- Add RPC calls in winspool, Router calls in spoolsv and Local Spooler calls in spoolss for most of the APIs I've implemented in localspl.
This is still Work-In-Progress and missing some sanity checks, but a first step into something usable from the documented Spooler API side.
- Separate APIs into individual source files just like I did for localspl.
svn path=/branches/colins-printing-for-freedom/; revision=68237
list(APPEND SOURCE
context.c
+ jobs.c
main.c
memory.c
precomp.h
+ printers.c
+ printprocessors.c
tools.c)
add_library(spoolss SHARED
--- /dev/null
+/*
+ * PROJECT: ReactOS Spooler Router
+ * LICENSE: GNU LGPL v2.1 or any later version as published by the Free Software Foundation
+ * PURPOSE: Functions for managing print jobs
+ * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
+ */
+
+#include "precomp.h"
+
+BOOL WINAPI
+AddJob(HANDLE hPrinter, DWORD Level, LPBYTE pData, DWORD cbBuf, LPDWORD pcbNeeded)
+{
+ return LocalSplFuncs.fpAddJob(hPrinter, Level, pData, cbBuf, pcbNeeded);
+}
+
+BOOL WINAPI
+GetJob(HANDLE hPrinter, DWORD JobId, DWORD Level, LPBYTE pJob, DWORD cbBuf, LPDWORD pcbNeeded)
+{
+ return LocalSplFuncs.fpGetJob(hPrinter, JobId, Level, pJob, cbBuf, pcbNeeded);
+}
PRINTPROVIDOR LocalSplFuncs;
-BOOL WINAPI
-ClosePrinter(HANDLE hPrinter)
-{
- return FALSE;
-}
-
BOOL WINAPI
DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
return TRUE;
}
-BOOL WINAPI
-EndDocPrinter(HANDLE hPrinter)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-EndPagePrinter(HANDLE hPrinter)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-EnumPrintersW(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-GetPrintProcessorDirectoryW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded)
-{
- return FALSE;
-}
-
BOOL WINAPI
InitializeRouter(HANDLE SpoolerStatusHandle)
{
return TRUE;
}
-BOOL WINAPI
-OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
-{
- return FALSE;
-}
-
-DWORD WINAPI
-StartDocPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pDocInfo)
-{
- return 0;
-}
-
BOOL WINAPI
SplInitializeWinSpoolDrv(PVOID* pTable)
{
// Nothing to do here yet
return ERROR_SUCCESS;
}
-
-BOOL WINAPI
-StartPagePrinter(HANDLE hPrinter)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-WritePrinter(HANDLE hPrinter, LPVOID pBuf, DWORD cbBuf, LPDWORD pcWritten)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-XcvDataW(HANDLE hXcv, PCWSTR pszDataName, PBYTE pInputData, DWORD cbInputData, PBYTE pOutputData, DWORD cbOutputData, PDWORD pcbOutputNeeded, PDWORD pdwStatus)
-{
- return FALSE;
-}
// main.c
extern HANDLE hProcessHeap;
+extern PRINTPROVIDOR LocalSplFuncs;
#endif
--- /dev/null
+/*
+ * PROJECT: ReactOS Spooler Router
+ * LICENSE: GNU LGPL v2.1 or any later version as published by the Free Software Foundation
+ * PURPOSE: Functions related to Printers and printing
+ * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
+ */
+
+#include "precomp.h"
+
+
+BOOL WINAPI
+ClosePrinter(HANDLE hPrinter)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+EndDocPrinter(HANDLE hPrinter)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+EndPagePrinter(HANDLE hPrinter)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+EnumPrintersW(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
+{
+ return LocalSplFuncs.fpEnumPrinters(Flags, Name, Level, pPrinterEnum, cbBuf, pcbNeeded, pcReturned);
+}
+
+BOOL WINAPI
+GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
+{
+ return LocalSplFuncs.fpOpenPrinter(pPrinterName, phPrinter, pDefault);
+}
+
+DWORD WINAPI
+StartDocPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pDocInfo)
+{
+ return 0;
+}
+
+BOOL WINAPI
+StartPagePrinter(HANDLE hPrinter)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+WritePrinter(HANDLE hPrinter, LPVOID pBuf, DWORD cbBuf, LPDWORD pcWritten)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+XcvDataW(HANDLE hXcv, PCWSTR pszDataName, PBYTE pInputData, DWORD cbInputData, PBYTE pOutputData, DWORD cbOutputData, PDWORD pcbOutputNeeded, PDWORD pdwStatus)
+{
+ return FALSE;
+}
--- /dev/null
+/*
+ * PROJECT: ReactOS Spooler Router
+ * LICENSE: GNU LGPL v2.1 or any later version as published by the Free Software Foundation
+ * PURPOSE: Functions related to Print Processors
+ * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
+ */
+
+#include "precomp.h"
+
+BOOL WINAPI
+EnumPrintProcessorDatatypesW(LPWSTR pName, LPWSTR pPrintProcessorName, DWORD Level, LPBYTE pDatatypes, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
+{
+ return LocalSplFuncs.fpEnumPrintProcessorDatatypes(pName, pPrintProcessorName, Level, pDatatypes, cbBuf, pcbNeeded, pcReturned);
+}
+
+BOOL WINAPI
+EnumPrintProcessorsW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
+{
+ return LocalSplFuncs.fpEnumPrintProcessors(pName, pEnvironment, Level, pPrintProcessorInfo, cbBuf, pcbNeeded, pcReturned);
+}
+
+BOOL WINAPI
+GetPrintProcessorDirectoryW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded)
+{
+ return LocalSplFuncs.fpGetPrintProcessorDirectory(pName, pEnvironment, Level, pPrintProcessorInfo, cbBuf, pcbNeeded);
+}
@ stub AbortPrinter
@ stub AddDriverCatalog
@ stub AddFormW
-@ stub AddJobW
+@ stdcall AddJobW(long long ptr long ptr)
@ stub AddMonitorW
@ stub AddPerMachineConnectionW
@ stub AddPortExW
@ stub EnumPrinterDriversW
@ stub EnumPrinterKeyW
@ stdcall EnumPrintersW(long ptr long ptr long ptr ptr)
-@ stub EnumPrintProcessorDatatypesW
-@ stub EnumPrintProcessorsW
+@ stdcall EnumPrintProcessorDatatypesW(ptr ptr long ptr long ptr ptr)
+@ stdcall EnumPrintProcessorsW(ptr ptr long ptr long ptr ptr)
@ stub FindClosePrinterChangeNotification
@ stub FlushPrinter
@ stub FormatPrinterForRegistryKey
@ stub GetClientUserHandle
@ stub GetFormW
@ stub GetJobAttributes
-@ stub GetJobW
+@ stdcall GetJobW(long long long ptr long ptr)
@ stub GetNetworkId
@ stub GetPrinterDataExW
@ stub GetPrinterDataW
list(APPEND SOURCE
init.c
+ jobs.c
main.c
+ printers.c
+ printprocessors.c
+ precomp.h
rpcserver.c
rpcstubs.c
- precomp.h
${CMAKE_CURRENT_BINARY_DIR}/winspool_s.c)
add_executable(spoolsv ${SOURCE} spoolsv.rc)
--- /dev/null
+/*
+ * PROJECT: ReactOS Print Spooler Service
+ * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
+ * PURPOSE: Functions for managing print jobs
+ * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
+ */
+
+#include "precomp.h"
+
+DWORD
+_RpcAddJob(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Level, BYTE* pAddJob, DWORD cbBuf, DWORD* pcbNeeded)
+{
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ dwErrorCode = AddJobW(hPrinter, Level, pAddJob, cbBuf, pcbNeeded);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("AddJobW failed with error %lu!\n", dwErrorCode);
+ RpcRevertToSelf();
+ return dwErrorCode;
+ }
+
+ return RpcRevertToSelf();
+}
+
+DWORD
+_RpcGetJob(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD JobId, DWORD Level, BYTE* pJob, DWORD cbBuf, DWORD* pcbNeeded)
+{
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ dwErrorCode = GetJobW(hPrinter, JobId, Level, pJob, cbBuf, pcbNeeded);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("GetJobW failed with error %lu!\n", dwErrorCode);
+ RpcRevertToSelf();
+ return dwErrorCode;
+ }
+
+ return RpcRevertToSelf();
+}
+
+DWORD
+_RpcScheduleJob(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD JobId)
+{
+ UNIMPLEMENTED;
+ return ERROR_INVALID_FUNCTION;
+}
+
+DWORD
+_RpcSetJob(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD JobId, WINSPOOL_JOB_CONTAINER* pJobContainer, DWORD Command)
+{
+ UNIMPLEMENTED;
+ return ERROR_INVALID_FUNCTION;
+}
--- /dev/null
+/*
+ * PROJECT: ReactOS Print Spooler Service
+ * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
+ * PURPOSE: Functions related to Printers and printing
+ * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
+ */
+
+#include "precomp.h"
+
+DWORD
+_RpcEnumPrinters(DWORD Flags, WINSPOOL_HANDLE Name, DWORD Level, BYTE* pPrinterEnum, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned)
+{
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ dwErrorCode = EnumPrintersW(Flags, Name, Level, pPrinterEnum, cbBuf, pcbNeeded, pcReturned);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("EnumPrintersW failed with error %lu!\n", dwErrorCode);
+ RpcRevertToSelf();
+ return dwErrorCode;
+ }
+
+ return RpcRevertToSelf();
+}
+
+DWORD
+_RpcOpenPrinter(WINSPOOL_HANDLE pPrinterName, WINSPOOL_PRINTER_HANDLE* phPrinter, WCHAR* pDatatype, WINSPOOL_DEVMODE_CONTAINER* pDevModeContainer, DWORD AccessRequired)
+{
+ DWORD dwErrorCode;
+ PRINTER_DEFAULTSW Default;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ Default.DesiredAccess = AccessRequired;
+ Default.pDatatype = pDatatype;
+ Default.pDevMode = (PDEVMODEW)pDevModeContainer->pDevMode;
+
+ dwErrorCode = OpenPrinterW(pPrinterName, phPrinter, &Default);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("OpenPrinterW failed with error %lu!\n", dwErrorCode);
+ RpcRevertToSelf();
+ return dwErrorCode;
+ }
+
+ return RpcRevertToSelf();
+}
--- /dev/null
+/*
+ * PROJECT: ReactOS Print Spooler Service
+ * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
+ * PURPOSE: Functions related to Print Processors
+ * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
+ */
+
+#include "precomp.h"
+
+DWORD
+_RpcAddPrintProcessor(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pPathName, WCHAR *pPrintProcessorName)
+{
+ UNIMPLEMENTED;
+ return ERROR_INVALID_FUNCTION;
+}
+
+DWORD
+_RpcEnumPrintProcessorDatatypes(WINSPOOL_HANDLE pName, WCHAR *pPrintProcessorName, DWORD Level, BYTE *pDatatypes, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned)
+{
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ dwErrorCode = EnumPrintProcessorDatatypesW(pName, pPrintProcessorName, Level, pDatatypes, cbBuf, pcbNeeded, pcReturned);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("EnumPrintProcessorDatatypesW failed with error %lu!\n", dwErrorCode);
+ RpcRevertToSelf();
+ return dwErrorCode;
+ }
+
+ return RpcRevertToSelf();
+}
+
+DWORD
+_RpcEnumPrintProcessors(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, DWORD Level, BYTE *pPrintProcessorInfo, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned)
+{
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ dwErrorCode = EnumPrintProcessorsW(pName, pEnvironment, Level, pPrintProcessorInfo, cbBuf, pcbNeeded, pcReturned);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("EnumPrintProcessorsW failed with error %lu!\n", dwErrorCode);
+ RpcRevertToSelf();
+ return dwErrorCode;
+ }
+
+ return RpcRevertToSelf();
+}
+
+DWORD
+_RpcGetPrintProcessorDirectory(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, DWORD Level, BYTE *pPrintProcessorDirectory, DWORD cbBuf, DWORD *pcbNeeded)
+{
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ dwErrorCode = GetPrintProcessorDirectoryW(pName, pEnvironment, Level, pPrintProcessorDirectory, cbBuf, pcbNeeded);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("EnumPrintProcessorsW failed with error %lu!\n", dwErrorCode);
+ RpcRevertToSelf();
+ return dwErrorCode;
+ }
+
+ return RpcRevertToSelf();
+}
#include "precomp.h"
-DWORD
-_RpcEnumPrinters(DWORD Flags, WINSPOOL_HANDLE Name, DWORD Level, BYTE* pPrinterEnum, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned)
-{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
-}
-
-DWORD
-_RpcOpenPrinter(WINSPOOL_HANDLE pPrinterName, WINSPOOL_PRINTER_HANDLE* phPrinter, WCHAR* pDatatype, WINSPOOL_DEVMODE_CONTAINER* pDevModeContainer, DWORD AccessRequired)
-{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
-}
-
-DWORD
-_RpcSetJob(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD JobId, WINSPOOL_JOB_CONTAINER *pJobContainer, DWORD Command)
-{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
-}
-
-DWORD
-_RpcGetJob(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD JobId, DWORD Level, BYTE *pJob, DWORD cbBuf, DWORD *pcbNeeded)
-{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
-}
-
DWORD
_RpcEnumJobs(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD FirstJob, DWORD NoJobs, DWORD Level, BYTE *pJob, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned)
{
return ERROR_INVALID_FUNCTION;
}
-DWORD
-_RpcAddPrintProcessor(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pPathName, WCHAR *pPrintProcessorName)
-{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
-}
-
-DWORD
-_RpcEnumPrintProcessors(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, DWORD Level, BYTE *pPrintProcessorInfo, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned)
-{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
-}
-
-DWORD
-_RpcGetPrintProcessorDirectory(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, DWORD Level, BYTE *pPrintProcessorDirectory, DWORD cbBuf, DWORD *pcbNeeded)
-{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
-}
-
DWORD
_RpcStartDocPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_DOC_INFO_CONTAINER *pDocInfoContainer, DWORD *pJobId)
{
return ERROR_INVALID_FUNCTION;
}
-DWORD
-_RpcAddJob(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Level, BYTE *pAddJob, DWORD cbBuf, DWORD *pcbNeeded)
-{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
-}
-
-DWORD
-_RpcScheduleJob(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD JobId)
-{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
-}
-
DWORD
_RpcGetPrinterData(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pValueName, DWORD *pType, BYTE *pData, DWORD nSize, DWORD *pcbNeeded)
{
return ERROR_INVALID_FUNCTION;
}
-DWORD
-_RpcEnumPrintProcessorDatatypes(WINSPOOL_HANDLE pName, WCHAR *pPrintProcessorName, DWORD Level, BYTE *pDatatypes, DWORD cbBuf, DWORD *pcbNeeded, DWORD *pcReturned)
-{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
-}
-
DWORD
_RpcResetPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR *pDatatype, WINSPOOL_DEVMODE_CONTAINER *pDevModeContainer)
{
spec2def(winspool.drv winspool.spec ADD_IMPORTLIB)
list(APPEND SOURCE
+ jobs.c
main.c
precomp.h
+ printers.c
+ printprocessors.c
${CMAKE_CURRENT_BINARY_DIR}/winspool_c.c)
add_library(winspool SHARED
--- /dev/null
+/*
+ * PROJECT: ReactOS Spooler API
+ * LICENSE: GNU LGPL v2.1 or any later version as published by the Free Software Foundation
+ * PURPOSE: Functions for managing print jobs
+ * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
+ */
+
+#include "precomp.h"
+
+BOOL WINAPI
+AddJob(HANDLE hPrinter, DWORD Level, LPBYTE pData, DWORD cbBuf, LPDWORD pcbNeeded)
+{
+ BOOL bReturnValue = FALSE;
+ DWORD dwErrorCode;
+
+ // Do the RPC call
+ RpcTryExcept
+ {
+ dwErrorCode = _RpcAddJob(hPrinter, Level, pData, cbBuf, pcbNeeded);
+ if (dwErrorCode)
+ {
+ ERR("_RpcAddJob failed with error %lu!\n", dwErrorCode);
+ }
+
+ bReturnValue = (dwErrorCode == ERROR_SUCCESS);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ERR("_RpcAddJob failed with exception code %lu!\n", RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return bReturnValue;
+}
+
+BOOL WINAPI
+GetJob(HANDLE hPrinter, DWORD JobId, DWORD Level, LPBYTE pJob, DWORD cbBuf, LPDWORD pcbNeeded)
+{
+ BOOL bReturnValue = FALSE;
+ DWORD dwErrorCode;
+
+ // Do the RPC call
+ RpcTryExcept
+ {
+ dwErrorCode = _RpcGetJob(hPrinter, JobId, Level, pJob, cbBuf, pcbNeeded);
+ if (dwErrorCode)
+ {
+ ERR("_RpcGetJob failed with error %lu!\n", dwErrorCode);
+ }
+
+ bReturnValue = (dwErrorCode == ERROR_SUCCESS);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ERR("_RpcGetJob failed with exception code %lu!\n", RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return bReturnValue;
+}
HeapFree(GetProcessHeap(), 0, ptr);
}
-BOOL WINAPI
-ClosePrinter(HANDLE hPrinter)
-{
- return FALSE;
-}
-
-DWORD WINAPI
-DeviceCapabilitiesA(LPCSTR pDevice, LPCSTR pPort, WORD fwCapability, LPSTR pOutput, const DEVMODEA* pDevMode)
-{
- return 0;
-}
-
-DWORD WINAPI
-DeviceCapabilitiesW(LPCWSTR pDevice, LPCWSTR pPort, WORD fwCapability, LPWSTR pOutput, const DEVMODEW* pDevMode)
-{
- return 0;
-}
-
-LONG WINAPI
-DocumentPropertiesA(HWND hWnd, HANDLE hPrinter, LPSTR pDeviceName, PDEVMODEA pDevModeOutput, PDEVMODEA pDevModeInput, DWORD fMode)
-{
- return 0;
-}
-
-LONG WINAPI
-DocumentPropertiesW(HWND hWnd, HANDLE hPrinter, LPWSTR pDeviceName, PDEVMODEW pDevModeOutput, PDEVMODEW pDevModeInput, DWORD fMode)
-{
- return 0;
-}
-
-BOOL WINAPI
-EndDocPrinter(HANDLE hPrinter)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-EndPagePrinter(HANDLE hPrinter)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-EnumPrintersA(DWORD Flags, LPSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-EnumPrintersW(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-EnumPrintProcessorDatatypesA(LPSTR pName, LPSTR pPrintProcessorName, DWORD Level, LPBYTE pDatatypes, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-EnumPrintProcessorDatatypesW(LPWSTR pName, LPWSTR pPrintProcessorName, DWORD Level, LPBYTE pDatatypes, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-GetDefaultPrinterA(LPSTR pszBuffer, LPDWORD pcchBuffer)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-GetDefaultPrinterW(LPWSTR pszBuffer, LPDWORD pcchBuffer)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-GetPrinterA(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-GetPrintProcessorDirectoryW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-OpenPrinterA(LPSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSA pDefault)
-{
- BOOL ReturnValue = FALSE;
- PWSTR pwszPrinterName = NULL;
- PWSTR pwszDatatype = NULL;
- PRINTER_DEFAULTSW wDefault = { 0 };
- size_t StringLength;
-
- if (pPrinterName)
- {
- // Convert pPrinterName to a Unicode string pwszPrinterName
- StringLength = strlen(pPrinterName) + 1;
-
- pwszPrinterName = HeapAlloc(GetProcessHeap(), 0, StringLength * sizeof(WCHAR));
- if (!pwszPrinterName)
- {
- ERR("HeapAlloc failed for pwszPrinterName with last error %lu!\n", GetLastError());
- goto Cleanup;
- }
-
- MultiByteToWideChar(CP_ACP, 0, pPrinterName, -1, pwszPrinterName, StringLength);
- }
-
- if (pDefault)
- {
- wDefault.DesiredAccess = pDefault->DesiredAccess;
-
- if (pDefault->pDatatype)
- {
- // Convert pDefault->pDatatype to a Unicode string pwszDatatype that later becomes wDefault.pDatatype
- StringLength = strlen(pDefault->pDatatype) + 1;
-
- pwszDatatype = HeapAlloc(GetProcessHeap(), 0, StringLength * sizeof(WCHAR));
- if (!pwszDatatype)
- {
- ERR("HeapAlloc failed for pwszDatatype with last error %lu!\n", GetLastError());
- goto Cleanup;
- }
-
- MultiByteToWideChar(CP_ACP, 0, pDefault->pDatatype, -1, pwszDatatype, StringLength);
- wDefault.pDatatype = pwszDatatype;
- }
-
- if (pDefault->pDevMode)
- wDefault.pDevMode = GdiConvertToDevmodeW(pDefault->pDevMode);
- }
-
- ReturnValue = OpenPrinterW(pwszPrinterName, phPrinter, &wDefault);
-
-Cleanup:
- if (wDefault.pDevMode)
- HeapFree(GetProcessHeap(), 0, wDefault.pDevMode);
-
- if (pwszPrinterName)
- HeapFree(GetProcessHeap(), 0, pwszPrinterName);
-
- if (pwszDatatype)
- HeapFree(GetProcessHeap(), 0, pwszDatatype);
-
- return ReturnValue;
-}
-
-BOOL WINAPI
-OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
-{
- BOOL ReturnValue = FALSE;
- DWORD ErrorCode;
- PWSTR pDatatype = NULL;
- WINSPOOL_DEVMODE_CONTAINER DevModeContainer;
- WINSPOOL_DEVMODE_CONTAINER* pDevModeContainer = NULL;
- ACCESS_MASK AccessRequired = 0;
-
- // Prepare the additional parameters in the format required by _RpcOpenPrinter
- if (pDefault)
- {
- pDatatype = pDefault->pDatatype;
- DevModeContainer.cbBuf = sizeof(DEVMODEW);
- DevModeContainer.pDevMode = (BYTE*)pDefault->pDevMode;
- pDevModeContainer = &DevModeContainer;
- AccessRequired = pDefault->DesiredAccess;
- }
-
- // Do the RPC call
- RpcTryExcept
- {
- ErrorCode = _RpcOpenPrinter(pPrinterName, phPrinter, pDatatype, pDevModeContainer, AccessRequired);
- if (ErrorCode)
- {
- ERR("_RpcOpenPrinter failed with error %lu!\n", ErrorCode);
- }
-
- ReturnValue = (ErrorCode == ERROR_SUCCESS);
- }
- RpcExcept(EXCEPTION_EXECUTE_HANDLER)
- {
- ERR("_RpcOpenPrinter failed with exception code %lu!\n", RpcExceptionCode());
- }
- RpcEndExcept;
-
- return ReturnValue;
-}
-
BOOL WINAPI
SpoolerInit()
{
return ReturnValue;
}
-
-DWORD WINAPI
-StartDocPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pDocInfo)
-{
- return 0;
-}
-
-BOOL WINAPI
-StartPagePrinter(HANDLE hPrinter)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-WritePrinter(HANDLE hPrinter, LPVOID pBuf, DWORD cbBuf, LPDWORD pcWritten)
-{
- return FALSE;
-}
-
-BOOL WINAPI
-XcvDataW(HANDLE hXcv, PCWSTR pszDataName, PBYTE pInputData, DWORD cbInputData, PBYTE pOutputData, DWORD cbOutputData, PDWORD pcbOutputNeeded, PDWORD pdwStatus)
-{
- return FALSE;
-}
--- /dev/null
+/*
+ * PROJECT: ReactOS Spooler API
+ * LICENSE: GNU LGPL v2.1 or any later version as published by the Free Software Foundation
+ * PURPOSE: Functions related to Printers and printing
+ * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
+ */
+
+#include "precomp.h"
+
+BOOL WINAPI
+EnumPrintersA(DWORD Flags, LPSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+EnumPrintersW(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
+{
+ BOOL bReturnValue = FALSE;
+ DWORD dwErrorCode;
+
+ // Do the RPC call
+ RpcTryExcept
+ {
+ dwErrorCode = _RpcEnumPrinters(Flags, Name, Level, pPrinterEnum, cbBuf, pcbNeeded, pcReturned);
+ if (dwErrorCode)
+ {
+ ERR("_RpcEnumPrinters failed with error %lu!\n", dwErrorCode);
+ }
+
+ bReturnValue = (dwErrorCode == ERROR_SUCCESS);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ERR("_RpcEnumPrinters failed with exception code %lu!\n", RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return bReturnValue;
+}
+
+BOOL WINAPI
+ClosePrinter(HANDLE hPrinter)
+{
+ return FALSE;
+}
+
+DWORD WINAPI
+DeviceCapabilitiesA(LPCSTR pDevice, LPCSTR pPort, WORD fwCapability, LPSTR pOutput, const DEVMODEA* pDevMode)
+{
+ return 0;
+}
+
+DWORD WINAPI
+DeviceCapabilitiesW(LPCWSTR pDevice, LPCWSTR pPort, WORD fwCapability, LPWSTR pOutput, const DEVMODEW* pDevMode)
+{
+ return 0;
+}
+
+LONG WINAPI
+DocumentPropertiesA(HWND hWnd, HANDLE hPrinter, LPSTR pDeviceName, PDEVMODEA pDevModeOutput, PDEVMODEA pDevModeInput, DWORD fMode)
+{
+ return 0;
+}
+
+LONG WINAPI
+DocumentPropertiesW(HWND hWnd, HANDLE hPrinter, LPWSTR pDeviceName, PDEVMODEW pDevModeOutput, PDEVMODEW pDevModeInput, DWORD fMode)
+{
+ return 0;
+}
+
+BOOL WINAPI
+EndDocPrinter(HANDLE hPrinter)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+EndPagePrinter(HANDLE hPrinter)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+GetDefaultPrinterA(LPSTR pszBuffer, LPDWORD pcchBuffer)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+GetDefaultPrinterW(LPWSTR pszBuffer, LPDWORD pcchBuffer)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+GetPrinterA(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+OpenPrinterA(LPSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSA pDefault)
+{
+ BOOL bReturnValue = FALSE;
+ PWSTR pwszPrinterName = NULL;
+ PWSTR pwszDatatype = NULL;
+ PRINTER_DEFAULTSW wDefault = { 0 };
+ size_t StringLength;
+
+ if (pPrinterName)
+ {
+ // Convert pPrinterName to a Unicode string pwszPrinterName
+ StringLength = strlen(pPrinterName) + 1;
+
+ pwszPrinterName = HeapAlloc(GetProcessHeap(), 0, StringLength * sizeof(WCHAR));
+ if (!pwszPrinterName)
+ {
+ ERR("HeapAlloc failed for pwszPrinterName with last error %lu!\n", GetLastError());
+ goto Cleanup;
+ }
+
+ MultiByteToWideChar(CP_ACP, 0, pPrinterName, -1, pwszPrinterName, StringLength);
+ }
+
+ if (pDefault)
+ {
+ wDefault.DesiredAccess = pDefault->DesiredAccess;
+
+ if (pDefault->pDatatype)
+ {
+ // Convert pDefault->pDatatype to a Unicode string pwszDatatype that later becomes wDefault.pDatatype
+ StringLength = strlen(pDefault->pDatatype) + 1;
+
+ pwszDatatype = HeapAlloc(GetProcessHeap(), 0, StringLength * sizeof(WCHAR));
+ if (!pwszDatatype)
+ {
+ ERR("HeapAlloc failed for pwszDatatype with last error %lu!\n", GetLastError());
+ goto Cleanup;
+ }
+
+ MultiByteToWideChar(CP_ACP, 0, pDefault->pDatatype, -1, pwszDatatype, StringLength);
+ wDefault.pDatatype = pwszDatatype;
+ }
+
+ if (pDefault->pDevMode)
+ wDefault.pDevMode = GdiConvertToDevmodeW(pDefault->pDevMode);
+ }
+
+ bReturnValue = OpenPrinterW(pwszPrinterName, phPrinter, &wDefault);
+
+Cleanup:
+ if (wDefault.pDevMode)
+ HeapFree(GetProcessHeap(), 0, wDefault.pDevMode);
+
+ if (pwszPrinterName)
+ HeapFree(GetProcessHeap(), 0, pwszPrinterName);
+
+ if (pwszDatatype)
+ HeapFree(GetProcessHeap(), 0, pwszDatatype);
+
+ return bReturnValue;
+}
+
+BOOL WINAPI
+OpenPrinterW(LPWSTR pPrinterName, LPHANDLE phPrinter, LPPRINTER_DEFAULTSW pDefault)
+{
+ BOOL bReturnValue = FALSE;
+ DWORD dwErrorCode;
+ PWSTR pDatatype = NULL;
+ WINSPOOL_DEVMODE_CONTAINER DevModeContainer;
+ WINSPOOL_DEVMODE_CONTAINER* pDevModeContainer = NULL;
+ ACCESS_MASK AccessRequired = 0;
+
+ // Prepare the additional parameters in the format required by _RpcOpenPrinter
+ if (pDefault)
+ {
+ pDatatype = pDefault->pDatatype;
+ DevModeContainer.cbBuf = sizeof(DEVMODEW);
+ DevModeContainer.pDevMode = (BYTE*)pDefault->pDevMode;
+ pDevModeContainer = &DevModeContainer;
+ AccessRequired = pDefault->DesiredAccess;
+ }
+
+ // Do the RPC call
+ RpcTryExcept
+ {
+ dwErrorCode = _RpcOpenPrinter(pPrinterName, phPrinter, pDatatype, pDevModeContainer, AccessRequired);
+ if (dwErrorCode)
+ {
+ ERR("_RpcOpenPrinter failed with error %lu!\n", dwErrorCode);
+ }
+
+ bReturnValue = (dwErrorCode == ERROR_SUCCESS);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ERR("_RpcOpenPrinter failed with exception code %lu!\n", RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return bReturnValue;
+}
+
+DWORD WINAPI
+StartDocPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pDocInfo)
+{
+ return 0;
+}
+
+BOOL WINAPI
+StartPagePrinter(HANDLE hPrinter)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+WritePrinter(HANDLE hPrinter, LPVOID pBuf, DWORD cbBuf, LPDWORD pcWritten)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+XcvDataW(HANDLE hXcv, PCWSTR pszDataName, PBYTE pInputData, DWORD cbInputData, PBYTE pOutputData, DWORD cbOutputData, PDWORD pcbOutputNeeded, PDWORD pdwStatus)
+{
+ return FALSE;
+}
--- /dev/null
+/*
+ * PROJECT: ReactOS Spooler API
+ * LICENSE: GNU LGPL v2.1 or any later version as published by the Free Software Foundation
+ * PURPOSE: Functions related to Print Processors
+ * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
+ */
+
+#include "precomp.h"
+
+BOOL WINAPI
+EnumPrintProcessorDatatypesA(LPSTR pName, LPSTR pPrintProcessorName, DWORD Level, LPBYTE pDatatypes, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
+{
+ return FALSE;
+}
+
+BOOL WINAPI
+EnumPrintProcessorDatatypesW(LPWSTR pName, LPWSTR pPrintProcessorName, DWORD Level, LPBYTE pDatatypes, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
+{
+ BOOL bReturnValue = FALSE;
+ DWORD dwErrorCode;
+
+ // Do the RPC call
+ RpcTryExcept
+ {
+ dwErrorCode = _RpcEnumPrintProcessorDatatypes(pName, pPrintProcessorName, Level, pDatatypes, cbBuf, pcbNeeded, pcReturned);
+ if (dwErrorCode)
+ {
+ ERR("_RpcEnumPrintProcessorDatatypes failed with error %lu!\n", dwErrorCode);
+ }
+
+ bReturnValue = (dwErrorCode == ERROR_SUCCESS);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ERR("_RpcEnumPrintProcessorDatatypes failed with exception code %lu!\n", RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return bReturnValue;
+}
+
+BOOL WINAPI
+EnumPrintProcessorsW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
+{
+ BOOL bReturnValue = FALSE;
+ DWORD dwErrorCode;
+
+ // Do the RPC call
+ RpcTryExcept
+ {
+ dwErrorCode = _RpcEnumPrintProcessors(pName, pEnvironment, Level, pPrintProcessorInfo, cbBuf, pcbNeeded, pcReturned);
+ if (dwErrorCode)
+ {
+ ERR("_RpcEnumPrintProcessors failed with error %lu!\n", dwErrorCode);
+ }
+
+ bReturnValue = (dwErrorCode == ERROR_SUCCESS);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ERR("_RpcEnumPrintProcessors failed with exception code %lu!\n", RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return bReturnValue;
+}
+
+BOOL WINAPI
+GetPrintProcessorDirectoryW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded)
+{
+ BOOL bReturnValue = FALSE;
+ DWORD dwErrorCode;
+
+ // Do the RPC call
+ RpcTryExcept
+ {
+ dwErrorCode = _RpcGetPrintProcessorDirectory(pName, pEnvironment, Level, pPrintProcessorInfo, cbBuf, pcbNeeded);
+ if (dwErrorCode)
+ {
+ ERR("_RpcGetPrintProcessorDirectory failed with error %lu!\n", dwErrorCode);
+ }
+
+ bReturnValue = (dwErrorCode == ERROR_SUCCESS);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ ERR("_RpcGetPrintProcessorDirectory failed with exception code %lu!\n", RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return bReturnValue;
+}
109 stub AddFormA
110 stub AddFormW
111 stub AddJobA
-112 stub AddJobW
+112 stdcall AddJobW(long long ptr long ptr)
113 stub AddMonitorA
114 stub AddMonitorW
115 stub AddPortA
191 stdcall EnumPrintProcessorDatatypesA(ptr ptr long ptr long ptr ptr)
192 stdcall EnumPrintProcessorDatatypesW(ptr ptr long ptr long ptr ptr)
193 stub EnumPrintProcessorsA
-194 stub EnumPrintProcessorsW
+194 stdcall EnumPrintProcessorsW(ptr ptr long ptr long ptr ptr)
195 stub EnumPrinterDataA
196 stub EnumPrinterDataExA
197 stub EnumPrinterDataExW
242 stub GetFormA
243 stub GetFormW
244 stub GetJobA
-245 stub GetJobW
+245 stdcall GetJobW(long long long ptr long ptr)
246 stub GetPrintProcessorDirectoryA
247 stdcall GetPrintProcessorDirectoryW(wstr wstr long ptr long ptr)
248 stdcall GetPrinterA(long long ptr long ptr)