Author: tfaber
Date: Thu Jun 15 13:25:26 2017
New Revision: 75046
URL:
http://svn.reactos.org/svn/reactos?rev=75046&view=rev
Log:
[NTOS:IO]
- Pass Enum subkey handle to IopAttachFilterDrivers, since we've already opened it in
PipCallDriverAddDevice.
CORE-13336
Modified:
trunk/reactos/ntoskrnl/io/iomgr/driver.c
trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Thu Jun 15 13:25:26 2017
@@ -640,41 +640,15 @@
FASTCALL
IopAttachFilterDrivers(
PDEVICE_NODE DeviceNode,
+ HANDLE EnumSubKey,
BOOLEAN Lower)
{
RTL_QUERY_REGISTRY_TABLE QueryTable[2] = { { NULL, 0, NULL, NULL, 0, NULL, 0 }, };
UNICODE_STRING Class;
WCHAR ClassBuffer[40];
- UNICODE_STRING EnumRoot = RTL_CONSTANT_STRING(ENUM_ROOT);
UNICODE_STRING ControlClass =
RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class");
- HANDLE EnumRootKey, SubKey;
HANDLE ControlKey, ClassKey;
NTSTATUS Status;
-
- /* Open enumeration root key */
- Status = IopOpenRegistryKeyEx(&EnumRootKey,
- NULL,
- &EnumRoot,
- KEY_READ);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("IopOpenRegistryKeyEx() failed for '%wZ' with status
0x%lx\n",
- &EnumRoot, Status);
- return Status;
- }
-
- /* Open subkey */
- Status = IopOpenRegistryKeyEx(&SubKey,
- EnumRootKey,
- &DeviceNode->InstancePath,
- KEY_READ);
- ZwClose(EnumRootKey);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("IopOpenRegistryKeyEx() failed for '%wZ' with status
0x%lx\n",
- &DeviceNode->InstancePath, Status);
- return Status;
- }
/*
* First load the device filters
@@ -688,7 +662,7 @@
QueryTable[0].DefaultType = REG_NONE;
Status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE,
- (PWSTR)SubKey,
+ (PWSTR)EnumSubKey,
QueryTable,
DeviceNode,
NULL);
@@ -696,7 +670,6 @@
{
DPRINT1("Failed to load device %s filters: %08X\n",
Lower ? "lower" : "upper", Status);
- ZwClose(SubKey);
return Status;
}
@@ -712,13 +685,10 @@
QueryTable[0].Flags = RTL_QUERY_REGISTRY_REQUIRED | RTL_QUERY_REGISTRY_DIRECT;
Status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE,
- (PWSTR)SubKey,
+ (PWSTR)EnumSubKey,
QueryTable,
DeviceNode,
NULL);
-
- /* Close subkey */
- ZwClose(SubKey);
/* If there is no class GUID, we're done */
if (!NT_SUCCESS(Status))
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c [iso-8859-1] Thu Jun 15 13:25:26 2017
@@ -290,7 +290,6 @@
Status = IopGetRegistryValue(SubKey,
REGSTR_VAL_CLASSGUID,
&KeyValueInformation);
- ZwClose(SubKey);
if (NT_SUCCESS(Status))
{
/* Convert to unicode string */
@@ -356,26 +355,28 @@
}
/* Do ReactOS-style setup */
- Status = IopAttachFilterDrivers(DeviceNode, TRUE);
+ Status = IopAttachFilterDrivers(DeviceNode, SubKey, TRUE);
if (!NT_SUCCESS(Status))
{
IopRemoveDevice(DeviceNode);
- return Status;
+ goto Exit;
}
Status = IopInitializeDevice(DeviceNode, DriverObject);
if (NT_SUCCESS(Status))
{
- Status = IopAttachFilterDrivers(DeviceNode, FALSE);
+ Status = IopAttachFilterDrivers(DeviceNode, SubKey, FALSE);
if (!NT_SUCCESS(Status))
{
IopRemoveDevice(DeviceNode);
- return Status;
+ goto Exit;
}
Status = IopStartDevice(DeviceNode);
}
- /* Return status */
+Exit:
+ /* Close key and return status */
+ ZwClose(SubKey);
return Status;
}