ExShutdownSystem

VOID __stdcall ExShutdownSystem(UINT64 Phase){
  int v1; 
  UINT8 v2; 
  _ESERVERSILO_GLOBALS *ServerSiloGlobals; 
  _ADAPTER_OBJECT *ExpDefaultErrorPort; 
  _EPROCESS *ExpDefaultErrorPortProcess; 

  ServerSiloGlobals = PsGetServerSiloGlobals(0i64);
  if( v1 )
  {
    if( v1 == 1 && (*(&stru_140C23628 + 2336) & 2) != 0 )
      ExSwapinWorkerThreads(v2);
  }
  else
  {
    ExpRecordShutdownTime();
    ExpDefaultErrorPort = (_ADAPTER_OBJECT *)ServerSiloGlobals->ExpDefaultErrorPort;
    ExpTooLateForErrors = 1;
    ExpShuttingDown = 1;
    if( ExpDefaultErrorPort )
    {
      HalPutDmaAdapter(ExpDefaultErrorPort);
      ServerSiloGlobals->ExpDefaultErrorPort = 0i64;
    }
    ExpDefaultErrorPortProcess = ServerSiloGlobals->ExpDefaultErrorPortProcess;
    if( ExpDefaultErrorPortProcess )
    {
      ObfDereferenceObjectWithTag(ExpDefaultErrorPortProcess, 0x65487845ui64);
      ServerSiloGlobals->ExpDefaultErrorPortProcess = 0i64;
    }
    ExAcquirePushLockExclusiveEx((_EX_PUSH_LOCK *)&ExBootDevicesRemovedEvent + 40, 0i64);
    if( *(&ExBootDevicesRemovedEvent + 42) )
    {
      HalPutDmaAdapter(*(&ExBootDevicesRemovedEvent + 42));
      *(&ExBootDevicesRemovedEvent + 42) = 0i64;
    }
    if( *(&ExBootDevicesRemovedEvent + 43) )
    {
      HalPutDmaAdapter(*(&ExBootDevicesRemovedEvent + 43));
      *(&ExBootDevicesRemovedEvent + 43) = 0i64;
    }
    if( *(&ExBootDevicesRemovedEvent + 38) )
    {
      ObCloseHandle(*(&ExBootDevicesRemovedEvent + 38), 0);
      *(&ExBootDevicesRemovedEvent + 38) = 0i64;
    }
    if( *(_QWORD *)&ExpSetupKey )
    {
      ObCloseHandle(*(VOID **)&ExpSetupKey, 0);
      *(_QWORD *)&ExpSetupKey = 0i64;
    }
    ExReleasePushLockEx((ULONG_PTR)&ExBootDevicesRemovedEvent + 320, 0);
  }
}

Referenced by:

PopGracefulShutdown