From 42e6d94784cd403be77c6bd25b88d875a084438f Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 19 Sep 2008 14:03:47 +0200 Subject: [PATCH] ntdll/tests: Fix a couple of tests failing on NT4. --- dlls/ntdll/tests/om.c | 71 ++++++++++++++++++++++++++++---------------------- dlls/ntdll/tests/reg.c | 2 +- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c index d211ea00432..1999da6bb61 100644 --- a/dlls/ntdll/tests/om.c +++ b/dlls/ntdll/tests/om.c @@ -285,6 +285,7 @@ static void test_directory(void) UNICODE_STRING str; OBJECT_ATTRIBUTES attr; HANDLE dir, dir1, h; + BOOL is_nt4; /* No name and/or no attributes */ status = pNtCreateDirectoryObject(NULL, DIRECTORY_QUERY, &attr); @@ -335,14 +336,18 @@ static void test_directory(void) pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local"); InitializeObjectAttributes(&attr, &str, 0, 0, NULL); status = pNtOpenSymbolicLinkObject(&dir, SYMBOLIC_LINK_QUERY, &attr); - ok(status == STATUS_SUCCESS, "Failed to open SymbolicLink(%08x)\n", status); - pRtlFreeUnicodeString(&str); - InitializeObjectAttributes(&attr, &str, 0, dir, NULL); - pRtlCreateUnicodeStringFromAsciiz(&str, "one more level"); - DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_TYPE_MISMATCH) - pRtlFreeUnicodeString(&str); - pNtClose(h); - pNtClose(dir); + is_nt4 = (status == STATUS_OBJECT_NAME_NOT_FOUND); /* nt4 doesn't have Local\\ symlink */ + if (!is_nt4) + { + ok(status == STATUS_SUCCESS, "Failed to open SymbolicLink(%08x)\n", status); + pRtlFreeUnicodeString(&str); + InitializeObjectAttributes(&attr, &str, 0, dir, NULL); + pRtlCreateUnicodeStringFromAsciiz(&str, "one more level"); + DIR_TEST_CREATE_FAILURE(&h, STATUS_OBJECT_TYPE_MISMATCH) + pRtlFreeUnicodeString(&str); + pNtClose(h); + pNtClose(dir); + } pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects"); InitializeObjectAttributes(&attr, &str, 0, 0, NULL); @@ -393,22 +398,23 @@ static void test_directory(void) pNtClose(dir); - InitializeObjectAttributes(&attr, &str, 0, 0, NULL); - pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Global\\om.c-test"); - DIR_TEST_CREATE_SUCCESS(&dir) - pRtlFreeUnicodeString(&str); - pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local\\om.c-test\\one more level"); - DIR_TEST_CREATE_SUCCESS(&h) - pRtlFreeUnicodeString(&str); - pNtClose(h); - InitializeObjectAttributes(&attr, &str, 0, dir, NULL); - pRtlCreateUnicodeStringFromAsciiz(&str, "one more level"); - DIR_TEST_CREATE_SUCCESS(&dir) - pRtlFreeUnicodeString(&str); - pNtClose(h); - - pNtClose(dir); - + if (!is_nt4) + { + InitializeObjectAttributes(&attr, &str, 0, 0, NULL); + pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Global\\om.c-test"); + DIR_TEST_CREATE_SUCCESS(&dir) + pRtlFreeUnicodeString(&str); + pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local\\om.c-test\\one more level"); + DIR_TEST_CREATE_SUCCESS(&h) + pRtlFreeUnicodeString(&str); + pNtClose(h); + InitializeObjectAttributes(&attr, &str, 0, dir, NULL); + pRtlCreateUnicodeStringFromAsciiz(&str, "one more level"); + DIR_TEST_CREATE_SUCCESS(&dir) + pRtlFreeUnicodeString(&str); + pNtClose(h); + pNtClose(dir); + } /* Create other objects using RootDirectory */ @@ -462,9 +468,6 @@ static void test_directory(void) #define SYMLNK_TEST_CREATE_SUCCESS(h) \ status = pNtCreateSymbolicLinkObject(h, SYMBOLIC_LINK_QUERY, &attr, &target); \ ok(status == STATUS_SUCCESS, "Failed to create SymbolicLink(%08x)\n", status); -#define SYMLNK_TEST_OPEN_SUCCESS(h) \ - status = pNtOpenSymbolicLinkObject(h, SYMBOLIC_LINK_QUERY, &attr); \ - ok(status == STATUS_SUCCESS, "Failed to open SymbolicLink(%08x)\n", status); static void test_symboliclink(void) { @@ -518,18 +521,24 @@ static void test_symboliclink(void) /* Compaund test */ - pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects"); - DIR_TEST_OPEN_SUCCESS(&dir) + pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects\\Local"); + status = pNtOpenDirectoryObject(&dir, DIRECTORY_QUERY, &attr); + if (status == STATUS_OBJECT_NAME_NOT_FOUND) /* nt4 doesn't have Local\\ */ + { + pRtlCreateUnicodeStringFromAsciiz(&str, "\\BaseNamedObjects"); + status = pNtOpenDirectoryObject(&dir, DIRECTORY_QUERY, &attr); + } + ok(status == STATUS_SUCCESS, "Failed to open Directory(%08x)\n", status); pRtlFreeUnicodeString(&str); InitializeObjectAttributes(&attr, &str, 0, dir, NULL); - pRtlCreateUnicodeStringFromAsciiz(&str, "Local\\test-link"); + pRtlCreateUnicodeStringFromAsciiz(&str, "test-link"); pRtlCreateUnicodeStringFromAsciiz(&target, "\\DosDevices"); SYMLNK_TEST_CREATE_SUCCESS(&link) pRtlFreeUnicodeString(&str); pRtlFreeUnicodeString(&target); - pRtlCreateUnicodeStringFromAsciiz(&str, "Local\\test-link\\PIPE"); + pRtlCreateUnicodeStringFromAsciiz(&str, "test-link\\PIPE"); status = pNtOpenFile(&h, GENERIC_READ, &attr, &iosb, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN); todo_wine ok(status == STATUS_SUCCESS, "Failed to open NamedPipe(%08x)\n", status); pRtlFreeUnicodeString(&str); diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c index 94f2a0b6630..70864b6f250 100644 --- a/dlls/ntdll/tests/reg.c +++ b/dlls/ntdll/tests/reg.c @@ -575,7 +575,7 @@ static void test_RtlpNtQueryValueKey(void) START_TEST(reg) { - static const WCHAR winetest[] = {'\\','W','i','n','e','T','e','s','t','\\',0}; + static const WCHAR winetest[] = {'\\','W','i','n','e','T','e','s','t',0}; if(!InitFunctionPtrs()) return; pRtlFormatCurrentUserKeyPath(&winetestpath); -- 2.11.4.GIT