From 2507c181d05c419397656c8e9a3690ec097c8008 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Mon, 11 Jul 2011 00:38:34 +0000 Subject: [PATCH] [RTL]: Clarify what RtlGetLongestNtPathLength returns instead of using "+9" as a magic constant. svn path=/trunk/; revision=52623 --- reactos/lib/rtl/path.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/reactos/lib/rtl/path.c b/reactos/lib/rtl/path.c index d0b4e21a7a1..8764233b79e 100644 --- a/reactos/lib/rtl/path.c +++ b/reactos/lib/rtl/path.c @@ -28,6 +28,8 @@ static const WCHAR DeviceRootW[] = L"\\\\.\\"; static const UNICODE_STRING _condev = RTL_CONSTANT_STRING(L"\\\\.\\CON"); +static const UNICODE_STRING _unc = RTL_CONSTANT_STRING(L"\\??\\UNC\\"); + static const UNICODE_STRING _lpt = RTL_CONSTANT_STRING(L"LPT"); static const UNICODE_STRING _com = RTL_CONSTANT_STRING(L"COM"); @@ -46,9 +48,17 @@ static const UNICODE_STRING _nul = RTL_CONSTANT_STRING(L"NUL"); /* * @implemented */ -ULONG NTAPI RtlGetLongestNtPathLength (VOID) +ULONG +NTAPI +RtlGetLongestNtPathLength(VOID) { - return (MAX_PATH + 9); + /* + * The longest NT path is a DOS path that actually sits on a UNC path (ie: + * a mapped network drive), which is accessed through the DOS Global?? path. + * This is, and has always been equal to, 269 characters, except in Wine + * which claims this is 277. Go figure. + */ + return (MAX_PATH + _unc.Length + sizeof(ANSI_NULL)); }