setupapi: Fix SetupDiGetDeviceRegistryProperty if property does not exist.
Signed-off-by: Andrew Wesie <awesie@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
950b8a9699
commit
e4645d60d7
|
@ -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;
|
||||
|
|
|
@ -1051,6 +1051,10 @@ static void testDeviceRegistryPropertyA(void)
|
|||
ret = pSetupDiGetDeviceRegistryPropertyA(set, &devInfo, SPDRP_FRIENDLYNAME,
|
||||
NULL, (PBYTE)buf, buflen, &size);
|
||||
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);
|
||||
|
@ -1156,6 +1160,10 @@ static void testDeviceRegistryPropertyW(void)
|
|||
ret = pSetupDiGetDeviceRegistryPropertyW(set, &devInfo, SPDRP_FRIENDLYNAME,
|
||||
NULL, (PBYTE)buf, buflen, &size);
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue