MCPcopy Create free account
hub / github.com/SaadAhla/HeapCrypt / HeapEncryptDecrypt

Function HeapEncryptDecrypt

HeapCrypt/HeapEncryptDecrypt.cpp:61–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59
60
61void HeapEncryptDecrypt() {
62
63 DWORD numHeaps = GetProcessHeaps(0, NULL);
64 HANDLE* heaps = (HANDLE*)malloc(sizeof(HANDLE) * numHeaps);
65 GetProcessHeaps(numHeaps, heaps);
66
67 PROCESS_HEAP_ENTRY entry;
68 for (DWORD i = 0; i < numHeaps; i++) {
69 // skip the default process heap
70 if (heaps[i] == GetProcessHeap()) continue;
71
72 SecureZeroMemory(&entry, sizeof(entry));
73 while (HeapWalk(heaps[i], &entry)) {
74 if ((entry.wFlags & PROCESS_HEAP_ENTRY_BUSY) != 0) {
75 XorIT((BYTE*)entry.lpData, entry.cbData, KeyBuf);
76 }
77 }
78 }
79 free(heaps);
80
81
82}
83
84
85

Callers 1

HeapSleepFunction · 0.85

Calls 1

XorITFunction · 0.85

Tested by

no test coverage detected