Commit d2a3104f authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ntdll: Support CONIN$ and CONOUT$ in RtlIsDosDeviceName_U.

parent 18f83c12
...@@ -80,6 +80,8 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name ) ...@@ -80,6 +80,8 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
static const WCHAR lptW[] = {'L','P','T'}; static const WCHAR lptW[] = {'L','P','T'};
static const WCHAR nulW[] = {'N','U','L'}; static const WCHAR nulW[] = {'N','U','L'};
static const WCHAR prnW[] = {'P','R','N'}; 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; const WCHAR *start, *end, *p;
...@@ -124,6 +126,12 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name ) ...@@ -124,6 +126,12 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
if (wcsnicmp( start, comW, 3 ) && wcsnicmp( start, lptW, 3 )) break; if (wcsnicmp( start, comW, 3 ) && wcsnicmp( start, lptW, 3 )) break;
if (*end <= '0' || *end > '9') break; if (*end <= '0' || *end > '9') break;
return MAKELONG( 4 * sizeof(WCHAR), (start - dos_name) * sizeof(WCHAR) ); 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 */ default: /* can't match anything */
break; break;
} }
......
...@@ -77,6 +77,11 @@ static void test_RtlDetermineDosPathNameType_U(void) ...@@ -77,6 +77,11 @@ static void test_RtlDetermineDosPathNameType_U(void)
{ "//?foo", 1 }, { "//?foo", 1 },
{ "\\\\?", 7 }, { "\\\\?", 7 },
{ "//?", 7 }, { "//?", 7 },
{ "CONIN$", 5 },
{ "CONOUT$", 5 },
{ "CONERR$", 5 },
{ "\\\\.\\CONIN$", 6 },
{ "\\\\.\\CONOUT$", 6 },
{ NULL, 0 } { NULL, 0 }
}; };
...@@ -143,6 +148,15 @@ static void test_RtlIsDosDeviceName_U(void) ...@@ -143,6 +148,15 @@ static void test_RtlIsDosDeviceName_U(void)
{ "CoM4:", 0, 8 }, { "CoM4:", 0, 8 },
{ "lpt9:", 0, 8 }, { "lpt9:", 0, 8 },
{ "c:\\lpt0.txt", 0, 0 }, { "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" { "c:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
...@@ -329,6 +343,11 @@ static void test_RtlGetFullPathName_U(void) ...@@ -329,6 +343,11 @@ static void test_RtlGetFullPathName_U(void)
{ "//?/foo/.", "\\\\?\\foo", "foo"}, { "//?/foo/.", "\\\\?\\foo", "foo"},
{ "//?/foo/..", "\\\\?\\", NULL}, { "//?/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 */ /* RtlGetFullPathName_U() can't understand the global namespace prefix */
{ "\\??\\foo", "C:\\??\\foo", "foo"}, { "\\??\\foo", "C:\\??\\foo", "foo"},
{ 0 } { 0 }
...@@ -409,6 +428,7 @@ static void test_RtlDosPathNameToNtPathName_U(void) ...@@ -409,6 +428,7 @@ static void test_RtlDosPathNameToNtPathName_U(void)
const WCHAR *dos; const WCHAR *dos;
const WCHAR *nt; const WCHAR *nt;
int file_offset; /* offset to file part */ int file_offset; /* offset to file part */
const WCHAR *alt_nt;
} }
tests[] = tests[] =
{ {
...@@ -507,6 +527,11 @@ static void test_RtlDosPathNameToNtPathName_U(void) ...@@ -507,6 +527,11 @@ static void test_RtlDosPathNameToNtPathName_U(void)
{L"\\??\\foo\\bar", L"\\??\\foo\\bar", 8}, {L"\\??\\foo\\bar", L"\\??\\foo\\bar", 8},
{L"\\??\\foo\\.", L"\\??\\foo\\.", 8}, {L"\\??\\foo\\.", L"\\??\\foo\\.", 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); GetCurrentDirectoryA(sizeof(curdir), curdir);
...@@ -555,9 +580,11 @@ static void test_RtlDosPathNameToNtPathName_U(void) ...@@ -555,9 +580,11 @@ static void test_RtlDosPathNameToNtPathName_U(void)
continue; 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)); debugstr_w(tests[i].dos), debugstr_w(tests[i].nt), debugstr_w(nameW.Buffer));
if (!wcscmp(nameW.Buffer, tests[i].nt))
{
if (tests[i].file_offset > 0) if (tests[i].file_offset > 0)
ok(file_part == nameW.Buffer + tests[i].file_offset, ok(file_part == nameW.Buffer + tests[i].file_offset,
"%s: Expected file part %s, got %s.\n", debugstr_w(tests[i].dos), "%s: Expected file part %s, got %s.\n", debugstr_w(tests[i].dos),
...@@ -565,6 +592,7 @@ static void test_RtlDosPathNameToNtPathName_U(void) ...@@ -565,6 +592,7 @@ static void test_RtlDosPathNameToNtPathName_U(void)
else else
ok(file_part == NULL, "%s: Expected NULL file part, got %s.\n", ok(file_part == NULL, "%s: Expected NULL file part, got %s.\n",
debugstr_w(tests[i].dos), debugstr_w(file_part)); debugstr_w(tests[i].dos), debugstr_w(file_part));
}
RtlFreeUnicodeString(&nameW); RtlFreeUnicodeString(&nameW);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment