CmpConstructNameWithStatus
__int64 __fastcall CmpConstructNameWithStatus(_CM_KEY_CONTROL_BLOCK *Kcb, _UNICODE_STRING **KeyPath){
_ETHREAD *CurrentThread;
UINT8 v5;
__int64 v6;
_LOOKASIDE_LIST_EX *v7;
int LayerHeight;
_PRIVILEGE_SET *v9;
__int16 v10;
PPRIVILEGE_SET v11;
int v12;
unsigned int v13;
_CM_KCB_LAYER_INFO *LayerInfo;
__int64 v16;
__int16 v17;
_PRIVILEGE_SET *TransientPoolWithTag;
__int128 v19;
PPRIVILEGE_SET Privileges[2];
_UNICODE_STRING *KeyPatha;
v19 = 0i64;
WORD1(v19) = -1;
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
*(_OWORD *)Privileges = 0i64;
--CurrentThread->Tcb.KernelApcDisable;
KeyPatha = 0i64;
v5 = ExAcquireRundownProtection((_EX_RUNDOWN_REF *)&CmpDummyThreadEvent + 132);
if( !v5 )
KeLeaveCriticalRegionThread(KeGetCurrentThread());
LayerHeight = Kcb->LayerHeight;
v9 = 0i64;
v10 = Kcb->LayerHeight;
if( LayerHeight >= 2 )
{
TransientPoolWithTag = (_PRIVILEGE_SET *)CmpAllocateTransientPoolWithTag(
1ui64,
8i64 * (unsigned int)(LayerHeight - 1));
v9 = TransientPoolWithTag;
if( !TransientPoolWithTag )
{
v9 = Privileges[1];
v13 = -1073741670;
goto LABEL_16;
}
memset(TransientPoolWithTag, 0i64, 8 * (LayerHeight - 1));
v10 = Kcb->LayerHeight;
}
LOWORD(v19) = LayerHeight;
Privileges[1] = v9;
WORD1(v19) = v10;
if( v10 )
{
LayerInfo = Kcb->LayerInfo;
if( LayerInfo )
{
do
{
CmpSetKcbAtLayerHeight((__int64)&v19, v10, (__int64)LayerInfo->Kcb);
LayerInfo = *(_CM_KCB_LAYER_INFO **)(v16 + 24);
v10 = v17 - 1;
}
while( LayerInfo );
v9 = Privileges[1];
v10 = WORD1(v19);
}
}
else
{
*((_QWORD *)&v19 + 1) = Kcb;
}
if( v5 && v10 >= 0 )
{
do
{
v11 = v10 >= 2 ? (PPRIVILEGE_SET)*((_QWORD *)v9 + v10 - 2) : Privileges[v10 - 1];
if( HIWORD(v11[3].Control) && BYTE1(v11[3].Control) == 1 )
break;
if( v11[2].PrivilegeCount != -1 )
{
if( Kcb->KeyHash.KeyCell != -1 || (Kcb->_bf_b8 & 0x40000) == 0 )
{
v12 = CmpConstructNameFromKeyNodes((__int64)&v19, &KeyPatha, v6, v7);
v9 = Privileges[1];
goto LABEL_14;
}
break;
}
--v10;
}
while( v10 >= 0 );
}
v12 = CmpConstructNameFromKcbNameBlocks(Kcb, &KeyPatha);
LABEL_14:
v13 = v12;
if( v12 >= 0 )
{
v13 = 0;
*KeyPath = KeyPatha;
}
LABEL_16:
if( v9 )
CmSiFreeMemory(v9);
if( v5 )
{
ExReleaseRundownProtection((_EX_RUNDOWN_REF *)&CmpDummyThreadEvent + 132);
KeLeaveCriticalRegionThread(KeGetCurrentThread());
}
return v13;
}Referenced by:
CmAddLogForAction
CmCallbackGetKeyObjectIDEx
CmEtwRunDown
CmLoadAppKey
CmQueryLayeredKey
CmVirtualKCBToRealPath
CmpConstructAndCacheName
CmpConstructName
CmpDoWritethroughReparse
CmpDumpKeyBodyList
CmpEtwDumpKcb
CmpReportAuditVirtualizationEvent
CmpTraceHiveSaveStart
CmpTraceSecurityChanging