2015-07-17 10:57:10 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Print Spooler Service
|
2017-09-29 17:18:19 +00:00
|
|
|
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
2015-07-17 10:57:10 +00:00
|
|
|
* PURPOSE: Functions related to Printer Drivers
|
2017-09-29 17:18:19 +00:00
|
|
|
* COPYRIGHT: Copyright 2015 Colin Finck (colin@reactos.org)
|
2015-07-17 10:57:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "precomp.h"
|
2018-12-29 22:51:32 +00:00
|
|
|
#include "marshalling/printerdrivers.h"
|
2015-07-17 10:57:10 +00:00
|
|
|
|
|
|
|
DWORD
|
|
|
|
_RpcAddPrinterDriver(WINSPOOL_HANDLE pName, WINSPOOL_DRIVER_CONTAINER* pDriverContainer)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
_RpcAddPrinterDriverEx(WINSPOOL_HANDLE pName, WINSPOOL_DRIVER_CONTAINER* pDriverContainer, DWORD dwFileCopyFlags)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
_RpcDeletePrinterDriver(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pDriverName)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
_RpcDeletePrinterDriverEx(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pDriverName, DWORD dwDeleteFlag, DWORD dwVersionNum)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
_RpcEnumPrinterDrivers(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, DWORD Level, BYTE* pDrivers, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
_RpcGetPrinterDriver(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pEnvironment, DWORD Level, BYTE* pDriver, DWORD cbBuf, DWORD* pcbNeeded)
|
|
|
|
{
|
2018-12-29 22:51:32 +00:00
|
|
|
DWORD dwErrorCode;
|
|
|
|
PBYTE pDriverAligned;
|
|
|
|
|
2020-01-31 23:38:47 +00:00
|
|
|
ERR("_RpcGetPrinterDriver(%p, %lu, %lu, %p, %lu, %p)\n", hPrinter, pEnvironment, Level, pDriver, cbBuf, pcbNeeded);
|
|
|
|
|
2018-12-29 22:51:32 +00:00
|
|
|
dwErrorCode = RpcImpersonateClient(NULL);
|
|
|
|
if (dwErrorCode != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
|
|
|
|
return dwErrorCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
pDriverAligned = AlignRpcPtr(pDriver, &cbBuf);
|
|
|
|
|
|
|
|
if (GetPrinterDriverW(hPrinter, pEnvironment, Level, pDriverAligned, cbBuf, pcbNeeded))
|
|
|
|
{
|
|
|
|
// Replace relative offset addresses in the output by absolute pointers.
|
2020-01-31 23:38:47 +00:00
|
|
|
ASSERT(Level >= 1 && Level <= 5);
|
2018-12-29 22:51:32 +00:00
|
|
|
MarshallDownStructure(pDriverAligned, pPrinterDriverMarshalling[Level]->pInfo, pPrinterDriverMarshalling[Level]->cbStructureSize, TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dwErrorCode = GetLastError();
|
|
|
|
}
|
|
|
|
|
|
|
|
RpcRevertToSelf();
|
|
|
|
UndoAlignRpcPtr(pDriver, pDriverAligned, cbBuf, pcbNeeded);
|
|
|
|
|
|
|
|
return dwErrorCode;
|
2015-07-17 10:57:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
_RpcGetPrinterDriver2(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pEnvironment, DWORD Level, BYTE* pDriver, DWORD cbBuf, DWORD* pcbNeeded, DWORD dwClientMajorVersion, DWORD dwClientMinorVersion, DWORD* pdwServerMaxVersion, DWORD* pdwServerMinVersion)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|
|
|
|
|
|
|
|
DWORD
|
|
|
|
_RpcGetPrinterDriverDirectory(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, DWORD Level, BYTE* pDriverDirectory, DWORD cbBuf, DWORD* pcbNeeded)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return ERROR_INVALID_FUNCTION;
|
|
|
|
}
|