mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 04:13:34 +00:00
[NTOSKRNL]
- Fix symbolic link creation with a reference string - Audio devices start successfully again (sound still seems to be regressed however) svn path=/trunk/; revision=54040
This commit is contained in:
@@ -887,7 +887,7 @@ IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject,
|
||||
ULONG StartIndex;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
ULONG i;
|
||||
NTSTATUS Status;
|
||||
NTSTATUS Status, SymLinkStatus;
|
||||
PEXTENDED_DEVOBJ_EXTENSION DeviceObjectExtension;
|
||||
|
||||
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
|
||||
@@ -1137,6 +1137,28 @@ IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject,
|
||||
}
|
||||
RtlAppendUnicodeToString(SymbolicLinkName, L"#");
|
||||
RtlAppendUnicodeStringToString(SymbolicLinkName, &GuidString);
|
||||
SymbolicLinkName->Buffer[SymbolicLinkName->Length/sizeof(WCHAR)] = L'\0';
|
||||
|
||||
/* Create symbolic link */
|
||||
DPRINT("IoRegisterDeviceInterface(): creating symbolic link %wZ -> %wZ\n", SymbolicLinkName, &PdoNameInfo->Name);
|
||||
SymLinkStatus = IoCreateSymbolicLink(SymbolicLinkName, &PdoNameInfo->Name);
|
||||
|
||||
/* If the symbolic link already exists, return an informational success status */
|
||||
if (SymLinkStatus == STATUS_OBJECT_NAME_COLLISION)
|
||||
SymLinkStatus = STATUS_OBJECT_NAME_EXISTS;
|
||||
|
||||
if (!NT_SUCCESS(SymLinkStatus))
|
||||
{
|
||||
DPRINT1("IoCreateSymbolicLink() failed with status 0x%08lx\n", SymLinkStatus);
|
||||
ZwClose(SubKey);
|
||||
ZwClose(InterfaceKey);
|
||||
ZwClose(ClassKey);
|
||||
ExFreePool(SubKeyName.Buffer);
|
||||
ExFreePool(InterfaceKeyName.Buffer);
|
||||
ExFreePool(BaseKeyName.Buffer);
|
||||
ExFreePool(SymbolicLinkName->Buffer);
|
||||
return SymLinkStatus;
|
||||
}
|
||||
|
||||
if (ReferenceString && ReferenceString->Length)
|
||||
{
|
||||
@@ -1147,44 +1169,23 @@ IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject,
|
||||
|
||||
/* Write symbolic link name in registry */
|
||||
SymbolicLinkName->Buffer[1] = '\\';
|
||||
Status = ZwSetValueKey(SubKey,
|
||||
&SymbolicLink,
|
||||
0, /* TileIndex */
|
||||
REG_SZ,
|
||||
SymbolicLinkName->Buffer,
|
||||
SymbolicLinkName->Length);
|
||||
Status = ZwSetValueKey(
|
||||
SubKey,
|
||||
&SymbolicLink,
|
||||
0, /* TileIndex */
|
||||
REG_SZ,
|
||||
SymbolicLinkName->Buffer,
|
||||
SymbolicLinkName->Length);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("ZwSetValueKey() failed with status 0x%08lx\n", Status);
|
||||
ZwClose(SubKey);
|
||||
ZwClose(InterfaceKey);
|
||||
ZwClose(ClassKey);
|
||||
ExFreePool(SubKeyName.Buffer);
|
||||
ExFreePool(InterfaceKeyName.Buffer);
|
||||
ExFreePool(BaseKeyName.Buffer);
|
||||
ExFreePool(SymbolicLinkName->Buffer);
|
||||
return Status;
|
||||
}
|
||||
else
|
||||
{
|
||||
SymbolicLinkName->Buffer[1] = '?';
|
||||
}
|
||||
|
||||
/* Create symbolic link */
|
||||
DPRINT("IoRegisterDeviceInterface(): creating symbolic link %wZ -> %wZ\n", SymbolicLinkName, &PdoNameInfo->Name);
|
||||
Status = IoCreateSymbolicLink(SymbolicLinkName, &PdoNameInfo->Name);
|
||||
|
||||
/* If the symbolic link already exists, return an informational success status */
|
||||
if (Status == STATUS_OBJECT_NAME_COLLISION)
|
||||
Status = STATUS_OBJECT_NAME_EXISTS;
|
||||
|
||||
/* Check if it really failed */
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("IoCreateSymbolicLink() failed with status 0x%08lx\n", Status);
|
||||
ExFreePool(SymbolicLinkName->Buffer);
|
||||
}
|
||||
|
||||
ZwClose(SubKey);
|
||||
ZwClose(InterfaceKey);
|
||||
ZwClose(ClassKey);
|
||||
@@ -1192,7 +1193,7 @@ IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject,
|
||||
ExFreePool(InterfaceKeyName.Buffer);
|
||||
ExFreePool(BaseKeyName.Buffer);
|
||||
|
||||
return Status;
|
||||
return NT_SUCCESS(Status) ? SymLinkStatus : Status;
|
||||
}
|
||||
|
||||
/*++
|
||||
|
||||
Reference in New Issue
Block a user