Paul Vriens : kernel32/tests: Fix some test failures on Win9x and WinME ( GetPrivateProfileSectionNames).

Alexandre Julliard julliard at winehq.org
Thu Jan 29 09:14:47 CST 2009


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

Author: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date:   Wed Jan 28 21:17:08 2009 +0100

kernel32/tests: Fix some test failures on Win9x and WinME (GetPrivateProfileSectionNames).

---

 dlls/kernel32/tests/profile.c |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c
index fba8c5d..303b2d2 100644
--- a/dlls/kernel32/tests/profile.c
+++ b/dlls/kernel32/tests/profile.c
@@ -217,9 +217,13 @@ static void test_profile_sections_names(void)
     /* Test with sufficiently large buffer */
     memset(buf, 0xc, sizeof(buf));
     ret = GetPrivateProfileSectionNamesA( buf, 29, testfile3 );
-    ok( ret == 27, "expected return size 27, got %d\n", ret );
-    ok( buf[ret-1] == 0 && buf[ret] == 0, "returned buffer not terminated with double-null\n" );
-    
+    ok( ret == 27 ||
+        broken(ret == 28), /* Win9x, WinME */
+        "expected return size 27, got %d\n", ret );
+    ok( (buf[ret-1] == 0 && buf[ret] == 0) ||
+        broken(buf[ret-1] == 0 && buf[ret-2] == 0), /* Win9x, WinME */
+        "returned buffer not terminated with double-null\n" );
+
     /* Test with exactly fitting buffer */
     memset(buf, 0xc, sizeof(buf));
     ret = GetPrivateProfileSectionNamesA( buf, 28, testfile3 );
@@ -236,13 +240,19 @@ static void test_profile_sections_names(void)
     memset(buf, 0xc, sizeof(buf));
     ret = GetPrivateProfileSectionNamesA( buf, 27, testfile3 );
     ok( ret == 25, "expected return size 25, got %d\n", ret );
+    /* Win9x and WinME only fills the buffer with complete section names (double-null terminated) */
+    count = strlen("section1") + sizeof(CHAR) + strlen("section2");
     todo_wine
-    ok( buf[ret+1] == 0 && buf[ret] == 0, "returned buffer not terminated with double-null\n" );
-    
+    ok( (buf[ret+1] == 0 && buf[ret] == 0) ||
+        broken(buf[count] == 0 && buf[count+1] == 0), /* Win9x, WinME */
+        "returned buffer not terminated with double-null\n" );
+
     /* Tests on nonexistent file */
     memset(buf, 0xc, sizeof(buf));
     ret = GetPrivateProfileSectionNamesA( buf, 10, ".\\not_here.ini" );
-    ok( ret == 0, "expected return size 0, got %d\n", ret );
+    ok( ret == 0 ||
+        broken(ret == 1), /* Win9x, WinME */
+        "expected return size 0, got %d\n", ret );
     ok( buf[0] == 0, "returned buffer not terminated with null\n" );
     ok( buf[1] != 0, "returned buffer terminated with double-null\n" );
     




More information about the wine-cvs mailing list