- 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.

svn path=/trunk/; revision=42819
This commit is contained in:
Johannes Anderwald 2009-08-21 10:02:25 +00:00
parent 97ebb9ee91
commit 5fb02a865b

View file

@ -881,17 +881,12 @@ IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject,
}
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 @@ IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject,
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,11 +960,13 @@ IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName,
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 @@ IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName,
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);