- Revert 44301
[reactos.git] / dll / win32 / gdi32 / include / gdi32p.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS System Libraries
4 * FILE: lib/gdi32/include/gdi32p.h
5 * PURPOSE: User-Mode Win32 GDI Library Private Header
6 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
7 */
8
9
10 /* DATA **********************************************************************/
11
12 extern PGDI_TABLE_ENTRY GdiHandleTable;
13 extern PGDI_SHARED_HANDLE_TABLE GdiSharedHandleTable;
14 extern HANDLE hProcessHeap;
15 extern HANDLE CurrentProcessId;
16 extern DWORD GDI_BatchLimit;
17 extern PDEVCAPS GdiDevCaps;
18 extern BOOL gbLpk; // Global bool LanguagePack
19 extern HANDLE ghSpooler;
20 extern RTL_CRITICAL_SECTION semLocal;
21
22 typedef INT
23 (CALLBACK* EMFPLAYPROC)(
24 HDC hdc,
25 INT iFunction,
26 HANDLE hPageQuery
27 );
28
29 /* DEFINES *******************************************************************/
30
31 #define HANDLE_LIST_INC 20
32
33 #define METAFILE_MEMORY 1
34 #define METAFILE_DISK 2
35
36 #define SAPCALLBACKDELAY 244
37
38 /* MACRO ********************************************************************/
39
40 #define ROP_USES_SOURCE(Rop) (((Rop) << 2 ^ Rop) & 0xCC0000)
41
42 /* TYPES *********************************************************************/
43
44 // Based on wmfapi.h and Wine.
45 typedef struct tagMETAFILEDC
46 {
47 PVOID pvMetaBuffer;
48 HANDLE hFile;
49 DWORD Size;
50 DWORD dwWritten;
51 METAHEADER mh;
52 WORD reserved;
53 HLOCAL MFObjList;
54 HPEN hPen;
55 HBRUSH hBrush;
56 HDC hDc;
57 HGDIOBJ hMetaDc;
58 HPALETTE hPalette;
59 HFONT hFont;
60 HBITMAP hBitmap;
61 HRGN hRegion;
62 HGDIOBJ hMetafile;
63 HGDIOBJ hMemDc;
64 HPEN hExtPen;
65 HGDIOBJ hEnhMetaDc;
66 HGDIOBJ hEnhMetaFile;
67 HCOLORSPACE hColorSpace;
68 WCHAR Filename[MAX_PATH+2];
69 } METAFILEDC,*PMETAFILEDC;
70
71 // Metafile Entry handle
72 typedef struct tagMF_ENTRY
73 {
74 LIST_ENTRY List;
75 HGDIOBJ hmDC; // Handle return from NtGdiCreateClientObj.
76 PMETAFILEDC pmfDC;
77 } MF_ENTRY, *PMF_ENTRY;
78
79 typedef struct tagENHMETAFILE
80 {
81 PVOID pvMetaBuffer;
82 HANDLE hFile; /* Handle for disk based MetaFile */
83 DWORD Size;
84 INT iType;
85 PENHMETAHEADER emf;
86 UINT handles_size, cur_handles;
87 HGDIOBJ *handles;
88 INT horzres, vertres;
89 INT horzsize, vertsize;
90 INT logpixelsx, logpixelsy;
91 INT bitspixel;
92 INT textcaps;
93 INT rastercaps;
94 INT technology;
95 INT planes;
96 } ENHMETAFILE,*PENHMETAFILE;
97
98
99 #define PDEV_UMPD_ID 0xFEDCBA98
100 // UMPDEV flags
101 #define UMPDEV_NO_ESCAPE 0x0002
102 #define UMPDEV_SUPPORT_ESCAPE 0x0004
103 typedef struct _UMPDEV
104 {
105 DWORD Sig; // Init with PDEV_UMPD_ID
106 struct _UMPDEV *pumpdNext;
107 PDRIVER_INFO_5W pdi5Info;
108 HMODULE hModule;
109 DWORD dwFlags;
110 DWORD dwDriverAttributes;
111 DWORD dwConfigVersion; // Number of times the configuration
112 // file for this driver has been upgraded
113 // or downgraded since the last spooler restart.
114 DWORD dwDriverCount; // After init should be 2
115 DWORD WOW64_UMPDev;
116 DWORD WOW64_hMod;
117 DWORD Unknown;
118 PVOID apfn[INDEX_LAST]; // Print Driver pfn
119 } UMPDEV, *PUMPDEV;
120
121 #define LOCALFONT_COUNT 10
122 typedef struct _LOCALFONT
123 {
124 FONT_ATTR lfa[LOCALFONT_COUNT];
125 } LOCALFONT, *PLOCALFONT;
126
127 // sdk/winspool.h
128 typedef BOOL (WINAPI *ABORTPRINTER) (HANDLE);
129 typedef BOOL (WINAPI *CLOSEPRINTER) (HANDLE);
130 typedef BOOL (WINAPI *CLOSESPOOLFILEHANDLE) (HANDLE, HANDLE); // W2k8
131 typedef HANDLE (WINAPI *COMMITSPOOLDATA) (HANDLE,HANDLE,DWORD); // W2k8
132 typedef LONG (WINAPI *DOCUMENTPROPERTIESW) (HWND,HANDLE,LPWSTR,PDEVMODEW,PDEVMODEW,DWORD);
133 typedef BOOL (WINAPI *ENDDOCPRINTER) (HANDLE);
134 typedef BOOL (WINAPI *ENDPAGEPRINTER) (HANDLE);
135 typedef BOOL (WINAPI *GETPRINTERW) (HANDLE,DWORD,LPBYTE,DWORD,LPDWORD);
136 typedef BOOL (WINAPI *GETPRINTERDRIVERW) (HANDLE,LPWSTR,DWORD,LPBYTE,DWORD,LPDWORD);
137 typedef HANDLE (WINAPI *GETSPOOLFILEHANDLE) (HANDLE); // W2k8
138 typedef BOOL (WINAPI *ISVALIDDEVMODEW) (PDEVMODEW,size_t);
139 typedef BOOL (WINAPI *OPENPRINTERW) (LPWSTR,PHANDLE,LPPRINTER_DEFAULTSW);
140 typedef BOOL (WINAPI *READPRINTER) (HANDLE,PVOID,DWORD,PDWORD);
141 typedef BOOL (WINAPI *RESETPRINTERW) (HANDLE,LPPRINTER_DEFAULTSW);
142 typedef LPWSTR (WINAPI *STARTDOCDLGW) (HANDLE,DOCINFOW *);
143 typedef DWORD (WINAPI *STARTDOCPRINTERW) (HANDLE,DWORD,PBYTE);
144 typedef BOOL (WINAPI *STARTPAGEPRINTER) (HANDLE);
145 // ddk/winsplp.h
146 typedef BOOL (WINAPI *SEEKPRINTER) (HANDLE,LARGE_INTEGER,PLARGE_INTEGER,DWORD,BOOL);
147 typedef BOOL (WINAPI *SPLREADPRINTER) (HANDLE,LPBYTE *,DWORD);
148 // Same as ddk/winsplp.h DriverUnloadComplete?
149 typedef BOOL (WINAPI *SPLDRIVERUNLOADCOMPLETE) (LPWSTR);
150 // Driver support:
151 // DrvDocumentEvent api/winddiui.h not W2k8 DocumentEventAW
152 typedef INT (WINAPI *DOCUMENTEVENT) (HANDLE,HDC,INT,ULONG,PVOID,ULONG,PVOID);
153 // DrvQueryColorProfile
154 typedef BOOL (WINAPI *QUERYCOLORPROFILE) (HANDLE,PDEVMODEW,ULONG,VOID*,ULONG,FLONG);
155 // Unknown:
156 typedef DWORD (WINAPI *QUERYSPOOLMODE) (HANDLE,DWORD,DWORD);
157 typedef DWORD (WINAPI *QUERYREMOTEFONTS) (DWORD,DWORD,DWORD);
158
159 extern CLOSEPRINTER fpClosePrinter;
160
161 /* FUNCTIONS *****************************************************************/
162
163 PVOID
164 HEAP_alloc(DWORD len);
165
166 NTSTATUS
167 HEAP_strdupA2W(
168 LPWSTR* ppszW,
169 LPCSTR lpszA
170 );
171
172 VOID
173 HEAP_free(LPVOID memory);
174
175 VOID
176 FASTCALL
177 FONT_TextMetricWToA(
178 const TEXTMETRICW *ptmW,
179 LPTEXTMETRICA ptmA
180 );
181
182 VOID
183 FASTCALL
184 NewTextMetricW2A(
185 NEWTEXTMETRICA *tma,
186 NEWTEXTMETRICW *tmw
187 );
188
189 VOID
190 FASTCALL
191 NewTextMetricExW2A(
192 NEWTEXTMETRICEXA *tma,
193 NEWTEXTMETRICEXW *tmw
194 );
195
196 BOOL
197 FASTCALL
198 DeleteRegion( HRGN );
199
200 BOOL
201 GdiIsHandleValid(HGDIOBJ hGdiObj);
202
203 BOOL
204 GdiGetHandleUserData(
205 HGDIOBJ hGdiObj,
206 DWORD ObjectType,
207 PVOID *UserData
208 );
209
210 PLDC
211 FASTCALL
212 GdiGetLDC(HDC hDC);
213
214 HGDIOBJ
215 WINAPI
216 GdiFixUpHandle(HGDIOBJ hGO);
217
218 BOOL
219 WINAPI
220 CalculateColorTableSize(
221 CONST BITMAPINFOHEADER *BitmapInfoHeader,
222 UINT *ColorSpec,
223 UINT *ColorTableSize
224 );
225
226 LPBITMAPINFO
227 WINAPI
228 ConvertBitmapInfo(
229 CONST BITMAPINFO *BitmapInfo,
230 UINT ColorSpec,
231 UINT *BitmapInfoSize,
232 BOOL FollowedByData
233 );
234
235 DEVMODEW *
236 NTAPI
237 GdiConvertToDevmodeW(DEVMODEA *dm);
238
239 DWORD
240 WINAPI
241 GetAndSetDCDWord( HDC, INT, DWORD, DWORD, DWORD, DWORD );
242
243 DWORD
244 WINAPI
245 GetDCDWord( HDC, INT, DWORD);
246
247 HGDIOBJ
248 WINAPI
249 GetDCObject( HDC, INT);
250
251 VOID
252 NTAPI
253 LogFontA2W(
254 LPLOGFONTW pW,
255 CONST LOGFONTA *pA
256 );
257
258 VOID
259 NTAPI
260 LogFontW2A(
261 LPLOGFONTA pA,
262 CONST LOGFONTW *pW
263 );
264
265 VOID
266 WINAPI
267 EnumLogFontExW2A(
268 LPENUMLOGFONTEXA fontA,
269 CONST ENUMLOGFONTEXW *fontW );
270
271 /* FIXME: Put in some public header */
272 UINT
273 WINAPI
274 UserRealizePalette(HDC hDC);
275
276 int
277 WINAPI
278 GdiAddFontResourceW(LPCWSTR lpszFilename,FLONG fl,DESIGNVECTOR *pdv);
279
280 VOID
281 WINAPI
282 GdiSetLastError( DWORD dwErrCode );
283
284 DWORD WINAPI GdiGetCodePage(HDC);
285 UINT FASTCALL DIB_BitmapBitsSize( PBITMAPINFO );
286
287 int
288 WINAPI
289 GdiGetBitmapBitsSize(BITMAPINFO *lpbmi);
290
291 VOID GdiSAPCallback(PLDC pldc);
292
293 int FASTCALL DocumentEventEx(PVOID,HANDLE,HDC,int,ULONG,PVOID,ULONG,PVOID);
294 BOOL FASTCALL EndPagePrinterEx(PVOID,HANDLE);
295 BOOL FASTCALL LoadTheSpoolerDrv(VOID);
296
297 /* EOF */