RtlNtStatusToDosErrorNoTeb

UINT64 __stdcall RtlNtStatusToDosErrorNoTeb(INT64 Status){
  unsigned int v1; 
  UINT64 result; 
  unsigned int v3; 
  unsigned int v4; 
  __int64 v5; 
  unsigned int v6; 
  unsigned int v7; 
  int v8; 
  v1 = 0;
  if( !(_DWORD)Status )
    return 0i64;
  if( (_DWORD)Status == 259 )
    return 997i64;
  result = (unsigned int)Status;
  if( (Status & 0x20000000) == 0 )
  {
    if( (Status & 0xFF0000) == 458752 && ((BYTE3(Status) - 128) & 0xFFFFFFBF) == 0 )
      return(unsigned __int16)Status;
    v3 = Status & 0xCFFFFFFF;
    v4 = 308;
    if( (Status & 0xF0000000) != -805306368 )
      v3 = Status;
    while( 1 )
    {
      v5 = (v1 + v4) >> 1;
      v6 = RtlpRunTable[2 * v5];
      v7 = v3 - v6;
      if( v3 < v6 )
      {
        v4 = v5 - 1;
      }
      else
      {
        if( v7 < (unsigned __int8)byte_140017A34[8 * v5] )
        {
          v8 = (unsigned __int16)word_140017A36[4 * v5];
          if( byte_140017A35[8 * v5] == 1 )
            return(unsigned __int16)RtlpStatusTable[v7 + v8];
          else
            return(unsigned __int16)RtlpStatusTable[2 * v7 + v8] | ((unsigned __int16)RtlpStatusTable[2 * v7 + 1 + v8] << 16);
        }
        v1 = v5 + 1;
      }
      if( v1 > v4 )
      {
        if( (v3 & 0xFFFF0000) == -1073676288 )
          return(unsigned __int16)v3;
        else
          return 317i64;
      }
    }
  }
  return result;
}

Referenced by:

RtlNtStatusToDosError