ReactOS 0.4.15-dev-5666-gc548b97
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: debug.h:115
#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
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
static const WCHAR dc[]
Definition: polytest.cpp:41
int32_t INT
Definition: typedefs.h:58
int ret
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:28

◆ 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 if (hDC == NULL)
98 {
99 if (pDriver)
100 {
101 /* FIXME : Get the pdev from its name */
103 return -1;
104 }
105
106 ppdev = EngpGetPDEV(NULL);
107 if (!ppdev)
108 {
110 return -1;
111 }
112
113 /* We're using the primary surface of the pdev. Lock it */
115
116 psurf = ppdev->pSurface;
117 if (!psurf)
118 {
120 PDEVOBJ_vRelease(ppdev);
121 return 0;
122 }
124 }
125 else
126 {
127 PDC pDC = DC_LockDc(hDC);
128 if ( pDC == NULL )
129 {
131 return -1;
132 }
133
134 /* Get the PDEV from the DC */
135 ppdev = pDC->ppdev;
136 PDEVOBJ_vReference(ppdev);
137
138 /* Check if we have a surface */
139 psurf = pDC->dclevel.pSurface;
140 if (!psurf)
141 {
142 DC_UnlockDc(pDC);
143 PDEVOBJ_vRelease(ppdev);
144 return 0;
145 }
147
148 /* We're done with the DC */
149 DC_UnlockDc(pDC);
150 }
151
152 /* See if we actually have a driver function to call */
153 if (ppdev->DriverFunctions.Escape == NULL)
154 {
155 Result = 0;
156 goto Exit;
157 }
158
159 if ( InSize && UnsafeInData )
160 {
162 {
163 ProbeForRead(UnsafeInData,
164 InSize,
165 1);
166 }
168 {
170 }
171 _SEH2_END;
172
173 if (!NT_SUCCESS(Status))
174 {
175 Result = -1;
176 goto Exit;
177 }
178
179 SafeInData = ExAllocatePoolWithTag ( PagedPool, InSize, GDITAG_TEMP );
180 if ( !SafeInData )
181 {
183 Result = -1;
184 goto Exit;
185 }
186
188 {
189 /* Pointers were already probed! */
190 RtlCopyMemory(SafeInData,
191 UnsafeInData,
192 InSize);
193 }
195 {
197 }
198 _SEH2_END;
199
200 if ( !NT_SUCCESS(Status) )
201 {
203 Result = -1;
204 goto Exit;
205 }
206 }
207
208 if ( OutSize && UnsafeOutData )
209 {
211 {
212 ProbeForWrite(UnsafeOutData,
213 OutSize,
214 1);
215 }
217 {
219 }
220 _SEH2_END;
221
222 if (!NT_SUCCESS(Status))
223 {
225 Result = -1;
226 goto Exit;
227 }
228
229 SafeOutData = ExAllocatePoolWithTag ( PagedPool, OutSize, GDITAG_TEMP );
230 if ( !SafeOutData )
231 {
233 Result = -1;
234 goto Exit;
235 }
236 }
237
238 /* Finally call the driver */
240 &psurf->SurfObj,
241 Escape,
242 InSize,
243 SafeInData,
244 OutSize,
245 SafeOutData );
246
247Exit:
248 if (hDC == NULL)
249 {
251 }
253 PDEVOBJ_vRelease(ppdev);
254
255 if ( SafeInData )
256 {
257 ExFreePoolWithTag ( SafeInData ,GDITAG_TEMP );
258 }
259
260 if ( SafeOutData )
261 {
262 if (Result > 0)
263 {
265 {
266 /* Pointers were already probed! */
267 RtlCopyMemory(UnsafeOutData, SafeOutData, OutSize);
268 }
270 {
272 }
273 _SEH2_END;
274
275 if ( !NT_SUCCESS(Status) )
276 {
278 Result = -1;
279 }
280 }
281
282 ExFreePoolWithTag ( SafeOutData, GDITAG_TEMP );
283 }
284
285 return Result;
286}
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#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
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
FxDriver * pDriver
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
Status
Definition: gdiplustypes.h:25
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
PPDEVOBJ NTAPI EngpGetPDEV(_In_opt_ PUNICODE_STRING pustrDeviceName)
Definition: pdevobj.c:726
VOID NTAPI PDEVOBJ_vRelease(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:104
FORCEINLINE VOID PDEVOBJ_vReference(_In_ PPDEVOBJ ppdev)
Definition: pdevobj.h:161
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#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(NTSTATUS Status)
Definition: error.c:37
#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:703
_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:426

◆ NtGdiStartDoc()

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

Definition at line 290 of file print.c.

295{
297 return 0;
298}

◆ NtGdiStartPage()

INT APIENTRY NtGdiStartPage ( HDC  hDC)

Definition at line 302 of file print.c.

303{
305 return 0;
306}