[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.
This commit is contained in:
James Tabor 2020-01-31 17:38:47 -06:00
parent 45f39ffc25
commit adffa8ea75
6 changed files with 169 additions and 9 deletions

View file

@ -49,6 +49,8 @@ _RpcGetPrinterDriver(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pEnvironment, DWOR
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)
{
@ -61,7 +63,7 @@ _RpcGetPrinterDriver(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pEnvironment, DWOR
if (GetPrinterDriverW(hPrinter, pEnvironment, Level, pDriverAligned, cbBuf, pcbNeeded))
{
// Replace relative offset addresses in the output by absolute pointers.
ASSERT(Level >= 1 && Level <= 3);
ASSERT(Level >= 1 && Level <= 5);
MarshallDownStructure(pDriverAligned, pPrinterDriverMarshalling[Level]->pInfo, pPrinterDriverMarshalling[Level]->cbStructureSize, TRUE);
}
else

View file

@ -15,6 +15,7 @@
#include <winreg.h>
#include <winspool.h>
#include <winspool_c.h>
#include <winddiui.h>
#include <ndk/rtlfuncs.h>
#include <spoolss.h>

View file

@ -194,6 +194,14 @@ DeviceCapabilitiesW(LPCWSTR pDevice, LPCWSTR pPort, WORD fwCapability, LPWSTR pO
return 0;
}
INT WINAPI
DocumentEvent( HANDLE hPrinter, HDC hdc, int iEsc, ULONG cbIn, PVOID pvIn, ULONG cbOut, PVOID pvOut)
{
ERR("DocumentEvent(%p, %p, %lu, %lu, %p, %lu, %p)\n", hPrinter, hdc, iEsc, cbIn, pvIn, cbOut, pvOut);
UNIMPLEMENTED;
return DOCUMENTEVENT_UNSUPPORTED;
}
LONG WINAPI
DocumentPropertiesA(HWND hWnd, HANDLE hPrinter, LPSTR pDeviceName, PDEVMODEA pDevModeOutput, PDEVMODEA pDevModeInput, DWORD fMode)
{
@ -1042,7 +1050,7 @@ GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDri
DWORD dwErrorCode;
PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
TRACE("GetPrinterDriverW(%p, %S, %lu, %p, %lu, %p)\n", hPrinter, pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded);
ERR("GetPrinterDriverW(%p, %S, %lu, %p, %lu, %p)\n", hPrinter, pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded);
// Sanity checks.
if (!pHandle)
@ -1076,7 +1084,7 @@ GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDri
if (dwErrorCode == ERROR_SUCCESS)
{
// Replace relative offset addresses in the output by absolute pointers.
ASSERT(Level <= 3);
ASSERT(Level <= 5);
MarshallUpStructure(cbBuf, pDriverInfo, pPrinterDriverMarshalling[Level]->pInfo, pPrinterDriverMarshalling[Level]->cbStructureSize, TRUE);
}
@ -1472,6 +1480,14 @@ SetPrinterW(HANDLE hPrinter, DWORD Level, PBYTE pPrinter, DWORD Command)
return FALSE;
}
BOOL WINAPI
SplDriverUnloadComplete(LPWSTR pDriverFile)
{
ERR("DriverUnloadComplete(%S)\n", pDriverFile);
UNIMPLEMENTED;
return TRUE; // return true for now.
}
DWORD WINAPI
StartDocPrinterA(HANDLE hPrinter, DWORD Level, PBYTE pDocInfo)
{

View file

@ -74,7 +74,7 @@
173 stdcall DeviceCapabilitiesW(wstr wstr long ptr ptr)
174 stub DeviceMode
175 stub DevicePropertySheets
176 stub DocumentEvent
176 stdcall DocumentEvent(ptr ptr long long ptr long ptr)
177 stdcall DocumentPropertiesA(ptr ptr ptr ptr ptr long)
178 stdcall DocumentPropertiesW(ptr ptr ptr ptr ptr long)
179 stub DocumentPropertySheets
@ -186,7 +186,7 @@
285 stdcall SetPrinterDataExW(ptr wstr wstr long ptr long)
286 stdcall SetPrinterDataW(ptr wstr long ptr long)
287 stdcall SetPrinterW(ptr long ptr long)
288 stub SplDriverUnloadComplete
288 stdcall SplDriverUnloadComplete(ptr)
289 stub SpoolerDevQueryPrintW
290 stdcall SpoolerInit()
291 stub SpoolerPrinterEvent