Added mapping of access rights

Removed user-mode types

svn path=/trunk/; revision=1580
This commit is contained in:
Eric Kohl 2001-01-28 21:37:37 +00:00
parent c06ef435fb
commit 17b93d7d9b
5 changed files with 148 additions and 209 deletions

View file

@ -1,72 +0,0 @@
// registry key structures
typedef struct _KEY_BASIC_INFORMATION {
LARGE_INTEGER LastWriteTime;
ULONG TitleIndex;
ULONG NameLength;
WCHAR Name[1]; // variable size
} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
typedef struct _KEY_NODE_INFORMATION {
LARGE_INTEGER LastWriteTime;
ULONG TitleIndex;
ULONG ClassOffset;
ULONG ClassLength;
ULONG NameLength;
WCHAR Name[1]; // variable size
} KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
typedef struct _KEY_FULL_INFORMATION {
LARGE_INTEGER LastWriteTime;
ULONG TitleIndex;
ULONG ClassOffset;
ULONG ClassLength;
ULONG SubKeys;
ULONG MaxNameLen;
ULONG MaxClassLen;
ULONG Values;
ULONG MaxValueNameLen;
ULONG MaxValueDataLen;
WCHAR Class[1]; // variable size
} KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
typedef struct _KEY_WRITE_TIME_INFORMATION {
LARGE_INTEGER LastWriteTime;
} KEY_WRITE_TIME_INFORMATION, *PKEY_WRITE_TIME_INFORMATION;
// key query value structures
typedef struct _KEY_VALUE_BASIC_INFORMATION {
ULONG TitleIndex;
ULONG Type;
ULONG NameLength;
WCHAR Name[1]; // variable size
} KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
typedef struct _KEY_VALUE_FULL_INFORMATION {
ULONG TitleIndex;
ULONG Type;
ULONG DataOffset;
ULONG DataLength;
ULONG NameLength;
WCHAR Name[1]; // variable size
} KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
typedef struct _KEY_VALUE_PARTIAL_INFORMATION {
ULONG TitleIndex;
ULONG Type;
ULONG DataLength;
UCHAR Data[1]; // variable size
} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
typedef struct _KEY_VALUE_ENTRY {
PUNICODE_STRING ValueName;
ULONG DataLength;
ULONG DataOffset;
ULONG Type;
} KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;

View file

