mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed mysterious registry bug
svn path=/trunk/; revision=1329
This commit is contained in:
parent
df314ce26e
commit
3004e5b9bd
1 changed files with 45 additions and 41 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: registry.c,v 1.25 2000/08/11 12:39:25 ekohl Exp $
|
||||
/* $Id: registry.c,v 1.26 2000/09/03 14:46:49 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -19,7 +19,7 @@
|
|||
//#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
//#define PROTO_REG 1 /* Comment out to disable */
|
||||
#define PROTO_REG 1 /* Comment out to disable */
|
||||
|
||||
/* ----------------------------------------------------- Typedefs */
|
||||
|
||||
|
@ -176,11 +176,11 @@ static PREGISTRY_FILE CmiSystemFile = NULL;
|
|||
/* ----------------------------------------- Forward Declarations */
|
||||
|
||||
#if PROTO_REG
|
||||
//static PVOID CmiObjectParse(PVOID ParsedObject, PWSTR *Path);
|
||||
static NTSTATUS CmiObjectParse(PVOID ParsedObject,
|
||||
PVOID *NextObject,
|
||||
PUNICODE_STRING FullPath,
|
||||
PWSTR *Path);
|
||||
PWSTR *Path,
|
||||
POBJECT_TYPE ObjectType);
|
||||
|
||||
static VOID CmiObjectDelete(PVOID DeletedObject);
|
||||
static NTSTATUS CmiBuildKeyPath(PWSTR *KeyPath,
|
||||
|
@ -330,16 +330,13 @@ CmInitializeRegistry(VOID)
|
|||
KeInitializeSpinLock(&CmiKeyListLock);
|
||||
|
||||
/* Build volitile registry store */
|
||||
CHECKPOINT;
|
||||
CmiVolatileFile = CmiCreateRegistry(NULL);
|
||||
|
||||
/* Build system registry store */
|
||||
CHECKPOINT;
|
||||
CmiSystemFile = NULL; // CmiCreateRegistry(SYSTEM_REG_FILE);
|
||||
|
||||
/* Create initial predefined symbolic links */
|
||||
/* HKEY_LOCAL_MACHINE */
|
||||
CHECKPOINT;
|
||||
Status = CmiCreateKey(CmiVolatileFile,
|
||||
L"Machine",
|
||||
&KeyBlock,
|
||||
|
@ -352,11 +349,9 @@ CHECKPOINT;
|
|||
{
|
||||
return;
|
||||
}
|
||||
CHECKPOINT;
|
||||
CmiReleaseBlock(CmiVolatileFile, KeyBlock);
|
||||
|
||||
/* HKEY_USERS */
|
||||
CHECKPOINT;
|
||||
Status = CmiCreateKey(CmiVolatileFile,
|
||||
L"Users",
|
||||
&KeyBlock,
|
||||
|
@ -1361,12 +1356,11 @@ RtlWriteRegistryValue (
|
|||
|
||||
|
||||
#if PROTO_REG
|
||||
//static PVOID
|
||||
//CmiObjectParse(PVOID ParsedObject, PWSTR *Path)
|
||||
static NTSTATUS CmiObjectParse(PVOID ParsedObject,
|
||||
PVOID *NextObject,
|
||||
PUNICODE_STRING FullPath,
|
||||
PWSTR *Path)
|
||||
PWSTR *Path,
|
||||
POBJECT_TYPE ObjectType)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
/* FIXME: this should be allocated based on the largest subkey name */
|
||||
|
@ -1768,7 +1762,6 @@ CHECKPOINT;
|
|||
CurKeyName[NextSlash - Remainder] = 0;
|
||||
|
||||
/* Verify existance of/Create CurKeyName */
|
||||
CHECKPOINT;
|
||||
Status = CmiScanForSubKey(RegistryFile,
|
||||
CurKeyBlock,
|
||||
&SubKeyBlock,
|
||||
|
@ -1797,10 +1790,8 @@ CHECKPOINT;
|
|||
|
||||
Remainder = NextSlash + 1;
|
||||
}
|
||||
CHECKPOINT;
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
CHECKPOINT;
|
||||
Status = CmiScanForSubKey(RegistryFile,
|
||||
CurKeyBlock,
|
||||
&SubKeyBlock,
|
||||
|
@ -1818,7 +1809,7 @@ CHECKPOINT;
|
|||
}
|
||||
else
|
||||
{
|
||||
ClassName = 0;
|
||||
ClassName = NULL;
|
||||
}
|
||||
Status = CmiAddSubKey(RegistryFile,
|
||||
CurKeyBlock,
|
||||
|
@ -2324,6 +2315,9 @@ CmiAllocateKeyBlock(IN PREGISTRY_FILE RegistryFile,
|
|||
ULONG NewKeySize;
|
||||
PKEY_BLOCK NewKeyBlock;
|
||||
|
||||
DPRINT("RegistryFile %p KeyBlock %p KeyName %S TitleIndex %x Class %S CreateOptions %x\n",
|
||||
RegistryFile, KeyBlock, KeyName, TitleIndex, Class,CreateOptions);
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
/* Handle volatile files first */
|
||||
|
@ -2332,7 +2326,10 @@ CmiAllocateKeyBlock(IN PREGISTRY_FILE RegistryFile,
|
|||
NewKeySize = sizeof(KEY_BLOCK) +
|
||||
(wcslen(KeyName) + 1) * sizeof(WCHAR) +
|
||||
(Class != NULL ? (wcslen(Class) + 1) * sizeof(WCHAR) : 0);
|
||||
DPRINT ("NewKeySize: %lu\n", NewKeySize);
|
||||
//CHECKPOINT;
|
||||
NewKeyBlock = ExAllocatePool(NonPagedPool, NewKeySize);
|
||||
//CHECKPOINT;
|
||||
if (NewKeyBlock == NULL)
|
||||
{
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -2493,14 +2490,21 @@ CmiAddKeyToHashTable(PREGISTRY_FILE RegistryFile,
|
|||
PHASH_TABLE_BLOCK HashBlock,
|
||||
PKEY_BLOCK NewKeyBlock)
|
||||
{
|
||||
HashBlock->Table[HashBlock->HashTableSize].KeyOffset =
|
||||
ULONG i;
|
||||
|
||||
for (i = 0; i < HashBlock->HashTableSize; i++)
|
||||
{
|
||||
if (HashBlock->Table[i].KeyOffset == 0)
|
||||
{
|
||||
HashBlock->Table[i].KeyOffset =
|
||||
CmiGetBlockOffset(RegistryFile, NewKeyBlock);
|
||||
RtlCopyMemory(&HashBlock->Table[HashBlock->HashTableSize].HashValue,
|
||||
RtlCopyMemory(&HashBlock->Table[i].HashValue,
|
||||
NewKeyBlock->Name,
|
||||
4);
|
||||
HashBlock->HashTableSize++;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
|
|
Loading…
Reference in a new issue