RtlpUpdateDynamicTimeZones

UINT8 __stdcall RtlpUpdateDynamicTimeZones(INT16 Year){
  UINT8 v2; 
  unsigned int v4; 
  UINT64 i; 
  INT64 v6; 
  INT64 v7; 
  int v8; 
  UINT64 Length; 
  INT64 Lengtha; 
  UINT64 *ResultLength; 
  UINT64 *ResultLengtha; 
  UINT64 *ResultLengthb; 
  UINT64 v14; 
  VOID *KeyHandle; 
  VOID *Key; 
  VOID *DestinationString; 
  _UNICODE_STRING DestinationString_8; 
  _BYTE ObjectAttributes_8[160]; 
  __int128 buf2; 
  __int128 v21; 
  __int64 v22; 
  int v23; 
  _REG_TZI_FORMAT RegTziFormat; 
  __int16 KeyInformation[136]; 

  Key = 0i64;
  KeyHandle = 0i64;
  DestinationString = 0i64;
  LODWORD(v14) = 0;
  DestinationString_8 = 0i64;
  memset(KeyInformation, 0i64, sizeof(KeyInformation));
  buf2 = 0i64;
  v22 = 0i64;
  v21 = 0i64;
  v23 = 0;
  memset(&RegTziFormat, 0, sizeof(RegTziFormat));
  memset(ObjectAttributes_8, 0, sizeof(ObjectAttributes_8));
  *(_DWORD *)&ObjectAttributes_8[56] = 292;
  *(_DWORD *)&ObjectAttributes_8[80] = 50331648;
  *(_QWORD *)&ObjectAttributes_8[64] = L"TZI";
  *(_QWORD *)&ObjectAttributes_8[72] = &buf2;
  if( RtlpGetRegistryHandle(3ui64, L"Time Zones", 0, &Key) < 0 )
    return 0;
  v4 = 0;
  v2 = 1;
  for( i = 0i64; ; i = v4 )
  {
    LODWORD(Length) = 272;
    if( ZwEnumerateKey(Key, i, KeyBasicInformation, KeyInformation, Length, &v14) < 0 )
      break;
    *(_DWORD *)(&DestinationString_8.MaximumLength + 1) = 0;
    DestinationString_8.MaximumLength = KeyInformation[6];
    DestinationString_8.Length = KeyInformation[6];
    *(_QWORD *)&ObjectAttributes_8[8] = Key;
    DestinationString_8.Buffer = (wchar_t *)&KeyInformation[8];
    *(_QWORD *)&ObjectAttributes_8[16] = &DestinationString_8;
    *(_DWORD *)ObjectAttributes_8 = 48;
    *(_DWORD *)&ObjectAttributes_8[24] = 576;
    *(_OWORD *)&ObjectAttributes_8[32] = 0i64;
    if( ZwOpenKey(
           &KeyHandle,
           0x2000000ui64,
           (_OBJECT_ATTRIBUTES *)ObjectAttributes_8,
           v6,
           Lengtha,
           (INT64)ResultLength,
           v14,
           (INT64)KeyHandle) >= 0 )
    {
      RtlInitUnicodeString(&DestinationString_8, L"Dynamic DST");
      *(_QWORD *)&ObjectAttributes_8[8] = KeyHandle;
      *(_DWORD *)ObjectAttributes_8 = 48;
      *(_QWORD *)&ObjectAttributes_8[16] = &DestinationString_8;
      *(_DWORD *)&ObjectAttributes_8[24] = 576;
      *(_OWORD *)&ObjectAttributes_8[32] = 0i64;
      if( ZwOpenKey(
             &DestinationString,
             0x20019ui64,
             (_OBJECT_ATTRIBUTES *)ObjectAttributes_8,
             v7,
             Length,
             (INT64)ResultLengtha,
             v14,
             (INT64)KeyHandle) >= 0 )
      {
        buf2 = 0i64;
        LODWORD(buf2) = -44;
        v21 = 0i64;
        v22 = 0i64;
        v23 = 0;
        LOBYTE(v8) = RtlpQueryRegistryValues((_KTRAP_FRAME *)0x40000000, (_KEXCEPTION_FRAME *)KeyHandle);
        if( v8 >= 0
          && RtlpFindRegTziForCurrentYear(&RegTziFormat, DestinationString, (unsigned __int16)Year) >= 0
          && memcmp(&RegTziFormat, &buf2, 0x2Cui64) )
        {
          LODWORD(ResultLengthb) = 44;
          RtlWriteRegistryValue(
            0x40000000ui64,
            (const WCHAR *)KeyHandle,
            L"TZI",
            3ui64,
            &RegTziFormat,
            (UINT64)ResultLengthb);
        }
        ZwClose((_HANDLE)DestinationString);
      }
      ZwClose((_HANDLE)KeyHandle);
    }
    ++v4;
  }
  ZwClose((_HANDLE)Key);
  return v2;
}

Referenced by:

ExpRefreshTimeZoneInformation