From 68edfb28f98bd83a4cd945b13c98fd48382da4d0 Mon Sep 17 00:00:00 2001
From: tatyana <tatyana@etersoft.ru>
Date: Tue, 15 Jan 2013 11:46:25 +0400
Subject: [eter-2.0.0 1/2] winspool.drv: Set pDevModeInputA to NULL if fMode
 not equal DM_IN_BUFFER(eterbug#8821)

---
 dlls/winspool.drv/info.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index 191bfff..e558b97 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -1737,7 +1737,7 @@ LONG WINAPI DocumentPropertiesA(HWND hWnd,HANDLE hPrinter,
 	hWnd,hPrinter,pDeviceName,pDevModeOutput,pDevModeInput,fMode
     );
 
-    if(!pDeviceName || !strcmp(pDeviceName,"")) {
+    if(!pDeviceName || !*pDeviceName) {
         LPCWSTR lpNameW = get_opened_printer_name(hPrinter);
         if(!lpNameW) {
 		ERR("no name from hPrinter?\n");
@@ -1777,22 +1777,13 @@ LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter,
 {
 
     LPSTR pDeviceNameA = strdupWtoA(pDeviceName);
-    LPDEVMODEA pDevModeInputA;
+    LPDEVMODEA pDevModeInputA = (fMode & DM_IN_BUFFER) ? DEVMODEdupWtoA(pDevModeInput) : NULL;
     LPDEVMODEA pDevModeOutputA = NULL;
     LONG ret;
     DWORD size;
     DWORD buflen = sizeof(DEVMODEW);
     LPBYTE ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen);
 
-    if(!(fMode&DM_IN_BUFFER))
-    {
-        WINSPOOL_GetDefaultDevMode(ptr, buflen, &size);
-        if(!pDevModeInput)
-            pDevModeInput = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
-        memcpy(pDevModeInput, ptr, size);
-    }
-
-    pDevModeInputA = DEVMODEdupWtoA(pDevModeInput);
 
     TRACE("(%p,%p,%s,%p,%p,%d)\n",
           hWnd,hPrinter,debugstr_w(pDeviceName),pDevModeOutput,pDevModeInput,
@@ -1812,7 +1803,6 @@ LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter,
         ret += (CCHDEVICENAME + CCHFORMNAME);
     HeapFree(GetProcessHeap(),0,pDevModeInputA);
     HeapFree(GetProcessHeap(),0,pDeviceNameA);
-    HeapFree(GetProcessHeap(),0,ptr);
     return ret;
 }
 
-- 
1.8.0.3
