diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index ebfeee0e247..75cb38b43c6 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -2650,20 +2650,31 @@ HKEY WINAPI SetupDiCreateDeviceInterfaceRegKeyW( samDesired, NULL, &interfKey, NULL); if (!l) { - if (instancePath) - { - LONG l; + struct DeviceInfo *devInfo = + (struct DeviceInfo *)ifaceInfo->device->Reserved; - l = RegCreateKeyExW(interfKey, instancePath, 0, NULL, 0, - samDesired, NULL, &key, NULL); - if (l) + l = RegSetValueExW(interfKey, DeviceInstance, 0, REG_SZ, + (BYTE *)devInfo->instanceId, + (lstrlenW(devInfo->instanceId) + 1) * sizeof(WCHAR)); + if (!l) + { + if (instancePath) { - SetLastError(l); - key = INVALID_HANDLE_VALUE; + LONG l; + + l = RegCreateKeyExW(interfKey, instancePath, 0, NULL, 0, + samDesired, NULL, &key, NULL); + if (l) + { + SetLastError(l); + key = INVALID_HANDLE_VALUE; + } + else if (InfHandle) + FIXME("INF section installation unsupported\n"); } - else if (InfHandle) - FIXME("INF section installation unsupported\n"); } + else + SetLastError(l); RegCloseKey(interfKey); } else diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index af98eb22856..7f63afcc1df 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -816,7 +816,6 @@ static void testRegisterAndGetDetail(void) SetLastError(0xdeadbeef); ret = pSetupDiEnumDeviceInterfaces(set, NULL, &guid, 0, &interfaceData); - todo_wine ok(ret, "SetupDiEnumDeviceInterfaces failed: %08x\n", GetLastError()); SetLastError(0xdeadbeef); ret = pSetupDiGetDeviceInterfaceDetailA(set, &interfaceData, NULL, 0, &dwSize, NULL); @@ -836,7 +835,6 @@ static void testRegisterAndGetDetail(void) ret = pSetupDiGetDeviceInterfaceDetailA(set, &interfaceData, detail, dwSize, &dwSize, NULL); ok(ret, "SetupDiGetDeviceInterfaceDetailA failed: %08x\n", GetLastError()); - todo_wine ok(!lstrcmpiA(path, detail->DevicePath), "Unexpected path %s\n", detail->DevicePath); HeapFree(GetProcessHeap(), 0, detail);