vo_glamo: sub.h was moved to sub directory in c9026cb3210205b07e2e068467a18ee40f9259a3
[mplayer/glamo.git] / loader / wine / heap.h
blob477f0e1acc70b6903d43aa9a884c817bd78f316a
1 /*
2 * Win32 heap definitions
4 * Copyright 1996 Alexandre Julliard
5 */
7 #ifndef MPLAYER_HEAP_H
8 #define MPLAYER_HEAP_H
10 #include "config.h"
12 #include "winbase.h"
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 */
44 typedef struct
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 */
52 } SYSTEM_HEAP_DESCR;
54 extern SYSTEM_HEAP_DESCR *SystemHeapDescr;
56 #endif /* MPLAYER_HEAP_H */