2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
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.
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.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 NtGdiAbortDoc(HDC hDC
)
58 if (Escape
== QUERYESCSUPPORT
)
79 SetLastWin32Error(ERROR_INVALID_HANDLE
);
83 /* TODO FIXME - don't pass umode buffer to an Int function */
84 ret
= IntGdiEscape(dc
, Escape
, InSize
, InData
, OutData
);
100 if (Escape
== QUERYESCSUPPORT
)
103 DPRINT1("IntEngExtEscape is unimplemented. - Keep going and have a nice day\n");
117 SURFACE
*psurf
= dc
->dclevel
.pSurface
;
120 /* FIXME - Handle psurf == NULL !!!!!! */
122 if ( NULL
== dc
->ppdev
->DriverFunctions
.Escape
)
124 Result
= IntEngExtEscape(
128 (PVOID
)((ULONG_PTR
)InData
),
134 Result
= dc
->ppdev
->DriverFunctions
.Escape(
150 IN OPTIONAL PWCHAR pDriver
,
154 OPTIONAL LPSTR UnsafeInData
,
156 OPTIONAL LPSTR UnsafeOutData
)
159 LPVOID SafeInData
= NULL
;
160 LPVOID SafeOutData
= NULL
;
161 NTSTATUS Status
= STATUS_SUCCESS
;
166 hDC
= UserGetWindowDC(NULL
);
169 pDC
= DC_LockDc(hDC
);
172 SetLastWin32Error(ERROR_INVALID_HANDLE
);
175 if ( pDC
->dctype
== DC_TYPE_INFO
)
181 if ( InSize
&& UnsafeInData
)
185 ProbeForRead(UnsafeInData
,
189 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
191 Status
= _SEH2_GetExceptionCode();
195 if (!NT_SUCCESS(Status
))
198 SetLastNtError(Status
);
202 SafeInData
= ExAllocatePoolWithTag ( PagedPool
, InSize
, TAG_PRINT
);
206 SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY
);
212 /* pointers were already probed! */
213 RtlCopyMemory(SafeInData
,
217 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
219 Status
= _SEH2_GetExceptionCode();
223 if ( !NT_SUCCESS(Status
) )
225 ExFreePoolWithTag ( SafeInData
, TAG_PRINT
);
227 SetLastNtError(Status
);
232 if ( OutSize
&& UnsafeOutData
)
236 ProbeForWrite(UnsafeOutData
,
240 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
242 Status
= _SEH2_GetExceptionCode();
246 if (!NT_SUCCESS(Status
))
248 SetLastNtError(Status
);
252 SafeOutData
= ExAllocatePoolWithTag ( PagedPool
, OutSize
, TAG_PRINT
);
255 SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY
);
258 ExFreePoolWithTag ( SafeInData
, TAG_PRINT
);
264 Result
= IntGdiExtEscape ( pDC
, Escape
, InSize
, SafeInData
, OutSize
, SafeOutData
);
269 ExFreePoolWithTag ( SafeInData
,TAG_PRINT
);
275 /* pointers were already probed! */
276 RtlCopyMemory(UnsafeOutData
,
280 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
282 Status
= _SEH2_GetExceptionCode();
286 ExFreePoolWithTag ( SafeOutData
, TAG_PRINT
);
287 if ( !NT_SUCCESS(Status
) )
289 SetLastNtError(Status
);
311 NtGdiStartPage(HDC hDC
)