Author: cgutman
Date: Thu Aug 18 17:32:26 2011
New Revision: 53301
URL:
http://svn.reactos.org/svn/reactos?rev=53301&view=rev
Log:
[NTOSKRNL]
- Return an informational success status if the device interface already exists
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] Thu Aug 18 17:32:26 2011
@@ -1136,12 +1136,42 @@
}
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);
+ 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 (!NT_SUCCESS(Status) && ReferenceString == NULL)
+
+ /* 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);
ZwClose(SubKey);
@@ -1152,32 +1182,6 @@
ExFreePool(BaseKeyName.Buffer);
ExFreePool(SymbolicLinkName->Buffer);
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(
- 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] = '?';
}
ZwClose(SubKey);