HvpFindFreeCellInBin

NTSTATUS __stdcall HvpFindFreeCellInBin(
        _HHIVE *Hive,
        UINT64 NewSize,
        HSTORAGE_TYPE Type,
        _HBIN *Bin,
        UINT64 *CellIndex,
        _HCELL **pCell,
        _HV_GET_CELL_CONTEXT *pCellContext){
  _HBIN *v7; 
  _HBIN *v8; 
  unsigned int Signature; 
  unsigned __int32 v12; 
  _CELL_DATA *v13; 
  _HCELL *v14; 
  v7 = Bin + 1;
  v8 = (_HBIN *)((char *)Bin + Bin->Size);
  if( &Bin[1] >= v8 )
    return -1073741275;
  while( 1 )
  {
    Signature = v7->Signature;
    if( (v7->Signature & 0x80000000) == 0 )
      break;
    Signature = -Signature;
LABEL_4:
    v7 = (_HBIN *)((char *)v7 + Signature);
    if( v7 >= v8 )
      return -1073741275;
  }
  v12 = Bin->FileOffset + (_DWORD)v7 + (Type << 31) - (_DWORD)Bin;
  if( (unsigned int)NewSize > Signature )
    goto LABEL_4;
  if( !HvpMarkCellDirty((UINT64)Hive, v12, 1) )
    return -1073741443;
  v13 = Hive->GetCellRoutine(Hive, v12, pCellContext);
  if( v13 )
    v14 = (_HCELL *)&v13[-1].u.KeyString[38];
  else
    v14 = 0i64;
  *pCell = v14;
  *(_DWORD *)CellIndex = v12;
  return 0;
}

Referenced by:

HvpFindFreeCell