HalpDispatchSystemStateTransition

NTSTATUS __stdcall HalpDispatchSystemStateTransition(IRP *Irp){
  __int64 v1; 
  char v2; 
  int v3; 
  int v4; 
  INT64 v5; 
  v1 = *((_QWORD *)Irp + 23);
  v2 = *(_BYTE *)(v1 + 1);
  v3 = *(_DWORD *)(v1 + 24);
  if( v3 == 1 )
  {
    if( HalpReEnableDiagnosticEventsOnResume )
    {
      HalpDiagnosticEventsRegistered = 1;
      HalpReEnableDiagnosticEventsOnResume = 0;
    }
    if( HalpResumeStructuresAllocated )
    {
      HalpFreeResumeStructures((_HALP_ALLOC_CONTEXT *)Irp);
      HalpResumeStructuresAllocated = 0;
    }
    HalpEfiLockOutRuntimeCallsForSystemSleep(1);
    if( (HalpPlatformFlags & 1) != 0 )
    {
      LOBYTE(v5) = 1;
      goto LABEL_9;
    }
  }
  else
  {
    if( (unsigned int)(v3 - 2) > 3 )
      return 0;
    if( !HalpResumeStructuresAllocated )
    {
      v4 = HalpBuildResumeStructures();
      if( v4 < 0 )
      {
        if( v2 == 2 )
          KeBugCheckEx(0x5Cu, 0x10Cui64, v4, 0i64, 0i64);
        return 0;
      }
      HalpResumeStructuresAllocated = 1;
    }
    if( v2 == 2 )
    {
      HalpEfiLockOutRuntimeCallsForSystemSleep(0);
      if( (HalpPlatformFlags & 1) != 0 )
      {
        v5 = 0i64;
LABEL_9:
        HalpInterruptMaskAcpi(v5);
      }
    }
  }
  return 0;
}

Referenced by:

HalpDispatchPower