ReactOS  0.4.15-dev-2153-g62b4c61
printprocessors.c File Reference
Include dependency graph for printprocessors.c:

Go to the source code of this file.

Functions

DWORD _RpcAddPrintProcessor (WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pPathName, WCHAR *pPrintProcessorName)
 
DWORD _RpcDeletePrintProcessor (WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pPrintProcessorName)
 
DWORD _RpcEnumPrintProcessorDatatypes (WINSPOOL_HANDLE pName, WCHAR *pPrintProcessorName, DWORD Level, BYTE *pDatatypes, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned)
 
DWORD _RpcEnumPrintProcessors (WINSPOOL_HANDLE pName, WCHAR *pEnvironment, DWORD Level, BYTE *pPrintProcessorInfo, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned)
 
DWORD _RpcGetPrintProcessorDirectory (WINSPOOL_HANDLE pName, WCHAR *pEnvironment, DWORD Level, BYTE *pPrintProcessorDirectory, DWORD cbBuf, DWORD *pcbNeeded)
 

Function Documentation

◆ _RpcAddPrintProcessor()

DWORD _RpcAddPrintProcessor ( WINSPOOL_HANDLE  pName,
WCHAR pEnvironment,
WCHAR pPathName,
WCHAR pPrintProcessorName 
)

Definition at line 12 of file printprocessors.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 (!AddPrintProcessorW(pName, pEnvironment, pPathName, pPrintProcessorName))
24  dwErrorCode = GetLastError();
25 
27  return dwErrorCode;
28 }
#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
static LPSTR pName
Definition: security.c:75
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI AddPrintProcessorW(PWSTR pName, PWSTR pEnvironment, PWSTR pPathName, PWSTR pPrintProcessorName)
#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 AddPrintProcessorW(), and pointer_default().

◆ _RpcDeletePrintProcessor()

DWORD _RpcDeletePrintProcessor ( WINSPOOL_HANDLE  pName,
WCHAR pEnvironment,
WCHAR pPrintProcessorName 
)

Definition at line 31 of file printprocessors.c.

32 {
33  DWORD dwErrorCode;
34 
35  dwErrorCode = RpcImpersonateClient(NULL);
36  if (dwErrorCode != ERROR_SUCCESS)
37  {
38  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
39  return dwErrorCode;
40  }
41 
42  if (!DeletePrintProcessorW(pName, pEnvironment, pPrintProcessorName))
43  dwErrorCode = GetLastError();
44 
46  return dwErrorCode;
47 }
BOOL WINAPI DeletePrintProcessorW(PWSTR pName, PWSTR pEnvironment, PWSTR pPrintProcessorName)
#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
static LPSTR pName
Definition: security.c:75
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 DeletePrintProcessorW(), and pointer_default().

◆ _RpcEnumPrintProcessorDatatypes()

DWORD _RpcEnumPrintProcessorDatatypes ( WINSPOOL_HANDLE  pName,
WCHAR pPrintProcessorName,
DWORD  Level,
BYTE pDatatypes,
DWORD  cbBuf,
DWORD pcbNeeded,
DWORD pcReturned 
)

Definition at line 50 of file printprocessors.c.

