2 * PROJECT: ReactOS Spooler API
3 * LICENSE: GNU LGPL v2.1 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 _MarshallUpDatatypesInfo(PDATATYPES_INFO_1W pDatatypesInfo1
)
13 // Replace relative offset addresses in the output by absolute pointers.
14 pDatatypesInfo1
->pName
= (PWSTR
)((ULONG_PTR
)pDatatypesInfo1
->pName
+ (ULONG_PTR
)pDatatypesInfo1
);
18 _MarshallUpPrintProcessorInfo(PPRINTPROCESSOR_INFO_1W pPrintProcessorInfo1
)
20 // Replace relative offset addresses in the output by absolute pointers.
21 pPrintProcessorInfo1
->pName
= (PWSTR
)((ULONG_PTR
)pPrintProcessorInfo1
->pName
+ (ULONG_PTR
)pPrintProcessorInfo1
);
25 AddPrintProcessorW(PWSTR pName
, PWSTR pEnvironment
, PWSTR pPathName
, PWSTR pPrintProcessorName
)
32 DeletePrintProcessorW(PWSTR pName
, PWSTR pEnvironment
, PWSTR pPrintProcessorName
)
39 EnumPrintProcessorDatatypesA(PSTR pName
, LPSTR pPrintProcessorName
, DWORD Level
, PBYTE pDatatypes
, DWORD cbBuf
, PDWORD pcbNeeded
, PDWORD pcReturned
)
46 EnumPrintProcessorDatatypesW(PWSTR pName
, LPWSTR pPrintProcessorName
, DWORD Level
, PBYTE pDatatypes
, DWORD cbBuf
, PDWORD pcbNeeded
, PDWORD pcReturned
)
55 dwErrorCode
= _RpcEnumPrintProcessorDatatypes(pName
, pPrintProcessorName
, Level
, pDatatypes
, cbBuf
, pcbNeeded
, pcReturned
);
57 RpcExcept(EXCEPTION_EXECUTE_HANDLER
)
59 dwErrorCode
= RpcExceptionCode();
60 ERR("_RpcEnumPrintProcessorDatatypes failed with exception code %lu!\n", dwErrorCode
);
64 if (dwErrorCode
== ERROR_SUCCESS
)
66 // Replace relative offset addresses in the output by absolute pointers.
67 for (i
= 0; i
< *pcReturned
; i
++)
69 _MarshallUpDatatypesInfo((PDATATYPES_INFO_1W
)p
);
70 p
+= sizeof(DATATYPES_INFO_1W
);
74 SetLastError(dwErrorCode
);
75 return (dwErrorCode
== ERROR_SUCCESS
);
79 EnumPrintProcessorsW(PWSTR pName
, PWSTR pEnvironment
, DWORD Level
, PBYTE pPrintProcessorInfo
, DWORD cbBuf
, PDWORD pcbNeeded
, PDWORD pcReturned
)
83 PBYTE p
= pPrintProcessorInfo
;
88 dwErrorCode
= _RpcEnumPrintProcessors(pName
, pEnvironment
, Level
, pPrintProcessorInfo
, cbBuf
, pcbNeeded
, pcReturned
);
90 RpcExcept(EXCEPTION_EXECUTE_HANDLER
)
92 dwErrorCode
= RpcExceptionCode();
93 ERR("_RpcEnumPrintProcessors failed with exception code %lu!\n", dwErrorCode
);
97 if (dwErrorCode
== ERROR_SUCCESS
)
99 // Replace relative offset addresses in the output by absolute pointers.
100 for (i
= 0; i
< *pcReturned
; i
++)
102 _MarshallUpPrintProcessorInfo((PPRINTPROCESSOR_INFO_1W
)p
);
103 p
+= sizeof(PRINTPROCESSOR_INFO_1W
);
107 SetLastError(dwErrorCode
);
108 return (dwErrorCode
== ERROR_SUCCESS
);
112 GetPrintProcessorDirectoryW(PWSTR pName
, PWSTR pEnvironment
, DWORD Level
, PBYTE pPrintProcessorInfo
, DWORD cbBuf
, PDWORD pcbNeeded
)
114 BOOL bReturnValue
= FALSE
;
120 dwErrorCode
= _RpcGetPrintProcessorDirectory(pName
, pEnvironment
, Level
, pPrintProcessorInfo
, cbBuf
, pcbNeeded
);
121 SetLastError(dwErrorCode
);
122 bReturnValue
= (dwErrorCode
== ERROR_SUCCESS
);
124 RpcExcept(EXCEPTION_EXECUTE_HANDLER
)
126 ERR("_RpcGetPrintProcessorDirectory failed with exception code %lu!\n", RpcExceptionCode());