Author: tfaber
Date: Sat Oct 18 10:11:02 2014
New Revision: 64798
URL:
http://svn.reactos.org/svn/reactos?rev=64798&view=rev
Log:
[MOUNTMGR]
- Fix IsDriveLetter. CID 1206760.
Modified:
trunk/reactos/drivers/filters/mountmgr/symlink.c
Modified: trunk/reactos/drivers/filters/mountmgr/symlink.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filters/mountmgr/s…
==============================================================================
--- trunk/reactos/drivers/filters/mountmgr/symlink.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filters/mountmgr/symlink.c [iso-8859-1] Sat Oct 18 10:11:02
2014
@@ -923,27 +923,35 @@
BOOLEAN
IsDriveLetter(PUNICODE_STRING SymbolicName)
{
- WCHAR Letter;
- BOOLEAN Result = FALSE;
+ WCHAR Letter, Colon;
/* We must have a precise length */
- if (SymbolicName->Length != sizeof(DosDevices.Buffer) + 2 * sizeof(WCHAR))
+ if (SymbolicName->Length != DosDevices.Length + 2 * sizeof(WCHAR))
{
return FALSE;
}
- /* Check if len is correct */
- Letter = SymbolicName->Buffer[sizeof(DosDevices.Buffer) / sizeof(WCHAR)];
- if (((Letter >= L'A' && Letter <= L'Z') || Letter ==
(WCHAR)-1) &&
- SymbolicName->Buffer[(sizeof(DosDevices.Buffer) + sizeof(WCHAR)) / sizeof
(WCHAR)] == L':')
- {
- /* In case it's not a normal drive letter, check differently */
- SymbolicName->Length = sizeof(DosDevices.Buffer);
- Result = RtlEqualUnicodeString(SymbolicName, &DosDevices, TRUE);
- SymbolicName->Length = sizeof(DosDevices.Buffer) + 2 * sizeof(WCHAR);
- }
-
- return Result;
+ /* Must start with the DosDevices prefix */
+ if (!RtlPrefixUnicodeString(&DosDevices, SymbolicName, TRUE))
+ {
+ return FALSE;
+ }
+
+ /* Check if letter is correct */
+ Letter = SymbolicName->Buffer[DosDevices.Length / sizeof(WCHAR)];
+ if ((Letter < L'A' || Letter > L'Z') && Letter !=
(WCHAR)-1)
+ {
+ return FALSE;
+ }
+
+ /* And finally it must end with a colon */
+ Colon = SymbolicName->Buffer[DosDevices.Length / sizeof(WCHAR) + 1];
+ if (Colon != L':')
+ {
+ return FALSE;
+ }
+
+ return TRUE;
}
/*