MCPcopy Create free account
hub / github.com/dobin/RedEdr / FreeHashTable

Function FreeHashTable

RedEdrDriver/hashcache.c:98–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96
97
98VOID FreeHashTable()
99{
100 ULONG i;
101 PHASH_ENTRY entry, tempEntry;
102
103 KIRQL oldIrql;
104 KeAcquireSpinLock(&HashTableLock, &oldIrql);
105
106 // Iterate through each bucket in the hash table
107 for (i = 0; i < HASH_TABLE_SIZE; i++) {
108 entry = HashTable[i];
109
110 // Traverse the linked list in this bucket
111 while (entry) {
112 tempEntry = entry->Next;
113
114 // Free the associated PROCESS_INFO structure if allocated separately
115 if (entry->ProcessInfo) {
116 ExFreePoolWithTag(entry->ProcessInfo, 'Proc');
117 }
118
119 // Free the hash table entry itself
120 ExFreePoolWithTag(entry, 'Hash');
121
122 // Move to the next entry in the list
123 entry = tempEntry;
124 }
125
126 // Set the bucket to NULL after freeing all entries
127 HashTable[i] = NULL;
128 }
129
130 KeReleaseSpinLock(&HashTableLock, oldIrql);
131}
132
133
134ULONG HashFunction(HANDLE ProcessId)

Callers 1

RedEdrUnloadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected