ReactOS  0.4.15-dev-509-g96a357b
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 {
16 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by AddPrintProcessorW(), and pointer_default().

◆ _RpcDeletePrintProcessor()

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

Definition at line 19 of file printprocessors.c.

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

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 26 of file printprocessors.c.

27 {
28  DWORD dwErrorCode;
29  PBYTE pDatatypesAligned;
30 
31  dwErrorCode = RpcImpersonateClient(NULL);
32  if (dwErrorCode != ERROR_SUCCESS)
33  {
34  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
35  return dwErrorCode;
36  }
37 
38  pDatatypesAligned = AlignRpcPtr(pDatatypes, &cbBuf);
39 
40  if (EnumPrintProcessorDatatypesW(pName, pPrintProcessorName, Level, pDatatypesAligned, cbBuf, pcbNeeded, pcReturned))
41  {
42  // Replace absolute pointer addresses in the output by relative offsets.
44  }
45  else
46  {
47  dwErrorCode = GetLastError();
48  }
49 
51  UndoAlignRpcPtr(pDatatypes, pDatatypesAligned, cbBuf, pcbNeeded);
52 
53  return dwErrorCode;
54 }
DWORD cbStructureSize
Definition: marshalling.h:25
MARSHALLING_INFO pInfo[]
Definition: marshalling.h:26
#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
static const MARSHALLING DatatypesInfo1Marshalling
smooth NULL
Definition: ftsmooth.c:416
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
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 57 of file printprocessors.c.

58 {
59  DWORD dwErrorCode;
60  PBYTE pPrintProcessorInfoAligned;
61 
62  dwErrorCode = RpcImpersonateClient(NULL);
63  if (dwErrorCode != ERROR_SUCCESS)
64  {
65  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
66  return dwErrorCode;
67  }
68 
69  pPrintProcessorInfoAligned = AlignRpcPtr(pPrintProcessorInfo, &cbBuf);
70 
71  if (EnumPrintProcessorsW(pName, pEnvironment, Level, pPrintProcessorInfoAligned, cbBuf, pcbNeeded, pcReturned))
72  {
73  // Replace absolute pointer addresses in the output by relative offsets.
75  }
76  else
77  {
78  dwErrorCode = GetLastError();
79  }
80 
82  UndoAlignRpcPtr(pPrintProcessorInfo, pPrintProcessorInfoAligned, cbBuf, pcbNeeded);
83 
84  return dwErrorCode;
85 }
DWORD cbStructureSize
Definition: marshalling.h:25
MARSHALLING_INFO pInfo[]
Definition: marshalling.h:26
#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
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
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 88 of file printprocessors.c.

89 {
90  DWORD dwErrorCode;
91 
92  dwErrorCode = RpcImpersonateClient(NULL);
93  if (dwErrorCode != ERROR_SUCCESS)
94  {
95  ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
96  return dwErrorCode;
97  }
98 
99  if (!GetPrintProcessorDirectoryW(pName, pEnvironment, Level, pPrintProcessorDirectory, cbBuf, pcbNeeded))
100  dwErrorCode = GetLastError();
101 
102  RpcRevertToSelf();
103  return dwErrorCode;
104 }
#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
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

Referenced by GetPrintProcessorDirectoryW(), and pointer_default().