From ca69cc6078de3e3f79462b774baf05273925c26a Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 13 Feb 2012 16:01:27 +0100 Subject: [PATCH] wineps16.drv: Call winspool functions instead of removed wineps.drv entry points. --- dlls/wineps16.drv16/Makefile.in | 1 + dlls/wineps16.drv16/driver.c | 43 ++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/dlls/wineps16.drv16/Makefile.in b/dlls/wineps16.drv16/Makefile.in index 759410b6a23..879e7da7fbc 100644 --- a/dlls/wineps16.drv16/Makefile.in +++ b/dlls/wineps16.drv16/Makefile.in @@ -1,4 +1,5 @@ MODULE = wineps16.drv16 +IMPORTS = winspool EXTRADLLFLAGS = -m16 C_SRCS = driver.c diff --git a/dlls/wineps16.drv16/driver.c b/dlls/wineps16.drv16/driver.c index 64dcbfb7d49..b4d54ddeef7 100644 --- a/dlls/wineps16.drv16/driver.c +++ b/dlls/wineps16.drv16/driver.c @@ -25,24 +25,11 @@ #include "windef.h" #include "wine/winuser16.h" #include "wownt32.h" +#include "winspool.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(psdrv); -static HMODULE wineps; -static INT (CDECL *pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD); -static DWORD (CDECL *pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA); - -static HMODULE load_wineps(void) -{ - if (!wineps) - { - wineps = LoadLibraryA( "wineps.drv" ); - pExtDeviceMode = (void *)GetProcAddress( wineps, "ExtDeviceMode" ); - pDeviceCapabilities = (void *)GetProcAddress( wineps, "DeviceCapabilities" ); - } - return wineps; -} /************************************************************** * AdvancedSetupDialog [WINEPS16.93] @@ -63,9 +50,7 @@ INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver, LPSTR lpszProfile, WORD fwMode) { - if (!load_wineps() || !pExtDeviceMode) return -1; - return pExtDeviceMode( NULL, HWND_32(hwnd), lpdmOutput, lpszDevice, - lpszPort, lpdmInput, lpszProfile, fwMode ); + return DocumentPropertiesA( HWND_32(hwnd), 0, lpszDevice, lpdmOutput, lpdmInput, fwMode ); } /************************************************************** @@ -75,8 +60,28 @@ DWORD WINAPI PSDRV_DeviceCapabilities16(LPCSTR lpszDevice, LPCSTR lpszPort, WORD fwCapability, LPSTR lpszOutput, LPDEVMODEA lpdm) { - if (!load_wineps() || !pDeviceCapabilities) return 0; - return pDeviceCapabilities( NULL, lpszDevice, lpszPort, fwCapability, lpszOutput, lpdm ); + int i, ret; + POINT *pt; + POINT16 *pt16; + + if (fwCapability != DC_PAPERSIZE || !lpszOutput) + return DeviceCapabilitiesA( lpszDevice, lpszPort, fwCapability, lpszOutput, lpdm ); + + /* for DC_PAPERSIZE, map POINT to POINT16 */ + + ret = DeviceCapabilitiesA( lpszDevice, lpszPort, DC_PAPERSIZE, NULL, lpdm ); + if (ret <= 0) return ret; + + pt16 = (POINT16 *)lpszOutput; + pt = HeapAlloc( GetProcessHeap(), 0, ret * sizeof(POINT) ); + ret = DeviceCapabilitiesA( lpszDevice, lpszPort, DC_PAPERSIZE, (LPSTR)pt, lpdm ); + for (i = 0; i < ret; i++) + { + pt16[i].x = pt[i].x; + pt16[i].y = pt[i].y; + } + HeapFree( GetProcessHeap(), 0, pt ); + return ret; } /***************************************************************