| 473 | } |
| 474 | |
| 475 | const char *getVGAadapter(HDEVINFO DeviceInfoSet, SP_DEVINFO_DATA *did_out) |
| 476 | { |
| 477 | static char hwid_str[1000]; |
| 478 | int DeviceIndex = 0; |
| 479 | SP_DEVINFO_DATA DeviceInfoData; |
| 480 | if(DeviceInfoSet) |
| 481 | { |
| 482 | ZeroMemory(&DeviceInfoData, sizeof(SP_DEVINFO_DATA)); |
| 483 | DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); |
| 484 | DeviceIndex = 0; |
| 485 | |
| 486 | while(DYN(SetupDiEnumDeviceInfo)(DeviceInfoSet, DeviceIndex, &DeviceInfoData)) |
| 487 | { |
| 488 | if(DYN(SetupDiGetDeviceRegistryPropertyA)(DeviceInfoSet, &DeviceInfoData, SPDRP_HARDWAREID, NULL, (PBYTE)&(hwid_str[0]), sizeof(hwid_str), NULL)) |
| 489 | { |
| 490 | vga_device_t dev; |
| 491 | |
| 492 | // NOTE: hwid_str is REG_MULTI_SZ = multi strings reparated by \0 and terminated by \0\0 (to string is empty) |
| 493 | char *hwid_str_ptr = hwid_str; |
| 494 | |
| 495 | while(hwid_str_ptr[0] != '\0') |
| 496 | { |
| 497 | if(device_parse(hwid_str_ptr, &dev)) |
| 498 | { |
| 499 | const char *section = device_ini_get(&dev, "inf"); |
| 500 | if(section != NULL) |
| 501 | { |
| 502 | memcpy(did_out, &DeviceInfoData, sizeof(SP_DEVINFO_DATA)); |
| 503 | return section; |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | size_t strsize = strlen(hwid_str_ptr)+1; |
| 508 | hwid_str_ptr += strsize; |
| 509 | } |
| 510 | } |
| 511 | DeviceIndex++; |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | return NULL; |
| 516 | } |
| 517 | |
| 518 | static DWORD checkInstallatioListLookup(HDEVINFO DeviceInfoSet) |
| 519 | { |
no test coverage detected