[SETUPAPI] SetupDiCreateDeviceInfoW: Fix flags conversion for CM_Create_DevInst_ExW

This commit is contained in:
Eric Kohl 2022-04-17 23:32:01 +02:00
parent dde7e6e254
commit 851c5e0c3a

View file

@ -1583,6 +1583,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(
DEVINST RootDevInst;
DEVINST DevInst;
WCHAR GenInstanceId[MAX_DEVICE_ID_LEN];
DWORD dwFlags;
TRACE("%s(%p %s %s %s %p %x %p)\n", __FUNCTION__, DeviceInfoSet, debugstr_w(DeviceName),
debugstr_guid(ClassGuid), debugstr_w(DeviceDescription),
@ -1632,13 +1633,15 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(
return FALSE;
}
dwFlags = CM_CREATE_DEVINST_PHANTOM;
if (CreationFlags & DICD_GENERATE_ID)
dwFlags |= CM_CREATE_DEVINST_GENERATE_ID;
/* Create the new device instance */
cr = CM_Create_DevInst_ExW(&DevInst,
(DEVINSTID)DeviceName,
RootDevInst,
CM_CREATE_DEVINST_PHANTOM |
(CreationFlags & DICD_GENERATE_ID) ?
CM_CREATE_DEVINST_GENERATE_ID : 0,
dwFlags,
set->hMachine);
if (cr != CR_SUCCESS)
{