IopGetRelatedFileName
NTSTATUS __stdcall IopGetRelatedFileName(
_FILE_OBJECT *FileObject,
_UNICODE_STRING *NtFileName,
UINT16 AdditionalAllocationBytes,
UINT16 *DeviceNameLength){
VOID **v4;
int v5;
VOID **v6;
size_t v7;
size_t v8;
VOID **PoolWithTag;
NTSTATUS NameStringMode;
NTSTATUS v13;
VOID **v14;
NTSTATUS FileInformation;
unsigned int v16;
VOID **v17;
UINT64 ReturnLength[2];
v4 = 0i64;
v5 = AdditionalAllocationBytes;
v6 = 0i64;
v7 = 256;
LODWORD(ReturnLength[0]) = 0;
v8 = 256;
do
{
if( v6 )
{
ExFreePoolWithTag(v6, 0);
v6 = 0i64;
}
if( v8 >= 0xFFFF )
{
v13 = -1073741562;
goto LABEL_21;
}
PoolWithTag = ExAllocatePoolWithTag(1ui64, v8, 1665560393i64);
v6 = PoolWithTag;
if( !PoolWithTag )
return -1073741670;
memset(PoolWithTag, 0i64, v8);
NameStringMode = ObQueryNameStringMode(
FileObject->DeviceObject,
(_OBJECT_NAME_INFORMATION *)v6,
v8,
ReturnLength,
0);
v13 = NameStringMode;
v8 = LODWORD(ReturnLength[0]) + 8;
if( DeviceNameLength )
*DeviceNameLength = *(_WORD *)v6;
}
while( NameStringMode == -2147483643 );
if( NameStringMode >= 0 )
{
do
{
if( v4 )
{
ExFreePoolWithTag(v4, 0);
v4 = 0i64;
}
if( v7 >= 0xFFFF )
goto LABEL_26;
v14 = ExAllocatePoolWithTag(1ui64, v7, 1665560393i64);
v4 = v14;
if( !v14 )
{
v13 = -1073741670;
goto LABEL_21;
}
memset(v14, 0i64, v7);
FileInformation = IopGetFileInformation(FileObject->RelatedFileObject, v7, FileNameInformation, v4, ReturnLength);
v13 = FileInformation;
v7 = *(_DWORD *)v4 + 8;
}
while( FileInformation == -2147483643 );
if( FileInformation < 0 )
goto LABEL_19;
v16 = v5 + *(_DWORD *)v4 + *(unsigned __int16 *)v6;
if( v16 >= 0xFFFF )
{
LABEL_26:
v13 = -1073741562;
goto LABEL_19;
}
NtFileName->MaximumLength = v16;
NtFileName->Length = v16 - v5;
v17 = ExAllocatePoolWithTag(1ui64, v16, 1665560393i64);
NtFileName->Buffer = (wchar_t *)v17;
if( v17 )
{
memmove(v17, v6[1], *(unsigned __int16 *)v6);
memmove((char *)NtFileName->Buffer + *(unsigned __int16 *)v6, (char *)v4 + 4, *(_DWORD *)v4);
}
else
{
v13 = -1073741670;
}
LABEL_19:
if( v4 )
ExFreePoolWithTag(v4, 0);
}
LABEL_21:
if( v6 )
ExFreePoolWithTag(v6, 0);
return v13;
}Referenced by:
IopSymlinkRememberJunction