ReactOS  0.4.15-dev-509-g96a357b
printers.c File Reference
#include "precomp.h"
#include <marshalling/printers.h>
Include dependency graph for printers.c:

Go to the source code of this file.

Functions

DWORD _RpcAbortPrinter (WINSPOOL_PRINTER_HANDLE hPrinter)
 
DWORD _RpcAddPrinter (WINSPOOL_HANDLE pName, WINSPOOL_PRINTER_CONTAINER *pPrinterContainer, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer, WINSPOOL_SECURITY_CONTAINER *pSecurityContainer, WINSPOOL_PRINTER_HANDLE *pHandle)
 
DWORD _RpcAddPrinterEx (WINSPOOL_HANDLE pName, WINSPOOL_PRINTER_CONTAINER *pPrinterContainer, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer, WINSPOOL_SECURITY_CONTAINER *pSecurityContainer, WINSPOOL_SPLCLIENT_CONTAINER *pClientInfo, WINSPOOL_PRINTER_HANDLE *pHandle)
 
DWORD _RpcClosePrinter (WINSPOOL_PRINTER_HANDLE *phPrinter)
 
DWORD _RpcDeletePrinter (WINSPOOL_PRINTER_HANDLE hPrinter)
 
DWORD _RpcEndDocPrinter (WINSPOOL_PRINTER_HANDLE hPrinter)
 
DWORD _RpcEndPagePrinter (WINSPOOL_PRINTER_HANDLE hPrinter)
 
DWORD _RpcEnumPrinters (DWORD Flags, WINSPOOL_HANDLE Name, DWORD Level, BYTE *pPrinterEnum, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned)
 
DWORD _RpcFlushPrinter (WINSPOOL_PRINTER_HANDLE hPrinter, BYTE *pBuf, DWORD cbBuf, DWORD *pcWritten, DWORD cSleep)
 
DWORD _RpcGetPrinter (WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Level, BYTE *pPrinter, DWORD cbBuf, DWORD *pcbNeeded)
 
DWORD _RpcOpenPrinter (WINSPOOL_HANDLE pPrinterName, WINSPOOL_PRINTER_HANDLE *phPrinter, WCHAR *pDatatype, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer, DWORD AccessRequired)
 
DWORD _RpcOpenPrinterEx (WINSPOOL_HANDLE pPrinterName, WINSPOOL_PRINTER_HANDLE *pHandle, WCHAR *pDatatype, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer, DWORD AccessRequired, WINSPOOL_SPLCLIENT_CONTAINER *pClientInfo)
 
DWORD _RpcReadPrinter (WINSPOOL_PRINTER_HANDLE hPrinter, BYTE *pBuf, DWORD cbBuf, DWORD *pcNoBytesRead)
 
DWORD _RpcResetPrinter (WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pDatatype, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer)
 
DWORD _RpcResetPrinterEx (VOID)
 
DWORD _RpcSeekPrinter (VOID)
 
DWORD _RpcSetPrinter (WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_PRINTER_CONTAINER *pPrinterContainer, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer, WINSPOOL_SECURITY_CONTAINER *pSecurityContainer, DWORD Command)
 
DWORD _RpcStartDocPrinter (WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_DOC_INFO_CONTAINER *pDocInfoContainer, DWORD *pJobId)
 
DWORD _RpcStartPagePrinter (WINSPOOL_PRINTER_HANDLE hPrinter)
 
DWORD _RpcWritePrinter (WINSPOOL_PRINTER_HANDLE hPrinter, BYTE *pBuf, DWORD cbBuf, DWORD *pcWritten)
 

Function Documentation

◆ _RpcAbortPrinter()

DWORD _RpcAbortPrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter)

Definition at line 12 of file printers.c.

