Detlef Riekenberg : spoolss/test: Add a test for BuildOtherNamesFromMachineName.

Alexandre Julliard julliard at winehq.org
Mon Oct 22 09:55:16 CDT 2007


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

Author: Detlef Riekenberg <wine.dev at web.de>
Date:   Fri Oct 19 23:11:20 2007 +0200

spoolss/test: Add a test for BuildOtherNamesFromMachineName.

---

 dlls/spoolss/tests/spoolss.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/dlls/spoolss/tests/spoolss.c b/dlls/spoolss/tests/spoolss.c
index 3797785..602b925 100644
--- a/dlls/spoolss/tests/spoolss.c
+++ b/dlls/spoolss/tests/spoolss.c
@@ -33,6 +33,7 @@
 static HMODULE hwinspool;
 
 static HMODULE hspl;
+static BOOL   (WINAPI * pBuildOtherNamesFromMachineName)(LPWSTR **, LPDWORD);
 static DWORD  (WINAPI * pSplInitializeWinSpoolDrv)(LPVOID *);
 
 #define WINSPOOL_TABLESIZE   16
@@ -51,6 +52,10 @@ static LPCSTR load_functions(void)
     hspl = LoadLibraryA(ptr);
     if (!hspl) return ptr;
 
+    ptr = "BuildOtherNamesFromMachineName";
+    pBuildOtherNamesFromMachineName = (void *) GetProcAddress(hspl, ptr);
+    if (!pBuildOtherNamesFromMachineName) return ptr;
+
     ptr = "SplInitializeWinSpoolDrv";
     pSplInitializeWinSpoolDrv = (void *) GetProcAddress(hspl, ptr);
     if (!pSplInitializeWinSpoolDrv) return ptr;
@@ -90,6 +95,33 @@ static LPCSTR load_functions(void)
 
 /* ########################### */
 
+static void test_BuildOtherNamesFromMachineName(void)
+{
+    LPWSTR *buffers;
+    DWORD   numentries;
+    DWORD   res;
+
+    buffers = NULL;
+    numentries = 0;
+
+    SetLastError(0xdeadbeef);
+    res = pBuildOtherNamesFromMachineName(&buffers, &numentries);
+
+    /* An array with 3 stringpointer is returned:
+      entry_#0: "" (empty String)
+      entry_#1: <hostname> (this is the same as the computernam)
+      entry_#2: <ip-address> (string with the ip-address of <hostname>)
+    */
+    todo_wine
+    ok( res && (buffers != NULL) && (numentries == 3) && (buffers[0] != NULL) && (buffers[0][0] == '\0'),
+        "got %u with %u and %p,%u (%p:%d)\n", res, GetLastError(), buffers, numentries,
+        ((numentries > 0) && buffers) ? buffers[0] : NULL,
+        ((numentries > 0) && buffers && buffers[0]) ? lstrlenW(buffers[0]) : -1);
+
+}
+
+/* ########################### */
+
 static void test_SplInitializeWinSpoolDrv(VOID)
 {
     DWORD   res;
@@ -124,6 +156,7 @@ START_TEST(spoolss)
         return;
     }
 
+    test_BuildOtherNamesFromMachineName();
     test_SplInitializeWinSpoolDrv();
 
 }




More information about the wine-cvs mailing list