mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Create mandatory keys for resource management.
svn path=/trunk/; revision=2237
This commit is contained in:
parent
b62d5e3184
commit
0c901951af
3 changed files with 129 additions and 22 deletions
|
@ -2,20 +2,24 @@
|
|||
#ifndef __INCLUDE_CM_H
|
||||
#define __INCLUDE_CM_H
|
||||
|
||||
#define REG_ROOT_KEY_NAME L"\\Registry"
|
||||
#define REG_MACHINE_KEY_NAME L"\\Registry\\Machine"
|
||||
#define REG_CLASSES_KEY_NAME L"\\Registry\\Machine\\Software\\Classes"
|
||||
#define REG_SYSTEM_KEY_NAME L"\\Registry\\Machine\\System"
|
||||
#define REG_SOFTWARE_KEY_NAME L"\\Registry\\Machine\\Software"
|
||||
#define REG_SAM_KEY_NAME L"\\Registry\\Machine\\Sam"
|
||||
#define REG_SEC_KEY_NAME L"\\Registry\\Machine\\Security"
|
||||
#define REG_USERS_KEY_NAME L"\\Registry\\User"
|
||||
#define REG_USER_KEY_NAME L"\\Registry\\User\\CurrentUser"
|
||||
#define SYSTEM_REG_FILE L"\\SystemRoot\\System32\\Config\\SYSTEM"
|
||||
#define SOFTWARE_REG_FILE L"\\SystemRoot\\System32\\Config\\SOFTWARE"
|
||||
#define USER_REG_FILE L"\\SystemRoot\\System32\\Config\\DEFAULT"
|
||||
#define SAM_REG_FILE L"\\SystemRoot\\System32\\Config\\SAM"
|
||||
#define SEC_REG_FILE L"\\SystemRoot\\System32\\Config\\SECURITY"
|
||||
#define REG_ROOT_KEY_NAME L"\\Registry"
|
||||
#define REG_MACHINE_KEY_NAME L"\\Registry\\Machine"
|
||||
#define REG_HARDWARE_KEY_NAME L"\\Registry\\Machine\\HARDWARE"
|
||||
#define REG_DESCRIPTION_KEY_NAME L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION"
|
||||
#define REG_DEVICEMAP_KEY_NAME L"\\Registry\\Machine\\HARDWARE\\DEVICEMAP"
|
||||
#define REG_RESOURCEMAP_KEY_NAME L"\\Registry\\Machine\\HARDWARE\\RESOURCEMAP"
|
||||
#define REG_CLASSES_KEY_NAME L"\\Registry\\Machine\\Software\\Classes"
|
||||
#define REG_SYSTEM_KEY_NAME L"\\Registry\\Machine\\System"
|
||||
#define REG_SOFTWARE_KEY_NAME L"\\Registry\\Machine\\Software"
|
||||
#define REG_SAM_KEY_NAME L"\\Registry\\Machine\\Sam"
|
||||
#define REG_SEC_KEY_NAME L"\\Registry\\Machine\\Security"
|
||||
#define REG_USERS_KEY_NAME L"\\Registry\\User"
|
||||
#define REG_USER_KEY_NAME L"\\Registry\\User\\CurrentUser"
|
||||
#define SYSTEM_REG_FILE L"\\SystemRoot\\System32\\Config\\SYSTEM"
|
||||
#define SOFTWARE_REG_FILE L"\\SystemRoot\\System32\\Config\\SOFTWARE"
|
||||
#define USER_REG_FILE L"\\SystemRoot\\System32\\Config\\DEFAULT"
|
||||
#define SAM_REG_FILE L"\\SystemRoot\\System32\\Config\\SAM"
|
||||
#define SEC_REG_FILE L"\\SystemRoot\\System32\\Config\\SECURITY"
|
||||
|
||||
#define REGISTRY_FILE_MAGIC "REGEDIT4"
|
||||
|
||||
|
|
|
@ -1010,13 +1010,12 @@ NtQueryValueKey (
|
|||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NTSTATUS STDCALL
|
||||
NtSetValueKey (
|
||||
IN HANDLE KeyHandle,
|
||||
IN HANDLE KeyHandle,
|
||||
IN PUNICODE_STRING ValueName,
|
||||
IN ULONG TitleIndex,
|
||||
IN ULONG Type,
|
||||
IN ULONG Type,
|
||||
IN PVOID Data,
|
||||
IN ULONG DataSize
|
||||
)
|
||||
|
@ -1032,7 +1031,7 @@ NtSetValueKey (
|
|||
PHEAP_BLOCK pHeap;
|
||||
// KIRQL OldIrql;
|
||||
|
||||
DPRINT1("KeyHandle %x ValueName %S Type %d\n",
|
||||
DPRINT("KeyHandle %x ValueName %S Type %d\n",
|
||||
KeyHandle, ValueName->Buffer, Type);
|
||||
|
||||
wcstombs(ValueName2,ValueName->Buffer,ValueName->Length>>1);
|
||||
|
@ -1045,7 +1044,6 @@ NtSetValueKey (
|
|||
UserMode,
|
||||
(PVOID *)&KeyObject,
|
||||
NULL);
|
||||
DPRINT1("Status 0x%X\n", Status);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
|
@ -1131,7 +1129,7 @@ NtSetValueKey (
|
|||
// KeReleaseSpinLock(&RegistryFile->RegLock, OldIrql);
|
||||
ObDereferenceObject (KeyObject);
|
||||
|
||||
DPRINT1("Return Status 0x%X\n", Status);
|
||||
DPRINT("Return Status 0x%X\n", Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: registry.c,v 1.64 2001/08/30 20:38:18 dwelch Exp $
|
||||
/* $Id: registry.c,v 1.65 2001/09/08 09:02:08 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -33,6 +33,7 @@ KSPIN_LOCK CmiKeyListLock;
|
|||
static PKEY_OBJECT CmiRootKey = NULL;
|
||||
static PKEY_OBJECT CmiMachineKey = NULL;
|
||||
static PKEY_OBJECT CmiUserKey = NULL;
|
||||
static PKEY_OBJECT CmiHardwareKey = NULL;
|
||||
|
||||
static GENERIC_MAPPING CmiKeyMapping =
|
||||
{KEY_READ, KEY_WRITE, KEY_EXECUTE, KEY_ALL_ACCESS};
|
||||
|
@ -159,6 +160,110 @@ DPRINT("Creating HKU\n");
|
|||
CmiAddKeyToList(CmiRootKey,NewKey);
|
||||
CmiUserKey=NewKey;
|
||||
|
||||
/* Create '\\Registry\\Machine\\HARDWARE' key. */
|
||||
RtlInitUnicodeString(&RootKeyName, REG_HARDWARE_KEY_NAME);
|
||||
InitializeObjectAttributes(&ObjectAttributes, &RootKeyName, 0, NULL, NULL);
|
||||
Status=ObCreateObject(&KeyHandle,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
&ObjectAttributes,
|
||||
CmiKeyType,
|
||||
(PVOID*)&NewKey);
|
||||
Status = CmiAddSubKey(CmiVolatileFile,
|
||||
CmiMachineKey,
|
||||
NewKey,
|
||||
L"HARDWARE",
|
||||
16,
|
||||
0,
|
||||
NULL,
|
||||
0);
|
||||
NewKey->RegistryFile = CmiVolatileFile;
|
||||
NewKey->Flags = 0;
|
||||
NewKey->NumberOfSubKeys=0;
|
||||
NewKey->SubKeys= NULL;
|
||||
NewKey->SizeOfSubKeys= NewKey->KeyBlock->NumberOfSubKeys;
|
||||
NewKey->Name=ExAllocatePool(PagedPool,strlen("HARDWARE"));
|
||||
NewKey->NameSize=strlen("HARDWARE");
|
||||
memcpy(NewKey->Name,"HARDWARE",strlen("HARDWARE"));
|
||||
CmiAddKeyToList(CmiMachineKey,NewKey);
|
||||
CmiHardwareKey=NewKey;
|
||||
|
||||
/* Create '\\Registry\\Machine\\HARDWARE\\DESCRIPTION' key. */
|
||||
RtlInitUnicodeString(&RootKeyName, REG_DESCRIPTION_KEY_NAME);
|
||||
InitializeObjectAttributes(&ObjectAttributes, &RootKeyName, 0, NULL, NULL);
|
||||
Status=ObCreateObject(&KeyHandle,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
&ObjectAttributes,
|
||||
CmiKeyType,
|
||||
(PVOID*)&NewKey);
|
||||
Status = CmiAddSubKey(CmiVolatileFile,
|
||||
CmiHardwareKey,
|
||||
NewKey,
|
||||
L"DESCRIPTION",
|
||||
16,
|
||||
0,
|
||||
NULL,
|
||||
0);
|
||||
NewKey->RegistryFile = CmiVolatileFile;
|
||||
NewKey->Flags = 0;
|
||||
NewKey->NumberOfSubKeys=0;
|
||||
NewKey->SubKeys= NULL;
|
||||
NewKey->SizeOfSubKeys= NewKey->KeyBlock->NumberOfSubKeys;
|
||||
NewKey->Name=ExAllocatePool(PagedPool,strlen("DESCRIPTION"));
|
||||
NewKey->NameSize=strlen("DESCRIPTION");
|
||||
memcpy(NewKey->Name,"DESCRIPTION",strlen("DESCRIPTION"));
|
||||
CmiAddKeyToList(CmiHardwareKey,NewKey);
|
||||
|
||||
/* Create '\\Registry\\Machine\\HARDWARE\\DEVICEMAP' key. */
|
||||
RtlInitUnicodeString(&RootKeyName, REG_DEVICEMAP_KEY_NAME);
|
||||
InitializeObjectAttributes(&ObjectAttributes, &RootKeyName, 0, NULL, NULL);
|
||||
Status=ObCreateObject(&KeyHandle,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
&ObjectAttributes,
|
||||
CmiKeyType,
|
||||
(PVOID*)&NewKey);
|
||||
Status = CmiAddSubKey(CmiVolatileFile,
|
||||
CmiHardwareKey,
|
||||
NewKey,
|
||||
L"DEVICEMAP",
|
||||
18,
|
||||
0,
|
||||
NULL,
|
||||
0);
|
||||
NewKey->RegistryFile = CmiVolatileFile;
|
||||
NewKey->Flags = 0;
|
||||
NewKey->NumberOfSubKeys=0;
|
||||
NewKey->SubKeys= NULL;
|
||||
NewKey->SizeOfSubKeys= NewKey->KeyBlock->NumberOfSubKeys;
|
||||
NewKey->Name=ExAllocatePool(PagedPool,strlen("DEVICEMAP"));
|
||||
NewKey->NameSize=strlen("DEVICEMAP");
|
||||
memcpy(NewKey->Name,"DEVICEMAP",strlen("DEVICEMAP"));
|
||||
CmiAddKeyToList(CmiHardwareKey,NewKey);
|
||||
|
||||
/* Create '\\Registry\\Machine\\HARDWARE\\RESOURCEMAP' key. */
|
||||
RtlInitUnicodeString(&RootKeyName, REG_RESOURCEMAP_KEY_NAME);
|
||||
InitializeObjectAttributes(&ObjectAttributes, &RootKeyName, 0, NULL, NULL);
|
||||
Status=ObCreateObject(&KeyHandle,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
&ObjectAttributes,
|
||||
CmiKeyType,
|
||||
(PVOID*)&NewKey);
|
||||
Status = CmiAddSubKey(CmiVolatileFile,
|
||||
CmiHardwareKey,
|
||||
NewKey,
|
||||
L"RESOURCEMAP",
|
||||
22,
|
||||
0,
|
||||
NULL,
|
||||
0);
|
||||
NewKey->RegistryFile = CmiVolatileFile;
|
||||
NewKey->Flags = 0;
|
||||
NewKey->NumberOfSubKeys=0;
|
||||
NewKey->SubKeys= NULL;
|
||||
NewKey->SizeOfSubKeys= NewKey->KeyBlock->NumberOfSubKeys;
|
||||
NewKey->Name=ExAllocatePool(PagedPool,strlen("RESOURCEMAP"));
|
||||
NewKey->NameSize=strlen("RESOURCEMAP");
|
||||
memcpy(NewKey->Name,"RESOURCEMAP",strlen("RESOURCEMAP"));
|
||||
CmiAddKeyToList(CmiHardwareKey,NewKey);
|
||||
|
||||
/* FIXME: create remaining structure needed for default handles */
|
||||
/* FIXME: load volatile registry data from ROSDTECT */
|
||||
|
|
Loading…
Reference in a new issue