[RTL] Implement RtlGetProcessHeaps

This commit is contained in:
Mark Jansen 2023-12-07 20:20:03 +01:00
parent 0ba94c83b5
commit b8cdd1a879
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
3 changed files with 32 additions and 15 deletions

View file

@ -127,3 +127,32 @@ RtlInitializeHeapManager(VOID)
RtlInitializeCriticalSection(&RtlpProcessHeapsListLock);
}
ULONG NTAPI
RtlGetProcessHeaps(_In_ ULONG HeapCount, _Out_cap_(HeapCount) HANDLE *HeapArray)
{
PPEB Peb = RtlGetCurrentPeb();
RtlEnterCriticalSection(&RtlpProcessHeapsListLock);
ULONG nHeaps = Peb->NumberOfHeaps;
_SEH2_TRY
{
if (HeapArray)
{
for (ULONG n = 0; n < min(nHeaps, HeapCount); ++n)
{
HeapArray[n] = Peb->ProcessHeaps[n];
}
}
}
_SEH2_FINALLY
{
RtlLeaveCriticalSection(&RtlpProcessHeapsListLock);
}
_SEH2_END;
/* TODO: Add RtlpDphPageHeapList here */
return nHeaps;
}