Skip to content

Commit

Permalink
[KERNEL32] Add stubs for HeapAlloc and HeapFree
Browse files Browse the repository at this point in the history
This allows external code linked into kernel32 to link to these functions, which are otherwise defined as macros to RtlAllocateHeap and RtlFreeHeap.
This will be needed for NT6 apis.
  • Loading branch information
tkreuzer authored and DarkFire01 committed Nov 1, 2024
1 parent 55954f8 commit e102b88
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions dll/win32/kernel32/client/heapmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1860,5 +1860,26 @@ LocalUnlock(HLOCAL hMem)
RtlUnlockHeap(BaseHeap);
return RetVal;
}
#undef HeapAlloc
LPVOID
WINAPI
HeapAlloc(
_In_ HANDLE hHeap,
_In_ DWORD dwFlags,
_In_ SIZE_T dwBytes)
{
return RtlAllocateHeap(hHeap, dwFlags, dwBytes);
}

#undef HeapFree
BOOL
WINAPI
HeapFree(
_In_ HANDLE hHeap,
_In_ DWORD dwFlags,
_In_ _Frees_ptr_opt_ LPVOID lpMem)
{
return RtlFreeHeap(hHeap, dwFlags, lpMem);
}

/* EOF */

0 comments on commit e102b88

Please sign in to comment.