mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 20:03:07 +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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
//#define NDEBUG
|
//#define NDEBUG
|
||||||
#include <internal/debug.h>
|
#include <internal/debug.h>
|
||||||
|
|
||||||
//#define PROTO_REG 1 /* Comment out to disable */
|
#define PROTO_REG 1 /* Comment out to disable */
|
||||||
|
|
||||||
/* ----------------------------------------------------- Typedefs */
|
/* ----------------------------------------------------- Typedefs */
|
||||||
|
|
||||||
|
@ -176,11 +176,11 @@ static PREGISTRY_FILE CmiSystemFile = NULL;
|
||||||
/* ----------------------------------------- Forward Declarations */
|
/* ----------------------------------------- Forward Declarations */
|
||||||
|
|
||||||
#if PROTO_REG
|
#if PROTO_REG
|
||||||
//static PVOID CmiObjectParse(PVOID ParsedObject, PWSTR *Path);
|
|
||||||
static NTSTATUS CmiObjectParse(PVOID ParsedObject,
|
static NTSTATUS CmiObjectParse(PVOID ParsedObject,
|
||||||
PVOID *NextObject,
|
PVOID *NextObject,
|
||||||
PUNICODE_STRING FullPath,
|
PUNICODE_STRING FullPath,
|
||||||
PWSTR *Path);
|
PWSTR *Path,
|
||||||
|
POBJECT_TYPE ObjectType);
|
||||||
|
|
||||||
static VOID CmiObjectDelete(PVOID DeletedObject);
|
static VOID CmiObjectDelete(PVOID DeletedObject);
|
||||||
static NTSTATUS CmiBuildKeyPath(PWSTR *KeyPath,
|
static NTSTATUS CmiBuildKeyPath(PWSTR *KeyPath,
|
||||||
|
@ -330,16 +330,13 @@ CmInitializeRegistry(VOID)
|
||||||
KeInitializeSpinLock(&CmiKeyListLock);
|
KeInitializeSpinLock(&CmiKeyListLock);
|
||||||
|
|
||||||
/* Build volitile registry store */
|
/* Build volitile registry store */
|
||||||
CHECKPOINT;
|
|
||||||
CmiVolatileFile = CmiCreateRegistry(NULL);
|
CmiVolatileFile = CmiCreateRegistry(NULL);
|
||||||
|
|
||||||
/* Build system registry store */
|
/* Build system registry store */
|
||||||
CHECKPOINT;
|
|
||||||
CmiSystemFile = NULL; // CmiCreateRegistry(SYSTEM_REG_FILE);
|
CmiSystemFile = NULL; // CmiCreateRegistry(SYSTEM_REG_FILE);
|
||||||
|
|
||||||
/* Create initial predefined symbolic links */
|
/* Create initial predefined symbolic links */
|
||||||
/* HKEY_LOCAL_MACHINE */
|
/* HKEY_LOCAL_MACHINE */
|
||||||
CHECKPOINT;
|
|
||||||
Status = CmiCreateKey(CmiVolatileFile,
|
Status = CmiCreateKey(CmiVolatileFile,
|
||||||
L"Machine",
|
L"Machine",
|
||||||
&KeyBlock,
|
&KeyBlock,
|
||||||
|
@ -352,11 +349,9 @@ CHECKPOINT;
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CHECKPOINT;
|
|
||||||
CmiReleaseBlock(CmiVolatileFile, KeyBlock);
|
CmiReleaseBlock(CmiVolatileFile, KeyBlock);
|
||||||
|
|
||||||
/* HKEY_USERS */
|
/* HKEY_USERS */
|
||||||
CHECKPOINT;
|
|
||||||
Status = CmiCreateKey(CmiVolatileFile,
|
Status = CmiCreateKey(CmiVolatileFile,
|
||||||
L"Users",
|
L"Users",
|
||||||
&KeyBlock,
|
&KeyBlock,
|
||||||
|
@ -1361,12 +1356,11 @@ RtlWriteRegistryValue (
|
||||||
|
|
||||||
|
|
||||||
#if PROTO_REG
|
#if PROTO_REG
|
||||||
//static PVOID
|
|
||||||
//CmiObjectParse(PVOID ParsedObject, PWSTR *Path)
|
|
||||||
static NTSTATUS CmiObjectParse(PVOID ParsedObject,
|
static NTSTATUS CmiObjectParse(PVOID ParsedObject,
|
||||||
PVOID *NextObject,
|
PVOID *NextObject,
|
||||||
PUNICODE_STRING FullPath,
|
PUNICODE_STRING FullPath,
|
||||||
PWSTR *Path)
|
PWSTR *Path,
|
||||||
|
POBJECT_TYPE ObjectType)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
/* FIXME: this should be allocated based on the largest subkey name */
|
/* FIXME: this should be allocated based on the largest subkey name */
|
||||||
|
@ -1768,7 +1762,6 @@ CHECKPOINT;
|
||||||
CurKeyName[NextSlash - Remainder] = 0;
|
CurKeyName[NextSlash - Remainder] = 0;
|
||||||
|
|
||||||
/* Verify existance of/Create CurKeyName */
|
/* Verify existance of/Create CurKeyName */
|
||||||
CHECKPOINT;
|
|
||||||
Status = CmiScanForSubKey(RegistryFile,
|
Status = CmiScanForSubKey(RegistryFile,
|
||||||
CurKeyBlock,
|
CurKeyBlock,
|
||||||
&SubKeyBlock,
|
&SubKeyBlock,
|
||||||
|
@ -1797,10 +1790,8 @@ CHECKPOINT;
|
||||||
|
|
||||||
Remainder = NextSlash + 1;
|
Remainder = NextSlash + 1;
|
||||||
}
|
}
|
||||||
CHECKPOINT;
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
CHECKPOINT;
|
|
||||||
Status = CmiScanForSubKey(RegistryFile,
|
Status = CmiScanForSubKey(RegistryFile,
|
||||||
CurKeyBlock,
|
CurKeyBlock,
|
||||||
&SubKeyBlock,
|
&SubKeyBlock,
|
||||||
|
@ -1818,7 +1809,7 @@ CHECKPOINT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClassName = 0;
|
ClassName = NULL;
|
||||||
}
|
}
|
||||||
Status = CmiAddSubKey(RegistryFile,
|
Status = CmiAddSubKey(RegistryFile,
|
||||||
CurKeyBlock,
|
CurKeyBlock,
|
||||||
|
@ -2324,6 +2315,9 @@ CmiAllocateKeyBlock(IN PREGISTRY_FILE RegistryFile,
|
||||||
ULONG NewKeySize;
|
ULONG NewKeySize;
|
||||||
PKEY_BLOCK NewKeyBlock;
|
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;
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
/* Handle volatile files first */
|
/* Handle volatile files first */
|
||||||
|
@ -2332,7 +2326,10 @@ CmiAllocateKeyBlock(IN PREGISTRY_FILE RegistryFile,
|
||||||
NewKeySize = sizeof(KEY_BLOCK) +
|
NewKeySize = sizeof(KEY_BLOCK) +
|
||||||
(wcslen(KeyName) + 1) * sizeof(WCHAR) +
|
(wcslen(KeyName) + 1) * sizeof(WCHAR) +
|
||||||
(Class != NULL ? (wcslen(Class) + 1) * sizeof(WCHAR) : 0);
|
(Class != NULL ? (wcslen(Class) + 1) * sizeof(WCHAR) : 0);
|
||||||
|
DPRINT ("NewKeySize: %lu\n", NewKeySize);
|
||||||
|
//CHECKPOINT;
|
||||||
NewKeyBlock = ExAllocatePool(NonPagedPool, NewKeySize);
|
NewKeyBlock = ExAllocatePool(NonPagedPool, NewKeySize);
|
||||||
|
//CHECKPOINT;
|
||||||
if (NewKeyBlock == NULL)
|
if (NewKeyBlock == NULL)
|
||||||
{
|
{
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
@ -2493,15 +2490,22 @@ CmiAddKeyToHashTable(PREGISTRY_FILE RegistryFile,
|
||||||
PHASH_TABLE_BLOCK HashBlock,
|
PHASH_TABLE_BLOCK HashBlock,
|
||||||
PKEY_BLOCK NewKeyBlock)
|
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);
|
CmiGetBlockOffset(RegistryFile, NewKeyBlock);
|
||||||
RtlCopyMemory(&HashBlock->Table[HashBlock->HashTableSize].HashValue,
|
RtlCopyMemory(&HashBlock->Table[i].HashValue,
|
||||||
NewKeyBlock->Name,
|
NewKeyBlock->Name,
|
||||||
4);
|
4);
|
||||||
HashBlock->HashTableSize++;
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
CmiDestroyHashTableBlock(PREGISTRY_FILE RegistryFile,
|
CmiDestroyHashTableBlock(PREGISTRY_FILE RegistryFile,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue