[NTOSKRNL]

- Make legacy device keys volatile

svn path=/trunk/; revision=46840
This commit is contained in:
Cameron Gutman 2010-04-11 16:08:20 +00:00
parent a4f5e7b912
commit 5d13bbcc06
3 changed files with 9 additions and 6 deletions

View file

@ -63,6 +63,7 @@ IopUpdateResourceMapForPnPDevice(
NTSTATUS NTSTATUS
NTAPI NTAPI
IopCreateDeviceKeyPath(IN PCUNICODE_STRING RegistryPath, IopCreateDeviceKeyPath(IN PCUNICODE_STRING RegistryPath,
IN ULONG CreateOptions,
OUT PHANDLE Handle); OUT PHANDLE Handle);
PDEVICE_NODE PDEVICE_NODE
@ -226,7 +227,7 @@ IopStartDevice(
} }
} }
Status = IopCreateDeviceKeyPath(&DeviceNode->InstancePath, &InstanceHandle); Status = IopCreateDeviceKeyPath(&DeviceNode->InstancePath, 0, &InstanceHandle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return Status; return Status;
@ -458,7 +459,7 @@ IopCreateDeviceNode(PDEVICE_NODE ParentNode,
} }
/* Create the device key for legacy drivers */ /* Create the device key for legacy drivers */
Status = IopCreateDeviceKeyPath(&Node->InstancePath, &InstanceHandle); Status = IopCreateDeviceKeyPath(&Node->InstancePath, REG_OPTION_VOLATILE, &InstanceHandle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ZwClose(InstanceHandle); ZwClose(InstanceHandle);
@ -761,6 +762,7 @@ IopTraverseDeviceTree(PDEVICETREE_TRAVERSE_CONTEXT Context)
NTSTATUS NTSTATUS
NTAPI NTAPI
IopCreateDeviceKeyPath(IN PCUNICODE_STRING RegistryPath, IopCreateDeviceKeyPath(IN PCUNICODE_STRING RegistryPath,
IN ULONG CreateOptions,
OUT PHANDLE Handle) OUT PHANDLE Handle)
{ {
UNICODE_STRING EnumU = RTL_CONSTANT_STRING(ENUM_ROOT); UNICODE_STRING EnumU = RTL_CONSTANT_STRING(ENUM_ROOT);
@ -811,7 +813,7 @@ IopCreateDeviceKeyPath(IN PCUNICODE_STRING RegistryPath,
&ObjectAttributes, &ObjectAttributes,
0, 0,
NULL, NULL,
0, CreateOptions,
NULL); NULL);
/* Close parent key handle, we don't need it anymore */ /* Close parent key handle, we don't need it anymore */
@ -2244,7 +2246,7 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode,
/* /*
* Create registry key for the instance id, if it doesn't exist yet * Create registry key for the instance id, if it doesn't exist yet
*/ */
Status = IopCreateDeviceKeyPath(&DeviceNode->InstancePath, &InstanceKey); Status = IopCreateDeviceKeyPath(&DeviceNode->InstancePath, 0, &InstanceKey);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("Failed to create the instance key! (Status %lx)\n", Status); DPRINT1("Failed to create the instance key! (Status %lx)\n", Status);

View file

@ -15,6 +15,7 @@
NTSTATUS NTSTATUS
NTAPI NTAPI
IopCreateDeviceKeyPath(IN PCUNICODE_STRING RegistryPath, IopCreateDeviceKeyPath(IN PCUNICODE_STRING RegistryPath,
IN ULONG CreateOptions,
OUT PHANDLE Handle); OUT PHANDLE Handle);
NTSTATUS NTSTATUS
@ -196,7 +197,7 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject,
IopActionConfigureChildServices(DeviceNode, DeviceNode->Parent); IopActionConfigureChildServices(DeviceNode, DeviceNode->Parent);
/* Open a handle to the instance path key */ /* Open a handle to the instance path key */
Status = IopCreateDeviceKeyPath(&DeviceNode->InstancePath, &InstanceKey); Status = IopCreateDeviceKeyPath(&DeviceNode->InstancePath, 0, &InstanceKey);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return Status; return Status;

View file

@ -172,7 +172,7 @@ PnpRootCreateDevice(
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
InitializeObjectAttributes(&ObjectAttributes, &Device->DeviceID, OBJ_CASE_INSENSITIVE, EnumHandle, NULL); InitializeObjectAttributes(&ObjectAttributes, &Device->DeviceID, OBJ_CASE_INSENSITIVE, EnumHandle, NULL);
Status = ZwCreateKey(&DeviceKeyHandle, KEY_SET_VALUE, &ObjectAttributes, 0, NULL, 0, NULL); Status = ZwCreateKey(&DeviceKeyHandle, KEY_SET_VALUE, &ObjectAttributes, 0, NULL, REG_OPTION_VOLATILE, NULL);
ZwClose(EnumHandle); ZwClose(EnumHandle);
} }