Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/setupapi/devinst.c | 120 ++++++++++++++++++++++++++++++++++++++++ dlls/setupapi/stubs.c | 12 ---- 2 files changed, 120 insertions(+), 12 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 32bcd0ed39..2d7cb99590 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -103,6 +103,13 @@ static const WCHAR Control[] = {'C','o','n','t','r','o','l',0}; static const WCHAR Linked[] = {'L','i','n','k','e','d',0}; static const WCHAR emptyW[] = {0};
+struct driver +{ + WCHAR inf_path[MAX_PATH]; + WCHAR manufacturer[LINE_LEN]; + WCHAR description[LINE_LEN]; +}; + /* is used to identify if a DeviceInfoSet pointer is valid or not */ #define SETUP_DEVICE_INFO_SET_MAGIC 0xd00ff056 @@ -127,6 +134,9 @@ struct device struct list entry; BOOL removed; SP_DEVINSTALL_PARAMS_W params; + struct driver *drivers; + unsigned int driver_count; + struct driver *selected_driver; };
struct device_iface @@ -4113,3 +4123,113 @@ BOOL WINAPI SetupDiRegisterCoDeviceInstallers(HDEVINFO dev, PSP_DEVINFO_DATA inf SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } + +/* Check whether the given hardware or compatible ID matches any of the device's + * own hardware or compatible IDs. */ +static BOOL device_matches_id(const struct device *device, const WCHAR *id_type, const WCHAR *id) +{ + WCHAR *device_ids; + const WCHAR *p; + DWORD size; + + if (!RegGetValueW(device->key, NULL, id_type, RRF_RT_REG_MULTI_SZ, NULL, NULL, &size)) + { + device_ids = heap_alloc(size); + if (!RegGetValueW(device->key, NULL, id_type, RRF_RT_REG_MULTI_SZ, NULL, device_ids, &size)) + { + for (p = device_ids; *p; p += strlenW(p) + 1) + { + if (!strcmpiW(p, id)) + { + heap_free(device_ids); + return TRUE; + } + } + } + heap_free(device_ids); + } + + return FALSE; +} + +static void enum_compat_drivers_from_file(struct device *device, const WCHAR *path) +{ + static const WCHAR manufacturerW[] = {'M','a','n','u','f','a','c','t','u','r','e','r',0}; + WCHAR mfg_name[LINE_LEN], mfg_key[LINE_LEN], mfg_key_ext[LINE_LEN], id[MAX_DEVICE_ID_LEN]; + INFCONTEXT ctx; + DWORD i, j, k; + HINF hinf; + + TRACE("Enumerating drivers from %s.\n", debugstr_w(path)); + + if ((hinf = SetupOpenInfFileW(path, NULL, INF_STYLE_WIN4, NULL)) == INVALID_HANDLE_VALUE) + return; + + for (i = 0; SetupGetLineByIndexW(hinf, manufacturerW, i, &ctx); ++i) + { + SetupGetStringFieldW(&ctx, 0, mfg_name, ARRAY_SIZE(mfg_name), NULL); + if (!SetupGetStringFieldW(&ctx, 1, mfg_key, ARRAY_SIZE(mfg_key), NULL)) + strcpyW(mfg_key, mfg_name); + + if (!SetupDiGetActualSectionToInstallW(hinf, mfg_key, mfg_key_ext, ARRAY_SIZE(mfg_key_ext), NULL, NULL)) + { + WARN("Failed to find section for %s, skipping.\n", debugstr_w(mfg_key)); + continue; + } + + for (j = 0; SetupGetLineByIndexW(hinf, mfg_key_ext, j, &ctx); ++j) + { + for (k = 2; SetupGetStringFieldW(&ctx, k, id, ARRAY_SIZE(id), NULL); ++k) + { + if (device_matches_id(device, HardwareId, id) || device_matches_id(device, CompatibleIDs, id)) + { + unsigned int count = ++device->driver_count; + + device->drivers = heap_realloc(device->drivers, count * sizeof(*device->drivers)); + strcpyW(device->drivers[count - 1].inf_path, path); + strcpyW(device->drivers[count - 1].manufacturer, mfg_name); + SetupGetStringFieldW(&ctx, 0, device->drivers[count - 1].description, + ARRAY_SIZE(device->drivers[count - 1].description), NULL); + + TRACE("Found compatible driver: manufacturer %s, desc %s.\n", + debugstr_w(mfg_name), debugstr_w(device->drivers[count - 1].description)); + } + } + } + } + + SetupCloseInfFile(hinf); +} + +/*********************************************************************** + * SetupDiBuildDriverInfoList (SETUPAPI.@) + */ +BOOL WINAPI SetupDiBuildDriverInfoList(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data, DWORD type) +{ + struct device *device; + + TRACE("devinfo %p, device_data %p, type %#x.\n", devinfo, device_data, type); + + if (type != SPDIT_COMPATDRIVER) + { + FIXME("Unhandled type %#x.\n", type); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; + } + + if (!(device = get_device(devinfo, device_data))) + return FALSE; + + if (device->params.Flags & DI_ENUMSINGLEINF) + { + enum_compat_drivers_from_file(device, device->params.DriverPath); + } + else + { + FIXME("Searching in a directory is not yet implemented.\n"); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; + } + + return TRUE; +} diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c index ede878f1de..1be10ced39 100644 --- a/dlls/setupapi/stubs.c +++ b/dlls/setupapi/stubs.c @@ -575,18 +575,6 @@ BOOL WINAPI SetupLogFileA( return FALSE; }
-/*********************************************************************** - * SetupDiBuildDriverInfoList (SETUPAPI.@) - */ - -BOOL WINAPI SetupDiBuildDriverInfoList(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD DriverType) - { - FIXME(": stub %p, %p, %d\n", DeviceInfoSet, DeviceInfoData, DriverType); - - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; - } - /*********************************************************************** * SetupDiDestroyDriverInfoList (SETUPAPI.@) */
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/setupapi/devinst.c | 44 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 2d7cb99590..1b93d4be74 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -4152,10 +4152,37 @@ static BOOL device_matches_id(const struct device *device, const WCHAR *id_type, return FALSE; }
+static BOOL version_is_compatible(const WCHAR *version) +{ + const WCHAR *machine_ext = NtPlatformExtension + 1, *p; + size_t len = strlenW(version); + BOOL wow64; + + /* We are only concerned with architecture. */ + if ((p = strchrW(version, '.'))) + len = p - version; + + if (!strncmpiW(version, NtExtension + 1, len)) + return TRUE; + + if (IsWow64Process(GetCurrentProcess(), &wow64) && wow64) + { +#ifdef __i386__ + static const WCHAR wow_ext[] = {'N','T','a','m','d','6','4',0}; + machine_ext = wow_ext; +#elif defined(__arm__) + static const WCHAR wow_ext[] = {'N','T','a','r','m','6','4',0}; + machine_ext = wow_ext; +#endif + } + + return !strncmpiW(version, machine_ext, len); +} + static void enum_compat_drivers_from_file(struct device *device, const WCHAR *path) { static const WCHAR manufacturerW[] = {'M','a','n','u','f','a','c','t','u','r','e','r',0}; - WCHAR mfg_name[LINE_LEN], mfg_key[LINE_LEN], mfg_key_ext[LINE_LEN], id[MAX_DEVICE_ID_LEN]; + WCHAR mfg_name[LINE_LEN], mfg_key[LINE_LEN], mfg_key_ext[LINE_LEN], id[MAX_DEVICE_ID_LEN], version[MAX_DEVICE_ID_LEN]; INFCONTEXT ctx; DWORD i, j, k; HINF hinf; @@ -4171,6 +4198,21 @@ static void enum_compat_drivers_from_file(struct device *device, const WCHAR *pa if (!SetupGetStringFieldW(&ctx, 1, mfg_key, ARRAY_SIZE(mfg_key), NULL)) strcpyW(mfg_key, mfg_name);
+ if (SetupGetFieldCount(&ctx) >= 2) + { + BOOL compatible = FALSE; + for (j = 2; SetupGetStringFieldW(&ctx, j, version, ARRAY_SIZE(version), NULL); ++j) + { + if (version_is_compatible(version)) + { + compatible = TRUE; + break; + } + } + if (!compatible) + continue; + } + if (!SetupDiGetActualSectionToInstallW(hinf, mfg_key, mfg_key_ext, ARRAY_SIZE(mfg_key_ext), NULL, NULL)) { WARN("Failed to find section for %s, skipping.\n", debugstr_w(mfg_key));
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/setupapi/devinst.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 1b93d4be74..b72ae7cf55 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -101,6 +101,7 @@ static const WCHAR Phantom[] = {'P','h','a','n','t','o','m',0}; static const WCHAR SymbolicLink[] = {'S','y','m','b','o','l','i','c','L','i','n','k',0}; static const WCHAR Control[] = {'C','o','n','t','r','o','l',0}; static const WCHAR Linked[] = {'L','i','n','k','e','d',0}; +static const WCHAR backslashW[] = {'\',0}; static const WCHAR emptyW[] = {0};
struct driver @@ -4268,9 +4269,32 @@ BOOL WINAPI SetupDiBuildDriverInfoList(HDEVINFO devinfo, SP_DEVINFO_DATA *device } else { - FIXME("Searching in a directory is not yet implemented.\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + static const WCHAR default_path[] = {'C',':','/','w','i','n','d','o','w','s','/','i','n','f',0}; + static const WCHAR wildcardW[] = {'*',0}; + WCHAR dir[MAX_PATH], file[MAX_PATH]; + WIN32_FIND_DATAW find_data; + HANDLE find_handle; + + if (device->params.DriverPath[0]) + strcpyW(dir, device->params.DriverPath); + else + strcpyW(dir, default_path); + strcatW(dir, backslashW); + strcatW(dir, wildcardW); + + TRACE("Searching for drivers in %s.\n", debugstr_w(dir)); + + if ((find_handle = FindFirstFileW(dir, &find_data)) != INVALID_HANDLE_VALUE) + { + do + { + strcpyW(file, dir); + strcpyW(file + strlenW(file) - 1, find_data.cFileName); + enum_compat_drivers_from_file(device, file); + } while (FindNextFileW(find_handle, &find_data)); + + FindClose(find_handle); + } }
return TRUE;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/setupapi/devinst.c | 67 +++++++++++++++++++++++++++++++++++++++++ dlls/setupapi/stubs.c | 22 -------------- 2 files changed, 67 insertions(+), 22 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index b72ae7cf55..11c12b125b 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -4299,3 +4299,70 @@ BOOL WINAPI SetupDiBuildDriverInfoList(HDEVINFO devinfo, SP_DEVINFO_DATA *device
return TRUE; } + +/*********************************************************************** + * SetupDiEnumDriverInfoW (SETUPAPI.@) + */ +BOOL WINAPI SetupDiEnumDriverInfoW(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data, + DWORD type, DWORD index, SP_DRVINFO_DATA_W *driver_data) +{ + static const WCHAR providerW[] = {'P','r','o','v','i','d','e','r',0}; + struct device *device; + INFCONTEXT ctx; + HINF hinf; + + TRACE("devinfo %p, device_data %p, type %#x, index %u, driver_data %p.\n", + devinfo, device_data, type, index, driver_data); + + if (type != SPDIT_COMPATDRIVER) + { + FIXME("Unhandled type %#x.\n", type); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; + } + + if (!(device = get_device(devinfo, device_data))) + return FALSE; + + if (index >= device->driver_count) + { + SetLastError(ERROR_NO_MORE_ITEMS); + return FALSE; + } + + if ((hinf = SetupOpenInfFileW(device->drivers[index].inf_path, NULL, INF_STYLE_WIN4, NULL)) == INVALID_HANDLE_VALUE) + return FALSE; + + driver_data->ProviderName[0] = 0; + if (SetupFindFirstLineW(hinf, Version, providerW, &ctx)) + SetupGetStringFieldW(&ctx, 1, driver_data->ProviderName, ARRAY_SIZE(driver_data->ProviderName), NULL); + strcpyW(driver_data->Description, device->drivers[index].description); + strcpyW(driver_data->MfgName, device->drivers[index].manufacturer); + driver_data->DriverType = SPDIT_COMPATDRIVER; + + SetupCloseInfFile(hinf); + + return TRUE; +} + +/*********************************************************************** + * SetupDiEnumDriverInfoA (SETUPAPI.@) + */ +BOOL WINAPI SetupDiEnumDriverInfoA(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data, + DWORD type, DWORD index, SP_DRVINFO_DATA_A *driver_data) +{ + SP_DRVINFO_DATA_W driver_dataW; + BOOL ret; + + driver_dataW.cbSize = sizeof(driver_dataW); + ret = SetupDiEnumDriverInfoW(devinfo, device_data, type, index, &driver_dataW); + driver_data->DriverType = driver_dataW.DriverType; + driver_data->Reserved = driver_dataW.Reserved; + WideCharToMultiByte(CP_ACP, 0, driver_dataW.Description, -1, driver_data->Description, + sizeof(driver_data->Description), NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, driver_dataW.MfgName, -1, driver_data->MfgName, + sizeof(driver_data->MfgName), NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, driver_dataW.ProviderName, -1, driver_data->ProviderName, + sizeof(driver_data->ProviderName), NULL, NULL); + return ret; +} diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c index 1be10ced39..c2ac2a4892 100644 --- a/dlls/setupapi/stubs.c +++ b/dlls/setupapi/stubs.c @@ -641,28 +641,6 @@ BOOL WINAPI SetupDiSetSelectedDevice(HDEVINFO SetupDiSetSelectedDevice, PSP_DEVI return TRUE; }
-/*********************************************************************** - * SetupDiEnumDriverInfoA (SETUPAPI.@) - */ -BOOL WINAPI SetupDiEnumDriverInfoA(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD DriverType, DWORD MemberIndex, PSP_DRVINFO_DATA_A DriverInfoData) -{ - FIXME("(%p, %p, 0x%x, %u, %p stub\n", DeviceInfoSet, DeviceInfoData, DriverType, MemberIndex, DriverInfoData); - - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -/*********************************************************************** - * SetupDiEnumDriverInfoW (SETUPAPI.@) - */ -BOOL WINAPI SetupDiEnumDriverInfoW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD DriverType, DWORD MemberIndex, PSP_DRVINFO_DATA_W DriverInfoData) -{ - FIXME("(%p, %p, 0x%x, %u, %p stub\n", DeviceInfoSet, DeviceInfoData, DriverType, MemberIndex, DriverInfoData); - - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - /*********************************************************************** * CM_Request_Device_EjectA (SETUPAPI.@) */
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/setupapi/tests/devinst.c | 234 ++++++++++++++++++++++++++++++++++ 1 file changed, 234 insertions(+)
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index d2a32fc623..a717bc08c6 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -41,6 +41,8 @@ static GUID guid2 = {0x6a55b5a5, 0x3f65, 0x11db, {0xb7,0x04,0x00,0x11,0x95,0x5c, BOOL (WINAPI *pSetupDiSetDevicePropertyW)(HDEVINFO, PSP_DEVINFO_DATA, const DEVPROPKEY *, DEVPROPTYPE, const BYTE *, DWORD, DWORD); BOOL (WINAPI *pSetupDiGetDevicePropertyW)(HDEVINFO, PSP_DEVINFO_DATA, const DEVPROPKEY *, DEVPROPTYPE *, BYTE *, DWORD, DWORD *, DWORD);
+static BOOL wow64; + static void create_file(const char *name, const char *data) { HANDLE file; @@ -2115,8 +2117,236 @@ static void test_get_actual_section(void) ok(ret, "Failed to delete %s, error %u.\n", inf_path, GetLastError()); }
+static void test_driver_list(void) +{ + char inf_dir[MAX_PATH], inf_path[MAX_PATH], inf_path2[MAX_PATH]; + static const char hardware_id[] = "bogus_hardware_id\0"; + static const char compat_id[] = "bogus_compat_id\0"; + SP_DEVINSTALL_PARAMS_A params = {sizeof(params)}; + SP_DRVINFO_DATA_A driver = {sizeof(driver)}; + SP_DEVINFO_DATA device = {sizeof(device)}; + HDEVINFO set; + BOOL ret; + + static const char inf_data[] = "[Version]\n" + "Signature="$Chicago$"\n" + "ClassGuid={6a55b5a4-3f65-11db-b704-0011955c2bdb}\n" + "[Manufacturer]\n" + "mfg1=mfg1_key,NT" MYEXT "\n" + "mfg2=mfg2_key,NT" MYEXT "\n" + "mfg1_wow=mfg1_key,NT" WOWEXT "\n" + "mfg2_wow=mfg2_key,NT" WOWEXT "\n" + "mfg3=mfg3_key,NT" WRONGEXT "\n" + "[mfg1_key.nt" MYEXT "]\n" + "desc1=,bogus_hardware_id\n" + "desc2=,bogus_hardware_id\n" + "desc3=,wrong_hardware_id\n" + "desc4=,wrong_hardware_id,bogus_compat_id\n" + "[mfg1_key.nt" WOWEXT "]\n" + "desc1=,bogus_hardware_id\n" + "desc2=,bogus_hardware_id\n" + "desc3=,wrong_hardware_id\n" + "desc4=,wrong_hardware_id,bogus_compat_id\n" + "[mfg2_key.nt" MYEXT "]\n" + "desc5=,bogus_hardware_id\n" + "[mfg2_key.nt" WOWEXT "]\n" + "desc5=,bogus_hardware_id\n" + "[mfg3_key.nt" WRONGEXT "]\n" + "desc6=,bogus_hardware_id\n"; + + static const char inf_data_file1[] = "[Version]\n" + "Signature="$Chicago$"\n" + "ClassGuid={6a55b5a4-3f65-11db-b704-0011955c2bdb}\n" + "[Manufacturer]\n" + "mfg1=mfg1_key,NT" MYEXT ",NT" WOWEXT "\n" + "[mfg1_key.nt" MYEXT "]\n" + "desc1=,bogus_hardware_id\n" + "[mfg1_key.nt" WOWEXT "]\n" + "desc1=,bogus_hardware_id\n"; + + static const char inf_data_file2[] = "[Version]\n" + "Signature="$Chicago$"\n" + "ClassGuid={6a55b5a5-3f65-11db-b704-0011955c2bdb}\n" + "[Manufacturer]\n" + "mfg1=mfg1_key,NT" MYEXT ",NT" WOWEXT "\n" + "[mfg1_key.nt" MYEXT "]\n" + "desc2=,bogus_hardware_id\n" + "[mfg1_key.nt" WOWEXT "]\n" + "desc2=,bogus_hardware_id\n"; + + GetTempPathA(sizeof(inf_path), inf_path); + strcat(inf_path, "setupapi_test.inf"); + create_file(inf_path, inf_data); + set = SetupDiCreateDeviceInfoList(NULL, NULL); + ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError()); + ret = SetupDiCreateDeviceInfoA(set, "Root\BOGUS\0000", &GUID_NULL, NULL, NULL, 0, &device); + ok(ret, "Failed to create device, error %#x.\n", GetLastError()); + + ret = SetupDiSetDeviceRegistryPropertyA(set, &device, SPDRP_HARDWAREID, + (const BYTE *)hardware_id, sizeof(hardware_id)); + ok(ret, "Failed to set hardware ID, error %#x.\n", GetLastError()); + + ret = SetupDiSetDeviceRegistryPropertyA(set, &device, SPDRP_COMPATIBLEIDS, + (const BYTE *)compat_id, sizeof(compat_id)); + ok(ret, "Failed to set hardware ID, error %#x.\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 0, &driver); + ok(!ret, "Expected failure.\n"); + ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#x.\n", GetLastError()); + + ret = SetupDiGetDeviceInstallParamsA(set, &device, ¶ms); + ok(ret, "Failed to get device install params, error %#x.\n", GetLastError()); + strcpy(params.DriverPath, inf_path); + params.Flags = DI_ENUMSINGLEINF; + ret = SetupDiSetDeviceInstallParamsA(set, &device, ¶ms); + ok(ret, "Failed to set device install params, error %#x.\n", GetLastError()); + + ret = SetupDiBuildDriverInfoList(set, &device, SPDIT_COMPATDRIVER); + ok(ret, "Failed to build driver list, error %#x.\n", GetLastError()); + + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 0, &driver); + ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError()); + ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType); + ok(!strcmp(driver.Description, "desc1"), "Got wrong description '%s'.\n", driver.Description); + ok(!strcmp(driver.MfgName, wow64 ? "mfg1_wow" : "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName); + ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName); + + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 1, &driver); + ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError()); + ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType); + ok(!strcmp(driver.Description, "desc2"), "Got wrong description '%s'.\n", driver.Description); + ok(!strcmp(driver.MfgName, wow64 ? "mfg1_wow" : "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName); + ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName); + + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 2, &driver); + ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError()); + ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType); + ok(!strcmp(driver.Description, "desc4"), "Got wrong description '%s'.\n", driver.Description); + ok(!strcmp(driver.MfgName, wow64 ? "mfg1_wow" : "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName); + ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName); + + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 3, &driver); + ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError()); + ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType); + ok(!strcmp(driver.Description, "desc5"), "Got wrong description '%s'.\n", driver.Description); + ok(!strcmp(driver.MfgName, wow64 ? "mfg2_wow" : "mfg2"), "Got wrong manufacturer '%s'.\n", driver.MfgName); + ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName); + + SetLastError(0xdeadbeef); + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 4, &driver); + ok(!ret, "Expected failure.\n"); + ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#x.\n", GetLastError()); + + SetupDiDestroyDeviceInfoList(set); + ret = DeleteFileA(inf_path); + ok(ret, "Failed to delete %s, error %u.\n", inf_path, GetLastError()); + + /* Test building from a path. */ + + GetTempPathA(sizeof(inf_dir), inf_dir); + strcat(inf_dir, "setupapi_test"); + ret = CreateDirectoryA(inf_dir, NULL); + ok(ret, "Failed to create directory, error %u.\n", GetLastError()); + sprintf(inf_path, "%s/test1.inf", inf_dir); + create_file(inf_path, inf_data_file1); + sprintf(inf_path2, "%s/test2.inf", inf_dir); + create_file(inf_path2, inf_data_file2); + + set = SetupDiCreateDeviceInfoList(NULL, NULL); + ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError()); + ret = SetupDiCreateDeviceInfoA(set, "Root\BOGUS\0000", &GUID_NULL, NULL, NULL, 0, &device); + ok(ret, "Failed to create device, error %#x.\n", GetLastError()); + + ret = SetupDiSetDeviceRegistryPropertyA(set, &device, SPDRP_HARDWAREID, + (const BYTE *)hardware_id, sizeof(hardware_id)); + ok(ret, "Failed to set hardware ID, error %#x.\n", GetLastError()); + + ret = SetupDiGetDeviceInstallParamsA(set, &device, ¶ms); + ok(ret, "Failed to get device install params, error %#x.\n", GetLastError()); + strcpy(params.DriverPath, inf_dir); + ret = SetupDiSetDeviceInstallParamsA(set, &device, ¶ms); + ok(ret, "Failed to set device install params, error %#x.\n", GetLastError()); + + ret = SetupDiBuildDriverInfoList(set, &device, SPDIT_COMPATDRIVER); + ok(ret, "Failed to build driver list, error %#x.\n", GetLastError()); + + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 0, &driver); + ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError()); + ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType); + ok(!strcmp(driver.Description, "desc1"), "Got wrong description '%s'.\n", driver.Description); + ok(!strcmp(driver.MfgName, "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName); + ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName); + + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 1, &driver); + ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError()); + ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType); + ok(!strcmp(driver.Description, "desc2"), "Got wrong description '%s'.\n", driver.Description); + ok(!strcmp(driver.MfgName, "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName); + ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName); + + SetLastError(0xdeadbeef); + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 2, &driver); + ok(!ret, "Expected failure.\n"); + ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#x.\n", GetLastError()); + + SetupDiDestroyDeviceInfoList(set); + ret = DeleteFileA(inf_path); + ok(ret, "Failed to delete %s, error %u.\n", inf_path, GetLastError()); + ret = DeleteFileA(inf_path2); + ok(ret, "Failed to delete %s, error %u.\n", inf_path2, GetLastError()); + ret = RemoveDirectoryA(inf_dir); + ok(ret, "Failed to delete %s, error %u.\n", inf_dir, GetLastError()); + + /* Test the default path. */ + + create_file("C:/windows/inf/wine_test1.inf", inf_data_file1); + create_file("C:/windows/inf/wine_test2.inf", inf_data_file2); + + set = SetupDiCreateDeviceInfoList(NULL, NULL); + ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError()); + ret = SetupDiCreateDeviceInfoA(set, "Root\BOGUS\0000", &GUID_NULL, NULL, NULL, 0, &device); + ok(ret, "Failed to create device, error %#x.\n", GetLastError()); + + ret = SetupDiSetDeviceRegistryPropertyA(set, &device, SPDRP_HARDWAREID, + (const BYTE *)hardware_id, sizeof(hardware_id)); + ok(ret, "Failed to set hardware ID, error %#x.\n", GetLastError()); + + ret = SetupDiBuildDriverInfoList(set, &device, SPDIT_COMPATDRIVER); + ok(ret, "Failed to build driver list, error %#x.\n", GetLastError()); + + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 0, &driver); + ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError()); + ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType); + ok(!strcmp(driver.Description, "desc1"), "Got wrong description '%s'.\n", driver.Description); + ok(!strcmp(driver.MfgName, "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName); + ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName); + + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 1, &driver); + ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError()); + ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType); + ok(!strcmp(driver.Description, "desc2"), "Got wrong description '%s'.\n", driver.Description); + ok(!strcmp(driver.MfgName, "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName); + ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName); + + SetLastError(0xdeadbeef); + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 2, &driver); + ok(!ret, "Expected failure.\n"); + ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#x.\n", GetLastError()); + + SetupDiDestroyDeviceInfoList(set); + ret = DeleteFileA("C:/windows/inf/wine_test1.inf"); + ok(ret, "Failed to delete %s, error %u.\n", inf_path, GetLastError()); + ret = DeleteFileA("C:/windows/inf/wine_test2.inf"); + ok(ret, "Failed to delete %s, error %u.\n", inf_path2, GetLastError()); + /* Windows "precompiles" INF files in this dir; try to avoid leaving them behind. */ + DeleteFileA("C:/windows/inf/wine_test1.pnf"); + DeleteFileA("C:/windows/inf/wine_test2.pnf"); +} + START_TEST(devinst) { + static BOOL (WINAPI *pIsWow64Process)(HANDLE, BOOL *); HKEY hkey;
test_get_actual_section(); @@ -2128,6 +2358,9 @@ START_TEST(devinst) } RegCloseKey(hkey);
+ pIsWow64Process = (void *)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsWow64Process"); + if (pIsWow64Process) pIsWow64Process(GetCurrentProcess(), &wow64); + test_create_device_list_ex(); test_open_class_key(); test_install_class(); @@ -2146,4 +2379,5 @@ START_TEST(devinst) test_devnode(); test_device_interface_key(); test_device_install_params(); + test_driver_list(); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=52591
Your paranoid android.
=== w1064v1809 (32 bit report) ===
setupapi: devinst: Timeout
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/setupapi/devinst.c | 14 ++++++++++++++ dlls/setupapi/tests/devinst.c | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 11c12b125b..25bde67752 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -4297,6 +4297,20 @@ BOOL WINAPI SetupDiBuildDriverInfoList(HDEVINFO devinfo, SP_DEVINFO_DATA *device } }
+ if (device->driver_count) + { + WCHAR classname[MAX_CLASS_NAME_LEN], guidstr[39]; + GUID class; + + if (SetupDiGetINFClassW(device->drivers[0].inf_path, &class, classname, ARRAY_SIZE(classname), NULL)) + { + device_data->ClassGuid = device->class = class; + SETUPDI_GuidToString(&class, guidstr); + RegSetValueExW(device->key, ClassGUID, 0, REG_SZ, (BYTE *)guidstr, sizeof(guidstr)); + RegSetValueExW(device->key, Class, 0, REG_SZ, (BYTE *)classname, strlenW(classname) * sizeof(WCHAR)); + } + } + return TRUE; }
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index a717bc08c6..73fdcb1283 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -2125,12 +2125,14 @@ static void test_driver_list(void) SP_DEVINSTALL_PARAMS_A params = {sizeof(params)}; SP_DRVINFO_DATA_A driver = {sizeof(driver)}; SP_DEVINFO_DATA device = {sizeof(device)}; + char buffer[39]; HDEVINFO set; BOOL ret;
static const char inf_data[] = "[Version]\n" "Signature="$Chicago$"\n" "ClassGuid={6a55b5a4-3f65-11db-b704-0011955c2bdb}\n" + "Class=wine test class 1\n" "[Manufacturer]\n" "mfg1=mfg1_key,NT" MYEXT "\n" "mfg2=mfg2_key,NT" MYEXT "\n" @@ -2157,6 +2159,7 @@ static void test_driver_list(void) static const char inf_data_file1[] = "[Version]\n" "Signature="$Chicago$"\n" "ClassGuid={6a55b5a4-3f65-11db-b704-0011955c2bdb}\n" + "Class=wine test class 1\n" "[Manufacturer]\n" "mfg1=mfg1_key,NT" MYEXT ",NT" WOWEXT "\n" "[mfg1_key.nt" MYEXT "]\n" @@ -2167,6 +2170,7 @@ static void test_driver_list(void) static const char inf_data_file2[] = "[Version]\n" "Signature="$Chicago$"\n" "ClassGuid={6a55b5a5-3f65-11db-b704-0011955c2bdb}\n" + "Class=wine test class 2\n" "[Manufacturer]\n" "mfg1=mfg1_key,NT" MYEXT ",NT" WOWEXT "\n" "[mfg1_key.nt" MYEXT "]\n" @@ -2205,6 +2209,14 @@ static void test_driver_list(void) ret = SetupDiBuildDriverInfoList(set, &device, SPDIT_COMPATDRIVER); ok(ret, "Failed to build driver list, error %#x.\n", GetLastError());
+ ok(IsEqualGUID(&device.ClassGuid, &guid), "Got unexpected class %s.\n", wine_dbgstr_guid(&device.ClassGuid)); + ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_CLASSGUID, NULL, (BYTE *)buffer, sizeof(buffer), NULL); + ok(ret, "Failed to get class GUID, error %#x.\n", GetLastError()); + ok(!strcasecmp(buffer, "{6a55b5a4-3f65-11db-b704-0011955c2bdb}"), "Got unexpected class %s.\n", buffer); + ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_CLASS, NULL, (BYTE *)buffer, sizeof(buffer), NULL); + ok(ret, "Failed to get class GUID, error %#x.\n", GetLastError()); + ok(!strcmp(buffer, "wine test class 1"), "Got unexpected class %s.\n", buffer); + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 0, &driver); ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError()); ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType); @@ -2271,6 +2283,14 @@ static void test_driver_list(void) ret = SetupDiBuildDriverInfoList(set, &device, SPDIT_COMPATDRIVER); ok(ret, "Failed to build driver list, error %#x.\n", GetLastError());
+ ok(IsEqualGUID(&device.ClassGuid, &guid), "Got unexpected class %s.\n", wine_dbgstr_guid(&device.ClassGuid)); + ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_CLASSGUID, NULL, (BYTE *)buffer, sizeof(buffer), NULL); + ok(ret, "Failed to get class GUID, error %#x.\n", GetLastError()); + ok(!strcasecmp(buffer, "{6a55b5a4-3f65-11db-b704-0011955c2bdb}"), "Got unexpected class %s.\n", buffer); + ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_CLASS, NULL, (BYTE *)buffer, sizeof(buffer), NULL); + ok(ret, "Failed to get class GUID, error %#x.\n", GetLastError()); + ok(!strcmp(buffer, "wine test class 1"), "Got unexpected class %s.\n", buffer); + ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 0, &driver); ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError()); ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=52592
Your paranoid android.
=== wvistau64 (32 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== wvistau64_zh_CN (32 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== wvistau64_fr (32 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== wvistau64_he (32 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== w2008s64 (32 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== w7u (32 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== w7pro64 (32 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== w8 (32 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== w864 (32 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== w1064v1507 (32 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== w1064v1809 (32 bit report) ===
setupapi: devinst: Timeout
=== wvistau64 (64 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== w2008s64 (64 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== w7pro64 (64 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== w864 (64 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== w1064v1507 (64 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
=== w1064v1809 (64 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
On 5/21/19 12:41 AM, Marvin wrote:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=52592
Your paranoid android.
=== wvistau64 (32 bit report) ===
setupapi: devinst.c:2207: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2209: Test failed: Failed to get class GUID, error 0xd. devinst.c:2210: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2281: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}. devinst.c:2283: Test failed: Failed to get class GUID, error 0xd. devinst.c:2284: Test failed: Got unexpected class {00000000-0000-0000-0000-000000000000}.
Clearly this must be set at a later point in Vista+; I'll do some more testing. The series should hopefully be acceptable without this patch.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/setupapi/devinst.c | 26 ++++++++++++++++++++++++++ dlls/setupapi/stubs.c | 11 ----------- 2 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 25bde67752..a864cdde73 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -4380,3 +4380,29 @@ BOOL WINAPI SetupDiEnumDriverInfoA(HDEVINFO devinfo, SP_DEVINFO_DATA *device_dat sizeof(driver_data->ProviderName), NULL, NULL); return ret; } + +/*********************************************************************** + * SetupDiSelectBestCompatDrv (SETUPAPI.@) + */ +BOOL WINAPI SetupDiSelectBestCompatDrv(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data) +{ + struct device *device; + + TRACE("devinfo %p, device_data %p.\n", devinfo, device_data); + + if (!(device = get_device(devinfo, device_data))) + return FALSE; + + if (!device->driver_count) + { + ERR("No compatible drivers were enumerated for device %s.\n", debugstr_w(device->instanceId)); + SetLastError(ERROR_NO_COMPAT_DRIVERS); + return FALSE; + } + + WARN("Semi-stub, selecting the first available driver.\n"); + + device->selected_driver = &device->drivers[0]; + + return TRUE; +} diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c index c2ac2a4892..e6d1f1a0ce 100644 --- a/dlls/setupapi/stubs.c +++ b/dlls/setupapi/stubs.c @@ -620,17 +620,6 @@ BOOL WINAPI SetupDiLoadClassIcon(const GUID *ClassGuid, HICON *LargeIcon, PINT M return FALSE; }
-/*********************************************************************** - * SetupDiSelectBestCompatDrv (SETUPAPI.@) - */ -BOOL WINAPI SetupDiSelectBestCompatDrv(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData) -{ - FIXME(": stub %p, %p\n", DeviceInfoSet, DeviceInfoData); - - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - /*********************************************************************** * SetupDiSetSelectedDevice (SETUPAPI.@) */