Commit e4645d60 authored by Andrew Wesie's avatar Andrew Wesie Committed by Alexandre Julliard

setupapi: Fix SetupDiGetDeviceRegistryProperty if property does not exist.

parent 950b8a96
......@@ -3125,7 +3125,9 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyA(
LONG l = RegQueryValueExA(devInfo->key, PropertyMap[Property].nameA,
NULL, PropertyRegDataType, PropertyBuffer, &size);
if (l == ERROR_MORE_DATA || !PropertyBufferSize)
if (l == ERROR_FILE_NOT_FOUND)
SetLastError(ERROR_INVALID_DATA);
else if (l == ERROR_MORE_DATA || !PropertyBufferSize)
SetLastError(ERROR_INSUFFICIENT_BUFFER);
else if (!l)
ret = TRUE;
......@@ -3186,7 +3188,9 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(
LONG l = RegQueryValueExW(devInfo->key, PropertyMap[Property].nameW,
NULL, PropertyRegDataType, PropertyBuffer, &size);
if (l == ERROR_MORE_DATA || !PropertyBufferSize)
if (l == ERROR_FILE_NOT_FOUND)
SetLastError(ERROR_INVALID_DATA);
else if (l == ERROR_MORE_DATA || !PropertyBufferSize)
SetLastError(ERROR_INSUFFICIENT_BUFFER);
else if (!l)
ret = TRUE;
......
......@@ -1053,6 +1053,10 @@ static void testDeviceRegistryPropertyA(void)
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %08x\n", GetLastError());
ret = pSetupDiGetDeviceRegistryPropertyA(set, &devInfo, SPDRP_HARDWAREID,
NULL, NULL, 0, &size);
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %08x\n", GetLastError());
pSetupDiDestroyDeviceInfoList(set);
res = RegOpenKeyA(HKEY_LOCAL_MACHINE, bogus, &key);
......@@ -1158,6 +1162,10 @@ static void testDeviceRegistryPropertyW(void)
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %08x\n", GetLastError());
ret = pSetupDiGetDeviceRegistryPropertyW(set, &devInfo, SPDRP_HARDWAREID,
NULL, NULL, 0, &size);
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %08x\n", GetLastError());
pSetupDiDestroyDeviceInfoList(set);
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key);
......
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