#define NDEBUG
#include <debug.h>
+NTSTATUS
+NTAPI
+DriverEntry(
+ PDRIVER_OBJECT DriverObject,
+ PUNICODE_STRING RegistryPath
+);
+
+VOID
+MupInitializeData(
+ VOID
+);
+
+VOID
+MupInitializeVcb(
+ PMUP_VCB Vcb
+);
+
+#if defined(ALLOC_PRAGMA)
+#pragma alloc_text(INIT, DriverEntry)
+#pragma alloc_text(INIT, MupInitializeData)
+#pragma alloc_text(INIT, MupInitializeVcb)
+#endif
+
ERESOURCE MupGlobalLock;
ERESOURCE MupPrefixTableLock;
ERESOURCE MupCcbListLock;
/* FUNCTIONS ****************************************************************/
+INIT_SECTION
VOID
-MupInitializeData()
+MupInitializeData(VOID)
{
ExInitializeResourceLite(&MupGlobalLock);
ExInitializeResourceLite(&MupPrefixTableLock);
ExDeleteResourceLite(&MupVcbLock);
}
+INIT_SECTION
VOID
MupInitializeVcb(PMUP_VCB Vcb)
{
KeyName.MaximumLength = sizeof(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Mup");
/* Simply query registry to know whether we have to disable DFS.
- * Unless explicitely stated in registry, we will try to enable DFS.
+ * Unless explicitly stated in registry, we will try to enable DFS.
*/
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
return Status;
}
-NTSTATUS
-NTAPI
-DfsVolumePassThrough(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
-{
- return STATUS_NOT_IMPLEMENTED;
-}
-
NTSTATUS
NTAPI
MupForwardIoRequest(PDEVICE_OBJECT DeviceObject,
Status = ZwQueryValueKey(KeyHandle, &Value, KeyValueFullInformation, Info, ResultLength, &ResultLength);
}
+ else
+ {
+ Info = NULL;
+ }
ZwClose(KeyHandle);
*/
if (NT_SUCCESS(Status))
{
+ ASSERT(Info != NULL);
AddUnregisteredProvider((PWSTR)((ULONG_PTR)Info + Info->DataOffset), ProviderOrder);
}
Status = ZwQueryValueKey(KeyHandle, &ProviderOrder, KeyValueFullInformation, Info, ResultLength, &ResultLength);
}
+ else
+ {
+ Info = NULL;
+ }
ZwClose(KeyHandle);
if (NT_SUCCESS(Status))
{
+ ASSERT(Info != NULL);
+
Providers = (PWSTR)((ULONG_PTR)Info + Info->DataOffset);
End = FALSE;
ProviderCount = 0;
return Status;
}
-NTSTATUS
-DfsFsdFileSystemControl(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
-{
- return STATUS_NOT_IMPLEMENTED;
-}
-
NTSTATUS
NTAPI
MupFsControl(PDEVICE_OBJECT DeviceObject,
RtlMoveMemory(FullPath, UncProvider->DeviceName.Buffer, UncProvider->DeviceName.Length);
RtlMoveMemory((PWSTR)((ULONG_PTR)FullPath + UncProvider->DeviceName.Length), FileObject->FileName.Buffer, FileObject->FileName.Length);
- /* And redo the path in the file oject */
+ /* And redo the path in the file object */
ExFreePoolWithTag(FileObject->FileName.Buffer, 0);
FileObject->FileName.Buffer = FullPath;
FileObject->FileName.MaximumLength = TotalLength;
BroadcastOpen(PIRP Irp)
{
PMUP_FCB Fcb;
- PMUP_CCB Ccb;
HANDLE Handle;
PLIST_ENTRY Entry;
+ PMUP_CCB Ccb = NULL;
PMUP_UNC UncProvider;
UNICODE_STRING FullPath;
PFILE_OBJECT FileObject;
Complete:
/* In finally, complete the IRP for real! */
MasterQueryContext->Irp->IoStatus.Status = Status;
- IofCompleteRequest(MasterQueryContext->Irp, IO_DISK_INCREMENT);
+ IoCompleteRequest(MasterQueryContext->Irp, IO_DISK_INCREMENT);
MasterQueryContext->Irp = NULL;
MupFreeMasterQueryContext(MasterQueryContext);
}
/* Otherwise, if the prefix was in the prefix table, just drop it:
- * we have a provider which superseeds the accepted prefix, so leave
+ * we have a provider which supersedes the accepted prefix, so leave
* room for the new prefix/provider
*/
ExAcquireResourceExclusiveLite(&MupPrefixTableLock, TRUE);
MasterQueryContext->LatestProvider = QueryContext->UncProvider;
MasterQueryContext->LatestStatus = Status;
- if (MasterQueryContext->FileObject->FsContext2 != DFS_MAGIC_CCB)
+ if (MasterQueryContext->FileObject->FsContext2 != (PVOID)DFS_DOWNLEVEL_OPEN_CONTEXT)
{
/* Allocate a buffer for the prefix */
AcceptedPrefix = ExAllocatePoolWithTag(PagedPool, QueryResponse->LengthAccepted, TAG_MUP);
TableStatus = MupOrderedErrorList[0];
LatestPos = 0;
- /* Otherwise, time to compare statuteses, between the latest failed
+ /* Otherwise, time to compare statuses, between the latest failed
* and the current failure.
* We have an order table of failed status: the deeper you go in the
* table, the more the error is critical.
return STATUS_MORE_PROCESSING_REQUIRED;
}
-NTSTATUS
-DfsFsdCreate(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
NTSTATUS
CreateRedirectedFile(PIRP Irp,
PFILE_OBJECT FileObject,
}
/* Ok, at that point, that's a regular MUP opening (if no DFS) */
- if (!MupEnableDfs || FileObject->FsContext2 == DFS_MAGIC_CCB)
+ if (!MupEnableDfs || FileObject->FsContext2 == (PVOID)DFS_DOWNLEVEL_OPEN_CONTEXT)
{
/* We won't complete immediately */
IoMarkIrpPending(Irp);
ExReleaseResourceLite(&MasterQueryContext->QueryPathListLock);
/* Query the provider !*/
- DPRINT1("Requeting UNC provider: %wZ\n", &UncProvider->DeviceName);
+ DPRINT1("Requesting UNC provider: %wZ\n", &UncProvider->DeviceName);
DPRINT("Calling: %wZ\n", &UncProvider->DeviceObject->DriverObject->DriverName);
Status = IoCallDriver(UncProvider->DeviceObject, QueryIrp);
}
_SEH2_TRY
{
/* If DFS is enabled, check if that's for DFS and is so relay */
- if (MupEnableDfs)
+ if (MupEnableDfs && (DeviceObject->DeviceType == FILE_DEVICE_DFS || DeviceObject->DeviceType == FILE_DEVICE_DFS_FILE_SYSTEM))
{
- if (DeviceObject->DeviceType == FILE_DEVICE_DFS || DeviceObject->DeviceType == FILE_DEVICE_DFS_FILE_SYSTEM)
- {
- Status = DfsFsdCreate(DeviceObject, Irp);
- }
+ Status = DfsFsdCreate(DeviceObject, Irp);
}
else
{
}
}
-NTSTATUS
-DfsFsdCleanup(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
NTSTATUS
NTAPI
MupCleanup(PDEVICE_OBJECT DeviceObject,
return STATUS_SUCCESS;
}
-NTSTATUS
-DfsFsdClose(PDEVICE_OBJECT DeviceObject,
- PIRP Irp)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
NTSTATUS
NTAPI
MupClose(PDEVICE_OBJECT DeviceObject,
return Status;
}
-VOID
-DfsUnload(PDRIVER_OBJECT DriverObject)
-{
- UNIMPLEMENTED;
-}
-
VOID
NTAPI
MupUnload(PDRIVER_OBJECT DriverObject)
MupUninitializeData();
}
-NTSTATUS
-DfsDriverEntry(PDRIVER_OBJECT DriverObject,
- PUNICODE_STRING RegistryPath)
-{
- /* We don't support DFS yet, so
- * fail to make sure it remains disabled
- */
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
/*
* FUNCTION: Called by the system to initialize the driver
* ARGUMENTS:
* RegistryPath = path to our configuration entries
* RETURNS: Success or failure
*/
+INIT_SECTION
NTSTATUS
NTAPI
DriverEntry(PDRIVER_OBJECT DriverObject,