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 LPSTR
HEAP_strdupA( HANDLE heap
, DWORD flags
, LPCSTR str
);
20 extern LPWSTR
HEAP_strdupW( HANDLE heap
, DWORD flags
, LPCWSTR str
);
21 extern LPWSTR
HEAP_strdupAtoW( HANDLE heap
, DWORD flags
, LPCSTR str
);
22 extern LPSTR
HEAP_strdupWtoA( HANDLE heap
, DWORD flags
, LPCWSTR str
);
23 extern BOOL
HEAP_CreateSystemHeap(void);
25 /* SEGPTR helper macros */
27 #define SEGPTR_ALLOC(size) \
28 (HeapAlloc( SegptrHeap, 0, (size) ))
29 #define SEGPTR_NEW(type) \
30 ((type *)HeapAlloc( SegptrHeap, 0, sizeof(type) ))
31 #define SEGPTR_STRDUP(str) \
32 (HIWORD(str) ? HEAP_strdupA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
33 #define SEGPTR_STRDUP_WtoA(str) \
34 (HIWORD(str) ? HEAP_strdupWtoA( SegptrHeap, 0, (str) ) : (LPSTR)(str))
35 /* define an inline function, a macro won't do */
36 static inline SEGPTR WINE_UNUSED
SEGPTR_Get(LPCVOID ptr
) {
37 return (HIWORD(ptr
) ? HEAP_GetSegptr( SegptrHeap
, 0, ptr
) : (SEGPTR
)ptr
);
39 #define SEGPTR_GET(ptr) SEGPTR_Get(ptr)
40 #define SEGPTR_FREE(ptr) \
41 (HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0)
43 /* system heap private data */
44 /* you must lock the system heap before using this structure */
47 void *gdi
; /* GDI heap */
48 void *user
; /* USER handle table */
49 void *cursor
; /* cursor information */
50 void *queue
; /* message queues descriptor */
51 void *win
; /* windows descriptor */
52 void *root
; /* X11 root window */
55 extern SYSTEM_HEAP_DESCR
*SystemHeapDescr
;
57 #endif /* __WINE_HEAP_H */