PopCloneUnicodeString
NTSTATUS __stdcall PopCloneUnicodeString(PCUNICODE_STRING SourceString, PUNICODE_STRING DestinationString){
wchar_t *Buffer;
wchar_t *v5;
unsigned int Length;
unsigned int v7;
unsigned int v8;
int v9;
VOID **PoolWithTag;
Buffer = SourceString->Buffer;
v5 = 0i64;
if( Buffer && (Length = SourceString->Length, Length >= 2) )
{
v7 = Length >> 1;
v8 = 2 * v7 + 2;
if( !Buffer[v7 - 1] )
v8 = 2 * v7;
if( v8 >= 0xFFFF )
{
v9 = -2147483643;
LABEL_15:
*DestinationString = 0i64;
return v9;
}
PoolWithTag = ExAllocatePoolWithTag(1ui64, v8, 1734960208i64);
v5 = (wchar_t *)PoolWithTag;
if( !PoolWithTag )
{
v9 = -1073741670;
goto LABEL_15;
}
memset(PoolWithTag, 0i64, v8);
DestinationString->Buffer = v5;
DestinationString->Length = 0;
DestinationString->MaximumLength = v8;
v9 = RtlUnicodeStringCopy(DestinationString, SourceString);
if( v9 >= 0 )
return 0;
}
else
{
v9 = 0;
*SourceString = 0i64;
}
if( v5 )
ExFreePoolWithTag(v5, 0x67696450u);
if( v9 < 0 )
goto LABEL_15;
return v9;
}Referenced by:
PopDirectedDripsDiagCreateDeviceDescription