CmpGetSecurityDescriptorNode
__int64 __fastcall CmpGetSecurityDescriptorNode(
_HHIVE *Hive,
unsigned int Cell,
_CM_KEY_NODE *Node,
void *SecurityDescriptor,
int Replace,
unsigned int *SecurityCell){
ULONG_PTR v10;
_CELL_DATA *v11;
int v13;
size_t v14;
_DWORD *v15;
INT64 v16;
PVOID CellIndex;
_HV_GET_CELL_CONTEXT CellAddressContext;
VOID *CellAddress;
LODWORD(CellIndex) = 0;
CellAddress = 0i64;
CellAddressContext.Cell = -1;
*(_DWORD *)&CellAddressContext.BinContext._bf_0 = 0;
if( !HvMarkCellDirty(Hive, *(PVOID *)&Cell, 0) )
return 3221225853i64;
CmpUpdateKeyNodeAccessBits(Hive, Node, Cell);
if( !CmpFindMatchingDescriptorCell((CMHIVE *)Hive, SecurityDescriptor, Cell >> 31, (UINT64 *)&CellIndex, 0i64) )
{
if( KeGetCurrentThread()->PreviousMode
&& (Hive[2].Storage[1].FreeDisplay[6].RealVectorSize & 0x20) != 0
&& Hive[1].Storage[0].FreeDisplay[1].RealVectorSize > 1 )
{
return 3221225506i64;
}
v13 = RtlLengthSecurityDescriptorStrict(SecurityDescriptor);
v10 = HvAllocateCell((ULONG_PTR)Hive, (unsigned int)(v13 + 20), Cell >> 31, &CellAddress, &CellAddressContext);
if( v10 == -1 )
return 3221225626i64;
v14 = RtlLengthSecurityDescriptorStrict(SecurityDescriptor);
v15 = CellAddress;
*(_WORD *)CellAddress = 27507;
v15[3] = 1;
v15[4] = v14;
memmove(v15 + 5, SecurityDescriptor, v14);
Hive->ReleaseCellRoutine(Hive, &CellAddressContext);
LOBYTE(v16) = Replace;
if( (unsigned __int8)CmpInsertSecurityCellList(Hive, Cell, v10, v16) )
goto LABEL_6;
HvFreeCell((ULONG_PTR)Hive, v10);
return 3221225853i64;
}
v10 = (unsigned int)CellIndex;
if( !HvMarkCellDirty(Hive, (PVOID)(unsigned int)CellIndex, 0) )
return 3221225853i64;
v11 = Hive->GetCellRoutine(Hive, v10, &CellAddressContext);
if( v11 )
{
++v11->u.KeyValue.Type;
Hive->ReleaseCellRoutine(Hive, &CellAddressContext);
LABEL_6:
*SecurityCell = v10;
return 0i64;
}
return 3221225626i64;
}Referenced by:
CmpAssignSecurityDescriptor
CmpCopyMergeOfLayeredKeyNode
CmpCopySaclToVirtualKey
CmpCreateChild
CmpLightWeightPrepareSetSecDescUoW