Zhiyi Zhang : kernel32/tests: Test GetFileAttributesExW() with a NT path not in canonical form.
Alexandre Julliard
julliard at winehq.org
Wed Jun 2 16:27:43 CDT 2021
Module: wine
Branch: master
Commit: f77d42471e43b3120f8e5a72afdc0d2cf5d20f86
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f77d42471e43b3120f8e5a72afdc0d2cf5d20f86
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Wed Jun 2 10:54:06 2021 +0800
kernel32/tests: Test GetFileAttributesExW() with a NT path not in canonical form.
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/tests/file.c | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 8560524683d..138f1e6c2d3 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -5417,26 +5417,35 @@ todo_wine
static void test_GetFileAttributesExW(void)
{
- static const WCHAR path1[] = {'\\','\\','?','\\',0};
- static const WCHAR path2[] = {'\\','?','?','\\',0};
- static const WCHAR path3[] = {'\\','D','o','s','D','e','v','i','c','e','s','\\',0};
+ static const struct
+ {
+ const WCHAR *path;
+ DWORD expected_error;
+ }
+ tests[] =
+ {
+ {L"\\\\?\\", ERROR_INVALID_NAME},
+ {L"\\??\\", ERROR_INVALID_NAME},
+ {L"\\DosDevices\\", ERROR_FILE_NOT_FOUND},
+ {L"\\\\?\\C:\\windows\\system32\\..\\system32\\kernel32.dll", ERROR_INVALID_NAME},
+ };
WIN32_FILE_ATTRIBUTE_DATA info;
+ DWORD error, test_idx;
BOOL ret;
- SetLastError(0xdeadbeef);
- ret = GetFileAttributesExW(path1, GetFileExInfoStandard, &info);
- ok(!ret, "GetFileAttributesExW succeeded\n");
- ok(GetLastError() == ERROR_INVALID_NAME, "Expected error ERROR_INVALID_NAME, got %u\n", GetLastError());
+ for (test_idx = 0; test_idx < ARRAY_SIZE(tests); ++test_idx)
+ {
+ winetest_push_context("Test %u", test_idx);
- SetLastError(0xdeadbeef);
- ret = GetFileAttributesExW(path2, GetFileExInfoStandard, &info);
- ok(!ret, "GetFileAttributesExW succeeded\n");
- ok(GetLastError() == ERROR_INVALID_NAME, "Expected error ERROR_INVALID_NAME, got %u\n", GetLastError());
+ SetLastError(0xdeadbeef);
+ ret = GetFileAttributesExW(tests[test_idx].path, GetFileExInfoStandard, &info);
+ error = GetLastError();
+ ok(!ret, "GetFileAttributesExW succeeded\n");
+ ok(error == tests[test_idx].expected_error, "Expected error %u, got %u\n",
+ tests[test_idx].expected_error, error);
- SetLastError(0xdeadbeef);
- ret = GetFileAttributesExW(path3, GetFileExInfoStandard, &info);
- ok(!ret, "GetFileAttributesExW succeeded\n");
- ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
+ winetest_pop_context();
+ }
}
static void test_post_completion(void)
More information about the wine-cvs
mailing list