Commit 309914f3 authored by Christian Inci's avatar Christian Inci Committed by Alexandre Julliard

setupapi: Fix return behaviour when the device key doesn't exist.

parent 94e057dd
...@@ -3728,8 +3728,13 @@ static HKEY SETUPDI_OpenDrvKey(struct DeviceInfo *devInfo, REGSAM samDesired) ...@@ -3728,8 +3728,13 @@ static HKEY SETUPDI_OpenDrvKey(struct DeviceInfo *devInfo, REGSAM samDesired)
WCHAR devId[10]; WCHAR devId[10];
sprintfW(devId, fmt, devInfo->devId); sprintfW(devId, fmt, devInfo->devId);
RegOpenKeyExW(classKey, devId, 0, samDesired, &key); l = RegOpenKeyExW(classKey, devId, 0, samDesired, &key);
RegCloseKey(classKey); RegCloseKey(classKey);
if (l)
{
SetLastError(ERROR_KEY_DOES_NOT_EXIST);
return INVALID_HANDLE_VALUE;
}
} }
return key; return key;
} }
......
...@@ -974,7 +974,6 @@ static void testDevRegKey(void) ...@@ -974,7 +974,6 @@ static void testDevRegKey(void)
key = pSetupDiOpenDevRegKey(set, &devInfo, DICS_FLAG_GLOBAL, 0, key = pSetupDiOpenDevRegKey(set, &devInfo, DICS_FLAG_GLOBAL, 0,
DIREG_DRV, 0); DIREG_DRV, 0);
/* The software key isn't created by default */ /* The software key isn't created by default */
todo_wine
ok(key == INVALID_HANDLE_VALUE && ok(key == INVALID_HANDLE_VALUE &&
GetLastError() == ERROR_KEY_DOES_NOT_EXIST, GetLastError() == ERROR_KEY_DOES_NOT_EXIST,
"Expected ERROR_KEY_DOES_NOT_EXIST, got %08x\n", GetLastError()); "Expected ERROR_KEY_DOES_NOT_EXIST, got %08x\n", GetLastError());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment