RtlUpcaseUnicodeToCustomCPN

NTSTATUS __stdcall RtlUpcaseUnicodeToCustomCPN(
        PCPTABLEINFO CustomCP,
        PCH CustomCPString,
        UINT64 MaxBytesInCustomCPString,
        PULONG BytesInCustomCPString,
        WCHAR *UnicodeString,
        UINT64 BytesInUnicodeString){
  unsigned int v6; 
  unsigned int v8; 
  _BYTE *v9; 
  unsigned int v11; 
  _BYTE *v12; 
  WCHAR *v13; 
  __int64 v14; 
  UINT16 v15; 
  _BYTE *v16; 
  PUSHORT DBCSOffsets; 
  int v18; 
  _WORD *WideCharTable; 
  WCHAR *v20; 
  __int64 v21; 
  unsigned __int16 v22; 
  __int64 v23; 
  UINT16 v24; 
  __int16 v25; 
  unsigned int v26; 

  v6 = (unsigned int)BytesInUnicodeString >> 1;
  v8 = MaxBytesInCustomCPString;
  LODWORD(v9) = (_DWORD)CustomCPString;
  if( CustomCP->DBCSCodePage )
  {
    DBCSOffsets = CustomCP->DBCSOffsets;
    v18 = (int)CustomCPString;
    WideCharTable = CustomCP->WideCharTable;
    if( v6 )
    {
      v20 = UnicodeString;
      do
      {
        if( !v8 )
          break;
        v21 = *v20++;
        v22 = WideCharTable[v21];
        v23 = DBCSOffsets[(unsigned __int64)v22 >> 8];
        if( (_WORD)v23 )
          v24 = DBCSOffsets[(unsigned __int8)v22 + v23];
        else
          v24 = CustomCP->MultiByteTable[(unsigned __int8)v22];
        v25 = WideCharTable[NLS_UPCASE(v24)];
        if( HIBYTE(v25) )
        {
          v26 = v8--;
          if( v26 < 2 )
            break;
          *v9++ = HIBYTE(v25);
        }
        *v9 = v25;
        --v8;
        LODWORD(v9) = (_DWORD)v9 + 1;
        --v6;
      }
      while( v6 );
    }
    if( BytesInCustomCPString )
      *BytesInCustomCPString = (_DWORD)v9 - v18;
  }
  else
  {
    v11 = MaxBytesInCustomCPString;
    if( v6 < (unsigned int)MaxBytesInCustomCPString )
      v11 = (unsigned int)BytesInUnicodeString >> 1;
    if( BytesInCustomCPString )
      *BytesInCustomCPString = v11;
    v12 = CustomCP->WideCharTable;
    if( v11 )
    {
      v13 = UnicodeString;
      v14 = v11;
      do
      {
        v15 = NLS_UPCASE(CustomCP->MultiByteTable[(unsigned __int8)v12[*v13++]]);
        *v16 = v12[v15];
        --v14;
      }
      while( v14 );
    }
  }
  return v8 < v6 ? 0x80000005 : 0;
}

Referenced by:

No references.