setupapi: SetupDiGetDeviceRegistryProperty should return ERROR_INSUFFICIENT_BUFFER when buffer size is insufficient.
This commit is contained in:
parent
68f12e32a8
commit
85861a4999
|
@ -3118,14 +3118,14 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyA(
|
||||||
LONG l = RegQueryValueExA(devInfo->key, PropertyMap[Property].nameA,
|
LONG l = RegQueryValueExA(devInfo->key, PropertyMap[Property].nameA,
|
||||||
NULL, PropertyRegDataType, PropertyBuffer, &size);
|
NULL, PropertyRegDataType, PropertyBuffer, &size);
|
||||||
|
|
||||||
if (RequiredSize)
|
if (l == ERROR_MORE_DATA || !PropertyBufferSize)
|
||||||
*RequiredSize = size;
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||||
if (!PropertyBuffer)
|
|
||||||
; /* do nothing, ret is already FALSE, last error is already set */
|
|
||||||
else if (!l)
|
else if (!l)
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
else
|
else
|
||||||
SetLastError(l);
|
SetLastError(l);
|
||||||
|
if (RequiredSize)
|
||||||
|
*RequiredSize = size;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -3174,14 +3174,14 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(
|
||||||
LONG l = RegQueryValueExW(devInfo->key, PropertyMap[Property].nameW,
|
LONG l = RegQueryValueExW(devInfo->key, PropertyMap[Property].nameW,
|
||||||
NULL, PropertyRegDataType, PropertyBuffer, &size);
|
NULL, PropertyRegDataType, PropertyBuffer, &size);
|
||||||
|
|
||||||
if (RequiredSize)
|
if (l == ERROR_MORE_DATA || !PropertyBufferSize)
|
||||||
*RequiredSize = size;
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||||
if (!PropertyBuffer)
|
|
||||||
; /* do nothing, ret is already FALSE, last error is already set */
|
|
||||||
else if (!l)
|
else if (!l)
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
else
|
else
|
||||||
SetLastError(l);
|
SetLastError(l);
|
||||||
|
if (RequiredSize)
|
||||||
|
*RequiredSize = size;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -923,7 +923,6 @@ static void testDeviceRegistryPropertyA()
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = pSetupDiGetDeviceRegistryPropertyA(set, &devInfo, SPDRP_FRIENDLYNAME,
|
ret = pSetupDiGetDeviceRegistryPropertyA(set, &devInfo, SPDRP_FRIENDLYNAME,
|
||||||
NULL, NULL, 0, &size);
|
NULL, NULL, 0, &size);
|
||||||
todo_wine
|
|
||||||
ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||||
"Expected ERROR_INSUFFICIENT_BUFFER, got %08x\n", GetLastError());
|
"Expected ERROR_INSUFFICIENT_BUFFER, got %08x\n", GetLastError());
|
||||||
ok(buflen == size, "Unexpected size: %d\n", size);
|
ok(buflen == size, "Unexpected size: %d\n", size);
|
||||||
|
@ -1018,7 +1017,6 @@ static void testDeviceRegistryPropertyW()
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = pSetupDiGetDeviceRegistryPropertyW(set, &devInfo, SPDRP_FRIENDLYNAME,
|
ret = pSetupDiGetDeviceRegistryPropertyW(set, &devInfo, SPDRP_FRIENDLYNAME,
|
||||||
NULL, NULL, 0, &size);
|
NULL, NULL, 0, &size);
|
||||||
todo_wine
|
|
||||||
ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||||
"Expected ERROR_INSUFFICIENT_BUFFER, got %08x\n", GetLastError());
|
"Expected ERROR_INSUFFICIENT_BUFFER, got %08x\n", GetLastError());
|
||||||
ok(buflen == size, "Unexpected size: %d\n", size);
|
ok(buflen == size, "Unexpected size: %d\n", size);
|
||||||
|
|
Loading…
Reference in New Issue