RtlpGetDynamicTimeZoneInfoHandle

NTSTATUS __stdcall RtlpGetDynamicTimeZoneInfoHandle(WCHAR *TimeZoneKeyName, VOID **Key){
  __int64 v3; 
  __int16 *v4; 
  __int16 v5; 
  __int16 *v6; 
  NTSTATUS result; 
  __int64 v8; 
  __int16 *v9; 
  __int64 v10; 
  __int16 *v11; 
  __int64 v12; 
  __int64 v13; 
  char *v14; 
  __int16 v15; 
  __int16 *v16; 
  __int16 pszDest[256]; 

  if( !*TimeZoneKeyName )
    return -1073741811;
  v3 = 256i64;
  v4 = pszDest;
  do
  {
    if( v3 == -2147483390 )
      break;
    v5 = *(__int16 *)((char *)v4 + (char *)L"Time Zones\\" - (char *)pszDest);
    if( !v5 )
      break;
    *v4++ = v5;
    --v3;
  }
  while( v3 );
  v6 = v4 - 1;
  if( v3 )
    v6 = v4;
  *v6 = 0;
  result = v3 == 0 ? 0x80000005 : 0;
  if( v3 )
  {
    result = RtlStringCbCatW((WCHAR *)pszDest, 0x200ui64, TimeZoneKeyName);
    if( result >= 0 )
    {
      v8 = 256i64;
      v9 = pszDest;
      do
      {
        if( !*v9 )
          break;
        ++v9;
        --v8;
      }
      while( v8 );
      result = v8 == 0 ? 0xC000000D : 0;
      if( v8 )
        v10 = 256 - v8;
      else
        v10 = 0i64;
      if( v8 )
      {
        v11 = &pszDest[v10];
        v12 = 256 - v10;
        if( 256 != v10 )
        {
          v13 = 2147483646i64;
          v14 = (char *)((char *)L"\\Dynamic DST" - (char *)v11);
          do
          {
            if( !v13 )
              break;
            v15 = *(__int16 *)((char *)v11 + (_QWORD)v14);
            if( !v15 )
              break;
            *v11 = v15;
            --v13;
            ++v11;
            --v12;
          }
          while( v12 );
        }
        v16 = v11 - 1;
        if( v12 )
          v16 = v11;
        *v16 = 0;
        result = v12 == 0 ? 0x80000005 : 0;
      }
      if( result >= 0 )
        return RtlpGetRegistryHandle(3ui64, (const WCHAR *)pszDest, 0, Key);
    }
  }
  return result;
}

Referenced by:

RtlpCheckDynamicTimeZoneInformation