[UMPNPMGR] Partially implement ReenumerateDeviceInstance which is needed by the Lenov...
authorEric Kohl <eric.kohl@reactos.org>
Sun, 12 Aug 2018 20:19:05 +0000 (22:19 +0200)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 12 Aug 2018 20:26:22 +0000 (22:26 +0200)
base/services/umpnpmgr/umpnpmgr.c
sdk/include/ndk/cmtypes.h

index 478bcc7..02eaf05 100644 (file)
@@ -1959,11 +1959,36 @@ DisableDeviceInstance(LPWSTR pszDeviceInstance)
 
 
 static CONFIGRET
-ReenumerateDeviceInstance(LPWSTR pszDeviceInstance)
+ReenumerateDeviceInstance(
+    _In_ LPWSTR pszDeviceInstance,
+    _In_ ULONG ulFlags)
 {
-    DPRINT("ReenumerateDeviceInstance: not implemented\n");
-    /* FIXME */
-    return CR_CALL_NOT_IMPLEMENTED;
+    PLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA EnumerateDeviceData;
+    CONFIGRET ret = CR_SUCCESS;
+    NTSTATUS Status;
+
+    DPRINT1("ReenumerateDeviceInstance(%S 0x%08lx)\n",
+           pszDeviceInstance, ulFlags);
+
+    if (ulFlags & ~CM_REENUMERATE_BITS)
+        return CR_INVALID_FLAG;
+
+    if (ulFlags & CM_REENUMERATE_RETRY_INSTALLATION)
+    {
+        DPRINT1("CM_REENUMERATE_RETRY_INSTALLATION not implemented!\n");
+    }
+
+    RtlInitUnicodeString(&EnumerateDeviceData.DeviceInstance,
+                         pszDeviceInstance);
+    EnumerateDeviceData.Flags = 0;
+
+    Status = NtPlugPlayControl(PlugPlayControlEnumerateDevice,
+                               &EnumerateDeviceData,
+                               sizeof(PLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA));
+    if (!NT_SUCCESS(Status))
+        ret = NtStatusToCrError(Status);
+
+    return ret;
 }
 
 
@@ -2004,7 +2029,8 @@ PNP_DeviceInstanceAction(
             break;
 
         case PNP_DEVINST_REENUMERATE:
-            ret = ReenumerateDeviceInstance(pszDeviceInstance1);
+            ret = ReenumerateDeviceInstance(pszDeviceInstance1,
+                                            ulFlags);
             break;
 
         default:
index 1d58d93..2b85492 100644 (file)
@@ -445,6 +445,13 @@ typedef struct _PLUGPLAY_EVENT_BLOCK
 // Plug and Play Control Classes
 //
 
+// Class 0x00
+typedef struct _PLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA
+{
+    UNICODE_STRING DeviceInstance;
+    ULONG Flags;
+} PLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA, *PPLUGPLAY_CONTROL_ENUMERATE_DEVICE_DATA;
+
 //Class 0x09
 typedef struct _PLUGPLAY_CONTROL_INTERFACE_DEVICE_LIST_DATA
 {