CmCreateDevice
NTSTATUS __stdcall CmCreateDevice(
HPNPCTX *hPnpCtx,
WCHAR *DeviceInstanceId,
WCHAR *DesiredAccess,
INT64 DeviceKey,
VOID **Created,
UINT8 *Flags,
INT64 a7,
INT64 a8,
INT64 a9){
int v10;
__int64(__fastcall *v13)(HPNPCTX *, WCHAR *, __int64, __int64, int, UINT64 *);
int v14;
NTSTATUS DeviceWorker;
NTSTATUS v16;
int v17;
int v18;
int v19;
UINT64 v21;
UINT64 v22[12];
v10 = (int)DesiredAccess;
memset(v22, 0i64, 0x58u);
v13 = (__int64(__fastcall *)(HPNPCTX *, WCHAR *, __int64, __int64, int, UINT64 *))*((_QWORD *)hPnpCtx + 63);
if( v10 || (LODWORD(v22[2]) = 1, DeviceKey) )
LODWORD(v22[2]) = v10;
HIDWORD(v22[4]) = (_DWORD)Flags;
if( v13 )
{
v14 = v13(hPnpCtx, DeviceInstanceId, 1i64, 2i64, 1, v22);
if( v14 == -1073741822 )
{
v13 = 0i64;
}
else
{
if( v14 == -1073741536 )
goto LABEL_20;
if( v14 )
{
v16 = -1073741595;
goto LABEL_25;
}
}
}
LODWORD(v21) = HIDWORD(v22[4]);
DeviceWorker = CmCreateDeviceWorker(
hPnpCtx,
DeviceInstanceId,
LODWORD(v22[2]),
(VOID **)&v22[3],
(UINT8 *)&v22[4],
v21);
v16 = DeviceWorker;
if( !v13 )
goto LABEL_13;
LODWORD(v22[0]) = DeviceWorker;
v17 = ((__int64(__fastcall *)(HPNPCTX *, WCHAR *, __int64))v13)(hPnpCtx, DeviceInstanceId, 1i64);
v18 = v17;
if( v17 == -1073741822 )
goto LABEL_13;
if( v17 == -1073741536 )
{
LABEL_20:
v16 = v22[0];
goto LABEL_13;
}
v19 = v16;
if( v18 )
v19 = -1073741595;
v16 = v19;
LABEL_13:
if( v16 >= 0 && DeviceKey )
{
*(_QWORD *)DeviceKey = v22[3];
goto LABEL_16;
}
LABEL_25:
if( v22[3] )
ZwClose(v22[3]);
LABEL_16:
if( v16 >= 0 && Created )
*(_BYTE *)Created = v22[4];
return v16;
}Referenced by:
IoReportDetectedDevice
IoReportRootDevice
IopInitializePlugPlayServices
PiCMCreateDevice
PiCMGenerateDeviceInstance
PiDevCfgInitDriverDatabaseCallback
PnpDispatchDevice