Bruno Jesus : winspool.drv: Do not try to check the registry if opening the printer fails (valgrind).

Alexandre Julliard julliard at winehq.org
Wed Jun 11 13:36:23 CDT 2014


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

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Thu May 29 22:04:56 2014 -0300

winspool.drv: Do not try to check the registry if opening the printer fails (valgrind).

---

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

diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index e33b257..bfb22cb 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -2530,6 +2530,7 @@ BOOL WINAPI OpenPrinterA(LPSTR lpPrinterName,HANDLE *phPrinter,
  */
 BOOL WINAPI OpenPrinterW(LPWSTR lpPrinterName,HANDLE *phPrinter, LPPRINTER_DEFAULTSW pDefault)
 {
+    HKEY key;
 
     TRACE("(%s, %p, %p)\n", debugstr_w(lpPrinterName), phPrinter, pDefault);
 
@@ -2542,12 +2543,10 @@ 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);
 
-    if (*phPrinter)
+    if (*phPrinter && WINSPOOL_GetOpenedPrinterRegKey( *phPrinter, &key ) == ERROR_SUCCESS)
     {
-        HKEY key;
         DWORD deleting = 0, size = sizeof( deleting ), type;
         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 );




More information about the wine-cvs mailing list