2 * Win32 heap definitions
4 * Copyright 1996 Alexandre Julliard
14 extern HANDLE SystemHeap
;
15 extern HANDLE SegptrHeap
;
17 extern int HEAP_IsInsideHeap( HANDLE heap
, DWORD flags
, LPCVOID ptr
);
18 extern SEGPTR
HEAP_GetSegptr( HANDLE heap
, DWORD flags
, LPCVOID ptr
);
19 extern LPVOID
HEAP_xalloc( HANDLE heap
, DWORD flags
, DWORD size
);
20 extern LPSTR
HEAP_strdupA( HANDLE heap
, DWORD flags
, LPCSTR str
);
21 extern LPWSTR
HEAP_strdupW( HANDLE heap
, DWORD flags
, LPCWSTR str
);
22 extern LPWSTR
HEAP_strdupAtoW( HANDLE heap
, DWORD flags
, LPCSTR str
);
23 extern LPSTR
HEAP_strdupWtoA( HANDLE heap
, DWORD flags
, LPCWSTR str
);
24 extern BOOL
HEAP_CreateSystemHeap(void);
26 /* SEGPTR helper macros */
28 #define SEGPTR_ALLOC(size) \
29 (HeapAlloc( SegptrHeap, 0, (size) ))
30 #define SEGPTR_NEW(type) \
31 ((type *)HeapAlloc( SegptrHeap, 0, sizeof(type) ))
32 #define SEGPTR_STRDUP(str) \
33 (HIWORD(str) ? HEAP_strdupA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
34 #define SEGPTR_STRDUP_WtoA(str) \
35 (HIWORD(str) ? HEAP_strdupWtoA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
36 /* define an inline function, a macro won't do */
37 static inline SEGPTR WINE_UNUSED
SEGPTR_Get(LPCVOID ptr
) {
38 return (HIWORD(ptr
) ? HEAP_GetSegptr( SegptrHeap
, 0, ptr
) : (SEGPTR
)ptr
);
40 #define SEGPTR_GET(ptr) SEGPTR_Get(ptr)
41 #define SEGPTR_FREE(ptr) \
42 (HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0)
44 /* system heap private data */
45 /* you must lock the system heap before using this structure */
48 void *gdi
; /* GDI heap */
49 void *user
; /* USER handle table */
50 void *cursor
; /* cursor information */
51 void *queue
; /* message queues descriptor */
52 void *win
; /* windows descriptor */
53 void *root
; /* X11 root window */
56 extern SYSTEM_HEAP_DESCR
*SystemHeapDescr
;
58 #endif /* __WINE_HEAP_H */