winspool: [1/2] support monitors without a name

Detlef Riekenberg wine.dev at web.de
Thu Jan 11 06:05:16 CST 2007


we need this, when we load userinterface-dlls


Changelog:
- winspool: support monitors without a name


-- 
 
By by ... Detlef

-------------- next part --------------
>From a090368f43e91dd2fbbd020625d8a0ebbc63cd96 Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Thu, 11 Jan 2007 12:41:14 +0100
Subject: [PATCH] winspool: support monitors without a name
---
 dlls/winspool.drv/info.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index 41b706c..3821c27 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -985,11 +985,13 @@ static monitor_t * monitor_load(LPCWSTR 
     /* Is the Monitor already loaded? */
     EnterCriticalSection(&monitor_handles_cs);
 
-    LIST_FOR_EACH_ENTRY(cursor, &monitor_handles, monitor_t, entry)
-    {
-        if (lstrcmpW(name, cursor->name) == 0) {
-            pm = cursor;
-            break;
+    if (name) {
+        LIST_FOR_EACH_ENTRY(cursor, &monitor_handles, monitor_t, entry)
+        {
+            if (cursor->name && (lstrcmpW(name, cursor->name) == 0)) {
+                pm = cursor;
+                break;
+            }
         }
     }
 
@@ -1005,8 +1007,10 @@ static monitor_t * monitor_load(LPCWSTR 
         LPMONITOREX pmonitorEx;
         DWORD   len;
 
-        len = lstrlenW(MonitorsW) + lstrlenW(name) + 2; 
-        regroot = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+        if (name) {
+            len = lstrlenW(MonitorsW) + lstrlenW(name) + 2; 
+            regroot = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+        }
 
         if (regroot) {
             lstrcpyW(regroot, MonitorsW);
@@ -1029,7 +1033,7 @@ static monitor_t * monitor_load(LPCWSTR 
         pm->name = strdupW(name);
         pm->dllname = strdupW(driver);
 
-        if (!regroot || !pm->name || !pm->dllname) {
+        if ((name && (!regroot || !pm->name)) || !pm->dllname) {
             monitor_unload(pm);
             SetLastError(ERROR_NOT_ENOUGH_MEMORY);
             pm = NULL;
@@ -1069,7 +1073,7 @@ static monitor_t * monitor_load(LPCWSTR 
             }
         }
 
-        if (pInitializePrintMonitor != NULL) {
+        if (pInitializePrintMonitor && regroot) {
             pmonitorEx = pInitializePrintMonitor(regroot);
             TRACE(  "%p: LPMONITOREX from %s,InitializePrintMonitor(%s)\n", 
                     pmonitorEx, debugstr_w(driver), debugstr_w(regroot)); 
@@ -1085,7 +1089,7 @@ static monitor_t * monitor_load(LPCWSTR 
 
         }
 
-        if (!pm->monitor) {
+        if (!pm->monitor && regroot) {
             if (pInitializePrintMonitor2 != NULL) {
                 FIXME("%s,InitializePrintMonitor2 not implemented\n", debugstr_w(driver));
             }
-- 
1.4.1



More information about the wine-patches mailing list