mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
preliminary implementation of boot hive import. exposes memory problem in registry routines
svn path=/trunk/; revision=2203
This commit is contained in:
parent
5a73b65484
commit
0c52657980
10 changed files with 646 additions and 63 deletions
46
reactos/boot.hiv
Normal file
46
reactos/boot.hiv
Normal file
|
@ -0,0 +1,46 @@
|
|||
REGEDIT4
|
||||
|
||||
[\Registry\Machine\HARDWARE]
|
||||
|
||||
[\Registry\Machine\HARDWARE\DESCRIPTION]
|
||||
|
||||
[\Registry\Machine\HARDWARE\DESCRIPTION\System]
|
||||
|
||||
[\Registry\Machine\HARDWARE\DESCRIPTION\System\MultifunctionAdapter]
|
||||
|
||||
[\Registry\Machine\HARDWARE\DESCRIPTION\System\MultifunctionAdapter\0]
|
||||
"Component Information"=hex:00,00,00,00,00,00,00,00,00,00,00,00,ff,ff,ff,ff
|
||||
"Identifier"="ISA"
|
||||
"Configuration Data"=hex(9):01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
|
||||
|
||||
[\Registry\Machine\HARDWARE\DESCRIPTION\System\MultifunctionAdapter\0\KeyboardController]
|
||||
|
||||
[\Registry\Machine\HARDWARE\DESCRIPTION\System\MultifunctionAdapter\0\KeyboardController\0]
|
||||
"Component Information"=hex:28,00,00,00,00,00,00,00,00,00,00,00,ff,ff,ff,ff
|
||||
"Configuration Data"=hex(9):01,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,01,\
|
||||
01,01,00,60,00,00,00,00,00,00,00,01,00,00,00,01,01,01,00,64,00,00,00,00,00,\
|
||||
00,00,01,00,00,00,02,00,01,00,01,00,00,00,01,00,00,00,ff,ff,ff,ff
|
||||
|
||||
[\Registry\Machine\HARDWARE\DESCRIPTION\System\MultifunctionAdapter\0\KeyboardController\0\KeyboardPeripheral]
|
||||
|
||||
[\Registry\Machine\HARDWARE\DESCRIPTION\System\MultifunctionAdapter\0\KeyboardController\0\KeyboardPeripheral\0]
|
||||
"Component Information"=hex:28,00,00,00,00,00,00,00,00,00,00,00,ff,ff,ff,ff
|
||||
"Identifier"="PCAT_ENHANCED"
|
||||
"Configuration Data"=hex(9):01,00,00,00,00,00,00,00,00,00,00,00,01,00,00,00,05,\
|
||||
00,00,00,08,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,04,00,00,00
|
||||
|
||||
[\Registry\Machine\HARDWARE\DESCRIPTION\System\MultifunctionAdapter\0\PointerController]
|
||||
|
||||
[\Registry\Machine\HARDWARE\DESCRIPTION\System\MultifunctionAdapter\0\PointerController\0]
|
||||
"Component Information"=hex:20,00,00,00,00,00,00,00,00,00,00,00,ff,ff,ff,ff
|
||||
"Configuration Data"=hex(9):01,00,00,00,00,00,00,00,00,00,00,00,01,00,00,00,02,\
|
||||
00,01,00,0c,00,00,00,0c,00,00,00,ff,ff,ff,ff
|
||||
|
||||
[\Registry\Machine\HARDWARE\DESCRIPTION\System\MultifunctionAdapter\0\PointerController\0\PointerPeripheral]
|
||||
|
||||
[\Registry\Machine\HARDWARE\DESCRIPTION\System\MultifunctionAdapter\0\PointerController\0\PointerPeripheral\0]
|
||||
"Component Information"=hex:20,00,00,00,00,00,00,00,00,00,00,00,ff,ff,ff,ff
|
||||
"Identifier"="MICROSOFT PS2 MOUSE"
|
||||
"Configuration Data"=hex(9):01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
|
||||
|
||||
|
|
@ -233,20 +233,36 @@ entry:
|
|||
push di
|
||||
mov dx, di
|
||||
|
||||
; Check if it is a symbol file
|
||||
cmp byte [bx-5],'.'
|
||||
jne .pe_copy
|
||||
cmp byte [bx-4],'s'
|
||||
jne .pe_copy
|
||||
cmp byte [bx-3],'y'
|
||||
jne .pe_copy
|
||||
cmp byte [bx-2],'m'
|
||||
jne .pe_copy
|
||||
; Check if it is a symbol file
|
||||
cmp byte [bx-5],'.'
|
||||
jne .checkForHive
|
||||
cmp byte [bx-4],'s'
|
||||
jne .checkForHive
|
||||
cmp byte [bx-3],'y'
|
||||
jne .checkForHive
|
||||
cmp byte [bx-2],'m'
|
||||
jne .checkForHive
|
||||
|
||||
call sym_load_module
|
||||
jmp .after_copy
|
||||
jmp .after_copy
|
||||
|
||||
.checkForHive:
|
||||
; Check if it is a symbol file
|
||||
cmp byte [bx-5],'.'
|
||||
jne .pe_copy
|
||||
cmp byte [bx-4],'h'
|
||||
jne .pe_copy
|
||||
cmp byte [bx-3],'i'
|
||||
jne .pe_copy
|
||||
cmp byte [bx-2],'v'
|
||||
jne .pe_copy
|
||||
|
||||
call sym_load_module
|
||||
jmp .after_copy
|
||||
|
||||
.pe_copy:
|
||||
call pe_load_module
|
||||
call pe_load_module
|
||||
|
||||
.after_copy:
|
||||
pop di
|
||||
cmp eax, 0
|
||||
|
@ -703,38 +719,40 @@ _current_file_size:
|
|||
;; DS:DX = Filename
|
||||
;;
|
||||
sym_load_module:
|
||||
call load_module1
|
||||
call load_module2
|
||||
mov edi, [next_load_base]
|
||||
add edi, [_current_file_size]
|
||||
call load_module1
|
||||
call load_module2
|
||||
mov edi, [next_load_base]
|
||||
add edi, [_current_file_size]
|
||||
|
||||
mov eax, edi
|
||||
mov eax, edi
|
||||
test di, 0xfff
|
||||
jz .sym_no_round
|
||||
and di, 0xf000
|
||||
add edi, 0x1000
|
||||
|
||||
;;
|
||||
;; Clear unused space in the last page
|
||||
;;
|
||||
mov esi, edi
|
||||
mov ecx, edi
|
||||
sub ecx, eax
|
||||
;;
|
||||
;; Clear unused space in the last page
|
||||
;;
|
||||
mov esi, edi
|
||||
mov ecx, edi
|
||||
sub ecx, eax
|
||||
|
||||
.sym_clear:
|
||||
mov byte [esi],0
|
||||
inc esi
|
||||
loop .sym_clear
|
||||
mov byte [esi],0
|
||||
inc esi
|
||||
loop .sym_clear
|
||||
|
||||
.sym_no_round:
|
||||
|
||||
call load_module3
|
||||
ret
|
||||
call load_module3
|
||||
ret
|
||||
|
||||
;;
|
||||
;; Load a PE file
|
||||
;; DS:DX = Filename
|
||||
;;
|
||||
pe_load_module:
|
||||
call load_module1
|
||||
call load_module1
|
||||
|
||||
;;
|
||||
;; Read in the DOS EXE header
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.50 2001/08/21 20:13:08 chorns Exp $
|
||||
# $Id: Makefile,v 1.51 2001/08/29 05:06:31 rex Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
|
@ -252,6 +252,7 @@ OBJECTS_SE = \
|
|||
|
||||
# Configuration Manager (Registry)
|
||||
OBJECTS_CM = \
|
||||
cm/import.o \
|
||||
cm/registry.o \
|
||||
cm/ntfunc.o \
|
||||
cm/rtlfunc.o \
|
||||
|
|
|
@ -2,16 +2,30 @@
|
|||
#ifndef __INCLUDE_CM_H
|
||||
#define __INCLUDE_CM_H
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/config.h>
|
||||
#include <internal/ob.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <internal/pool.h>
|
||||
#include <internal/registry.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 NDEBUG
|
||||
#include <internal/debug.h>
|
||||
#define REGISTRY_FILE_MAGIC "REGEDIT4"
|
||||
|
||||
#define REG_MACHINE_STD_HANDLE_NAME "HKEY_LOCAL_MACHINE"
|
||||
#define REG_CLASSES_STD_HANDLE_NAME "HKEY_CLASSES_ROOT"
|
||||
#define REG_USERS_STD_HANDLE_NAME "HKEY_USERS"
|
||||
#define REG_USER_STD_HANDLE_NAME "HKEY_CURRENT_USER"
|
||||
#define REG_CONFIG_STD_HANDLE_NAME "HKEY_CURRENT_CONFIG"
|
||||
#define REG_DYN_STD_HANDLE_NAME "HKEY_DYN_DATA"
|
||||
#define MAX_REG_STD_HANDLE_NAME 19
|
||||
|
||||
#define KO_MARKED_FOR_DELETE 0x00000001
|
||||
|
||||
|
@ -261,4 +275,4 @@ NTSTATUS
|
|||
CmiAddFree(PREGISTRY_FILE RegistryFile,
|
||||
PFREE_SUB_BLOCK FreeBlock,BLOCK_OFFSET FreeOffset);
|
||||
|
||||
#endif /*__INCLUDE_CM_H*/
|
||||
#endif /*__INCLUDE_CM_H*/
|
||||
|
|
469
reactos/ntoskrnl/cm/import.c
Normal file
469
reactos/ntoskrnl/cm/import.c
Normal file
|
@ -0,0 +1,469 @@
|
|||
/* $Id: import.c,v 1.1 2001/08/29 05:06:31 rex Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/cm/import.c
|
||||
* PURPOSE: Registry functions
|
||||
* PROGRAMMERS: Rex Jolliff
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/config.h>
|
||||
#include <internal/ob.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <internal/pool.h>
|
||||
#include <internal/registry.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#include "cm.h"
|
||||
|
||||
static PCHAR
|
||||
checkAndSkipMagic (PCHAR regChunk)
|
||||
{
|
||||
if (strncmp (regChunk,
|
||||
REGISTRY_FILE_MAGIC,
|
||||
strlen (REGISTRY_FILE_MAGIC)) != 0)
|
||||
{
|
||||
CPRINT ("incorrect magic number in registry chunk. expected: %s got:%.*s\n",
|
||||
REGISTRY_FILE_MAGIC,
|
||||
strlen (REGISTRY_FILE_MAGIC),
|
||||
regChunk);
|
||||
return 0;
|
||||
}
|
||||
regChunk += strlen (REGISTRY_FILE_MAGIC);
|
||||
DPRINT ("Found regsitry chunk magic value\n");
|
||||
|
||||
return regChunk;
|
||||
}
|
||||
|
||||
static PCHAR
|
||||
skipWhitespaceInChunk (PCHAR regChunk)
|
||||
{
|
||||
while (*regChunk && isspace (*regChunk))
|
||||
regChunk++;
|
||||
|
||||
return *regChunk ? regChunk : 0;
|
||||
}
|
||||
|
||||
static int
|
||||
computeKeyNameSize (PCHAR regChunk)
|
||||
{
|
||||
int copyCount = 0;
|
||||
|
||||
while (*regChunk != 0 && *regChunk != ']')
|
||||
{
|
||||
copyCount++;
|
||||
regChunk++;
|
||||
}
|
||||
|
||||
return copyCount;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
allocateKeyName (PUNICODE_STRING newKeyName, int newKeySize)
|
||||
{
|
||||
if (newKeyName->MaximumLength < (newKeySize + 1) * sizeof (WCHAR))
|
||||
{
|
||||
if (newKeyName->Buffer != 0)
|
||||
ExFreePool (newKeyName->Buffer);
|
||||
newKeyName->Length = 0;
|
||||
newKeyName->MaximumLength = (newKeySize + 1) * sizeof (WCHAR);
|
||||
newKeyName->Buffer = ExAllocatePool (NonPagedPool, newKeyName->MaximumLength);
|
||||
if (newKeyName->Buffer == 0)
|
||||
{
|
||||
CPRINT ("Could not allocate space for key name\n");
|
||||
return FALSE;
|
||||
}
|
||||
newKeyName->Buffer [0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
newKeyName->Length = 0;
|
||||
newKeyName->Buffer [0] = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static PCHAR
|
||||
skipToNextKeyInChunk (PCHAR regChunk)
|
||||
{
|
||||
while (*regChunk != 0 && *regChunk != '[')
|
||||
{
|
||||
while (*regChunk != 0 && *regChunk != '\n')
|
||||
{
|
||||
regChunk++;
|
||||
}
|
||||
regChunk++;
|
||||
}
|
||||
|
||||
return *regChunk ? regChunk : 0;
|
||||
}
|
||||
|
||||
static PCHAR
|
||||
getKeyNameFromChunk (PCHAR regChunk, PUNICODE_STRING newKeyName)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
while (*regChunk != 0 && *regChunk != ']')
|
||||
{
|
||||
newKeyName->Buffer [index++] = *regChunk++;
|
||||
}
|
||||
newKeyName->Buffer [index] = '\0';
|
||||
newKeyName->Length = index * sizeof (WCHAR);
|
||||
|
||||
return *regChunk ? regChunk : 0;
|
||||
}
|
||||
|
||||
static HANDLE
|
||||
createNewKey (PUNICODE_STRING newKeyName)
|
||||
{
|
||||
NTSTATUS status;
|
||||
OBJECT_ATTRIBUTES attributes;
|
||||
HANDLE handleToReturn;
|
||||
|
||||
DPRINT ("Creating key (%wZ)\n", newKeyName);
|
||||
InitializeObjectAttributes (&attributes,
|
||||
newKeyName,
|
||||
0,
|
||||
0,
|
||||
NULL);
|
||||
status = NtCreateKey (&handleToReturn,
|
||||
KEY_ALL_ACCESS,
|
||||
&attributes,
|
||||
0,
|
||||
NULL,
|
||||
REG_OPTION_VOLATILE,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
CPRINT ("Could not crete key (%wZ)\n", newKeyName);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
return handleToReturn;
|
||||
}
|
||||
|
||||
static PCHAR
|
||||
skipToNextKeyValueInChunk (PCHAR regChunk)
|
||||
{
|
||||
while (*regChunk != 0 && *regChunk != '\n')
|
||||
regChunk++;
|
||||
regChunk = skipWhitespaceInChunk (regChunk);
|
||||
|
||||
return regChunk;
|
||||
}
|
||||
|
||||
static int
|
||||
computeKeyValueNameSize (PCHAR regChunk)
|
||||
{
|
||||
int size = 0;
|
||||
|
||||
if (*regChunk != '\"')
|
||||
return 0;
|
||||
regChunk++;
|
||||
while (*regChunk != 0 && *regChunk != '\"')
|
||||
{
|
||||
size++;
|
||||
regChunk++;
|
||||
}
|
||||
|
||||
return regChunk ? size : 0;
|
||||
}
|
||||
|
||||
static PCHAR
|
||||
getKeyValueNameFromChunk (PCHAR regChunk, PUNICODE_STRING newKeyName)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
regChunk++;
|
||||
while (*regChunk != 0 && *regChunk != '\"')
|
||||
{
|
||||
newKeyName->Buffer [index++] = *regChunk++;
|
||||
}
|
||||
newKeyName->Buffer [index] = '\0';
|
||||
newKeyName->Length = index * sizeof (WCHAR);
|
||||
regChunk++;
|
||||
|
||||
return *regChunk ? regChunk : 0;
|
||||
}
|
||||
|
||||
static PCHAR
|
||||
getKeyValueTypeFromChunk (PCHAR regChunk, PCHAR dataFormat, int *keyValueType)
|
||||
{
|
||||
if (*regChunk == '\"')
|
||||
{
|
||||
strcpy (dataFormat, "string");
|
||||
*keyValueType = REG_SZ;
|
||||
}
|
||||
else if (strncmp (regChunk, "hex", 3) == 0)
|
||||
{
|
||||
strcpy (dataFormat, "hex");
|
||||
regChunk += 3;
|
||||
if (*regChunk == '(')
|
||||
{
|
||||
regChunk++;
|
||||
*keyValueType = atoi (regChunk);
|
||||
while (*regChunk != 0 && *regChunk != ')')
|
||||
regChunk++;
|
||||
regChunk++;
|
||||
}
|
||||
else
|
||||
*keyValueType = REG_BINARY;
|
||||
if (*regChunk == ':')
|
||||
regChunk++;
|
||||
}
|
||||
else
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
return *regChunk ? regChunk : 0;
|
||||
}
|
||||
|
||||
static int
|
||||
computeKeyValueDataSize (PCHAR regChunk, PCHAR dataFormat)
|
||||
{
|
||||
int dataSize = 0;
|
||||
|
||||
if (strcmp (dataFormat, "string") == 0)
|
||||
{
|
||||
regChunk++;
|
||||
while (*regChunk != 0 && *regChunk != '\"')
|
||||
{
|
||||
dataSize++;
|
||||
regChunk++;
|
||||
}
|
||||
}
|
||||
else if (strcmp (dataFormat, "hex") == 0)
|
||||
{
|
||||
while (*regChunk != 0 && isxdigit(*regChunk))
|
||||
{
|
||||
regChunk++;
|
||||
regChunk++;
|
||||
dataSize++;
|
||||
if (*regChunk == ',')
|
||||
{
|
||||
regChunk++;
|
||||
if (*regChunk == '\\')
|
||||
{
|
||||
regChunk = skipWhitespaceInChunk (regChunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
return dataSize;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
allocateDataBuffer (PVOID * data, int * dataBufferSize, int dataSize)
|
||||
{
|
||||
if (*dataBufferSize < dataSize)
|
||||
{
|
||||
if (*dataBufferSize > 0)
|
||||
ExFreePool (*data);
|
||||
*data = ExAllocatePool (NonPagedPool, dataSize);
|
||||
*dataBufferSize = dataSize;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static PCHAR
|
||||
getKeyValueDataFromChunk (PCHAR regChunk, PCHAR dataFormat, PCHAR data)
|
||||
{
|
||||
char dataValue;
|
||||
|
||||
if (strcmp (dataFormat, "string") == 0)
|
||||
{
|
||||
regChunk++;
|
||||
while (*regChunk != 0 && *regChunk != '\"')
|
||||
{
|
||||
*data++ = *regChunk++;
|
||||
}
|
||||
}
|
||||
else if (strcmp (dataFormat, "hex") == 0)
|
||||
{
|
||||
while (*regChunk != 0 && isxdigit (*regChunk))
|
||||
{
|
||||
dataValue = (isdigit (*regChunk) ? *regChunk - '0' :
|
||||
tolower(*regChunk) - 'a') << 4;
|
||||
regChunk++;
|
||||
dataValue += (isdigit (*regChunk) ? *regChunk - '0' :
|
||||
tolower(*regChunk) - 'a');
|
||||
regChunk++;
|
||||
*data++ = dataValue;
|
||||
if (*regChunk == ',')
|
||||
{
|
||||
regChunk++;
|
||||
if (*regChunk == '\\')
|
||||
{
|
||||
regChunk = skipWhitespaceInChunk (regChunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
return *regChunk ? regChunk : 0;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
setKeyValue (HANDLE currentKey,
|
||||
PUNICODE_STRING newValueName,
|
||||
ULONG keyValueType,
|
||||
PVOID data,
|
||||
ULONG dataSize)
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
||||
DPRINT ("Adding value (%wZ) to current key, with data type %d size %d\n",
|
||||
newValueName,
|
||||
keyValueType,
|
||||
dataSize);
|
||||
status = NtSetValueKey (currentKey,
|
||||
newValueName,
|
||||
0,
|
||||
keyValueType,
|
||||
data,
|
||||
dataSize);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
CPRINT ("could not set key value, rc:%08x\n", status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID
|
||||
CmImportHive(PCHAR regChunk)
|
||||
{
|
||||
HANDLE currentKey = INVALID_HANDLE_VALUE;
|
||||
int newKeySize;
|
||||
UNICODE_STRING newKeyName = {0, 0, 0};
|
||||
char dataFormat [10];
|
||||
int keyValueType;
|
||||
int dataSize = 0;
|
||||
int dataBufferSize = 0;
|
||||
PVOID data = 0;
|
||||
|
||||
regChunk = checkAndSkipMagic (regChunk);
|
||||
if (regChunk == 0)
|
||||
return;
|
||||
|
||||
while (regChunk != 0 && *regChunk != 0)
|
||||
{
|
||||
regChunk = skipWhitespaceInChunk (regChunk);
|
||||
if (regChunk == 0)
|
||||
continue;
|
||||
|
||||
if (*regChunk == '[')
|
||||
{
|
||||
if (currentKey != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
NtClose (currentKey);
|
||||
currentKey = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
regChunk++;
|
||||
|
||||
newKeySize = computeKeyNameSize (regChunk);
|
||||
if (!allocateKeyName (&newKeyName, newKeySize))
|
||||
{
|
||||
regChunk = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
regChunk = getKeyNameFromChunk (regChunk, &newKeyName);
|
||||
if (regChunk == 0)
|
||||
continue;
|
||||
|
||||
currentKey = createNewKey (&newKeyName);
|
||||
if (currentKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
regChunk = skipToNextKeyInChunk (regChunk);
|
||||
continue;
|
||||
}
|
||||
|
||||
regChunk++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentKey == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
regChunk = skipToNextKeyInChunk (regChunk);
|
||||
continue;
|
||||
}
|
||||
|
||||
newKeySize = computeKeyValueNameSize (regChunk);
|
||||
if (!allocateKeyName (&newKeyName, newKeySize))
|
||||
{
|
||||
regChunk = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
regChunk = getKeyValueNameFromChunk (regChunk, &newKeyName);
|
||||
if (regChunk == 0)
|
||||
continue;
|
||||
|
||||
if (*regChunk != '=')
|
||||
{
|
||||
regChunk = skipToNextKeyValueInChunk (regChunk);
|
||||
continue;
|
||||
}
|
||||
regChunk++;
|
||||
|
||||
regChunk = getKeyValueTypeFromChunk (regChunk, dataFormat, &keyValueType);
|
||||
if (regChunk == 0)
|
||||
continue;
|
||||
|
||||
dataSize = computeKeyValueDataSize (regChunk, dataFormat);
|
||||
if (!allocateDataBuffer (&data, &dataBufferSize, dataSize))
|
||||
{
|
||||
regChunk = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
regChunk = getKeyValueDataFromChunk (regChunk, dataFormat, data);
|
||||
if (regChunk == 0)
|
||||
continue;
|
||||
|
||||
if (!setKeyValue (currentKey, &newKeyName, keyValueType, data, dataSize))
|
||||
{
|
||||
regChunk = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (currentKey != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
NtClose (currentKey);
|
||||
}
|
||||
if (newKeyName.Buffer != 0)
|
||||
{
|
||||
ExFreePool (newKeyName.Buffer);
|
||||
}
|
||||
if (data != 0)
|
||||
{
|
||||
ExFreePool (data);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -6,6 +6,17 @@
|
|||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/config.h>
|
||||
#include <internal/ob.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <internal/pool.h>
|
||||
#include <internal/registry.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#include "cm.h"
|
||||
|
||||
extern POBJECT_TYPE CmiKeyType;
|
||||
|
@ -31,6 +42,9 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
|||
// DPRINT("NtCreateKey (Name %wZ),KeyHandle=%x,Root=%x\n",
|
||||
// ObjectAttributes->ObjectName,KeyHandle
|
||||
// ,ObjectAttributes->RootDirectory);
|
||||
|
||||
/*FIXME: check for standard handle prefix and adjust objectAttributes accordingly */
|
||||
|
||||
Status = ObFindObject(ObjectAttributes,&Object,&RemainingPath,CmiKeyType);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
|
|
@ -6,6 +6,17 @@
|
|||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/config.h>
|
||||
#include <internal/ob.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <internal/pool.h>
|
||||
#include <internal/registry.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#include "cm.h"
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: registry.c,v 1.62 2001/06/16 14:06:00 ekohl Exp $
|
||||
/* $Id: registry.c,v 1.63 2001/08/29 05:06:31 rex Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -11,24 +11,19 @@
|
|||
* Created 22/05/98
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/config.h>
|
||||
#include <internal/ob.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <internal/pool.h>
|
||||
#include <internal/registry.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#include "cm.h"
|
||||
|
||||
#define REG_ROOT_KEY_NAME L"\\Registry"
|
||||
#define REG_MACHINE_KEY_NAME L"\\Registry\\Machine"
|
||||
#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"
|
||||
|
||||
|
||||
/* ------------------------------------------------- File Statics */
|
||||
|
||||
POBJECT_TYPE CmiKeyType = NULL;
|
||||
|
@ -263,13 +258,6 @@ __asm__ ("hlt\n\t");
|
|||
*/
|
||||
}
|
||||
|
||||
VOID
|
||||
CmImportHive(PCHAR Chunk)
|
||||
{
|
||||
/* FIXME: implemement this */
|
||||
return;
|
||||
}
|
||||
|
||||
VOID
|
||||
CmShutdownRegistry(VOID)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,17 @@
|
|||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/config.h>
|
||||
#include <internal/ob.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <internal/pool.h>
|
||||
#include <internal/registry.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#include "cm.h"
|
||||
|
||||
extern POBJECT_TYPE CmiKeyType;
|
||||
|
|
|
@ -6,6 +6,17 @@
|
|||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/config.h>
|
||||
#include <internal/ob.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <internal/pool.h>
|
||||
#include <internal/registry.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#include "cm.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
|
|
Loading…
Reference in a new issue