Author: dchapyshev Date: Sun Sep 25 17:05:52 2016 New Revision: 72802
URL: http://svn.reactos.org/svn/reactos?rev=72802&view=rev Log: [RTL] Capture parameters with using SEH. Fixes new test for ntdll:RtlAllocateHeap
Modified: trunk/reactos/sdk/lib/rtl/heap.c
Modified: trunk/reactos/sdk/lib/rtl/heap.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/heap.c?rev=7280... ============================================================================== --- trunk/reactos/sdk/lib/rtl/heap.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/rtl/heap.c [iso-8859-1] Sun Sep 25 17:05:52 2016 @@ -1256,8 +1256,23 @@ Flags &= HEAP_CREATE_VALID_MASK; }
- /* TODO: Capture parameters, once we decide to use SEH */ - if (!Parameters) Parameters = &SafeParams; + /* Capture parameters */ + if (Parameters) + { + _SEH2_TRY + { + /* If size of structure correct, then copy it */ + if (Parameters->Length == sizeof(RTL_HEAP_PARAMETERS)) + RtlCopyMemory(&SafeParams, Parameters, sizeof(RTL_HEAP_PARAMETERS)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + _SEH2_YIELD(return NULL); + } + _SEH2_END; + } + + Parameters = &SafeParams;
/* Check global flags */ if (NtGlobalFlags & FLG_HEAP_DISABLE_COALESCING) @@ -1960,7 +1975,7 @@ /* Add settable user flags, if any */ EntryFlags |= (Flags & HEAP_SETTABLE_USER_FLAGS) >> 4;
- Index = AllocationSize >> HEAP_ENTRY_SHIFT; + Index = AllocationSize >> HEAP_ENTRY_SHIFT;
/* Acquire the lock if necessary */ if (!(Flags & HEAP_NO_SERIALIZE))