From 851c5e0c3a2b6a781eda35066685dc91c168d187 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 17 Apr 2022 23:32:01 +0200 Subject: [PATCH] [SETUPAPI] SetupDiCreateDeviceInfoW: Fix flags conversion for CM_Create_DevInst_ExW --- dll/win32/setupapi/devinst.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dll/win32/setupapi/devinst.c b/dll/win32/setupapi/devinst.c index 065c857bb22..47e2bf8beaa 100644 --- a/dll/win32/setupapi/devinst.c +++ b/dll/win32/setupapi/devinst.c @@ -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) {