[PATCH v4 0/1] MR11284: kernel32/tests: Test filename case preservation when opening existing file.
-- v4: kernel32/tests: Test filename case preservation when opening existing file. https://gitlab.winehq.org/wine/wine/-/merge_requests/11284
From: Paul Gofman <pgofman@codeweavers.com> --- dlls/kernel32/tests/file.c | 77 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c index 8dac53384bb..2427129d093 100644 --- a/dlls/kernel32/tests/file.c +++ b/dlls/kernel32/tests/file.c @@ -5759,6 +5759,83 @@ static void test_GetFinalPathNameByHandleW(void) ok(lstrcmpiW(test_path, result_path) == 0, "Expected %s, got %s\n", wine_dbgstr_w(test_path), wine_dbgstr_w(result_path)); CloseHandle(file); + + wcscpy(test_path, temp_path); + wcscat(test_path, L"Test.Dat"); + DeleteFileW(test_path); + file = CreateFileW(test_path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); + ok(file != INVALID_HANDLE_VALUE, "CreateFileW error %lu\n", GetLastError()); + count = pGetFinalPathNameByHandleW(file, result_path, ARRAY_SIZE(result_path), 0); + ok(count == lstrlenW(test_path) + 4, "Expected length %u, got %lu\n", lstrlenW(test_path), count); + ok(wcscmp(test_path, result_path + 4) == 0, "Expected %s, got %s\n", + wine_dbgstr_w(test_path), wine_dbgstr_w(result_path)); + CloseHandle(file); + + wcscpy(result_path, temp_path); + wcscat(result_path, L"test.dat"); + file = CreateFileW(result_path, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0); + ok(file != INVALID_HANDLE_VALUE, "CreateFileW error %lu\n", GetLastError()); + count = pGetFinalPathNameByHandleW(file, result_path, ARRAY_SIZE(result_path), 0); + ok(count == lstrlenW(test_path) + 4, "Expected length %u, got %lu\n", lstrlenW(test_path), count); + todo_wine ok(wcscmp(test_path, result_path + 4) == 0, "Expected %s, got %s\n", + wine_dbgstr_w(test_path), wine_dbgstr_w(result_path)); + CloseHandle(file); + + wcscpy(result_path, temp_path); + wcscat(result_path, L"test.dat"); + file = CreateFileW(result_path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, CREATE_ALWAYS, 0, 0); + ok(file != INVALID_HANDLE_VALUE, "CreateFileW error %lu\n", GetLastError()); + count = pGetFinalPathNameByHandleW(file, result_path, ARRAY_SIZE(result_path), 0); + ok(count == lstrlenW(test_path) + 4, "Expected length %u, got %lu\n", lstrlenW(test_path), count); + todo_wine ok(wcscmp(test_path, result_path + 4) == 0, "Expected %s, got %s\n", + wine_dbgstr_w(test_path), wine_dbgstr_w(result_path)); + wcscpy(test_path, temp_path); + wcscat(test_path, L"test_renamed.dat"); + success = MoveFileW(result_path + 4, test_path); + ok(success, "got error %ld.\n", GetLastError()); + + count = pGetFinalPathNameByHandleW(file, result_path, ARRAY_SIZE(result_path), 0); + todo_wine ok(count == lstrlenW(test_path) + 4, "Expected length %u, got %lu\n", lstrlenW(test_path), count); + todo_wine ok(wcscmp(test_path, result_path + 4) == 0, "Expected %s, got %s\n", + wine_dbgstr_w(test_path), wine_dbgstr_w(result_path)); + CloseHandle(file); + + success = DeleteFileW(test_path); + ok(success, "got error %ld.\n", GetLastError()); + + wcscpy(test_path, temp_path); + wcscat(test_path, L"link"); + success = CreateSymbolicLinkW(test_path, temp_path, SYMBOLIC_LINK_FLAG_DIRECTORY | SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE); + ok(success, "got error %ld.\n", GetLastError()); + + wcscpy(test_path, temp_path); + wcscat(test_path, L"LINK"); + file = CreateFileW(test_path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, 0); + ok(file != INVALID_HANDLE_VALUE, "CreateFileW error %lu\n", GetLastError()); + wcscpy(test_path, temp_path); + wcscat(test_path, L"link"); + count = pGetFinalPathNameByHandleW(file, result_path, ARRAY_SIZE(result_path), 0); + ok(count == lstrlenW(test_path) + 4, "Expected length %u, got %lu\n", lstrlenW(test_path), count); + todo_wine ok(wcscmp(test_path, result_path + 4) == 0, "Expected %s, got %s\n", + wine_dbgstr_w(test_path), wine_dbgstr_w(result_path)); + CloseHandle(file); + + wcscat(test_path, L"\\Test.Dat"); + file = CreateFileW(test_path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); + ok(file != INVALID_HANDLE_VALUE, "CreateFileW error %lu\n", GetLastError()); + count = pGetFinalPathNameByHandleW(file, result_path, ARRAY_SIZE(result_path), 0); + wcscpy(test_path, temp_path); + wcscat(test_path, L"Test.Dat"); + ok(count == lstrlenW(test_path) + 4, "Expected length %u, got %lu\n", lstrlenW(test_path), count); + ok(wcscmp(test_path, result_path + 4) == 0, "Expected %s, got %s\n", + wine_dbgstr_w(test_path), wine_dbgstr_w(result_path)); + CloseHandle(file); + + wcscpy(test_path, temp_path); + wcscat(test_path, L"LINK"); + success = RemoveDirectoryW(test_path); + ok(success, "got error %ld.\n", GetLastError()); } static void test_SetFileInformationByHandle(void) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11284
participants (2)
-
Paul Gofman -
Paul Gofman (@gofman)