Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
3.1 KiB

  1. #pragma once
  2. #include "positionindependentblob.h"
  3. #include "positionindependenthashtable.h"
  4. class CPositionIndependentHashTableAccessor
  5. {
  6. private:
  7. CPositionIndependentHashTableAccessor(const CPositionIndependentHashTableAccessor &);
  8. void operator=(const CPositionIndependentHashTableAccessor &);
  9. public:
  10. ~CPositionIndependentHashTableAccessor() { }
  11. CPositionIndependentHashTableAccessor(
  12. CPositionIndependentHashTable * PositionIndependentTable = NULL,
  13. ULONG HashTableIndex = 0
  14. );
  15. BYTE Init(
  16. CPositionIndependentHashTable * PositionIndependentTable,
  17. ULONG HashTableIndex = 0
  18. );
  19. void GetBounds(const BYTE * Bounds[2]);
  20. void IsInBlob(const BYTE * Pointer, ULONG Size, BOOL * IsInBlob);
  21. BOOL IsEmpty();
  22. BOOL IsKeyPresent(const BYTE * Key);
  23. void SetAt(const BYTE * Key, ULONG KeySize, const BYTE * Value, ULONG ValueSize);
  24. void GetAt(const BYTE * Key, const BYTE ** Value, ULONG * ValueSize = NULL);
  25. void Remove(const BYTE * Key);
  26. typedef CPositionIndependentHashTable::CHashTable CHashTable;
  27. typedef CPositionIndependentHashTable::CHashTableBucket CHashTableBucket;
  28. typedef CPositionIndependentHashTable::CHashTableElement CHashTableElement;
  29. //protected:
  30. CPositionIndependentHashTable * const m_PositionIndependentTable;
  31. CHashTable * m_PointerToHashTables;
  32. const BYTE * m_Key;
  33. CHashTableBucket * m_PointerToBucket;
  34. ULONG m_KeyHash;
  35. ULONG m_KeyIndex;
  36. ULONG const m_HashTableIndex;
  37. BOOL m_KeyHashIsValid;
  38. //const BYTE * OffsetToPointer(ULONG Offset) { return m_PositionIndependentTable->OffsetToPointer(Offset); }
  39. //template <typename T> void OffsetToPointer(ULONG Offset, T *& Pointer) { m_PositionIndependentTable->OffsetToPointer(Offset, Pointer); }
  40. template <typename T> void OffsetToPointer(ULONG Offset, T ** Pointer) { m_PositionIndependentTable->OffsetToPointer(Offset, Pointer); }
  41. ULONG PointerToOffset(const BYTE * p);
  42. void PointerToOffset(const BYTE * p, ULONG * Offset) { *Offset = PointerToOffset(p); }
  43. void GetHashTableBucketForKey(const BYTE * Key, CHashTableBucket **);
  44. void GetKeyHash(const BYTE * Key, ULONG * KeyHash);
  45. void GetKeyHashNoCache(const BYTE * Key, ULONG * KeyHash);
  46. BOOL AreKeysEqual(const BYTE * Key1, const BYTE * Key2);
  47. void GetHashTableBucket(const BYTE * Key, CHashTableBucket **);
  48. void GetPointerToHashTable(CHashTable **);
  49. CHashTable * GetPointerToHashTable();
  50. void GetPointerToHashTable(ULONG HashTableIndex, CHashTable **);
  51. CHashTable * GetPointerToHashTable(ULONG HashTableIndex);
  52. void Alloc(ULONG NumberOfBytes, ULONG * Offset);
  53. void GrowNumberOfBuckets(ULONG NumberOfBuckets);
  54. PBYTE GetBasePointer();
  55. void Reserve(ULONG Bytes, ULONG Blocks) { /* UNDONE */ }
  56. };