CmpCommitRenameKeyUoW
INT64 __stdcall CmpCommitRenameKeyUoW(_CM_KCB_UOW *UoW, _LARGE_INTEGER *CommitTime){
__int64 v2;
INT64 v4;
_CM_KEY_CONTROL_BLOCK *KeyControlBlock;
HSTORAGE_TYPE StorageType;
UINT64 KeyHive;
_QWORD *p_RefCount;
_CM_KEY_CONTROL_BLOCK *ChildKCB;
_CM_KEY_CONTROL_BLOCK *v10;
__int64 v11;
int v12;
__int64 v13;
const VOID *v14;
unsigned int v15;
unsigned __int16 *v16;
unsigned int v17;
_CM_KEY_CONTROL_BLOCK *v18;
CHAR updated;
_CM_KEY_CONTROL_BLOCK *v20;
_LARGE_INTEGER v22;
unsigned __int16 v23;
unsigned int v24;
_CM_KEY_CONTROL_BLOCK *v25;
_HV_GET_CELL_CONTEXT CellAddressContext;
int v27[2];
PVOID BugCheckParameter4;
VOID *CellAddress;
__int64 v30;
INT64 v31[2];
_CM_KEY_CONTROL_BLOCK *v32;
_CM_KEY_CONTROL_BLOCK *v33;
_HSTORAGE_TYPE Type;
__int64 a2;
int v37;
int v38;
a2 = v2;
CellAddress = 0i64;
CellAddressContext.Cell = -1;
v27[0] = -1;
v4 = v2;
v37 = -1;
KeyControlBlock = UoW->KeyControlBlock;
*(_DWORD *)&CellAddressContext.BinContext._bf_0 = 0;
v27[1] = 0;
v38 = 0;
StorageType = UoW->StorageType;
*(_OWORD *)v31 = 0i64;
KeyHive = (UINT64)KeyControlBlock->KeyHash.KeyHive;
Type = StorageType;
CmpReferenceKeyControlBlock(KeyControlBlock);
p_RefCount = &UoW->KeyControlBlock->RefCount;
ChildKCB = UoW->ChildKCB;
BugCheckParameter4 = p_RefCount;
CmpReferenceKeyControlBlock(ChildKCB);
v10 = UoW->ChildKCB;
v11 = (*(__int64(__fastcall **)(UINT64, _QWORD, int *))(KeyHive + 8))(
KeyHive,
UoW->KeyControlBlock->ParentKcb->KeyHash.KeyCell,
v27);
if( !v11 )
{
v12 = -1073741670;
LABEL_25:
if( p_RefCount )
CmpDereferenceKeyControlBlockWithLock((ULONG_PTR)p_RefCount, v4, 0);
if( v10 )
CmpDereferenceKeyControlBlockWithLock((ULONG_PTR)v10, v4, 0);
CmpCleanupRollbackPacket((INT64)v31);
return(unsigned int)v12;
}
if( !HvMarkCellDirty((PVOID)KeyHive, (PVOID)UoW->KeyControlBlock->ParentKcb->KeyHash.KeyCell, 1u)
|| !HvMarkCellDirty((PVOID)KeyHive, (PVOID)UoW->KeyControlBlock->KeyHash.KeyCell, 1u)
|| !HvMarkCellDirty((PVOID)KeyHive, (PVOID)*(unsigned int *)(UoW->LastWriteTime.QuadPart + 40), 1u)
|| !CmpMarkIndexDirty(
(PVOID)KeyHive,
UoW->KeyControlBlock->ParentKcb->KeyHash.KeyCell,
*(_DWORD *)(UoW->LastWriteTime.QuadPart + 40)) )
{
v12 = -1073741443;
LABEL_24:
(*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, v27);
goto LABEL_25;
}
++p_RefCount[38];
++v10->SequenceNumber;
v12 = CmpPrepareToInvalidateAllHigherLayerKcbs((__int64)p_RefCount, 1u, (__int64)v31);
if( v12 < 0 )
goto LABEL_24;
v12 = CmpPrepareToInvalidateAllHigherLayerKcbs((__int64)v10, 1u, (__int64)v31);
if( v12 < 0 )
goto LABEL_24;
CmpInvalidateAllHigherLayerKcbs((INT64)p_RefCount, 1u, 8i64, v4);
CmpInvalidateAllHigherLayerKcbs((INT64)v10, 1u, 8i64, v4);
v13 = (*(__int64(__fastcall **)(UINT64, _QWORD, int *))(KeyHive + 8))(
KeyHive,
UoW->KeyControlBlock->KeyHash.KeyCell,
&v37);
v30 = v13;
v14 = (const VOID *)v13;
if( !v13 )
{
v12 = -1073741670;
goto LABEL_24;
}
v15 = HvAllocateCell(KeyHive, (unsigned int)(-4 - *(_DWORD *)(v13 - 4)), Type, &CellAddress, &CellAddressContext);
v16 = (unsigned __int16 *)CellAddress;
v17 = v15;
if( v15 == -1 )
{
v12 = -1073741443;
goto LABEL_19;
}
memmove(CellAddress, v14, -4 - *((_DWORD *)v14 - 1));
(*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, &v37);
v18 = UoW->KeyControlBlock;
v30 = 0i64;
if( !CmpAddSubKey(KeyHive, v18->ParentKcb->KeyHash.$0C446697F936DAB21E8D4AF094591EF0::KeyCell, v17)
|| !CmpRemoveSubKey(
KeyHive,
UoW->KeyControlBlock->ParentKcb->KeyHash.KeyCell,
*(_DWORD *)(UoW->LastWriteTime.QuadPart + 40)) )
{
v12 = -1073741670;
LABEL_21:
if( v16 )
{
(*(void(__fastcall **)(UINT64, _HV_GET_CELL_CONTEXT *))(KeyHive + 16))(KeyHive, &CellAddressContext);
CmpFreeKeyByCell(KeyHive, v17, 0);
}
v4 = a2;
p_RefCount = BugCheckParameter4;
goto LABEL_24;
}
updated = CmpUpdateParentForEachSon(KeyHive, v17, 1);
v20 = UoW->KeyControlBlock;
if( !updated )
{
v12 = -1073741670;
CmpRemoveSubKey(KeyHive, v20->ParentKcb->KeyHash.$0C446697F936DAB21E8D4AF094591EF0::KeyCell, v17);
CmpAddSubKey(
KeyHive,
UoW->KeyControlBlock->ParentKcb->KeyHash.KeyCell,
*(unsigned int *)(UoW->LastWriteTime.QuadPart + 40));
LABEL_19:
if( v30 )
(*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, &v37);
goto LABEL_21;
}
UoW->TxSecurityCell = v20->KeyHash.KeyCell;
v20->KeyHash.KeyCell = v17;
v22 = *CommitTime;
*((_DWORD *)v16 + 4) = UoW->KeyControlBlock->ParentKcb->KeyHash.KeyCell;
++UoW->KeyControlBlock->ParentKcb->SequenceNumber;
*(_LARGE_INTEGER *)(v11 + 4) = v22;
UoW->KeyControlBlock->ParentKcb->KcbLastWriteTime = v22;
v23 = v16[36];
if( (v16[1] & 0x20) != 0 )
v23 *= 2;
if( (unsigned __int16)*(_DWORD *)(v11 + 52) < (unsigned int)v23 )
{
*(_WORD *)(v11 + 52) = v23;
UoW->KeyControlBlock->ParentKcb->KcbMaxNameLen = v23;
}
v24 = v16[37];
if( *(_DWORD *)(v11 + 56) < v24 )
*(_DWORD *)(v11 + 56) = v24;
(*(void(__fastcall **)(UINT64, _HV_GET_CELL_CONTEXT *))(KeyHive + 16))(KeyHive, &CellAddressContext);
(*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, v27);
v25 = UoW->ChildKCB;
v33 = UoW->KeyControlBlock;
v32 = v25;
CmpSearchKeyControlBlockTreeEx(
(__int64(__fastcall *)(__int64 *, __int64, __int64, __int64))CmpRefreshParent,
(__int64)v33->KeyHash.KeyHive,
a2,
(__int64)&v32,
1);
CmpSearchForOpenSubKeys(&UoW->KeyControlBlock->RefCount, 1, 0i64);
HvFreeCell(KeyHive, *(_DWORD *)(UoW->LastWriteTime.QuadPart + 40));
CmpFlushNotifiesOnKeyBodyList(UoW->LastWriteTime.QuadPart, 8i64, a2, 1);
CmpMarkKeyUnbacked(UoW->LastWriteTime.QuadPart, a2);
CmpDiscardKcb((UINT64)UoW->ChildKCB, a2);
CmpDereferenceKeyControlBlockWithLock((ULONG_PTR)BugCheckParameter4, a2, 0);
CmpDereferenceKeyControlBlockWithLock((ULONG_PTR)v10, a2, 0);
CmpCleanupRollbackPacket((INT64)v31);
return 0i64;
}Referenced by:
CmpTransMgrCommitUoW