reactos/win32ss/printing/base/spoolsv/printerdrivers.c
Joachim Henze 818e5bc752 [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
acec69a1d7

[WINSPOOL] Add Implementation of EnumPrintersA (#2273)
cherry picked from commit 0.4.14-dev-878-g
e8b177825b

[FORMATTING] Fix indentation of winspool/printers.c
No code changes
cherry picked from commit 0.4.14-dev-879-g
45f39ffc25

[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
adffa8ea75

[WINSPOOL] printers.c: Demote 3 ERR() to TRACE(), Fix 1 copypasta (#2311)
cherry picked from commit 0.4.14-dev-889-g
06f8f80181

[WINSPOOL] Implement GetPrinterDriverA and a helper function UnicodeToAnsiInPlace (#2317)
cherry picked from commit 0.4.14-dev-957-g
d90beaeed2

[WINSPOOL] Fix build
cherry picked from commit 0.4.14-dev-958-g
8da7fbc704

[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
5d8c39753e

[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
3077c0e43e
2020-02-27 03:02:21 +01:00

93 lines
2.8 KiB
C

/*
* 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;
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.
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;
}