mirror of
https://github.com/reactos/reactos.git
synced 2025-06-16 07:48:47 +00:00
- Create device instance key for root device node.
- Add DeviceReference value for each non-root device node. svn path=/trunk/; revision=15796
This commit is contained in:
parent
607f793fc0
commit
355593bafa
3 changed files with 118 additions and 37 deletions
|
@ -16,8 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id$
|
/*
|
||||||
*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: include/internal/io.h
|
* FILE: include/internal/io.h
|
||||||
|
@ -340,6 +339,9 @@ extern ULONGLONG IoOtherTransferCount;
|
||||||
VOID
|
VOID
|
||||||
PnpInit(VOID);
|
PnpInit(VOID);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
PnpInit2(VOID);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
IopInitDriverImplementation(VOID);
|
IopInitDriverImplementation(VOID);
|
||||||
|
|
||||||
|
|
|
@ -325,6 +325,8 @@ IoInit2(BOOLEAN BootLog)
|
||||||
MODULE_OBJECT ModuleObject;
|
MODULE_OBJECT ModuleObject;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
PnpInit2();
|
||||||
|
|
||||||
IoCreateDriverList();
|
IoCreateDriverList();
|
||||||
|
|
||||||
KeInitializeSpinLock (&IoStatisticsLock);
|
KeInitializeSpinLock (&IoStatisticsLock);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/* $Id$
|
/*
|
||||||
*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/io/pnpmgr.c
|
* FILE: ntoskrnl/io/pnpmgr.c
|
||||||
|
@ -893,6 +892,39 @@ IopSetDeviceInstanceData(HANDLE InstanceKey,
|
||||||
ZwClose(LogConfKey);
|
ZwClose(LogConfKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DeviceNode->PhysicalDeviceObject != NULL)
|
||||||
|
{
|
||||||
|
/* Create the 'Control' key */
|
||||||
|
RtlInitUnicodeString(&KeyName,
|
||||||
|
L"Control");
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
&KeyName,
|
||||||
|
OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
|
||||||
|
InstanceKey,
|
||||||
|
NULL);
|
||||||
|
Status = ZwCreateKey(&LogConfKey,
|
||||||
|
KEY_ALL_ACCESS,
|
||||||
|
&ObjectAttributes,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
REG_OPTION_VOLATILE,
|
||||||
|
NULL);
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ULONG Reference = (ULONG)DeviceNode->PhysicalDeviceObject;
|
||||||
|
RtlInitUnicodeString(&KeyName,
|
||||||
|
L"DeviceReference");
|
||||||
|
Status = ZwSetValueKey(LogConfKey,
|
||||||
|
&KeyName,
|
||||||
|
0,
|
||||||
|
REG_DWORD,
|
||||||
|
&Reference,
|
||||||
|
sizeof(PVOID));
|
||||||
|
|
||||||
|
ZwClose(LogConfKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DPRINT("IopSetDeviceInstanceData() done\n");
|
DPRINT("IopSetDeviceInstanceData() done\n");
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -1818,7 +1850,8 @@ IopInitializePnpServices(
|
||||||
DeviceNode,
|
DeviceNode,
|
||||||
IopActionInitBootServices,
|
IopActionInitBootServices,
|
||||||
DeviceNode);
|
DeviceNode);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
IopInitDeviceTreeTraverseContext(
|
IopInitDeviceTreeTraverseContext(
|
||||||
&Context,
|
&Context,
|
||||||
|
@ -1981,6 +2014,35 @@ IopInvalidateDeviceRelations(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static NTSTATUS INIT_FUNCTION
|
||||||
|
IopSetRootDeviceInstanceData(PDEVICE_NODE DeviceNode)
|
||||||
|
{
|
||||||
|
PWSTR KeyBuffer;
|
||||||
|
HANDLE InstanceKey = NULL;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Create registry key for the instance id, if it doesn't exist yet */
|
||||||
|
KeyBuffer = ExAllocatePool(PagedPool,
|
||||||
|
(49 * sizeof(WCHAR)) + DeviceNode->InstancePath.Length);
|
||||||
|
wcscpy(KeyBuffer, L"\\Registry\\Machine\\System\\CurrentControlSet\\Enum\\");
|
||||||
|
wcscat(KeyBuffer, DeviceNode->InstancePath.Buffer);
|
||||||
|
Status = IopCreateDeviceKeyPath(KeyBuffer,
|
||||||
|
&InstanceKey);
|
||||||
|
ExFreePool(KeyBuffer);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Failed to create the instance key! (Status %lx)\n", Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: Set 'ConfigFlags' value */
|
||||||
|
|
||||||
|
ZwClose(InstanceKey);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID INIT_FUNCTION
|
VOID INIT_FUNCTION
|
||||||
PnpInit(VOID)
|
PnpInit(VOID)
|
||||||
{
|
{
|
||||||
|
@ -2026,7 +2088,7 @@ PnpInit(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IopCreateUnicodeString(&IopRootDeviceNode->InstancePath,
|
if (!IopCreateUnicodeString(&IopRootDeviceNode->InstancePath,
|
||||||
L"HTREE\\Root\\0",
|
L"HTREE\\ROOT\\0",
|
||||||
PagedPool))
|
PagedPool))
|
||||||
{
|
{
|
||||||
CPRINT("Failed to create the instance path!\n");
|
CPRINT("Failed to create the instance path!\n");
|
||||||
|
@ -2044,4 +2106,19 @@ PnpInit(VOID)
|
||||||
IopRootDeviceNode->PhysicalDeviceObject);
|
IopRootDeviceNode->PhysicalDeviceObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID INIT_FUNCTION
|
||||||
|
PnpInit2(VOID)
|
||||||
|
{
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Set root device instance data */
|
||||||
|
Status = IopSetRootDeviceInstanceData(IopRootDeviceNode);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
CPRINT("Failed to set instance data\n");
|
||||||
|
KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue