Alexander Morozov : setupapi: SetupDiGetDeviceRegistryProperty should return ERROR_INVALID_DATA when buffer size is not 0 but buffer is NULL .

Alexandre Julliard julliard at winehq.org
Thu Apr 17 14:43:43 CDT 2008


Module: wine
Branch: master
Commit: af5e168f169a6024c5d618a5696f47faf27a4505
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=af5e168f169a6024c5d618a5696f47faf27a4505

Author: Alexander Morozov <amorozov at etersoft.ru>
Date:   Thu Apr 17 20:28:14 2008 +0400

setupapi: SetupDiGetDeviceRegistryProperty should return ERROR_INVALID_DATA when buffer size is not 0 but buffer is NULL.

---

 dlls/setupapi/devinst.c       |   10 ++++++++++
 dlls/setupapi/tests/devinst.c |    2 --
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 25fa0b5..2b0f920 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 b55565d..f3f6c99 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);




More information about the wine-cvs mailing list