CmpQueryKeySecurity
INT64 __stdcall CmpQueryKeySecurity(
CM_KEY_BODY *KeyBody,
UINT64 *SecurityInformation,
VOID *SecurityDescriptor,
UINT64 *CapturedLength){
char v4;
_ETHREAD *CurrentThread;
UINT8 v10;
int started;
INT64 v12;
CM_TRANS *v13;
PSECURITY_DESCRIPTOR ObjectsSecurityDescriptor;
__int128 v16;
__int128 v17;
CM_TRANS *CmTrans;
v4 = 0;
v16 = 0i64;
CmTrans = 0i64;
v17 = 0i64;
WORD1(v16) = -1;
CurrentThread = (_ETHREAD *)KeGetCurrentThread();
--CurrentThread->Tcb.KernelApcDisable;
v10 = ExAcquireRundownProtection((_EX_RUNDOWN_REF *)&CmpDummyThreadEvent + 132);
if( v10 )
{
CmpLockRegistry();
v4 = 1;
started = CmpStartKcbStackForTopLayerKcb((INT64)&v16, (INT64)KeyBody->KeyControlBlock);
if( started < 0 )
goto LABEL_10;
CmpLockKcbStackShared((INT64)&v16);
started = CmpPerformKeyBodyDeletionCheck(KeyBody, 0i64);
if( started < 0 )
goto LABEL_9;
if( *(_QWORD *)&KeyBody->Trans.0 || KeyBody->KtmUow )
{
started = CmpTransSearchAddTransFromKeyBody(KeyBody, &CmTrans);
if( started < 0 || (v13 = CmTrans, started = CmpPerformKeyBodyDeletionCheck(KeyBody, CmTrans), started < 0) )
{
LABEL_9:
CmpUnlockKcbStack((INT64)&v16);
goto LABEL_10;
}
}
else
{
v13 = CmTrans;
}
ObjectsSecurityDescriptor = &CmpGetSecurityCacheEntryForKcbStack((INT64)&v16, (INT64)v13, v12)[2];
started = SeQuerySecurityDescriptorInfo(
SecurityInformation,
SecurityDescriptor,
CapturedLength,
&ObjectsSecurityDescriptor);
if( started >= 0 )
started = 0;
goto LABEL_9;
}
KeLeaveCriticalRegionThread(KeGetCurrentThread());
started = -1073741431;
LABEL_10:
if( *((_QWORD *)&v17 + 1) )
CmSiFreeMemory(*((PPRIVILEGE_SET *)&v17 + 1));
if( v4 )
CmpUnlockRegistry();
if( v10 )
{
ExReleaseRundownProtection((_EX_RUNDOWN_REF *)&CmpDummyThreadEvent + 132);
KeLeaveCriticalRegionThread(KeGetCurrentThread());
}
return(unsigned int)started;
}Referenced by:
CmpSecurityMethod