* PROGRAMMER: Pierre Schweitzer (pierre.schweitzer@reactos.org)
*/
-/* INCLUDES *****************************************************************/
-
#include "mntmgr.h"
#define NDEBUG
DosName->Length - DosDevices.Length);
IntGlobal.Buffer[IntGlobal.Length / sizeof(WCHAR)] = UNICODE_NULL;
}
- else
+ else if (RtlPrefixUnicodeString(&Global, DosName, TRUE))
{
- if (RtlPrefixUnicodeString(&Global, DosName, TRUE))
+ /* Switch to DOS global */
+ IntGlobal.Length = DosName->Length - Global.Length + DosGlobal.Length;
+ IntGlobal.MaximumLength = IntGlobal.Length + sizeof(WCHAR);
+ IntGlobal.Buffer = AllocatePool(IntGlobal.MaximumLength);
+ if (!IntGlobal.Buffer)
{
- /* Switch to DOS global */
- IntGlobal.Length = DosName->Length - Global.Length + DosGlobal.Length;
- IntGlobal.MaximumLength = IntGlobal.Length + sizeof(WCHAR);
- IntGlobal.Buffer = AllocatePool(IntGlobal.MaximumLength);
- if (!IntGlobal.Buffer)
- {
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- RtlCopyMemory(IntGlobal.Buffer, DosGlobal.Buffer, DosGlobal.Length);
- RtlCopyMemory(IntGlobal.Buffer + (DosGlobal.Length / sizeof(WCHAR)),
- DosName->Buffer + (Global.Length / sizeof(WCHAR)),
- DosName->Length - Global.Length);
- IntGlobal.Buffer[IntGlobal.Length / sizeof(WCHAR)] = UNICODE_NULL;
+ return STATUS_INSUFFICIENT_RESOURCES;
}
- else
- {
- /* Simply duplicate string */
- IntGlobal.Length = DosName->Length;
- IntGlobal.MaximumLength = DosName->MaximumLength;
- IntGlobal.Buffer = AllocatePool(IntGlobal.MaximumLength);
- if (!IntGlobal.Buffer)
- {
- return STATUS_INSUFFICIENT_RESOURCES;
- }
- RtlCopyMemory(IntGlobal.Buffer, DosName->Buffer, IntGlobal.MaximumLength);
+ RtlCopyMemory(IntGlobal.Buffer, DosGlobal.Buffer, DosGlobal.Length);
+ RtlCopyMemory(IntGlobal.Buffer + (DosGlobal.Length / sizeof(WCHAR)),
+ DosName->Buffer + (Global.Length / sizeof(WCHAR)),
+ DosName->Length - Global.Length);
+ IntGlobal.Buffer[IntGlobal.Length / sizeof(WCHAR)] = UNICODE_NULL;
+ }
+ else
+ {
+ /* Simply duplicate string */
+ IntGlobal.Length = DosName->Length;
+ IntGlobal.MaximumLength = DosName->MaximumLength;
+ IntGlobal.Buffer = AllocatePool(IntGlobal.MaximumLength);
+ if (!IntGlobal.Buffer)
+ {
+ return STATUS_INSUFFICIENT_RESOURCES;
}
+
+ RtlCopyMemory(IntGlobal.Buffer, DosName->Buffer, IntGlobal.MaximumLength);
}
/* Return string */
NTSTATUS Status;
UNICODE_STRING GlobalName;
+ UNREFERENCED_PARAMETER(DeviceName);
+
/* First create the global string */
Status = CreateStringWithGlobal(DosName, &GlobalName);
if (!NT_SUCCESS(Status))
Stack = IoGetNextIrpStackLocation(Irp);
Stack->FileObject = FileObject;
- Status = IofCallDriver(DeviceObject, Irp);
+ Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING)
{
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
Stack->FileObject = FileObject;
/* Really notify */
- Status = IofCallDriver(DeviceObject, Irp);
+ Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING)
{
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
FreePool(Name);
}
- ObfDereferenceObject(DeviceObject);
- ObfDereferenceObject(FileObject);
+ ObDereferenceObject(DeviceObject);
+ ObDereferenceObject(FileObject);
return;
}
Stack = IoGetNextIrpStackLocation(Irp);
Stack->FileObject = FileObject;
- Status = IofCallDriver(DeviceObject, Irp);
+ Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING)
{
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
Stack->FileObject = FileObject;
/* Really notify */
- Status = IofCallDriver(DeviceObject, Irp);
+ Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING)
{
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
FreePool(Name);
}
- ObfDereferenceObject(DeviceObject);
- ObfDereferenceObject(FileObject);
+ ObDereferenceObject(DeviceObject);
+ ObDereferenceObject(FileObject);
return;
}
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)
BOOLEAN WriteNew;
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
+ UNREFERENCED_PARAMETER(DeviceExtension);
+
/* First of all, count links */
RtlZeroMemory(QueryTable, sizeof(QueryTable));
QueryTable[0].QueryRoutine = SymbolicLinkNamesFromUniqueIdCount;
IoStackLocation->FileObject = FileObject;
/* And ask */
- Status = IofCallDriver(DeviceObject, Irp);
+ Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING)
{
KeWaitForSingleObject(&Event, Executive, KernelMode,
IoStackLocation = IoGetNextIrpStackLocation(Irp);
IoStackLocation->FileObject = FileObject;
- Status = IofCallDriver(DeviceObject, Irp);
+ Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING)
{
KeWaitForSingleObject(&Event, Executive, KernelMode,
FreePool(IoCtlSuggested);
Dereference:
- ObfDereferenceObject(DeviceObject);
- ObfDereferenceObject(FileObject);
+ ObDereferenceObject(DeviceObject);
+ ObDereferenceObject(FileObject);
return Status;
}
RemoveEntryList(&(SymlinkInformation->SymbolicLinksListEntry));
FreePool(SymlinkInformation->Name.Buffer);
FreePool(SymlinkInformation);
-
+
return TRUE;
}
}
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':')
+ /* Must start with the DosDevices prefix */
+ if (!RtlPrefixUnicodeString(&DosDevices, SymbolicName, TRUE))
{
- /* 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;
+ }
+
+ /* 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 Result;
+ return TRUE;
}
/*