Author: cgutman
Date: Mon Feb 20 11:30:51 2012
New Revision: 55747
URL:
http://svn.reactos.org/svn/reactos?rev=55747&view=rev
Log:
[NTOSKRNL]
- Create the DeviceClasses key necessary for device interfaces to be registered
successfully in 1st stage
- This may not be the correct place to do this so anyone is free to move it
Modified:
trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c
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] Mon Feb 20 11:30:51 2012
@@ -362,7 +362,7 @@
{
NTSTATUS Status;
ULONG Disposition;
- HANDLE KeyHandle, EnumHandle, ParentHandle, TreeHandle;
+ HANDLE KeyHandle, EnumHandle, ParentHandle, TreeHandle, ControlHandle;
UNICODE_STRING KeyName =
RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET");
PDEVICE_OBJECT Pdo;
@@ -386,7 +386,37 @@
&KeyName,
KEY_ALL_ACCESS);
if (!NT_SUCCESS(Status)) return Status;
-
+
+ /* Create the control key */
+ RtlInitUnicodeString(&KeyName, L"Control");
+ Status = IopCreateRegistryKeyEx(&ControlHandle,
+ KeyHandle,
+ &KeyName,
+ KEY_ALL_ACCESS,
+ REG_OPTION_NON_VOLATILE,
+ &Disposition);
+ if (!NT_SUCCESS(Status)) return Status;
+
+ /* Check if it's a new key */
+ if (Disposition == REG_CREATED_NEW_KEY)
+ {
+ HANDLE DeviceClassesHandle;
+
+ /* Create the device classes key */
+ RtlInitUnicodeString(&KeyName, L"DeviceClasses");
+ Status = IopCreateRegistryKeyEx(&DeviceClassesHandle,
+ ControlHandle,
+ &KeyName,
+ KEY_ALL_ACCESS,
+ REG_OPTION_NON_VOLATILE,
+ &Disposition);
+ if (!NT_SUCCESS(Status)) return Status;
+
+ ZwClose(DeviceClassesHandle);
+ }
+
+ ZwClose(ControlHandle);
+
/* Create the enum key */
RtlInitUnicodeString(&KeyName, REGSTR_KEY_ENUM);
Status = IopCreateRegistryKeyEx(&EnumHandle,
@@ -436,7 +466,26 @@
NtClose(EnumHandle);
if (NT_SUCCESS(Status)) NtClose(TreeHandle);
}
-
+
+ /* Open the root key now */
+ RtlInitUnicodeString(&KeyName,
L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET\\ENUM");
+ Status = IopOpenRegistryKeyEx(&EnumHandle,
+ NULL,
+ &KeyName,
+ KEY_ALL_ACCESS);
+ if (NT_SUCCESS(Status))
+ {
+ /* Create the root dev node */
+ RtlInitUnicodeString(&KeyName, REGSTR_VAL_ROOT_DEVNODE);
+ Status = IopCreateRegistryKeyEx(&TreeHandle,
+ EnumHandle,
+ &KeyName,
+ KEY_ALL_ACCESS,
+ REG_OPTION_NON_VOLATILE,
+ NULL);
+ NtClose(EnumHandle);
+ if (NT_SUCCESS(Status)) NtClose(TreeHandle);
+ }
/* Create the root driver */
Status = IoCreateDriver(NULL, PnpRootDriverEntry);
if (!NT_SUCCESS(Status))