Author: ion
Date: Fri Oct 6 05:23:49 2006
New Revision: 24418
URL:
http://svn.reactos.org/svn/reactos?rev=24418&view=rev
Log:
- Stub CmpDelayCloseWorker, CmpDelayDerefKCBWorker.
- Implement CmpInitializeKcbDelayedDeref, CmpDelayDerefKCBRoutine,
CmpInitializeCmAllocations, CmpInitializeCache, CmpDelayCloseDpcRoutine
- Stub CmpCloseKeyObject, CmpDeleteKeyObject, CmpQueryKeyName, CmpSecurityMethod,
CmpParseKey.
- Add cminit.c containing CmpCreateRootNode, CmpCreateRootKey, CmpSetSystemBootValues,
CmpInitializeCallbacks, CmInitializeRegistry.
Added:
branches/alex-cm-branch/reactos/ntoskrnl/cm/cminit.c
Modified:
branches/alex-cm-branch/reactos/ntoskrnl/cm/cm.h
branches/alex-cm-branch/reactos/ntoskrnl/cm/cmkcbncb.c
branches/alex-cm-branch/reactos/ntoskrnl/cm/cmobject.c
Modified: branches/alex-cm-branch/reactos/ntoskrnl/cm/cm.h
URL:
http://svn.reactos.org/svn/reactos/branches/alex-cm-branch/reactos/ntoskrnl…
==============================================================================
--- branches/alex-cm-branch/reactos/ntoskrnl/cm/cm.h (original)
+++ branches/alex-cm-branch/reactos/ntoskrnl/cm/cm.h Fri Oct 6 05:23:49 2006
@@ -112,6 +112,7 @@
// Number of various lists and hashes
//
#define CMP_SECURITY_HASH_LISTS 64
+#define CMP_MAX_CALLBACKS 100
//
// Hashing Constants
@@ -569,6 +570,103 @@
);
//
+// KCB Cache/Delay Routines
+//
+VOID
+NTAPI
+CmpInitializeCache(
+ VOID
+);
+
+VOID
+NTAPI
+CmpInitializeCmAllocations(
+ VOID
+);
+
+VOID
+NTAPI
+CmpInitializeKcbDelayedDeref(
+ VOID
+);
+
+//
+// Key Object Routines
+//
+VOID
+NTAPI
+CmpCloseKeyObject(
+ IN PEPROCESS Process OPTIONAL,
+ IN PVOID Object,
+ IN ACCESS_MASK GrantedAccess,
+ IN ULONG ProcessHandleCount,
+ IN ULONG SystemHandleCount
+);
+
+VOID
+NTAPI
+CmpDeleteKeyObject(
+ IN PVOID Object
+);
+
+NTSTATUS
+NTAPI
+CmpParseKey(
+ IN PVOID ParseObject,
+ IN PVOID ObjectType,
+ IN OUT PACCESS_STATE AccessState,
+ IN KPROCESSOR_MODE AccessMode,
+ IN ULONG Attributes,
+ IN OUT PUNICODE_STRING CompleteName,
+ IN OUT PUNICODE_STRING RemainingName,
+ IN OUT PVOID Context OPTIONAL,
+ IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL,
+ OUT PVOID *Object
+);
+
+NTSTATUS
+NTAPI
+CmpSecurityMethod(
+ IN PVOID Object,
+ IN SECURITY_OPERATION_CODE OperationType,
+ IN SECURITY_INFORMATION SecurityInformation, // FIXME: <= should be a pointer
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN OUT PULONG CapturedLength,
+ IN OUT PSECURITY_DESCRIPTOR *ObjectSecurityDescriptor,
+ IN POOL_TYPE PoolType,
+ IN PGENERIC_MAPPING GenericMapping
+);
+
+NTSTATUS
+NTAPI
+CmpQueryKeyName(
+ IN PVOID Object,
+ IN BOOLEAN HasObjectName,
+ OUT POBJECT_NAME_INFORMATION ObjectNameInfo,
+ IN ULONG Length,
+ OUT PULONG ReturnLength,
+ IN KPROCESSOR_MODE AccessMode
+);
+
+//
+// Hive Routines
+//
+NTSTATUS
+NTAPI
+CmpInitializeHive(
+ OUT PCMHIVE *CmHive,
+ IN ULONG Operation,
+ IN ULONG Flags,
+ IN ULONG FileType,
+ IN PVOID HiveData,
+ IN HANDLE Primary,
+ IN HANDLE Alternate,
+ IN HANDLE Log,
+ IN HANDLE External,
+ IN PUNICODE_STRING FileName
+);
+
+//
// Registry Utility Functions
//
BOOLEAN
@@ -577,6 +675,18 @@
VOID
);
+VOID
+NTAPI
+CmpLockRegistryExclusive(
+ VOID
+);
+
+VOID
+NTAPI
+CmpUnlockRegistry(
+ VOID
+);
+
PVOID
NTAPI
CmpAllocateDelayItem(
@@ -592,6 +702,17 @@
//
// KCB Functions
//
+PCM_KEY_CONTROL_BLOCK
+NTAPI
+CmpCreateKcb(
+ IN PHHIVE Hive,
+ IN HCELL_INDEX Index,
+ IN PCM_KEY_NODE Node,
+ IN PCM_KEY_CONTROL_BLOCK Parent,
+ IN ULONG Flags,
+ IN PUNICODE_STRING KeyName
+);
+
VOID
NTAPI
CmpDereferenceKcbWithLock(
@@ -626,6 +747,11 @@
extern BOOLEAN CmpFlushOnLockRelease;
extern EX_PUSH_LOCK CmpHiveListHeadLock;
extern LIST_ENTRY CmpHiveListHead;
+extern POBJECT_TYPE CmpKeyObjectType;
+extern ERESOURCE CmpRegistryLock;
+extern PCM_KEY_HASH_TABLE_ENTRY *CmpCacheTable;
+extern PCM_NAME_HASH_TABLE_ENTRY *CmpNameCacheTable;
+extern KGUARDED_MUTEX CmpDelayedCloseTableLock;
//
// Inlined functions
Added: branches/alex-cm-branch/reactos/ntoskrnl/cm/cminit.c
URL:
http://svn.reactos.org/svn/reactos/branches/alex-cm-branch/reactos/ntoskrnl…
==============================================================================
--- branches/alex-cm-branch/reactos/ntoskrnl/cm/cminit.c (added)
+++ branches/alex-cm-branch/reactos/ntoskrnl/cm/cminit.c Fri Oct 6 05:23:49 2006
@@ -1,0 +1,396 @@
+/*
+ * PROJECT: ReactOS Kernel
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: ntoskrnl/cm/cminit.c
+ * PURPOSE: Initialization and generic utility routines
+ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org)
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <ntoskrnl.h>
+#define NDEBUG
+#include <debug.h>
+
+PEPROCESS CmpSystemProcess;
+PCMHIVE CmpMasterHive;
+HANDLE CmpRegistryRootHandle;
+
+KGUARDED_MUTEX CmpSelfHealQueueLock;
+LIST_ENTRY CmpSelfHealQueueListHead;
+
+EX_PUSH_LOCK CmpLoadHiveLock;
+
+UNICODE_STRING CmpSystemStartOptions;
+
+ULONG CmpCallBackCount;
+
+/* FUNCTIONS *****************************************************************/
+
+NTSTATUS
+NTAPI
+CmpCreateRootNode(IN PHHIVE Hive,
+ IN PWCHAR Name,
+ OUT HCELL_INDEX *Index)
+{
+ UNICODE_STRING KeyName;
+ PCELL_DATA Cell;
+ LARGE_INTEGER SystemTime;
+ PAGED_CODE();
+
+ /* Initialize the node name and allocate it */
+ RtlInitUnicodeString(&KeyName, Name);
+ *Index = HvAllocateCell(Hive,
+ FIELD_OFFSET(CM_KEY_NODE, Name) +
+ CmpNameSize(Hive, &KeyName),
+ HvStable); // FIXME: , -1);
+ if (*Index == HCELL_NIL) return STATUS_UNSUCCESSFUL;
+
+ /* Set the cell index and get the data */
+ Hive->HiveHeader->RootCell = *Index;
+ Cell = HvGetCell(Hive, *Index);
+
+ /* Fill out the cell */
+ Cell->u.KeyNode.Signature = CM_KEY_NODE_SIGNATURE;
+ Cell->u.KeyNode.Flags = KEY_HIVE_ENTRY | KEY_NO_DELETE;
+ KeQuerySystemTime(&SystemTime);
+ Cell->u.KeyNode.LastWriteTime = SystemTime;
+ Cell->u.KeyNode.Parent = HCELL_NIL;
+ Cell->u.KeyNode.SubKeyCounts[HvStable] = 0;
+ Cell->u.KeyNode.SubKeyCounts[HvVolatile] = 0;
+ Cell->u.KeyNode.SubKeyLists[HvStable] = 0;
+ Cell->u.KeyNode.SubKeyLists[HvVolatile] = 0;
+ Cell->u.KeyNode.ValueList.Count = 0;
+ Cell->u.KeyNode.ValueList.List = HCELL_NIL;
+ Cell->u.KeyNode.Class = HCELL_NIL;
+ Cell->u.KeyNode.MaxValueDataLen = 0;
+ Cell->u.KeyNode.MaxNameLen = 0;
+ Cell->u.KeyNode.MaxValueNameLen = 0;
+ Cell->u.KeyNode.MaxClassLen = 0;
+
+ /* Copy the name (this will also set the length) */
+ Cell->u.KeyNode.NameLength = CmpCopyName(Hive,
+ Cell->u.KeyNode.Name,
+ &KeyName);
+
+ /* Check if the name was compressed */
+ if (Cell->u.KeyNode.NameLength < KeyName.Length)
+ {
+ /* Set the flag */
+ Cell->u.KeyNode.Flags |= KEY_COMP_NAME;
+ }
+
+ /* Return success */
+ HvReleaseCell(Hive, *Index);
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+NTAPI
+CmpCreateRootKey(VOID)
+{
+ NTSTATUS Status;
+ HCELL_INDEX RootCell;
+ PCM_KEY_BODY Key;
+ PVOID KeyBody;
+ HANDLE KeyHandle;
+ PCM_KEY_CONTROL_BLOCK RootKcb;
+ UNICODE_STRING RootName = RTL_CONSTANT_STRING(L"\\REGISTRY");
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ PAGED_CODE();
+
+ /* Create the root node */
+ Status = CmpCreateRootNode(&CmpMasterHive->Hive, L"REGISTRY",
&RootCell);
+ if (!NT_SUCCESS(Status)) return Status;
+
+ /* Create the object */
+ InitializeObjectAttributes(&ObjectAttributes,
+ &RootName,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
+ Status = ObCreateObject(KernelMode,
+ CmpKeyObjectType,
+ &ObjectAttributes,
+ UserMode,
+ NULL,
+ sizeof(CM_KEY_BODY),
+ 0,
+ 0,
+ (PVOID*)&Key);
+ if (!NT_SUCCESS(Status)) return Status;
+
+ /* Create the KCB */
+ RootKcb = CmpCreateKcb(&CmpMasterHive->Hive,
+ RootCell,
+ HvGetCell(&CmpMasterHive->Hive, RootCell),
+ NULL,
+ FALSE,
+ &RootName);
+ if (!RootKcb) return STATUS_UNSUCCESSFUL;
+
+ /* Setup the key */
+ Key->Type = TAG('k', 'y', '0', '2');
+ Key->KeyControlBlock = RootKcb;
+ Key->NotifyBlock = NULL;
+ Key->ProcessID = PsGetCurrentProcess();
+
+ /* Enlist it */
+ CmpEnlistKeyWithKcb(Key, RootKcb);
+
+ /* Insert the key */
+ Status = ObInsertObject(Key,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ &CmpRegistryRootHandle);
+ if (!NT_SUCCESS(Status)) return Status;
+
+ /* Now reference it as a keep alive and return the status */
+ Status = ObReferenceObjectByHandle(KeyHandle,
+ KEY_READ,
+ NULL,
+ KernelMode,
+ &KeyBody,
+ NULL);
+ return Status;
+}
+
+VOID
+NTAPI
+CmpInitializeCallbacks(VOID)
+{
+ ULONG i;
+ PAGED_CODE();
+
+ /* Reset counter */
+ CmpCallBackCount = 0;
+
+ /* Loop all the callbacks */
+ for (i = 0; i < CMP_MAX_CALLBACKS; i++)
+ {
+ /* Initialize this one */
+ ExInitializeCallBack(&CmpCallBackVector[i]);
+ }
+}
+
+VOID
+NTAPI
+CmpSetSystemBootValues(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
+{
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ UNICODE_STRING KeyName, ValueName;
+ HANDLE KeyHandle;
+ NTSTATUS Status;
+ PCHAR CommandLine;
+ PCHAR SystemBootDevice;
+ ULONG i = 0;
+ ASSERT(LoaderBlock != NULL);
+
+ /* Setup attributes for loader options */
+ RtlInitUnicodeString(&KeyName,
+ L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\"
+ L"Control");
+ InitializeObjectAttributes(&ObjectAttributes,
+ &KeyName,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
+ Status = NtOpenKey(&KeyHandle, KEY_WRITE, &ObjectAttributes);
+ if (NT_SUCCESS(Status))
+ {
+ /* Key opened, now write to the key */
+ RtlInitUnicodeString(&KeyName, L"SystemStartOptions");
+ NtSetValueKey(KeyHandle,
+ &KeyName,
+ 0,
+ REG_SZ,
+ CmpSystemStartOptions.Buffer,
+ CmpSystemStartOptions.Length);
+ }
+
+ /* Free the options now */
+ ExFreePool(CmpSystemStartOptions.Buffer);
+
+ /* Setup value name for system boot device */
+ RtlInitUnicodeString(&KeyName, L"SystemBootDevice");
+ RtlCreateUnicodeStringFromAsciiz(&ValueName, LoaderBlock->NtBootPathName);
+ NtSetValueKey(KeyHandle,
+ &KeyName,
+ 0,
+ REG_SZ,
+ ValueName.Buffer,
+ ValueName.Length);
+
+ /* Free the buffers */
+ RtlFreeUnicodeString(&ValueName);
+ ExFreePool(SystemBootDevice);
+
+ /* Close the key and return */
+ NtClose(KeyHandle);
+}
+
+VOID
+NTAPI
+CmInitializeRegistry(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
+{
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ UNICODE_STRING KeyName;
+ OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
+ UNICODE_STRING Name;
+ HANDLE KeyHandle;
+ NTSTATUS Status;
+ PAGED_CODE();
+
+ /* Initialize the hive list and lock */
+ InitializeListHead(&CmpHiveListHead);
+ ExInitializePushLock(&CmpHiveListHeadLock);
+ ExInitializePushLock(&CmpLoadHiveLock);
+
+ /* Initialize registry lock */
+ ExInitializeResourceLite(&CmpRegistryLock);
+
+ /* Initialize the cache */
+ CmpInitializeCache();
+
+ /* Initialize allocation and delayed dereferencing */
+ CmpInitializeCmAllocations();
+ CmpInitializeKcbDelayedDeref();
+
+ /* Initialize callbacks */
+ CmpInitializeCallbacks();
+
+ /* Initialize self healing */
+ KeInitializeGuardedMutex(&CmpSelfHealQueueLock);
+ InitializeListHead(&CmpSelfHealQueueListHead);
+
+ /* Save the current process and lock the registry */
+ CmpSystemProcess = PsGetCurrentProcess();
+ CmpLockRegistryExclusive();
+
+ /* Initialize the Key object type */
+ RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
+ RtlInitUnicodeString(&Name, L"Key");
+ ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
+ ObjectTypeInitializer.DefaultPagedPoolCharge = sizeof(CM_KEY_BODY);
+ ObjectTypeInitializer.GenericMapping = NULL;
+ ObjectTypeInitializer.PoolType = PagedPool;
+ ObjectTypeInitializer.SecurityRequired = TRUE;
+ ObjectTypeInitializer.ValidAccessMask = KEY_ALL_ACCESS;
+ ObjectTypeInitializer.UseDefaultObject = TRUE;
+ ObjectTypeInitializer.DeleteProcedure = CmpDeleteKeyObject;
+ ObjectTypeInitializer.ParseProcedure = CmpParseKey;
+ ObjectTypeInitializer.SecurityProcedure = CmpSecurityMethod;
+ ObjectTypeInitializer.QueryNameProcedure = CmpQueryKeyName;
+ ObjectTypeInitializer.CloseProcedure = CmpCloseKeyObject;
+ ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&CmpKeyObjectType);
+
+ /* Create master hive */
+ Status = CmpInitializeHive(&CmpMasterHive,
+ HINIT_CREATE,
+ HIVE_VOLATILE,
+ HFILE_TYPE_PRIMARY,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ if (!NT_SUCCESS(Status)) KeBugCheck(0);
+
+ /* Create the \REGISTRY key */
+ Status = CmpCreateRootKey();
+ if (!NT_SUCCESS(Status)) KeBugCheck(0);
+
+ /* Create '\Registry\Machine' key. */
+ RtlInitUnicodeString(&KeyName, L"\\REGISTRY\\MACHINE");
+ InitializeObjectAttributes(&ObjectAttributes,
+ &KeyName,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
+ Status = NtCreateKey(&KeyHandle,
+ KEY_READ | KEY_WRITE,
+ &ObjectAttributes,
+ 0,
+ NULL,
+ 0,
+ NULL);
+ if (!NT_SUCCESS(Status)) KeBugCheck(0);
+ NtClose(KeyHandle);
+
+ /* Create '\Registry\User' key. */
+ RtlInitUnicodeString(&KeyName, L"\\REGISTRY\\USER");
+ InitializeObjectAttributes(&ObjectAttributes,
+ &KeyName,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
+ Status = NtCreateKey(&KeyHandle,
+ KEY_READ | KEY_WRITE,
+ &ObjectAttributes,
+ 0,
+ NULL,
+ 0,
+ NULL);
+ if (!NT_SUCCESS(Status)) KeBugCheck(0);
+ NtClose(KeyHandle);
+
+ /* Initialize and load the system hive */
+ Status = CmpInitializeSystemHive(LoaderBlock);
+ if (!NT_SUCCESS(Status)) KeBugCheck(0);
+
+ /* Create the CCS symbolic link */
+ Status = CmpCreateCurrentControlSetLink(LoaderBlock);
+ if (!NT_SUCCESS(Status)) KeBugCheck(0);
+
+ /* Load the hardware hive */
+ Status = CmpInitializeHardwareHive(LoaderBlock);
+ if (!NT_SUCCESS(Status)) KeBugCheck(0);
+
+ /* Unlock the registry now */
+ CmpUnlockRegistry();
+
+ /* Set system boot values */
+ CmpSetSystemBootValues(LoaderBlock);
+}
+
+#if 0
+VOID
+INIT_FUNCTION
+STDCALL
+CmInitHives(BOOLEAN SetupBoot)
+{
+ PCHAR BaseAddress;
+
+ /* Load Registry Hives. This one can be missing. */
+ if (CachedModules[SystemRegistry]) {
+ BaseAddress = (PCHAR)CachedModules[SystemRegistry]->ModStart;
+ CmImportSystemHive(BaseAddress,
+ CachedModules[SystemRegistry]->ModEnd -
(ULONG_PTR)BaseAddress);
+ }
+
+ BaseAddress = (PCHAR)CachedModules[HardwareRegistry]->ModStart;
+ CmImportHardwareHive(BaseAddress,
+ CachedModules[HardwareRegistry]->ModEnd -
(ULONG_PTR)BaseAddress);
+
+
+ /* Create dummy keys if no hardware hive was found */
+ CmImportHardwareHive (NULL, 0);
+
+ /* Initialize volatile registry settings */
+ if (SetupBoot == FALSE) CmInit2((PCHAR)KeLoaderBlock.CommandLine);
+}
+
+ /*
+ * Create a CurrentControlSet\Control\MiniNT key that is used
+ * to detect WinPE/MiniNT systems.
+ */
+ if (MiniNT)
+ {
+ Status = RtlCreateRegistryKey(RTL_REGISTRY_CONTROL, L"MiniNT");
+ if (!NT_SUCCESS(Status))
+ KEBUGCHECK(CONFIG_INITIALIZATION_FAILED);
+ }
+#endif
Modified: branches/alex-cm-branch/reactos/ntoskrnl/cm/cmkcbncb.c
URL:
http://svn.reactos.org/svn/reactos/branches/alex-cm-branch/reactos/ntoskrnl…
==============================================================================
--- branches/alex-cm-branch/reactos/ntoskrnl/cm/cmkcbncb.c (original)
+++ branches/alex-cm-branch/reactos/ntoskrnl/cm/cmkcbncb.c Fri Oct 6 05:23:49 2006
@@ -17,13 +17,19 @@
ULONG CmpHashTableSize;
PCM_KEY_HASH_TABLE_ENTRY *CmpCacheTable;
PCM_NAME_HASH_TABLE_ENTRY *CmpNameCacheTable;
+
LIST_ENTRY CmpFreeKCBListHead;
+
BOOLEAN CmpAllocInited;
-KGUARDED_MUTEX CmpAllocBucketLock;
+KGUARDED_MUTEX CmpAllocBucketLock, CmpDelayAllocBucketLock;
+WORK_QUEUE_ITEM CmpDelayDerefKCBWorkItem;
+LIST_ENTRY CmpFreeDelayItemsListHead;
+
ULONG CmpDelayedCloseSize;
ULONG CmpDelayedCloseElements;
KGUARDED_MUTEX CmpDelayedCloseTableLock;
BOOLEAN CmpDelayCloseWorkItemActive;
+WORK_QUEUE_ITEM CmpDelayCloseWorkItem;
LIST_ENTRY CmpDelayedLRUListHead;
ULONG CmpDelayCloseIntervalInSeconds = 5;
KDPC CmpDelayCloseDpc;
@@ -39,6 +45,127 @@
BOOLEAN CmpHoldLazyFlush;
/* FUNCTIONS *****************************************************************/
+
+VOID
+NTAPI
+CmpDelayCloseDpcRoutine(IN PKDPC Dpc,
+ IN PVOID DeferredContext,
+ IN PVOID SystemArgument1,
+ IN PVOID SystemArgument2)
+{
+ /* Sanity check */
+ ASSERT(CmpDelayCloseWorkItemActive);
+
+ /* Queue the work item */
+ ExQueueWorkItem(&CmpDelayCloseWorkItem, DelayedWorkQueue);
+}
+
+VOID
+NTAPI
+CmpDelayCloseWorker(IN PVOID Context)
+{
+ PAGED_CODE();
+
+ /* Sanity check */
+ ASSERT(CmpDelayCloseWorkItemActive);
+
+ /* FIXME: TODO */
+}
+
+VOID
+NTAPI
+CmpInitializeCache(VOID)
+{
+ ULONG Length;
+
+ /* Calculate length for the table */
+ Length = CmpHashTableSize * sizeof(PCM_KEY_HASH);
+
+ /* Allocate it */
+ CmpCacheTable = ExAllocatePoolWithTag(PagedPool, Length, TAG_CM);
+ if (!CmpCacheTable) KeBugCheck(CONFIG_INITIALIZATION_FAILED);
+ RtlZeroMemory(CmpCacheTable, Length);
+
+ /* Calculate length for the name cache */
+ Length = CmpHashTableSize * sizeof(PCM_NAME_HASH);
+
+ /* Now allocate the name cache table */
+ CmpNameCacheTable = ExAllocatePoolWithTag(PagedPool, Length, TAG_CM);
+ if (!CmpCacheTable) KeBugCheck(CONFIG_INITIALIZATION_FAILED);
+ RtlZeroMemory(CmpNameCacheTable, Length);
+
+ /* Setup the delayed close lock */
+ KeInitializeGuardedMutex(&CmpDelayedCloseTableLock);
+
+ /* Setup the work item */
+ ExInitializeWorkItem(&CmpDelayCloseWorkItem, CmpDelayCloseWorker, NULL);
+
+ /* Setup the DPC and its timer */
+ KeInitializeDpc(&CmpDelayCloseDpc, CmpDelayCloseDpcRoutine, NULL);
+ KeInitializeTimer(&CmpDelayCloseTimer);
+}
+
+VOID
+NTAPI
+CmpInitializeCmAllocations(VOID)
+{
+ /* Make sure we didn't already do this */
+ if (!CmpAllocInited)
+ {
+ /* Setup the lock and list */
+ KeInitializeGuardedMutex(&CmpAllocBucketLock);
+ InitializeListHead(&CmpFreeKCBListHead);
+ CmpAllocInited = TRUE;
+ }
+
+ /* Initialize the delay one too */
+ KeInitializeGuardedMutex(&CmpDelayAllocBucketLock);
+ InitializeListHead(&CmpFreeDelayItemsListHead);
+}
+
+VOID
+NTAPI
+CmpDelayDerefKCBDpcRoutine(IN PKDPC Dpc,
+ IN PVOID DeferredContext,
+ IN PVOID SystemArgument1,
+ IN PVOID SystemArgument2)
+{
+ /* Sanity check */
+ ASSERT(CmpDelayDerefKCBWorkItemActive);
+
+ /* Queue the work item */
+ ExQueueWorkItem(&CmpDelayDerefKCBWorkItem, DelayedWorkQueue);
+}
+
+VOID
+NTAPI
+CmpDelayDerefKCBWorker(IN PVOID Context)
+{
+ PAGED_CODE();
+
+ /* Sanity check */
+ ASSERT(CmpDelayDerefKCBWorkItemActive);
+
+ /* FIXME: TODO */
+}
+
+VOID
+NTAPI
+CmpInitializeKcbDelayedDeref(VOID)
+{
+ /* Initialize lock and list */
+ KeInitializeGuardedMutex(&CmpDelayDerefKCBLock);
+ InitializeListHead(&CmpDelayDerefKCBListHead);
+
+ /* Setup the work item */
+ ExInitializeWorkItem(&CmpDelayDerefKCBWorkItem,
+ CmpDelayDerefKCBWorker,
+ NULL);
+
+ /* Setup the DPC and timer for it */
+ KeInitializeDpc(&CmpDelayDerefKCBDpc, CmpDelayDerefKCBDpcRoutine, NULL);
+ KeInitializeTimer(&CmpDelayDerefKCBTimer);
+}
VOID
NTAPI
Modified: branches/alex-cm-branch/reactos/ntoskrnl/cm/cmobject.c
URL:
http://svn.reactos.org/svn/reactos/branches/alex-cm-branch/reactos/ntoskrnl…
==============================================================================
--- branches/alex-cm-branch/reactos/ntoskrnl/cm/cmobject.c (original)
+++ branches/alex-cm-branch/reactos/ntoskrnl/cm/cmobject.c Fri Oct 6 05:23:49 2006
@@ -12,5 +12,77 @@
#define NDEBUG
#include <debug.h>
+/* GLOBALS *******************************************************************/
+
+POBJECT_TYPE CmpKeyObjectType;
+
/* FUNCTIONS *****************************************************************/
+VOID
+NTAPI
+CmpCloseKeyObject(IN PEPROCESS Process OPTIONAL,
+ IN PVOID Object,
+ IN ACCESS_MASK GrantedAccess,
+ IN ULONG ProcessHandleCount,
+ IN ULONG SystemHandleCount)
+{
+ /* FIXME: TODO */
+ ASSERT(FALSE);
+}
+
+VOID
+NTAPI
+CmpDeleteKeyObject(IN PVOID Object)
+{
+ /* FIXME: TODO */
+ ASSERT(FALSE);
+}
+
+NTSTATUS
+NTAPI
+CmpParseKey(IN PVOID ParseObject,
+ IN PVOID ObjectType,
+ IN OUT PACCESS_STATE AccessState,
+ IN KPROCESSOR_MODE AccessMode,
+ IN ULONG Attributes,
+ IN OUT PUNICODE_STRING CompleteName,
+ IN OUT PUNICODE_STRING RemainingName,
+ IN OUT PVOID Context OPTIONAL,
+ IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL,
+ OUT PVOID *Object)
+{
+ /* FIXME: TODO */
+ ASSERT(FALSE);
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+NTAPI
+CmpSecurityMethod(IN PVOID Object,
+ IN SECURITY_OPERATION_CODE OperationType,
+ IN SECURITY_INFORMATION SecurityInformation, // FIXME: <= should be
a pointer
+ IN PSECURITY_DESCRIPTOR SecurityDescriptor,
+ IN OUT PULONG CapturedLength,
+ IN OUT PSECURITY_DESCRIPTOR *ObjectSecurityDescriptor,
+ IN POOL_TYPE PoolType,
+ IN PGENERIC_MAPPING GenericMapping)
+{
+ /* FIXME: TODO */
+ ASSERT(FALSE);
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+NTAPI
+CmpQueryKeyName(IN PVOID Object,
+ IN BOOLEAN HasObjectName,
+ OUT POBJECT_NAME_INFORMATION ObjectNameInfo,
+ IN ULONG Length,
+ OUT PULONG ReturnLength,
+ IN KPROCESSOR_MODE AccessMode)
+{
+ /* FIXME: TODO */
+ ASSERT(FALSE);
+ return STATUS_SUCCESS;
+}
+