AdtpBuildIPv4Strings
NTSTATUS __stdcall AdtpBuildIPv4Strings(
sockaddr_in *pSockAddr,
UNICODE_STRING *ResultantString1,
UINT8 *FreeWhenDone1,
UNICODE_STRING *ResultantString2,
UINT8 *FreeWhenDone2){
NTSTATUS v9;
wchar_t *PoolWithTag;
wchar_t *v11;
__int64 v12;
if( pSockAddr->sin_family != 2 )
{
v9 = -1073741503;
goto LABEL_13;
}
if( ResultantString1 && FreeWhenDone1 )
{
ResultantString1->MaximumLength = 32;
PoolWithTag = (wchar_t *)ExAllocatePoolWithTag(PagedPool, 0x20ui64, 0x6B416553ui64);
ResultantString1->Buffer = PoolWithTag;
if( !PoolWithTag )
{
LABEL_6:
v9 = -1073741801;
goto LABEL_13;
}
*FreeWhenDone1 = 1;
ResultantString1->Length = 2
* ((__int64)((unsigned int)RtlIpv4AddressToStringW(
&pSockAddr->sin_addr,
ResultantString1->Buffer)
- LODWORD(ResultantString1->Buffer)) >> 1);
}
if( !ResultantString2 || !FreeWhenDone2 )
return 0;
ResultantString2->MaximumLength = 16;
v11 = (wchar_t *)ExAllocatePoolWithTag(PagedPool, 0x10ui64, 0x6B416553ui64);
ResultantString2->Buffer = v11;
if( !v11 )
goto LABEL_6;
*FreeWhenDone2 = 1;
if( StringCchPrintfW(ResultantString2->Buffer, 8ui64, (WCHAR *)L"%d") >= 0 )
{
v12 = -1i64;
do
++v12;
while( ResultantString2->Buffer[v12] );
ResultantString2->Length = 2 * v12;
return 0;
}
v9 = -1073741811;
LABEL_13:
if( FreeWhenDone1 && *FreeWhenDone1 )
{
*FreeWhenDone1 = 0;
ExFreePoolWithTag(ResultantString1->Buffer, 0);
}
if( FreeWhenDone2 && *FreeWhenDone2 )
{
*FreeWhenDone2 = 0;
ExFreePoolWithTag(ResultantString2->Buffer, 0);
}
return v9;
}Referenced by:
AdtpBuildSockAddrString