Removed some comments - previous change didn't fix infinite re-creation of print...
[reactos.git] / reactos / subsys / win32k / objects / print.c
1 /*
2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 /* $Id: print.c,v 1.23 2004/07/17 17:37:41 blight Exp $ */
20 #include <w32k.h>
21
22 INT
23 STDCALL
24 NtGdiAbortDoc(HDC hDC)
25 {
26 UNIMPLEMENTED;
27 return 0;
28 }
29
30 INT
31 STDCALL
32 NtGdiEndDoc(HDC hDC)
33 {
34 UNIMPLEMENTED;
35 return 0;
36 }
37
38 INT
39 STDCALL
40 NtGdiEndPage(HDC hDC)
41 {
42 UNIMPLEMENTED;
43 return 0;
44 }
45
46 INT
47 STDCALL
48 NtGdiEscape(HDC hDC,
49 INT Escape,
50 INT InSize,
51 LPCSTR InData,
52 LPVOID OutData)
53 {
54 UNIMPLEMENTED;
55 return 0;
56 }
57
58 INT
59 STDCALL
60 IntEngExtEscape(
61 SURFOBJ *Surface,
62 INT Escape,
63 INT InSize,
64 LPVOID InData,
65 INT OutSize,
66 LPVOID OutData)
67 {
68 if (Escape == 0x1101)
69 return 0;
70
71 UNIMPLEMENTED;
72 return -1;
73 }
74
75 INT
76 STDCALL
77 IntGdiExtEscape(
78 PDC dc,
79 INT Escape,
80 INT InSize,
81 LPCSTR InData,
82 INT OutSize,
83 LPSTR OutData)
84 {
85 BITMAPOBJ *BitmapObj = BITMAPOBJ_LockBitmap(dc->w.hBitmap);
86 INT Result;
87
88 if ( NULL == dc->DriverFunctions.Escape )
89 {
90 Result = IntEngExtEscape(
91 &BitmapObj->SurfObj,
92 Escape,
93 InSize,
94 (PVOID)InData,
95 OutSize,
96 (PVOID)OutData);
97 }
98 else
99 {
100 Result = dc->DriverFunctions.Escape(
101 &BitmapObj->SurfObj,
102 Escape,
103 InSize,
104 (PVOID)InData,
105 OutSize,
106 (PVOID)OutData );
107 }
108 BITMAPOBJ_UnlockBitmap(dc->w.hBitmap);
109
110 return Result;
111 }
112
113 INT
114 STDCALL
115 NtGdiExtEscape(
116 HDC hDC,
117 INT Escape,
118 INT InSize,
119 LPCSTR UnsafeInData,
120 INT OutSize,
121 LPSTR UnsafeOutData)
122 {
123 PDC pDC = DC_LockDc(hDC);
124 LPVOID SafeInData = NULL;
125 LPVOID SafeOutData = NULL;
126 NTSTATUS Status;
127 INT Result;
128
129 if ( pDC == NULL )
130 {
131 SetLastWin32Error(ERROR_INVALID_HANDLE);
132 return -1;
133 }
134
135 if ( InSize && UnsafeInData )
136 {
137 SafeInData = ExAllocatePoolWithTag ( PagedPool, InSize, TAG_PRINT );
138 if ( !SafeInData )
139 {
140 DC_UnlockDc(hDC);
141 SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
142 return -1;
143 }
144 Status = MmCopyFromCaller ( SafeInData, UnsafeInData, InSize );
145 if ( !NT_SUCCESS(Status) )
146 {
147 ExFreePool ( SafeInData );
148 DC_UnlockDc(hDC);
149 SetLastNtError(Status);
150 return -1;
151 }
152 }
153
154 if ( OutSize && UnsafeOutData )
155 {
156 SafeOutData = ExAllocatePoolWithTag ( PagedPool, OutSize, TAG_PRINT );
157 if ( !SafeOutData )
158 {
159 if ( SafeInData )
160 ExFreePool ( SafeInData );
161 DC_UnlockDc(hDC);
162 SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
163 return -1;
164 }
165 }
166
167 Result = IntGdiExtEscape ( pDC, Escape, InSize, SafeInData, OutSize, SafeOutData );
168
169 DC_UnlockDc(hDC);
170
171 if ( SafeInData )
172 ExFreePool ( SafeInData );
173
174 if ( SafeOutData )
175 {
176 Status = MmCopyToCaller ( UnsafeOutData, SafeOutData, OutSize );
177 ExFreePool ( SafeOutData );
178 if ( !NT_SUCCESS(Status) )
179 {
180 SetLastNtError(Status);
181 return -1;
182 }
183 }
184
185 return Result;
186 }
187
188 INT
189 STDCALL
190 NtGdiSetAbortProc(HDC hDC,
191 ABORTPROC AbortProc)
192 {
193 UNIMPLEMENTED;
194 return 0;
195 }
196
197 INT
198 STDCALL
199 NtGdiStartDoc(HDC hDC,
200 CONST LPDOCINFOW di)
201 {
202 UNIMPLEMENTED;
203 return 0;
204 }
205
206 INT
207 STDCALL
208 NtGdiStartPage(HDC hDC)
209 {
210 UNIMPLEMENTED;
211 return 0;
212 }
213 /* EOF */