[CMAKE]
[reactos.git] / dll / win32 / setupapi / cfgmgr.c
index ccff5e6..e995e8f 100644 (file)
@@ -1987,10 +1987,47 @@ CONFIGRET WINAPI CM_Get_Device_ID_List_ExW(
     PCWSTR pszFilter, PWCHAR Buffer, ULONG BufferLen, ULONG ulFlags,
     HMACHINE hMachine)
 {
-    FIXME("%p %p %ld %ld %lx\n",
+    RPC_BINDING_HANDLE BindingHandle = NULL;
+    CONFIGRET ret;
+
+    TRACE("%p %p %ld %ld %lx\n",
           pszFilter, Buffer, BufferLen, ulFlags, hMachine);
-    memset(Buffer,0,2);
-    return CR_SUCCESS;
+
+    if (Buffer == NULL || BufferLen == 0)
+        return CR_INVALID_POINTER;
+
+    if (ulFlags & ~CM_GETIDLIST_FILTER_BITS)
+        return CR_INVALID_FLAG;
+
+    if (hMachine != NULL)
+    {
+        BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+        if (BindingHandle == NULL)
+            return CR_FAILURE;
+    }
+    else
+    {
+        if (!PnpGetLocalHandles(&BindingHandle, NULL))
+            return CR_FAILURE;
+    }
+
+    *Buffer = 0;
+
+    RpcTryExcept
+    {
+        ret = PNP_GetDeviceList(BindingHandle,
+                                pszFilter,
+                                Buffer,
+                                &BufferLen,
+                                ulFlags);
+    }
+    RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+    {
+        ret = RpcStatusToCmStatus(RpcExceptionCode());
+    }
+    RpcEndExcept;
+
+    return ret;
 }