[ros-diffs] [tkreuzer] 43466: Some 64 bit heap fixes by encoded, merged from amd64 branch

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Wed Oct 14 22:46:58 CEST 2009


Author: tkreuzer
Date: Wed Oct 14 22:46:58 2009
New Revision: 43466

URL: http://svn.reactos.org/svn/reactos?rev=43466&view=rev
Log:
Some 64 bit heap fixes by encoded, merged from amd64 branch

Modified:
    trunk/reactos/lib/rtl/heap.c

Modified: trunk/reactos/lib/rtl/heap.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heap.c?rev=43466&r1=43465&r2=43466&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/heap.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/heap.c [iso-8859-1] Wed Oct 14 22:46:58 2009
@@ -83,9 +83,14 @@
 
 #define ARENA_FLAG_FREE        0x00000001  /* flags OR'ed with arena size */
 #define ARENA_FLAG_PREV_FREE   0x00000002
-#define ARENA_SIZE_MASK        (~3)
 #define ARENA_INUSE_MAGIC      0x455355        /* Value for arena 'magic' field */
 #define ARENA_FREE_MAGIC       0x45455246      /* Value for arena 'magic' field */
+
+#ifndef _WIN64
+#define ARENA_SIZE_MASK        (~3L)
+#else
+#define ARENA_SIZE_MASK        (~7L)
+#endif
 
 #define ARENA_INUSE_FILLER     0x55
 #define ARENA_FREE_FILLER      0xaa
@@ -113,7 +118,7 @@
     0x10, 0x20, 0x80, 0x200, MAXULONG
 };
 
-typedef struct
+typedef union
 {
     ARENA_FREE  arena;
     void        *aligment[4];
@@ -146,7 +151,7 @@
     SUBHEAP          subheap;       /* First sub-heap */
     struct list      entry;         /* Entry in process heap list */
     RTL_CRITICAL_SECTION critSection; /* Critical section for serialization */
-    FREE_LIST_ENTRY  freeList[HEAP_NB_FREE_LISTS];  /* Free lists */
+    FREE_LIST_ENTRY  freeList[HEAP_NB_FREE_LISTS] DECLSPEC_ALIGN(8);  /* Free lists */
     DWORD            flags;         /* Heap flags */
     DWORD            magic;         /* Magic number */
     PRTL_HEAP_COMMIT_ROUTINE commitRoutine;
@@ -1249,7 +1254,7 @@
 PVOID NTAPI
 RtlAllocateHeap(HANDLE heap,   /* [in] Handle of private heap block */
                 ULONG flags,   /* [in] Heap allocation control flags */
-                ULONG size)    /* [in] Number of bytes to allocate */
+                SIZE_T size)    /* [in] Number of bytes to allocate */
 {
    ARENA_FREE *pArena;
    ARENA_INUSE *pInUse;
@@ -1599,14 +1604,14 @@
  *
  * @implemented
  */
-ULONG NTAPI
+SIZE_T NTAPI
 RtlSizeHeap(
    HANDLE heap,
    ULONG flags,
    PVOID ptr
 )
 {
-   SIZE_T ret;
+    SIZE_T ret;
     HEAP *heapPtr = HEAP_GetPtr( heap );
 
     if (!heapPtr)
@@ -1891,7 +1896,7 @@
 RtlExtendHeap(IN HANDLE Heap,
               IN ULONG Flags,
               IN PVOID P,
-              IN ULONG Size)
+              IN SIZE_T Size)
 {
     /* TODO */
     UNIMPLEMENTED;




More information about the Ros-diffs mailing list