RtlGetThreadLangIdByIndex

NTSTATUS __stdcall RtlGetThreadLangIdByIndex(
        UINT64 ulFlags,
        UINT64 ulIndex,
        UINT64 *pulLangIdRtrn,
        UINT64 *pulNumLanguagesRtrn,
        INT64 a5,
        INT64 a6,
        INT64 a7,
        INT64 a8){
  __int64 v9; 
  _ETHREAD *CurrentThread; 
  _QWORD *Teb; 
  unsigned __int64 v12; 
  __int64 v13; 
  unsigned __int64 v14; 
  NTSTATUS v15; 
  unsigned __int16 v17; 
  NTSTATUS v18; 
  unsigned int v19; 

  v9 = (unsigned int)ulIndex;
  v18 = 0;
  v17 = 0;
  v19 = 0;
  if( (_DWORD)ulFlags || !pulLangIdRtrn )
    return -1073741811;
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  if( (CurrentThread->Tcb._bf_0 & 0x400) != 0 || CurrentThread->Tcb.ApcStateIndex == 1 )
    Teb = 0i64;
  else
    Teb = CurrentThread->Tcb.Teb;
  v12 = Teb[762];
  if( v12 )
  {
    if( (v12 & 3) != 0 )
      ExRaiseDatatypeMisalignment();
    if( v12 + 64 > 0x7FFFFFFF0000i64 || v12 + 64 < v12 )
      MEMORY[0x7FFFFFFF0000] = 0;
    v13 = *(_QWORD *)(v12 + 24);
    if( v13 )
    {
      v19 = *(unsigned __int16 *)(v12 + 4);
      if( (unsigned int)v9 < v19 )
      {
        if( (v13 & 1) != 0 )
          ExRaiseDatatypeMisalignment();
        v14 = v13 + 6 * v9;
        if( v14 + 6 > 0x7FFFFFFF0000i64 || v14 + 6 < v14 )
          MEMORY[0x7FFFFFFF0000] = 0;
        if( (unsigned __int16)*(_DWORD *)v14 == 1 )
          v17 = *(_WORD *)(v14 + 4);
        else
          v18 = -1073741595;
      }
    }
  }
  *(_DWORD *)pulLangIdRtrn = v17;
  if( pulNumLanguagesRtrn )
    *(_DWORD *)pulNumLanguagesRtrn = v19;
  v15 = v18;
  if( !v18 )
  {
    if( !v17 )
      return -1073741275;
    return v15;
  }
  return v18;
}

Referenced by:

No references.