- NDK 0.98, now with versionned headers. Too many changes to list, see the TinyKRNL...
[reactos.git] / reactos / subsystems / win32 / win32k / w32k.h
1 #ifndef __W32K_H
2 #define __W32K_H
3 /*
4 * COPYRIGHT: See COPYING in the top level directory
5 * PROJECT: ReactOS Graphics Subsystem
6 * FILE: subsys/win32k/w32k.h
7 * PURPOSE: Main Win32K Header
8 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
9 */
10
11 /* INCLUDES ******************************************************************/
12
13 #define _NO_COM
14
15 /* DDK/NDK/SDK Headers */
16 #include <ntifs.h>
17 #include <ntddk.h>
18 #include <ntddmou.h>
19 #include <ntndk.h>
20 //#include <rtltypes.h>
21
22 /* Win32 Headers */
23 /* FIXME: Defines in winbase.h that we need... */
24 typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
25 #define WINBASEAPI
26 #define STARTF_USESIZE 2
27 #define STARTF_USEPOSITION 4
28 #include <stdarg.h>
29 #include <windef.h>
30 #include <winerror.h>
31 #include <wingdi.h>
32 #include <winddi.h>
33 #include <winuser.h>
34 #include <prntfont.h>
35 #include <dde.h>
36 #include <wincon.h>
37 #define _NOCSECT_TYPE
38 #include <ddrawi.h>
39
40 /* SEH Support with PSEH */
41 #include <pseh/pseh.h>
42
43 /* CSRSS Header */
44 #include <csrss/csrss.h>
45
46 /* Helper Header */
47 #include <reactos/helper.h>
48
49 /* Probe and capture */
50 #include <reactos/probe.h>
51
52 /* Public Win32K Headers */
53 #include <win32k/callback.h>
54 #include <win32k/ntusrtyp.h>
55 #include <win32k/ntuser.h>
56 #include <win32k/ntgdityp.h>
57 #include <win32k/ntgdibad.h>
58 #include <ntgdi.h>
59
60 /* Internal Win32K Header */
61 #include "include/win32k.h"
62
63 /* Undocumented stuff */
64 typedef DRIVEROBJ *PDRIVEROBJ;
65 #define WM_SYSTIMER 280
66 #ifndef M_PI
67 #define M_PI 3.14159265358979323846f
68 #define M_PI_2 1.57079632679489661923
69 #endif
70
71 /* User heap */
72 extern HANDLE GlobalUserHeap;
73
74 HANDLE
75 UserCreateHeap(OUT PSECTION_OBJECT *SectionObject,
76 IN OUT PVOID *SystemBase,
77 IN ULONG HeapSize);
78
79 static __inline PVOID
80 UserHeapAlloc(SIZE_T Bytes)
81 {
82 return RtlAllocateHeap(GlobalUserHeap,
83 HEAP_NO_SERIALIZE,
84 Bytes);
85 }
86
87 static __inline BOOL
88 UserHeapFree(PVOID lpMem)
89 {
90 return RtlFreeHeap(GlobalUserHeap,
91 HEAP_NO_SERIALIZE,
92 lpMem);
93 }
94
95 static __inline PVOID
96 UserHeapReAlloc(PVOID lpMem,
97 SIZE_T Bytes)
98 {
99 #if 0
100 /* NOTE: ntoskrnl doesn't export RtlReAllocateHeap... */
101 return RtlReAllocateHeap(GlobalUserHeap,
102 HEAP_NO_SERIALIZE,
103 lpMem,
104 Bytes);
105 #else
106 SIZE_T PrevSize;
107 PVOID pNew;
108
109 PrevSize = RtlSizeHeap(GlobalUserHeap,
110 HEAP_NO_SERIALIZE,
111 lpMem);
112
113 if (PrevSize == Bytes)
114 return lpMem;
115
116 pNew = RtlAllocateHeap(GlobalUserHeap,
117 HEAP_NO_SERIALIZE,
118 Bytes);
119 if (pNew != NULL)
120 {
121 if (PrevSize < Bytes)
122 Bytes = PrevSize;
123
124 RtlCopyMemory(pNew,
125 lpMem,
126 Bytes);
127
128 RtlFreeHeap(GlobalUserHeap,
129 HEAP_NO_SERIALIZE,
130 lpMem);
131 }
132
133 return pNew;
134 #endif
135 }
136
137 static __inline PVOID
138 UserHeapAddressToUser(PVOID lpMem)
139 {
140 return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)GlobalUserHeap) +
141 (ULONG_PTR)PsGetWin32Process()->HeapMappings.UserMapping);
142 }
143
144 #endif /* __W32K_H */