[PATCH] ntdll: Fix handling of DOS style device paths in RtlIsDosDeviceName_U
Lukas Platz
lukas.platz at bluescan.de
Thu Apr 11 10:16:55 CDT 2019
Use existing general processing code instead of hardcoding a
less general result.
Signed-off-by: Lukas Platz <lukas.platz at bluescan.de>
---
dlls/ntdll/path.c | 6 ++----
dlls/ntdll/tests/path.c | 1 +
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c
index 11483fabba..c41dc81a20 100644
--- a/dlls/ntdll/path.c
+++ b/dlls/ntdll/path.c
@@ -268,7 +268,6 @@ DOS_PATHNAME_TYPE WINAPI RtlDetermineDosPathNameType_U( PCWSTR path )
*/
ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
{
- static const WCHAR consoleW[] = {'\\','\\','.','\\','C','O','N',0};
static const WCHAR auxW[] = {'A','U','X'};
static const WCHAR comW[] = {'C','O','M'};
static const WCHAR conW[] = {'C','O','N'};
@@ -284,9 +283,8 @@ ULONG WINAPI RtlIsDosDeviceName_U( PCWSTR dos_name )
case UNC_PATH:
return 0;
case DEVICE_PATH:
- if (!strcmpiW( dos_name, consoleW ))
- return MAKELONG( sizeof(conW), 4 * sizeof(WCHAR) ); /* 4 is length of \\.\ prefix */
- return 0;
+ start = dos_name + 4; /* skip device path prefix */
+ break;
case ABSOLUTE_DRIVE_PATH:
case RELATIVE_DRIVE_PATH:
start = dos_name + 2; /* skip drive letter */
diff --git a/dlls/ntdll/tests/path.c b/dlls/ntdll/tests/path.c
index 195dea37e8..e744c10649 100644
--- a/dlls/ntdll/tests/path.c
+++ b/dlls/ntdll/tests/path.c
@@ -114,6 +114,7 @@ static void test_RtlIsDosDeviceName_U(void)
{ "\\\\.\\CON", 8, 6, TRUE }, /* fails on win8 */
{ "\\\\.\\con", 8, 6, TRUE }, /* fails on win8 */
{ "\\\\.\\CON2", 0, 0 },
+ { "\\\\.\\com3", 8, 8 },
{ "", 0, 0 },
{ "\\\\foo\\nul", 0, 0 },
{ "c:\\nul:", 6, 6 },
--
2.18.0
More information about the wine-devel
mailing list