2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/fsrtl/unc.c
5 * PURPOSE: Manages UNC support routines for file system drivers.
9 /* INCLUDES ******************************************************************/
15 /* PUBLIC FUNCTIONS **********************************************************/
18 * @name FsRtlDeregisterUncProvider
33 FsRtlDeregisterUncProvider(IN HANDLE Handle
)
35 UNICODE_STRING DosDevicesUNC
= RTL_CONSTANT_STRING(L
"\\DosDevices\\UNC");
37 DPRINT("FsRtlDeregisterUncProvider: Handle=%p\n", Handle
);
39 // Normal implementation should look like:
41 // - at last deregistration, destroy \DosDevices\UNC symbolic link
46 IoDeleteSymbolicLink(&DosDevicesUNC
);
50 * @name FsRtlRegisterUncProvider
58 * @param RedirectorDeviceName
61 * @param MailslotsSupported
70 FsRtlRegisterUncProvider(IN OUT PHANDLE Handle
,
71 IN PUNICODE_STRING RedirectorDeviceName
,
72 IN BOOLEAN MailslotsSupported
)
74 UNICODE_STRING DevNull
= RTL_CONSTANT_STRING(L
"\\Device\\Null");
75 UNICODE_STRING DosDevicesUNC
= RTL_CONSTANT_STRING(L
"\\DosDevices\\UNC");
76 OBJECT_ATTRIBUTES ObjectAttributes
;
81 DPRINT("FsRtlRegisterUncProvider: Redirector=%wZ MailslotsSupported=%d\n",
82 RedirectorDeviceName
, MailslotsSupported
);
85 // Current implementation is a hack, as it only supports one UNC provider.
86 // However, it doesn't require to have a functional mup.sys driver.
90 // Normal implementation should look like:
91 // - at registration 1, creates symlink \DosDevices\UNC to new provider;
92 // returns handle to \Device\Null
93 // - at registration 2, load mup.sys, register both providers to mup.sys
94 // and change \DosDevices\UNC to DD_MUP_DEVICE_NAME;
95 // returns handle to new provider
96 // - at next registrations, register provider to mup.sys;
97 // returns handle to new provider
100 *Handle
= (HANDLE
)-1;
101 InitializeObjectAttributes(&ObjectAttributes
,
106 Status
= ZwCreateFile(&FileHandle
,
111 FILE_ATTRIBUTE_NORMAL
,
112 FILE_SHARE_READ
| FILE_SHARE_WRITE
,
117 if (!NT_SUCCESS(Status
))
119 DPRINT("Failed to open %wZ\n", &DevNull
);
123 Status
= IoCreateSymbolicLink(&DosDevicesUNC
, RedirectorDeviceName
);
124 if (!NT_SUCCESS(Status
))
126 DPRINT("Failed to create symbolic link %wZ -> %wZ\n", &DosDevicesUNC
, RedirectorDeviceName
);
127 DPRINT1("FIXME: multiple unc provider registered?\n");
132 *Handle
= FileHandle
;
133 return STATUS_SUCCESS
;