[PATCH 2/8] setupapi: Set phantom value after device creation.

Zhiyi Zhang zzhang at codeweavers.com
Thu Mar 14 11:32:24 CDT 2019


Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/setupapi/devinst.c       | 4 ++++
 dlls/setupapi/tests/devinst.c | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 2c95b5cfb9..331db87d06 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -723,6 +723,7 @@ static void delete_device(struct device *device)
 static struct device *SETUPDI_CreateDeviceInfo(struct DeviceInfoSet *set,
     const GUID *class, const WCHAR *instanceid, BOOL phantom)
 {
+    const DWORD one = 1;
     struct device *device;
     WCHAR guidstr[39];
 
@@ -752,6 +753,9 @@ static struct device *SETUPDI_CreateDeviceInfo(struct DeviceInfoSet *set,
     device->removed = FALSE;
     list_add_tail(&set->devices, &device->entry);
 
+    if (phantom)
+        RegSetValueExW(device->key, Phantom, 0, REG_DWORD, (const BYTE *)&one, sizeof(one));
+
     SETUPDI_GuidToString(class, guidstr);
     SETUPDI_SetDeviceRegistryPropertyW(device, SPDRP_CLASSGUID,
         (const BYTE *)guidstr, sizeof(guidstr));
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index 9474d149dd..c28ce0e6d0 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -778,9 +778,9 @@ static void test_register_device_info(void)
     RegOpenKeyA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Enum\\ROOT\\LEGACY_BOGUS\\0000", &hkey);
     size = sizeof(phantom);
     ls = RegQueryValueExA(hkey, "Phantom", NULL, &type, (BYTE *)&phantom, &size);
-    todo_wine ok(ls == ERROR_SUCCESS, "Got wrong error code %#x\n", ls);
-    todo_wine ok(phantom == 1, "Got wrong phantom value %d\n", phantom);
-    todo_wine ok(type == REG_DWORD, "Got wrong phantom type %#x\n", type);
+    ok(ls == ERROR_SUCCESS, "Got wrong error code %#x\n", ls);
+    ok(phantom == 1, "Got wrong phantom value %d\n", phantom);
+    ok(type == REG_DWORD, "Got wrong phantom type %#x\n", type);
     ok(size == sizeof(phantom), "Got wrong phantom size %d\n", size);
     ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
     ok(ret, "Failed to register device, error %#x.\n", GetLastError());
-- 
2.19.2





More information about the wine-devel mailing list