Various small changes for registry work

svn path=/trunk/; revision=614
This commit is contained in:
Rex Jolliff 1999-08-14 18:59:28 +00:00
parent 2a466eda80
commit 9957d94c20
5 changed files with 81 additions and 12 deletions

View file

@ -3,9 +3,9 @@
:
: copy files to HD...
:
COPY /Y A:\DRIVERS\*.SYS C:\reactos\system\drivers > NUL:
COPY /Y A:\DLLS\*.DLL C:\reactos\system > NUL:
COPY /Y A:\APPS\*.EXE C:\reactos\system > NUL:
COPY /Y A:\DRIVERS\*.SYS C:\reactos\system32\drivers > NUL:
COPY /Y A:\DLLS\*.DLL C:\reactos\system32 > NUL:
COPY /Y A:\APPS\*.EXE C:\reactos\system32 > NUL:
:
: present a menu to the booter...
:

View file

@ -92,6 +92,7 @@ VOID PsInit(VOID);
VOID TstBegin(VOID);
VOID KeInit(VOID);
VOID HalInitConsole(boot_param* bp);
VOID CmInitializeRegistry(VOID);
extern WCHAR wtolower(WCHAR ch);

View file

@ -18,7 +18,7 @@
//#define NDEBUG
#include <internal/debug.h>
#define PROTO_REG 1 /* Comment out to disable */
/* #define PROTO_REG 1 /* Comment out to disable */
/* ----------------------------------------------------- Typedefs */
@ -277,9 +277,11 @@ VOID
CmInitializeRegistry(VOID)
{
#if PROTO_REG
NTSTATUS Status;
HANDLE RootKeyHandle;
UNICODE_STRING RootKeyName;
OBJECT_ATTRIBUTES ObjectAttributes;
PKEY_BLOCK KeyBlock;
/* Initialize the Key object type */
CmiKeyType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
@ -311,14 +313,49 @@ CmInitializeRegistry(VOID)
KeInitializeSpinLock(&CmiKeyListLock);
/* Build volitile registry store */
CHECKPOINT;
CmiVolatileFile = CmiCreateRegistry(NULL);
/* Build system registry store */
CmiSystemFile = CmiCreateRegistry(SYSTEM_REG_FILE);
CHECKPOINT;
CmiSystemFile = NULL; // CmiCreateRegistry(SYSTEM_REG_FILE);
/* FIXME: Create initial predefined symbolic links */
/* Create initial predefined symbolic links */
/* HKEY_LOCAL_MACHINE */
CHECKPOINT;
Status = CmiCreateKey(CmiVolatileFile,
L"Machine",
&KeyBlock,
KEY_ALL_ACCESS,
0,
NULL,
REG_OPTION_VOLATILE,
0);
if (!NT_SUCCESS(Status))
{
return;
}
CHECKPOINT;
CmiReleaseBlock(CmiVolatileFile, KeyBlock);
/* HKEY_USERS */
CHECKPOINT;
Status = CmiCreateKey(CmiVolatileFile,
L"Users",
&KeyBlock,
KEY_ALL_ACCESS,
0,
NULL,
REG_OPTION_VOLATILE,
0);
if (!NT_SUCCESS(Status))
{
return;
}
CHECKPOINT;
CmiReleaseBlock(CmiVolatileFile, KeyBlock);
/* FIXME: create remaining structure needed for default handles */
/* FIXME: load volatile registry data from ROSDTECT */
#endif
@ -1653,11 +1690,13 @@ CmiCreateKey(IN PREGISTRY_FILE RegistryFile,
/* FIXME: Should handle search by Class/TitleIndex */
CHECKPOINT;
/* Loop through each key level and find or build the needed subkey */
Status = STATUS_SUCCESS;
/* FIXME: this access of RootKeyBlock should be guarded by spinlock */
CurKeyBlock = CmiGetKeyBlock(RegistryFile,
RegistryFile->HeaderBlock->RootKeyBlock);
CHECKPOINT;
Remainder = KeyNameBuf;
while (NT_SUCCESS(Status) &&
(NextSlash = wcschr(Remainder, L'\\')) != NULL)
@ -1667,6 +1706,7 @@ CmiCreateKey(IN PREGISTRY_FILE RegistryFile,
CurKeyName[NextSlash - Remainder] = 0;
/* Verify existance of/Create CurKeyName */
CHECKPOINT;
Status = CmiScanForSubKey(RegistryFile,
CurKeyBlock,
&SubKeyBlock,
@ -1695,8 +1735,10 @@ CmiCreateKey(IN PREGISTRY_FILE RegistryFile,
Remainder = NextSlash + 1;
}
CHECKPOINT;
if (NT_SUCCESS(Status))
{
CHECKPOINT;
Status = CmiScanForSubKey(RegistryFile,
CurKeyBlock,
&SubKeyBlock,
@ -1723,7 +1765,10 @@ CmiCreateKey(IN PREGISTRY_FILE RegistryFile,
TitleIndex,
ClassName,
CreateOptions);
ExFreePool(ClassName);
if (ClassName != NULL)
{
ExFreePool(ClassName);
}
if (NT_SUCCESS(Status) && Disposition != NULL)
{
*Disposition = REG_CREATED_NEW_KEY;
@ -2222,8 +2267,9 @@ CmiAllocateKeyBlock(IN PREGISTRY_FILE RegistryFile,
/* Handle volatile files first */
if (RegistryFile->Filename == NULL)
{
NewKeySize = sizeof(KEY_BLOCK) + wcslen(KeyName) + 1 +
(Class != NULL ? wcslen(Class) + 1 : 0);
NewKeySize = sizeof(KEY_BLOCK) +
(wcslen(KeyName) + 1) * sizeof(WCHAR) +
(Class != NULL ? (wcslen(Class) + 1) * sizeof(WCHAR) : 0);
NewKeyBlock = ExAllocatePool(NonPagedPool, NewKeySize);
if (NewKeyBlock == NULL)
{
@ -2385,7 +2431,14 @@ CmiAddKeyToHashTable(PREGISTRY_FILE RegistryFile,
PHASH_TABLE_BLOCK HashBlock,
PKEY_BLOCK NewKeyBlock)
{
UNIMPLEMENTED;
HashBlock->Table[HashBlock->HashTableSize].KeyOffset =
CmiGetBlockOffset(RegistryFile, NewKeyBlock);
RtlCopyMemory(&HashBlock->Table[HashBlock->HashTableSize].HashValue,
NewKeyBlock->Name,
4);
HashBlock->HashTableSize++;
return STATUS_SUCCESS;
}
static NTSTATUS

View file

@ -25,7 +25,7 @@
#include <internal/mmhal.h>
#include <internal/i386/segment.h>
#define NDEBUG
//#define NDEBUG
#include <internal/debug.h>
/* FUNCTIONS ****************************************************************/
@ -106,6 +106,20 @@ void set_breakpoint(unsigned int i, unsigned int addr, unsigned int type,
extern int edata;
extern int end;
static char * INIData =
"[HKEY_LOCAL_MACHINE\HARDWARE]\r\n"
"\r\n"
"[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP]\r\n"
"\r\n"
"[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\AtDisk]\r\n"
"\r\n"
"[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\AtDisk\Controller 0]\r\n"
"Controller Address=dword:000001f0\r\n"
"Controller Interrupt=dword:0000000e\r\n"
"\r\n"
"\r\n"
"\r\n"
"";
asmlinkage void _main(boot_param* _bp)
/*
@ -164,6 +178,7 @@ asmlinkage void _main(boot_param* _bp)
PsInit();
IoInit();
LdrInitModuleManagement();
CmInitializeRegistry();
/*
* Initalize services loaded at boot time

View file

@ -290,7 +290,7 @@ NTSTATUS STDCALL NtAccessCheck(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
IN HANDLE ClientToken,
IN ACCESS_MASK DesiredAccess,
IN PGENERIC_MAPPING GenericMapping,
OUT PRIVILEGE_SET PrivilegeSet,
OUT PPRIVILEGE_SET PrivilegeSet,
OUT PULONG ReturnLength,
OUT PULONG GrantedAccess,
OUT PBOOLEAN AccessStatus)