ReactOS  0.4.15-dev-2091-gc14c9ca
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 (WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pDatatype, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer, DWORD dwFlags)
 
DWORD _RpcSeekPrinter (WINSPOOL_PRINTER_HANDLE hPrinter, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER pliNewPointer, DWORD dwMoveMethod, BOOL bWrite)
 
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 {
14  DWORD dwErrorCode;
15 
16  dwErrorCode = RpcImpersonateClient(NULL);
17  if (dwErrorCode != ERROR_SUCCESS)
18  {
19  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
20  return dwErrorCode;
21  }
22 
23  if (!AbortPrinter(hPrinter))
24  dwErrorCode = GetLastError();
25 
27  return dwErrorCode;
28 }
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI AbortPrinter(HANDLE hPrinter)
Definition: printers.c:11
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
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
#define NULL
Definition: types.h:112

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 31 of file printers.c.

32 {
35 }
#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 38 of file printers.c.

39 {
42 }
#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 45 of file printers.c.

46 {
47  DWORD dwErrorCode;
48 
49  dwErrorCode = RpcImpersonateClient(NULL);
50  if (dwErrorCode != ERROR_SUCCESS)
51  {
52  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
53  return dwErrorCode;
54  }
55 
56  if (ClosePrinter(*phPrinter))
57  *phPrinter = NULL;
58  else
59  dwErrorCode = GetLastError();
60 
62  return dwErrorCode;
63 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
BOOL WINAPI ClosePrinter(HANDLE hPrinter)
Definition: printers.c:176
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
#define NULL
Definition: types.h:112

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

◆ _RpcDeletePrinter()

DWORD _RpcDeletePrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter)

Definition at line 66 of file printers.c.

67 {
68  DWORD dwErrorCode;
69 
70  dwErrorCode = RpcImpersonateClient(NULL);
71  if (dwErrorCode != ERROR_SUCCESS)
72  {
73  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
74  return dwErrorCode;
75  }
76 
77  if (!DeletePrinter(hPrinter))
78  dwErrorCode = GetLastError();
79 
81  return dwErrorCode;
82 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
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 DeletePrinter(HANDLE hPrinter)
Definition: printers.c:202
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052
#define NULL
Definition: types.h:112

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

◆ _RpcEndDocPrinter()

DWORD _RpcEndDocPrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter)

Definition at line 85 of file printers.c.

86 {
87  DWORD dwErrorCode;
88 
89  dwErrorCode = RpcImpersonateClient(NULL);
90  if (dwErrorCode != ERROR_SUCCESS)
91  {
92  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
93  return dwErrorCode;
94  }
95 
96  if (!EndDocPrinter(hPrinter))
97  dwErrorCode = GetLastError();
98 
100  return dwErrorCode;
101 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
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
#define NULL
Definition: types.h:112
BOOL WINAPI EndDocPrinter(HANDLE hPrinter)
Definition: printers.c:217

Referenced by EndDocPrinter(), and pointer_default().

◆ _RpcEndPagePrinter()

DWORD _RpcEndPagePrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter)

Definition at line 104 of file printers.c.

