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

This commit is contained in:
Christian Inci 2011-07-08 18:43:59 +02:00 committed by Alexandre Julliard
parent 94e057dde5
commit 309914f315
2 changed files with 6 additions and 2 deletions

View File

@ -3728,8 +3728,13 @@ static HKEY SETUPDI_OpenDrvKey(struct DeviceInfo *devInfo, REGSAM samDesired)
WCHAR devId[10];
sprintfW(devId, fmt, devInfo->devId);
RegOpenKeyExW(classKey, devId, 0, samDesired, &key);
l = RegOpenKeyExW(classKey, devId, 0, samDesired, &key);
RegCloseKey(classKey);
if (l)
{
SetLastError(ERROR_KEY_DOES_NOT_EXIST);
return INVALID_HANDLE_VALUE;
}
}
return key;
}

View File

@ -974,7 +974,6 @@ static void testDevRegKey(void)
key = pSetupDiOpenDevRegKey(set, &devInfo, DICS_FLAG_GLOBAL, 0,
DIREG_DRV, 0);
/* The software key isn't created by default */
todo_wine
ok(key == INVALID_HANDLE_VALUE &&
GetLastError() == ERROR_KEY_DOES_NOT_EXIST,
"Expected ERROR_KEY_DOES_NOT_EXIST, got %08x\n", GetLastError());