Author: ion Date: Tue Jun 27 02:48:12 2006 New Revision: 22646
URL: http://svn.reactos.org/svn/reactos?rev=22646&view=rev Log: - Fix a typo in a comparison (& vs &&) which was breaking GlobalReAlloc in some cases. - Fix a missing | (OR) in GlobalAlloc which created an invalid handle if the first allocation was of size 0.
Modified: trunk/reactos/dll/win32/kernel32/include/baseheap.h trunk/reactos/dll/win32/kernel32/mem/global.c
Modified: trunk/reactos/dll/win32/kernel32/include/baseheap.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/include/... ============================================================================== --- trunk/reactos/dll/win32/kernel32/include/baseheap.h (original) +++ trunk/reactos/dll/win32/kernel32/include/baseheap.h Tue Jun 27 02:48:12 2006 @@ -65,6 +65,7 @@ #define BASE_TRACE_FAILURE() \ BH_PRINT("[BASE_HEAP] %s : Failing %d\n", \ __FUNCTION__, __LINE__) + // // The handle structure for global heap handles. // Notice that it nicely overlays with RTL_HANDLE_ENTRY.
Modified: trunk/reactos/dll/win32/kernel32/mem/global.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/mem/glob... ============================================================================== --- trunk/reactos/dll/win32/kernel32/mem/global.c (original) +++ trunk/reactos/dll/win32/kernel32/mem/global.c Tue Jun 27 02:48:12 2006 @@ -117,7 +117,7 @@ if (!Ptr) { /* We don't have a valid pointer, but so reuse this handle */ - HandleEntry->Flags = BASE_HEAP_ENTRY_FLAG_REUSE; + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSE; }
/* Check if the handle is discardable */ @@ -486,7 +486,7 @@ if (Ptr) { /* Make sure the handle isn't locked */ - if ((uFlags & GMEM_MOVEABLE) & !(HandleEntry->LockCount)) + if ((uFlags & GMEM_MOVEABLE) && !(HandleEntry->LockCount)) { /* Free the current heap */ RtlFreeHeap(hProcessHeap, Flags, Ptr);