Make dlls-kernel-tests-process.c work on Windows 95 and XP.

Jakob Eriksson jakov at vmlinux.org
Sat Apr 24 19:43:02 CDT 2004



Remove one failure on Windows XP, now down from 9 to 8 failures.

Haven't tested on Windows 95 yet, to many crashes on that platform
on process.c for me to be bothered this night.



regards,
Jakob


-------------- next part --------------
Index: process.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/process.c,v
retrieving revision 1.15
diff -u -r1.15 process.c
--- process.c	6 Feb 2004 05:24:34 -0000	1.15
+++ process.c	25 Apr 2004 00:39:48 -0000
@@ -421,6 +421,51 @@
         ok(result == expect, "%s:%s expected %d, but got %d\n", (sect), (key), (int)(expect), result); \
    } while (0)
 
+static const char* test_Startup_strip_args(const char *path)
+{
+    static char no_args[MAX_PATH + 1];
+    int i;
+
+    strncpy(no_args, path, strlen(path) + 1);
+
+    i = 0;
+    while (no_args[i])
+    {
+        if (' ' == no_args[i])
+        {
+            no_args[i] = '\0';
+
+            return no_args;
+        }
+	i ++;
+    }
+
+    return no_args;
+}
+
+static const char* test_Startup_strip_full_path(const char *path)
+{
+    int len = strlen(path);
+    const char* onlyname = path + len;
+
+    if (0 == len)
+    {
+        return path;
+    }
+
+    do
+    {
+        onlyname --;
+	len --;
+    }
+    while (len && *onlyname != '\\');
+
+    if (*onlyname)
+        return onlyname + 1;
+
+    return path;
+}
+
 static void test_Startup(void)
 {
     char                buffer[MAX_PATH];
@@ -444,7 +489,17 @@
     GetStartupInfoA(&si);
     okChildInt("StartupInfoA", "cb", startup.cb);
     okChildString("StartupInfoA", "lpDesktop", si.lpDesktop);
-    okChildString("StartupInfoA", "lpTitle", si.lpTitle);
+    do
+    {
+        const char* expect = test_Startup_strip_args(si.lpTitle);
+        const char* sect = "StartupInfoA";
+        const char* key = "lpTitle";
+        const char* result = test_Startup_strip_full_path(getChildString(sect, key));
+        ok(strCmp(result, expect, 1) == 0,
+           "%s:%s expected '%s', got '%s'\n",
+           sect, key, expect ? expect:"(null)", result);
+    }
+    while (0);
     okChildInt("StartupInfoA", "dwX", startup.dwX);
     okChildInt("StartupInfoA", "dwY", startup.dwY);
     okChildInt("StartupInfoA", "dwXSize", startup.dwXSize);


More information about the wine-patches mailing list