Zhiyi Zhang : setupapi: Set phantom value after device creation.
Alexandre Julliard
julliard at winehq.org
Mon Mar 18 16:20:14 CDT 2019
Module: wine
Branch: master
Commit: 64c09819cf937b87344b41d049d43e4b8754fb64
URL: https://source.winehq.org/git/wine.git/?a=commit;h=64c09819cf937b87344b41d049d43e4b8754fb64
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Fri Mar 15 11:41:02 2019 +0800
setupapi: Set phantom value after device creation.
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 2c95b5c..331db87 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 3add9b2..75ac8fe 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());
More information about the wine-cvs
mailing list