Author: hpoussin
Date: Wed Sep 10 16:05:44 2014
New Revision: 64108
URL:
http://svn.reactos.org/svn/reactos?rev=64108&view=rev
Log:
[NTOS:IO]
- Support creating new registry keys when registering new interfaces
- IoSetDeviceInterfaceState: do not try to parse symbolic link name, as symbolic link name
is enough to open the right object
- IoSetDeviceInterfaceState: send the notification on the right interface when registering
interfaces on devices already having an interface
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] Wed Sep 10 16:05:44 2014
@@ -95,9 +95,13 @@
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
ClassesKey,
NULL);
- Status = ZwOpenKey(GuidKeyRealP,
- DesiredAccess | KEY_ENUMERATE_SUB_KEYS,
- &ObjectAttributes);
+ Status = ZwCreateKey(GuidKeyRealP,
+ DesiredAccess | KEY_ENUMERATE_SUB_KEYS,
+ &ObjectAttributes,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ NULL);
ZwClose(ClassesKey);
if (!NT_SUCCESS(Status))
{
@@ -142,9 +146,13 @@
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
*GuidKeyRealP,
NULL);
- Status = ZwOpenKey(DeviceKeyRealP,
- DesiredAccess | KEY_ENUMERATE_SUB_KEYS,
- &ObjectAttributes);
+ Status = ZwCreateKey(DeviceKeyRealP,
+ DesiredAccess | KEY_ENUMERATE_SUB_KEYS,
+ &ObjectAttributes,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ NULL);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to open %wZ%wZ\\%wZ\n", &BaseKeyU, &GuidString,
&SubKeyName);
@@ -156,9 +164,13 @@
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
*DeviceKeyRealP,
NULL);
- Status = ZwOpenKey(InstanceKeyRealP,
- DesiredAccess,
- &ObjectAttributes);
+ Status = ZwCreateKey(InstanceKeyRealP,
+ DesiredAccess,
+ &ObjectAttributes,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ NULL);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to open %wZ%wZ\\%wZ%\\%wZ (%x)\n", &BaseKeyU,
&GuidString, &SubKeyName, &ReferenceString, Status);
@@ -1237,7 +1249,6 @@
PDEVICE_OBJECT PhysicalDeviceObject;
PFILE_OBJECT FileObject;
UNICODE_STRING GuidString;
- UNICODE_STRING SymLink;
PWCHAR StartPosition;
PWCHAR EndPosition;
NTSTATUS Status;
@@ -1255,8 +1266,8 @@
/* Symbolic link name is \??\ACPI#PNP0501#1#{GUID}\ReferenceString */
/* Get GUID from SymbolicLinkName */
- StartPosition = wcschr(SymbolicLinkName->Buffer, L'{');
- EndPosition = wcschr(SymbolicLinkName->Buffer, L'}');
+ StartPosition = wcsrchr(SymbolicLinkName->Buffer, L'{');
+ EndPosition = wcsrchr(SymbolicLinkName->Buffer, L'}');
if (!StartPosition ||!EndPosition || StartPosition > EndPosition)
{
DPRINT1("IoSetDeviceInterfaceState() returning
STATUS_INVALID_PARAMETER_1\n");
@@ -1264,10 +1275,6 @@
}
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);
- DPRINT("IoSetDeviceInterfaceState('%wZ', %u)\n", SymbolicLinkName,
Enable);
Status = OpenRegistryHandlesFromSymbolicLink(SymbolicLinkName,
KEY_CREATE_SUB_KEY,
@@ -1315,7 +1322,7 @@
/* Get pointer to the PDO */
Status = IoGetDeviceObjectPointer(
- &SymLink,
+ SymbolicLinkName,
0, /* DesiredAccess */
&FileObject,
&PhysicalDeviceObject);