ObpReferenceDeviceMap
__int64 __fastcall ObpReferenceDeviceMap(char a1){
_ETHREAD *CurrentThread;
__int64 v3;
char v4;
struct _DMA_ADAPTER *v5;
__int64 v6;
_EJOB *ProcessServerSilo;
ULONG *v8;
ULONG *v9;
WCHAR *v10;
ULONG *v11;
__int64 *CurrentServerSiloGlobals;
_ETHREAD *v13;
UINT64 v14;
struct _DMA_ADAPTER *v16;
__int64 v17[9];
BOOL v18;
BYTE v19;
INT64 v20;
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
v3 = 0i64;
v4 = 0;
v5 = 0i64;
v6 = *((_QWORD *)CurrentThread + 68);
ProcessServerSilo = (_EJOB *)PsGetProcessServerSilo(v6);
if( ProcessServerSilo != PsGetCurrentServerSilo() )
v4 = 1;
if( (*((_DWORD *)CurrentThread + 324) & 8) == 0 || a1 )
{
if( !v4 )
goto LABEL_5;
}
else if( !v4 )
{
v16 = (struct _DMA_ADAPTER *)PsReferenceImpersonationTokenEx((INT64)CurrentThread, 1, &v19, &v18, &v20, 0i64);
v5 = v16;
if( !v16 )
goto LABEL_5;
if( v16[1].DmaOperations != (_DMA_OPERATIONS *)999 )
{
v17[0] = 0i64;
if( SeGetTokenDeviceMap((__int64)v16, v17) >= 0 )
{
v3 = v17[0];
if( v17[0] )
{
_InterlockedIncrement((volatile signed __int32 *)(v17[0] + 24));
goto LABEL_11;
}
}
LABEL_5:
if( !*(_QWORD *)(v6 + 1416) && ObSetCurrentProcessDeviceMap(v9, v8, v10, v11) < 0 )
goto LABEL_11;
goto LABEL_6;
}
v4 = 1;
}
LABEL_6:
CurrentServerSiloGlobals = PsGetCurrentServerSiloGlobals();
v13 = (_ETHREAD *)KeGetCurrentThread();
--*((_WORD *)v13 + 243);
v14 = (UINT64)(CurrentServerSiloGlobals + 15);
ExAcquirePushLockSharedEx((UINT64)(CurrentServerSiloGlobals + 15), 0i64);
if( v4 )
v3 = *CurrentServerSiloGlobals;
else
v3 = *(_QWORD *)(v6 + 1416);
if( v3 )
_InterlockedIncrement((volatile signed __int32 *)(v3 + 24));
ExReleasePushLockEx(v14, 0i64);
KiLeaveGuardedRegionUnsafe((__int64)KeGetCurrentThread());
LABEL_11:
if( v5 )
HalPutDmaAdapter(v5);
return v3;
}Referenced by:
ObQueryDeviceMapInformation
ObpLookupObjectName