From 309914f315ff95b8b5af36e0cb76a5513bedbc73 Mon Sep 17 00:00:00 2001 From: Christian Inci Date: Fri, 8 Jul 2011 18:43:59 +0200 Subject: [PATCH] setupapi: Fix return behaviour when the device key doesn't exist. --- dlls/setupapi/devinst.c | 7 ++++++- dlls/setupapi/tests/devinst.c | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 91765549fe4..73a67ee6a0e 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -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; } diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index 3c01f320938..df4a407f5bf 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -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()); -- 2.11.4.GIT