RtlUnicodeToCustomCPN
NTSTATUS __stdcall RtlUnicodeToCustomCPN(
PCPTABLEINFO CustomCP,
PCH CustomCPString,
UINT64 MaxBytesInCustomCPString,
PULONG BytesInCustomCPString,
WCHAR *UnicodeString,
UINT64 BytesInUnicodeString){
NTSTATUS v6;
unsigned int v7;
PCH v8;
unsigned int *v9;
NTSTATUS v10;
unsigned int v12;
unsigned int v13;
_BYTE *v14;
WCHAR *v15;
__int64 v16;
__int64 v17;
_WORD *WideCharTable;
int v19;
WCHAR *v20;
__int64 v21;
__int16 v22;
unsigned int v23;
UINT64 UnicodeStringByteCount;
char v25;
v6 = 0;
v7 = MaxBytesInCustomCPString;
v8 = CustomCPString;
if( CustomCP->CodePage == 0xFDE9 )
{
v9 = (unsigned int *)&v25;
if( BytesInCustomCPString )
v9 = BytesInCustomCPString;
if( (_DWORD)BytesInUnicodeString )
{
LODWORD(UnicodeStringByteCount) = BytesInUnicodeString;
v10 = RtlUnicodeToUTF8N(CustomCPString, v7, v9, UnicodeString, UnicodeStringByteCount);
}
else
{
*v9 = 0;
v10 = 0;
}
if( v10 == -1073741789 )
return -2147483643;
return v6;
}
else
{
v12 = (unsigned int)BytesInUnicodeString >> 1;
if( CustomCP->DBCSCodePage )
{
WideCharTable = CustomCP->WideCharTable;
v19 = (int)v8;
if( v12 )
{
v20 = UnicodeString;
do
{
if( !v7 )
break;
v21 = *v20++;
v22 = WideCharTable[v21];
if( HIBYTE(v22) )
{
v23 = v7--;
if( v23 < 2 )
break;
*v8++ = HIBYTE(v22);
}
*v8 = v22;
--v7;
++v8;
--v12;
}
while( v12 );
}
if( BytesInCustomCPString )
*BytesInCustomCPString = (_DWORD)v8 - v19;
}
else
{
v13 = MaxBytesInCustomCPString;
if( v12 < (unsigned int)MaxBytesInCustomCPString )
v13 = (unsigned int)BytesInUnicodeString >> 1;
if( BytesInCustomCPString )
*BytesInCustomCPString = v13;
v14 = CustomCP->WideCharTable;
if( v13 )
{
v15 = UnicodeString;
v16 = v13;
do
{
v17 = *v15++;
*v8++ = v14[v17];
--v16;
}
while( v16 );
}
}
return v7 < v12 ? 0x80000005 : 0;
}
}Referenced by:
No references.