[MOUNTMGR] Remove a leftover UNREFERENCED_PARAMETER()
[reactos.git] / drivers / filters / mountmgr / symlink.c
index 80c5b00..f4d2381 100644 (file)
@@ -114,8 +114,6 @@ GlobalCreateSymbolicLink(IN PUNICODE_STRING DosName,
     NTSTATUS Status;
     UNICODE_STRING GlobalName;
 
-    UNREFERENCED_PARAMETER(DeviceName);
-
     /* First create the global string */
     Status = CreateStringWithGlobal(DosName, &GlobalName);
     if (!NT_SUCCESS(Status))
@@ -124,7 +122,7 @@ GlobalCreateSymbolicLink(IN PUNICODE_STRING DosName,
     }
 
     /* Then, create the symlink */
-    Status = IoCreateSymbolicLink(&GlobalName, DosName);
+    Status = IoCreateSymbolicLink(&GlobalName, DeviceName);
 
     FreePool(GlobalName.Buffer);
 
@@ -489,7 +487,7 @@ CreateNewVolumeName(OUT PUNICODE_STRING VolumeName,
         return Status;
     }
 
-    /* Size for volume namespace, litteral GUID, and null char */
+    /* Size for volume namespace, literal GUID, and null char */
     VolumeName->MaximumLength = 0x14 + 0x4C + sizeof(UNICODE_NULL);
     VolumeName->Buffer = AllocatePool(0x14 + 0x4C + sizeof(UNICODE_NULL));
     if (!VolumeName->Buffer)
@@ -923,27 +921,35 @@ DeleteSymbolicLinkNameFromMemory(IN PDEVICE_EXTENSION DeviceExtension,
 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;
+    }
+
+    /* Must start with the DosDevices prefix */
+    if (!RtlPrefixUnicodeString(&DosDevices, SymbolicName, TRUE))
     {
         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':')
+    /* Check if letter is correct */
+    Letter = SymbolicName->Buffer[DosDevices.Length / sizeof(WCHAR)];
+    if ((Letter < L'A' || Letter > L'Z') && Letter != (WCHAR)-1)
     {
-        /* 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 FALSE;
+    }
+
+    /* And finally it must end with a colon */
+    Colon = SymbolicName->Buffer[DosDevices.Length / sizeof(WCHAR) + 1];
+    if (Colon != L':')
+    {
+        return FALSE;
     }
 
-    return Result;
+    return TRUE;
 }
 
 /*