Closed qmfrederik closed 4 years ago
I think the unit tests in this repo only run in a 32-bit process, correct?
Yes, but I should fix this: #486
For the sake of completeness, here's the source code for that test program, and the output when ran as a 32-bit or 64-bit program:
#include <iostream>
#include <Windows.h>
#include "setupapi.h"
int main()
{
printf("Bitness: 0x%p\n", sizeof(void*));
printf("\n");
printf("SP_DRVINFO_DETAIL_DATA size: 0x%p\n", sizeof(SP_DRVINFO_DETAIL_DATA));
printf("\n");
printf("SP_DRVINFO_DETAIL_DATA.cbSize @ 0x%p\n", offsetof(SP_DRVINFO_DETAIL_DATA, cbSize));
printf("SP_DRVINFO_DETAIL_DATA.InfDate @ 0x%p\n", offsetof(SP_DRVINFO_DETAIL_DATA, InfDate));
printf("SP_DRVINFO_DETAIL_DATA.CompatIDsOffset @ 0x%p\n", offsetof(SP_DRVINFO_DETAIL_DATA, CompatIDsOffset));
printf("SP_DRVINFO_DETAIL_DATA.CompatIDsLength @ 0x%p\n", offsetof(SP_DRVINFO_DETAIL_DATA, CompatIDsLength));
printf("SP_DRVINFO_DETAIL_DATA.Reserved @ 0x%p\n", offsetof(SP_DRVINFO_DETAIL_DATA, Reserved));
printf("SP_DRVINFO_DETAIL_DATA.SectionName @ 0x%p\n", offsetof(SP_DRVINFO_DETAIL_DATA, SectionName));
printf("SP_DRVINFO_DETAIL_DATA.InfFileName @ 0x%p\n", offsetof(SP_DRVINFO_DETAIL_DATA, InfFileName));
printf("SP_DRVINFO_DETAIL_DATA.DrvDescription @ 0x%p\n", offsetof(SP_DRVINFO_DETAIL_DATA, DrvDescription));
printf("SP_DRVINFO_DETAIL_DATA.HardwareID @ 0x%p\n", offsetof(SP_DRVINFO_DETAIL_DATA, HardwareID));
}
Bitness: 0x00000004
SP_DRVINFO_DETAIL_DATA size: 0x00000622
SP_DRVINFO_DETAIL_DATA.cbSize @ 0x00000000
SP_DRVINFO_DETAIL_DATA.InfDate @ 0x00000004
SP_DRVINFO_DETAIL_DATA.CompatIDsOffset @ 0x0000000C
SP_DRVINFO_DETAIL_DATA.CompatIDsLength @ 0x00000010
SP_DRVINFO_DETAIL_DATA.Reserved @ 0x00000014
SP_DRVINFO_DETAIL_DATA.SectionName @ 0x00000018
SP_DRVINFO_DETAIL_DATA.InfFileName @ 0x00000218
SP_DRVINFO_DETAIL_DATA.DrvDescription @ 0x00000420
SP_DRVINFO_DETAIL_DATA.HardwareID @ 0x00000620
Bitness: 0x0000000000000008
SP_DRVINFO_DETAIL_DATA size: 0x0000000000000630
SP_DRVINFO_DETAIL_DATA.cbSize @ 0x0000000000000000
SP_DRVINFO_DETAIL_DATA.InfDate @ 0x0000000000000004
SP_DRVINFO_DETAIL_DATA.CompatIDsOffset @ 0x000000000000000C
SP_DRVINFO_DETAIL_DATA.CompatIDsLength @ 0x0000000000000010
SP_DRVINFO_DETAIL_DATA.Reserved @ 0x0000000000000018
SP_DRVINFO_DETAIL_DATA.SectionName @ 0x0000000000000020
SP_DRVINFO_DETAIL_DATA.InfFileName @ 0x0000000000000220
SP_DRVINFO_DETAIL_DATA.DrvDescription @ 0x0000000000000428
SP_DRVINFO_DETAIL_DATA.HardwareID @ 0x0000000000000628
It doesn't answer the why but serves as a confirmation that the values in that unit test are correct.
@AArnott The
SP_DRVINFO_DETAIL_DATA
struct is a bit of a mystery to me. The code in this PR makes the tests pass on 32-bit and 64-bit Windows; but I'm not quite sure why the magic which is being done works/is required.As a sidenote, I think the unit tests in this repo only run in a 32-bit process, correct?