Commit af5e168f authored by Alexander Morozov's avatar Alexander Morozov Committed by Alexandre Julliard

setupapi: SetupDiGetDeviceRegistryProperty should return ERROR_INVALID_DATA when…

setupapi: SetupDiGetDeviceRegistryProperty should return ERROR_INVALID_DATA when buffer size is not 0 but buffer is NULL.
parent 85861a49
......@@ -3110,6 +3110,11 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyA(
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (PropertyBufferSize && PropertyBuffer == NULL)
{
SetLastError(ERROR_INVALID_DATA);
return FALSE;
}
devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
if (Property < sizeof(PropertyMap) / sizeof(PropertyMap[0])
&& PropertyMap[Property].nameA)
......@@ -3166,6 +3171,11 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyW(
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (PropertyBufferSize && PropertyBuffer == NULL)
{
SetLastError(ERROR_INVALID_DATA);
return FALSE;
}
devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
if (Property < sizeof(PropertyMap) / sizeof(PropertyMap[0])
&& PropertyMap[Property].nameW)
......
......@@ -917,7 +917,6 @@ static void testDeviceRegistryPropertyA()
SetLastError(0xdeadbeef);
ret = pSetupDiGetDeviceRegistryPropertyA(set, &devInfo, SPDRP_FRIENDLYNAME,
NULL, NULL, buflen, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
......@@ -1011,7 +1010,6 @@ static void testDeviceRegistryPropertyW()
SetLastError(0xdeadbeef);
ret = pSetupDiGetDeviceRegistryPropertyW(set, &devInfo, SPDRP_FRIENDLYNAME,
NULL, NULL, buflen, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
......
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