[PATCH v3 0/1] MR11284: kernel32/tests: Test filename case preservation when opening existing file.
-- v3: 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 | 80 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c index 8dac53384bb..f4b839747ec 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) @@ -6929,6 +7006,9 @@ START_TEST(file) ret = DeleteFileA(filename); ok(ret != 0, "DeleteFile error %lu\n", GetLastError()); +test_symbolic_link(); +test_GetFinalPathNameByHandleW(); +return; test__hread( ); test__hwrite( ); test__lclose( ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11284
William Horvath (@whrvt) commented about dlls/kernel32/tests/file.c:
ret = DeleteFileA(filename); ok(ret != 0, "DeleteFile error %lu\n", GetLastError());
+test_symbolic_link(); +test_GetFinalPathNameByHandleW(); +return;
You probably didn't mean to commit this part. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11284#note_144584
participants (3)
-
Paul Gofman -
Paul Gofman (@gofman) -
William Horvath (@whrvt)