Source code of Windows XP (NT5)
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.

82 lines
1.2 KiB

  1. /*++
  2. Copyright(c) 1995 Microsoft Corporation
  3. MODULE NAME
  4. table.h
  5. ABSTRACT
  6. Header file for generic hash table routines.
  7. AUTHOR
  8. Anthony Discolo (adiscolo) 28-Jul-1995
  9. REVISION HISTORY
  10. --*/
  11. //
  12. // Number of hash table buckets.
  13. //
  14. #define NBUCKETS 13
  15. //
  16. // Generic hash table structure.
  17. //
  18. typedef struct _HASH_TABLE {
  19. LIST_ENTRY ListEntry[NBUCKETS]; // the hash buckets
  20. ULONG ulSize; // number of total entries
  21. } HASH_TABLE, *PHASH_TABLE;
  22. //
  23. // Hash table enumerator procedure.
  24. // Returns TRUE to continue enumeration,
  25. // FALSE to terminate enumeration.
  26. //
  27. typedef BOOLEAN (*PHASH_TABLE_ENUM_PROC)(PVOID, LPTSTR, PVOID);
  28. PHASH_TABLE
  29. NewTable();
  30. VOID
  31. ClearTable(
  32. IN PHASH_TABLE pTable
  33. );
  34. VOID
  35. FreeTable(
  36. IN PHASH_TABLE pTable
  37. );
  38. ULONG
  39. TableSize(
  40. IN PHASH_TABLE pTable
  41. );
  42. VOID
  43. EnumTable(
  44. IN PHASH_TABLE pTable,
  45. IN PHASH_TABLE_ENUM_PROC pProc,
  46. IN PVOID pArg
  47. );
  48. BOOLEAN
  49. GetTableEntry(
  50. IN PHASH_TABLE pTable,
  51. IN LPTSTR pszKey,
  52. OUT PVOID *pData
  53. );
  54. BOOLEAN
  55. PutTableEntry(
  56. IN PHASH_TABLE pTable,
  57. IN LPTSTR pszKey,
  58. IN PVOID pData
  59. );
  60. BOOLEAN
  61. DeleteTableEntry(
  62. IN PHASH_TABLE pTable,
  63. IN LPTSTR pszKey
  64. );
  65.