reactos/win32ss/printing/base/spoolsv/printerdrivers.c

93 lines
2.8 KiB
C
Raw Normal View History

/*
* PROJECT: ReactOS Print Spooler Service
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Functions related to Printer Drivers
* COPYRIGHT: Copyright 2015 Colin Finck (colin@reactos.org)
*/
#include "precomp.h"
#include "marshalling/printerdrivers.h"
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)
{
DWORD dwErrorCode;
PBYTE pDriverAligned;
[0.4.13][PRINTING] Fix regression CORE-16622 in comdlg32:printdlg ANSI A very nice set of patches done by Doug Lyons!, Jim Tabor, Colin Finck to fix: - a crash on the testbots for comdlg32:printdlg - erroneous behavior of PrintDlg in _A()-application "Kompozer", namely - prevents exceptions from being thrown when opening the print dlg - prevents heap allocations of 0 byte size when opening the print dlg - prevents a help-button that should be invisible from overlapping other controls - allows Kompozer to extend the print-dialog with additional controls - allows combobox to show the printers name, instead of memory garbage [PRINTING] Improve Stubs for GetPrinterA and GetPrinterDeviceA (#2274) cherry picked from commit 0.4.14-dev-849-g acec69a1d7333dfc8b0a1e922196b29768ce0f9c [WINSPOOL] Add Implementation of EnumPrintersA (#2273) cherry picked from commit 0.4.14-dev-878-g e8b177825b0f44784286032d6ec64606c7b0a718 [FORMATTING] Fix indentation of winspool/printers.c No code changes cherry picked from commit 0.4.14-dev-879-g 45f39ffc253012b2399dc1105bcb797caec6ae36 [PRINTING] Part of GDI Support Fix ups and added support to prevent GDI from crashing. These functions will be required for GDI. Part 1 of print support. cherry picked from commit 0.4.14-dev-880-g adffa8ea7591f4d2d6530a82361d419a9ffc8ad7 [WINSPOOL] printers.c: Demote 3 ERR() to TRACE(), Fix 1 copypasta (#2311) cherry picked from commit 0.4.14-dev-889-g 06f8f8018191a15714d27b78f3d1e38eb1623e37 [WINSPOOL] Implement GetPrinterDriverA and a helper function UnicodeToAnsiInPlace (#2317) cherry picked from commit 0.4.14-dev-957-g d90beaeed26863985486874aaa2a1c3422fd6d9f [WINSPOOL] Fix build cherry picked from commit 0.4.14-dev-958-g 8da7fbc704448a03610a5497a88f9dfada8be644 [GDI32] GdiConvertToDevmodeW: Import WINE commit 32393796bb534e9cf11dd988dce88722c67f7906 ("gdi32: GdiConvertToDevmodeW should not refer to unintialized name bytes.") This makes our GdiConvertToDevmodeW equivalent to the WINE counterpart again. cherry picked from commit 0.4.14-dev-1031-g 5d8c39753e82e8e7f8db90a427b230ed248f0158 [WINSPOOL] Implement DocumentPropertiesA including DEVMODE conversions (#2339) Co-authored-by: Doug Lyons <douglyons@douglyons.com> Co-authored-by: Colin Finck <colin@reactos.org> cherry picked from commit 0.4.14-dev-1035-g 3077c0e43e08bc98f801718a86d354adc269a963
2020-02-26 22:21:00 +00:00
ERR("_RpcGetPrinterDriver(%p, %lu, %lu, %p, %lu, %p)\n", hPrinter, pEnvironment, Level, pDriver, cbBuf, pcbNeeded);
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.
[0.4.13][PRINTING] Fix regression CORE-16622 in comdlg32:printdlg ANSI A very nice set of patches done by Doug Lyons!, Jim Tabor, Colin Finck to fix: - a crash on the testbots for comdlg32:printdlg - erroneous behavior of PrintDlg in _A()-application "Kompozer", namely - prevents exceptions from being thrown when opening the print dlg - prevents heap allocations of 0 byte size when opening the print dlg - prevents a help-button that should be invisible from overlapping other controls - allows Kompozer to extend the print-dialog with additional controls - allows combobox to show the printers name, instead of memory garbage [PRINTING] Improve Stubs for GetPrinterA and GetPrinterDeviceA (#2274) cherry picked from commit 0.4.14-dev-849-g acec69a1d7333dfc8b0a1e922196b29768ce0f9c [WINSPOOL] Add Implementation of EnumPrintersA (#2273) cherry picked from commit 0.4.14-dev-878-g e8b177825b0f44784286032d6ec64606c7b0a718 [FORMATTING] Fix indentation of winspool/printers.c No code changes cherry picked from commit 0.4.14-dev-879-g 45f39ffc253012b2399dc1105bcb797caec6ae36 [PRINTING] Part of GDI Support Fix ups and added support to prevent GDI from crashing. These functions will be required for GDI. Part 1 of print support. cherry picked from commit 0.4.14-dev-880-g adffa8ea7591f4d2d6530a82361d419a9ffc8ad7 [WINSPOOL] printers.c: Demote 3 ERR() to TRACE(), Fix 1 copypasta (#2311) cherry picked from commit 0.4.14-dev-889-g 06f8f8018191a15714d27b78f3d1e38eb1623e37 [WINSPOOL] Implement GetPrinterDriverA and a helper function UnicodeToAnsiInPlace (#2317) cherry picked from commit 0.4.14-dev-957-g d90beaeed26863985486874aaa2a1c3422fd6d9f [WINSPOOL] Fix build cherry picked from commit 0.4.14-dev-958-g 8da7fbc704448a03610a5497a88f9dfada8be644 [GDI32] GdiConvertToDevmodeW: Import WINE commit 32393796bb534e9cf11dd988dce88722c67f7906 ("gdi32: GdiConvertToDevmodeW should not refer to unintialized name bytes.") This makes our GdiConvertToDevmodeW equivalent to the WINE counterpart again. cherry picked from commit 0.4.14-dev-1031-g 5d8c39753e82e8e7f8db90a427b230ed248f0158 [WINSPOOL] Implement DocumentPropertiesA including DEVMODE conversions (#2339) Co-authored-by: Doug Lyons <douglyons@douglyons.com> Co-authored-by: Colin Finck <colin@reactos.org> cherry picked from commit 0.4.14-dev-1035-g 3077c0e43e08bc98f801718a86d354adc269a963
2020-02-26 22:21:00 +00:00
ASSERT(Level >= 1 && Level <= 5);
MarshallDownStructure(pDriverAligned, pPrinterDriverMarshalling[Level]->pInfo, pPrinterDriverMarshalling[Level]->cbStructureSize, TRUE);
}
else
{
dwErrorCode = GetLastError();
}
RpcRevertToSelf();
UndoAlignRpcPtr(pDriver, pDriverAligned, cbBuf, pcbNeeded);
return dwErrorCode;
}
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;
}