Detlef Riekenberg : winspool: Support xcv in AddPortW.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 16 05:22:21 CST 2007


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

Author: Detlef Riekenberg <wine.dev at web.de>
Date:   Mon Jan 15 05:37:24 2007 +0100

winspool: Support xcv in AddPortW.

---

 dlls/winspool.drv/info.c |   48 ++++++++++++++++++++++++++++++---------------
 1 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index 934565c..053cbbe 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -6001,7 +6001,8 @@ BOOL WINAPI AddPortA(LPSTR pName, HWND h
 BOOL WINAPI AddPortW(LPWSTR pName, HWND hWnd, LPWSTR pMonitorName)
 {
     monitor_t * pm;
-    DWORD   res = ROUTER_UNKNOWN;
+    monitor_t * pui;
+    DWORD       res;
 
     TRACE("(%s, %p, %s)\n", debugstr_w(pName), hWnd, debugstr_w(pMonitorName));
 
@@ -6016,28 +6017,43 @@ BOOL WINAPI AddPortW(LPWSTR pName, HWND
     }
 
     /* an empty Monitorname is Invalid */
-    if (!pMonitorName[0]) goto cleanup;
+    if (!pMonitorName[0]) {
+        SetLastError(ERROR_NOT_SUPPORTED);
+        return FALSE;
+    }
 
     pm = monitor_load(pMonitorName, NULL);
-    if (pm && pm->monitor) {
-        if (pm->monitor->pfnAddPort != NULL) {
-            res = pm->monitor->pfnAddPort(pName, hWnd, pMonitorName);
-            TRACE("got %d with %d\n", res, GetLastError());
+    if (pm && pm->monitor && pm->monitor->pfnAddPort) {
+        res = pm->monitor->pfnAddPort(pName, hWnd, pMonitorName);
+        TRACE("got %d with %u\n", res, GetLastError());
+        res = TRUE;
+    }
+    else
+    {
+        pui = monitor_loadui(pm);
+        if (pui && pui->monitorUI && pui->monitorUI->pfnAddPortUI) {
+            TRACE("use %p: %s\n", pui, debugstr_w(pui->dllname));
+            res = pui->monitorUI->pfnAddPortUI(pName, hWnd, pMonitorName, NULL);
+            TRACE("got %d with %u\n", res, GetLastError());
+            res = TRUE;
         }
-        else if (pm->monitor->pfnXcvOpenPort != NULL)
+        else
         {
-            FIXME("XcvOpenPort not implemented (dwMonitorSize: %d)\n", pm->dwMonitorSize);
+            FIXME("not implemented for %s (%p: %s => %p: %s)\n", debugstr_w(pMonitorName),
+                pm, pm ? debugstr_w(pm->dllname) : NULL, pui, pui ? debugstr_w(pui->dllname) : NULL);
+
+            /* XP: ERROR_NOT_SUPPORTED, NT351,9x: ERROR_INVALID_PARAMETER */
+            SetLastError(ERROR_NOT_SUPPORTED);
+            res = FALSE;
         }
-        /* invalidate cached PORT_INFO_2W */
-        if (res == ROUTER_SUCCESS) monitor_flush(pm);
+        monitor_unload(pui);
     }
-    monitor_unload(pm);
+    /* invalidate cached PORT_INFO_2W */
+    monitor_flush(pm);
 
-cleanup:
-    /* XP: ERROR_NOT_SUPPORTED, NT351,9x: ERROR_INVALID_PARAMETER */
-    if (res == ROUTER_UNKNOWN) SetLastError(ERROR_NOT_SUPPORTED);
-    TRACE("returning %d with %d\n", (res == ROUTER_SUCCESS), GetLastError());
-    return (res == ROUTER_SUCCESS);
+    monitor_unload(pm);
+    TRACE("returning %d with %u\n", res, GetLastError());
+    return res;
 }
 
 /******************************************************************************




More information about the wine-cvs mailing list