13 {
16 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by AbortPrinter(), and pointer_default().

◆ _RpcAddPrinter()

DWORD _RpcAddPrinter ( WINSPOOL_HANDLE  pName,
WINSPOOL_PRINTER_CONTAINER pPrinterContainer,
WINSPOOL_DEVMODE_CONTAINER pDevModeContainer,
WINSPOOL_SECURITY_CONTAINER pSecurityContainer,
WINSPOOL_PRINTER_HANDLE pHandle 
)

Definition at line 19 of file printers.c.

20 {
23 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by AddPrinterW(), and pointer_default().

◆ _RpcAddPrinterEx()

DWORD _RpcAddPrinterEx ( WINSPOOL_HANDLE  pName,
WINSPOOL_PRINTER_CONTAINER pPrinterContainer,
WINSPOOL_DEVMODE_CONTAINER pDevModeContainer,
WINSPOOL_SECURITY_CONTAINER pSecurityContainer,
WINSPOOL_SPLCLIENT_CONTAINER pClientInfo,
WINSPOOL_PRINTER_HANDLE pHandle 
)

Definition at line 26 of file printers.c.

27 {
30 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by pointer_default().

◆ _RpcClosePrinter()

DWORD _RpcClosePrinter ( WINSPOOL_PRINTER_HANDLE phPrinter)

Definition at line 33 of file printers.c.

34 {
35  DWORD dwErrorCode;
36 
37  dwErrorCode = RpcImpersonateClient(NULL);
38  if (dwErrorCode != ERROR_SUCCESS)
39  {
40  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
41  return dwErrorCode;
42  }
43 
44  if (ClosePrinter(*phPrinter))
45  *phPrinter = NULL;
46  else
47  dwErrorCode = GetLastError();
48 
50  return dwErrorCode;
51 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
BOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:12
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERR(fmt,...)
Definition: debug.h:110
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052

Referenced by AddPrinterW(), ClosePrinter(), and pointer_default().

◆ _RpcDeletePrinter()

DWORD _RpcDeletePrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter)

Definition at line 54 of file printers.c.

55 {
58 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by AddPrinterW(), DeletePrinter(), and pointer_default().

◆ _RpcEndDocPrinter()

DWORD _RpcEndDocPrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter)

Definition at line 61 of file printers.c.

62 {
63  DWORD dwErrorCode;
64 
65  dwErrorCode = RpcImpersonateClient(NULL);
66  if (dwErrorCode != ERROR_SUCCESS)
67  {
68  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
69  return dwErrorCode;
70  }
71 
72  if (!EndDocPrinter(hPrinter))
73  dwErrorCode = GetLastError();
74 
76  return dwErrorCode;
77 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERR(fmt,...)
Definition: debug.h:110
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052
BOOL WINAPI EndDocPrinter(HANDLE hPrinter)
Definition: printers.c:36

Referenced by EndDocPrinter(), and pointer_default().

◆ _RpcEndPagePrinter()

DWORD _RpcEndPagePrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter)

Definition at line 80 of file printers.c.

81 {
82  DWORD dwErrorCode;
83 
84  dwErrorCode = RpcImpersonateClient(NULL);
85  if (dwErrorCode != ERROR_SUCCESS)
86  {
87  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
88  return dwErrorCode;
89  }
90 
91  if (!EndPagePrinter(hPrinter))
92  dwErrorCode = GetLastError();
93 
95  return dwErrorCode;
96 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI EndPagePrinter(HANDLE hPrinter)
Definition: printers.c:51
#define ERR(fmt,...)
Definition: debug.h:110
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052

Referenced by EndPagePrinter(), and pointer_default().

◆ _RpcEnumPrinters()

DWORD _RpcEnumPrinters ( DWORD  Flags,
WINSPOOL_HANDLE  Name,
DWORD  Level,
BYTE pPrinterEnum,
DWORD  cbBuf,
DWORD pcbNeeded,
DWORD pcReturned 
)

Definition at line 99 of file printers.c.

100 {
101  DWORD dwErrorCode;
102  PBYTE pPrinterEnumAligned;
103 
104  dwErrorCode = RpcImpersonateClient(NULL);
105  if (dwErrorCode != ERROR_SUCCESS)
106  {
107  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
108  return dwErrorCode;
109  }
110 
111  pPrinterEnumAligned = AlignRpcPtr(pPrinterEnum, &cbBuf);
112 
113  if (EnumPrintersW(Flags, Name, Level, pPrinterEnumAligned, cbBuf, pcbNeeded, pcReturned))
114  {
115  // Replace absolute pointer addresses in the output by relative offsets.
116  ASSERT(Level <= 9);
117  MarshallDownStructuresArray(pPrinterEnumAligned, *pcReturned, pPrinterInfoMarshalling[Level]->pInfo, pPrinterInfoMarshalling[Level]->cbStructureSize, TRUE);
118  }
119  else
120  {
121  dwErrorCode = GetLastError();
122  }
123 
124  RpcRevertToSelf();
125  UndoAlignRpcPtr(pPrinterEnum, pPrinterEnumAligned, cbBuf, pcbNeeded);
126 
127  return dwErrorCode;
128 }
BOOL WINAPI EnumPrintersW(DWORD Flags, PWSTR Name, DWORD Level, PBYTE pPrinterEnum, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
Definition: printers.c:66
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
unsigned long DWORD
Definition: ntddk_ex.h:95
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ERR(fmt,...)
Definition: debug.h:110
PVOID WINAPI AlignRpcPtr(PVOID pBuffer, PDWORD pcbBuffer)
Definition: memory.c:29
static const MARSHALLING * pPrinterInfoMarshalling[]
Definition: printers.h:146
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
PDWORD WINAPI UndoAlignRpcPtr(PVOID pDestinationBuffer, PVOID pSourceBuffer, DWORD cbBuffer, PDWORD pcbNeeded)
Definition: memory.c:239
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052
BYTE * PBYTE
Definition: pedump.c:66
BOOL WINAPI MarshallDownStructuresArray(PVOID pStructuresArray, DWORD cElements, const MARSHALLING_INFO *pInfo, DWORD cbStructureSize, BOOL bSomeBoolean)
Definition: marshalling.c:91

Referenced by EnumPrintersW(), and pointer_default().

◆ _RpcFlushPrinter()

DWORD _RpcFlushPrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter,
BYTE pBuf,
DWORD  cbBuf,
DWORD pcWritten,
DWORD  cSleep 
)

Definition at line 131 of file printers.c.

132 {
134  return ERROR_INVALID_FUNCTION;
135 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by pointer_default().

◆ _RpcGetPrinter()

DWORD _RpcGetPrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter,
DWORD  Level,
BYTE pPrinter,
DWORD  cbBuf,
DWORD pcbNeeded 
)

Definition at line 138 of file printers.c.

139 {
140  DWORD dwErrorCode;
141  PBYTE pPrinterAligned;
142 
143  dwErrorCode = RpcImpersonateClient(NULL);
144  if (dwErrorCode != ERROR_SUCCESS)
145  {
146  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
147  return dwErrorCode;
148  }
149 
150  pPrinterAligned = AlignRpcPtr(pPrinter, &cbBuf);
151 
152  if (GetPrinterW(hPrinter, Level, pPrinterAligned, cbBuf, pcbNeeded))
153  {
154  // Replace absolute pointer addresses in the output by relative offsets.
155  ASSERT(Level <= 9);
156  MarshallDownStructure(pPrinterAligned, pPrinterInfoMarshalling[Level]->pInfo, pPrinterInfoMarshalling[Level]->cbStructureSize, TRUE);
157  }
158  else
159  {
160  dwErrorCode = GetLastError();
161  }
162 
163  RpcRevertToSelf();
164  UndoAlignRpcPtr(pPrinter, pPrinterAligned, cbBuf, pcbNeeded);
165 
166  return dwErrorCode;
167 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
BOOL WINAPI GetPrinterW(HANDLE hPrinter, DWORD Level, PBYTE pPrinter, DWORD cbBuf, PDWORD pcbNeeded)
Definition: printers.c:140
unsigned long DWORD
Definition: ntddk_ex.h:95
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
BOOL WINAPI MarshallDownStructure(PVOID pStructure, const MARSHALLING_INFO *pInfo, DWORD cbStructureSize, BOOL bSomeBoolean)
Definition: marshalling.c:38
#define ERR(fmt,...)
Definition: debug.h:110
PVOID WINAPI AlignRpcPtr(PVOID pBuffer, PDWORD pcbBuffer)
Definition: memory.c:29
static const MARSHALLING * pPrinterInfoMarshalling[]
Definition: printers.h:146
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
PDWORD WINAPI UndoAlignRpcPtr(PVOID pDestinationBuffer, PVOID pSourceBuffer, DWORD cbBuffer, PDWORD pcbNeeded)
Definition: memory.c:239
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052
BYTE * PBYTE
Definition: pedump.c:66

Referenced by GetPrinterW(), and pointer_default().

◆ _RpcOpenPrinter()

DWORD _RpcOpenPrinter ( WINSPOOL_HANDLE  pPrinterName,
WINSPOOL_PRINTER_HANDLE phPrinter,
WCHAR pDatatype,
WINSPOOL_DEVMODE_CONTAINER pDevModeContainer,
DWORD  AccessRequired 
)

Definition at line 170 of file printers.c.

171 {
172  DWORD dwErrorCode;
174 
175  dwErrorCode = RpcImpersonateClient(NULL);
176  if (dwErrorCode != ERROR_SUCCESS)
177  {
178  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
179  return dwErrorCode;
180  }
181 
182  Default.DesiredAccess = AccessRequired;
183  Default.pDatatype = pDatatype;
184  Default.pDevMode = (PDEVMODEW)pDevModeContainer->pDevMode;
185 
186  if (!OpenPrinterW(pPrinterName, phPrinter, &Default))
187  dwErrorCode = GetLastError();
188 
189  RpcRevertToSelf();
190  return dwErrorCode;
191 }
struct _devicemodeW * PDEVMODEW
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
if(!(yy_init))
Definition: macro.lex.yy.c:714
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERR(fmt,...)
Definition: debug.h:110
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052
BOOL WINAPI OpenPrinterW(PWSTR pPrinterName, PHANDLE phPrinter, PPRINTER_DEFAULTSW pDefault)
Definition: printers.c:155

Referenced by OpenPrinterW(), and pointer_default().

◆ _RpcOpenPrinterEx()

DWORD _RpcOpenPrinterEx ( WINSPOOL_HANDLE  pPrinterName,
WINSPOOL_PRINTER_HANDLE pHandle,
WCHAR pDatatype,
WINSPOOL_DEVMODE_CONTAINER pDevModeContainer,
DWORD  AccessRequired,
WINSPOOL_SPLCLIENT_CONTAINER pClientInfo 
)

Definition at line 194 of file printers.c.

195 {
197  return ERROR_INVALID_FUNCTION;
198 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by pointer_default().

◆ _RpcReadPrinter()

DWORD _RpcReadPrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter,
BYTE pBuf,
DWORD  cbBuf,
DWORD pcNoBytesRead 
)

Definition at line 201 of file printers.c.

202 {
203  DWORD dwErrorCode;
204 
205  dwErrorCode = RpcImpersonateClient(NULL);
206  if (dwErrorCode != ERROR_SUCCESS)
207  {
208  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
209  return dwErrorCode;
210  }
211 
212  if (!ReadPrinter(hPrinter, pBuf, cbBuf, pcNoBytesRead))
213  dwErrorCode = GetLastError();
214 
215  RpcRevertToSelf();
216  return dwErrorCode;
217 }
BOOL WINAPI ReadPrinter(HANDLE hPrinter, PVOID pBuf, DWORD cbBuf, PDWORD pNoBytesRead)
Definition: printers.c:207
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERR(fmt,...)
Definition: debug.h:110
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052

Referenced by pointer_default(), and ReadPrinter().

◆ _RpcResetPrinter()

DWORD _RpcResetPrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter,
WCHAR pDatatype,
WINSPOOL_DEVMODE_CONTAINER pDevModeContainer 
)

Definition at line 220 of file printers.c.

221 {
223  return ERROR_INVALID_FUNCTION;
224 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by pointer_default().

◆ _RpcResetPrinterEx()

DWORD _RpcResetPrinterEx ( VOID  )

Definition at line 227 of file printers.c.

228 {
230  return ERROR_INVALID_FUNCTION;
231 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by pointer_default().

◆ _RpcSeekPrinter()

DWORD _RpcSeekPrinter ( VOID  )

Definition at line 234 of file printers.c.

235 {
237  return ERROR_INVALID_FUNCTION;
238 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by pointer_default().

◆ _RpcSetPrinter()

DWORD _RpcSetPrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter,
WINSPOOL_PRINTER_CONTAINER pPrinterContainer,
WINSPOOL_DEVMODE_CONTAINER pDevModeContainer,
WINSPOOL_SECURITY_CONTAINER pSecurityContainer,
DWORD  Command 
)

Definition at line 241 of file printers.c.

242 {
244  return ERROR_INVALID_FUNCTION;
245 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by pointer_default(), and SetPrinterW().

◆ _RpcStartDocPrinter()

DWORD _RpcStartDocPrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter,
WINSPOOL_DOC_INFO_CONTAINER pDocInfoContainer,
DWORD pJobId 
)

Definition at line 248 of file printers.c.

249 {
250  DWORD dwErrorCode;
251 
252  dwErrorCode = RpcImpersonateClient(NULL);
253  if (dwErrorCode != ERROR_SUCCESS)
254  {
255  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
256  return dwErrorCode;
257  }
258 
259  *pJobId = StartDocPrinterW(hPrinter, pDocInfoContainer->Level, (PBYTE)pDocInfoContainer->DocInfo.pDocInfo1);
260  dwErrorCode = GetLastError();
261 
262  RpcRevertToSelf();
263  return dwErrorCode;
264 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD WINAPI StartDocPrinterW(HANDLE hPrinter, DWORD Level, PBYTE pDocInfo)
Definition: printers.c:222
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
union _WINSPOOL_DOC_INFO_CONTAINER::@3358 DocInfo
unsigned long DWORD
Definition: ntddk_ex.h:95
WINSPOOL_DOC_INFO_1 * pDocInfo1
Definition: winspool.idl:577
#define ERR(fmt,...)
Definition: debug.h:110
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052
BYTE * PBYTE
Definition: pedump.c:66

Referenced by _StartDocPrinterWithRPC(), and pointer_default().

◆ _RpcStartPagePrinter()

DWORD _RpcStartPagePrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter)

Definition at line 267 of file printers.c.

268 {
269  DWORD dwErrorCode;
270 
271  dwErrorCode = RpcImpersonateClient(NULL);
272  if (dwErrorCode != ERROR_SUCCESS)
273  {
274  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
275  return dwErrorCode;
276  }
277 
278  if (!StartPagePrinter(hPrinter))
279  dwErrorCode = GetLastError();
280 
281  RpcRevertToSelf();
282  return dwErrorCode;
283 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERR(fmt,...)
Definition: debug.h:110
BOOL WINAPI StartPagePrinter(HANDLE hPrinter)
Definition: printers.c:237
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052

Referenced by pointer_default(), and StartPagePrinter().

◆ _RpcWritePrinter()

DWORD _RpcWritePrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter,
BYTE pBuf,
DWORD  cbBuf,
DWORD pcWritten 
)

Definition at line 286 of file printers.c.

287 {
288  DWORD dwErrorCode;
289 
290  dwErrorCode = RpcImpersonateClient(NULL);
291  if (dwErrorCode != ERROR_SUCCESS)
292  {
293  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
294  return dwErrorCode;
295  }
296 
297  if (!WritePrinter(hPrinter, pBuf, cbBuf, pcWritten))
298  dwErrorCode = GetLastError();
299 
300  RpcRevertToSelf();
301  return dwErrorCode;
302 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
BOOL WINAPI WritePrinter(HANDLE hPrinter, PVOID pBuf, DWORD cbBuf, PDWORD pcWritten)
Definition: printers.c:252
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERR(fmt,...)
Definition: debug.h:110
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052

Referenced by pointer_default(), and WritePrinter().