James Hawkins : kernel32: Split the GetComputerName/ Ex tests into their own test functions.

Alexandre Julliard julliard at winehq.org
Thu Apr 17 07:38:21 CDT 2008


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

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Wed Apr 16 15:36:09 2008 -0500

kernel32: Split the GetComputerName/Ex tests into their own test functions.

---

 dlls/kernel32/tests/environ.c |   40 +++++++++++++++++++++++++++++++++-------
 1 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/dlls/kernel32/tests/environ.c b/dlls/kernel32/tests/environ.c
index 958da24..fb33304 100644
--- a/dlls/kernel32/tests/environ.c
+++ b/dlls/kernel32/tests/environ.c
@@ -25,6 +25,17 @@
 #include "winbase.h"
 #include "winerror.h"
 
+static BOOL (WINAPI *pGetComputerNameExA)(COMPUTER_NAME_FORMAT,LPSTR,LPDWORD);
+static BOOL (WINAPI *pGetComputerNameExW)(COMPUTER_NAME_FORMAT,LPWSTR,LPDWORD);
+
+static void init_functionpointers(void)
+{
+    HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
+
+    pGetComputerNameExA = (void *)GetProcAddress(hkernel32, "GetComputerNameExA");
+    pGetComputerNameExW = (void *)GetProcAddress(hkernel32, "GetComputerNameExW");
+}
+
 static void test_GetSetEnvironmentVariableA(void)
 {
     char buf[256];
@@ -291,9 +302,6 @@ static void test_ExpandEnvironmentStringsA(void)
     SetEnvironmentVariableA("EnvVar", NULL);
 }
 
-static BOOL (WINAPI *pGetComputerNameExA)(COMPUTER_NAME_FORMAT,LPSTR,LPDWORD);
-static BOOL (WINAPI *pGetComputerNameExW)(COMPUTER_NAME_FORMAT,LPWSTR,LPDWORD);
-
 static void test_GetComputerName(void)
 {
     DWORD size;
@@ -347,11 +355,18 @@ static void test_GetComputerName(void)
         ok(ret, "GetComputerNameW failed with error %d\n", GetLastError());
         HeapFree(GetProcessHeap(), 0, nameW);
     }
+}
+
+static void test_GetComputerNameExA(void)
+{
+    DWORD size;
+    BOOL ret;
+    LPSTR name;
+    DWORD error;
 
-    pGetComputerNameExA = (void *)GetProcAddress(GetModuleHandle("kernel32.dll"), "GetComputerNameExA");
     if (!pGetComputerNameExA)
     {
-        skip("GetComputerNameExA function not implemented, so not testing\n");
+        skip("GetComputerNameExA function not implemented\n");
         return;
     }
 
@@ -402,11 +417,18 @@ static void test_GetComputerName(void)
     ok(ret, "GetComputerNameExA(ComputerNameNetBIOS) failed with error %d\n", GetLastError());
     trace("NetBIOS name is \"%s\"\n", name);
     HeapFree(GetProcessHeap(), 0, name);
+}
+
+static void test_GetComputerNameExW(void)
+{
+    DWORD size;
+    BOOL ret;
+    LPWSTR nameW;
+    DWORD error;
 
-    pGetComputerNameExW = (void *)GetProcAddress(GetModuleHandle("kernel32.dll"), "GetComputerNameExW");
     if (!pGetComputerNameExW)
     {
-        skip("GetComputerNameExW function not implemented, so not testing\n");
+        skip("GetComputerNameExW function not implemented\n");
         return;
     }
 
@@ -453,8 +475,12 @@ static void test_GetComputerName(void)
 
 START_TEST(environ)
 {
+    init_functionpointers();
+
     test_GetSetEnvironmentVariableA();
     test_GetSetEnvironmentVariableW();
     test_ExpandEnvironmentStringsA();
     test_GetComputerName();
+    test_GetComputerNameExA();
+    test_GetComputerNameExW();
 }




More information about the wine-cvs mailing list