CmpLightWeightPrepareSetValueKeyUoW
NTSTATUS __stdcall CmpLightWeightPrepareSetValueKeyUoW(_CM_KCB_UOW *UoW){
CM_UOW_SET_VALUE_LIST_DATA *SetValueData;
PVOID p_Data;
_CM_KEY_CONTROL_BLOCK *KeyControlBlock;
UINT64 KeyHive;
int v6;
_CM_UOW_SET_VALUE_KEY_DATA *TransientPoolWithTag;
_CM_UOW_SET_VALUE_KEY_DATA *v8;
__int64 v9;
_CM_KEY_VALUE *v10;
unsigned int v11;
unsigned int v12;
VOID **PoolWithTag;
unsigned int v14;
unsigned int v15;
__int64 v16;
int v17;
unsigned int v18;
UINT64 Size;
UINT64 Type;
PVOID CellIndex;
CM_UOW_SET_VALUE_LIST_DATA *Data;
PVOID P;
int v25[2];
int v26[2];
INT64 v27;
int v28[2];
__int64 v29;
_UNICODE_STRING ValueName[5];
INT64 p_ValueList;
char v32;
char v33;
UINT64 Index;
SetValueData = UoW->SetValueData;
LODWORD(Index) = 0;
LODWORD(CellIndex) = 0;
p_Data = 0i64;
v29 = 0i64;
v28[1] = 0;
v26[1] = 0;
v25[1] = 0;
KeyControlBlock = UoW->KeyControlBlock;
v28[0] = -1;
v26[0] = -1;
v27 = 0xFFFFFFFFi64;
v25[0] = -1;
KeyHive = (UINT64)KeyControlBlock->KeyHash.KeyHive;
P = 0i64;
v32 = 0;
v33 = 0;
LOBYTE(p_ValueList) = 0;
Data = SetValueData;
ValueName[0] = 0i64;
if( !SetValueData )
{
v6 = CmpLightWeightCreateSetValueData(UoW, &Data);
if( v6 < 0 )
return v6;
SetValueData = Data;
CmpLightWeightUpdateSharedSetValueData(Data, UoW->KeyControlBlock);
--SetValueData->RefCount;
}
TransientPoolWithTag = (_CM_UOW_SET_VALUE_KEY_DATA *)CmpAllocateTransientPoolWithTag(1ui64, 0x10ui64);
v8 = TransientPoolWithTag;
if( !TransientPoolWithTag )
return -1073741670;
*(_QWORD *)&TransientPoolWithTag->NameLength = 0i64;
TransientPoolWithTag->PreparedCell = -1;
TransientPoolWithTag->OldValueCell = -1;
v9 = (*(__int64(__fastcall **)(UINT64, _QWORD, int *))(KeyHive + 8))(KeyHive, UoW->NewValueCell, v28);
v10 = (_CM_KEY_VALUE *)v9;
if( v9 )
{
v11 = *(_DWORD *)(v9 + 4);
v12 = v11 + 0x80000000;
if( v11 < 0x80000000 )
v12 = v11;
LODWORD(Data) = v12;
if( v12 )
{
if( v11 >= 0x80000000 )
{
p_Data = &v10->Data;
}
else
{
if( !CmpGetValueData(
(_HHIVE *)KeyHive,
UoW->NewValueCell,
v10,
(unsigned int *)&Data,
&P,
(unsigned __int8 *)&p_ValueList,
(_HV_GET_CELL_CONTEXT *)&v27) )
{
v6 = -1073741670;
LABEL_34:
(*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, v28);
goto LABEL_35;
}
p_Data = P;
v12 = (unsigned int)Data;
v33 = p_ValueList;
v32 = 1;
}
}
if( !HvMarkCellDirty((PVOID)KeyHive, (PVOID)UoW->KeyControlBlock->KeyHash.KeyCell, 0) )
{
v6 = -1073741443;
LABEL_30:
if( v32 && p_Data )
{
if( v33 )
ExFreePoolWithTag(p_Data, 0);
else(*(void(__fastcall **)(UINT64, INT64 *))(KeyHive + 16))(KeyHive, &v27);
}
goto LABEL_34;
}
Data = (CM_UOW_SET_VALUE_LIST_DATA *)(*(__int64(__fastcall **)(UINT64, _QWORD, int *))(KeyHive + 8))(
KeyHive,
UoW->KeyControlBlock->KeyHash.KeyCell,
v26);
UoW->StorageType = UoW->KeyControlBlock->KeyHash.KeyCell >> 31;
PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x8000ui64, 1649626435i64);
P = PoolWithTag;
if( !PoolWithTag )
{
v6 = -1073741670;
LABEL_28:
if( Data )
(*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, v26);
goto LABEL_30;
}
CmpInitializeValueNameString(v10, ValueName, (_WCHAR *)PoolWithTag);
p_ValueList = (INT64)&SetValueData->ValueList;
if( !CmpFindNameInList(
KeyHive,
(unsigned int *)&SetValueData->ValueList,
(__int64)ValueName,
0,
(unsigned int *)&Index,
&CellIndex)
|| (LODWORD(Type) = UoW->StorageType,
LODWORD(Size) = v12,
v14 = CmpAddValueKeyNew(KeyHive, ValueName, v10->Type, p_Data, Size, Type),
v14 == -1) )
{
v6 = -1073741670;
LABEL_27:
ExFreePoolWithTag(P, 0);
goto LABEL_28;
}
v15 = (unsigned int)CellIndex;
if( (_DWORD)CellIndex != -1 )
{
if( HvMarkCellDirty((PVOID)KeyHive, (PVOID)(unsigned int)CellIndex, 0) )
{
v16 = (*(__int64(__fastcall **)(UINT64, _QWORD, int *))(KeyHive + 8))(KeyHive, v15, v25);
v29 = v16;
if( v16 )
{
if( !CmpMarkValueDataDirty((PVOID)KeyHive, v16) )
{
v6 = -1073741443;
LABEL_23:
if( v29 )
(*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, v25);
goto LABEL_25;
}
v17 = CmpSwapValueInList((_HHIVE *)KeyHive, v14, (unsigned int)Index, (_CHILD_LIST *)p_ValueList);
LABEL_21:
v6 = v17;
if( v17 >= 0 )
{
v6 = 0;
v8->NameLength = ValueName[0].Length;
v18 = (unsigned int)CellIndex;
v8->PreparedCell = v14;
v8->OldValueCell = v18;
v8->DataSize = v12;
UoW->ValueData = v8;
v8 = 0i64;
v14 = -1;
}
goto LABEL_23;
}
v6 = -1073741670;
}
else
{
v6 = -1073741443;
}
LABEL_25:
if( v14 != -1 )
CmpFreeValue(KeyHive, v14);
goto LABEL_27;
}
v17 = CmpAddValueToList(KeyHive, v14, (unsigned int)Index, (unsigned int)UoW->StorageType, (UINT64 *)p_ValueList);
goto LABEL_21;
}
v6 = -1073741670;
LABEL_35:
if( v8 )
CmpFreeTransientPoolWithTag(v8, 0x77554D43ui64);
return v6;
}Referenced by:
CmpProcessLightWeightUOW