mirror of
https://github.com/reactos/reactos.git
synced 2024-11-19 05:22:59 +00:00
[RTL] Fix heap usage flags
- Use Heap->ForceFlags where needed - Use passed-in flags instead of the heap flags in some places - Do not recursively acquire the heap lock
This commit is contained in:
parent
d74df8af74
commit
6d697561f0
1 changed files with 8 additions and 7 deletions
|
@ -2681,7 +2681,8 @@ RtlReAllocateHeap(HANDLE HeapPtr,
|
|||
{
|
||||
RtlEnterHeapLock(Heap->LockVariable, TRUE);
|
||||
HeapLocked = TRUE;
|
||||
Flags &= ~HEAP_NO_SERIALIZE;
|
||||
/* Do not acquire the lock anymore for re-entrant call */
|
||||
Flags |= HEAP_NO_SERIALIZE;
|
||||
}
|
||||
|
||||
/* Get the pointer to the in-use entry */
|
||||
|
@ -3656,7 +3657,7 @@ BOOLEAN NTAPI RtlValidateHeap(
|
|||
}
|
||||
|
||||
/* Force flags */
|
||||
Flags = Heap->ForceFlags;
|
||||
Flags |= Heap->ForceFlags;
|
||||
|
||||
/* Acquire the lock if necessary */
|
||||
if (!(Flags & HEAP_NO_SERIALIZE))
|
||||
|
@ -3744,7 +3745,7 @@ RtlSetUserValueHeap(IN PVOID HeapHandle,
|
|||
BOOLEAN HeapLocked = FALSE, ValueSet = FALSE;
|
||||
|
||||
/* Force flags */
|
||||
Flags |= Heap->Flags;
|
||||
Flags |= Heap->ForceFlags;
|
||||
|
||||
/* Call special heap */
|
||||
if (RtlpHeapIsSpecial(Flags))
|
||||
|
@ -3806,14 +3807,14 @@ RtlSetUserFlagsHeap(IN PVOID HeapHandle,
|
|||
BOOLEAN HeapLocked = FALSE;
|
||||
|
||||
/* Force flags */
|
||||
Flags |= Heap->Flags;
|
||||
Flags |= Heap->ForceFlags;
|
||||
|
||||
/* Call special heap */
|
||||
if (RtlpHeapIsSpecial(Flags))
|
||||
return RtlDebugSetUserFlagsHeap(Heap, Flags, BaseAddress, UserFlagsReset, UserFlagsSet);
|
||||
|
||||
/* Lock if it's lockable */
|
||||
if (!(Heap->Flags & HEAP_NO_SERIALIZE))
|
||||
if (!(Flags & HEAP_NO_SERIALIZE))
|
||||
{
|
||||
RtlEnterHeapLock(Heap->LockVariable, TRUE);
|
||||
HeapLocked = TRUE;
|
||||
|
@ -3862,14 +3863,14 @@ RtlGetUserInfoHeap(IN PVOID HeapHandle,
|
|||
BOOLEAN HeapLocked = FALSE;
|
||||
|
||||
/* Force flags */
|
||||
Flags |= Heap->Flags;
|
||||
Flags |= Heap->ForceFlags;
|
||||
|
||||
/* Call special heap */
|
||||
if (RtlpHeapIsSpecial(Flags))
|
||||
return RtlDebugGetUserInfoHeap(Heap, Flags, BaseAddress, UserValue, UserFlags);
|
||||
|
||||
/* Lock if it's lockable */
|
||||
if (!(Heap->Flags & HEAP_NO_SERIALIZE))
|
||||
if (!(Flags & HEAP_NO_SERIALIZE))
|
||||
{
|
||||
RtlEnterHeapLock(Heap->LockVariable, TRUE);
|
||||
HeapLocked = TRUE;
|
||||
|
|
Loading…
Reference in a new issue