HalpDispatchSystemStateTransition

NTSTATUS __stdcall HalpDispatchSystemStateTransition(_IRP *Irp){
  _IO_STACK_LOCATION *CurrentStackLocation; 
  unsigned __int8 MinorFunction; 
  int v3; 
  NTSTATUS v4; 
  INT64 v5; 

  CurrentStackLocation = Irp->Tail.CurrentStackLocation;
  MinorFunction = CurrentStackLocation->MinorFunction;
  v3 = *(_DWORD *)&CurrentStackLocation->Parameters.FileAttributes;
  if( v3 == 1 )
  {
    if( *(&stru_140CF2E80 + 7376) )
    {
      byte_140C4A328 = 1;
      *(&stru_140CF2E80 + 7376) = 0;
    }
    if( byte_140C49EB8 )
    {
      HalpFreeResumeStructures((PINTERRUPT_INITIALIZE_IO_UNIT *)Irp);
      byte_140C49EB8 = 0;
    }
    HalpEfiLockOutRuntimeCallsForSystemSleep(1);
    if( (HalpPlatformFlags & 1) != 0 )
    {
      LOBYTE(v5) = 1;
      goto LABEL_9;
    }
  }
  else
  {
    if( (unsigned int)(v3 - 2) > 3 )
      return 0;
    if( !byte_140C49EB8 )
    {
      v4 = HalpBuildResumeStructures();
      if( v4 < 0 )
      {
        if( MinorFunction == 2 )
          KeBugCheckEx(0x5Cu, (PVOID)0x10C, (PVOID)v4, 0i64, 0i64);
        return 0;
      }
      byte_140C49EB8 = 1;
    }
    if( MinorFunction == 2 )
    {
      HalpEfiLockOutRuntimeCallsForSystemSleep(0);
      if( (HalpPlatformFlags & 1) != 0 )
      {
        v5 = 0i64;
LABEL_9:
        HalpInterruptMaskAcpi(v5);
      }
    }
  }
  return 0;
}

Referenced by:

HalpDispatchPower