IoShutdownSystem
VOID __stdcall IoShutdownSystem(UINT64 Phase){
int v1;
_DEVICE_OBJECT *v2;
_ADAPTER_OBJECT *v3;
PIRP *v4;
_LIST_ENTRY *v5;
UINT8 *v6;
_OBJECT_TYPE *v7;
VOID *v8;
_UNICODE_STRING *v9;
PADAPTER_OBJECT *v10;
INT64 v11;
_DEVICE_OBJECT *v12;
_ADAPTER_OBJECT *v13;
PIRP *v14;
_LIST_ENTRY *v15;
INT64 v16;
INT64 v17;
PADAPTER_OBJECT *v18;
UINT64 v19;
PKEVENT Event;
PIO_STATUS_BLOCK IoStatusBlock;
VOID *v22;
_IO_STATUS_BLOCK v23;
__int128 Object;
__int64 v25;
int SystemInformation;
Object = 0i64;
v25 = 0i64;
v1 = Phase;
v23 = 0i64;
if( VfIsVerifierEnabled() )
VfNotifyVerifierOfEvent(1ui64);
KeInitializeEvent((INT64)&Object, 0, 0);
if( v1 )
{
if( v1 == 1 )
{
ExWaitForRundownProtectionRelease((_EX_RUNDOWN_REF *)&stru_140C452E0 + 173);
ExAcquireResourceExclusiveLite((UINT64)&stru_140C452E0 + 1280, 1, v11);
IopShutdownBaseFileSystems((_LIST_ENTRY *)&stru_140C452E0 + 97);
IopShutdownBaseFileSystems((_LIST_ENTRY *)&stru_140C452E0 + 98);
IopShutdownBaseFileSystems((_LIST_ENTRY *)&stru_140C452E0 + 95);
while( 1 )
{
v15 = IopInterlockedRemoveHeadList((_LIST_ENTRY *)&stru_140C452E0 + 100);
v18 = (PADAPTER_OBJECT *)v15;
if( !v15 )
break;
LODWORD(v12) = IoGetAttachedDeviceReference((INT64)v15[1].Flink, v16, v17);
v13 = (_ADAPTER_OBJECT *)v12;
v14 = IoBuildSynchronousFsdRequest(0x10u, v12, 0i64, 0, 0i64, (PKEVENT)&Object, &v23);
if( v14 && IofCallDriver((UINT64)v13, (UINT64)v14) == 259 )
KeWaitForSingleObject((UINT64)&Object, 0, 0, 0, 0i64);
HalPutDmaAdapter(v13);
HalPutDmaAdapter(v18[2]);
ExFreePoolWithTag(v18, 0);
KeResetEvent((_KEVENT *)&Object);
}
}
}
else
{
PnpShutdownDevices();
while( 1 )
{
v5 = IopInterlockedRemoveHeadList((_LIST_ENTRY *)&stru_140C452E0 + 99);
v10 = (PADAPTER_OBJECT *)v5;
if( !v5 )
break;
LODWORD(v2) = IoGetAttachedDeviceReference((INT64)v5[1].Flink, (INT64)v6, (INT64)v8);
v3 = (_ADAPTER_OBJECT *)v2;
v4 = IoBuildSynchronousFsdRequest(0x10u, v2, 0i64, 0, 0i64, (PKEVENT)&Object, &v23);
if( v4 && IofCallDriver((UINT64)v3, (UINT64)v4) == 259 )
KeWaitForSingleObject((UINT64)&Object, 0, 0, 0, 0i64);
HalPutDmaAdapter(v3);
HalPutDmaAdapter(v10[2]);
ExFreePoolWithTag(v10, 0);
KeResetEvent((_KEVENT *)&Object);
}
if( (MmVerifierData & 0x10) != 0 )
IovUnloadDrivers(v7, v6, v8, v9, v19, (UINT64)Event, IoStatusBlock, v22);
SystemInformation = 2;
ZwSetSystemInformation(SystemSoftRebootInformation, &SystemInformation, 4ui64);
}
}Referenced by:
PopGracefulShutdown