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