2 * PROJECT: ReactOS win32 kernel mode subsystem
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: win32ss/gdi/ntgdi/print.c
5 * PURPOSE: Print functions
16 NtGdiAbortDoc(HDC hDC
)
46 if (Escape
== QUERYESCSUPPORT
)
67 EngSetLastError(ERROR_INVALID_HANDLE
);
71 /* TODO: FIXME: Don't pass umode buffer to an Int function */
72 ret
= IntGdiEscape(dc
, Escape
, InSize
, InData
, OutData
);
82 IN OPTIONAL PWCHAR pDriver
,
86 OPTIONAL LPSTR UnsafeInData
,
88 OPTIONAL LPSTR UnsafeOutData
)
90 LPVOID SafeInData
= NULL
;
91 LPVOID SafeOutData
= NULL
;
92 NTSTATUS Status
= STATUS_SUCCESS
;
101 /* FIXME : Get the pdev from its name */
106 ppdev
= EngpGetPDEV(NULL
);
109 EngSetLastError(ERROR_BAD_DEVICE
);
113 /* We're using the primary surface of the pdev. Lock it */
114 EngAcquireSemaphore(ppdev
->hsemDevLock
);
116 psurf
= ppdev
->pSurface
;
119 EngReleaseSemaphore(ppdev
->hsemDevLock
);
120 PDEVOBJ_vRelease(ppdev
);
123 SURFACE_ShareLockByPointer(psurf
);
127 PDC pDC
= DC_LockDc(hDC
);
130 EngSetLastError(ERROR_INVALID_HANDLE
);
134 /* Get the PDEV from the DC */
136 PDEVOBJ_vReference(ppdev
);
138 /* Check if we have a surface */
139 psurf
= pDC
->dclevel
.pSurface
;
143 PDEVOBJ_vRelease(ppdev
);
146 SURFACE_ShareLockByPointer(psurf
);
148 /* We're done with the DC */
152 /* See if we actually have a driver function to call */
153 if (ppdev
->DriverFunctions
.Escape
== NULL
)
159 if ( InSize
&& UnsafeInData
)
163 ProbeForRead(UnsafeInData
,
167 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
169 Status
= _SEH2_GetExceptionCode();
173 if (!NT_SUCCESS(Status
))
179 SafeInData
= ExAllocatePoolWithTag ( PagedPool
, InSize
, GDITAG_TEMP
);
182 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
189 /* Pointers were already probed! */
190 RtlCopyMemory(SafeInData
,
194 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
196 Status
= _SEH2_GetExceptionCode();
200 if ( !NT_SUCCESS(Status
) )
202 SetLastNtError(Status
);
208 if ( OutSize
&& UnsafeOutData
)
212 ProbeForWrite(UnsafeOutData
,
216 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
218 Status
= _SEH2_GetExceptionCode();
222 if (!NT_SUCCESS(Status
))
224 SetLastNtError(Status
);
229 SafeOutData
= ExAllocatePoolWithTag ( PagedPool
, OutSize
, GDITAG_TEMP
);
232 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
238 /* Finally call the driver */
239 Result
= ppdev
->DriverFunctions
.Escape(
250 EngReleaseSemaphore(ppdev
->hsemDevLock
);
252 SURFACE_ShareUnlockSurface(psurf
);
253 PDEVOBJ_vRelease(ppdev
);
257 ExFreePoolWithTag ( SafeInData
,GDITAG_TEMP
);
266 /* Pointers were already probed! */
267 RtlCopyMemory(UnsafeOutData
, SafeOutData
, OutSize
);
269 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
271 Status
= _SEH2_GetExceptionCode();
275 if ( !NT_SUCCESS(Status
) )
277 SetLastNtError(Status
);
282 ExFreePoolWithTag ( SafeOutData
, GDITAG_TEMP
);
302 NtGdiStartPage(HDC hDC
)