2015-06-22 14:31:47 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Spooler API
|
2017-09-29 17:18:19 +00:00
|
|
|
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
2015-06-22 14:31:47 +00:00
|
|
|
* PURPOSE: Functions for managing print jobs
|
2017-12-09 11:00:09 +00:00
|
|
|
* COPYRIGHT: Copyright 2015-2017 Colin Finck (colin@reactos.org)
|
2015-06-22 14:31:47 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "precomp.h"
|
|
|
|
|
2015-07-17 15:09:31 +00:00
|
|
|
static void
|
|
|
|
_MarshallUpAddJobInfo(PADDJOB_INFO_1W pAddJobInfo1)
|
|
|
|
{
|
|
|
|
// Replace relative offset addresses in the output by absolute pointers.
|
|
|
|
pAddJobInfo1->Path = (PWSTR)((ULONG_PTR)pAddJobInfo1->Path + (ULONG_PTR)pAddJobInfo1);
|
|
|
|
}
|
|
|
|
|
2015-06-27 12:36:45 +00:00
|
|
|
static void
|
|
|
|
_MarshallUpJobInfo(PBYTE pJobInfo, DWORD Level)
|
|
|
|
{
|
|
|
|
PJOB_INFO_1W pJobInfo1;
|
|
|
|
PJOB_INFO_2W pJobInfo2;
|
|
|
|
|
2015-07-17 10:57:10 +00:00
|
|
|
// Replace relative offset addresses in the output by absolute pointers.
|
2015-06-27 12:36:45 +00:00
|
|
|
if (Level == 1)
|
|
|
|
{
|
|
|
|
pJobInfo1 = (PJOB_INFO_1W)pJobInfo;
|
|
|
|
pJobInfo1->pDatatype = (PWSTR)((ULONG_PTR)pJobInfo1->pDatatype + (ULONG_PTR)pJobInfo1);
|
|
|
|
pJobInfo1->pDocument = (PWSTR)((ULONG_PTR)pJobInfo1->pDocument + (ULONG_PTR)pJobInfo1);
|
|
|
|
pJobInfo1->pMachineName = (PWSTR)((ULONG_PTR)pJobInfo1->pMachineName + (ULONG_PTR)pJobInfo1);
|
|
|
|
pJobInfo1->pPrinterName = (PWSTR)((ULONG_PTR)pJobInfo1->pPrinterName + (ULONG_PTR)pJobInfo1);
|
|
|
|
|
|
|
|
if (pJobInfo1->pStatus)
|
|
|
|
pJobInfo1->pStatus = (PWSTR)((ULONG_PTR)pJobInfo1->pStatus + (ULONG_PTR)pJobInfo1);
|
|
|
|
|
|
|
|
pJobInfo1->pUserName = (PWSTR)((ULONG_PTR)pJobInfo1->pUserName + (ULONG_PTR)pJobInfo1);
|
|
|
|
}
|
|
|
|
else if (Level == 2)
|
|
|
|
{
|
|
|
|
pJobInfo2 = (PJOB_INFO_2W)pJobInfo;
|
|
|
|
pJobInfo2->pDatatype = (PWSTR)((ULONG_PTR)pJobInfo2->pDatatype + (ULONG_PTR)pJobInfo2);
|
|
|
|
pJobInfo2->pDevMode = (PDEVMODEW)((ULONG_PTR)pJobInfo2->pDevMode + (ULONG_PTR)pJobInfo2);
|
|
|
|
pJobInfo2->pDocument = (PWSTR)((ULONG_PTR)pJobInfo2->pDocument + (ULONG_PTR)pJobInfo2);
|
|
|
|
pJobInfo2->pDriverName = (PWSTR)((ULONG_PTR)pJobInfo2->pDriverName + (ULONG_PTR)pJobInfo2);
|
|
|
|
pJobInfo2->pMachineName = (PWSTR)((ULONG_PTR)pJobInfo2->pMachineName + (ULONG_PTR)pJobInfo2);
|
|
|
|
pJobInfo2->pNotifyName = (PWSTR)((ULONG_PTR)pJobInfo2->pNotifyName + (ULONG_PTR)pJobInfo2);
|
|
|
|
pJobInfo2->pPrinterName = (PWSTR)((ULONG_PTR)pJobInfo2->pPrinterName + (ULONG_PTR)pJobInfo2);
|
|
|
|
pJobInfo2->pPrintProcessor = (PWSTR)((ULONG_PTR)pJobInfo2->pPrintProcessor + (ULONG_PTR)pJobInfo2);
|
|
|
|
|
|
|
|
if (pJobInfo2->pParameters)
|
|
|
|
pJobInfo2->pParameters = (PWSTR)((ULONG_PTR)pJobInfo2->pParameters + (ULONG_PTR)pJobInfo2);
|
|
|
|
|
|
|
|
if (pJobInfo2->pStatus)
|
|
|
|
pJobInfo2->pStatus = (PWSTR)((ULONG_PTR)pJobInfo2->pStatus + (ULONG_PTR)pJobInfo2);
|
|
|
|
|
|
|
|
pJobInfo2->pUserName = (PWSTR)((ULONG_PTR)pJobInfo2->pUserName + (ULONG_PTR)pJobInfo2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-22 14:31:47 +00:00
|
|
|
BOOL WINAPI
|
2015-06-27 12:36:45 +00:00
|
|
|
AddJobA(HANDLE hPrinter, DWORD Level, PBYTE pData, DWORD cbBuf, PDWORD pcbNeeded)
|
|
|
|
{
|
2017-12-09 11:00:09 +00:00
|
|
|
TRACE("AddJobA(%p, %lu, %p, %lu, %p)\n", hPrinter, Level, pData, cbBuf, pcbNeeded);
|
2015-06-27 12:36:45 +00:00
|
|
|
UNIMPLEMENTED;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
AddJobW(HANDLE hPrinter, DWORD Level, PBYTE pData, DWORD cbBuf, PDWORD pcbNeeded)
|
2015-06-22 14:31:47 +00:00
|
|
|
{
|
|
|
|
DWORD dwErrorCode;
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
|
|
|
|
|
2017-12-09 11:00:09 +00:00
|
|
|
TRACE("AddJobW(%p, %lu, %p, %lu, %p)\n", hPrinter, Level, pData, cbBuf, pcbNeeded);
|
|
|
|
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
if (!pHandle)
|
|
|
|
{
|
|
|
|
dwErrorCode = ERROR_INVALID_HANDLE;
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
2015-06-22 14:31:47 +00:00
|
|
|
|
|
|
|
// Do the RPC call
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
dwErrorCode = _RpcAddJob(pHandle->hPrinter, Level, pData, cbBuf, pcbNeeded);
|
2015-06-22 14:31:47 +00:00
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
2015-06-27 12:36:45 +00:00
|
|
|
dwErrorCode = RpcExceptionCode();
|
|
|
|
ERR("_RpcAddJob failed with exception code %lu!\n", dwErrorCode);
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
if (dwErrorCode == ERROR_SUCCESS)
|
2015-07-17 15:09:31 +00:00
|
|
|
_MarshallUpAddJobInfo((PADDJOB_INFO_1W)pData);
|
2015-06-27 12:36:45 +00:00
|
|
|
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
Cleanup:
|
2015-06-27 12:36:45 +00:00
|
|
|
SetLastError(dwErrorCode);
|
|
|
|
return (dwErrorCode == ERROR_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
EnumJobsA(HANDLE hPrinter, DWORD FirstJob, DWORD NoJobs, DWORD Level, PBYTE pJob, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
|
|
|
|
{
|
2017-12-09 11:00:09 +00:00
|
|
|
TRACE("EnumJobsA(%p, %lu, %lu, %lu, %p, %lu, %p, %p)\n", hPrinter, FirstJob, NoJobs, Level, pJob, cbBuf, pcbNeeded, pcReturned);
|
2015-06-27 12:36:45 +00:00
|
|
|
UNIMPLEMENTED;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
EnumJobsW(HANDLE hPrinter, DWORD FirstJob, DWORD NoJobs, DWORD Level, PBYTE pJob, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
|
|
|
|
{
|
|
|
|
DWORD dwErrorCode;
|
|
|
|
DWORD i;
|
|
|
|
PBYTE p = pJob;
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
|
|
|
|
|
2017-12-09 11:00:09 +00:00
|
|
|
TRACE("EnumJobsW(%p, %lu, %lu, %lu, %p, %lu, %p, %p)\n", hPrinter, FirstJob, NoJobs, Level, pJob, cbBuf, pcbNeeded, pcReturned);
|
|
|
|
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
if (!pHandle)
|
|
|
|
{
|
|
|
|
dwErrorCode = ERROR_INVALID_HANDLE;
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
2015-06-27 12:36:45 +00:00
|
|
|
|
|
|
|
// Do the RPC call
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
dwErrorCode = _RpcEnumJobs(pHandle->hPrinter, FirstJob, NoJobs, Level, pJob, cbBuf, pcbNeeded, pcReturned);
|
2015-06-27 12:36:45 +00:00
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
dwErrorCode = RpcExceptionCode();
|
|
|
|
ERR("_RpcEnumJobs failed with exception code %lu!\n", dwErrorCode);
|
2015-06-22 14:31:47 +00:00
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
2015-06-27 12:36:45 +00:00
|
|
|
if (dwErrorCode == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
// Replace relative offset addresses in the output by absolute pointers.
|
|
|
|
for (i = 0; i < *pcReturned; i++)
|
|
|
|
{
|
|
|
|
_MarshallUpJobInfo(p, Level);
|
|
|
|
|
|
|
|
if (Level == 1)
|
|
|
|
p += sizeof(JOB_INFO_1W);
|
|
|
|
else if (Level == 2)
|
|
|
|
p += sizeof(JOB_INFO_2W);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
Cleanup:
|
2015-06-27 12:36:45 +00:00
|
|
|
SetLastError(dwErrorCode);
|
|
|
|
return (dwErrorCode == ERROR_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
GetJobA(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pJob, DWORD cbBuf, PDWORD pcbNeeded)
|
|
|
|
{
|
2017-12-09 11:00:09 +00:00
|
|
|
TRACE("GetJobA(%p, %lu, %lu, %p, %lu, %p)\n", hPrinter, JobId, Level, pJob, cbBuf, pcbNeeded);
|
2015-06-27 12:36:45 +00:00
|
|
|
UNIMPLEMENTED;
|
|
|
|
return FALSE;
|
2015-06-22 14:31:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI
|
2015-06-27 12:36:45 +00:00
|
|
|
GetJobW(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pJob, DWORD cbBuf, PDWORD pcbNeeded)
|
2015-06-22 14:31:47 +00:00
|
|
|
{
|
|
|
|
DWORD dwErrorCode;
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
|
|
|
|
|
2017-12-09 11:00:09 +00:00
|
|
|
TRACE("GetJobW(%p, %lu, %lu, %p, %lu, %p)\n", hPrinter, JobId, Level, pJob, cbBuf, pcbNeeded);
|
|
|
|
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
if (!pHandle)
|
|
|
|
{
|
|
|
|
dwErrorCode = ERROR_INVALID_HANDLE;
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
2015-06-22 14:31:47 +00:00
|
|
|
|
|
|
|
// Do the RPC call
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
dwErrorCode = _RpcGetJob(pHandle->hPrinter, JobId, Level, pJob, cbBuf, pcbNeeded);
|
2015-06-22 14:31:47 +00:00
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
2015-06-27 12:36:45 +00:00
|
|
|
dwErrorCode = RpcExceptionCode();
|
|
|
|
ERR("_RpcGetJob failed with exception code %lu!\n", dwErrorCode);
|
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
|
|
|
if (dwErrorCode == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
// Replace relative offset addresses in the output by absolute pointers.
|
|
|
|
_MarshallUpJobInfo(pJob, Level);
|
|
|
|
}
|
|
|
|
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
Cleanup:
|
2015-06-27 12:36:45 +00:00
|
|
|
SetLastError(dwErrorCode);
|
|
|
|
return (dwErrorCode == ERROR_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2015-06-28 15:51:32 +00:00
|
|
|
BOOL WINAPI
|
|
|
|
ScheduleJob(HANDLE hPrinter, DWORD dwJobID)
|
|
|
|
{
|
|
|
|
DWORD dwErrorCode;
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
|
|
|
|
|
2017-12-09 11:00:09 +00:00
|
|
|
TRACE("ScheduleJob(%p, %lu)\n", hPrinter, dwJobID);
|
|
|
|
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
if (!pHandle)
|
|
|
|
{
|
|
|
|
dwErrorCode = ERROR_INVALID_HANDLE;
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
2015-06-28 15:51:32 +00:00
|
|
|
|
|
|
|
// Do the RPC call
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
dwErrorCode = _RpcScheduleJob(pHandle->hPrinter, dwJobID);
|
2015-06-28 15:51:32 +00:00
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
dwErrorCode = RpcExceptionCode();
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
ERR("_RpcScheduleJob failed with exception code %lu!\n", dwErrorCode);
|
2015-06-28 15:51:32 +00:00
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
Cleanup:
|
2015-06-28 15:51:32 +00:00
|
|
|
SetLastError(dwErrorCode);
|
|
|
|
return (dwErrorCode == ERROR_SUCCESS);
|
|
|
|
}
|
|
|
|
|
2015-06-27 12:36:45 +00:00
|
|
|
BOOL WINAPI
|
|
|
|
SetJobA(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pJobInfo, DWORD Command)
|
|
|
|
{
|
2017-12-09 11:00:09 +00:00
|
|
|
TRACE("SetJobA(%p, %lu, %lu, %p, %lu)\n", hPrinter, JobId, Level, pJobInfo, Command);
|
2015-06-27 12:36:45 +00:00
|
|
|
UNIMPLEMENTED;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WINAPI
|
|
|
|
SetJobW(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pJobInfo, DWORD Command)
|
|
|
|
{
|
|
|
|
DWORD dwErrorCode;
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
|
2015-06-27 12:36:45 +00:00
|
|
|
WINSPOOL_JOB_CONTAINER JobContainer;
|
|
|
|
|
2017-12-09 11:00:09 +00:00
|
|
|
TRACE("SetJobW(%p, %lu, %lu, %p, %lu)\n", hPrinter, JobId, Level, pJobInfo, Command);
|
|
|
|
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
if (!pHandle)
|
|
|
|
{
|
|
|
|
dwErrorCode = ERROR_INVALID_HANDLE;
|
|
|
|
goto Cleanup;
|
|
|
|
}
|
|
|
|
|
2015-06-27 12:36:45 +00:00
|
|
|
// pJobContainer->JobInfo is a union of pointers, so we can just set any element to our BYTE pointer.
|
|
|
|
JobContainer.Level = Level;
|
|
|
|
JobContainer.JobInfo.Level1 = (WINSPOOL_JOB_INFO_1*)pJobInfo;
|
|
|
|
|
|
|
|
// Do the RPC call
|
|
|
|
RpcTryExcept
|
|
|
|
{
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
dwErrorCode = _RpcSetJob(pHandle->hPrinter, JobId, &JobContainer, Command);
|
2015-06-27 12:36:45 +00:00
|
|
|
}
|
|
|
|
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
dwErrorCode = RpcExceptionCode();
|
|
|
|
ERR("_RpcSetJob failed with exception code %lu!\n", dwErrorCode);
|
2015-06-22 14:31:47 +00:00
|
|
|
}
|
|
|
|
RpcEndExcept;
|
|
|
|
|
[LOCALSPL, WINSPOOL]
Partially implement the whole StartDocPrinter, StartPagePrinter, ReadPrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter group of functions.
They behave very differently based on whether spooled printing is enabled, whether it's a local or remote call, etc. Most information was gained by observing callchains under Windows.
So far, only the spooled path is implemented, the others need more investigation first.
Many other TODOs remain as well, see the comments.
Also make some more comments Doxygen-aware :)
svn path=/branches/colins-printing-for-freedom/; revision=68405
2015-07-16 15:03:47 +00:00
|
|
|
Cleanup:
|
2015-06-27 12:36:45 +00:00
|
|
|
SetLastError(dwErrorCode);
|
|
|
|
return (dwErrorCode == ERROR_SUCCESS);
|
2015-06-22 14:31:47 +00:00
|
|
|
}
|