https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8897a890c94ed83f4e34147b63dc58b2108e16d7

commit 8897a890c94ed83f4e34147b63dc58b2108e16d7
Author:     Eric Kohl <[email protected]>
AuthorDate: Mon Apr 18 19:53:18 2022 +0200
Commit:     Eric Kohl <[email protected]>
CommitDate: Mon Apr 18 19:53:18 2022 +0200

    [UMPNPMGR] PNP_CreateDevInst: Support the creation of phantom devices
---
 base/services/umpnpmgr/rpcserver.c | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/base/services/umpnpmgr/rpcserver.c 
b/base/services/umpnpmgr/rpcserver.c
index ae7337ce8eb..140f1efa91a 100644
--- a/base/services/umpnpmgr/rpcserver.c
+++ b/base/services/umpnpmgr/rpcserver.c
@@ -2877,8 +2877,11 @@ done:
 }
 
 
-static CONFIGRET
-CreateDeviceInstance(LPWSTR pszDeviceID)
+static
+CONFIGRET
+CreateDeviceInstance(
+    _In_ LPWSTR pszDeviceID,
+    _In_ BOOL bPhantomDevice)
 {
     WCHAR szEnumerator[MAX_DEVICE_ID_LEN];
     WCHAR szDevice[MAX_DEVICE_ID_LEN];
@@ -2962,6 +2965,17 @@ CreateDeviceInstance(LPWSTR pszDeviceID)
         return CR_REGISTRY_ERROR;
     }
 
+    if (bPhantomDevice)
+    {
+        DWORD dwPhantomValue = 1;
+        RegSetValueExW(hKeyInstance,
+                       L"Phantom",
+                       0,
+                       REG_DWORD,
+                       (PBYTE)&dwPhantomValue,
+                       sizeof(dwPhantomValue));
+    }
+
     /* Create the 'Control' sub key */
     lError = RegCreateKeyExW(hKeyInstance,
                              L"Control",
@@ -3061,8 +3075,16 @@ PNP_CreateDevInst(
             return ret;
     }
 
-    /* Create the device instance */
-    ret = CreateDeviceInstance(pszDeviceID);
+    if (ulFlags & CM_CREATE_DEVNODE_PHANTOM)
+    {
+        /* Create the phantom device instance */
+        ret = CreateDeviceInstance(pszDeviceID, TRUE);
+    }
+    else
+    {
+        /* Create the device instance */
+        ret = CreateDeviceInstance(pszDeviceID, FALSE);
+    }
 
     DPRINT("PNP_CreateDevInst() done (returns %lx)\n", ret);
 

Reply via email to