PnpStartDeviceNode
__int64 __fastcall PnpStartDeviceNode(__int64 a1, int a2, int a3){
int v5;
LIST_ENTRY *v6;
_PNP_DEVNODE_STATE *v7;
__int64 v8;
LIST_ENTRY *v9;
int started;
__int64 v12;
_PNP_DEVNODE_STATE *v13;
__int64 Context;
struct _KEVENT Event;
int v16;
int v17;
v17 = 0;
memset(&Event, 0, sizeof(Event));
v5 = a2 != 0 ? 5 : 0;
if( !a2 && (unsigned int)IopGetSessionIdFromPDO(*(DEVICE_OBJECT **)(a1 + 32)) != -1 )
PpMarkDeviceStackExtensionFlag(*(DEVICE_OBJECT **)(a1 + 32), 0x400ui64, 1u);
if( a3
|| (PnpAsyncOptions & 1) == 0
|| (*(_DWORD *)(a1 + 396) & 0x400000) != 0
|| (*(_DWORD *)(*(_QWORD *)(a1 + 32) + 48i64) & 0x4000) != 0
|| InitSafeBootMode
|| (v6 = (LIST_ENTRY *)PnpDeviceCompletionRequestCreate(a1, (unsigned int)(v5 + 774))) == 0i64 )
{
PnpDiagnosticTraceObject(&KMPnPEvt_DeviceStart_Start, (_UNICODE_STRING *)(a1 + 40));
Context = 0i64;
v16 = -1073741823;
KeInitializeEvent(&Event, SynchronizationEvent, 0);
started = PnpStartDevice(
*(PDEVICE_OBJECT *)(a1 + 32),
(PIO_COMPLETION_ROUTINE)PnpDiagnosticCompletionRoutine,
&Context);
if( started == 259 )
{
KeWaitForSingleObject(&Event, Executive, 0, 0, 0i64);
started = v16;
}
if( started >= 0 )
{
PipUpdatePostStartCharacteristics(*(DEVICE_OBJECT **)(a1 + 32));
PnpSetObjectProperty(
PiPnpRtlCtx,
*(_QWORD *)(a1 + 48),
1u,
0i64,
0i64,
(__int64)&DEVPKEY_Device_DriverProblemDesc,
0,
0i64,
0,
0);
PiSwProcessParentStartIrp(*(DEVICE_OBJECT **)(a1 + 32));
}
v12 = Context;
*(_DWORD *)(a1 + 392) = started;
PnpTraceStartDevice(a1, started, v12);
PipSetDevNodeState((_DEVICE_NODE *)a1, (_PNP_DEVNODE_STATE)(v5 + 774), v13);
}
else
{
PnpDiagnosticTraceObject(&KMPnPEvt_DeviceStart_Start, (_UNICODE_STRING *)(a1 + 40));
PipSetDevNodeState((_DEVICE_NODE *)a1, DeviceNodeStartPending, v7);
*(_DWORD *)(a1 + 392) = 259;
PnpDeviceCompletionQueueAddDispatchedRequest(v8, v6);
started = PnpStartDevice(*(PDEVICE_OBJECT *)(a1 + 32), (PIO_COMPLETION_ROUTINE)PnpDeviceCompletionRoutine, v6);
if( started == 259 )
{
PnpDiagnosticTraceObject(&KMPnPEvt_DeviceStart_Pend, (_UNICODE_STRING *)(a1 + 40));
}
else
{
PnpDeviceCompletionQueueRemoveCompletedRequest(v9, v6);
return(unsigned int)PnpDeviceCompletionProcessCompletedRequest((INT64)v6);
}
}
return(unsigned int)started;
}Referenced by:
PipProcessRestartPhase1
PipProcessStartPhase1
PnpReallocateResources