winspool: Load the local Monitor only once

Detlef Riekenberg wine.dev at web.de
Tue Nov 28 13:04:08 CST 2006


The Monitor for the local Ports is Loaded/Initialized/Unloaded
on every use.

This Patch add an extra reference once to avoid this.



Changelog:
winspool: Load the local Monitor only once


This Patch was created after
"Implement DeletePortW/A, AddPortW/A".

It works without the Patches, but has a Line-Offset

-- 
 
By by ... Detlef

-------------- next part --------------
>From cd545a60bb93bd4c1ba1d42ae10b694b9d46f345 Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Tue, 28 Nov 2006 19:48:13 +0100
Subject: [PATCH] winspool: load the local monitor only once
---
 dlls/winspool.drv/info.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index b1a761c..77eaa24 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -138,6 +138,7 @@ typedef struct {
 /* ############################### */
 
 static struct list monitor_handles = LIST_INIT( monitor_handles );
+static monitor_t * pm_localport;
 
 static opened_printer_t **printer_handles;
 static int nb_printer_handles;
@@ -1097,6 +1098,10 @@ static monitor_t * monitor_load(LPWSTR n
         }
     }
 cleanup:
+    if ((pm_localport ==  NULL) && (pm != NULL) && (lstrcmpW(pm->name, LocalPortW) == 0)) {
+        pm->refcount++;
+        pm_localport = pm;
+    }
     LeaveCriticalSection(&monitor_handles_cs);
     if (driver != dllname) HeapFree(GetProcessHeap(), 0, driver);
     HeapFree(GetProcessHeap(), 0, regroot);
-- 
1.4.1



More information about the wine-patches mailing list