localspl/tests: load the userinterface-dll on demand

Detlef Riekenberg wine.dev at web.de
Mon Jan 8 10:58:54 CST 2007


The userinterface for "Local Port" is in a seperate dll since w2k
("localui.dll").

Use the documented API ("XcvDataPort") to get the
dllname and load it on demand

This is a step for more tests with the dislogs


changelog:
localspl/tests: load the userinterface-dll on demand




-- 
 
By by ... Detlef

-------------- next part --------------
>From d8478ea4cd18b2bf038c26970a2358f7f7ea403c Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Mon, 8 Jan 2007 17:23:13 +0100
Subject: [PATCH] localspl/tests: load userinterface-dll on demand
---
 dlls/localspl/tests/localmon.c |   44 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/dlls/localspl/tests/localmon.c b/dlls/localspl/tests/localmon.c
index b99a6a8..b5d0ddf 100644
--- a/dlls/localspl/tests/localmon.c
+++ b/dlls/localspl/tests/localmon.c
@@ -58,6 +58,13 @@ static BOOL  (WINAPI *pXcvOpenPort)(LPCW
 static DWORD (WINAPI *pXcvDataPort)(HANDLE, LPCWSTR, PBYTE, DWORD, PBYTE, DWORD, PDWORD);
 static BOOL  (WINAPI *pXcvClosePort)(HANDLE);
 
+static HMODULE  hlocalui;
+static PMONITORUI (WINAPI *pInitializePrintMonitorUI)(VOID);
+static PMONITORUI pui;
+static BOOL  (WINAPI *pAddPortUI)(PCWSTR, HWND, PCWSTR, PWSTR *);
+static BOOL  (WINAPI *pConfigurePortUI)(PCWSTR, HWND, PCWSTR);
+static BOOL  (WINAPI *pDeletePortUI)(PCWSTR, HWND, PCWSTR);
+
 static WCHAR cmd_MonitorUIW[] = {'M','o','n','i','t','o','r','U','I',0};
 static WCHAR cmd_MonitorUI_lcaseW[] = {'m','o','n','i','t','o','r','u','i',0};
 static WCHAR does_not_existW[] = {'d','o','e','s','_','n','o','t','_','e','x','i','s','t',0};
@@ -481,11 +488,15 @@ #define GET_MONITOR_FUNC(name) \
 
 START_TEST(localmon)
 {
+    DWORD   numentries;
+
     /* This DLL does not exists on Win9x */
     hdll = LoadLibraryA("localspl.dll");
     if (!hdll) return;
 
     pInitializePrintMonitor = (void *) GetProcAddress(hdll, "InitializePrintMonitor");
+    pInitializePrintMonitorUI = (void *) GetProcAddress(hdll, "InitializePrintMonitorUI");
+
     if (!pInitializePrintMonitor) {
         /* The Monitor for "Local Ports" was in a seperate dll before w2k */
         hlocalmon = LoadLibraryA("localmon.dll");
@@ -501,7 +512,6 @@ START_TEST(localmon)
        or InitializePrintMonitor fails. */
     pm = pInitializePrintMonitor(Monitors_LocalPortW);
     if (pm) {
-        DWORD   numentries;
         numentries = (pm->dwMonitorSize ) / sizeof(VOID *);
         /* NT4: 14, since w2k: 17 */
         ok( numentries == 14 || numentries == 17, 
@@ -525,6 +535,38 @@ START_TEST(localmon)
         GET_MONITOR_FUNC(XcvDataPort);
         GET_MONITOR_FUNC(XcvClosePort);
     }
+
+    if ((!pInitializePrintMonitorUI) && (pXcvOpenPort) && (pXcvDataPort) && (pXcvClosePort)) {
+        /* The User-Interface for "Local Ports" is in a seperate dll since w2k */
+        BYTE    buffer[MAX_PATH];
+        DWORD   res;
+        DWORD   len;
+        HANDLE  hXcv;
+
+        res = pXcvOpenPort(emptyW, SERVER_ACCESS_ADMINISTER, &hXcv);
+        if (res) {
+            res = pXcvDataPort(hXcv, cmd_MonitorUIW, NULL, 0, buffer, MAX_PATH, &len);
+            if (res == ERROR_SUCCESS) hlocalui = LoadLibraryW( (LPWSTR) buffer);
+            if (hlocalui) pInitializePrintMonitorUI = (void *) GetProcAddress(hlocalui, "InitializePrintMonitorUI");
+            pXcvClosePort(hXcv);
+        }
+    }
+
+    if (pInitializePrintMonitorUI) {
+        pui = pInitializePrintMonitorUI();
+        if (pui) {
+            numentries = (pui->dwMonitorUISize - sizeof(DWORD)) / sizeof(VOID *);
+            ok( numentries == 3,
+                "dwMonitorUISize (%d) => %d Functions\n", pui->dwMonitorUISize, numentries);
+
+            if (numentries > 2) {
+                pAddPortUI = pui->pfnAddPortUI;
+                pConfigurePortUI = pui->pfnConfigurePortUI;
+                pDeletePortUI = pui->pfnDeletePortUI;
+            }
+        }
+    }
+
     test_InitializePrintMonitor();
 
     test_AddPort();
-- 
1.4.1



More information about the wine-patches mailing list