//#define NDEBUG
#include <internal/debug.h>
-#define PROTO_REG 1 /* Comment out to disable */
+/* #define PROTO_REG 1 /* Comment out to disable */
/* ----------------------------------------------------- Typedefs */
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));
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
/* 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)
CurKeyName[NextSlash - Remainder] = 0;
/* Verify existance of/Create CurKeyName */
+CHECKPOINT;
Status = CmiScanForSubKey(RegistryFile,
CurKeyBlock,
&SubKeyBlock,
Remainder = NextSlash + 1;
}
+CHECKPOINT;
if (NT_SUCCESS(Status))
{
+CHECKPOINT;
Status = CmiScanForSubKey(RegistryFile,
CurKeyBlock,
&SubKeyBlock,
TitleIndex,
ClassName,
CreateOptions);
- ExFreePool(ClassName);
+ if (ClassName != NULL)
+ {
+ ExFreePool(ClassName);
+ }
if (NT_SUCCESS(Status) && Disposition != NULL)
{
*Disposition = REG_CREATED_NEW_KEY;
/* 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)
{
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
#include <internal/mmhal.h>
#include <internal/i386/segment.h>
-#define NDEBUG
+//#define NDEBUG
#include <internal/debug.h>
/* FUNCTIONS ****************************************************************/
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)
/*
PsInit();
IoInit();
LdrInitModuleManagement();
+ CmInitializeRegistry();
/*
* Initalize services loaded at boot time