Author: janderwald
Date: Fri Aug 21 12:02:25 2009
New Revision: 42819
URL:
http://svn.reactos.org/svn/reactos?rev=42819&view=rev
Log:
- Reference strings are not part of the symbolic link. Therefore don't include them
when creating the symbolic link (IoCreateSymbolicLink)
- Reference strings are used by the kernel streaming system to distinguish kernel
streaming filters. As it is perfectly possible, to provide more than one filter with same
guid but different reference string, ignore the failure for now if IoCreateSymbolicLink
fails
See issue #4566 for more details.
Modified:
trunk/reactos/ntoskrnl/io/iomgr/deviface.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/deviface.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/deviface…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/deviface.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/deviface.c [iso-8859-1] Fri Aug 21 12:02:25 2009
@@ -881,17 +881,12 @@
}
RtlAppendUnicodeToString(SymbolicLinkName, L"#");
RtlAppendUnicodeStringToString(SymbolicLinkName, &GuidString);
- if (ReferenceString && ReferenceString->Length)
- {
- RtlAppendUnicodeToString(SymbolicLinkName, L"\\");
- RtlAppendUnicodeStringToString(SymbolicLinkName, ReferenceString);
- }
SymbolicLinkName->Buffer[SymbolicLinkName->Length/sizeof(WCHAR)] =
L'\0';
/* Create symbolic link */
DPRINT1("IoRegisterDeviceInterface(): creating symbolic link %wZ ->
%wZ\n", SymbolicLinkName, &PdoNameInfo->Name);
Status = IoCreateSymbolicLink(SymbolicLinkName, &PdoNameInfo->Name);
- if (!NT_SUCCESS(Status))
+ if (!NT_SUCCESS(Status) && ReferenceString == NULL)
{
DPRINT("IoCreateSymbolicLink() failed with status 0x%08lx\n", Status);
ZwClose(SubKey);
@@ -904,6 +899,13 @@
return Status;
}
+ if (ReferenceString && ReferenceString->Length)
+ {
+ RtlAppendUnicodeToString(SymbolicLinkName, L"\\");
+ RtlAppendUnicodeStringToString(SymbolicLinkName, ReferenceString);
+ }
+ SymbolicLinkName->Buffer[SymbolicLinkName->Length/sizeof(WCHAR)] =
L'\0';
+
/* Write symbolic link name in registry */
SymbolicLinkName->Buffer[1] = '\\';
Status = ZwSetValueKey(
@@ -958,10 +960,12 @@
PDEVICE_OBJECT PhysicalDeviceObject;
PFILE_OBJECT FileObject;
UNICODE_STRING GuidString;
+ UNICODE_STRING SymLink;
PWCHAR StartPosition;
PWCHAR EndPosition;
NTSTATUS Status;
LPCGUID EventGuid;
+
if (SymbolicLinkName == NULL)
return STATUS_INVALID_PARAMETER_1;
@@ -980,9 +984,13 @@
GuidString.Buffer = StartPosition;
GuidString.MaximumLength = GuidString.Length = (USHORT)((ULONG_PTR)(EndPosition + 1)
- (ULONG_PTR)StartPosition);
+ SymLink.Buffer = SymbolicLinkName->Buffer;
+ SymLink.MaximumLength = SymLink.Length = (USHORT)((ULONG_PTR)(EndPosition + 1) -
(ULONG_PTR)SymLink.Buffer);
+
+
/* Get pointer to the PDO */
Status = IoGetDeviceObjectPointer(
- SymbolicLinkName,
+ &SymLink,
0, /* DesiredAccess */
&FileObject,
&PhysicalDeviceObject);