ntdll: Fix handling \\.\CON path in RtlDosPathNameToNtPathName.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=32183
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
(cherry picked from commit 32b81bfaff
)
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
This commit is contained in:
parent
bd444692a9
commit
2b48e780fe
|
@ -197,7 +197,8 @@ NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(const WCHAR *dos_path, U
|
||||||
return STATUS_OBJECT_NAME_INVALID;
|
return STATUS_OBJECT_NAME_INVALID;
|
||||||
|
|
||||||
if (!memcmp(dos_path, global_prefix, sizeof(global_prefix)) ||
|
if (!memcmp(dos_path, global_prefix, sizeof(global_prefix)) ||
|
||||||
(!memcmp(dos_path, global_prefix2, sizeof(global_prefix2)) && dos_path[4]))
|
(!memcmp(dos_path, global_prefix2, sizeof(global_prefix2)) && dos_path[4]) ||
|
||||||
|
!wcsicmp( dos_path, L"\\\\.\\CON" ))
|
||||||
{
|
{
|
||||||
ntpath->Length = wcslen(dos_path) * sizeof(WCHAR);
|
ntpath->Length = wcslen(dos_path) * sizeof(WCHAR);
|
||||||
ntpath->MaximumLength = ntpath->Length + sizeof(WCHAR);
|
ntpath->MaximumLength = ntpath->Length + sizeof(WCHAR);
|
||||||
|
@ -205,6 +206,7 @@ NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(const WCHAR *dos_path, U
|
||||||
if (!ntpath->Buffer) return STATUS_NO_MEMORY;
|
if (!ntpath->Buffer) return STATUS_NO_MEMORY;
|
||||||
memcpy( ntpath->Buffer, dos_path, ntpath->MaximumLength );
|
memcpy( ntpath->Buffer, dos_path, ntpath->MaximumLength );
|
||||||
ntpath->Buffer[1] = '?'; /* change \\?\ to \??\ */
|
ntpath->Buffer[1] = '?'; /* change \\?\ to \??\ */
|
||||||
|
ntpath->Buffer[2] = '?';
|
||||||
if (file_part)
|
if (file_part)
|
||||||
{
|
{
|
||||||
if ((ptr = wcsrchr( ntpath->Buffer, '\\' )) && ptr[1]) *file_part = ptr + 1;
|
if ((ptr = wcsrchr( ntpath->Buffer, '\\' )) && ptr[1]) *file_part = ptr + 1;
|
||||||
|
|
|
@ -119,6 +119,8 @@ static void test_RtlIsDosDeviceName_U(void)
|
||||||
{ "\\\\.\\CON", 8, 6, TRUE }, /* fails on win8 */
|
{ "\\\\.\\CON", 8, 6, TRUE }, /* fails on win8 */
|
||||||
{ "\\\\.\\con", 8, 6, TRUE }, /* fails on win8 */
|
{ "\\\\.\\con", 8, 6, TRUE }, /* fails on win8 */
|
||||||
{ "\\\\.\\CON2", 0, 0 },
|
{ "\\\\.\\CON2", 0, 0 },
|
||||||
|
{ "\\\\.\\CONIN$", 0, 0 },
|
||||||
|
{ "\\\\.\\CONOUT$",0, 0 },
|
||||||
{ "", 0, 0 },
|
{ "", 0, 0 },
|
||||||
{ "\\\\foo\\nul", 0, 0 },
|
{ "\\\\foo\\nul", 0, 0 },
|
||||||
{ "c:\\nul:", 6, 6 },
|
{ "c:\\nul:", 6, 6 },
|
||||||
|
@ -434,6 +436,7 @@ static void test_RtlDosPathNameToNtPathName_U(void)
|
||||||
const WCHAR *nt;
|
const WCHAR *nt;
|
||||||
int file_offset; /* offset to file part */
|
int file_offset; /* offset to file part */
|
||||||
const WCHAR *alt_nt;
|
const WCHAR *alt_nt;
|
||||||
|
BOOL may_fail;
|
||||||
}
|
}
|
||||||
tests[] =
|
tests[] =
|
||||||
{
|
{
|
||||||
|
@ -518,6 +521,9 @@ static void test_RtlDosPathNameToNtPathName_U(void)
|
||||||
{L"\\\\.\\foo/.", L"\\??\\foo", 4},
|
{L"\\\\.\\foo/.", L"\\??\\foo", 4},
|
||||||
{L"\\\\.\\foo/..", L"\\??\\", -1},
|
{L"\\\\.\\foo/..", L"\\??\\", -1},
|
||||||
{L"\\\\.\\foo. . ", L"\\??\\foo", 4},
|
{L"\\\\.\\foo. . ", L"\\??\\foo", 4},
|
||||||
|
{L"\\\\.\\CON", L"\\??\\CON", 4, NULL, TRUE}, /* broken on win7 */
|
||||||
|
{L"\\\\.\\CONIN$", L"\\??\\CONIN$", 4},
|
||||||
|
{L"\\\\.\\CONOUT$", L"\\??\\CONOUT$", 4},
|
||||||
|
|
||||||
{L"\\\\?", L"\\??\\", -1},
|
{L"\\\\?", L"\\??\\", -1},
|
||||||
{L"\\\\?\\", L"\\??\\", -1},
|
{L"\\\\?\\", L"\\??\\", -1},
|
||||||
|
@ -585,6 +591,11 @@ static void test_RtlDosPathNameToNtPathName_U(void)
|
||||||
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
||||||
{
|
{
|
||||||
ret = pRtlDosPathNameToNtPathName_U(tests[i].dos, &nameW, &file_part, NULL);
|
ret = pRtlDosPathNameToNtPathName_U(tests[i].dos, &nameW, &file_part, NULL);
|
||||||
|
if (!ret && tests[i].may_fail)
|
||||||
|
{
|
||||||
|
win_skip("skipping broken %s\n", debugstr_w(tests[i].dos));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ok(ret == TRUE, "%s: Got %d.\n", debugstr_w(tests[i].dos), ret);
|
ok(ret == TRUE, "%s: Got %d.\n", debugstr_w(tests[i].dos), ret);
|
||||||
|
|
||||||
if (pRtlDosPathNameToNtPathName_U_WithStatus)
|
if (pRtlDosPathNameToNtPathName_U_WithStatus)
|
||||||
|
|
Loading…
Reference in New Issue