mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 21:56:06 +00:00
[NTOS:IO]
- Pass Enum subkey handle to IopAttachFilterDrivers, since we've already opened it in PipCallDriverAddDevice. CORE-13336 svn path=/trunk/; revision=75046
This commit is contained in:
parent
3dda28e8fb
commit
2103cf341f
2 changed files with 10 additions and 39 deletions
|
@ -640,42 +640,16 @@ NTSTATUS
|
|||
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 @@ IopAttachFilterDrivers(
|
|||
QueryTable[0].DefaultType = REG_NONE;
|
||||
|
||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE,
|
||||
(PWSTR)SubKey,
|
||||
(PWSTR)EnumSubKey,
|
||||
QueryTable,
|
||||
DeviceNode,
|
||||
NULL);
|
||||
|
@ -696,7 +670,6 @@ IopAttachFilterDrivers(
|
|||
{
|
||||
DPRINT1("Failed to load device %s filters: %08X\n",
|
||||
Lower ? "lower" : "upper", Status);
|
||||
ZwClose(SubKey);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -712,14 +685,11 @@ IopAttachFilterDrivers(
|
|||
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))
|
||||
{
|
||||
|
|
|
@ -290,7 +290,6 @@ PipCallDriverAddDevice(IN PDEVICE_NODE DeviceNode,
|
|||
Status = IopGetRegistryValue(SubKey,
|
||||
REGSTR_VAL_CLASSGUID,
|
||||
&KeyValueInformation);
|
||||
ZwClose(SubKey);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Convert to unicode string */
|
||||
|
@ -356,26 +355,28 @@ PipCallDriverAddDevice(IN PDEVICE_NODE DeviceNode,
|
|||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue