ReactOS 0.4.16-dev-2279-gc890759
print.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for print.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

INT APIENTRY NtGdiAbortDoc (HDC hDC)
 
INT APIENTRY NtGdiEndDoc (HDC hDC)
 
INT APIENTRY NtGdiEndPage (HDC hDC)
 
INT FASTCALL IntGdiEscape (PDC dc, INT Escape, INT InSize, LPCSTR InData, LPVOID OutData)
 
INT APIENTRY NtGdiEscape (HDC hDC, INT Escape, INT InSize, LPCSTR InData, LPVOID OutData)
 
INT APIENTRY NtGdiExtEscape (HDC hDC, IN OPTIONAL PWCHAR pDriver, IN INT nDriver, INT Escape, INT InSize, OPTIONAL LPSTR UnsafeInData, INT OutSize, OPTIONAL LPSTR UnsafeOutData)
 
INT APIENTRY NtGdiStartDoc (IN HDC hdc, IN DOCINFOW *pdi, OUT BOOL *pbBanding, IN INT iJob)
 
INT APIENTRY NtGdiStartPage (HDC hDC)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file print.c.

Function Documentation

◆ IntGdiEscape()

INT FASTCALL IntGdiEscape ( PDC  dc,
INT  Escape,
INT  InSize,
LPCSTR  InData,
LPVOID  OutData 
)

Definition at line 40 of file print.c.

45{
47 return FALSE;
48
50 return SP_ERROR;
51}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define FALSE
Definition: types.h:117
STRING Escape(const STRING &str)
Definition: fontsub.cpp:1030
#define SP_ERROR
Definition: wingdi.h:318
#define QUERYESCSUPPORT
Definition: wingdi.h:1001

Referenced by NtGdiEscape().

◆ NtGdiAbortDoc()

INT APIENTRY NtGdiAbortDoc ( HDC  hDC)

Definition at line 16 of file print.c.

17{
19 return 0;
20}

◆ NtGdiEndDoc()

INT APIENTRY NtGdiEndDoc ( HDC  hDC)

Definition at line 24 of file print.c.

25{
27 return 0;
28}

◆ NtGdiEndPage()

INT APIENTRY NtGdiEndPage ( HDC  hDC)

Definition at line 32 of file print.c.

33{
35 return 0;
36}

◆ NtGdiEscape()

INT APIENTRY NtGdiEscape ( HDC  hDC,
INT  Escape,
INT  InSize,
LPCSTR  InData,
LPVOID  OutData 
)

Definition at line 55 of file print.c.

60{
61 PDC dc;
62 INT ret;
63
64 dc = DC_LockDc(hDC);
65 if (dc == NULL)
66 {
68 return SP_ERROR;
69 }
70
71 /* TODO: FIXME: Don't pass umode buffer to an Int function */
72 ret = IntGdiEscape(dc, Escape, InSize, InData, OutData);
73
74 DC_UnlockDc( dc );
75 return ret;
76}
static HDC hDC
Definition: 3dtext.c:33
HDC dc
Definition: cylfrac.c:34
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
#define NULL
Definition: types.h:112
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
return ret
Definition: mutex.c:146
Definition: polytest.cpp:41
int32_t INT
Definition: typedefs.h:58
INT FASTCALL IntGdiEscape(PDC dc, INT Escape, INT InSize, LPCSTR InData, LPVOID OutData)
Definition: print.c:40
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22

◆ NtGdiExtEscape()

INT APIENTRY NtGdiExtEscape ( HDC  hDC,
IN OPTIONAL PWCHAR  pDriver,
IN INT  nDriver,
INT  Escape,
INT  InSize,
OPTIONAL LPSTR  UnsafeInData,
INT  OutSize,
OPTIONAL LPSTR  UnsafeOutData 
)

Definition at line 80 of file print.c.

