mirror of
https://github.com/reactos/reactos.git
synced 2024-09-27 21:16:34 +00:00
[Printing] Update and Add Functions
Fix and Update WinSpool.idl. Start forwards to LocalSpl.
This commit is contained in:
parent
a77a65ab6d
commit
89e716a7f7
|
@ -834,11 +834,11 @@ typedef [switch_type(DWORD)] union _WINSPOOL_V2_UREPLY_PRINTER
|
|||
}
|
||||
WINSPOOL_V2_UREPLY_PRINTER;
|
||||
|
||||
typedef struct _WINSPOOL_FILE_INFO
|
||||
typedef struct _WINSPOOL_FILE_INFO_1
|
||||
{
|
||||
BOOL bInheritHandle;
|
||||
HANDLE hSpoolFileHandle;
|
||||
DWORD dwOptions;
|
||||
BOOL bInheritHandle;
|
||||
WINSPOOL_HANDLE hSpoolFileHandle;
|
||||
DWORD dwOptions;
|
||||
}
|
||||
WINSPOOL_FILE_INFO_1;
|
||||
|
||||
|
@ -1575,22 +1575,50 @@ interface winspool {
|
|||
/* TODO */
|
||||
);
|
||||
|
||||
/* Function 0x5B (TODO) */
|
||||
/* Function 0x5B */
|
||||
DWORD _RpcGetSpoolFileInfo(
|
||||
/* TODO */
|
||||
[in] WINSPOOL_PRINTER_HANDLE hPrinter,
|
||||
[in] WINSPOOL_HANDLE hProcessHandle,
|
||||
[in] DWORD Level,
|
||||
[in] WINSPOOL_FILE_INFO_1* pFileInfo,
|
||||
[in] DWORD dwSize,
|
||||
[in] DWORD* dwNeeded
|
||||
);
|
||||
|
||||
/* Function 0x5C (TODO) */
|
||||
/* Function 0x5C */
|
||||
DWORD _RpcCommitSpoolData(
|
||||
/* TODO */
|
||||
[in] WINSPOOL_PRINTER_HANDLE hPrinter,
|
||||
[in] WINSPOOL_HANDLE hProcessHandle,
|
||||
[in] DWORD cbCommit,
|
||||
[in] DWORD Level,
|
||||
[in] WINSPOOL_FILE_INFO_1* pFileInfo,
|
||||
[in] DWORD dwSize,
|
||||
[in] DWORD* dwNeeded
|
||||
);
|
||||
|
||||
/* Function 0x5D (TODO) */
|
||||
DWORD _RpcCloseSpoolFileHandle(
|
||||
/* TODO */
|
||||
/* Function 0x5D */
|
||||
DWORD _RpcGetSpoolFileInfo2(
|
||||
[in] WINSPOOL_PRINTER_HANDLE hPrinter,
|
||||
[in] DWORD dwProcessId,
|
||||
[in] DWORD Level,
|
||||
[in] WINSPOOL_FILE_INFO_CONTAINER* pFileInfoContainer
|
||||
);
|
||||
|
||||
/* Function 0x5E */
|
||||
DWORD _RpcCommitSpoolData2(
|
||||
[in] WINSPOOL_PRINTER_HANDLE hPrinter,
|
||||
[in] DWORD dwProcessId,
|
||||
[in] DWORD cbCommit,
|
||||
[in] DWORD Level,
|
||||
[in] WINSPOOL_FILE_INFO_CONTAINER* pFileInfoContainer
|
||||
);
|
||||
|
||||
/* Function 0x5F */
|
||||
DWORD _RpcCloseSpoolFileHandle(
|
||||
[in] WINSPOOL_PRINTER_HANDLE hPrinter
|
||||
);
|
||||
|
||||
/* Function 0x60 */
|
||||
DWORD _RpcFlushPrinter(
|
||||
[in] WINSPOOL_PRINTER_HANDLE hPrinter,
|
||||
[in, size_is(cbBuf)] BYTE* pBuf,
|
||||
|
@ -1599,7 +1627,7 @@ interface winspool {
|
|||
[in] DWORD cSleep
|
||||
);
|
||||
|
||||
/* Function 0x5F */
|
||||
/* Function 0x61 */
|
||||
DWORD _RpcSendRecvBidiData(
|
||||
[in] WINSPOOL_PRINTER_HANDLE hPrinter,
|
||||
[in, string, unique] const WCHAR* pAction,
|
||||
|
@ -1607,7 +1635,7 @@ interface winspool {
|
|||
[out] WINSPOOL_BIDI_RESPONSE_CONTAINER** ppRespData
|
||||
);
|
||||
|
||||
/* Function 0x60 (TODO) */
|
||||
/* Function 0x62 (TODO) */
|
||||
DWORD _RpcAddDriverCatalog(
|
||||
/* TODO */
|
||||
);
|
||||
|
|
|
@ -12,6 +12,7 @@ list(APPEND SOURCE
|
|||
printerdata.c
|
||||
printers.c
|
||||
printprocessors.c
|
||||
spoolfile.c
|
||||
tools.c)
|
||||
|
||||
list(APPEND PCH_SKIP_SOURCE
|
||||
|
|
|
@ -52,4 +52,12 @@ SPOOLSS_PRINTER_HANDLE, *PSPOOLSS_PRINTER_HANDLE;
|
|||
extern HANDLE hProcessHeap;
|
||||
extern LIST_ENTRY PrintProviderList;
|
||||
|
||||
// spoolfile.c
|
||||
typedef struct _FILE_INFO_1
|
||||
{
|
||||
BOOL bInheritHandle;
|
||||
HANDLE hSpoolFileHandle;
|
||||
DWORD dwOptions;
|
||||
} FILE_INFO_1, *PFILE_INFO_1;
|
||||
|
||||
#endif
|
||||
|
|
88
win32ss/printing/base/spoolss/spoolfile.c
Normal file
88
win32ss/printing/base/spoolss/spoolfile.c
Normal file
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Spooler Router
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: Functions related to Spool File
|
||||
* COPYRIGHT: Copyright 1998-2022 ReactOS
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
BOOL WINAPI
|
||||
SplGetSpoolFileInfo(
|
||||
HANDLE hPrinter,
|
||||
HANDLE hProcessHandle,
|
||||
DWORD Level,
|
||||
PFILE_INFO_1 pFileInfo,
|
||||
DWORD dwSize,
|
||||
DWORD* dwNeeded )
|
||||
{
|
||||
BOOL Ret;
|
||||
HANDLE hHandle, hSourceProcessHandle;
|
||||
PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
|
||||
|
||||
// Sanity checks.
|
||||
if (!pHandle)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hSourceProcessHandle = GetCurrentProcess();
|
||||
|
||||
// No Local? Ok, what ever...
|
||||
|
||||
Ret = pHandle->pPrintProvider->PrintProvider.fpGetSpoolFileInfo( pHandle->hPrinter,
|
||||
NULL,
|
||||
&hHandle,
|
||||
hProcessHandle,
|
||||
hSourceProcessHandle );
|
||||
if ( Ret )
|
||||
{
|
||||
pFileInfo->hSpoolFileHandle = hHandle;
|
||||
pFileInfo->bInheritHandle = TRUE;
|
||||
pFileInfo->dwOptions = DUPLICATE_CLOSE_SOURCE;
|
||||
}
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
SplCommitSpoolData(
|
||||
HANDLE hPrinter,
|
||||
HANDLE hProcessHandle,
|
||||
DWORD cbCommit,
|
||||
DWORD Level,
|
||||
PFILE_INFO_1 pFileInfo,
|
||||
DWORD dwSize,
|
||||
DWORD* dwNeeded )
|
||||
{
|
||||
PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
|
||||
|
||||
// Sanity checks.
|
||||
if (!pHandle)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pFileInfo->hSpoolFileHandle = INVALID_HANDLE_VALUE;
|
||||
pFileInfo->bInheritHandle = TRUE;
|
||||
pFileInfo->dwOptions = DUPLICATE_CLOSE_SOURCE;
|
||||
|
||||
return pHandle->pPrintProvider->PrintProvider.fpCommitSpoolData( hPrinter, cbCommit );
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
SplCloseSpoolFileHandle( HANDLE hPrinter )
|
||||
{
|
||||
PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
|
||||
|
||||
// Sanity checks.
|
||||
if (!pHandle)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return pHandle->pPrintProvider->PrintProvider.fpCloseSpoolFileHandle( pHandle->hPrinter );
|
||||
}
|
|
@ -142,10 +142,10 @@
|
|||
@ stdcall SetPrinterDataExW(long wstr wstr long ptr long)
|
||||
@ stdcall SetPrinterDataW(long wstr long ptr long)
|
||||
@ stub SetPrinterW
|
||||
@ stub SplCloseSpoolFileHandle
|
||||
@ stub SplCommitSpoolData
|
||||
@ stdcall SplCloseSpoolFileHandle(ptr)
|
||||
@ stdcall SplCommitSpoolData(ptr ptr long long ptr long ptr)
|
||||
@ stub SplDriverUnloadComplete
|
||||
@ stub SplGetSpoolFileInfo
|
||||
@ stdcall SplGetSpoolFileInfo(ptr ptr long ptr long ptr)
|
||||
@ stdcall SplInitializeWinSpoolDrv(ptr)
|
||||
@ stub SplIsSessionZero
|
||||
@ stdcall SplIsUpgrade()
|
||||
|
|
|
@ -18,6 +18,7 @@ list(APPEND SOURCE
|
|||
printproviders.c
|
||||
rpcserver.c
|
||||
rpcstubs.c
|
||||
spoolfile.c
|
||||
xcv.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/winspool_s.c)
|
||||
|
||||
|
|
|
@ -28,4 +28,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(spoolsv);
|
|||
// rpcserver.c
|
||||
DWORD WINAPI LrpcThreadProc(LPVOID lpParameter);
|
||||
|
||||
// spoolfile.c
|
||||
BOOL WINAPI
|
||||
SplGetSpoolFileInfo(
|
||||
HANDLE hPrinter,
|
||||
HANDLE hProcessHandle,
|
||||
DWORD Level,
|
||||
WINSPOOL_FILE_INFO_1 *pFileInfo,
|
||||
DWORD dwSize,
|
||||
DWORD* dwNeeded );
|
||||
|
||||
BOOL WINAPI
|
||||
SplCommitSpoolData(
|
||||
HANDLE hPrinter,
|
||||
HANDLE hProcessHandle,
|
||||
DWORD cbCommit,
|
||||
DWORD Level,
|
||||
WINSPOOL_FILE_INFO_1 *pFileInfo,
|
||||
DWORD dwSize,
|
||||
DWORD* dwNeeded );
|
||||
|
||||
BOOL WINAPI
|
||||
SplCloseSpoolFileHandle( HANDLE hPrinter );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -105,27 +105,6 @@ _RpcSplOpenPrinter(VOID)
|
|||
return ERROR_INVALID_FUNCTION;
|
||||
}
|
||||
|
||||
DWORD
|
||||
_RpcGetSpoolFileInfo(VOID)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return ERROR_INVALID_FUNCTION;
|
||||
}
|
||||
|
||||
DWORD
|
||||
_RpcCommitSpoolData(VOID)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return ERROR_INVALID_FUNCTION;
|
||||
}
|
||||
|
||||
DWORD
|
||||
_RpcCloseSpoolFileHandle(VOID)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return ERROR_INVALID_FUNCTION;
|
||||
}
|
||||
|
||||
DWORD
|
||||
_RpcSendRecvBidiData(WINSPOOL_PRINTER_HANDLE hPrinter, const WCHAR* pAction, WINSPOOL_BIDI_REQUEST_CONTAINER* pReqData, WINSPOOL_BIDI_RESPONSE_CONTAINER** ppRespData)
|
||||
{
|
||||
|
|
120
win32ss/printing/base/spoolsv/spoolfile.c
Normal file
120
win32ss/printing/base/spoolsv/spoolfile.c
Normal file
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Print Spooler Service
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: Spool File RPC calls
|
||||
* COPYRIGHT: Copyright 2020 ReactOS
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
DWORD
|
||||
_RpcGetSpoolFileInfo( WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_HANDLE hProcessHandle, DWORD Level, WINSPOOL_FILE_INFO_1* pFileInfo, DWORD dwSize, DWORD* dwNeeded )
|
||||
{
|
||||
DWORD dwErrorCode;
|
||||
|
||||
dwErrorCode = RpcImpersonateClient(NULL);
|
||||
if (dwErrorCode != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
|
||||
return dwErrorCode;
|
||||
}
|
||||
|
||||
if (!SplGetSpoolFileInfo( hPrinter, hProcessHandle, Level, pFileInfo, dwSize, dwNeeded ) )
|
||||
dwErrorCode = GetLastError();
|
||||
|
||||
RpcRevertToSelf();
|
||||
return dwErrorCode;
|
||||
}
|
||||
|
||||
DWORD
|
||||
_RpcCommitSpoolData( WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_HANDLE hProcessHandle, DWORD cbCommit, DWORD Level, WINSPOOL_FILE_INFO_1* pFileInfo, DWORD dwSize, DWORD* dwNeeded )
|
||||
{
|
||||
DWORD dwErrorCode;
|
||||
|
||||
dwErrorCode = RpcImpersonateClient(NULL);
|
||||
if (dwErrorCode != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
|
||||
return dwErrorCode;
|
||||
}
|
||||
|
||||
if (!SplCommitSpoolData( hPrinter, hProcessHandle, cbCommit, Level, pFileInfo, dwSize, dwNeeded ) )
|
||||
dwErrorCode = GetLastError();
|
||||
|
||||
RpcRevertToSelf();
|
||||
return dwErrorCode;
|
||||
}
|
||||
|
||||
DWORD
|
||||
_RpcGetSpoolFileInfo2( WINSPOOL_PRINTER_HANDLE hPrinter, DWORD dwProcessId, DWORD Level, WINSPOOL_FILE_INFO_CONTAINER* pFileInfoContainer )
|
||||
{
|
||||
DWORD dwErrorCode, dwNeeded = 0;
|
||||
HANDLE hProcessHandle;
|
||||
|
||||
dwErrorCode = RpcImpersonateClient(NULL);
|
||||
if (dwErrorCode != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
|
||||
return dwErrorCode;
|
||||
}
|
||||
|
||||
hProcessHandle = OpenProcess( PROCESS_DUP_HANDLE, FALSE, dwProcessId );
|
||||
|
||||
|
||||
if (!SplGetSpoolFileInfo( hPrinter, hProcessHandle, Level, pFileInfoContainer->FileInfo.pFileInfo1, sizeof(WINSPOOL_FILE_INFO_1), &dwNeeded ) )
|
||||
dwErrorCode = GetLastError();
|
||||
|
||||
if ( hProcessHandle )
|
||||
{
|
||||
CloseHandle( hProcessHandle );
|
||||
}
|
||||
|
||||
RpcRevertToSelf();
|
||||
return dwErrorCode;
|
||||
}
|
||||
|
||||
DWORD
|
||||
_RpcCommitSpoolData2( WINSPOOL_PRINTER_HANDLE hPrinter, DWORD dwProcessId, DWORD cbCommit, DWORD Level, WINSPOOL_FILE_INFO_CONTAINER* pFileInfoContainer )
|
||||
{
|
||||
DWORD dwErrorCode, dwNeeded = 0;
|
||||
HANDLE hProcessHandle;
|
||||
|
||||
dwErrorCode = RpcImpersonateClient(NULL);
|
||||
if (dwErrorCode != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
|
||||
return dwErrorCode;
|
||||
}
|
||||
|
||||
hProcessHandle = OpenProcess( PROCESS_DUP_HANDLE, FALSE, dwProcessId );
|
||||
|
||||
if (!SplCommitSpoolData( hPrinter, hProcessHandle, cbCommit, Level, pFileInfoContainer->FileInfo.pFileInfo1, sizeof(WINSPOOL_FILE_INFO_1), &dwNeeded ) )
|
||||
dwErrorCode = GetLastError();
|
||||
|
||||
if ( hProcessHandle )
|
||||
{
|
||||
CloseHandle( hProcessHandle );
|
||||
}
|
||||
|
||||
RpcRevertToSelf();
|
||||
return dwErrorCode;
|
||||
}
|
||||
|
||||
DWORD
|
||||
_RpcCloseSpoolFileHandle( WINSPOOL_PRINTER_HANDLE hPrinter )
|
||||
{
|
||||
DWORD dwErrorCode;
|
||||
|
||||
dwErrorCode = RpcImpersonateClient(NULL);
|
||||
if (dwErrorCode != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
|
||||
return dwErrorCode;
|
||||
}
|
||||
|
||||
if (!SplCloseSpoolFileHandle( hPrinter ) )
|
||||
dwErrorCode = GetLastError();
|
||||
|
||||
RpcRevertToSelf();
|
||||
return dwErrorCode;
|
||||
}
|
|
@ -172,7 +172,7 @@
|
|||
271 stdcall ResetPrinterA(ptr ptr)
|
||||
272 stdcall ResetPrinterW(ptr ptr)
|
||||
273 stdcall ScheduleJob(ptr long)
|
||||
274 stub SeekPrinter
|
||||
274 stdcall -stub SeekPrinter(ptr int64 ptr long long)
|
||||
275 stub SetAllocFailCount
|
||||
276 stdcall SetFormA(ptr str long str)
|
||||
277 stdcall SetFormW(ptr str long str)
|
||||
|
|
|
@ -14,6 +14,7 @@ list(APPEND SOURCE
|
|||
printers.c
|
||||
printingthread.c
|
||||
printprocessors.c
|
||||
spoolfile.c
|
||||
tools.c)
|
||||
|
||||
add_library(localspl MODULE
|
||||
|
|
|
@ -112,9 +112,9 @@ static const PRINTPROVIDOR _PrintProviderFunctions = {
|
|||
NULL, // fpAddPrinterDriverEx
|
||||
NULL, // fpSplReadPrinter
|
||||
NULL, // fpDriverUnloadComplete
|
||||
NULL, // fpGetSpoolFileInfo
|
||||
NULL, // fpCommitSpoolData
|
||||
NULL, // fpCloseSpoolFileHandle
|
||||
LocalGetSpoolFileInfo, // fpGetSpoolFileInfo
|
||||
LocalCommitSpoolData, // fpCommitSpoolData
|
||||
LocalCloseSpoolFileHandle, // fpCloseSpoolFileHandle
|
||||
NULL, // fpFlushPrinter
|
||||
NULL, // fpSendRecvBidiData
|
||||
NULL, // fpAddDriverCatalog
|
||||
|
|
|
@ -316,6 +316,11 @@ BOOL WINAPI LocalEnumPrintProcessorDatatypes(LPWSTR pName, LPWSTR pPrintProcesso
|
|||
BOOL WINAPI LocalEnumPrintProcessors(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned);
|
||||
BOOL WINAPI LocalGetPrintProcessorDirectory(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded);
|
||||
|
||||
// spoolfile.c
|
||||
BOOL WINAPI LocalGetSpoolFileInfo(HANDLE hPrinter,LPWSTR *pSpoolDir,LPHANDLE phFile,HANDLE hSpoolerProcess,HANDLE hAppProcess);
|
||||
BOOL WINAPI LocalCommitSpoolData(HANDLE hPrinter,DWORD cbCommit);
|
||||
BOOL WINAPI LocalCloseSpoolFileHandle(HANDLE hPrinter);
|
||||
|
||||
// tools.c
|
||||
PWSTR AllocAndRegQueryWSZ(HKEY hKey, PCWSTR pwszValueName);
|
||||
PDEVMODEW DuplicateDevMode(PDEVMODEW pInput);
|
||||
|
|
35
win32ss/printing/providers/localspl/spoolfile.c
Normal file
35
win32ss/printing/providers/localspl/spoolfile.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Local Spooler
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: Functions related to Spool Files and printing
|
||||
* COPYRIGHT: Copyright 1998-2020 ReactOS)
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
BOOL WINAPI
|
||||
LocalGetSpoolFileInfo(
|
||||
HANDLE hPrinter,
|
||||
LPWSTR *pSpoolDir,
|
||||
LPHANDLE phFile,
|
||||
HANDLE hSpoolerProcess,
|
||||
HANDLE hAppProcess )
|
||||
{
|
||||
FIXME("LocalGetSpoolFileInfo(%p, %S, %p, %p, %p)\n", hPrinter, pSpoolDir, phFile, hSpoolerProcess, hAppProcess);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
LocalCommitSpoolData( HANDLE hPrinter, DWORD cbCommit)
|
||||
{
|
||||
FIXME("LocalCommitSpoolData(%p, %lu)\n", hPrinter, cbCommit);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI
|
||||
LocalCloseSpoolFileHandle( HANDLE hPrinter)
|
||||
{
|
||||
FIXME("LocalCloseSpoolFileHandle(%p)\n", hPrinter);
|
||||
return FALSE;
|
||||
}
|
||||
|
Loading…
Reference in a new issue