-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
cmlib.h
799 lines (679 loc) · 16.6 KB
/
cmlib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
/*
* PROJECT: Registry manipulation library
* LICENSE: GPL - See COPYING in the top level directory
* COPYRIGHT: Copyright 2005 Filip Navara <navaraf@reactos.org>
* Copyright 2001 - 2005 Eric Kohl
*/
#ifndef _CMLIB_H_
#define _CMLIB_H_
//
// Debug support switch
//
#define _CMLIB_DEBUG_ 1
#ifdef CMLIB_HOST
#include <typedefs.h>
#include <stdio.h>
#include <string.h>
// NTDDI_xxx versions we allude to in the library (see psdk/sdkddkver.h)
#define NTDDI_WS03SP4 0x05020400
#define NTDDI_WIN6 0x06000000
#define NTDDI_LONGHORN NTDDI_WIN6
#define NTDDI_VISTA NTDDI_WIN6
#define NTDDI_WIN7 0x06010000
#define NTDDI_VERSION NTDDI_WS03SP4 // This is the ReactOS NT kernel version
/* C_ASSERT Definition */
#define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
#ifdef _WIN32
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif // _WIN32
#if (!defined(_MSC_VER) || (_MSC_VER < 1500))
#define _In_
#define _Out_
#define _Inout_
#define _In_opt_
#define _In_range_(x, y)
#endif
#define __drv_aliasesMem
#ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif
// #ifndef max
// #define max(a, b) (((a) > (b)) ? (a) : (b))
// #endif
// Definitions copied from <ntstatus.h>
// We only want to include host headers, so we define them manually
#define STATUS_SUCCESS ((NTSTATUS)0x00000000)
#define STATUS_NOT_IMPLEMENTED ((NTSTATUS)0xC0000002)
#define STATUS_NO_MEMORY ((NTSTATUS)0xC0000017)
#define STATUS_INSUFFICIENT_RESOURCES ((NTSTATUS)0xC000009A)
#define STATUS_REGISTRY_CORRUPT ((NTSTATUS)0xC000014C)
#define STATUS_NOT_REGISTRY_FILE ((NTSTATUS)0xC000015C)
#define STATUS_REGISTRY_RECOVERED ((NTSTATUS)0x40000009)
#define REG_OPTION_VOLATILE 1
#define OBJ_CASE_INSENSITIVE 0x00000040L
#define USHORT_MAX USHRT_MAX
#define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\')
#define UNICODE_NULL ((WCHAR)0)
VOID NTAPI
RtlInitUnicodeString(
IN OUT PUNICODE_STRING DestinationString,
IN PCWSTR SourceString);
LONG NTAPI
RtlCompareUnicodeString(
IN PCUNICODE_STRING String1,
IN PCUNICODE_STRING String2,
IN BOOLEAN CaseInSensitive);
// FIXME: DECLSPEC_NORETURN
VOID
NTAPI
KeBugCheckEx(
IN ULONG BugCheckCode,
IN ULONG_PTR BugCheckParameter1,
IN ULONG_PTR BugCheckParameter2,
IN ULONG_PTR BugCheckParameter3,
IN ULONG_PTR BugCheckParameter4);
VOID NTAPI
KeQuerySystemTime(
OUT PLARGE_INTEGER CurrentTime);
WCHAR NTAPI
RtlUpcaseUnicodeChar(
IN WCHAR Source);
VOID NTAPI
RtlInitializeBitMap(
IN PRTL_BITMAP BitMapHeader,
IN PULONG BitMapBuffer,
IN ULONG SizeOfBitMap);
ULONG NTAPI
RtlFindSetBits(
IN PRTL_BITMAP BitMapHeader,
IN ULONG NumberToFind,
IN ULONG HintIndex);
VOID NTAPI
RtlSetBits(
IN PRTL_BITMAP BitMapHeader,
IN ULONG StartingIndex,
IN ULONG NumberToSet);
VOID NTAPI
RtlClearAllBits(
IN PRTL_BITMAP BitMapHeader);
#define RtlCheckBit(BMH,BP) (((((PLONG)(BMH)->Buffer)[(BP) / 32]) >> ((BP) % 32)) & 0x1)
#define UNREFERENCED_PARAMETER(P) ((void)(P))
#define PKTHREAD PVOID
#define PKGUARDED_MUTEX PVOID
#define PERESOURCE PVOID
#define PFILE_OBJECT PVOID
#define PKEVENT PVOID
#define PWORK_QUEUE_ITEM PVOID
#define EX_PUSH_LOCK PULONG_PTR
// Definitions copied from <ntifs.h>
// We only want to include host headers, so we define them manually
typedef USHORT SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
typedef struct _SECURITY_DESCRIPTOR_RELATIVE
{
UCHAR Revision;
UCHAR Sbz1;
SECURITY_DESCRIPTOR_CONTROL Control;
ULONG Owner;
ULONG Group;
ULONG Sacl;
ULONG Dacl;
} SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
#define CMLTRACE(x, ...)
#undef PAGED_CODE
#define PAGED_CODE()
#define REGISTRY_ERROR ((ULONG)0x00000051L)
#else
//
// Debug/Tracing support
//
#if _CMLIB_DEBUG_
#ifdef NEW_DEBUG_SYSTEM_IMPLEMENTED // enable when Debug Filters are implemented
#define CMLTRACE DbgPrintEx
#else
#define CMLTRACE(x, ...) \
if (x & CmlibTraceLevel) DbgPrint(__VA_ARGS__)
#endif
#else
#define CMLTRACE(x, ...) DPRINT(__VA_ARGS__)
#endif
#include <ntdef.h>
#include <ntifs.h>
#include <bugcodes.h>
#undef PAGED_CODE
#define PAGED_CODE()
/* Prevent inclusion of Windows headers through <wine/unicode.h> */
#define _WINDEF_
#define _WINBASE_
#define _WINNLS_
#endif
//
// These define the Debug Masks Supported
//
#define CMLIB_HCELL_DEBUG 0x01
#ifndef ROUND_UP
#define ROUND_UP(a,b) ((((a)+(b)-1)/(b))*(b))
#define ROUND_DOWN(a,b) (((a)/(b))*(b))
#endif
//
// PAGE_SIZE definition
//
#ifndef PAGE_SIZE
#if defined(TARGET_i386) || defined(TARGET_amd64) || \
defined(TARGET_arm) || defined(TARGET_arm64)
#define PAGE_SIZE 0x1000
#else
#error Local PAGE_SIZE definition required when built as host
#endif
#endif
#define TAG_CM ' MC'
#define TAG_KCB 'bkMC'
#define TAG_CMHIVE 'vHMC'
#define TAG_CMSD 'DSMC'
#define CMAPI NTAPI
//
// Check Registry status type definition
//
#define CM_CHECK_REGISTRY_STATUS ULONG
//
// Check Registry flags
//
#define CM_CHECK_REGISTRY_PURGE 0x1
#define CM_CHECK_REGISTRY_MANDATORY_PURGE 0x2
#define CM_CHECK_REGISTRY_BOOTLOADER_PURGE 0x4
#define CM_CHECK_REGISTRY_SYSTEM_PURGE 0x8
#define CM_CHECK_REGISTRY_VALIDATE_HIVE 0x10
#define CM_CHECK_REGISTRY_VALID_FLAGS (CM_CHECK_REGISTRY_PURGE | \
CM_CHECK_REGISTRY_MANDATORY_PURGE | \
CM_CHECK_REGISTRY_BOOTLOADER_PURGE | \
CM_CHECK_REGISTRY_SYSTEM_PURGE | \
CM_CHECK_REGISTRY_VALIDATE_HIVE)
//
// Check Registry success macro
//
#define CM_CHECK_REGISTRY_SUCCESS(StatusCode) ((ULONG)(StatusCode) >= 0)
//
// Check Registry status codes
//
#define CM_CHECK_REGISTRY_GOOD 0
#define CM_CHECK_REGISTRY_SD_INVALID 1000
#define CM_CHECK_REGISTRY_HIVE_CORRUPT_SIGNATURE 2000
#define CM_CHECK_REGISTRY_BIN_HEADER_CORRUPT 3000
#define CM_CHECK_REGISTRY_FREE_CELL_EXCEEDS_BIN_SIZE 3010
#define CM_CHECK_REGISTRY_ALLOC_CELL_EXCEEDS_BIN_SIZE 3020
#define CM_CHECK_REGISTRY_BAD_CELL_IN_BIN 3030
#include <wine/unicode.h>
#include <wchar.h>
#include "hivedata.h"
#include "cmdata.h"
/* 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 ntoskrnl/include/internal/cm.h
#define CMP_SECURITY_HASH_LISTS 64
//
// 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;
typedef struct _HV_HIVE_CELL_PAIR
{
PHHIVE Hive;
HCELL_INDEX Cell;
} HV_HIVE_CELL_PAIR, *PHV_HIVE_CELL_PAIR;
#define STATIC_CELL_PAIR_COUNT 4
typedef struct _HV_TRACK_CELL_REF
{
USHORT Count;
USHORT Max;
PHV_HIVE_CELL_PAIR CellArray;
HV_HIVE_CELL_PAIR StaticArray[STATIC_CELL_PAIR_COUNT];
USHORT StaticCount;
} HV_TRACK_CELL_REF, *PHV_TRACK_CELL_REF;
extern ULONG CmlibTraceLevel;
//
// Hack since big keys are not yet supported
//
#define ASSERT_VALUE_BIG(h, s) \
ASSERTMSG("Big keys not supported!\n", !CmpIsKeyValueBig(h, s));
//
// Returns whether or not this is a small valued key
//
static inline
BOOLEAN
CmpIsKeyValueSmall(OUT PULONG RealLength,
IN ULONG Length)
{
/* Check if the length has the special size value */
if (Length >= CM_KEY_VALUE_SPECIAL_SIZE)
{
/* It does, so this is a small key: return the real length */
*RealLength = Length - CM_KEY_VALUE_SPECIAL_SIZE;
return TRUE;
}
/* This is not a small key, return the length we read */
*RealLength = Length;
return FALSE;
}
//
// Returns whether or not this is a big valued key
//
static inline
BOOLEAN
CmpIsKeyValueBig(IN PHHIVE Hive,
IN ULONG Length)
{
/* Check if the hive is XP Beta 1 or newer */
if (Hive->Version >= HSYS_WHISTLER_BETA1)
{
/* Check if the key length is valid for a big value key */
if ((Length < CM_KEY_VALUE_SPECIAL_SIZE) && (Length > CM_KEY_VALUE_BIG))
{
/* Yes, this value is big */
return TRUE;
}
}
/* Not a big value key */
return FALSE;
}
/*
* Public Hive functions.
*/
NTSTATUS CMAPI
HvInitialize(
PHHIVE RegistryHive,
ULONG OperationType,
ULONG HiveFlags,
ULONG FileType,
PVOID HiveData OPTIONAL,
PALLOCATE_ROUTINE Allocate,
PFREE_ROUTINE Free,
PFILE_SET_SIZE_ROUTINE FileSetSize,
PFILE_WRITE_ROUTINE FileWrite,
PFILE_READ_ROUTINE FileRead,
PFILE_FLUSH_ROUTINE FileFlush,
ULONG Cluster OPTIONAL,
PCUNICODE_STRING FileName OPTIONAL);
VOID CMAPI
HvFree(
PHHIVE RegistryHive);
#define HvGetCell(Hive, Cell) \
(Hive)->GetCellRoutine(Hive, Cell)
#define HvReleaseCell(Hive, Cell) \
do { \
if ((Hive)->ReleaseCellRoutine) \
(Hive)->ReleaseCellRoutine(Hive, Cell); \
} while(0)
LONG CMAPI
HvGetCellSize(
PHHIVE RegistryHive,
PVOID Cell);
HCELL_INDEX CMAPI
HvAllocateCell(
PHHIVE RegistryHive,
ULONG Size,
HSTORAGE_TYPE Storage,
IN HCELL_INDEX Vicinity);
BOOLEAN CMAPI
HvIsCellAllocated(
IN PHHIVE RegistryHive,
IN HCELL_INDEX CellIndex
);
HCELL_INDEX CMAPI
HvReallocateCell(
PHHIVE RegistryHive,
HCELL_INDEX CellOffset,
ULONG Size);
VOID CMAPI
HvFreeCell(
PHHIVE RegistryHive,
HCELL_INDEX CellOffset);
BOOLEAN CMAPI
HvMarkCellDirty(
PHHIVE RegistryHive,
HCELL_INDEX CellOffset,
BOOLEAN HoldingLock);
BOOLEAN CMAPI
HvIsCellDirty(
IN PHHIVE Hive,
IN HCELL_INDEX Cell
);
BOOLEAN
CMAPI
HvHiveWillShrink(
IN PHHIVE RegistryHive
);
BOOLEAN CMAPI
HvSyncHive(
PHHIVE RegistryHive);
BOOLEAN CMAPI
HvWriteHive(
PHHIVE RegistryHive);
BOOLEAN
CMAPI
HvTrackCellRef(
IN OUT PHV_TRACK_CELL_REF CellRef,
IN PHHIVE Hive,
IN HCELL_INDEX Cell
);
VOID
CMAPI
HvReleaseFreeCellRefArray(
IN OUT PHV_TRACK_CELL_REF CellRef
);
/*
* Private functions.
*/
PCELL_DATA CMAPI
HvpGetCellData(
_In_ PHHIVE Hive,
_In_ HCELL_INDEX CellIndex);
PHBIN CMAPI
HvpAddBin(
PHHIVE RegistryHive,
ULONG Size,
HSTORAGE_TYPE Storage);
NTSTATUS CMAPI
HvpCreateHiveFreeCellList(
PHHIVE Hive);
ULONG CMAPI
HvpHiveHeaderChecksum(
PHBASE_BLOCK HiveHeader);
/* Old-style Public "Cmlib" functions */
BOOLEAN CMAPI
CmCreateRootNode(
PHHIVE Hive,
PCWSTR Name);
VOID CMAPI
CmPrepareHive(
PHHIVE RegistryHive);
/* NT-style Public Cm functions */
//
// Check Registry Routines
//
BOOLEAN
NTAPI
CmpValidateSDsOfHive(
_In_ PHHIVE Hive,
_Out_ PBOOLEAN SecurityDefaulted);
CM_CHECK_REGISTRY_STATUS
NTAPI
HvValidateBin(
_In_ PHBIN Bin,
_In_ PHHIVE Hive,
_In_ ULONG StorageIndex,
_In_ ULONG StorageLength);
CM_CHECK_REGISTRY_STATUS
NTAPI
HvValidateHive(
_In_ PHHIVE Hive);
CM_CHECK_REGISTRY_STATUS
NTAPI
CmCheckRegistry(
_In_ PCMHIVE RegistryHive,
_In_ ULONG Flags);
//
// Cell Index Routines
//
HCELL_INDEX
NTAPI
CmpFindSubKeyByName(
IN PHHIVE Hive,
IN PCM_KEY_NODE Parent,
IN PCUNICODE_STRING SearchName
);
HCELL_INDEX
NTAPI
CmpFindSubKeyByNumber(
IN PHHIVE Hive,
IN PCM_KEY_NODE Node,
IN ULONG Number
);
ULONG
NTAPI
CmpComputeHashKey(
IN ULONG Hash,
IN PCUNICODE_STRING Name,
IN BOOLEAN AllowSeparators
);
BOOLEAN
NTAPI
CmpAddSubKey(
IN PHHIVE Hive,
IN HCELL_INDEX Parent,
IN HCELL_INDEX Child
);
BOOLEAN
NTAPI
CmpRemoveSubKey(
IN PHHIVE Hive,
IN HCELL_INDEX ParentKey,
IN HCELL_INDEX TargetKey
);
BOOLEAN
NTAPI
CmpMarkIndexDirty(
IN PHHIVE Hive,
HCELL_INDEX ParentKey,
HCELL_INDEX TargetKey
);
//
// Name Functions
//
LONG
NTAPI
CmpCompareCompressedName(
IN PCUNICODE_STRING SearchName,
IN PWCHAR CompressedName,
IN ULONG NameLength
);
USHORT
NTAPI
CmpNameSize(
IN PHHIVE Hive,
IN PCUNICODE_STRING Name
);
USHORT
NTAPI
CmpCompressedNameSize(
IN PWCHAR Name,
IN ULONG Length
);
USHORT
NTAPI
CmpCopyName(
IN PHHIVE Hive,
OUT PWCHAR Destination,
IN PCUNICODE_STRING Source
);
VOID
NTAPI
CmpCopyCompressedName(
OUT PWCHAR Destination,
IN ULONG DestinationLength,
IN PWCHAR Source,
IN ULONG SourceLength
);
BOOLEAN
NTAPI
CmpFindNameInList(
IN PHHIVE Hive,
IN PCHILD_LIST ChildList,
IN PCUNICODE_STRING Name,
OUT PULONG ChildIndex OPTIONAL,
OUT PHCELL_INDEX CellIndex
);
//
// Cell Value Routines
//
HCELL_INDEX
NTAPI
CmpFindValueByName(
IN PHHIVE Hive,
IN PCM_KEY_NODE KeyNode,
IN PCUNICODE_STRING Name
);
PCELL_DATA
NTAPI
CmpValueToData(
IN PHHIVE Hive,
IN PCM_KEY_VALUE Value,
OUT PULONG Length
);
NTSTATUS
NTAPI
CmpSetValueDataNew(
IN PHHIVE Hive,
IN PVOID Data,
IN ULONG DataSize,
IN HSTORAGE_TYPE StorageType,
IN HCELL_INDEX ValueCell,
OUT PHCELL_INDEX DataCell
);
NTSTATUS
NTAPI
CmpAddValueToList(
IN PHHIVE Hive,
IN HCELL_INDEX ValueCell,
IN ULONG Index,
IN HSTORAGE_TYPE StorageType,
IN OUT PCHILD_LIST ChildList
);
BOOLEAN
NTAPI
CmpFreeValue(
IN PHHIVE Hive,
IN HCELL_INDEX Cell
);
BOOLEAN
NTAPI
CmpMarkValueDataDirty(
IN PHHIVE Hive,
IN PCM_KEY_VALUE Value
);
BOOLEAN
NTAPI
CmpFreeValueData(
IN PHHIVE Hive,
IN HCELL_INDEX DataCell,
IN ULONG DataLength
);
NTSTATUS
NTAPI
CmpRemoveValueFromList(
IN PHHIVE Hive,
IN ULONG Index,
IN OUT PCHILD_LIST ChildList
);
BOOLEAN
NTAPI
CmpGetValueData(
IN PHHIVE Hive,
IN PCM_KEY_VALUE Value,
OUT PULONG Length,
OUT PVOID *Buffer,
OUT PBOOLEAN BufferAllocated,
OUT PHCELL_INDEX CellToRelease
);
NTSTATUS
NTAPI
CmpCopyKeyValueList(
IN PHHIVE SourceHive,
IN PCHILD_LIST SrcValueList,
IN PHHIVE DestinationHive,
IN OUT PCHILD_LIST DestValueList,
IN HSTORAGE_TYPE StorageType
);
NTSTATUS
NTAPI
CmpFreeKeyByCell(
IN PHHIVE Hive,
IN HCELL_INDEX Cell,
IN BOOLEAN Unlink
);
VOID
NTAPI
CmpRemoveSecurityCellList(
IN PHHIVE Hive,
IN HCELL_INDEX SecurityCell
);
VOID
NTAPI
CmpFreeSecurityDescriptor(
IN PHHIVE Hive,
IN HCELL_INDEX Cell
);
/******************************************************************************/
/* To be implemented by the user of this library */
PVOID
NTAPI
CmpAllocate(
IN SIZE_T Size,
IN BOOLEAN Paged,
IN ULONG Tag
);
VOID
NTAPI
CmpFree(
IN PVOID Ptr,
IN ULONG Quota
);
#endif /* _CMLIB_H_ */