mirror of
https://github.com/reactos/reactos.git
synced 2024-08-26 13:18:51 +00:00
![James Tabor](/assets/img/avatar_default.png)
WinSpool : Implement missing API. Sync/Port from wine. Setting it to fast track for needed testing of the later GDI code. Leaving Fix-me debug prints on. Local tree has WinSpool_winetest turned on. So no debug noise during normal ReactOS operation. SpoolSS : Reordered header types. Have more Spl function to be added while SpoolSV is being coded to forward to LocalSpl. Based on wine and old research from the GDI code.
121 lines
3.4 KiB
C
121 lines
3.4 KiB
C
/*
|
|
* 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, (FILE_INFO_1*)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, (FILE_INFO_1*)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, (FILE_INFO_1*)pFileInfoContainer->FileInfo.pFileInfo1, sizeof(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, (FILE_INFO_1*)pFileInfoContainer->FileInfo.pFileInfo1, sizeof(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;
|
|
}
|