diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 25fa0b56479..2b0f92075ed 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -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) diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index b55565de696..f3f6c99ca92 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -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);