51 {
52  DWORD dwErrorCode;
53  PBYTE pDatatypesAligned;
54 
55  dwErrorCode = RpcImpersonateClient(NULL);
56  if (dwErrorCode != ERROR_SUCCESS)
57  {
58  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
59  return dwErrorCode;
60  }
61 
62  pDatatypesAligned = AlignRpcPtr(pDatatypes, &cbBuf);
63 
64  if (EnumPrintProcessorDatatypesW(pName, pPrintProcessorName, Level, pDatatypesAligned, cbBuf, pcbNeeded, pcReturned))
65  {
66  // Replace absolute pointer addresses in the output by relative offsets.
68  }
69  else
70  {
71  dwErrorCode = GetLastError();
72  }
73 
75  UndoAlignRpcPtr(pDatatypes, pDatatypesAligned, cbBuf, pcbNeeded);
76 
77  return dwErrorCode;
78 }
DWORD cbStructureSize
Definition: marshalling.h:25
MARSHALLING_INFO pInfo[]
Definition: marshalling.h:26
#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
static const MARSHALLING DatatypesInfo1Marshalling
RPC_STATUS WINAPI RpcRevertToSelf(void)
Definition: rpc_binding.c:1459
static LPSTR pName
Definition: security.c:75
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
_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
BOOL WINAPI EnumPrintProcessorDatatypesW(PWSTR pName, PWSTR pPrintProcessorName, DWORD Level, PBYTE pDatatypes, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
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 EnumPrintProcessorDatatypesW(), and pointer_default().

◆ _RpcEnumPrintProcessors()

DWORD _RpcEnumPrintProcessors ( WINSPOOL_HANDLE  pName,
WCHAR pEnvironment,
DWORD  Level,
BYTE pPrintProcessorInfo,
DWORD  cbBuf,
DWORD pcbNeeded,
DWORD pcReturned 
)

Definition at line 81 of file printprocessors.c.

82 {
83  DWORD dwErrorCode;
84  PBYTE pPrintProcessorInfoAligned;
85 
86  dwErrorCode = RpcImpersonateClient(NULL);
87  if (dwErrorCode != ERROR_SUCCESS)
88  {
89  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
90  return dwErrorCode;
91  }
92 
93  pPrintProcessorInfoAligned = AlignRpcPtr(pPrintProcessorInfo, &cbBuf);
94 
95  if (EnumPrintProcessorsW(pName, pEnvironment, Level, pPrintProcessorInfoAligned, cbBuf, pcbNeeded, pcReturned))
96  {
97  // Replace absolute pointer addresses in the output by relative offsets.
99  }
100  else
101  {
102  dwErrorCode = GetLastError();
103  }
104 
105  RpcRevertToSelf();
106  UndoAlignRpcPtr(pPrintProcessorInfo, pPrintProcessorInfoAligned, cbBuf, pcbNeeded);
107 
108  return dwErrorCode;
109 }
DWORD cbStructureSize
Definition: marshalling.h:25
MARSHALLING_INFO pInfo[]
Definition: marshalling.h:26
#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
static LPSTR pName
Definition: security.c:75
unsigned long DWORD
Definition: ntddk_ex.h:95
static const MARSHALLING PrintProcessorInfo1Marshalling
#define ERR(fmt,...)
Definition: debug.h:110
PVOID WINAPI AlignRpcPtr(PVOID pBuffer, PDWORD pcbBuffer)
Definition: memory.c:29
_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
BOOL WINAPI EnumPrintProcessorsW(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE pPrintProcessorInfo, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)

Referenced by EnumPrintProcessorsW(), and pointer_default().

◆ _RpcGetPrintProcessorDirectory()

DWORD _RpcGetPrintProcessorDirectory ( WINSPOOL_HANDLE  pName,
WCHAR pEnvironment,
DWORD  Level,
BYTE pPrintProcessorDirectory,
DWORD  cbBuf,
DWORD pcbNeeded 
)

Definition at line 112 of file printprocessors.c.

113 {
114  DWORD dwErrorCode;
115 
116  dwErrorCode = RpcImpersonateClient(NULL);
117  if (dwErrorCode != ERROR_SUCCESS)
118  {
119  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
120  return dwErrorCode;
121  }
122 
123  if (!GetPrintProcessorDirectoryW(pName, pEnvironment, Level, pPrintProcessorDirectory, cbBuf, pcbNeeded))
124  dwErrorCode = GetLastError();
125 
126  RpcRevertToSelf();
127  return dwErrorCode;
128 }
#define ERROR_SUCCESS
Definition: deptool.c:10
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
static LPSTR pName
Definition: security.c:75
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI GetPrintProcessorDirectoryW(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE pPrintProcessorInfo, DWORD cbBuf, PDWORD pcbNeeded)
#define ERR(fmt,...)
Definition: debug.h:110
_In_ DWORD _Out_ PDWORD pcbNeeded
Definition: winddi.h:3827
RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle)
Definition: rpc_binding.c:1052
#define NULL
Definition: types.h:112

Referenced by GetPrintProcessorDirectoryW(), and pointer_default().