Juan Lang : setupapi: Implement SetupDiRegisterDeviceInfo.

Alexandre Julliard julliard at winehq.org
Fri Sep 21 07:23:07 CDT 2007


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Thu Sep 20 09:16:25 2007 -0700

setupapi: Implement SetupDiRegisterDeviceInfo.

---

 dlls/setupapi/devinst.c       |   28 ++++++++++++++++++++++++++--
 dlls/setupapi/tests/devinst.c |    5 -----
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 4d06c5c..e070c6b 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -1060,11 +1060,35 @@ BOOL WINAPI SetupDiRegisterDeviceInfo(
         PVOID CompareContext,
         PSP_DEVINFO_DATA DupDeviceInfoData)
 {
+    struct DeviceInfoSet *set = (struct DeviceInfoSet *)DeviceInfoSet;
+    struct DeviceInfo *devInfo;
+
     TRACE("%p %p %08x %p %p %p\n", DeviceInfoSet, DeviceInfoData, Flags,
             CompareProc, CompareContext, DupDeviceInfoData);
 
-    FIXME("\n");
-    return FALSE;
+    if (!DeviceInfoSet || DeviceInfoSet == (HDEVINFO)INVALID_HANDLE_VALUE)
+    {
+        SetLastError(ERROR_INVALID_HANDLE);
+        return FALSE;
+    }
+    if (set->magic != SETUP_DEVICE_INFO_SET_MAGIC)
+    {
+        SetLastError(ERROR_INVALID_HANDLE);
+        return FALSE;
+    }
+    if (!DeviceInfoData || DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA)
+            || !DeviceInfoData->Reserved)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+    devInfo = (struct DeviceInfo *)DeviceInfoData->Reserved;
+    if (devInfo->phantom)
+    {
+        devInfo->phantom = FALSE;
+        RegDeleteValueW(devInfo->key, Phantom);
+    }
+    return TRUE;
 }
 
 /***********************************************************************
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index a18f91a..0ef9047 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -289,7 +289,6 @@ static void testRegisterDeviceInfo(void)
     }
     SetLastError(0xdeadbeef);
     ret = pSetupDiRegisterDeviceInfo(NULL, NULL, 0, NULL, NULL, NULL);
-    todo_wine
     ok(!ret && GetLastError() == ERROR_INVALID_HANDLE,
      "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
     ret = pSetupDiRegisterDeviceInfo(NULL, NULL, 0, NULL, NULL, NULL);
@@ -301,18 +300,15 @@ static void testRegisterDeviceInfo(void)
 
         SetLastError(0xdeadbeef);
         ret = pSetupDiRegisterDeviceInfo(set, NULL, 0, NULL, NULL, NULL);
-        todo_wine
         ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
          "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
         SetLastError(0xdeadbeef);
         ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL, NULL);
-        todo_wine
         ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
          "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
         devInfo.cbSize = sizeof(devInfo);
         SetLastError(0xdeadbeef);
         ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL, NULL);
-        todo_wine
         ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
          "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
         ret = pSetupDiCreateDeviceInfoA(set, "USB\\BOGUS\\0000", &guid,
@@ -324,7 +320,6 @@ static void testRegisterDeviceInfo(void)
             /* If it already existed, registering it again will fail */
             ret = pSetupDiRegisterDeviceInfo(set, &devInfo, 0, NULL, NULL,
              NULL);
-            todo_wine
             ok(ret, "SetupDiCreateDeviceInfoA failed: %d\n", GetLastError());
         }
         /* FIXME: On Win2K+ systems, this is now persisted to registry in




More information about the wine-cvs mailing list