RtlpSetTimeZoneInformationWorker

NTSTATUS __stdcall RtlpSetTimeZoneInformationWorker(
        _RTL_DYNAMIC_TIME_ZONE_INFORMATION *DynamicTimeZoneInformation,
        UINT64 TimeZoneInformationSize){
  wchar_t *StandardName; 
  unsigned int v3; 
  UINT64 v5; 
  int v6; 
  UINT64 v7; 
  int v8; 
  UINT64 v9; 
  int v10; 
  NTSTATUS result; 
  int v12; 
  int *p_DynamicDaylightTimeDisabled; 
  UINT64 ValueLength; 
  UINT64 ValueLengtha; 
  UINT64 ValueLengthb; 
  int v17; 
  int DynamicDaylightTimeDisabled; 
  void *Key; 

  Key = 0i64;
  StandardName = DynamicTimeZoneInformation->tzi.StandardName;
  v3 = TimeZoneInformationSize;
  v5 = wcsnlen(DynamicTimeZoneInformation->tzi.StandardName, 0x20ui64);
  v6 = v5;
  if( v5 >= 0x20 )
    return -1073741811;
  v7 = wcsnlen(DynamicTimeZoneInformation->tzi.DaylightName, 0x20ui64);
  v8 = v7;
  if( v7 >= 0x20 )
    return -1073741811;
  if( v3 < 0x1B0 )
  {
    v10 = 0;
  }
  else
  {
    v9 = wcsnlen(DynamicTimeZoneInformation->TimeZoneKeyName, 0x80ui64);
    v10 = v9;
    if( v9 >= 0x80 )
      return -1073741811;
  }
  result = RtlpGetTimeZoneInfoHandle(1u, &Key);
  if( result >= 0 )
  {
    LODWORD(ValueLength) = 4;
    if( RtlWriteRegistryValue(
           0x40000000ui64,
           (const WCHAR *)Key,
           L"Bias",
           4ui64,
           DynamicTimeZoneInformation,
           ValueLength) < 0
      || (LODWORD(ValueLengtha) = 2 * v6 + 2,
          RtlWriteRegistryValue(0x40000000ui64, (const WCHAR *)Key, L"StandardName", 1ui64, StandardName, ValueLengtha) < 0)
      || (LODWORD(ValueLengtha) = 4,
          RtlWriteRegistryValue(
            0x40000000ui64,
            (const WCHAR *)Key,
            L"StandardBias",
            4ui64,
            &DynamicTimeZoneInformation->tzi.StandardBias,
            ValueLengtha) < 0)
      || (LODWORD(ValueLengtha) = 16,
          RtlWriteRegistryValue(
            0x40000000ui64,
            (const WCHAR *)Key,
            L"StandardStart",
            3ui64,
            &DynamicTimeZoneInformation->tzi.StandardStart,
            ValueLengtha) < 0)
      || (LODWORD(ValueLengtha) = 2 * v8 + 2,
          RtlWriteRegistryValue(
            0x40000000ui64,
            (const WCHAR *)Key,
            L"DaylightName",
            1ui64,
            DynamicTimeZoneInformation->tzi.DaylightName,
            ValueLengtha) < 0)
      || (LODWORD(ValueLengtha) = 4,
          RtlWriteRegistryValue(
            0x40000000ui64,
            (const WCHAR *)Key,
            L"DaylightBias",
            4ui64,
            &DynamicTimeZoneInformation->tzi.DaylightBias,
            ValueLengtha) < 0)
      || (LODWORD(ValueLengtha) = 16,
          RtlWriteRegistryValue(
            0x40000000ui64,
            (const WCHAR *)Key,
            L"DaylightStart",
            3ui64,
            &DynamicTimeZoneInformation->tzi.DaylightStart,
            ValueLengtha) < 0)
      || v3 < 0x1B0 )
    {
      LODWORD(ValueLengtha) = 2;
      LOWORD(v17) = 0;
      v12 = RtlWriteRegistryValue(0x40000000ui64, (const WCHAR *)Key, L"TimeZoneKeyName", 1ui64, &v17, ValueLengtha);
      if( v12 >= 0 )
      {
        DynamicDaylightTimeDisabled = DynamicTimeZoneInformation->DynamicDaylightTimeDisabled;
        p_DynamicDaylightTimeDisabled = &DynamicDaylightTimeDisabled;
        goto LABEL_21;
      }
    }
    else
    {
      LODWORD(ValueLengtha) = 2 * v10 + 2;
      v12 = RtlWriteRegistryValue(
              0x40000000ui64,
              (const WCHAR *)Key,
              L"TimeZoneKeyName",
              1ui64,
              DynamicTimeZoneInformation->TimeZoneKeyName,
              ValueLengtha);
      if( v12 >= 0 )
      {
        v17 = DynamicTimeZoneInformation->DynamicDaylightTimeDisabled;
        p_DynamicDaylightTimeDisabled = &v17;
LABEL_21:
        LODWORD(ValueLengthb) = 4;
        v12 = RtlWriteRegistryValue(
                0x40000000ui64,
                (const WCHAR *)Key,
                L"DynamicDaylightTimeDisabled",
                4ui64,
                p_DynamicDaylightTimeDisabled,
                ValueLengthb);
      }
    }
    ZwClose((_HANDLE)Key);
    return v12;
  }
  return result;
}

Referenced by:

ExpRefreshTimeZoneInformation
ExpSetTimeZoneInformation
RtlSetDynamicTimeZoneInformation
RtlSetTimeZoneInformation