From c9250c4438e1cc9aa78b237a57861e74cbc45cd8 Mon Sep 17 00:00:00 2001
From: tatyana <tatyana@etersoft.ru>
Date: Sat, 30 Mar 2013 12:04:26 +0400
Subject: [PATCH 1/2] winspool.drv: Set pDevModeInputA to NULL if fMode not
 equal DM_IN_BUFFER(eterbug#8821)

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

diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index dd84598..fa9d689 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -2361,7 +2361,7 @@ LONG WINAPI DocumentPropertiesA(HWND hWnd,HANDLE hPrinter,
 	hWnd,hPrinter,pDeviceName,pDevModeOutput,pDevModeInput,fMode
     );
 
-    if(!pDeviceName) {
+    if(!pDeviceName || !*pDeviceName) {
         LPCWSTR lpNameW = get_opened_printer_name(hPrinter);
         if(!lpNameW) {
 		ERR("no name from hPrinter?\n");
@@ -2413,7 +2413,7 @@ LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter,
 	if(ret < 0) return ret;
 	pDevModeOutputA = HeapAlloc(GetProcessHeap(), 0, ret);
     }
-    pDevModeInputA = DEVMODEdupWtoA(pDevModeInput);
+    pDevModeInputA = (fMode & DM_IN_BUFFER) ? DEVMODEdupWtoA(pDevModeInput) : NULL;
     ret = DocumentPropertiesA(hWnd, hPrinter, pDeviceNameA, pDevModeOutputA,
 			      pDevModeInputA, fMode);
     if(pDevModeOutput) {
-- 
1.8.1.4
