Huw Davies : winspool: Update the devmode when we update the driver.

Alexandre Julliard julliard at winehq.org
Thu Jun 21 15:03:41 CDT 2012


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Jun 21 12:59:02 2012 +0100

winspool: Update the devmode when we update the driver.

---

 dlls/winspool.drv/info.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index d1afe56..a8d245f 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -974,6 +974,10 @@ static BOOL update_driver( HANDLE printer )
     HeapFree( GetProcessHeap(), 0, ppd_dir );
     HeapFree( GetProcessHeap(), 0, ppd );
     HeapFree( GetProcessHeap(), 0, queue_name );
+
+    /* call into the driver to update the devmode */
+    DocumentPropertiesW( 0, printer, NULL, NULL, NULL, 0 );
+
     return ret;
 }
 
@@ -2369,7 +2373,6 @@ BOOL WINAPI OpenPrinterW(LPWSTR lpPrinterName,HANDLE *phPrinter, LPPRINTER_DEFAU
     /* Get the unique handle of the printer or Printserver */
     *phPrinter = get_opened_printer_entry(lpPrinterName, pDefault);
 
-    WaitForSingleObject( init_mutex, INFINITE );
     if (*phPrinter)
     {
         HKEY key;
@@ -2377,15 +2380,14 @@ BOOL WINAPI OpenPrinterW(LPWSTR lpPrinterName,HANDLE *phPrinter, LPPRINTER_DEFAU
         DWORD status;
         WINSPOOL_GetOpenedPrinterRegKey( *phPrinter, &key );
         RegQueryValueExW( key, May_Delete_Value, NULL, &type, (LPBYTE)&deleting, &size );
+        WaitForSingleObject( init_mutex, INFINITE );
         status = get_dword_from_reg( key, StatusW );
+        set_reg_DWORD( key, StatusW, status & ~PRINTER_STATUS_DRIVER_UPDATE_NEEDED );
+        ReleaseMutex( init_mutex );
         if (!deleting && (status & PRINTER_STATUS_DRIVER_UPDATE_NEEDED))
-        {
             update_driver( *phPrinter );
-            set_reg_DWORD( key, StatusW, status & ~PRINTER_STATUS_DRIVER_UPDATE_NEEDED );
-        }
         RegCloseKey( key );
     }
-    ReleaseMutex( init_mutex );
 
     TRACE("returning %d with %u and %p\n", *phPrinter != NULL, GetLastError(), *phPrinter);
     return (*phPrinter != 0);




More information about the wine-cvs mailing list