RtlpNameprepAsciiRealWorker
NTSTATUS __fastcall RtlpNameprepAsciiRealWorker(
int a1,
WCHAR *a2,
int a3,
VOID *a4,
int *a5,
char a6,
WCHAR *pInput,
char a8,
WCHAR *pOutput,
UINT8 bAllowEmail){
__int16 v10;
int v12;
WCHAR *v13;
int *v14;
int v15;
UINT8 v16;
bool v17;
UINT8 v18;
int v19;
NTSTATUS result;
int v21;
signed int v22;
WCHAR *v23;
int v24;
unsigned int EmailAt;
WCHAR *v26;
bool v27;
bool v28;
WCHAR v29;
WCHAR v30;
WCHAR *v31;
int v32;
bool v33;
__int64 v34;
UINT8 bUseStd3Rules;
size_t pcchLength[2];
int v37;
INT64 poutputBufferLength;
v10 = 0;
v12 = a3;
v13 = a2;
if( a2 )
{
if( a3 >= -1 )
{
v14 = a5;
if( a5 )
{
v15 = *a5;
if( *a5 >= 0 && (v15 <= 0 || a4) && (a1 & 0xFFFFFFF8) == 0 )
{
a8 = 0;
v37 = a1 & 1;
LODWORD(poutputBufferLength) = a1 & 4;
v16 = (_DWORD)poutputBufferLength != 0;
v17 = (a1 & 2) != 0;
bAllowEmail = (_DWORD)poutputBufferLength != 0;
if( a3 != -1 )
{
LABEL_11:
if( v12 > 0 && v13[v12 - 1] == v10 )
{
a8 = 1;
--v12;
}
v18 = RtlpValidateAsciiStd3AndLength(v13, (unsigned int)v12, v16, v17);
v19 = 0;
if( v18 )
{
if( !v12 )
return -1073740010;
v21 = v12 + 1;
if( !a8 )
v21 = v12;
goto LABEL_65;
}
v22 = 0;
v23 = pInput;
v24 = 511;
v21 = 0;
if( !(_DWORD)poutputBufferLength )
goto LABEL_28;
EmailAt = FindEmailAt(v13, (unsigned int)v12);
pcchLength[0] = EmailAt;
if( !EmailAt )
goto LABEL_55;
LODWORD(poutputBufferLength) = 511;
result = RtlNormalizeString(1ui64, v13, EmailAt, v26, &poutputBufferLength);
v21 = poutputBufferLength;
v19 = 0;
v27 = result == 0;
if( result >= 0 )
{
if( (_DWORD)poutputBufferLength )
{
v22 = pcchLength[0];
v23 = &pInput[(int)poutputBufferLength];
v24 = 511 - poutputBufferLength;
LABEL_28:
if( v22 >= v12 )
{
LABEL_32:
if( v21 > 0 )
{
v29 = pInput[v21 - 1];
if( v29 == 46 )
{
v30 = v13[v12 - 1];
if( v30 != 46 && v30 != 12290 && v30 != 0xFF0E && v30 != 0xFF61 )
goto LABEL_55;
}
if( !v29 )
goto LABEL_55;
}
v13 = pInput;
bUseStd3Rules = v17;
v31 = pOutput;
LODWORD(poutputBufferLength) = 515;
result = punycode_encode(
pInput,
(unsigned int)v21,
pOutput,
&poutputBufferLength,
bAllowEmail,
bUseStd3Rules);
v32 = poutputBufferLength;
v19 = 0;
if( (_DWORD)poutputBufferLength )
{
if( a6 )
{
if( !a8 )
goto LABEL_44;
if( (int)poutputBufferLength < 515 )
{
v31[(int)poutputBufferLength] = 0;
++v32;
LABEL_44:
if( a4 && v15 )
{
if( v32 > v15 )
{
LABEL_68:
result = -1073741789;
goto LABEL_56;
}
memmove(a4, v31, 2 * v32);
}
*v14 = v32;
return 0;
}
goto LABEL_55;
}
if( !a8 )
{
LABEL_65:
if( a4 && v15 )
{
if( v21 > v15 )
goto LABEL_68;
memmove(a4, v13, 2 * v21);
}
*v14 = v21;
return 0;
}
if( v21 <= 511 )
{
v34 = v21++;
v13[v34] = 0;
goto LABEL_65;
}
LABEL_55:
result = -1073740010;
}
LABEL_56:
*v14 = v19;
return result;
}
LODWORD(poutputBufferLength) = v24;
result = RtlNormalizeString(
((v37 ^ 1u) << 8) + 13,
&v13[v22],
(unsigned int)(v12 - v22),
v23,
&poutputBufferLength);
v19 = 0;
v28 = result == 0;
if( result >= 0 )
{
if( (_DWORD)poutputBufferLength )
{
v21 += poutputBufferLength;
goto LABEL_32;
}
v28 = result == 0;
}
if( v28 || result == -1073741789 || result == -1073740009 )
goto LABEL_55;
v33 = (int)poutputBufferLength <= 0;
LABEL_54:
if( !v33 )
goto LABEL_55;
goto LABEL_56;
}
v27 = result == 0;
}
if( v27 || result == -1073741789 || result == -1073740009 )
goto LABEL_55;
v33 = (int)poutputBufferLength <= 0;
goto LABEL_54;
}
*(_QWORD *)pcchLength = 0i64;
if( RtlStringCchLengthW(v13, 0x7FFFFFFFui64, (UINT64 *)pcchLength) >= 0 )
{
v16 = bAllowEmail;
v12 = pcchLength[0] + 1;
goto LABEL_11;
}
}
}
}
}
return -1073741811;
}Referenced by:
RtlpNameprepAsciiWorker