2 * PROJECT: ReactOS Print Spooler Service
3 * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
4 * PURPOSE: Functions related to Print Processors
5 * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
11 _MarshallDownDatatypesInfo(PDATATYPES_INFO_1W pDatatypesInfo1
)
13 // Replace absolute pointer addresses in the output by relative offsets.
14 pDatatypesInfo1
->pName
= (PWSTR
)((ULONG_PTR
)pDatatypesInfo1
->pName
- (ULONG_PTR
)pDatatypesInfo1
);
18 _MarshallDownPrintProcessorInfo(PPRINTPROCESSOR_INFO_1W pPrintProcessorInfo1
)
20 // Replace absolute pointer addresses in the output by relative offsets.
21 pPrintProcessorInfo1
->pName
= (PWSTR
)((ULONG_PTR
)pPrintProcessorInfo1
->pName
- (ULONG_PTR
)pPrintProcessorInfo1
);
25 _RpcAddPrintProcessor(WINSPOOL_HANDLE pName
, WCHAR
* pEnvironment
, WCHAR
* pPathName
, WCHAR
* pPrintProcessorName
)
28 return ERROR_INVALID_FUNCTION
;
32 _RpcDeletePrintProcessor(WINSPOOL_HANDLE pName
, WCHAR
* pEnvironment
, WCHAR
* pPrintProcessorName
)
35 return ERROR_INVALID_FUNCTION
;
39 _RpcEnumPrintProcessorDatatypes(WINSPOOL_HANDLE pName
, WCHAR
* pPrintProcessorName
, DWORD Level
, BYTE
* pDatatypes
, DWORD cbBuf
, DWORD
* pcbNeeded
, DWORD
* pcReturned
)
45 dwErrorCode
= RpcImpersonateClient(NULL
);
46 if (dwErrorCode
!= ERROR_SUCCESS
)
48 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode
);
52 EnumPrintProcessorDatatypesW(pName
, pPrintProcessorName
, Level
, pDatatypes
, cbBuf
, pcbNeeded
, pcReturned
);
53 dwErrorCode
= GetLastError();
55 if (dwErrorCode
== ERROR_SUCCESS
)
57 // Replace absolute pointer addresses in the output by relative offsets.
58 for (i
= 0; i
< *pcReturned
; i
++)
60 _MarshallDownDatatypesInfo((PDATATYPES_INFO_1W
)p
);
61 p
+= sizeof(DATATYPES_INFO_1W
);
70 _RpcEnumPrintProcessors(WINSPOOL_HANDLE pName
, WCHAR
* pEnvironment
, DWORD Level
, BYTE
* pPrintProcessorInfo
, DWORD cbBuf
, DWORD
* pcbNeeded
, DWORD
* pcReturned
)
74 PBYTE p
= pPrintProcessorInfo
;
76 dwErrorCode
= RpcImpersonateClient(NULL
);
77 if (dwErrorCode
!= ERROR_SUCCESS
)
79 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode
);
83 EnumPrintProcessorsW(pName
, pEnvironment
, Level
, pPrintProcessorInfo
, cbBuf
, pcbNeeded
, pcReturned
);
84 dwErrorCode
= GetLastError();
86 if (dwErrorCode
== ERROR_SUCCESS
)
88 // Replace absolute pointer addresses in the output by relative offsets.
89 for (i
= 0; i
< *pcReturned
; i
++)
91 _MarshallDownPrintProcessorInfo((PPRINTPROCESSOR_INFO_1W
)p
);
92 p
+= sizeof(PRINTPROCESSOR_INFO_1W
);
101 _RpcGetPrintProcessorDirectory(WINSPOOL_HANDLE pName
, WCHAR
* pEnvironment
, DWORD Level
, BYTE
* pPrintProcessorDirectory
, DWORD cbBuf
, DWORD
* pcbNeeded
)
105 dwErrorCode
= RpcImpersonateClient(NULL
);
106 if (dwErrorCode
!= ERROR_SUCCESS
)
108 ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode
);
112 GetPrintProcessorDirectoryW(pName
, pEnvironment
, Level
, pPrintProcessorDirectory
, cbBuf
, pcbNeeded
);
113 dwErrorCode
= GetLastError();