Author: hpoussin
Date: Sat Sep 27 21:07:48 2014
New Revision: 64358
URL:
http://svn.reactos.org/svn/reactos?rev=64358&view=rev
Log:
[NTOSKRNL] Partly implement FsRtlRegisterUncProvider/FsRtlDeregisterUncProvider
Currently only support one UNC provider at the time. Also disable mup.sys, which is not
used for now.
Modified:
trunk/reactos/boot/bootdata/hivesys.inf
trunk/reactos/ntoskrnl/fsrtl/unc.c
Modified: trunk/reactos/boot/bootdata/hivesys.inf
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys.inf?…
==============================================================================
--- trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] Sat Sep 27 21:07:48 2014
@@ -1266,7 +1266,7 @@
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\DOS
Devices","NUL",0x00000000,"\Device\Null"
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\DOS
Devices","PIPE",0x00000000,"\Device\NamedPipe"
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\DOS
Devices","PRN",0x00000000,"\DosDevices\LPT1"
-HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\DOS
Devices","UNC",0x00000000,"\Device\Mup"
+;HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\DOS
Devices","UNC",0x00000000,"\Device\Mup"
; System environment settings
HKLM,"SYSTEM\CurrentControlSet\Control\Session
Manager\Environment","ComSpec",0x00020000,"%SystemRoot%\system32\cmd.exe"
@@ -1509,13 +1509,13 @@
HKLM,"SYSTEM\CurrentControlSet\Services\Msfs","Type",0x00010001,0x00000002
; Multiple UNC provider driver
-HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Description",0x00000000,"Multiple
UNC Provider (MUP)"
-HKLM,"SYSTEM\CurrentControlSet\Services\Mup","ErrorControl",0x00010001,0x00000001
+;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Description",0x00000000,"Multiple
UNC Provider (MUP)"
+;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","ErrorControl",0x00010001,0x00000001
;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Group",0x00000000,"Network"
-HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Group",0x00000000,"File
System"
-HKLM,"SYSTEM\CurrentControlSet\Services\Mup","ImagePath",0x00020000,"system32\drivers\mup.sys"
-HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Start",0x00010001,0x00000000
-HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Type",0x00010001,0x00000002
+;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Group",0x00000000,"File
System"
+;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","ImagePath",0x00020000,"system32\drivers\mup.sys"
+;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Start",0x00010001,0x00000000
+;HKLM,"SYSTEM\CurrentControlSet\Services\Mup","Type",0x00010001,0x00000002
; NDIS driver - the only boot-start network driver
HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","ErrorControl",0x00010001,0x00000001
Modified: trunk/reactos/ntoskrnl/fsrtl/unc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/unc.c?rev=6…
==============================================================================
--- trunk/reactos/ntoskrnl/fsrtl/unc.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fsrtl/unc.c [iso-8859-1] Sat Sep 27 21:07:48 2014
@@ -32,8 +32,18 @@
NTAPI
FsRtlDeregisterUncProvider(IN HANDLE Handle)
{
- /* Unimplemented */
- KeBugCheck(FILE_SYSTEM);
+ UNICODE_STRING DosDevicesUNC = RTL_CONSTANT_STRING(L"\\DosDevices\\UNC");
+
+ DPRINT("FsRtlDeregisterUncProvider: Handle=%p\n", Handle);
+ //
+ // Normal implementation should look like:
+ // - notify mup.sys?
+ // - at last deregistration, destroy \DosDevices\UNC symbolic link
+ //
+
+ ZwClose(Handle);
+
+ IoDeleteSymbolicLink(&DosDevicesUNC);
}
/*++
@@ -61,7 +71,64 @@
IN PUNICODE_STRING RedirectorDeviceName,
IN BOOLEAN MailslotsSupported)
{
- /* Unimplemented */
- KeBugCheck(FILE_SYSTEM);
- return STATUS_NOT_IMPLEMENTED;
+ UNICODE_STRING DevNull = RTL_CONSTANT_STRING(L"\\Device\\Null");
+ UNICODE_STRING DosDevicesUNC = RTL_CONSTANT_STRING(L"\\DosDevices\\UNC");
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ IO_STATUS_BLOCK Iosb;
+ HANDLE FileHandle;
+ NTSTATUS Status;
+
+ DPRINT("FsRtlRegisterUncProvider: Redirector=%wZ MailslotsSupported=%d\n",
+ RedirectorDeviceName, MailslotsSupported);
+
+ //
+ // Current implementation is a hack, as it only supports one UNC provider.
+ // However, it doesn't require to have a functional mup.sys driver.
+ //
+
+ //
+ // Normal implementation should look like:
+ // - at registration 1, creates symlink \DosDevices\UNC to new provider;
+ // returns handle to \Device\Null
+ // - at registration 2, load mup.sys, register both providers to mup.sys
+ // and change \DosDevices\UNC to DD_MUP_DEVICE_NAME;
+ // returns handle to new provider
+ // - at next registrations, register provider to mup.sys;
+ // returns handle to new provider
+ //
+
+ *Handle = (HANDLE)-1;
+ InitializeObjectAttributes(&ObjectAttributes,
+ &DevNull,
+ OBJ_KERNEL_HANDLE,
+ NULL,
+ NULL);
+ Status = ZwCreateFile(&FileHandle,
+ GENERIC_WRITE,
+ &ObjectAttributes,
+ &Iosb,
+ NULL,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ FILE_OPEN,
+ 0,
+ NULL,
+ 0);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("Failed to open %wZ\n", &DevNull);
+ return Status;
+ }
+
+ Status = IoCreateSymbolicLink(&DosDevicesUNC, RedirectorDeviceName);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("Failed to create symbolic link %wZ -> %wZ\n",
&DosDevicesUNC, RedirectorDeviceName);
+ DPRINT1("FIXME: multiple unc provider registered?\n");
+ ZwClose(FileHandle);
+ return Status;
+ }
+
+ *Handle = FileHandle;
+ return STATUS_SUCCESS;
}