CmpVolumeManagerGetContextForFile
INT64 __fastcall CmpVolumeManagerGetContextForFile(INT64 a1, VOID *a2, INT64 a3, INT64 *a4){
_OBJECT_TYPE *v5;
int v6;
struct _DMA_ADAPTER *AttachedDeviceReference;
NTSTATUS v8;
INT64 v9;
INT64 v10;
__int64 ContextForGuidUnsafe;
INT64 v12;
struct _PRIVILEGE_SET *v13;
INT64 v15;
__int64 *v16;
PPRIVILEGE_SET Privileges;
PADAPTER_OBJECT DmaAdapter;
GUID Guid;
Privileges = 0i64;
DmaAdapter = 0i64;
v5 = *(_OBJECT_TYPE **)CmIoFileObjectType;
Guid = 0i64;
v6 = ObReferenceObjectByHandle(a2, 0x80u, v5, 0, (PVOID *)&DmaAdapter, 0i64);
if( v6 < 0 )
goto LABEL_15;
AttachedDeviceReference = (struct _DMA_ADAPTER *)IoGetAttachedDeviceReference((DEVICE_OBJECT *)DmaAdapter->DmaOperations);
v8 = IoVolumeDeviceToGuid(AttachedDeviceReference, &Guid);
v6 = v8;
if( v8 == -1073741811 || v8 == -1073741637 || v8 == -1073741808 )
{
v6 = CmpVolumeContextCreate(v9, 0i64, (INT64 *)&Privileges);
if( v6 >= 0 )
{
CmpVolumeManagerLockContextListExclusive((UINT64)&CmpVolumeManager);
goto LABEL_20;
}
LABEL_24:
v13 = Privileges;
LABEL_11:
if( v13 )
CmpVolumeContextFree(v13);
goto LABEL_13;
}
if( v8 >= 0 )
{
ExAcquirePushLockSharedEx((UINT64)&CmpVolumeManager, 0i64);
ContextForGuidUnsafe = CmpVolumeManagerGetContextForGuidUnsafe(v10, &Guid);
if( _InterlockedCompareExchange64((volatile signed __int64 *)&CmpVolumeManager, 0i64, 17i64) != 17 )
ExfReleasePushLockShared((INT64 *)&CmpVolumeManager);
KeAbPostRelease(&CmpVolumeManager);
if( ContextForGuidUnsafe )
{
v13 = Privileges;
LABEL_10:
*a4 = ContextForGuidUnsafe;
v6 = 0;
goto LABEL_11;
}
v6 = CmpVolumeContextCreate(v12, AttachedDeviceReference, (INT64 *)&Privileges);
if( v6 >= 0 )
{
CmpVolumeManagerLockContextListExclusive((UINT64)&CmpVolumeManager);
ContextForGuidUnsafe = CmpVolumeManagerGetContextForGuidUnsafe(v15, &Guid);
if( ContextForGuidUnsafe )
{
v13 = Privileges;
LABEL_22:
CmpVolumeManagerUnlockContextListExclusive(&CmpVolumeManager);
goto LABEL_10;
}
LABEL_20:
v16 = (__int64 *)qword_140D2DF60;
if( *(__int64 **)qword_140D2DF60 != &qword_140D2DF58 )
__fastfail(3u);
ContextForGuidUnsafe = (__int64)Privileges;
v13 = 0i64;
*(_QWORD *)&Privileges->PrivilegeCount = &qword_140D2DF58;
*(_QWORD *)(ContextForGuidUnsafe + 8) = v16;
*v16 = ContextForGuidUnsafe;
qword_140D2DF60 = ContextForGuidUnsafe;
goto LABEL_22;
}
goto LABEL_24;
}
LABEL_13:
if( AttachedDeviceReference )
HalPutDmaAdapter(AttachedDeviceReference);
LABEL_15:
if( DmaAdapter )
HalPutDmaAdapter(DmaAdapter);
return(unsigned int)v6;
}Referenced by:
CmpCreateHive
CmpVolumeManagerGetContextForFilePath