89{
90 LPVOID SafeInData = NULL;
91 LPVOID SafeOutData = NULL;
93 INT Result;
94 PPDEVOBJ ppdev;
95 PSURFACE psurf;
96
97 /* Validate input parameters */
98 if ((InSize < 0) || (OutSize < 0) || (UnsafeInData == NULL && InSize != 0))
99 {
101 return -1;
102 }
103
104 if (hDC == NULL)
105 {
106 if (pDriver)
107 {
108 /* FIXME : Get the pdev from its name */
110 return -1;
111 }
112
113 ppdev = EngpGetPDEV(NULL);
114 if (!ppdev)
115 {
117 return -1;
118 }
119
120 /* We're using the primary surface of the pdev. Lock it */
122
123 psurf = ppdev->pSurface;
124 if (!psurf)
125 {
127 PDEVOBJ_vRelease(ppdev);
128 return 0;
129 }
131 }
132 else
133 {
134 PDC pDC = DC_LockDc(hDC);
135 if (pDC == NULL)
136 {
138 return -1;
139 }
140
141 /* Get the PDEV from the DC */
142 ppdev = pDC->ppdev;
143 PDEVOBJ_vReference(ppdev);
144
146
147 /* Check if we have a surface */
148 psurf = pDC->dclevel.pSurface;
149 if (!psurf)
150 {
152 PDEVOBJ_vRelease(ppdev);
153 DC_UnlockDc(pDC);
154 return 0;
155 }
157
158 /* We're done with the DC */
159 DC_UnlockDc(pDC);
160 }
161
162 /* See if we actually have a driver function to call */
163 if (ppdev->DriverFunctions.Escape == NULL)
164 {
165 Result = 0;
166 goto Exit;
167 }
168
169 if (InSize)
170 {
171 SafeInData = ExAllocatePoolWithTag(PagedPool, InSize, GDITAG_TEMP);
172 if (SafeInData == NULL)
173 {
175 goto Exit;
176 }
178 {
179 ProbeForRead(UnsafeInData, InSize, 1);
180 RtlCopyMemory(SafeInData, UnsafeInData, InSize);
181 }
183 {
186 _SEH2_YIELD(goto Exit);
187 }
188 _SEH2_END;
189 }
190
191 if (OutSize)
192 {
193 if (UnsafeOutData != NULL)
194 {
196 {
197 ProbeForWrite(UnsafeOutData, OutSize, 1);
198 }
200 {
203 _SEH2_YIELD(goto Exit);
204 }
205 _SEH2_END;
206 }
207
208 SafeOutData = ExAllocatePoolZero(PagedPool, OutSize, GDITAG_TEMP);
209 if (SafeOutData == NULL)
210 {
212 goto Exit;
213 }
214 }
215
216 /* Finally call the driver */
218 &psurf->SurfObj,
219 Escape,
220 InSize,
221 SafeInData,
222 OutSize,
223 SafeOutData);
224
225 if (OutSize != 0 && UnsafeOutData != NULL && SafeOutData != NULL)
226 {
228 {
229 RtlCopyMemory(UnsafeOutData, SafeOutData, OutSize);
230 }
232 {
235 Result = -1;
236 }
237 _SEH2_END;
238 }
239
240Exit:
243 PDEVOBJ_vRelease(ppdev);
244
245 if (SafeInData != NULL)
246 {
247 ExFreePoolWithTag(SafeInData, GDITAG_TEMP);
248 }
249
250 if (SafeOutData != NULL)
251 {
252 ExFreePoolWithTag(SafeOutData, GDITAG_TEMP);
253 }
254
255 return Result;
256}
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
FxDriver * pDriver
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
Status
Definition: gdiplustypes.h:25
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
FORCEINLINE PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
Definition: precomp.h:45
PPDEVOBJ NTAPI EngpGetPDEV(_In_opt_ PUNICODE_STRING pustrDeviceName)
Definition: pdevobj.c:799
VOID NTAPI PDEVOBJ_vRelease(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:105
FORCEINLINE VOID PDEVOBJ_vReference(_In_ PPDEVOBJ ppdev)
Definition: pdevobj.h:160
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:181
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:184
#define STATUS_SUCCESS
Definition: shellext.h:65
static void Exit(void)
Definition: sock.c:1330
PFN_DrvEscape Escape
Definition: ntgdityp.h:593
PSURFACE pSurface
Definition: pdevobj.h:124
DRIVER_FUNCTIONS DriverFunctions
Definition: pdevobj.h:137
HSEMAPHORE hsemDevLock
Definition: pdevobj.h:89
SURFOBJ SurfObj
Definition: surface.h:8
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
#define SURFACE_ShareUnlockSurface(pBMObj)
Definition: surface.h:102
FORCEINLINE VOID SURFACE_ShareLockByPointer(PSURFACE psurf)
Definition: surface.h:95
#define GDITAG_TEMP
Definition: tags.h:167
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
#define ERROR_BAD_DEVICE
Definition: winerror.h:1032
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

◆ NtGdiStartDoc()

INT APIENTRY NtGdiStartDoc ( IN HDC  hdc,
IN DOCINFOW pdi,
OUT BOOL pbBanding,
IN INT  iJob 
)

Definition at line 260 of file print.c.

265{
267 return 0;
268}

◆ NtGdiStartPage()

INT APIENTRY NtGdiStartPage ( HDC  hDC)

Definition at line 272 of file print.c.

273{
275 return 0;
276}