mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
[SPOOLSS] [SPOOLSV] [WINSPOOL]
- 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
This commit is contained in:
parent
9be537abb7
commit
5df5a009e2
18 changed files with 747 additions and 385 deletions
|
@ -3,9 +3,12 @@ spec2def(spoolss.dll spoolss.spec ADD_IMPORTLIB)
|
|||
|
||||
list(APPEND SOURCE
|
||||
context.c
|
||||
jobs.c
|
||||
main.c
|
||||
memory.c
|
||||
precomp.h
|
||||
printers.c
|
||||
printprocessors.c
|
||||
tools.c)
|
||||
|
||||
add_library(spoolss SHARED
|
||||
|
|
20
reactos/win32ss/printing/base/spoolss/jobs.c
Normal file
20
reactos/win32ss/printing/base/spoolss/jobs.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
|
@ -11,12 +11,6 @@ HANDLE hProcessHeap;
|
|||
PRINTPROVIDOR LocalSplFuncs;
|
||||
|
||||
|
||||
BOOL WINAPI
|
||||
ClosePrinter(HANDLE hPrinter)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
|
@ -31,42 +25,6 @@ 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)
|
||||
{
|
||||
|
@ -98,18 +56,6 @@ 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)
|
||||
{
|
||||
|
@ -154,21 +100,3 @@ SpoolerInit()
|
|||
// 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;
|
||||
}
|
||||
|
|
|
@ -26,5 +26,6 @@ typedef BOOL (WINAPI *PInitializePrintProvidor)(LPPRINTPROVIDOR, DWORD, LPWSTR);
|
|||
|
||||
// main.c
|
||||
extern HANDLE hProcessHeap;
|
||||
extern PRINTPROVIDOR LocalSplFuncs;
|
||||
|
||||
#endif
|
||||
|
|
75
reactos/win32ss/printing/base/spoolss/printers.c
Normal file
75
reactos/win32ss/printing/base/spoolss/printers.c
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
26
reactos/win32ss/printing/base/spoolss/printprocessors.c
Normal file
26
reactos/win32ss/printing/base/spoolss/printprocessors.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
@ stub AbortPrinter
|
||||
@ stub AddDriverCatalog
|
||||
@ stub AddFormW
|
||||
@ stub AddJobW
|
||||
@ stdcall AddJobW(long long ptr long ptr)
|
||||
@ stub AddMonitorW
|
||||
@ stub AddPerMachineConnectionW
|
||||
@ stub AddPortExW
|
||||
|
@ -68,8 +68,8 @@
|
|||
@ 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
|
||||
|
@ -78,7 +78,7 @@
|
|||
@ stub GetClientUserHandle
|
||||
@ stub GetFormW
|
||||
@ stub GetJobAttributes
|
||||
@ stub GetJobW
|
||||
@ stdcall GetJobW(long long long ptr long ptr)
|
||||
@ stub GetNetworkId
|
||||
@ stub GetPrinterDataExW
|
||||
@ stub GetPrinterDataW
|
||||
|
|
|
@ -4,10 +4,13 @@ add_rpc_files(server ${REACTOS_SOURCE_DIR}/include/reactos/idl/winspool.idl)
|
|||
|
||||
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)
|
||||
|
|
68
reactos/win32ss/printing/base/spoolsv/jobs.c
Normal file
68
reactos/win32ss/printing/base/spoolsv/jobs.c
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
59
reactos/win32ss/printing/base/spoolsv/printers.c
Normal file
59
reactos/win32ss/printing/base/spoolsv/printers.c
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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();
|
||||
}
|
84
reactos/win32ss/printing/base/spoolsv/printprocessors.c
Normal file
84
reactos/win32ss/printing/base/spoolsv/printprocessors.c
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* 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();
|
||||
}
|
|
@ -7,34 +7,6 @@
|
|||
|
||||
#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)
|
||||
{
|
||||
|
@ -105,27 +77,6 @@ _RpcDeletePrinterDriver(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pDriv
|
|||
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)
|
||||
{
|
||||
|
@ -175,20 +126,6 @@ _RpcEndDocPrinter(WINSPOOL_PRINTER_HANDLE hPrinter)
|
|||
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)
|
||||
{
|
||||
|
@ -364,13 +301,6 @@ _RpcDeletePrintProvidor(WINSPOOL_HANDLE pName, WCHAR *pEnvironment, WCHAR *pPrin
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -4,8 +4,11 @@ add_rpc_files(client ${REACTOS_SOURCE_DIR}/include/reactos/idl/winspool.idl)
|
|||
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
|
||||
|
|
60
reactos/win32ss/printing/base/winspool/jobs.c
Normal file
60
reactos/win32ss/printing/base/winspool/jobs.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
|
@ -65,217 +65,6 @@ midl_user_free(void __RPC_FAR* ptr)
|
|||
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()
|
||||
{
|
||||
|
@ -301,27 +90,3 @@ 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;
|
||||
}
|
||||
|
|
245
reactos/win32ss/printing/base/winspool/printers.c
Normal file
245
reactos/win32ss/printing/base/winspool/printers.c
Normal file
|
@ -0,0 +1,245 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
92
reactos/win32ss/printing/base/winspool/printprocessors.c
Normal file
92
reactos/win32ss/printing/base/winspool/printprocessors.c
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
|
@ -10,7 +10,7 @@
|
|||
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
|
||||
|
@ -92,7 +92,7 @@
|
|||
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
|
||||
|
@ -143,7 +143,7 @@
|
|||
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)
|
||||
|
|
Loading…
Reference in a new issue