Hi, This patch fixes some ntdll tests that crash on Win98. It doesn't make sense to run this test on Win98, I know, but it's better to exit gracefully, like some ntdll tests already do. -Hans Changelog: Check if a function exists before testing it. Uncomment some tests in rtlstr.c and wrap them in todo_wine{} instead.
Index: dlls/ntdll/tests/env.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/tests/env.c,v retrieving revision 1.4 diff -u -r1.4 env.c --- dlls/ntdll/tests/env.c 5 Sep 2003 23:08:34 -0000 1.4 +++ dlls/ntdll/tests/env.c 13 Dec 2003 22:41:15 -0000 @@ -295,7 +295,10 @@ pRtlSetEnvironmentVariable = (void*)GetProcAddress(mod, "RtlSetEnvironmentVariable"); pRtlExpandEnvironmentStrings_U = (void*)GetProcAddress(mod, "RtlExpandEnvironmentStrings_U"); - testQuery(); - testSet(); - testExpand(); + if (pRtlQueryEnvironmentVariable_U) + testQuery(); + if (pRtlSetEnvironmentVariable) + testSet(); + if (pRtlExpandEnvironmentStrings_U) + testExpand(); }
Index: dlls/ntdll/tests/large_int.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/tests/large_int.c,v retrieving revision 1.4 diff -u -r1.4 large_int.c --- dlls/ntdll/tests/large_int.c 4 Oct 2003 03:04:47 -0000 1.4 +++ dlls/ntdll/tests/large_int.c 13 Dec 2003 22:41:36 -0000 @@ -421,9 +421,10 @@ { InitFunctionPtrs(); - test_RtlExtendedMagicDivide(); - if (pRtlInt64ToUnicodeString != NULL) { - test_RtlInt64ToUnicodeString(); - } /* if */ - test_RtlLargeIntegerToChar(); + if (pRtlExtendedMagicDivide) + test_RtlExtendedMagicDivide(); + if (pRtlInt64ToUnicodeString) + test_RtlInt64ToUnicodeString(); + if (pRtlLargeIntegerToChar) + test_RtlLargeIntegerToChar(); }
Index: dlls/ntdll/tests/rtl.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/tests/rtl.c,v retrieving revision 1.5 diff -u -r1.5 rtl.c --- dlls/ntdll/tests/rtl.c 5 Sep 2003 23:08:34 -0000 1.5 +++ dlls/ntdll/tests/rtl.c 13 Dec 2003 22:46:24 -0000 @@ -827,18 +827,28 @@ { InitFunctionPtrs(); - test_RtlCompareMemory(); - test_RtlCompareMemoryUlong(); - test_RtlMoveMemory(); - test_RtlFillMemory(); - test_RtlFillMemoryUlong(); - test_RtlZeroMemory(); - if (pRtlUlonglongByteSwap) { - test_RtlUlonglongByteSwap(); - } /* if */ - test_RtlUniform(); - test_RtlRandom(); - test_RtlAreAllAccessesGranted(); - test_RtlAreAnyAccessesGranted(); - test_RtlComputeCrc32(); + if (pRtlCompareMemory) + test_RtlCompareMemory(); + if (pRtlCompareMemoryUlong) + test_RtlCompareMemoryUlong(); + if (pRtlMoveMemory) + test_RtlMoveMemory(); + if (pRtlFillMemory) + test_RtlFillMemory(); + if (pRtlFillMemoryUlong) + test_RtlFillMemoryUlong(); + if (pRtlZeroMemory) + test_RtlZeroMemory(); + if (pRtlUlonglongByteSwap) + test_RtlUlonglongByteSwap(); + if (pRtlUniform) + test_RtlUniform(); + if (pRtlRandom) + test_RtlRandom(); + if (pRtlAreAllAccessesGranted) + test_RtlAreAllAccessesGranted(); + if (pRtlAreAnyAccessesGranted) + test_RtlAreAnyAccessesGranted(); + if (pRtlComputeCrc32) + test_RtlComputeCrc32(); }
Index: dlls/ntdll/tests/path.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/tests/path.c,v retrieving revision 1.4 diff -u -r1.4 path.c --- dlls/ntdll/tests/path.c 6 Oct 2003 21:03:32 -0000 1.4 +++ dlls/ntdll/tests/path.c 13 Dec 2003 22:44:12 -0000 @@ -234,7 +234,10 @@ pRtlIsDosDeviceName_U = (void *)GetProcAddress(mod,"RtlIsDosDeviceName_U"); pRtlOemStringToUnicodeString = (void *)GetProcAddress(mod,"RtlOemStringToUnicodeString"); pRtlIsNameLegalDOS8Dot3 = (void *)GetProcAddress(mod,"RtlIsNameLegalDOS8Dot3"); - test_RtlDetermineDosPathNameType(); - test_RtlIsDosDeviceName(); - test_RtlIsNameLegalDOS8Dot3(); + if (pRtlDetermineDosPathNameType_U) + test_RtlDetermineDosPathNameType(); + if (pRtlIsDosDeviceName_U) + test_RtlIsDosDeviceName(); + if (pRtlIsNameLegalDOS8Dot3) + test_RtlIsNameLegalDOS8Dot3(); }
Index: dlls/ntdll/tests/string.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/tests/string.c,v retrieving revision 1.4 diff -u -r1.4 string.c --- dlls/ntdll/tests/string.c 4 Oct 2003 03:04:46 -0000 1.4 +++ dlls/ntdll/tests/string.c 13 Dec 2003 22:50:04 -0000 @@ -1075,13 +1075,20 @@ { InitFunctionPtrs(); - test_ulongtoa(); - test_ulonglongtoa(); - test_atoi64(); - - test_ulongtow(); - test_ulonglongtow(); - test_wtoi(); - test_wtol(); - test_wtoi64(); + if (p_ultoa) + test_ulongtoa(); + if (p_ui64toa) + test_ulonglongtoa(); + if (p_atoi64) + test_atoi64(); + if (p_ultow) + test_ulongtow(); + if (p_ui64tow) + test_ulonglongtow(); + if (p_wtoi) + test_wtoi(); + if (p_wtol) + test_wtol(); + if (p_wtoi64) + test_wtoi64(); }
Index: dlls/ntdll/tests/rtlstr.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/tests/rtlstr.c,v retrieving revision 1.14 diff -u -r1.14 rtlstr.c --- dlls/ntdll/tests/rtlstr.c 12 Dec 2003 05:56:44 -0000 1.14 +++ dlls/ntdll/tests/rtlstr.c 13 Dec 2003 22:47:29 -0000 @@ -561,22 +561,25 @@ WCHAR upper_ch; WCHAR expected_upper_ch; - for (i = 0; i <= 255; i++) { - ch = (WCHAR) i; - upper_ch = pRtlUpcaseUnicodeChar(ch); - if (ch >= 'a' && ch <= 'z') { - expected_upper_ch = ch - 'a' + 'A'; - } else if (ch >= 0xe0 && ch <= 0xfe && ch != 0xf7) { - expected_upper_ch = ch - 0x20; - } else if (ch == 0xff) { - expected_upper_ch = 0x178; - } else { - expected_upper_ch = ch; - } /* if */ - ok(upper_ch == expected_upper_ch, - "RtlUpcaseUnicodeChar('%c'[=0x%x]) has result '%c'[=0x%x], expected: '%c'[=0x%x]", - ch, ch, upper_ch, upper_ch, expected_upper_ch, expected_upper_ch); - } /* for */ + todo_wine + { + for (i = 0; i <= 255; i++) { + ch = (WCHAR) i; + upper_ch = pRtlUpcaseUnicodeChar(ch); + if (ch >= 'a' && ch <= 'z') { + expected_upper_ch = ch - 'a' + 'A'; + } else if (ch >= 0xe0 && ch <= 0xfe && ch != 0xf7) { + expected_upper_ch = ch - 0x20; + } else if (ch == 0xff) { + expected_upper_ch = 0x178; + } else { + expected_upper_ch = ch; + } /* if */ + ok(upper_ch == expected_upper_ch, + "RtlUpcaseUnicodeChar('%c'[=0x%x]) has result '%c'[=0x%x], expected: '%c'[=0x%x]", + ch, ch, upper_ch, upper_ch, expected_upper_ch, expected_upper_ch); + } /* for */ + } } @@ -592,42 +595,45 @@ UNICODE_STRING result_str; UNICODE_STRING upper_str; - for (i = 0; i <= 255; i++) { - ch = (WCHAR) i; - if (ch >= 'a' && ch <= 'z') { - upper_ch = ch - 'a' + 'A'; - } else if (ch >= 0xe0 && ch <= 0xfe && ch != 0xf7) { - upper_ch = ch - 0x20; - } else if (ch == 0xff) { - upper_ch = 0x178; - } else { - upper_ch = ch; - } /* if */ - ascii_buf[i] = ch; - result_buf[i] = '\0'; - upper_buf[i] = upper_ch; - } /* for */ - ascii_buf[i] = '\0'; - result_buf[i] = '\0'; - upper_buf[i] = '\0'; - ascii_str.Length = 512; - ascii_str.MaximumLength = 512; - ascii_str.Buffer = ascii_buf; - result_str.Length = 512; - result_str.MaximumLength = 512; - result_str.Buffer = result_buf; - upper_str.Length = 512; - upper_str.MaximumLength = 512; - upper_str.Buffer = upper_buf; - - pRtlUpcaseUnicodeString(&result_str, &ascii_str, 0); - for (i = 0; i <= 255; i++) { - ok(result_str.Buffer[i] == upper_str.Buffer[i], - "RtlUpcaseUnicodeString works wrong: '%c'[=0x%x] is converted to '%c'[=0x%x], expected: '%c'[=0x%x]", - ascii_str.Buffer[i], ascii_str.Buffer[i], - result_str.Buffer[i], result_str.Buffer[i], - upper_str.Buffer[i], upper_str.Buffer[i]); - } /* for */ + todo_wine + { + for (i = 0; i <= 255; i++) { + ch = (WCHAR) i; + if (ch >= 'a' && ch <= 'z') { + upper_ch = ch - 'a' + 'A'; + } else if (ch >= 0xe0 && ch <= 0xfe && ch != 0xf7) { + upper_ch = ch - 0x20; + } else if (ch == 0xff) { + upper_ch = 0x178; + } else { + upper_ch = ch; + } /* if */ + ascii_buf[i] = ch; + result_buf[i] = '\0'; + upper_buf[i] = upper_ch; + } /* for */ + ascii_buf[i] = '\0'; + result_buf[i] = '\0'; + upper_buf[i] = '\0'; + ascii_str.Length = 512; + ascii_str.MaximumLength = 512; + ascii_str.Buffer = ascii_buf; + result_str.Length = 512; + result_str.MaximumLength = 512; + result_str.Buffer = result_buf; + upper_str.Length = 512; + upper_str.MaximumLength = 512; + upper_str.Buffer = upper_buf; + + pRtlUpcaseUnicodeString(&result_str, &ascii_str, 0); + for (i = 0; i <= 255; i++) { + ok(result_str.Buffer[i] == upper_str.Buffer[i], + "RtlUpcaseUnicodeString works wrong: '%c'[=0x%x] is converted to '%c'[=0x%x], expected: '%c'[=0x%x]", + ascii_str.Buffer[i], ascii_str.Buffer[i], + result_str.Buffer[i], result_str.Buffer[i], + upper_str.Buffer[i], upper_str.Buffer[i]); + } /* for */ + } } @@ -643,76 +649,79 @@ UNICODE_STRING result_str; UNICODE_STRING lower_str; - for (i = 0; i <= 1024; i++) { - ch = (WCHAR) i; - if (ch >= 'A' && ch <= 'Z') { - lower_ch = ch - 'A' + 'a'; - } else if (ch >= 0xc0 && ch <= 0xde && ch != 0xd7) { - lower_ch = ch + 0x20; - } else if (ch >= 0x391 && ch <= 0x3ab && ch != 0x3a2) { - lower_ch = ch + 0x20; - } else { - switch (ch) { - case 0x178: lower_ch = 0xff; break; - case 0x181: lower_ch = 0x253; break; - case 0x186: lower_ch = 0x254; break; - case 0x189: lower_ch = 0x256; break; - case 0x18a: lower_ch = 0x257; break; - case 0x18e: lower_ch = 0x1dd; break; - case 0x18f: lower_ch = 0x259; break; - case 0x190: lower_ch = 0x25b; break; - case 0x193: lower_ch = 0x260; break; - case 0x194: lower_ch = 0x263; break; - case 0x196: lower_ch = 0x269; break; - case 0x197: lower_ch = 0x268; break; - case 0x19c: lower_ch = 0x26f; break; - case 0x19d: lower_ch = 0x272; break; - case 0x19f: lower_ch = 0x275; break; - case 0x1a9: lower_ch = 0x283; break; - case 0x1ae: lower_ch = 0x288; break; - case 0x1b1: lower_ch = 0x28a; break; - case 0x1b2: lower_ch = 0x28b; break; - case 0x1b7: lower_ch = 0x292; break; - case 0x1c4: lower_ch = 0x1c6; break; - case 0x1c7: lower_ch = 0x1c9; break; - case 0x1ca: lower_ch = 0x1cc; break; - case 0x1f1: lower_ch = 0x1f3; break; - case 0x386: lower_ch = 0x3ac; break; - case 0x388: lower_ch = 0x3ad; break; - case 0x389: lower_ch = 0x3ae; break; - case 0x38a: lower_ch = 0x3af; break; - case 0x38c: lower_ch = 0x3cc; break; - case 0x38e: lower_ch = 0x3cd; break; - case 0x38f: lower_ch = 0x3ce; break; - case 0x400: lower_ch = 0x0; break; - default: lower_ch = ch; break; - } /* switch */ - } /* if */ - source_buf[i] = ch; - result_buf[i] = '\0'; - lower_buf[i] = lower_ch; - } /* for */ - source_buf[i] = '\0'; - result_buf[i] = '\0'; - lower_buf[i] = '\0'; - source_str.Length = 2048; - source_str.MaximumLength = 2048; - source_str.Buffer = source_buf; - result_str.Length = 2048; - result_str.MaximumLength = 2048; - result_str.Buffer = result_buf; - lower_str.Length = 2048; - lower_str.MaximumLength = 2048; - lower_str.Buffer = lower_buf; - - pRtlDowncaseUnicodeString(&result_str, &source_str, 0); - for (i = 0; i <= 1024; i++) { - ok(result_str.Buffer[i] == lower_str.Buffer[i] || result_str.Buffer[i] == source_str.Buffer[i] + 1, - "RtlDowncaseUnicodeString works wrong: '%c'[=0x%x] is converted to '%c'[=0x%x], expected: '%c'[=0x%x]", - source_str.Buffer[i], source_str.Buffer[i], - result_str.Buffer[i], result_str.Buffer[i], - lower_str.Buffer[i], lower_str.Buffer[i]); - } /* for */ + todo_wine + { + for (i = 0; i <= 1024; i++) { + ch = (WCHAR) i; + if (ch >= 'A' && ch <= 'Z') { + lower_ch = ch - 'A' + 'a'; + } else if (ch >= 0xc0 && ch <= 0xde && ch != 0xd7) { + lower_ch = ch + 0x20; + } else if (ch >= 0x391 && ch <= 0x3ab && ch != 0x3a2) { + lower_ch = ch + 0x20; + } else { + switch (ch) { + case 0x178: lower_ch = 0xff; break; + case 0x181: lower_ch = 0x253; break; + case 0x186: lower_ch = 0x254; break; + case 0x189: lower_ch = 0x256; break; + case 0x18a: lower_ch = 0x257; break; + case 0x18e: lower_ch = 0x1dd; break; + case 0x18f: lower_ch = 0x259; break; + case 0x190: lower_ch = 0x25b; break; + case 0x193: lower_ch = 0x260; break; + case 0x194: lower_ch = 0x263; break; + case 0x196: lower_ch = 0x269; break; + case 0x197: lower_ch = 0x268; break; + case 0x19c: lower_ch = 0x26f; break; + case 0x19d: lower_ch = 0x272; break; + case 0x19f: lower_ch = 0x275; break; + case 0x1a9: lower_ch = 0x283; break; + case 0x1ae: lower_ch = 0x288; break; + case 0x1b1: lower_ch = 0x28a; break; + case 0x1b2: lower_ch = 0x28b; break; + case 0x1b7: lower_ch = 0x292; break; + case 0x1c4: lower_ch = 0x1c6; break; + case 0x1c7: lower_ch = 0x1c9; break; + case 0x1ca: lower_ch = 0x1cc; break; + case 0x1f1: lower_ch = 0x1f3; break; + case 0x386: lower_ch = 0x3ac; break; + case 0x388: lower_ch = 0x3ad; break; + case 0x389: lower_ch = 0x3ae; break; + case 0x38a: lower_ch = 0x3af; break; + case 0x38c: lower_ch = 0x3cc; break; + case 0x38e: lower_ch = 0x3cd; break; + case 0x38f: lower_ch = 0x3ce; break; + case 0x400: lower_ch = 0x0; break; + default: lower_ch = ch; break; + } /* switch */ + } /* if */ + source_buf[i] = ch; + result_buf[i] = '\0'; + lower_buf[i] = lower_ch; + } /* for */ + source_buf[i] = '\0'; + result_buf[i] = '\0'; + lower_buf[i] = '\0'; + source_str.Length = 2048; + source_str.MaximumLength = 2048; + source_str.Buffer = source_buf; + result_str.Length = 2048; + result_str.MaximumLength = 2048; + result_str.Buffer = result_buf; + lower_str.Length = 2048; + lower_str.MaximumLength = 2048; + lower_str.Buffer = lower_buf; + + pRtlDowncaseUnicodeString(&result_str, &source_str, 0); + for (i = 0; i <= 1024; i++) { + ok(result_str.Buffer[i] == lower_str.Buffer[i] || result_str.Buffer[i] == source_str.Buffer[i] + 1, + "RtlDowncaseUnicodeString works wrong: '%c'[=0x%x] is converted to '%c'[=0x%x], expected: '%c'[=0x%x]", + source_str.Buffer[i], source_str.Buffer[i], + result_str.Buffer[i], result_str.Buffer[i], + lower_str.Buffer[i], lower_str.Buffer[i]); + } /* for */ + } } @@ -1738,9 +1747,10 @@ test_RtlGUIDFromString(); if (pRtlStringFromGUID) test_RtlStringFromGUID(); - /* - * test_RtlUpcaseUnicodeChar(); - * test_RtlUpcaseUnicodeString(); - * test_RtlDowncaseUnicodeString(); - */ + if (pRtlUpcaseUnicodeChar) + test_RtlUpcaseUnicodeChar(); + if (pRtlUpcaseUnicodeString) + test_RtlUpcaseUnicodeString(); + if (pRtlDowncaseUnicodeString) + test_RtlDowncaseUnicodeString(); }