PspInitPhase3

BOOL __stdcall PspInitPhase3(){
  BOOL v0; 
  int SystemDllSecureHandle; 
  int v2; 
  INT64 v3; 
  INT64 v4; 
  INT64 a2; 
  _KAPC_STATE ApcState; 
  INT64 result[14]; 
  memset(&ApcState, 0, sizeof(ApcState));
  a2 = 0i64;
  if( !VslVsmEnabled )
    goto LABEL_2;
  KiStackAttachProcess((_KPROCESS *)PsSecureSystemProcess, 0i64, &ApcState);
  SystemDllSecureHandle = PspGetSystemDllSecureHandle(PspSystemDlls, &a2);
  if( SystemDllSecureHandle >= 0 )
  {
    SystemDllSecureHandle = PspMapSystemDll((_EPROCESS *)PsSecureSystemProcess, (__int64)PspSystemDlls, 0, 0);
    if( SystemDllSecureHandle >= 0 )
    {
      v4 = 0i64;
      if( (int)PspGetSystemDllSecureHandle(off_140D2C288, &v4) < 0 )
      {
        v3 = v4;
      }
      else
      {
        v2 = PspMapSystemDll((_EPROCESS *)PsSecureSystemProcess, (__int64)off_140D2C288, 0, 0);
        v3 = v4;
        if( v2 < 0 )
          v3 = 0i64;
      }
      memset((INT64)result, 0i64);
      result[1] = a2;
      result[2] = v3;
      SystemDllSecureHandle = VslpEnterIumSecureMode(2u, 4, 0i64, (INT64)result);
    }
  }
  KiUnstackDetachProcess(&ApcState, 0i64);
  if( SystemDllSecureHandle < 0 )
    LOBYTE(v0) = 0;
  else
LABEL_2:
    LOBYTE(v0) = 1;
  return v0;
}

Referenced by:

Phase1InitializationIoReady
PsInitSystem