https://git.reactos.org/?p=reactos.git;a=commitdiff;h=54a00aa8ebddbbfdc8261…
commit 54a00aa8ebddbbfdc8261f918d19888cd5e41ecd
Author: George Bișoc <fraizeraust99(a)gmail.com>
AuthorDate: Sun Jul 10 14:35:53 2022 +0200
Commit: George Bișoc <fraizeraust99(a)gmail.com>
CommitDate: Sun Jul 10 14:35:53 2022 +0200
[CMLIB][NTOS:CM] Deduplicate other common definitions between CMLIB and the NTOS CM
Addendum to commit 8c2454e (r70605). Credits and courtesy go to Hermès BÉLUSCA -
MAÏTO.
CORE-10802 CORE-10793
---
ntoskrnl/include/internal/cm.h | 84 ++----------------------------------------
sdk/lib/cmlib/cmlib.h | 26 ++++++-------
2 files changed, 15 insertions(+), 95 deletions(-)
diff --git a/ntoskrnl/include/internal/cm.h b/ntoskrnl/include/internal/cm.h
index bd3dbe515e8..423c65b9a8d 100644
--- a/ntoskrnl/include/internal/cm.h
+++ b/ntoskrnl/include/internal/cm.h
@@ -40,12 +40,6 @@
#define CMTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__)
#endif
-//
-// Hack since bigkeys are not yet supported
-//
-#define ASSERT_VALUE_BIG(h, s) \
- ASSERTMSG("Big keys not supported!\n", !CmpIsKeyValueBig(h, s));
-
//
// CM_KEY_CONTROL_BLOCK Signatures
//
@@ -67,19 +61,14 @@
//
// CM_KEY_BODY Types
//
-#define CM_KEY_BODY_TYPE 0x6B793032
-
-//
-// CM_KEY_VALUE Types
-//
-#define CM_KEY_VALUE_SMALL 0x4
-#define CM_KEY_VALUE_BIG 0x3FD8
-#define CM_KEY_VALUE_SPECIAL_SIZE 0x80000000
+#define CM_KEY_BODY_TYPE 0x6B793032 // 'ky02'
//
// Number of various lists and hashes
//
+#if 0 // See sdk/lib/cmlib/cmlib.h
#define CMP_SECURITY_HASH_LISTS 64
+#endif
#define CMP_MAX_CALLBACKS 100
//
@@ -115,7 +104,7 @@
//
// Maximum size of Value Cache
//
-#define MAXIMUM_CACHED_DATA 2 * PAGE_SIZE
+#define MAXIMUM_CACHED_DATA (2 * PAGE_SIZE)
//
// Hives to load on startup
@@ -373,71 +362,6 @@ typedef struct _CM_DELAY_DEREF_KCB_ITEM
PCM_KEY_CONTROL_BLOCK Kcb;
} CM_DELAY_DEREF_KCB_ITEM, *PCM_DELAY_DEREF_KCB_ITEM;
-//
-// Use Count Log and Entry
-//
-typedef struct _CM_USE_COUNT_LOG_ENTRY
-{
- HCELL_INDEX Cell;
- PVOID Stack[7];
-} CM_USE_COUNT_LOG_ENTRY, *PCM_USE_COUNT_LOG_ENTRY;
-
-typedef struct _CM_USE_COUNT_LOG
-{
- USHORT Next;
- USHORT Size;
- CM_USE_COUNT_LOG_ENTRY Log[32];
-} CM_USE_COUNT_LOG, *PCM_USE_COUNT_LOG;
-
-//
-// Configuration Manager Hive Structure
-//
-typedef struct _CMHIVE
-{
- HHIVE Hive;
- HANDLE FileHandles[HFILE_TYPE_MAX];
- LIST_ENTRY NotifyList;
- LIST_ENTRY HiveList;
- EX_PUSH_LOCK HiveLock;
- PKTHREAD HiveLockOwner;
- PKGUARDED_MUTEX ViewLock;
- PKTHREAD ViewLockOwner;
- EX_PUSH_LOCK WriterLock;
- PKTHREAD WriterLockOwner;
- PERESOURCE FlusherLock;
- EX_PUSH_LOCK SecurityLock;
- PKTHREAD HiveSecurityLockOwner;
- LIST_ENTRY LRUViewListHead;
- LIST_ENTRY PinViewListHead;
- PFILE_OBJECT FileObject;
- UNICODE_STRING FileFullPath;
- UNICODE_STRING FileUserName;
- USHORT MappedViews;
- USHORT PinnedViews;
- ULONG UseCount;
- ULONG SecurityCount;
- ULONG SecurityCacheSize;
- LONG SecurityHitHint;
- PCM_KEY_SECURITY_CACHE_ENTRY SecurityCache;
- LIST_ENTRY SecurityHash[CMP_SECURITY_HASH_LISTS];
- PKEVENT UnloadEvent;
- PCM_KEY_CONTROL_BLOCK RootKcb;
- BOOLEAN Frozen;
- PWORK_QUEUE_ITEM UnloadWorkItem;
- BOOLEAN GrowOnlyMode;
- ULONG GrowOffset;
- LIST_ENTRY KcbConvertListHead;
- LIST_ENTRY KnodeConvertListHead;
- PCM_CELL_REMAP_BLOCK CellRemapArray;
- CM_USE_COUNT_LOG UseCountLog;
- CM_USE_COUNT_LOG LockHiveLog;
- ULONG Flags;
- LIST_ENTRY TrustClassEntry;
- ULONG FlushCount;
- BOOLEAN HiveIsLoading;
- PKTHREAD CreatorOwner;
-} CMHIVE, *PCMHIVE;
-
//
// Cached Value Index
//
diff --git a/sdk/lib/cmlib/cmlib.h b/sdk/lib/cmlib/cmlib.h
index e4ae010702e..d1b8c0656fe 100644
--- a/sdk/lib/cmlib/cmlib.h
+++ b/sdk/lib/cmlib/cmlib.h
@@ -122,7 +122,7 @@
IN PRTL_BITMAP BitMapHeader);
#define RtlCheckBit(BMH,BP) (((((PLONG)(BMH)->Buffer)[(BP) / 32]) >> ((BP) %
32)) & 0x1)
- #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
+ #define UNREFERENCED_PARAMETER(P) ((void)(P))
#define PKTHREAD PVOID
#define PKGUARDED_MUTEX PVOID
@@ -152,7 +152,9 @@
#undef PAGED_CODE
#define PAGED_CODE()
#define REGISTRY_ERROR ((ULONG)0x00000051L)
+
#else
+
//
// Debug/Tracing support
//
@@ -214,17 +216,13 @@
#include "hivedata.h"
#include "cmdata.h"
-#if defined(_TYPEDEFS_HOST_H) || defined(_BLDR_)
-
-#define PCM_KEY_SECURITY_CACHE_ENTRY PVOID
-#define PCM_KEY_CONTROL_BLOCK PVOID
-#define PCM_CELL_REMAP_BLOCK PVOID
+/* Forward declarations */
+typedef struct _CM_KEY_SECURITY_CACHE_ENTRY *PCM_KEY_SECURITY_CACHE_ENTRY;
+typedef struct _CM_KEY_CONTROL_BLOCK *PCM_KEY_CONTROL_BLOCK;
+typedef struct _CM_CELL_REMAP_BLOCK *PCM_CELL_REMAP_BLOCK;
-// See also ntoskrnl/include/internal/cm.h
-#define CMP_SECURITY_HASH_LISTS 64
-
-// #endif // Commented out until one finds a way to properly include
- // this header in the bootloader and in ntoskrnl.
+// See ntoskrnl/include/internal/cm.h
+#define CMP_SECURITY_HASH_LISTS 64
//
// Use Count Log and Entry
@@ -291,8 +289,6 @@ typedef struct _CMHIVE
PKTHREAD CreatorOwner;
} CMHIVE, *PCMHIVE;
-#endif // See comment above
-
typedef struct _HV_HIVE_CELL_PAIR
{
PHHIVE Hive;
@@ -312,9 +308,9 @@ typedef struct _HV_TRACK_CELL_REF
extern ULONG CmlibTraceLevel;
//
-// Hack since bigkeys are not yet supported
+// Hack since big keys are not yet supported
//
-#define ASSERT_VALUE_BIG(h, s) \
+#define ASSERT_VALUE_BIG(h, s) \
ASSERTMSG("Big keys not supported!\n", !CmpIsKeyValueBig(h, s));
//