Jacek Caban : ntdll: Support CONIN$ and CONOUT$ in RtlIsDosDeviceName_U.
Alexandre Julliard
julliard at winehq.org
Fri Jun 26 17:00:54 CDT 2020
Module: wine
Branch: master
Commit: d2a3104f5ffc289faf6a6e32f2b4e88e8ee3190c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=d2a3104f5ffc289faf6a6e32f2b4e88e8ee3190c
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Jun 25 22:27:26 2020 +0200
ntdll: Support CONIN$ and CONOUT$ in RtlIsDosDeviceName_U.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/path.c | 8 ++++++++
dlls/ntdll/tests/path.c | 44 ++++++++++++++++++++++++++++++++++++--------
2 files changed, 44 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c
index 2a807d5eef..acb4bf1249 100644
--- a/dlls/ntdll/path.c
+++ b/dlls/ntdll/path.c
@@ -80,6 +80,8 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
static const WCHAR lptW[] = {'L','P','T'};
static const WCHAR nulW[] = {'N','U','L'};
static const WCHAR prnW[] = {'P','R','N'};
+ static const WCHAR coninW[] = {'C','O','N','I','N','$'};
+ static const WCHAR conoutW[] = {'C','O','N','O','U','T','$'};
const WCHAR *start, *end, *p;
@@ -124,6 +126,12 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
if (wcsnicmp( start, comW, 3 ) && wcsnicmp( start, lptW, 3 )) break;
if (*end <= '0' || *end > '9') break;
return MAKELONG( 4 * sizeof(WCHAR), (start - dos_name) * sizeof(WCHAR) );
+ case 6:
+ if (wcsnicmp( start, coninW, ARRAY_SIZE(coninW) )) break;
+ return MAKELONG( sizeof(coninW), (start - dos_name) * sizeof(WCHAR) );
+ case 7:
+ if (wcsnicmp( start, conoutW, ARRAY_SIZE(conoutW) )) break;
+ return MAKELONG( sizeof(conoutW), (start - dos_name) * sizeof(WCHAR) );
default: /* can't match anything */
break;
}
diff --git a/dlls/ntdll/tests/path.c b/dlls/ntdll/tests/path.c
index 0541f560ac..e4adc992a2 100644
--- a/dlls/ntdll/tests/path.c
+++ b/dlls/ntdll/tests/path.c
@@ -77,6 +77,11 @@ static void test_RtlDetermineDosPathNameType_U(void)
{ "//?foo", 1 },
{ "\\\\?", 7 },
{ "//?", 7 },
+ { "CONIN$", 5 },
+ { "CONOUT$", 5 },
+ { "CONERR$", 5 },
+ { "\\\\.\\CONIN$", 6 },
+ { "\\\\.\\CONOUT$", 6 },
{ NULL, 0 }
};
@@ -143,6 +148,15 @@ static void test_RtlIsDosDeviceName_U(void)
{ "CoM4:", 0, 8 },
{ "lpt9:", 0, 8 },
{ "c:\\lpt0.txt", 0, 0 },
+ { "CONIN$", 0, 12, TRUE }, /* fails on winxp */
+ { "CONOUT$", 0, 14, TRUE }, /* fails on winxp */
+ { "CONERR$", 0, 0 },
+ { "CON", 0, 6 },
+ { "PIPE", 0, 0 },
+ { "\\??\\CONIN$", 8, 12, TRUE }, /* fails on winxp */
+ { "\\??\\CONOUT$", 8, 14, TRUE }, /* fails on winxp */
+ { "\\??\\CONERR$", 0, 0 },
+ { "\\??\\CON", 8, 6 },
{ "c:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
@@ -329,6 +343,11 @@ static void test_RtlGetFullPathName_U(void)
{ "//?/foo/.", "\\\\?\\foo", "foo"},
{ "//?/foo/..", "\\\\?\\", NULL},
+ { "CONIN$", "\\\\.\\CONIN$", NULL,
+ "C:\\windows\\CONIN$", "CONIN$"},
+ { "CONOUT$", "\\\\.\\CONOUT$", NULL,
+ "C:\\windows\\CONOUT$", "CONOUT$"},
+
/* RtlGetFullPathName_U() can't understand the global namespace prefix */
{ "\\??\\foo", "C:\\??\\foo", "foo"},
{ 0 }
@@ -409,6 +428,7 @@ static void test_RtlDosPathNameToNtPathName_U(void)
const WCHAR *dos;
const WCHAR *nt;
int file_offset; /* offset to file part */
+ const WCHAR *alt_nt;
}
tests[] =
{
@@ -507,6 +527,11 @@ static void test_RtlDosPathNameToNtPathName_U(void)
{L"\\??\\foo\\bar", L"\\??\\foo\\bar", 8},
{L"\\??\\foo\\.", L"\\??\\foo\\.", 8},
{L"\\??\\foo\\..", L"\\??\\foo\\..", 8},
+
+ {L"CONIN$", L"\\??\\CONIN$", -1, L"\\??\\C:\\windows\\CONIN$" /* winxp */ },
+ {L"CONOUT$", L"\\??\\CONOUT$", -1, L"\\??\\C:\\windows\\CONOUT$" /* winxp */ },
+ {L"cOnOuT$", L"\\??\\cOnOuT$", -1, L"\\??\\C:\\windows\\cOnOuT$" /* winxp */ },
+ {L"CONERR$", L"\\??\\C:\\windows\\CONERR$", 15},
};
GetCurrentDirectoryA(sizeof(curdir), curdir);
@@ -555,16 +580,19 @@ static void test_RtlDosPathNameToNtPathName_U(void)
continue;
}
- ok(!wcscmp(nameW.Buffer, tests[i].nt), "%s: Expected %s, got %s.\n",
+ ok(!wcscmp(nameW.Buffer, tests[i].nt) || broken(!wcscmp(nameW.Buffer, tests[i].alt_nt)), "%s: Expected %s, got %s.\n",
debugstr_w(tests[i].dos), debugstr_w(tests[i].nt), debugstr_w(nameW.Buffer));
- if (tests[i].file_offset > 0)
- ok(file_part == nameW.Buffer + tests[i].file_offset,
- "%s: Expected file part %s, got %s.\n", debugstr_w(tests[i].dos),
- debugstr_w(nameW.Buffer + tests[i].file_offset), debugstr_w(file_part));
- else
- ok(file_part == NULL, "%s: Expected NULL file part, got %s.\n",
- debugstr_w(tests[i].dos), debugstr_w(file_part));
+ if (!wcscmp(nameW.Buffer, tests[i].nt))
+ {
+ if (tests[i].file_offset > 0)
+ ok(file_part == nameW.Buffer + tests[i].file_offset,
+ "%s: Expected file part %s, got %s.\n", debugstr_w(tests[i].dos),
+ debugstr_w(nameW.Buffer + tests[i].file_offset), debugstr_w(file_part));
+ else
+ ok(file_part == NULL, "%s: Expected NULL file part, got %s.\n",
+ debugstr_w(tests[i].dos), debugstr_w(file_part));
+ }
RtlFreeUnicodeString(&nameW);
}
More information about the wine-cvs
mailing list