PiControlQueryDeviceRelations
__int64 __fastcall PiControlQueryDeviceRelations(__int64 a1, __int16 *a2, INT64 a3, INT8 a4){
__int16 v4;
int v7;
VOID *v8;
UINT64 v9;
NTSTATUS UserModeCallersCopy;
NTSTATUS v11;
UINT64 AllocateDestination;
UINT64 AllocateDestinationa;
VOID *Dest;
_UNICODE_STRING Destination;
UINT64 BufferLength;
v4 = *a2;
Destination = 0i64;
Destination.MaximumLength = v4;
Destination.Length = v4;
if( (unsigned __int16)(v4 - 1) > 0x18Fu || (v4 & 1) != 0 )
return 3221225485i64;
Dest = 0i64;
Destination.Buffer = 0i64;
v7 = *((_DWORD *)a2 + 5);
v8 = (VOID *)*((_QWORD *)a2 + 3);
if( v7 && v8 )
v9 = (unsigned int)(2 * v7);
else
v9 = 0i64;
LODWORD(BufferLength) = v9;
UserModeCallersCopy = PiControlAllocateBufferForUserModeCaller(&Dest, v9, a4, v8);
if( UserModeCallersCopy >= 0 )
{
LODWORD(AllocateDestination) = 1;
UserModeCallersCopy = PiControlMakeUserModeCallersCopy(
(VOID **)&Destination.Buffer,
*((VOID **)a2 + 1),
Destination.Length,
2ui64,
a4,
AllocateDestination);
if( UserModeCallersCopy >= 0 )
{
UserModeCallersCopy = PiQueryDeviceRelations(
&Destination,
*((PNP_QUERY_RELATION *)a2 + 4),
&BufferLength,
(WCHAR *)Dest);
if( Dest )
{
LODWORD(AllocateDestinationa) = 0;
v11 = PiControlMakeUserModeCallersCopy(
(VOID **)a2 + 3,
Dest,
(unsigned int)(2 * *((_DWORD *)a2 + 5)),
2ui64,
a4,
AllocateDestinationa);
if( v11 < 0 )
UserModeCallersCopy = v11;
}
*((_DWORD *)a2 + 5) = (unsigned int)BufferLength >> 1;
}
}
PiControlFreeUserModeCallersBuffer(a4, Dest);
PiControlFreeUserModeCallersBuffer(a4, Destination.Buffer);
return(unsigned int)UserModeCallersCopy;
}Referenced by:
No references.