@ -1,4 +1,4 @@
/* $Id: ntddk.h,v 1.17 2001/01/08 02:14:05 dwelch Exp $ /* $Id: ntddk.h,v 1.18 2001/01/28 21:36:05 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -27,6 +27,7 @@ extern "C"
#include <ntos/types.h> #include <ntos/types.h>
#include <ntos/disk.h> #include <ntos/disk.h>
#include <ntos/registry.h>
#include <napi/types.h> #include <napi/types.h>
#include <pe.h> #include <pe.h>
@ -35,7 +36,6 @@ extern "C"
#include <ddk/ntdef.h> #include <ddk/ntdef.h>
#include <ddk/defines.h> #include <ddk/defines.h>
#include <ddk/types.h> #include <ddk/types.h>
// #include <ddk/cfgtypes.h>
#include <ddk/cmtypes.h> #include <ddk/cmtypes.h>
#include <ddk/ketypes.h> #include <ddk/ketypes.h>
#include <ntos/security.h> #include <ntos/security.h>

View file

@ -32,8 +32,12 @@
#ifndef _GNU_H_WINDOWS32_DEFINES #ifndef _GNU_H_WINDOWS32_DEFINES
#define _GNU_H_WINDOWS32_DEFINES #define _GNU_H_WINDOWS32_DEFINES
#include <ntos/registry.h>
#define WINBASEAPI #define WINBASEAPI
#ifndef WIN32_NO_STATUS #ifndef WIN32_NO_STATUS
//#define STATUS_WAIT_0 (0x00000000L) //#define STATUS_WAIT_0 (0x00000000L)
//#define STATUS_ABANDONED_WAIT_0 (0x00000080L) //#define STATUS_ABANDONED_WAIT_0 (0x00000080L)
@ -44,19 +48,6 @@
/* DuplicateHandle, MapViewOfFile */
#define KEY_ALL_ACCESS (0xf003fL)
#define KEY_CREATE_LINK (32)
#define KEY_CREATE_SUB_KEY (4)
#define KEY_ENUMERATE_SUB_KEYS (8)
#define KEY_EXECUTE (0x20019L)
#define KEY_NOTIFY (16)
#define KEY_QUERY_VALUE (1)
#define KEY_READ (0x20019L)
#define KEY_SET_VALUE (2)
#define KEY_WRITE (0x20006L)
/* CreateFile, GetFileAttributes, SetFileAttributes */ /* CreateFile, GetFileAttributes, SetFileAttributes */
#define SECURITY_ANONYMOUS (0) #define SECURITY_ANONYMOUS (0)
@ -2106,18 +2097,6 @@ extern "C" {
/* NetUserEnum */ /* NetUserEnum */
/* OpenProcessToken */ /* OpenProcessToken */
#define TOKEN_ADJUST_DEFAULT (128)
#define TOKEN_ADJUST_GROUPS (64)
#define TOKEN_ADJUST_PRIVILEGES (32)
#define TOKEN_ALL_ACCESS (0xf00ffL)
#define TOKEN_ASSIGN_PRIMARY (1)
#define TOKEN_DUPLICATE (2)
#define TOKEN_EXECUTE (0x20000L)
#define TOKEN_IMPERSONATE (4)
#define TOKEN_QUERY (8)
#define TOKEN_QUERY_SOURCE (16)
#define TOKEN_READ (0x20008L)
#define TOKEN_WRITE (0x200e0L)
/* OpenSCManager */ /* OpenSCManager */
#define SC_MANAGER_ALL_ACCESS (0xf003fL) #define SC_MANAGER_ALL_ACCESS (0xf003fL)
@ -2194,10 +2173,6 @@ extern "C" {
#define HKEY_DYN_DATA ((HKEY)0x00000006) #define HKEY_DYN_DATA ((HKEY)0x00000006)
/* RegCreateKeyEx */ /* RegCreateKeyEx */
#define REG_OPTION_VOLATILE (0x1L)
#define REG_OPTION_NON_VOLATILE (0L)
#define REG_CREATED_NEW_KEY (0x1L)
#define REG_OPENED_EXISTING_KEY (0x2L)
/* RegEnumValue */ /* RegEnumValue */
#define REG_BINARY (3) #define REG_BINARY (3)
@ -2405,7 +2380,6 @@ extern "C" {
#define CAL_SSHORTDATE (5) #define CAL_SSHORTDATE (5)
/* SetProcessWorkingSetSize */ /* SetProcessWorkingSetSize */
#define PROCESS_SET_QUOTA (256)
/* SetPrinter */ /* SetPrinter */
@ -4750,6 +4724,6 @@ DECLARE_HANDLE(HANDLE);
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* WIN32_LEAN_AND_MEAN */ #endif /* WIN32_LEAN_AND_MEAN */
#endif /* _GNU_H_WINDOWS32_DEFINES */ #endif /* _GNU_H_WINDOWS32_DEFINES */

View file

@ -0,0 +1,37 @@
/* $Id: registry.h,v 1.1 2001/01/28 21:32:37 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: include/ntos/registry.h
* PURPOSE: Registry declarations used by all the parts of the
* system
* PROGRAMMER: Eric Kohl <ekohl@rz-online.de>
* UPDATE HISTORY:
* 25/01/2001: Created
*/
#ifndef __INCLUDE_REGISTRY_H
#define __INCLUDE_REGISTRY_H
/* Key access rights */
#define KEY_QUERY_VALUE (1)
#define KEY_SET_VALUE (2)
#define KEY_CREATE_SUB_KEY (4)
#define KEY_ENUMERATE_SUB_KEYS (8)
#define KEY_NOTIFY (16)
#define KEY_CREATE_LINK (32)
#define KEY_READ (0x20019L)
#define KEY_WRITE (0x20006L)
#define KEY_EXECUTE (0x20019L)
#define KEY_ALL_ACCESS (0xf003fL)
/* RegCreateKeyEx */
#define REG_OPTION_VOLATILE (0x1L)
#define REG_OPTION_NON_VOLATILE (0L)
#define REG_CREATED_NEW_KEY (0x1L)
#define REG_OPENED_EXISTING_KEY (0x2L)
#endif /* __INCLUDE_REGISTRY_H */

View file

@ -1,4 +1,4 @@
/* $Id: registry.c,v 1.52 2000/12/01 12:44:15 jean Exp $ /* $Id: registry.c,v 1.53 2001/01/28 21:37:37 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -11,46 +11,42 @@
* Created 22/05/98 * Created 22/05/98
*/ */
#undef WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <defines.h>
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/ob.h> #include <internal/ob.h>
#include <limits.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* ----------------------------------------------------- Typedefs */ /* ----------------------------------------------------- Typedefs */
//#define LONG_MAX 0x7fffffff #define REG_BLOCK_SIZE 4096
#define REG_HEAP_BLOCK_DATA_OFFSET 32
#define REG_BLOCK_SIZE 4096 #define REG_HEAP_ID 0x6e696268
#define REG_HEAP_BLOCK_DATA_OFFSET 32 #define REG_INIT_BLOCK_LIST_SIZE 32
#define REG_HEAP_ID 0x6e696268
#define REG_INIT_BLOCK_LIST_SIZE 32
#define REG_INIT_HASH_TABLE_SIZE 3 #define REG_INIT_HASH_TABLE_SIZE 3
#define REG_EXTEND_HASH_TABLE_SIZE 4 #define REG_EXTEND_HASH_TABLE_SIZE 4
#define REG_VALUE_LIST_BLOCK_MULTIPLE 4 #define REG_VALUE_LIST_BLOCK_MULTIPLE 4
#define REG_KEY_BLOCK_ID 0x6b6e #define REG_KEY_BLOCK_ID 0x6b6e
#define REG_HASH_TABLE_BLOCK_ID 0x666c #define REG_HASH_TABLE_BLOCK_ID 0x666c
#define REG_VALUE_BLOCK_ID 0x6b76 #define REG_VALUE_BLOCK_ID 0x6b76
#define REG_KEY_BLOCK_TYPE 0x20 #define REG_KEY_BLOCK_TYPE 0x20
#define REG_ROOT_KEY_BLOCK_TYPE 0x2c #define REG_ROOT_KEY_BLOCK_TYPE 0x2c
#define REG_ROOT_KEY_NAME L"\\Registry" #define REG_ROOT_KEY_NAME L"\\Registry"
#define REG_MACHINE_KEY_NAME L"\\Registry\\Machine" #define REG_MACHINE_KEY_NAME L"\\Registry\\Machine"
#define REG_SYSTEM_KEY_NAME L"\\Registry\\Machine\\System" #define REG_SYSTEM_KEY_NAME L"\\Registry\\Machine\\System"
#define REG_SOFTWARE_KEY_NAME L"\\Registry\\Machine\\Software" #define REG_SOFTWARE_KEY_NAME L"\\Registry\\Machine\\Software"
#define REG_SAM_KEY_NAME L"\\Registry\\Machine\\Sam" #define REG_SAM_KEY_NAME L"\\Registry\\Machine\\Sam"
#define REG_SEC_KEY_NAME L"\\Registry\\Machine\\Security" #define REG_SEC_KEY_NAME L"\\Registry\\Machine\\Security"
#define REG_USERS_KEY_NAME L"\\Registry\\User" #define REG_USERS_KEY_NAME L"\\Registry\\User"
#define REG_USER_KEY_NAME L"\\Registry\\User\\CurrentUser" #define REG_USER_KEY_NAME L"\\Registry\\User\\CurrentUser"
#define SYSTEM_REG_FILE L"\\SystemRoot\\System32\\Config\\SYSTEM" #define SYSTEM_REG_FILE L"\\SystemRoot\\System32\\Config\\SYSTEM"
#define SOFTWARE_REG_FILE L"\\SystemRoot\\System32\\Config\\SOFTWARE" #define SOFTWARE_REG_FILE L"\\SystemRoot\\System32\\Config\\SOFTWARE"
#define USER_REG_FILE L"\\SystemRoot\\System32\\Config\\DEFAULT" #define USER_REG_FILE L"\\SystemRoot\\System32\\Config\\DEFAULT"
#define SAM_REG_FILE L"\\SystemRoot\\System32\\Config\\SAM" #define SAM_REG_FILE L"\\SystemRoot\\System32\\Config\\SAM"
#define SEC_REG_FILE L"\\SystemRoot\\System32\\Config\\SECURITY" #define SEC_REG_FILE L"\\SystemRoot\\System32\\Config\\SECURITY"
#define KO_MARKED_FOR_DELETE 0x00000001 #define KO_MARKED_FOR_DELETE 0x00000001
@ -60,30 +56,30 @@ typedef DWORD BLOCK_OFFSET;
/* header for registry hive file : */ /* header for registry hive file : */
typedef struct _HEADER_BLOCK typedef struct _HEADER_BLOCK
{ {
DWORD BlockId; /* ="regf" */ ULONG BlockId; /* ="regf" */
DWORD Version; /* file version ?*/ ULONG Version; /* file version ?*/
DWORD VersionOld; /* file version ?*/ ULONG VersionOld; /* file version ?*/
FILETIME DateModified; LARGE_INTEGER DateModified;
DWORD Unused3; /* registry format version ? */ ULONG Unused3; /* registry format version ? */
DWORD Unused4; /* registry format version ? */ ULONG Unused4; /* registry format version ? */
DWORD Unused5; /* registry format version ? */ ULONG Unused5; /* registry format version ? */
DWORD Unused6; /* registry format version ? */ ULONG Unused6; /* registry format version ? */
BLOCK_OFFSET RootKeyBlock; BLOCK_OFFSET RootKeyBlock;
DWORD BlockSize; ULONG BlockSize;
DWORD Unused7; ULONG Unused7;
WCHAR FileName[64]; /* end of file name */ WCHAR FileName[64]; /* end of file name */
DWORD Unused8[83]; ULONG Unused8[83];
DWORD Checksum; ULONG Checksum;
} HEADER_BLOCK, *PHEADER_BLOCK; } HEADER_BLOCK, *PHEADER_BLOCK;
typedef struct _HEAP_BLOCK typedef struct _HEAP_BLOCK
{ {
DWORD BlockId; /* = "hbin" */ ULONG BlockId; /* = "hbin" */
BLOCK_OFFSET BlockOffset; /* block offset of this heap */ BLOCK_OFFSET BlockOffset; /* block offset of this heap */
DWORD BlockSize; /* size in bytes, 4k multiple */ ULONG BlockSize; /* size in bytes, 4k multiple */
DWORD Unused1; ULONG Unused1;
FILETIME DateModified; LARGE_INTEGER DateModified;
DWORD Unused2; ULONG Unused2;
} HEAP_BLOCK, *PHEAP_BLOCK; } HEAP_BLOCK, *PHEAP_BLOCK;
// each sub_block begin with this struct : // each sub_block begin with this struct :
@ -96,22 +92,22 @@ typedef struct _FREE_SUB_BLOCK
typedef struct _KEY_BLOCK typedef struct _KEY_BLOCK
{ {
LONG SubBlockSize; LONG SubBlockSize;
WORD SubBlockId; USHORT SubBlockId;
WORD Type; USHORT Type;
FILETIME LastWriteTime; LARGE_INTEGER LastWriteTime;
DWORD UnUsed1; ULONG UnUsed1;
BLOCK_OFFSET ParentKeyOffset; BLOCK_OFFSET ParentKeyOffset;
DWORD NumberOfSubKeys; ULONG NumberOfSubKeys;
DWORD UnUsed2; ULONG UnUsed2;
BLOCK_OFFSET HashTableOffset; BLOCK_OFFSET HashTableOffset;
DWORD UnUsed3; ULONG UnUsed3;
DWORD NumberOfValues; ULONG NumberOfValues;
BLOCK_OFFSET ValuesOffset; BLOCK_OFFSET ValuesOffset;
BLOCK_OFFSET SecurityKeyOffset; BLOCK_OFFSET SecurityKeyOffset;
BLOCK_OFFSET ClassNameOffset; BLOCK_OFFSET ClassNameOffset;
DWORD Unused4[5]; ULONG Unused4[5];
WORD NameSize; USHORT NameSize;
WORD ClassSize; /* size of ClassName in bytes */ USHORT ClassSize; /* size of ClassName in bytes */
UCHAR Name[0]; /* warning : not zero terminated */ UCHAR Name[0]; /* warning : not zero terminated */
} KEY_BLOCK, *PKEY_BLOCK; } KEY_BLOCK, *PKEY_BLOCK;
@ -126,8 +122,8 @@ typedef struct _HASH_RECORD
typedef struct _HASH_TABLE_BLOCK typedef struct _HASH_TABLE_BLOCK
{ {
LONG SubBlockSize; LONG SubBlockSize;
WORD SubBlockId; USHORT SubBlockId;
WORD HashTableSize; USHORT HashTableSize;
HASH_RECORD Table[0]; HASH_RECORD Table[0];
} HASH_TABLE_BLOCK, *PHASH_TABLE_BLOCK; } HASH_TABLE_BLOCK, *PHASH_TABLE_BLOCK;
@ -140,13 +136,13 @@ typedef struct _VALUE_LIST_BLOCK
typedef struct _VALUE_BLOCK typedef struct _VALUE_BLOCK
{ {
LONG SubBlockSize; LONG SubBlockSize;
WORD SubBlockId; // "kv" USHORT SubBlockId; // "kv"
WORD NameSize; // length of Name USHORT NameSize; // length of Name
LONG DataSize; // length of datas in the subblock pointed by DataOffset LONG DataSize; // length of datas in the subblock pointed by DataOffset
BLOCK_OFFSET DataOffset;// datas are here if high bit of DataSize is set BLOCK_OFFSET DataOffset;// datas are here if high bit of DataSize is set
DWORD DataType; ULONG DataType;
WORD Flags; USHORT Flags;
WORD Unused1; USHORT Unused1;
UCHAR Name[0]; /* warning : not zero terminated */ UCHAR Name[0]; /* warning : not zero terminated */
} VALUE_BLOCK, *PVALUE_BLOCK; } VALUE_BLOCK, *PVALUE_BLOCK;
@ -159,7 +155,7 @@ typedef struct _DATA_BLOCK
typedef struct _REGISTRY_FILE typedef struct _REGISTRY_FILE
{ {
PWSTR Filename; PWSTR Filename;
DWORD FileSize; ULONG FileSize;
PFILE_OBJECT FileObject; PFILE_OBJECT FileObject;
PHEADER_BLOCK HeaderBlock; PHEADER_BLOCK HeaderBlock;
// ULONG NumberOfBlocks; // ULONG NumberOfBlocks;
@ -184,14 +180,14 @@ typedef struct _KEY_OBJECT
CSHORT Size; CSHORT Size;
ULONG Flags; ULONG Flags;
WORD NameSize; // length of Name USHORT NameSize; // length of Name
UCHAR *Name; UCHAR *Name;
PREGISTRY_FILE RegistryFile; PREGISTRY_FILE RegistryFile;
BLOCK_OFFSET BlockOffset; BLOCK_OFFSET BlockOffset;
PKEY_BLOCK KeyBlock; PKEY_BLOCK KeyBlock;
struct _KEY_OBJECT *ParentKey; struct _KEY_OBJECT *ParentKey;
DWORD NumberOfSubKeys; /* subkeys loaded in SubKeys */ ULONG NumberOfSubKeys; /* subkeys loaded in SubKeys */
DWORD SizeOfSubKeys; /* space allocated in SubKeys */ ULONG SizeOfSubKeys; /* space allocated in SubKeys */
struct _KEY_OBJECT **SubKeys; /* list of subkeys loaded */ struct _KEY_OBJECT **SubKeys; /* list of subkeys loaded */
} KEY_OBJECT, *PKEY_OBJECT; } KEY_OBJECT, *PKEY_OBJECT;
@ -205,6 +201,9 @@ static PKEY_OBJECT CmiMachineKey = NULL;
static PKEY_OBJECT CmiUserKey = NULL; static PKEY_OBJECT CmiUserKey = NULL;
static KSPIN_LOCK CmiKeyListLock; static KSPIN_LOCK CmiKeyListLock;
static GENERIC_MAPPING CmiKeyMapping =
{KEY_READ, KEY_WRITE, KEY_EXECUTE, KEY_ALL_ACCESS};
/* ----------------------------------------- Forward Declarations */ /* ----------------------------------------- Forward Declarations */
@ -311,8 +310,8 @@ CmInitializeRegistry(VOID)
HANDLE RootKeyHandle; HANDLE RootKeyHandle;
UNICODE_STRING RootKeyName; UNICODE_STRING RootKeyName;
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
PKEY_OBJECT NewKey; PKEY_OBJECT NewKey;
HANDLE KeyHandle; HANDLE KeyHandle;
/* Initialize the Key object type */ /* Initialize the Key object type */
CmiKeyType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE)); CmiKeyType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
@ -322,6 +321,7 @@ CmInitializeRegistry(VOID)
CmiKeyType->MaxHandles = LONG_MAX; CmiKeyType->MaxHandles = LONG_MAX;
CmiKeyType->PagedPoolCharge = 0; CmiKeyType->PagedPoolCharge = 0;
CmiKeyType->NonpagedPoolCharge = sizeof(KEY_OBJECT); CmiKeyType->NonpagedPoolCharge = sizeof(KEY_OBJECT);
CmiKeyType->Mapping = &CmiKeyMapping;
CmiKeyType->Dump = NULL; CmiKeyType->Dump = NULL;
CmiKeyType->Open = NULL; CmiKeyType->Open = NULL;
CmiKeyType->Close = NULL; CmiKeyType->Close = NULL;
@ -398,8 +398,8 @@ DPRINT("Creating HKLM\n");
RtlInitUnicodeString(&RootKeyName, REG_USERS_KEY_NAME); RtlInitUnicodeString(&RootKeyName, REG_USERS_KEY_NAME);
DPRINT("Creating HKU\n"); DPRINT("Creating HKU\n");
InitializeObjectAttributes(&ObjectAttributes, &RootKeyName, 0, NULL, NULL); InitializeObjectAttributes(&ObjectAttributes, &RootKeyName, 0, NULL, NULL);
NewKey=ObCreateObject(&KeyHandle, NewKey=ObCreateObject(&KeyHandle,
STANDARD_RIGHTS_REQUIRED, STANDARD_RIGHTS_REQUIRED,
&ObjectAttributes, &ObjectAttributes,
CmiKeyType); CmiKeyType);
Status = CmiAddSubKey(CmiVolatileFile, Status = CmiAddSubKey(CmiVolatileFile,
@ -410,16 +410,16 @@ DPRINT("Creating HKU\n");
0, 0,
NULL, NULL,
0); 0);
NewKey->RegistryFile = CmiVolatileFile; NewKey->RegistryFile = CmiVolatileFile;
NewKey->Flags = 0; NewKey->Flags = 0;
NewKey->NumberOfSubKeys=0; NewKey->NumberOfSubKeys=0;
NewKey->SubKeys= NULL; NewKey->SubKeys= NULL;
NewKey->SizeOfSubKeys= NewKey->KeyBlock->NumberOfSubKeys; NewKey->SizeOfSubKeys= NewKey->KeyBlock->NumberOfSubKeys;
NewKey->Name=ExAllocatePool(PagedPool,strlen("User")); NewKey->Name=ExAllocatePool(PagedPool,strlen("User"));
NewKey->NameSize=strlen("User"); NewKey->NameSize=strlen("User");
memcpy(NewKey->Name,"Machine",strlen("User")); memcpy(NewKey->Name,"Machine",strlen("User"));
CmiAddKeyToList(CmiRootKey,NewKey); CmiAddKeyToList(CmiRootKey,NewKey);
CmiUserKey=NewKey; CmiUserKey=NewKey;
/* FIXME: create remaining structure needed for default handles */ /* FIXME: create remaining structure needed for default handles */
@ -776,8 +776,8 @@ NtEnumerateKey (
{ {
/* Fill buffer with requested info */ /* Fill buffer with requested info */
BasicInformation = (PKEY_BASIC_INFORMATION) KeyInformation; BasicInformation = (PKEY_BASIC_INFORMATION) KeyInformation;
BasicInformation->LastWriteTime.u.LowPart = SubKeyBlock->LastWriteTime.dwLowDateTime; BasicInformation->LastWriteTime.u.LowPart = SubKeyBlock->LastWriteTime.u.LowPart;
BasicInformation->LastWriteTime.u.HighPart = SubKeyBlock->LastWriteTime.dwHighDateTime; BasicInformation->LastWriteTime.u.HighPart = SubKeyBlock->LastWriteTime.u.HighPart;
BasicInformation->TitleIndex = Index; BasicInformation->TitleIndex = Index;
BasicInformation->NameLength = (SubKeyBlock->NameSize ) * sizeof(WCHAR); BasicInformation->NameLength = (SubKeyBlock->NameSize ) * sizeof(WCHAR);
mbstowcs(BasicInformation->Name, mbstowcs(BasicInformation->Name,
@ -801,8 +801,8 @@ NtEnumerateKey (
{ {
/* Fill buffer with requested info */ /* Fill buffer with requested info */
NodeInformation = (PKEY_NODE_INFORMATION) KeyInformation; NodeInformation = (PKEY_NODE_INFORMATION) KeyInformation;
NodeInformation->LastWriteTime.u.LowPart = SubKeyBlock->LastWriteTime.dwLowDateTime; NodeInformation->LastWriteTime.u.LowPart = SubKeyBlock->LastWriteTime.u.LowPart;
NodeInformation->LastWriteTime.u.HighPart = SubKeyBlock->LastWriteTime.dwHighDateTime; NodeInformation->LastWriteTime.u.HighPart = SubKeyBlock->LastWriteTime.u.HighPart;
NodeInformation->TitleIndex = Index; NodeInformation->TitleIndex = Index;
NodeInformation->ClassOffset = sizeof(KEY_NODE_INFORMATION) + NodeInformation->ClassOffset = sizeof(KEY_NODE_INFORMATION) +
SubKeyBlock->NameSize * sizeof(WCHAR); SubKeyBlock->NameSize * sizeof(WCHAR);
@ -838,8 +838,8 @@ NtEnumerateKey (
{ {
/* fill buffer with requested info */ /* fill buffer with requested info */
FullInformation = (PKEY_FULL_INFORMATION) KeyInformation; FullInformation = (PKEY_FULL_INFORMATION) KeyInformation;
FullInformation->LastWriteTime.u.LowPart = SubKeyBlock->LastWriteTime.dwLowDateTime; FullInformation->LastWriteTime.u.LowPart = SubKeyBlock->LastWriteTime.u.LowPart;
FullInformation->LastWriteTime.u.HighPart = SubKeyBlock->LastWriteTime.dwHighDateTime; FullInformation->LastWriteTime.u.HighPart = SubKeyBlock->LastWriteTime.u.HighPart;
FullInformation->TitleIndex = Index; FullInformation->TitleIndex = Index;
FullInformation->ClassOffset = sizeof(KEY_FULL_INFORMATION) - FullInformation->ClassOffset = sizeof(KEY_FULL_INFORMATION) -
sizeof(WCHAR); sizeof(WCHAR);
@ -1126,12 +1126,12 @@ END FIXME*/
fileOffset.u.HighPart = 0; fileOffset.u.HighPart = 0;
for (i=0; i < RegistryFile->BlockListSize ; i++) for (i=0; i < RegistryFile->BlockListSize ; i++)
{ {
if( RegistryFile->BlockList[i]->DateModified.dwHighDateTime if( RegistryFile->BlockList[i]->DateModified.u.HighPart
> RegistryFile->HeaderBlock->DateModified.dwHighDateTime > RegistryFile->HeaderBlock->DateModified.u.HighPart
||( RegistryFile->BlockList[i]->DateModified.dwHighDateTime ||( RegistryFile->BlockList[i]->DateModified.u.HighPart
== RegistryFile->HeaderBlock->DateModified.dwHighDateTime == RegistryFile->HeaderBlock->DateModified.u.HighPart
&& RegistryFile->BlockList[i]->DateModified.dwLowDateTime && RegistryFile->BlockList[i]->DateModified.u.LowPart
> RegistryFile->HeaderBlock->DateModified.dwLowDateTime) > RegistryFile->HeaderBlock->DateModified.u.LowPart)
) )
{ {
fileOffset.u.LowPart = RegistryFile->BlockList[i]->BlockOffset+4096; fileOffset.u.LowPart = RegistryFile->BlockList[i]->BlockOffset+4096;
@ -1284,8 +1284,8 @@ NtQueryKey (
{ {
/* Fill buffer with requested info */ /* Fill buffer with requested info */
BasicInformation = (PKEY_BASIC_INFORMATION) KeyInformation; BasicInformation = (PKEY_BASIC_INFORMATION) KeyInformation;
BasicInformation->LastWriteTime.u.LowPart = KeyBlock->LastWriteTime.dwLowDateTime; BasicInformation->LastWriteTime.u.LowPart = KeyBlock->LastWriteTime.u.LowPart;
BasicInformation->LastWriteTime.u.HighPart = KeyBlock->LastWriteTime.dwHighDateTime; BasicInformation->LastWriteTime.u.HighPart = KeyBlock->LastWriteTime.u.HighPart;
BasicInformation->TitleIndex = 0; BasicInformation->TitleIndex = 0;
BasicInformation->NameLength = BasicInformation->NameLength =
(KeyObject->NameSize ) * sizeof(WCHAR); (KeyObject->NameSize ) * sizeof(WCHAR);
@ -1309,8 +1309,8 @@ NtQueryKey (
{ {
/* Fill buffer with requested info */ /* Fill buffer with requested info */
NodeInformation = (PKEY_NODE_INFORMATION) KeyInformation; NodeInformation = (PKEY_NODE_INFORMATION) KeyInformation;
NodeInformation->LastWriteTime.u.LowPart = KeyBlock->LastWriteTime.dwLowDateTime; NodeInformation->LastWriteTime.u.LowPart = KeyBlock->LastWriteTime.u.LowPart;
NodeInformation->LastWriteTime.u.HighPart = KeyBlock->LastWriteTime.dwHighDateTime; NodeInformation->LastWriteTime.u.HighPart = KeyBlock->LastWriteTime.u.HighPart;
NodeInformation->TitleIndex = 0; NodeInformation->TitleIndex = 0;
NodeInformation->ClassOffset = sizeof(KEY_NODE_INFORMATION) + NodeInformation->ClassOffset = sizeof(KEY_NODE_INFORMATION) +
KeyObject->NameSize * sizeof(WCHAR); KeyObject->NameSize * sizeof(WCHAR);
@ -1346,8 +1346,8 @@ NtQueryKey (
{ {
/* Fill buffer with requested info */ /* Fill buffer with requested info */
FullInformation = (PKEY_FULL_INFORMATION) KeyInformation; FullInformation = (PKEY_FULL_INFORMATION) KeyInformation;
FullInformation->LastWriteTime.u.LowPart = KeyBlock->LastWriteTime.dwLowDateTime; FullInformation->LastWriteTime.u.LowPart = KeyBlock->LastWriteTime.u.LowPart;
FullInformation->LastWriteTime.u.HighPart = KeyBlock->LastWriteTime.dwHighDateTime; FullInformation->LastWriteTime.u.HighPart = KeyBlock->LastWriteTime.u.HighPart;
FullInformation->TitleIndex = 0; FullInformation->TitleIndex = 0;
FullInformation->ClassOffset = sizeof(KEY_FULL_INFORMATION) - FullInformation->ClassOffset = sizeof(KEY_FULL_INFORMATION) -
sizeof(WCHAR); sizeof(WCHAR);
@ -2415,8 +2415,8 @@ CmiCreateRegistry(PWSTR Filename)
ExAllocatePool(NonPagedPool, sizeof(HEADER_BLOCK)); ExAllocatePool(NonPagedPool, sizeof(HEADER_BLOCK));
RtlZeroMemory(RegistryFile->HeaderBlock, sizeof(HEADER_BLOCK)); RtlZeroMemory(RegistryFile->HeaderBlock, sizeof(HEADER_BLOCK));
RegistryFile->HeaderBlock->BlockId = 0x66676572; RegistryFile->HeaderBlock->BlockId = 0x66676572;
RegistryFile->HeaderBlock->DateModified.dwLowDateTime = 0; RegistryFile->HeaderBlock->DateModified.u.LowPart = 0;
RegistryFile->HeaderBlock->DateModified.dwHighDateTime = 0; RegistryFile->HeaderBlock->DateModified.u.HighPart = 0;
RegistryFile->HeaderBlock->Version = 1; RegistryFile->HeaderBlock->Version = 1;
RegistryFile->HeaderBlock->Unused3 = 3; RegistryFile->HeaderBlock->Unused3 = 3;
RegistryFile->HeaderBlock->Unused5 = 1; RegistryFile->HeaderBlock->Unused5 = 1;