CmpVolumeManagerGetContextForFile
INT64 __fastcall CmpVolumeManagerGetContextForFile(INT64 a1, VOID *a2, INT64 a3, INT64 *a4){
_OBJECT_TYPE *v5;
INT64 v6;
int v7;
INT64 v8;
_ADAPTER_OBJECT *v9;
_ADAPTER_OBJECT *v10;
NTSTATUS v11;
INT64 v12;
INT64 v13;
__int64 ContextForGuidUnsafe;
INT64 v15;
_PRIVILEGE_SET *v16;
INT64 v18;
__int64 *v19;
PPRIVILEGE_SET Privileges;
PADAPTER_OBJECT DmaAdapter;
_GUID Guid;
Privileges = 0i64;
DmaAdapter = 0i64;
v5 = (_OBJECT_TYPE *)**(&CmpDummyThreadEvent + 344);
Guid = 0i64;
v7 = ObReferenceObjectByHandle(a2, 0x80ui64, v5, 0, (VOID **)&DmaAdapter, 0i64);
if( v7 < 0 )
goto LABEL_15;
LODWORD(v9) = IoGetAttachedDeviceReference((INT64)DmaAdapter->AdapterObject.DmaHeader.DmaOperations, v6, v8);
v10 = v9;
v11 = IoVolumeDeviceToGuid(v9, &Guid);
v7 = v11;
if( v11 == -1073741811 || v11 == -1073741637 || v11 == -1073741808 )
{
v7 = CmpVolumeContextCreate(v12, 0i64, (INT64 *)&Privileges);
if( v7 >= 0 )
{
CmpVolumeManagerLockContextListExclusive((UINT64)&CmpVolumeManager);
goto LABEL_20;
}
LABEL_24:
v16 = Privileges;
LABEL_11:
if( v16 )
CmpVolumeContextFree(v16);
goto LABEL_13;
}
if( v11 >= 0 )
{
ExAcquirePushLockSharedEx(&CmpVolumeManager, 0i64);
ContextForGuidUnsafe = CmpVolumeManagerGetContextForGuidUnsafe(v13, &Guid);
if( _InterlockedCompareExchange64(&CmpVolumeManager._bf_0, 0i64, 17i64) != 17 )
ExfReleasePushLockShared(&CmpVolumeManager);
KeAbPostRelease(&CmpVolumeManager);
if( ContextForGuidUnsafe )
{
v16 = Privileges;
LABEL_10:
*a4 = ContextForGuidUnsafe;
v7 = 0;
goto LABEL_11;
}
v7 = CmpVolumeContextCreate(v15, v10, (INT64 *)&Privileges);
if( v7 >= 0 )
{
CmpVolumeManagerLockContextListExclusive((UINT64)&CmpVolumeManager);
ContextForGuidUnsafe = CmpVolumeManagerGetContextForGuidUnsafe(v18, &Guid);
if( ContextForGuidUnsafe )
{
v16 = Privileges;
LABEL_22:
CmpVolumeManagerUnlockContextListExclusive(&CmpVolumeManager);
goto LABEL_10;
}
LABEL_20:
v19 = (__int64 *)qword_140D2DF60;
if( *(__int64 **)qword_140D2DF60 != &qword_140D2DF58 )
__fastfail(3u);
ContextForGuidUnsafe = (__int64)Privileges;
v16 = 0i64;
*(_QWORD *)&Privileges->PrivilegeCount = &qword_140D2DF58;
*(_QWORD *)(ContextForGuidUnsafe + 8) = v19;
*v19 = ContextForGuidUnsafe;
qword_140D2DF60 = ContextForGuidUnsafe;
goto LABEL_22;
}
goto LABEL_24;
}
LABEL_13:
if( v10 )
HalPutDmaAdapter(v10);
LABEL_15:
if( DmaAdapter )
HalPutDmaAdapter(DmaAdapter);
return(unsigned int)v7;
}Referenced by:
CmpCreateHive
CmpVolumeManagerGetContextForFilePath