[ros-diffs] [hpoussin] 19613: Implement SetupDiGetDeviceInstanceIdW

hpoussin at svn.reactos.com hpoussin at svn.reactos.com
Sat Nov 26 09:13:22 CET 2005


Implement SetupDiGetDeviceInstanceIdW
Fix debug message
Modified: trunk/reactos/lib/devmgr/hwpage.c
Modified: trunk/reactos/lib/setupapi/devinst.c
Modified: trunk/reactos/lib/setupapi/stubs.c
  _____  

Modified: trunk/reactos/lib/devmgr/hwpage.c
--- trunk/reactos/lib/devmgr/hwpage.c	2005-11-26 04:29:40 UTC (rev
19612)
+++ trunk/reactos/lib/devmgr/hwpage.c	2005-11-26 08:13:04 UTC (rev
19613)
@@ -143,7 +143,7 @@

                                        0,
                                        &DeviceInstanceIdLen))
         {
-            DPRINT1("SetupDiGetDeviceInterfaceDetail unexpectedly
returned TRUE!\n");
+            DPRINT1("SetupDiGetDeviceInstanceId unexpectedly returned
TRUE!\n");
             goto Cleanup;
         }
 
  _____  

Modified: trunk/reactos/lib/setupapi/devinst.c
--- trunk/reactos/lib/setupapi/devinst.c	2005-11-26 04:29:40 UTC
(rev 19612)
+++ trunk/reactos/lib/setupapi/devinst.c	2005-11-26 08:13:04 UTC
(rev 19613)
@@ -3004,7 +3004,7 @@

 {
     BOOL ret = FALSE;
 
-    TRACE("%ld %p %p\n", InstallFunction, DeviceInfoSet,
DeviceInfoData);
+    TRACE("%u %p %p\n", InstallFunction, DeviceInfoSet,
DeviceInfoData);
 
     if (!DeviceInfoSet)
         SetLastError(ERROR_INVALID_PARAMETER);
@@ -3063,7 +3063,7 @@
                 DefaultHandler = SetupDiSelectBestCompatDrv;
                 break;
             default:
-                ERR("Install function %lu not supported\n",
InstallFunction);
+                ERR("Install function %u not supported\n",
InstallFunction);
                 SetLastError(ERROR_NOT_SUPPORTED);
         }
 
@@ -3463,6 +3463,71 @@
 }
 
 
/***********************************************************************
+ *		SetupDiGetDeviceInstanceIdA(SETUPAPI.@)
+ */
+BOOL WINAPI SetupDiGetDeviceInstanceIdA(
+        IN HDEVINFO DeviceInfoSet,
+        IN PSP_DEVINFO_DATA DeviceInfoData,
+        OUT PSTR DeviceInstanceId,
+        IN DWORD DeviceInstanceIdSize,
+        OUT PDWORD RequiredSize)
+{
+    FIXME ("Stub %p %p %p %d %p\n",
+           DeviceInfoSet, DeviceInfoData, DeviceInstanceId,
DeviceInstanceIdSize, RequiredSize);
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
+
+/**********************************************************************
*
+ *		SetupDiGetDeviceInstanceIdW(SETUPAPI.@)
+ */
+BOOL WINAPI SetupDiGetDeviceInstanceIdW(
+        IN HDEVINFO DeviceInfoSet,
+        IN PSP_DEVINFO_DATA DeviceInfoData,
+        OUT PWSTR DeviceInstanceId,
+        IN DWORD DeviceInstanceIdSize,
+        OUT PDWORD RequiredSize)
+{
+    BOOL ret = FALSE;
+
+    TRACE("%p %p %p %lu %p\n", DeviceInfoSet, DeviceInfoData,
+          DeviceInstanceId, DeviceInstanceIdSize, RequiredSize);
+
+    if (!DeviceInfoSet)
+        SetLastError(ERROR_INVALID_HANDLE);
+    else if (((struct DeviceInfoSet *)DeviceInfoSet)->magic !=
SETUP_DEV_INFO_SET_MAGIC)
+        SetLastError(ERROR_INVALID_HANDLE);
+    else if (!DeviceInfoData)
+        SetLastError(ERROR_INVALID_PARAMETER);
+    else if (DeviceInfoData->cbSize != sizeof(SP_DEVINFO_DATA))
+        SetLastError(ERROR_INVALID_USER_BUFFER);
+    else if (!DeviceInstanceId && DeviceInstanceIdSize > 0)
+        SetLastError(ERROR_INVALID_PARAMETER);
+    else if (DeviceInstanceId && DeviceInstanceIdSize == 0)
+        SetLastError(ERROR_INVALID_PARAMETER);
+    else
+    {
+        struct DeviceInfoElement *DevInfo = (struct DeviceInfoElement
*)DeviceInfoData->Reserved;
+        DWORD required;
+
+        required = (wcslen(DevInfo->DeviceName) + 1) * sizeof(WCHAR);
+        if (RequiredSize)
+            *RequiredSize = required;
+
+        if (required <= DeviceInstanceIdSize)
+        {
+            wcscpy(DeviceInstanceId, DevInfo->DeviceName);
+            ret = TRUE;
+        }
+        else
+            SetLastError(ERROR_INSUFFICIENT_BUFFER);
+    }
+
+    TRACE("Returning 0x%p\n", ret);
+    return ret;
+}
+
+/**********************************************************************
*
  *		SetupDiCreateDevRegKeyA (SETUPAPI.@)
  */
 HKEY WINAPI SetupDiCreateDevRegKeyA(
  _____  

Modified: trunk/reactos/lib/setupapi/stubs.c
--- trunk/reactos/lib/setupapi/stubs.c	2005-11-26 04:29:40 UTC (rev
19612)
+++ trunk/reactos/lib/setupapi/stubs.c	2005-11-26 08:13:04 UTC (rev
19613)
@@ -225,33 +225,8 @@

     return TRUE;
 }
 
-/**********************************************************************
*
- *		SetupDiGetDeviceInstanceIdA(SETUPAPI.@)
- */
-BOOL WINAPI SetupDiGetDeviceInstanceIdA(HDEVINFO DeviceInfoSet,
PSP_DEVINFO_DATA DeviceInfoData,
-                                        PSTR DeviceInstanceId, DWORD
DeviceInstanceIdSize,
-                                        PDWORD RequiredSize)
-{
-    FIXME ("Stub %p %p %p %d %p\n",
-           DeviceInfoSet, DeviceInfoData, DeviceInstanceId,
DeviceInstanceIdSize, RequiredSize);
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
 
 
/***********************************************************************
- *		SetupDiGetDeviceInstanceIdW(SETUPAPI.@)
- */
-BOOL WINAPI SetupDiGetDeviceInstanceIdW(HDEVINFO DeviceInfoSet,
PSP_DEVINFO_DATA DeviceInfoData,
-                                        PWSTR DeviceInstanceId, DWORD
DeviceInstanceIdSize,
-                                        PDWORD RequiredSize)
-{
-    FIXME ("Stub %p %p %p %d %p\n",
-           DeviceInfoSet, DeviceInfoData, DeviceInstanceId,
DeviceInstanceIdSize, RequiredSize);
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-/**********************************************************************
*
  *		SetupDiGetClassDevPropertySheetsA(SETUPAPI.@)
  */
 BOOL WINAPI SetupDiGetClassDevPropertySheetsA(HDEVINFO DeviceInfoSet,
PSP_DEVINFO_DATA DeviceInfoData,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20051126/b9b02994/attachment.html


More information about the Ros-diffs mailing list