setupapi: Set phantom value after device creation.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2019-03-15 11:41:02 +08:00 committed by Alexandre Julliard
parent 35673c7e8e
commit 64c09819cf
2 changed files with 7 additions and 3 deletions

View File

@ -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));

View File

@ -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());