Author: mnordell
Date: Tue Oct 16 09:39:47 2007
New Revision: 29621
URL:
http://svn.reactos.org/svn/reactos?rev=29621&view=rev
Log:
Attempt to make Cm API at least a little const-correct.
Modified:
trunk/reactos/lib/cmlib/cmlib.h
trunk/reactos/lib/cmlib/hiveinit.c
trunk/reactos/ntoskrnl/cm/cm.h
trunk/reactos/ntoskrnl/cm/regfile.c
trunk/reactos/ntoskrnl/cm/regobj.c
trunk/reactos/ntoskrnl/config/cm.h
trunk/reactos/ntoskrnl/config/cmindex.c
trunk/reactos/ntoskrnl/config/cminit.c
trunk/reactos/ntoskrnl/config/cmname.c
trunk/reactos/ntoskrnl/config/cmsysini.c
trunk/reactos/ntoskrnl/config/cmvalche.c
Modified: trunk/reactos/lib/cmlib/cmlib.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/cmlib.h?rev=2962…
==============================================================================
--- trunk/reactos/lib/cmlib/cmlib.h (original)
+++ trunk/reactos/lib/cmlib/cmlib.h Tue Oct 16 09:39:47 2007
@@ -211,7 +211,7 @@
PFILE_WRITE_ROUTINE FileWrite,
PFILE_SET_SIZE_ROUTINE FileSetSize,
PFILE_FLUSH_ROUTINE FileFlush,
- IN PUNICODE_STRING FileName);
+ IN CONST UNICODE_STRING* FileName);
VOID CMAPI
HvFree(
Modified: trunk/reactos/lib/cmlib/hiveinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hiveinit.c?rev=2…
==============================================================================
--- trunk/reactos/lib/cmlib/hiveinit.c (original)
+++ trunk/reactos/lib/cmlib/hiveinit.c Tue Oct 16 09:39:47 2007
@@ -440,7 +440,7 @@
PFILE_WRITE_ROUTINE FileWrite,
PFILE_SET_SIZE_ROUTINE FileSetSize,
PFILE_FLUSH_ROUTINE FileFlush,
- IN PUNICODE_STRING FileName)
+ IN CONST UNICODE_STRING* FileName)
{
NTSTATUS Status;
PHHIVE Hive = RegistryHive;
Modified: trunk/reactos/ntoskrnl/cm/cm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/cm.h?rev=29621…
==============================================================================
--- trunk/reactos/ntoskrnl/cm/cm.h (original)
+++ trunk/reactos/ntoskrnl/cm/cm.h Tue Oct 16 09:39:47 2007
@@ -169,13 +169,13 @@
NTSTATUS
CmiScanKeyList(IN PKEY_OBJECT Parent,
- IN PUNICODE_STRING KeyName,
+ IN CONST UNICODE_STRING* KeyName,
IN ULONG Attributes,
PKEY_OBJECT* ReturnedObject);
NTSTATUS
CmiLoadHive(POBJECT_ATTRIBUTES KeyObjectAttributes,
- PUNICODE_STRING FileName,
+ CONST UNICODE_STRING* FileName,
ULONG Flags);
NTSTATUS
@@ -200,7 +200,7 @@
IN PCM_KEY_NODE KeyCell,
OUT PCM_KEY_NODE *SubKeyCell,
OUT HCELL_INDEX *BlockOffset,
- IN PUNICODE_STRING KeyName,
+ IN CONST UNICODE_STRING* KeyName,
IN ACCESS_MASK DesiredAccess,
IN ULONG Attributes);
@@ -317,12 +317,14 @@
IN PUNICODE_STRING Name
);
+/* NOTE: This function declaration is currently duplicated in both */
+/* cm/cm.h and config/cm.h. TODO: Pick one single place to declare it. */
HCELL_INDEX
NTAPI
CmpFindSubKeyByName(
IN PHHIVE Hive,
IN PCM_KEY_NODE Parent,
- IN PUNICODE_STRING SearchName
+ IN CONST UNICODE_STRING* SearchName
);
VOID
@@ -340,10 +342,12 @@
IN PVOID ParseContext
);
-NTSTATUS
-NTAPI
-CmpOpenHiveFiles(IN PUNICODE_STRING BaseName,
- IN PWCHAR Extension OPTIONAL,
+/* NOTE: This function declaration is currently duplicated in both */
+/* cm/cm.h and config/cm.h. TODO: Pick one single place to declare it. */
+NTSTATUS
+NTAPI
+CmpOpenHiveFiles(IN CONST UNICODE_STRING* BaseName,
+ IN PCWSTR Extension OPTIONAL,
IN PHANDLE Primary,
IN PHANDLE Log,
IN PULONG PrimaryDisposition,
@@ -355,7 +359,7 @@
NTSTATUS
NTAPI
-CmpInitHiveFromFile(IN PUNICODE_STRING HiveName,
+CmpInitHiveFromFile(IN CONST UNICODE_STRING* HiveName,
IN ULONG HiveFlags,
OUT PEREGISTRY_HIVE *Hive,
IN OUT PBOOLEAN New,
Modified: trunk/reactos/ntoskrnl/cm/regfile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regfile.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/cm/regfile.c (original)
+++ trunk/reactos/ntoskrnl/cm/regfile.c Tue Oct 16 09:39:47 2007
@@ -24,7 +24,7 @@
NTSTATUS
CmiLoadHive(IN POBJECT_ATTRIBUTES KeyObjectAttributes,
- IN PUNICODE_STRING FileName,
+ IN CONST UNICODE_STRING* FileName,
IN ULONG Flags)
{
PEREGISTRY_HIVE Hive = NULL;
@@ -280,7 +280,7 @@
IN PCM_KEY_NODE KeyCell,
OUT PCM_KEY_NODE *SubKeyCell,
OUT HCELL_INDEX *BlockOffset,
- IN PUNICODE_STRING KeyName,
+ IN CONST UNICODE_STRING* KeyName,
IN ACCESS_MASK DesiredAccess,
IN ULONG Attributes)
{
Modified: trunk/reactos/ntoskrnl/cm/regobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regobj.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/cm/regobj.c (original)
+++ trunk/reactos/ntoskrnl/cm/regobj.c Tue Oct 16 09:39:47 2007
@@ -753,9 +753,10 @@
NewKey->ParentKey = ParentKey;
}
+/* Preconditions: Must be called with CmpRegistryLock held. */
NTSTATUS
CmiScanKeyList(PKEY_OBJECT Parent,
- PUNICODE_STRING KeyName,
+ CONST UNICODE_STRING* KeyName,
ULONG Attributes,
PKEY_OBJECT* ReturnedObject)
{
@@ -766,6 +767,7 @@
KeyName, &Parent->Name);
/* FIXME: if list maintained in alphabetic order, use dichotomic search */
+ /* (a binary search) */
for (Index=0; Index < Parent->SubKeyCounts; Index++)
{
CurKey = Parent->SubKeys[Index];
Modified: trunk/reactos/ntoskrnl/config/cm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cm.h?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cm.h (original)
+++ trunk/reactos/ntoskrnl/config/cm.h Tue Oct 16 09:39:47 2007
@@ -762,7 +762,7 @@
NTAPI
CmpFindValueByNameFromCache(
IN PKEY_OBJECT KeyObject,
- IN PUNICODE_STRING Name,
+ IN CONST UNICODE_STRING* Name,
OUT PCM_CACHED_VALUE **CachedValue,
OUT ULONG *Index,
OUT PCM_KEY_VALUE *Value,
@@ -929,11 +929,11 @@
IN ULONG Operation,
IN ULONG Flags,
IN ULONG FileType,
- IN PVOID HiveData,
+ IN PVOID HiveData OPTIONAL,
IN HANDLE Primary,
IN HANDLE Log,
IN HANDLE External,
- IN PUNICODE_STRING FileName,
+ IN CONST UNICODE_STRING* FileName OPTIONAL,
IN ULONG CheckFlags
);
@@ -953,11 +953,13 @@
IN PSECURITY_DESCRIPTOR SecurityDescriptor
);
+/* NOTE: This function declaration is currently duplicated in both */
+/* cm/cm.h and config/cm.h. TODO: Pick one single place to declare it. */
NTSTATUS
NTAPI
CmpOpenHiveFiles(
- IN PUNICODE_STRING BaseName,
- IN PWCHAR Extension OPTIONAL,
+ IN CONST UNICODE_STRING* BaseName,
+ IN PCWSTR Extension OPTIONAL,
IN PHANDLE Primary,
IN PHANDLE Log,
IN PULONG PrimaryDisposition,
@@ -1047,7 +1049,7 @@
LONG
NTAPI
CmpCompareCompressedName(
- IN PUNICODE_STRING SearchName,
+ IN CONST UNICODE_STRING* SearchName,
IN PWCHAR CompressedName,
IN ULONG NameLength
);
@@ -1116,12 +1118,15 @@
//
// Cell Index Routines
//
+
+/* NOTE: This function declaration is currently duplicated in both */
+/* cm/cm.h and config/cm.h. TODO: Pick one single place to declare it. */
HCELL_INDEX
NTAPI
CmpFindSubKeyByName(
IN PHHIVE Hive,
IN PCM_KEY_NODE Parent,
- IN PUNICODE_STRING SearchName
+ IN CONST UNICODE_STRING* SearchName
);
HCELL_INDEX
@@ -1136,7 +1141,7 @@
NTAPI
CmpComputeHashKey(
IN ULONG Hash,
- IN PUNICODE_STRING Name,
+ IN CONST UNICODE_STRING* Name,
IN BOOLEAN AllowSeparators
);
Modified: trunk/reactos/ntoskrnl/config/cmindex.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmindex.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmindex.c (original)
+++ trunk/reactos/ntoskrnl/config/cmindex.c Tue Oct 16 09:39:47 2007
@@ -27,10 +27,10 @@
/* FUNCTIONS *****************************************************************/
-LONG
+static LONG
NTAPI
CmpDoCompareKeyName(IN PHHIVE Hive,
- IN PUNICODE_STRING SearchName,
+ IN CONST UNICODE_STRING* SearchName,
IN HCELL_INDEX Cell)
{
PCM_KEY_NODE Node;
@@ -63,10 +63,10 @@
return (Result == 0) ? Result : ((Result > 0) ? 1 : -1);
}
-LONG
+static LONG
NTAPI
CmpCompareInIndex(IN PHHIVE Hive,
- IN PUNICODE_STRING SearchName,
+ IN CONST UNICODE_STRING* SearchName,
IN ULONG Count,
IN PCM_KEY_INDEX Index,
IN PHCELL_INDEX SubKey)
@@ -139,11 +139,11 @@
return Result;
}
-ULONG
+static ULONG
NTAPI
CmpFindSubKeyInRoot(IN PHHIVE Hive,
IN PCM_KEY_INDEX Index,
- IN PUNICODE_STRING SearchName,
+ IN CONST UNICODE_STRING* SearchName,
IN PHCELL_INDEX SubKey)
{
ULONG High, Low = 0, i, ReturnIndex;
@@ -355,11 +355,11 @@
return ReturnIndex;
}
-ULONG
+static ULONG
NTAPI
CmpFindSubKeyInLeaf(IN PHHIVE Hive,
IN PCM_KEY_INDEX Index,
- IN PUNICODE_STRING SearchName,
+ IN CONST UNICODE_STRING* SearchName,
IN PHCELL_INDEX SubKey)
{
ULONG High, Low = 0, i;
@@ -473,7 +473,7 @@
ULONG
NTAPI
CmpComputeHashKey(IN ULONG Hash,
- IN PUNICODE_STRING Name,
+ IN CONST UNICODE_STRING* Name,
IN BOOLEAN AllowSeparators)
{
LPWSTR Cp;
@@ -657,11 +657,11 @@
return HCELL_NIL;
}
-HCELL_INDEX
+static HCELL_INDEX
NTAPI
CmpFindSubKeyByHash(IN PHHIVE Hive,
IN PCM_KEY_FAST_INDEX FastIndex,
- IN PUNICODE_STRING SearchName)
+ IN CONST UNICODE_STRING* SearchName)
{
ULONG HashKey, i;
PCM_INDEX FastEntry;
@@ -698,7 +698,7 @@
NTAPI
CmpFindSubKeyByName(IN PHHIVE Hive,
IN PCM_KEY_NODE Parent,
- IN PUNICODE_STRING SearchName)
+ IN CONST UNICODE_STRING* SearchName)
{
ULONG i;
PCM_KEY_INDEX IndexRoot;
Modified: trunk/reactos/ntoskrnl/config/cminit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cminit.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cminit.c (original)
+++ trunk/reactos/ntoskrnl/config/cminit.c Tue Oct 16 09:39:47 2007
@@ -25,7 +25,7 @@
IN HANDLE Primary,
IN HANDLE Log,
IN HANDLE External,
- IN PUNICODE_STRING FileName OPTIONAL,
+ IN CONST UNICODE_STRING* FileName OPTIONAL,
IN ULONG CheckFlags)
{
#if 0
@@ -240,8 +240,8 @@
NTSTATUS
NTAPI
-CmpOpenHiveFiles(IN PUNICODE_STRING BaseName,
- IN PWCHAR Extension OPTIONAL,
+CmpOpenHiveFiles(IN CONST UNICODE_STRING* BaseName,
+ IN PCWSTR Extension OPTIONAL,
IN PHANDLE Primary,
IN PHANDLE Log,
IN PULONG PrimaryDisposition,
Modified: trunk/reactos/ntoskrnl/config/cmname.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmname.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmname.c (original)
+++ trunk/reactos/ntoskrnl/config/cmname.c Tue Oct 16 09:39:47 2007
@@ -107,7 +107,7 @@
LONG
NTAPI
-CmpCompareCompressedName(IN PUNICODE_STRING SearchName,
+CmpCompareCompressedName(IN CONST UNICODE_STRING* SearchName,
IN PWCHAR CompressedName,
IN ULONG NameLength)
{
Modified: trunk/reactos/ntoskrnl/config/cmsysini.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmsysini.c (original)
+++ trunk/reactos/ntoskrnl/config/cmsysini.c Tue Oct 16 09:39:47 2007
@@ -22,7 +22,7 @@
NTSTATUS
NTAPI
-CmpInitHiveFromFile(IN PUNICODE_STRING HiveName,
+CmpInitHiveFromFile(IN CONST UNICODE_STRING* HiveName,
IN ULONG HiveFlags,
OUT PCMHIVE *Hive,
IN OUT PBOOLEAN New,
Modified: trunk/reactos/ntoskrnl/config/cmvalche.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmvalche.c…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmvalche.c (original)
+++ trunk/reactos/ntoskrnl/config/cmvalche.c Tue Oct 16 09:39:47 2007
@@ -186,7 +186,7 @@
VALUE_SEARCH_RETURN_TYPE
NTAPI
CmpFindValueByNameFromCache(IN PKEY_OBJECT KeyObject,
- IN PUNICODE_STRING Name,
+ IN CONST UNICODE_STRING* Name,
OUT PCM_CACHED_VALUE **CachedValue,
OUT ULONG *Index,
OUT PCM_KEY_VALUE *Value,