PipEnumerateDevice
NTSTATUS __stdcall PipEnumerateDevice(_DEVICE_NODE *DeviceNode, UINT64 Synchronous, UINT64 OperationsPending){
int v3;
VOID **v5;
__int64 v6;
_DEVICE_OBJECT *v7;
NTSTATUS v8;
__int64 v9;
NTSTATUS v10;
__int64 v12;
_DEVICE_OBJECT *PhysicalDeviceObject;
int DeviceRelations;
v3 = OperationsPending;
if( (_DWORD)Synchronous
|| (PnpAsyncOptions & 2) == 0
|| (DeviceNode->Flags & 0x800000) != 0
|| InitSafeBootMode
|| (v5 = PnpDeviceCompletionRequestCreate((__int64)DeviceNode, 781)) == 0i64 )
{
if( v3 && (DeviceNode->Flags & 0x800000) != 0 )
return -1073741267;
PnpDiagnosticTraceObject(&KMPnPEvt_DeviceEnum_Start, &DeviceNode->InstancePath.Length);
PipClearDevNodeFlags(DeviceNode, 8ui64);
PoFxActivateDevice(DeviceNode->PhysicalDeviceObject);
PhysicalDeviceObject = DeviceNode->PhysicalDeviceObject;
DeviceNode->StateFlags |= 0x80u;
DeviceRelations = PnpQueryDeviceRelations(PhysicalDeviceObject, 0, 0i64, (UINT64 *)&DeviceNode->OverUsed1);
PoFxIdleDevice(DeviceNode->PhysicalDeviceObject);
DeviceNode->StateFlags &= ~0x80u;
DeviceNode->CompletionStatus = DeviceRelations;
PipSetDevNodeState(DeviceNode, DeviceNodeEnumerateCompletion);
PnpDiagnosticTraceObject(&KMPnPEvt_DeviceEnum_Stop, &DeviceNode->InstancePath.Length);
}
else
{
PipSetDevNodeState(DeviceNode, DeviceNodeEnumeratePending);
DeviceNode->CompletionStatus = 259;
PnpDeviceCompletionQueueAddDispatchedRequest(v6, v5);
PnpDiagnosticTraceObject(&KMPnPEvt_DeviceEnum_Start, &DeviceNode->InstancePath.Length);
PipClearDevNodeFlags(DeviceNode, 8ui64);
PoFxActivateDevice(DeviceNode->PhysicalDeviceObject);
v7 = DeviceNode->PhysicalDeviceObject;
DeviceNode->StateFlags |= 0x80u;
v8 = PnpQueryDeviceRelations(
v7,
0,
(int(__fastcall *)(_DEVICE_OBJECT *, _IRP *, void *))PnpDeviceCompletionRoutine,
(UINT64 *)v5);
v10 = v8;
if( v8 == 259 )
{
PnpDiagnosticTraceObject(&KMPnPEvt_DeviceEnum_Pend, &DeviceNode->InstancePath.Length);
return v10;
}
if( *((_DWORD *)v5 + 10) != v8 )
{
*((_DWORD *)v5 + 10) = v8;
PnpDiagnosticTraceObject(&KMPnPEvt_DeviceEnum_Stop, &DeviceNode->InstancePath.Length);
PnpDeviceCompletionQueueDispatchedEntryCompleted(v12, (_LIST_ENTRY *)v5);
}
PnpDeviceCompletionQueueRemoveCompletedRequest(v9, v5);
PnpDeviceCompletionProcessCompletedRequest(v5);
}
return 0;
}Referenced by:
PipProcessDevNodeTree