GetBootSystemTime

VOID __stdcall GetBootSystemTime(_LOADER_PARAMETER_EXTENSION *Extension, _LARGE_INTEGER *SystemTime){
  bool v3; 
  _LARGE_INTEGER v5; 
  __int64 v6; 
  NTSTATUS v7; 
  unsigned __int64 v8; 
  unsigned __int64 v9; 
  unsigned __int64 v10; 
  UINT64 v11; 
  UINT64 v12; 
  _KSPIN_LOCK *v13; 
  _ESERVERSILO_GLOBALS *CurrentServerSiloGlobals; 
  _TIME_FIELDS TimeFields; 
  UINT64 pullResult; 
  unsigned __int64 v17; 

  v17 = 0i64;
  pullResult = 0i64;
  v3 = (Extension->$646A265A81E4D5CDA223C7F06EA72776::_bf_0 & 1) == 0;
  v5 = Extension->SystemTime;
  TimeFields = 0i64;
  if( v3 && !*(&stru_140CF2E80 + 1829) )
    v5.QuadPart += PsGetCurrentServerSiloGlobals((_KSPIN_LOCK *)Extension)->ExTimeZoneState->TimeZoneBias.QuadPart;
  v6 = ((__int64(__fastcall *)(unsigned __int64 *))off_140C007F0)(&v17);
  v7 = RtlULongLongMult(v6 - Extension->TimeStampAtSystemTimeRead, 0x989680ui64, &pullResult);
  v10 = (unsigned int)v7;
  v11 = pullResult / v17;
  if( v7 < 0 )
  {
    v8 = v9 / v17;
    v10 = v17 * (v9 / v17);
    v11 = 10000000 * (v9 / v17) + 10000000 * (v9 % v17) / v17;
  }
  v12 = v11 + v5.QuadPart;
  v3 = (Extension->$646A265A81E4D5CDA223C7F06EA72776::_bf_0 & 2) == 0;
  pullResult = v12;
  if( v3 )
  {
    if( !*(&stru_140CF2E80 + 1829) )
      pullResult = v12 - PsGetCurrentServerSiloGlobals((_KSPIN_LOCK *)v10)->ExTimeZoneState->TimeZoneBias.QuadPart;
    RtlpTimeToTimeFields((_LARGE_INTEGER *)&pullResult, &TimeFields, (_LARGE_INTEGER)v8);
    HalSetRealTimeClock(&TimeFields.Year);
  }
  else if( (*(&ExBootDevicesRemovedEvent + 1112) & 4) == 0 && (unsigned __int8)HalQueryRealTimeClock(&TimeFields) )
  {
    if( !RtlpTimeFieldsToTime(&TimeFields.Year, (INT64 *)&pullResult) || *(&stru_140CF2E80 + 1829) )
    {
      v12 = pullResult;
    }
    else
    {
      CurrentServerSiloGlobals = PsGetCurrentServerSiloGlobals(v13);
      v12 = CurrentServerSiloGlobals->ExTimeZoneState->TimeZoneBias.QuadPart + pullResult;
    }
  }
  SystemTime->QuadPart = v12;
}

Referenced by:

No references.