Juan Lang : setupapi: Implement SetupDiGetClassDevsExA.

Alexandre Julliard julliard at winehq.org
Tue Sep 25 07:50:50 CDT 2007


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Mon Sep 24 13:32:46 2007 -0700

setupapi: Implement SetupDiGetClassDevsExA.

---

 dlls/setupapi/devinst.c |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 dlls/setupapi/stubs.c   |   11 -----------
 2 files changed, 47 insertions(+), 11 deletions(-)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 503eaa5..2459ccd 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -1769,6 +1769,53 @@ end:
     return ret;
 }
 
+/***********************************************************************
+ *		  SetupDiGetClassDevsExA (SETUPAPI.@)
+ */
+HDEVINFO WINAPI SetupDiGetClassDevsExA(
+        const GUID *class,
+        PCSTR enumstr,
+        HWND parent,
+        DWORD flags,
+        HDEVINFO deviceset,
+        PCSTR machine,
+        PVOID reserved)
+{
+    HDEVINFO ret;
+    LPWSTR enumstrW = NULL, machineW = NULL;
+
+    if (enumstr)
+    {
+        int len = MultiByteToWideChar(CP_ACP, 0, enumstr, -1, NULL, 0);
+        enumstrW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+        if (!enumstrW)
+        {
+            ret = (HDEVINFO)INVALID_HANDLE_VALUE;
+            goto end;
+        }
+        MultiByteToWideChar(CP_ACP, 0, enumstr, -1, enumstrW, len);
+    }
+    if (machine)
+    {
+        int len = MultiByteToWideChar(CP_ACP, 0, machine, -1, NULL, 0);
+        machineW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+        if (!machineW)
+        {
+            HeapFree(GetProcessHeap(), 0, enumstrW);
+            ret = (HDEVINFO)INVALID_HANDLE_VALUE;
+            goto end;
+        }
+        MultiByteToWideChar(CP_ACP, 0, machine, -1, machineW, len);
+    }
+    ret = SetupDiGetClassDevsExW(class, enumstrW, parent, flags, deviceset,
+            machineW, reserved);
+    HeapFree(GetProcessHeap(), 0, enumstrW);
+    HeapFree(GetProcessHeap(), 0, machineW);
+
+end:
+    return ret;
+}
+
 static void SETUPDI_AddDeviceInterfaces(SP_DEVINFO_DATA *dev, HKEY key,
         const GUID *interface)
 {
diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c
index 3342a65..de1fec1 100644
--- a/dlls/setupapi/stubs.c
+++ b/dlls/setupapi/stubs.c
@@ -50,17 +50,6 @@ DWORD WINAPI suErrorToIds16( WORD w1, WORD w2 )
 }
 
 /***********************************************************************
- *		  (SETUPAPI.@)
- *
- * NO WINAPI in description given
- */
-HDEVINFO WINAPI SetupDiGetClassDevsExA(const GUID *class, PCSTR filter, HWND parent, DWORD flags, HDEVINFO deviceset, PCSTR machine, PVOID reserved)
-{
-  FIXME("filter %s machine %s\n",debugstr_a(filter),debugstr_a(machine));
-  return FALSE;
-}
-
-/***********************************************************************
  *		CM_Connect_MachineW  (SETUPAPI.@)
  */
 DWORD WINAPI CM_Connect_MachineW(LPCWSTR name, void * machine)




More information about the wine-cvs mailing list