Author: cgutman
Date: Fri Oct 7 03:13:58 2011
New Revision: 54040
URL:
http://svn.reactos.org/svn/reactos?rev=54040&view=rev
Log:
[NTOSKRNL]
- Fix symbolic link creation with a reference string
- Audio devices start successfully again (sound still seems to be regressed however)
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 Oct 7 03:13:58 2011
@@ -887,7 +887,7 @@
ULONG StartIndex;
OBJECT_ATTRIBUTES ObjectAttributes;
ULONG i;
- NTSTATUS Status;
+ NTSTATUS Status, SymLinkStatus;
PEXTENDED_DEVOBJ_EXTENSION DeviceObjectExtension;
ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
@@ -1137,25 +1137,19 @@
}
RtlAppendUnicodeToString(SymbolicLinkName, L"#");
RtlAppendUnicodeStringToString(SymbolicLinkName, &GuidString);
-
- 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(SubKey,
- &SymbolicLink,
- 0, /* TileIndex */
- REG_SZ,
- SymbolicLinkName->Buffer,
- SymbolicLinkName->Length);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("ZwSetValueKey() failed with status 0x%08lx\n", Status);
+ /* 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);
@@ -1163,26 +1157,33 @@
ExFreePool(InterfaceKeyName.Buffer);
ExFreePool(BaseKeyName.Buffer);
ExFreePool(SymbolicLinkName->Buffer);
- return Status;
+ return SymLinkStatus;
+ }
+
+ 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(
+ SubKey,
+ &SymbolicLink,
+ 0, /* TileIndex */
+ REG_SZ,
+ SymbolicLinkName->Buffer,
+ SymbolicLinkName->Length);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("ZwSetValueKey() failed with status 0x%08lx\n", Status);
+ ExFreePool(SymbolicLinkName->Buffer);
}
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);
@@ -1192,7 +1193,7 @@
ExFreePool(InterfaceKeyName.Buffer);
ExFreePool(BaseKeyName.Buffer);
- return Status;
+ return NT_SUCCESS(Status) ? SymLinkStatus : Status;
}
/*++