mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +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
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id$
|
||||
*
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/internal/io.h
|
||||
|
@ -340,6 +339,9 @@ extern ULONGLONG IoOtherTransferCount;
|
|||
VOID
|
||||
PnpInit(VOID);
|
||||
|
||||
VOID
|
||||
PnpInit2(VOID);
|
||||
|
||||
VOID
|
||||
IopInitDriverImplementation(VOID);
|
||||
|
||||
|
|
|
@ -325,6 +325,8 @@ IoInit2(BOOLEAN BootLog)
|
|||
MODULE_OBJECT ModuleObject;
|
||||
NTSTATUS Status;
|
||||
|
||||
PnpInit2();
|
||||
|
||||
IoCreateDriverList();
|
||||
|
||||
KeInitializeSpinLock (&IoStatisticsLock);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* $Id$
|
||||
*
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/io/pnpmgr.c
|
||||
|
@ -893,6 +892,39 @@ IopSetDeviceInstanceData(HANDLE InstanceKey,
|
|||
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");
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -1818,7 +1850,8 @@ IopInitializePnpServices(
|
|||
DeviceNode,
|
||||
IopActionInitBootServices,
|
||||
DeviceNode);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
IopInitDeviceTreeTraverseContext(
|
||||
&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
|
||||
PnpInit(VOID)
|
||||
{
|
||||
|
@ -2026,7 +2088,7 @@ PnpInit(VOID)
|
|||
}
|
||||
|
||||
if (!IopCreateUnicodeString(&IopRootDeviceNode->InstancePath,
|
||||
L"HTREE\\Root\\0",
|
||||
L"HTREE\\ROOT\\0",
|
||||
PagedPool))
|
||||
{
|
||||
CPRINT("Failed to create the instance path!\n");
|
||||
|
@ -2044,4 +2106,19 @@ PnpInit(VOID)
|
|||
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 */
|
||||
|
|
Loading…
Reference in a new issue