CmpSyncKeyValues
char __fastcall CmpSyncKeyValues(_EX_PUSH_LOCK *a1, __int64 a2, __int64 a3, __int64 a4, UINT64 a5, __int64 a6, char a7){
_EX_PUSH_LOCK *v7;
ULONG_PTR v8;
int v9;
__int64 v12;
unsigned int v14;
INT64 v15;
char v16;
_CMHIVE *v17;
unsigned int v18;
UINT64 v19;
__int64 v20;
bool v21;
unsigned int v22;
__int64 v23;
int *v24;
__int64 v25;
__int64 v26;
int v27;
int v28;
unsigned int *v29;
unsigned int v30;
__int64 v31;
unsigned int CellIndex;
unsigned int CellIndexa;
ULONG_PTR CellIndex_4;
int v35[2];
int v36[2];
int v37[2];
int v38[2];
int v39[2];
int v40[2];
__int64 v41;
__int64 v42;
__int64 v43;
UINT64 Index;
v7 = a1;
v39[1] = 0;
v39[0] = -1;
v8 = -1;
v38[0] = -1;
v9 = -1;
CellIndex_4 = -1;
v40[0] = -1;
a7 = 0;
v38[1] = 0;
LODWORD(Index) = 0;
v40[1] = 0;
CmpLockTwoSecurityCachesExclusiveShared((_CMHIVE *)a4, (_CMHIVE *)a1);
v12 = a6;
if( !CmpFreeKeyValues(a4, (void *)(unsigned int)a5, a6) )
{
CmpUnlockTwoSecurityCaches((_CMHIVE *)a4, (_CMHIVE *)v7);
return 0;
}
v14 = (unsigned int)a5 >> 31;
if( !*(_WORD *)(a3 + 74) || (v15 = *(unsigned int *)(a3 + 48), (_DWORD)v15 == -1) )
{
LABEL_8:
*(_DWORD *)(v12 + 48) = v9;
if( !CmpFindSecurityCellCacheIndex((CMHIVE *)v7, *(unsigned int *)(a3 + 44), &Index) )
{
LABEL_9:
v17 = (_CMHIVE *)a4;
LABEL_10:
CmpUnlockTwoSecurityCaches(v17, (_CMHIVE *)v7);
v16 = a7;
goto LABEL_46;
}
v18 = *(_DWORD *)(v12 + 44);
v19 = (unsigned int)a5;
v20 = *(_QWORD *)(v7[235]._bf_0 + 16i64 * (unsigned int)Index + 8);
*(_DWORD *)(v12 + 44) = -1;
if( (int)CmpAssignSecurityDescriptor(a4, v19, v12, (VOID *)(v20 + 32), 0) < 0 )
{
*(_DWORD *)(v12 + 44) = v18;
goto LABEL_9;
}
v21 = (*(_BYTE *)(v12 + 2) & 4) == 0;
v22 = *(_DWORD *)(v12 + 44);
LODWORD(Index) = v22;
*(_DWORD *)(v12 + 44) = v18;
if( v21 || v22 == v18 )
{
v27 = v22;
}
else
{
v35[0] = -1;
v36[0] = -1;
v37[0] = -1;
v35[1] = 0;
v36[1] = 0;
v37[1] = 0;
v41 = (*(__int64(__fastcall **)(__int64, _QWORD, int *))(a4 + 8))(a4, v22, v35);
v17 = (_CMHIVE *)a4;
if( !v41 )
goto LABEL_10;
v23 = (*(__int64(__fastcall **)(__int64, _QWORD, int *))(a4 + 8))(a4, v18, v36);
v42 = v23;
if( !v23 )
{
v24 = v35;
LABEL_18:
(*(void(__fastcall **)(__int64, int *))(a4 + 16))(a4, v24);
goto LABEL_9;
}
CellIndex = *(_DWORD *)(v23 + 8);
v43 = (*(__int64(__fastcall **)(__int64, _QWORD, int *))(a4 + 8))(a4, CellIndex, v37);
if( !v43 )
{
(*(void(__fastcall **)(__int64, int *))(a4 + 16))(a4, v35);
v24 = v36;
goto LABEL_18;
}
if( !HvMarkCellDirty((PVOID)a4, (PVOID)v18, 0) || !HvMarkCellDirty((PVOID)a4, (PVOID)CellIndex, 0) )
{
(*(void(__fastcall **)(__int64, int *))(a4 + 16))(a4, v35);
(*(void(__fastcall **)(__int64, int *))(a4 + 16))(a4, v36);
v24 = v37;
goto LABEL_18;
}
v25 = v41;
*(_DWORD *)(v41 + 8) = CellIndex;
v26 = v42;
*(_DWORD *)(v25 + 4) = v18;
v27 = Index;
*(_DWORD *)(v26 + 8) = Index;
*(_DWORD *)(v43 + 4) = v27;
(*(void(__fastcall **)(__int64, int *))(a4 + 16))(a4, v35);
(*(void(__fastcall **)(__int64, int *))(a4 + 16))(a4, v36);
(*(void(__fastcall **)(__int64, int *))(a4 + 16))(a4, v37);
}
CmpFreeSecurityDescriptor((_HHIVE *)a4, (unsigned int)a5);
*(_DWORD *)(v12 + 44) = v27;
CmpUnlockTwoSecurityCaches((_CMHIVE *)a4, (_CMHIVE *)v7);
v28 = *(_DWORD *)(a3 + 36);
*(_DWORD *)(v12 + 40) = -1;
*(_DWORD *)(v12 + 36) = 0;
*(_DWORD *)(v12 + 60) = *(_DWORD *)(a3 + 60);
*(_DWORD *)(v12 + 64) = *(_DWORD *)(a3 + 64);
LODWORD(Index) = v28;
if( !v28 )
return 1;
v29 = (unsigned int *)((__int64(__fastcall *)(_EX_PUSH_LOCK *, _QWORD, int *))v7[1]._bf_0)(
v7,
*(unsigned int *)(a3 + 40),
v39);
if( v29 )
{
v30 = 0;
if( (_DWORD)Index )
{
while( 1 )
{
CellIndexa = CmpCopyValue((INT64)v7, *v29, a4, v14);
if( CellIndexa == -1 || !(*(__int64(__fastcall **)(__int64, _QWORD, int *))(a4 + 8))(a4, CellIndexa, v40) )
{
v8 = *(_DWORD *)(v12 + 40);
goto LABEL_35;
}
if( (int)CmpAddValueToList(a4, CellIndexa, v30, v14, (UINT64 *)(v12 + 36)) < 0 )
break;
++v30;
++v29;
if( v30 >= (unsigned int)Index )
goto LABEL_34;
}
v8 = *(_DWORD *)(v12 + 40);
if( v8 != -1 )
{
v31 = (*(__int64(__fastcall **)(__int64, _QWORD, int *))(a4 + 8))(a4, v8, v38);
if( v31 )
{
if( v30 )
{
do
HvFreeCell(a4, *(_DWORD *)(v31 + 4i64 * --v30));
while( v30 );
v7 = a1;
}
(*(void(__fastcall **)(__int64, int *))(a4 + 16))(a4, v38);
}
}
}
else
{
LABEL_34:
a7 = 1;
}
LABEL_35:
((void(__fastcall *)(_EX_PUSH_LOCK *, int *))v7[2]._bf_0)(v7, v39);
v16 = a7;
if( a7 )
return v16;
if( v8 != -1 )
HvFreeCell(a4, v8);
}
else
{
v16 = 0;
}
LABEL_46:
if( CellIndex_4 != -1 )
HvFreeCell(a4, CellIndex_4);
return v16;
}
CellIndex_4 = CmpCopyCell((INT64)v7, v15, a4, v14);
if( CellIndex_4 != -1 )
{
v9 = CellIndex_4;
*(_WORD *)(v12 + 74) = *(_WORD *)(a3 + 74);
goto LABEL_8;
}
CmpUnlockTwoSecurityCaches((_CMHIVE *)a4, (_CMHIVE *)v7);
return a7;
}Referenced by:
CmpCopySyncTree2
CmpMergeKeyValues