PopTransitionToSleep

VOID __stdcall PopTransitionToSleep(PVOID Context){
  int v1; 
  NTSTATUS v3; 
  INT64 v4; 
  char v5; 
  CHAR v6; 
  int v7; 
  int v8; 
  int v9; 
  __int128 v10; 
  __int128 v11; 
  __int64 v12; 
  UINT8 LowSpace; 
  v1 = *((_DWORD *)Context + 18);
  v12 = 0i64;
  LowSpace = 0;
  v10 = 0i64;
  v11 = 0i64;
  BugCheckParameter4 = (ULONG_PTR)KeGetCurrentThread();
  if( v1 == 3 || v1 == 6 )
  {
    if( (PopSimulateHiberBugcheck & 0x20) != 0 )
    {
      KeSetEvent((PRKEVENT)Context, 0);
      KeWaitForSingleObject((char *)Context + 24, Executive, 0, 0, 0i64);
      v9 = 0;
      goto LABEL_15;
    }
    v3 = PopEnlargeHiberFile(&LowSpace);
    v4 = LowSpace;
    LODWORD(v12) = 16;
    *(_QWORD *)&v10 = xHalPciEarlyRestore;
    if( v3 < 0 )
      v4 = 1i64;
    *((_QWORD *)&v11 + 1) = 0i64;
    v5 = 0;
    *((_QWORD *)&v10 + 1) = PopEndMirroring;
    v6 = 0;
    *(_QWORD *)&v11 = PopMirrorPhysicalMemory;
    if( (_BYTE)v4 )
    {
      MmEmptyAllWorkingSets();
      v6 = 1;
      v7 = v12 | 1;
    }
    else if( (*(_BYTE *)Flags & 0x20) != 0 && PopEnableMinimalHiberFile || PopForceMinimalHiberFile )
    {
      MmEmptyAllWorkingSets();
      v6 = 1;
      v7 = v12 | 4;
    }
    else
    {
      if( v1 == 6 )
      {
        MmTrimFilePagesFromWorkingSets(v4);
        v7 = v12 | 1;
        goto LABEL_11;
      }
      v7 = 20;
    }
    v5 = 1;
LABEL_11:
    LODWORD(v12) = v7;
    byte_140C2411C = v5;
    byte_140C2411D = v6;
    dword_140C24118 = v7;
    PopDiagTraceEventNoPayload((EVENT_DESCRIPTOR *)&POP_ETW_EVENT_FLUSHALLPAGES);
    if( v5 )
      MmFlushAllPagesEx(v6);
    PopDiagTraceEventNoPayload((EVENT_DESCRIPTOR *)&POP_ETW_EVENT_FLUSHALLPAGES_END);
    PopHibernatePowerStateHandlerType = v1;
    PopSleeperHandoff = (PRKEVENT)Context;
    v8 = MmDuplicateMemory((__int64)&v10);
    PopSleeperHandoff = 0i64;
    PopHibernatePowerStateHandlerType = 7;
    goto LABEL_14;
  }
  KeSetEvent((PRKEVENT)Context, 0);
  KeWaitForSingleObject((char *)Context + 24, Executive, 0, 0, 0i64);
  v8 = PopInvokeSystemStateHandler(v1, HiberContext);
LABEL_14:
  v9 = v8;
LABEL_15:
  qword_140C238C0 = __rdtsc();
  *((_DWORD *)Context + 19) = v9;
  KeSetEvent((PRKEVENT)Context + 2, 0);
}

Referenced by:

No references.