Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/kernelbase/kernelbase.h | 37 ++++++++++++++++++++++++++++++++++++ dlls/kernelbase/memory.c | 37 ------------------------------------ 2 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/dlls/kernelbase/kernelbase.h b/dlls/kernelbase/kernelbase.h index 82502059b66..7d1bbad3012 100644 --- a/dlls/kernelbase/kernelbase.h +++ b/dlls/kernelbase/kernelbase.h @@ -54,4 +54,41 @@ static inline BOOL set_ntstatus( NTSTATUS status ) #define HeapReAlloc(heap, flags, ptr, size) RtlReAllocateHeap(heap, flags, ptr, size) #define HeapFree(heap, flags, ptr) RtlFreeHeap(heap, flags, ptr)
+#include "pshpack1.h" + +struct mem_entry +{ + WORD magic; + void *ptr; + BYTE flags; + BYTE lock; +}; + +#include "poppack.h" + +#define MAGIC_LOCAL_USED 0x5342 +/* align the storage needed for the HLOCAL on an 8-byte boundary thus + * LocalAlloc/LocalReAlloc'ing with LMEM_MOVEABLE of memory with + * size = 8*k, where k=1,2,3,... allocs exactly the given size. + * The Minolta DiMAGE Image Viewer heavily relies on this, corrupting + * the output jpeg's > 1 MB if not */ +#define HLOCAL_STORAGE (sizeof(HLOCAL) * 2) + +static inline struct mem_entry *unsafe_mem_from_HLOCAL( HLOCAL handle ) +{ + struct mem_entry *mem = CONTAINING_RECORD( handle, struct mem_entry, ptr ); + if (mem->magic != MAGIC_LOCAL_USED) return NULL; + return mem; +} + +static inline HLOCAL HLOCAL_from_mem( struct mem_entry *mem ) +{ + return &mem->ptr; +} + +static inline BOOL is_pointer( HLOCAL handle ) +{ + return !((ULONG_PTR)handle & 2); +} + #endif /* __WINE_KERNELBASE_H */ diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c index 765d5dea3d8..e0378e39014 100644 --- a/dlls/kernelbase/memory.c +++ b/dlls/kernelbase/memory.c @@ -578,43 +578,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH HeapWalk( HANDLE heap, PROCESS_HEAP_ENTRY *entry ) * Global/local heap functions ***********************************************************************/
-#include "pshpack1.h" - -struct mem_entry -{ - WORD magic; - void *ptr; - BYTE flags; - BYTE lock; -}; - -#include "poppack.h" - -#define MAGIC_LOCAL_USED 0x5342 -/* align the storage needed for the HLOCAL on an 8-byte boundary thus - * LocalAlloc/LocalReAlloc'ing with LMEM_MOVEABLE of memory with - * size = 8*k, where k=1,2,3,... allocs exactly the given size. - * The Minolta DiMAGE Image Viewer heavily relies on this, corrupting - * the output jpeg's > 1 MB if not */ -#define HLOCAL_STORAGE (sizeof(HLOCAL) * 2) - -static inline struct mem_entry *unsafe_mem_from_HLOCAL( HLOCAL handle ) -{ - struct mem_entry *mem = CONTAINING_RECORD( handle, struct mem_entry, ptr ); - if (mem->magic != MAGIC_LOCAL_USED) return NULL; - return mem; -} - -static inline HLOCAL HLOCAL_from_mem( struct mem_entry *mem ) -{ - return &mem->ptr; -} - -static inline BOOL is_pointer( HLOCAL handle ) -{ - return !((ULONG_PTR)handle & 2); -} - /*********************************************************************** * GlobalAlloc (kernelbase.@) */