00001
00002
00003
00004
00005
00006
00007 #ifndef __WINE_HEAP_H
00008 #define __WINE_HEAP_H
00009
00010 #include "config.h"
00011
00012 #include "winbase.h"
00013
00014 extern HANDLE SystemHeap;
00015 extern HANDLE SegptrHeap;
00016
00017 extern int HEAP_IsInsideHeap( HANDLE heap, DWORD flags, LPCVOID ptr );
00018 extern SEGPTR HEAP_GetSegptr( HANDLE heap, DWORD flags, LPCVOID ptr );
00019 extern LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str );
00020 extern LPWSTR HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str );
00021 extern LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str );
00022 extern LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str );
00023
00024
00025
00026 #define SEGPTR_ALLOC(size) \
00027 (HeapAlloc( SegptrHeap, 0, (size) ))
00028 #define SEGPTR_NEW(type) \
00029 ((type *)HeapAlloc( SegptrHeap, 0, sizeof(type) ))
00030 #define SEGPTR_STRDUP(str) \
00031 (HIWORD(str) ? HEAP_strdupA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
00032 #define SEGPTR_STRDUP_WtoA(str) \
00033 (HIWORD(str) ? HEAP_strdupWtoA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
00034
00035 static inline SEGPTR WINE_UNUSED SEGPTR_Get(LPCVOID ptr) {
00036 return (HIWORD(ptr) ? HEAP_GetSegptr( SegptrHeap, 0, ptr ) : (SEGPTR)ptr);
00037 }
00038 #define SEGPTR_GET(ptr) SEGPTR_Get(ptr)
00039 #define SEGPTR_FREE(ptr) \
00040 (HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0)
00041
00042
00043
00044 typedef struct
00045 {
00046 void *gdi;
00047 void *user;
00048 void *cursor;
00049 void *queue;
00050 void *win;
00051 void *root;
00052 } SYSTEM_HEAP_DESCR;
00053
00054 extern SYSTEM_HEAP_DESCR *SystemHeapDescr;
00055
00056 #endif