Module: wine Branch: oldstable Commit: b301e0285e78b3c873522dcae8c297bf4258746d URL: https://source.winehq.org/git/wine.git/?a=commit;h=b301e0285e78b3c873522dcae...
Author: Akihiro Sagawa sagawa.aki@gmail.com Date: Sat Jun 19 18:25:33 2021 +0900
ntdll/tests: Expand path name tests with path + device name.
Signed-off-by: Akihiro Sagawa sagawa.aki@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 64c4582a40a512181bddd8d7e02f25f343049c7f) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/ntdll/tests/path.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-)
diff --git a/dlls/ntdll/tests/path.c b/dlls/ntdll/tests/path.c index e4adc992a28..66d029b2016 100644 --- a/dlls/ntdll/tests/path.c +++ b/dlls/ntdll/tests/path.c @@ -316,6 +316,11 @@ static void test_RtlGetFullPathName_U(void) { "...", "C:\windows\", NULL}, { "./foo", "C:\windows\foo", "foo"}, { "foo/..", "C:\windows", "windows"}, + { "\windows\nul", "\\.\nul", NULL}, + { "C:\nonexistent\nul", "\\.\nul", NULL}, + { "C:\con\con", "\\.\con", NULL}, + { "C:NUL.", "\\.\NUL", NULL}, + { "C:NUL", "\\.\NUL", NULL}, { "AUX", "\\.\AUX", NULL}, { "COM1", "\\.\COM1", NULL}, { "?<>*"|:", "C:\windows\?<>*"|:", "?<>*"|:"}, @@ -458,6 +463,9 @@ static void test_RtlDosPathNameToNtPathName_U(void) {L"...", L"\??\C:\windows\", -1}, {L"./foo", L"\??\C:\windows\foo", 15}, {L"foo/..", L"\??\C:\windows", 7}, + {L"\windows\nul", L"\??\nul", -1}, + {L"C:NUL.", L"\??\NUL", -1}, + {L"C:NUL", L"\??\NUL", -1}, {L"AUX" , L"\??\AUX", -1}, {L"COM1" , L"\??\COM1", -1}, {L"?<>*"|:", L"\??\C:\windows\?<>*"|:", 15}, @@ -533,32 +541,30 @@ static void test_RtlDosPathNameToNtPathName_U(void) {L"cOnOuT$", L"\??\cOnOuT$", -1, L"\??\C:\windows\cOnOuT$" /* winxp */ }, {L"CONERR$", L"\??\C:\windows\CONERR$", 15}, }; + static const WCHAR *error_paths[] = { + NULL, L"", L" ", L"C:\nonexistent\nul", L"C:\con\con" + };
GetCurrentDirectoryA(sizeof(curdir), curdir); SetCurrentDirectoryA("C:\windows\");
- ret = pRtlDosPathNameToNtPathName_U(NULL, &nameW, &file_part, NULL); - ok(!ret, "Got %d.\n", ret); - - ret = pRtlDosPathNameToNtPathName_U(L"", &nameW, &file_part, NULL); - ok(!ret, "Got %d.\n", ret); - - ret = pRtlDosPathNameToNtPathName_U(L" ", &nameW, &file_part, NULL); - ok(!ret, "Got %d.\n", ret); - - if (pRtlDosPathNameToNtPathName_U_WithStatus) + for (i = 0; i < ARRAY_SIZE(error_paths); ++i) { - status = pRtlDosPathNameToNtPathName_U_WithStatus(NULL, &nameW, &file_part, NULL); - ok(status == STATUS_OBJECT_NAME_INVALID || status == STATUS_OBJECT_PATH_NOT_FOUND /* 2003 */, - "Got status %#x.\n", status); + winetest_push_context("%s", debugstr_w(error_paths[i]));
- status = pRtlDosPathNameToNtPathName_U_WithStatus(L"", &nameW, &file_part, NULL); - ok(status == STATUS_OBJECT_NAME_INVALID || status == STATUS_OBJECT_PATH_NOT_FOUND /* 2003 */, - "Got status %#x.\n", status); + ret = pRtlDosPathNameToNtPathName_U(error_paths[i], &nameW, &file_part, NULL); + todo_wine_if(i == 3 || i == 4) + ok(!ret, "Got %d.\n", ret); + + if (pRtlDosPathNameToNtPathName_U_WithStatus) + { + status = pRtlDosPathNameToNtPathName_U_WithStatus(error_paths[i], &nameW, &file_part, NULL); + todo_wine_if(i == 3 || i == 4) + ok(status == STATUS_OBJECT_NAME_INVALID || broken(status == STATUS_OBJECT_PATH_NOT_FOUND /* 2003 */), + "Got status %#x.\n", status); + }
- status = pRtlDosPathNameToNtPathName_U_WithStatus(L" ", &nameW, &file_part, NULL); - ok(status == STATUS_OBJECT_NAME_INVALID || status == STATUS_OBJECT_PATH_NOT_FOUND /* 2003 */, - "Got status %#x.\n", status); + winetest_pop_context(); }
for (i = 0; i < ARRAY_SIZE(tests); ++i)