CmpSetValueDataExisting
__int64 __fastcall CmpSetValueDataExisting(
_HHIVE *Hive,
void *Data,
unsigned int DataSize,
unsigned int StorageType,
unsigned int OldDataCell){
_CELL_DATA *(__fastcall *GetCellRoutine)(_HHIVE *, unsigned int, _HV_GET_CELL_CONTEXT *);
__int64 v9;
__int64 v10;
_CELL_DATA *v11;
unsigned int v12;
unsigned __int16 v13;
char *v14;
_CELL_DATA *v15;
unsigned int v16;
unsigned int v17;
void *v19;
int v20;
unsigned __int16 v21;
unsigned int Cell;
unsigned __int16 v23;
void *v24;
int v25;
_HV_GET_CELL_CONTEXT CellAddressContext;
int v27[2];
int v28[4];
VOID *CellAddress;
VOID *Src;
Src = Data;
v27[1] = 0;
v28[1] = 0;
*(_DWORD *)&CellAddressContext.BinContext._bf_0 = 0;
GetCellRoutine = Hive->GetCellRoutine;
v27[0] = -1;
v28[0] = -1;
CellAddressContext.Cell = -1;
v9 = (__int64)GetCellRoutine(Hive, OldDataCell, (_HV_GET_CELL_CONTEXT *)v28);
v10 = v9;
if( v9 )
{
v11 = Hive->GetCellRoutine(Hive, *(unsigned int *)(v9 + 4), &CellAddressContext);
if( !v11 )
{
v17 = -1073741670;
LABEL_14:
Hive->ReleaseCellRoutine(Hive, (_HV_GET_CELL_CONTEXT *)v28);
return v17;
}
v12 = (DataSize + 16343) / 0x3FD8;
if( (unsigned __int16)v12 > *(_WORD *)(v10 + 2) )
{
Hive->ReleaseCellRoutine(Hive, &CellAddressContext);
v19 = (void *)*(unsigned int *)(v10 + 4);
CellAddress = 0i64;
v20 = HvReallocateCell(Hive, v19, 4 * (unsigned int)(unsigned __int16)v12, 1u, &CellAddress, &CellAddressContext);
v11 = (_CELL_DATA *)CellAddress;
if( v20 == -1 )
goto LABEL_20;
v21 = *(_WORD *)(v10 + 2);
*(_DWORD *)(v10 + 4) = v20;
while( v21 < (unsigned __int16)v12 )
{
Cell = HvAllocateCell((ULONG_PTR)Hive, 0x3FD8ui64, StorageType, 0i64, 0i64);
v11->u.KeyList[v21] = Cell;
if( Cell == -1 )
goto LABEL_20;
++v21;
}
}
else if( (unsigned __int16)v12 < *(_WORD *)(v10 + 2) )
{
v23 = (DataSize + 16343) / 0x3FD8;
do
HvFreeCell((ULONG_PTR)Hive, v11->u.KeyList[v23++]);
while( v23 < *(_WORD *)(v10 + 2) );
Hive->ReleaseCellRoutine(Hive, &CellAddressContext);
v24 = (void *)*(unsigned int *)(v10 + 4);
CellAddress = 0i64;
v25 = HvReallocateCell(Hive, v24, 4 * (unsigned int)(unsigned __int16)v12, 1u, &CellAddress, &CellAddressContext);
v11 = (_CELL_DATA *)CellAddress;
if( v25 == -1 )
goto LABEL_20;
*(_DWORD *)(v10 + 4) = v25;
}
v13 = 0;
if( !(_WORD)v12 )
{
LABEL_11:
*(_WORD *)(v10 + 2) = v12;
v17 = 0;
goto LABEL_12;
}
v14 = (char *)Src;
while( 1 )
{
v15 = Hive->GetCellRoutine(Hive, v11->u.KeyList[v13], v27);
if( !v15 )
break;
v16 = DataSize;
if( DataSize > 0x3FD8 )
v16 = 16344;
memmove(v15, v14, v16);
Hive->ReleaseCellRoutine(Hive, (_HV_GET_CELL_CONTEXT *)v27);
DataSize -= 16344;
v14 += 16344;
if( ++v13 >= (unsigned __int16)v12 )
goto LABEL_11;
}
LABEL_20:
v17 = -1073741670;
LABEL_12:
if( v11 )
Hive->ReleaseCellRoutine(Hive, &CellAddressContext);
goto LABEL_14;
}
return 3221225626i64;
}Referenced by:
CmpSetValueKeyExisting