Christian Inci : setupapi: Fix return behaviour when the device key doesn' t exist.
Alexandre Julliard
julliard at winehq.org
Mon Jul 11 13:17:45 CDT 2011
Module: wine
Branch: master
Commit: 309914f315ff95b8b5af36e0cb76a5513bedbc73
URL: http://source.winehq.org/git/wine.git/?a=commit;h=309914f315ff95b8b5af36e0cb76a5513bedbc73
Author: Christian Inci <chris.pcguy.inci at gmail.com>
Date: Fri Jul 8 18:43:59 2011 +0200
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 9176554..73a67ee 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 3c01f32..df4a407 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());
More information about the wine-cvs
mailing list