105 {
106  DWORD dwErrorCode;
107 
108  dwErrorCode = RpcImpersonateClient(NULL);
109  if (dwErrorCode != ERROR_SUCCESS)
110  {
111  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
112  return dwErrorCode;
113  }
114 
115  if (!EndPagePrinter(hPrinter))
116  dwErrorCode = GetLastError();
117 
118  RpcRevertToSelf();
119  return dwErrorCode;
120 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
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:232
#define ERR(fmt,...)
Definition: debug.h:110
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052
#define NULL
Definition: types.h:112

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 123 of file printers.c.

124 {
125  DWORD dwErrorCode;
126  PBYTE pPrinterEnumAligned;
127 
128  dwErrorCode = RpcImpersonateClient(NULL);
129  if (dwErrorCode != ERROR_SUCCESS)
130  {
131  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
132  return dwErrorCode;
133  }
134 
135  pPrinterEnumAligned = AlignRpcPtr(pPrinterEnum, &cbBuf);
136 
137  if (EnumPrintersW(Flags, Name, Level, pPrinterEnumAligned, cbBuf, pcbNeeded, pcReturned))
138  {
139  // Replace absolute pointer addresses in the output by relative offsets.
140  ASSERT(Level <= 9);
141  MarshallDownStructuresArray(pPrinterEnumAligned, *pcReturned, pPrinterInfoMarshalling[Level]->pInfo, pPrinterInfoMarshalling[Level]->cbStructureSize, TRUE);
142  }
143  else
144  {
145  dwErrorCode = GetLastError();
146  }
147 
148  RpcRevertToSelf();
149  UndoAlignRpcPtr(pPrinterEnum, pPrinterEnumAligned, cbBuf, pcbNeeded);
150 
151  return dwErrorCode;
152 }
BOOL WINAPI EnumPrintersW(DWORD Flags, PWSTR Name, DWORD Level, PBYTE pPrinterEnum, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
Definition: printers.c:247
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define ASSERT(a)
Definition: mode.c:45
unsigned long DWORD
Definition: ntddk_ex.h:95
#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
#define NULL
Definition: types.h:112
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 155 of file printers.c.

156 {
158  return ERROR_INVALID_FUNCTION;
159 }
#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 162 of file printers.c.

163 {
164  DWORD dwErrorCode;
165  PBYTE pPrinterAligned;
166 
167  dwErrorCode = RpcImpersonateClient(NULL);
168  if (dwErrorCode != ERROR_SUCCESS)
169  {
170  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
171  return dwErrorCode;
172  }
173 
174  pPrinterAligned = AlignRpcPtr(pPrinter, &cbBuf);
175 
176  if (GetPrinterW(hPrinter, Level, pPrinterAligned, cbBuf, pcbNeeded))
177  {
178  // Replace absolute pointer addresses in the output by relative offsets.
179  ASSERT(Level <= 9);
180  MarshallDownStructure(pPrinterAligned, pPrinterInfoMarshalling[Level]->pInfo, pPrinterInfoMarshalling[Level]->cbStructureSize, TRUE);
181  }
182  else
183  {
184  dwErrorCode = GetLastError();
185  }
186 
187  RpcRevertToSelf();
188  UndoAlignRpcPtr(pPrinter, pPrinterAligned, cbBuf, pcbNeeded);
189 
190  return dwErrorCode;
191 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:55
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:312
#define ASSERT(a)
Definition: mode.c:45
unsigned long DWORD
Definition: ntddk_ex.h:95
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
#define NULL
Definition: types.h:112
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 194 of file printers.c.

195 {
196  DWORD dwErrorCode;
198 
199  dwErrorCode = RpcImpersonateClient(NULL);
200  if (dwErrorCode != ERROR_SUCCESS)
201  {
202  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
203  return dwErrorCode;
204  }
205 
206  Default.DesiredAccess = AccessRequired;
207  Default.pDatatype = pDatatype;
208  Default.pDevMode = (PDEVMODEW)pDevModeContainer->pDevMode;
209 
210  if (!OpenPrinterW(pPrinterName, phPrinter, &Default))
211  dwErrorCode = GetLastError();
212 
213  RpcRevertToSelf();
214  return dwErrorCode;
215 }
struct _devicemodeW * PDEVMODEW
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
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
#define NULL
Definition: types.h:112
BOOL WINAPI OpenPrinterW(PWSTR pPrinterName, PHANDLE phPrinter, PPRINTER_DEFAULTSW pDefault)
Definition: printers.c:345

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 218 of file printers.c.

219 {
221  return ERROR_INVALID_FUNCTION;
222 }
#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 225 of file printers.c.

226 {
227  DWORD dwErrorCode;
228 
229  dwErrorCode = RpcImpersonateClient(NULL);
230  if (dwErrorCode != ERROR_SUCCESS)
231  {
232  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
233  return dwErrorCode;
234  }
235 
236  if (!ReadPrinter(hPrinter, pBuf, cbBuf, pcNoBytesRead))
237  dwErrorCode = GetLastError();
238 
239  RpcRevertToSelf();
240  return dwErrorCode;
241 }
BOOL WINAPI ReadPrinter(HANDLE hPrinter, PVOID pBuf, DWORD cbBuf, PDWORD pNoBytesRead)
Definition: printers.c:397
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
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
#define NULL
Definition: types.h:112

Referenced by pointer_default(), and ReadPrinter().

◆ _RpcResetPrinter()

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

Definition at line 244 of file printers.c.

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

Referenced by pointer_default().

◆ _RpcResetPrinterEx()

DWORD _RpcResetPrinterEx ( WINSPOOL_PRINTER_HANDLE  hPrinter,
WCHAR pDatatype,
WINSPOOL_DEVMODE_CONTAINER pDevModeContainer,
DWORD  dwFlags 
)

Definition at line 251 of file printers.c.

252 {
253  DWORD dwErrorCode;
254  PRINTER_DEFAULTSW pdw;
255 
256  if (pDatatype)
257  {
258  pdw.pDatatype = pDatatype;
259  }
260  else
261  {
263  }
264 
265  if (pDevModeContainer->pDevMode)
266  {
267  pdw.pDevMode = (PDEVMODEW)pDevModeContainer->pDevMode;
268  // Fixme : Need to check DevMode before forward call, by copy devmode.c from WinSpool.
269  // Local SV!SplIsValidDevmode((PDW)pDevModeContainer->pDevMode, pDevModeContainer->cbBuf)
270  }
271  else
272  {
274 
275  }
276  pdw.DesiredAccess = 0;
277 
278  dwErrorCode = RpcImpersonateClient(NULL);
279  if (dwErrorCode != ERROR_SUCCESS)
280  {
281  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
282  return dwErrorCode;
283  }
284 
285  if (!ResetPrinterW(hPrinter, &pdw))
286  dwErrorCode = GetLastError();
287 
288  RpcRevertToSelf();
289  return dwErrorCode;
290 }
struct _devicemodeW * PDEVMODEW
#define ERROR_SUCCESS
Definition: deptool.c:10
uint16_t * PWSTR
Definition: typedefs.h:56
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
LPDEVMODEW pDevMode
Definition: winspool.h:862
#define RESETPRINTERDEFAULTDATATYPE
Definition: spoolss.h:11
BOOL WINAPI ResetPrinterW(HANDLE hPrinter, PPRINTER_DEFAULTSW pDefault)
Definition: printers.c:2931
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
unsigned long DWORD
Definition: ntddk_ex.h:95
ACCESS_MASK DesiredAccess
Definition: winspool.h:863
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ERR(fmt,...)
Definition: debug.h:110
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052
#define NULL
Definition: types.h:112
#define RESETPRINTERDEFAULTDEVMODE
Definition: spoolss.h:12

Referenced by pointer_default().

◆ _RpcSeekPrinter()

DWORD _RpcSeekPrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter,
LARGE_INTEGER  liDistanceToMove,
PLARGE_INTEGER  pliNewPointer,
DWORD  dwMoveMethod,
BOOL  bWrite 
)

Definition at line 293 of file printers.c.

294 {
295  DWORD dwErrorCode;
296 
297  dwErrorCode = RpcImpersonateClient(NULL);
298  if (dwErrorCode != ERROR_SUCCESS)
299  {
300  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
301  return dwErrorCode;
302  }
303 
304  if (!SeekPrinter(hPrinter, liDistanceToMove, pliNewPointer, dwMoveMethod, bWrite))
305  dwErrorCode = GetLastError();
306 
307  RpcRevertToSelf();
308  return dwErrorCode;
309 }
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI SeekPrinter(HANDLE hPrinter, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER pliNewPointer, DWORD dwMoveMethod, BOOL bWrite)
Definition: printers.c:412
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
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
#define NULL
Definition: types.h:112

Referenced by pointer_default(), and SeekPrinter().

◆ _RpcSetPrinter()

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

Definition at line 312 of file printers.c.

313 {
315  return ERROR_INVALID_FUNCTION;
316 }
#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 319 of file printers.c.

320 {
321  DWORD dwErrorCode;
322 
323  dwErrorCode = RpcImpersonateClient(NULL);
324  if (dwErrorCode != ERROR_SUCCESS)
325  {
326  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
327  return dwErrorCode;
328  }
329 
330  *pJobId = StartDocPrinterW(hPrinter, pDocInfoContainer->Level, (PBYTE)pDocInfoContainer->DocInfo.pDocInfo1);
331  dwErrorCode = GetLastError();
332 
333  RpcRevertToSelf();
334  return dwErrorCode;
335 }
union _WINSPOOL_DOC_INFO_CONTAINER::@3380 DocInfo
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
DWORD WINAPI StartDocPrinterW(HANDLE hPrinter, DWORD Level, PBYTE pDocInfo)
Definition: printers.c:442
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
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
#define NULL
Definition: types.h:112
BYTE * PBYTE
Definition: pedump.c:66

Referenced by _StartDocPrinterWithRPC(), and pointer_default().

◆ _RpcStartPagePrinter()

DWORD _RpcStartPagePrinter ( WINSPOOL_PRINTER_HANDLE  hPrinter)

Definition at line 338 of file printers.c.

339 {
340  DWORD dwErrorCode;
341 
342  dwErrorCode = RpcImpersonateClient(NULL);
343  if (dwErrorCode != ERROR_SUCCESS)
344  {
345  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
346  return dwErrorCode;
347  }
348 
349  if (!StartPagePrinter(hPrinter))
350  dwErrorCode = GetLastError();
351 
352  RpcRevertToSelf();
353  return dwErrorCode;
354 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
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:457
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052
#define NULL
Definition: types.h:112

Referenced by pointer_default(), and StartPagePrinter().

◆ _RpcWritePrinter()

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

Definition at line 357 of file printers.c.

358 {
359  DWORD dwErrorCode;
360 
361  dwErrorCode = RpcImpersonateClient(NULL);
362  if (dwErrorCode != ERROR_SUCCESS)
363  {
364  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
365  return dwErrorCode;
366  }
367 
368  if (!WritePrinter(hPrinter, pBuf, cbBuf, pcWritten))
369  dwErrorCode = GetLastError();
370 
371  RpcRevertToSelf();
372  return dwErrorCode;
373 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
BOOL WINAPI WritePrinter(HANDLE hPrinter, PVOID pBuf, DWORD cbBuf, PDWORD pcWritten)
Definition: printers.c:472
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
#define NULL
Definition: types.h:112

Referenced by pointer_default(), and WritePrinter().