CmpAssignSecurityToKcb

CHAR __fastcall CmpAssignSecurityToKcb(UINT64 P3, UINT64 P4, INT64 a3, CHAR a4, CHAR a5){
  unsigned __int64 BugCheckParameter4; 
  CHAR v9; 
  CMHIVE *v10; 
  UINT64 Index; 

  LODWORD(Index) = 0;
  BugCheckParameter4 = (unsigned int)P4;
  v9 = 1;
  if( (_DWORD)P4 == -1 )
  {
    *(_QWORD *)(P3 + 88) = 0i64;
  }
  else
  {
    v10 = *(CMHIVE **)(P3 + 32);
    if( !a4 )
      ExAcquirePushLockSharedEx(&v10->SecurityLock, 0i64);
    if( CmpFindSecurityCellCacheIndex(v10, (unsigned int)BugCheckParameter4, &Index) )
    {
      if( !a3 )
        *(_QWORD *)(P3 + 88) = v10->SecurityCache[(unsigned int)Index].CachedSecurity;
    }
    else
    {
      *(_QWORD *)(P3 + 88) = 0i64;
      if( !a5 )
        KeBugCheckEx(0x51u, (PVOID)4, (PVOID)1, (PVOID)P3, (PVOID)BugCheckParameter4);
      v9 = 0;
    }
    if( !a4 )
      ExReleasePushLockEx((_DWORD)v10 + 1776, 0);
  }
  return v9;
}

Referenced by:

CmRestoreKey
CmpAssignKeySecurity
CmpCommitAddKeyUoW
CmpCommitSetSecurityUoW
CmpCreateChild
CmpDoBuildVirtualStack
CmpLightWeightCommitAddKeyUoW
CmpLightWeightCommitSetSecDescUoW
CmpRebuildKcbCacheFromNode
CmpSetSecurityDescriptorInfo