Huw Davies : wineps.drv: Retrieve the full printer name to avoid truncation when the name is 32 characters or longer .

Alexandre Julliard julliard at winehq.org
Mon Mar 15 12:19:32 CDT 2010


Module: wine
Branch: master
Commit: 547e97a461ade867dea1a1313c94243f9560d41a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=547e97a461ade867dea1a1313c94243f9560d41a

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Mar 12 10:42:44 2010 +0000

wineps.drv: Retrieve the full printer name to avoid truncation when the name is 32 characters or longer.

---

 dlls/wineps.drv/init.c |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c
index ef5d9d8..685a56a 100644
--- a/dlls/wineps.drv/init.c
+++ b/dlls/wineps.drv/init.c
@@ -305,27 +305,22 @@ BOOL CDECL PSDRV_CreateDC( HDC hdc, PSDRV_PDEVICE **pdev, LPCWSTR driver, LPCWST
 {
     PSDRV_PDEVICE *physDev;
     PRINTERINFO *pi;
-    char *deviceA;
 
     /* If no device name was specified, retrieve the device name
-     * from the DEVMODE structure from the DC's physDev.
+     * from the PRINTERINFO structure from the DC's physDev.
      * (See CreateCompatibleDC) */
     if ( !device && *pdev )
     {
-        physDev = *pdev;
-        deviceA = HeapAlloc(GetProcessHeap(), 0, CCHDEVICENAME);
-        lstrcpynA(deviceA, (LPCSTR)physDev->Devmode->dmPublic.dmDeviceName, CCHDEVICENAME);
+        pi = PSDRV_FindPrinterInfo((*pdev)->pi->FriendlyName);
     }
     else
     {
         DWORD len = WideCharToMultiByte(CP_ACP, 0, device, -1, NULL, 0, NULL, NULL);
-        deviceA = HeapAlloc(GetProcessHeap(), 0, len);
+        char *deviceA = HeapAlloc(GetProcessHeap(), 0, len);
         WideCharToMultiByte(CP_ACP, 0, device, -1, deviceA, len, NULL, NULL);
+        pi = PSDRV_FindPrinterInfo(deviceA);
+        HeapFree(GetProcessHeap(), 0, deviceA);
     }
-    pi = PSDRV_FindPrinterInfo(deviceA);
-
-    HeapFree(GetProcessHeap(), 0, deviceA);
-    deviceA = NULL;
 
     TRACE("(%s %s %s %p)\n", debugstr_w(driver), debugstr_w(device),
                              debugstr_w(output), initData);




More information about the wine-cvs mailing list