Francois Gouget : kernel32/tests: Fix some module tests on Windows 8.

Alexandre Julliard julliard at winehq.org
Fri Nov 1 15:17:06 CDT 2013


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

Author: Francois Gouget <fgouget at free.fr>
Date:   Fri Nov  1 10:14:44 2013 +0100

kernel32/tests: Fix some module tests on Windows 8.

Windows 8 and 8.1 return some different error codes and
GetDllDirectory() handles buffer termination a bit differently.

---

 dlls/kernel32/tests/module.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/dlls/kernel32/tests/module.c b/dlls/kernel32/tests/module.c
index 6e9ad13..992f0ec 100644
--- a/dlls/kernel32/tests/module.c
+++ b/dlls/kernel32/tests/module.c
@@ -261,7 +261,8 @@ static void testLoadLibraryEx(void)
     hmodule = LoadLibraryExA("", NULL, 0);
     ok(hmodule == 0, "Expected 0, got %p\n", hmodule);
     ok(GetLastError() == ERROR_MOD_NOT_FOUND ||
-       GetLastError() == ERROR_DLL_NOT_FOUND, /* win9x */
+       GetLastError() == ERROR_DLL_NOT_FOUND /* win9x */ ||
+       GetLastError() == ERROR_INVALID_PARAMETER /* win8 */,
        "Expected ERROR_MOD_NOT_FOUND or ERROR_DLL_NOT_FOUND, got %d\n",
        GetLastError());
 
@@ -438,7 +439,8 @@ static void testGetDllDirectory(void)
         bufferA[length] = 'A';
         bufferA[length + 1] = 'A';
         ret = pGetDllDirectoryA(length + 1, bufferA);
-        ok(ret == length, "i=%d, Expected %u, got %u\n", i, length, ret);
+        ok(ret == length || broken(ret + 1 == length) /* win8 */,
+           "i=%d, Expected %u(+1), got %u\n", i, length, ret);
         ok(bufferA[length + 1] == 'A', "i=%d, Buffer overflow\n", i);
         ok(strcmp(bufferA, dll_directories[i]) == 0, "i=%d, Wrong path returned: '%s'\n", i, bufferA);
 
@@ -450,13 +452,11 @@ static void testGetDllDirectory(void)
         ok(cmpStrAW(dll_directories[i], bufferW, length, length),
            "i=%d, Wrong path returned: %s\n", i, wine_dbgstr_w(bufferW));
 
-        /* zero size buffer
-         * the A version always null-terminates the buffer,
-         * the W version doesn't do it on some platforms */
+        /* Zero size buffer. The buffer may or may not be terminated depending
+         * on the Windows version and whether the A or W API is called. */
         bufferA[0] = 'A';
         ret = pGetDllDirectoryA(0, bufferA);
         ok(ret == length + 1, "i=%d, Expected %u, got %u\n", i, length + 1, ret);
-        ok(bufferA[0] == 0, "i=%d, Buffer not null terminated\n", i);
 
         bufferW[0] = 'A';
         ret = pGetDllDirectoryW(0, bufferW);
@@ -468,7 +468,8 @@ static void testGetDllDirectory(void)
         bufferA[0] = 'A';
         ret = pGetDllDirectoryA(length, bufferA);
         ok(ret == length + 1, "i=%d, Expected %u, got %u\n", i, length + 1, ret);
-        ok(bufferA[0] == 0, "i=%d, Buffer not null terminated\n", i);
+        if (length != 0)
+            ok(bufferA[0] == 0, "i=%d, Buffer not null terminated\n", i);
 
         bufferW[0] = 'A';
         ret = pGetDllDirectoryW(length, bufferW);




More information about the wine-cvs mailing list