From 6f34173bc0d5fd796d5309fbd9be53639d7083fb Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Fri, 23 Jun 2006 23:10:58 +0000 Subject: [PATCH] - Hackplement RtlSetUserValueHeap and RtlGetUserInfoHeap, they are needed for being able to build higher-level heap management around the Heap APIs (either for developers or the OS). Case in point, needed for my Global* rewrite in kernel32. The current APIs are utter hacks, but they work (eventually we should get rid of the Wine Windows 95 heap implementation and replace it). svn path=/trunk/; revision=22552 --- reactos/dll/ntdll/def/ntdll.def | 4 ++-- reactos/include/ndk/rtlfuncs.h | 19 +++++++++++++++++ reactos/lib/rtl/heap.c | 37 +++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/reactos/dll/ntdll/def/ntdll.def b/reactos/dll/ntdll/def/ntdll.def index 421b819b6f5..73f04a905f2 100644 --- a/reactos/dll/ntdll/def/ntdll.def +++ b/reactos/dll/ntdll/def/ntdll.def @@ -482,7 +482,7 @@ RtlGetProcessHeaps@8 RtlGetSaclSecurityDescriptor@16 RtlGetSecurityDescriptorRMControl@8 RtlGetSetBootStatusData@24 -;RtlGetUserInfoHeap +RtlGetUserInfoHeap@20 RtlGetVersion@4 RtlHashUnicodeString@16 RtlIdentifierAuthoritySid@4 @@ -638,7 +638,7 @@ RtlSetSecurityObject@20 RtlSetTimeZoneInformation@4 ;RtlSetUnicodeCallouts ;RtlSetUserFlagsHeap -;RtlSetUserValueHeap +RtlSetUserValueHeap@16 RtlSizeHeap@12 RtlSplay@4 ;RtlStartRXact diff --git a/reactos/include/ndk/rtlfuncs.h b/reactos/include/ndk/rtlfuncs.h index 02e578e086e..2d5bf3886cb 100644 --- a/reactos/include/ndk/rtlfuncs.h +++ b/reactos/include/ndk/rtlfuncs.h @@ -496,6 +496,16 @@ RtlGetProcessHeaps( HANDLE *HeapArray ); +BOOLEAN +NTAPI +RtlGetUserInfoHeap( + IN PVOID HeapHandle, + IN ULONG Flags, + IN PVOID BaseAddress, + OUT PVOID *UserValue, + OUT PULONG UserFlags +); + NTSYSAPI PVOID NTAPI @@ -516,6 +526,15 @@ BOOLEAN NTAPI RtlUnlockHeap(IN HANDLE Heap); +BOOLEAN +NTAPI +RtlSetUserValueHeap( + IN PVOID HeapHandle, + IN ULONG Flags, + IN PVOID BaseAddress, + IN PVOID UserValue +); + NTSYSAPI ULONG NTAPI diff --git a/reactos/lib/rtl/heap.c b/reactos/lib/rtl/heap.c index 50bd5983664..7218879257c 100644 --- a/reactos/lib/rtl/heap.c +++ b/reactos/lib/rtl/heap.c @@ -100,6 +100,7 @@ typedef struct tagHEAP RTL_CRITICAL_SECTION critSection; /* Critical section for serialization */ ULONG flags; /* Heap flags */ ULONG magic; /* Magic number */ + PVOID UserValue; PRTL_HEAP_COMMIT_ROUTINE commitRoutine; } HEAP, *PHEAP; @@ -1843,4 +1844,40 @@ RtlZeroHeap( return FALSE; } +/* + * @unimplemented + */ +BOOLEAN +NTAPI +RtlSetUserValueHeap(IN PVOID HeapHandle, + IN ULONG Flags, + IN PVOID BaseAddress, + IN PVOID UserValue) +{ + HEAP *heapPtr = HEAP_GetPtr(HeapHandle); + + /* Hack */ + heapPtr->UserValue = UserValue; + return TRUE; +} + +/* + * @unimplemented + */ +BOOLEAN +NTAPI +RtlGetUserInfoHeap(IN PVOID HeapHandle, + IN ULONG Flags, + IN PVOID BaseAddress, + OUT PVOID *UserValue, + OUT PULONG UserFlags) +{ + HEAP *heapPtr = HEAP_GetPtr(HeapHandle); + + /* Hack */ + if (UserValue) *UserValue = heapPtr->UserValue; + if (UserFlags) *UserFlags = heapPtr->flags & HEAP_SETTABLE_USER_FLAGS; + return TRUE; +} + /* EOF */