1
|
1 /*
|
|
2 * Win32 heap definitions
|
|
3 *
|
|
4 * Copyright 1996 Alexandre Julliard
|
|
5 */
|
|
6
|
|
7 #ifndef __WINE_HEAP_H
|
|
8 #define __WINE_HEAP_H
|
|
9
|
|
10 #include "config.h"
|
|
11
|
|
12 #include "winbase.h"
|
|
13
|
|
14 extern HANDLE SystemHeap;
|
|
15 extern HANDLE SegptrHeap;
|
|
16
|
|
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
|
|
24 /* SEGPTR helper macros */
|
|
25
|
|
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);
|
|
37 }
|
|
38 #define SEGPTR_GET(ptr) SEGPTR_Get(ptr)
|
|
39 #define SEGPTR_FREE(ptr) \
|
|
40 (HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0)
|
|
41
|
|
42 /* system heap private data */
|
|
43 /* you must lock the system heap before using this structure */
|
|
44 typedef struct
|
|
45 {
|
|
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;
|
|
53
|
|
54 extern SYSTEM_HEAP_DESCR *SystemHeapDescr;
|
|
55
|
|
56 #endif /* __WINE_HEAP_H */
|