- Initialize more fields when creating an Object Type
[reactos.git] / reactos / ntoskrnl / cm / cm.h
1 #ifndef __INCLUDE_CM_H
2 #define __INCLUDE_CM_H
3
4 #ifdef DBG
5 #define CHECKED 1
6 #else
7 #define CHECKED 0
8 #endif
9
10 #define REG_ROOT_KEY_NAME L"\\Registry"
11 #define REG_MACHINE_KEY_NAME L"\\Registry\\Machine"
12 #define REG_HARDWARE_KEY_NAME L"\\Registry\\Machine\\HARDWARE"
13 #define REG_DESCRIPTION_KEY_NAME L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION"
14 #define REG_DEVICEMAP_KEY_NAME L"\\Registry\\Machine\\HARDWARE\\DEVICEMAP"
15 #define REG_RESOURCEMAP_KEY_NAME L"\\Registry\\Machine\\HARDWARE\\RESOURCEMAP"
16 #define REG_CLASSES_KEY_NAME L"\\Registry\\Machine\\Software\\Classes"
17 #define REG_SYSTEM_KEY_NAME L"\\Registry\\Machine\\SYSTEM"
18 #define REG_SOFTWARE_KEY_NAME L"\\Registry\\Machine\\SOFTWARE"
19 #define REG_SAM_KEY_NAME L"\\Registry\\Machine\\SAM"
20 #define REG_SEC_KEY_NAME L"\\Registry\\Machine\\SECURITY"
21 #define REG_USER_KEY_NAME L"\\Registry\\User"
22 #define REG_DEFAULT_USER_KEY_NAME L"\\Registry\\User\\.Default"
23 #define REG_CURRENT_USER_KEY_NAME L"\\Registry\\User\\CurrentUser"
24
25 #define SYSTEM_REG_FILE L"\\SystemRoot\\System32\\Config\\SYSTEM"
26 #define SYSTEM_LOG_FILE L"\\SystemRoot\\System32\\Config\\SYSTEM.log"
27 #define SOFTWARE_REG_FILE L"\\SystemRoot\\System32\\Config\\SOFTWARE"
28 #define DEFAULT_USER_REG_FILE L"\\SystemRoot\\System32\\Config\\DEFAULT"
29 #define SAM_REG_FILE L"\\SystemRoot\\System32\\Config\\SAM"
30 #define SEC_REG_FILE L"\\SystemRoot\\System32\\Config\\SECURITY"
31
32 #define REG_SYSTEM_FILE_NAME L"\\system"
33 #define REG_SOFTWARE_FILE_NAME L"\\software"
34 #define REG_DEFAULT_USER_FILE_NAME L"\\default"
35 #define REG_SAM_FILE_NAME L"\\sam"
36 #define REG_SEC_FILE_NAME L"\\security"
37
38 #define REG_BLOCK_SIZE 4096
39 #define REG_HBIN_DATA_OFFSET 32
40 #define REG_INIT_BLOCK_LIST_SIZE 32
41 #define REG_INIT_HASH_TABLE_SIZE 3
42 #define REG_EXTEND_HASH_TABLE_SIZE 4
43 #define REG_VALUE_LIST_CELL_MULTIPLE 4
44
45 #define REG_HIVE_ID 0x66676572
46 #define REG_BIN_ID 0x6e696268
47 #define REG_KEY_CELL_ID 0x6b6e
48 #define REG_HASH_TABLE_CELL_ID 0x666c
49 #define REG_VALUE_CELL_ID 0x6b76
50 #define REG_SECURITY_CELL_ID 0x6b73
51
52
53 // BLOCK_OFFSET = offset in file after header block
54 typedef ULONG BLOCK_OFFSET, *PBLOCK_OFFSET;
55
56 #include <pshpack1.h>
57
58 /* header for registry hive file : */
59 typedef struct _HIVE_HEADER
60 {
61 /* Hive identifier "regf" (0x66676572) */
62 ULONG BlockId;
63
64 /* Update counter */
65 ULONG UpdateCounter1;
66
67 /* Update counter */
68 ULONG UpdateCounter2;
69
70 /* When this hive file was last modified */
71 LARGE_INTEGER DateModified;
72
73 /* Registry format version ? (1?) */
74 ULONG Unused3;
75
76 /* Registry format version ? (3?) */
77 ULONG Unused4;
78
79 /* Registry format version ? (0?) */
80 ULONG Unused5;
81
82 /* Registry format version ? (1?) */
83 ULONG Unused6;
84
85 /* Offset into file from the byte after the end of the base block.
86 If the hive is volatile, this is the actual pointer to the KEY_CELL */
87 BLOCK_OFFSET RootKeyOffset;
88
89 /* Size of each hive block ? */
90 ULONG BlockSize;
91
92 /* (1?) */
93 ULONG Unused7;
94
95 /* Name of hive file */
96 WCHAR FileName[64];
97
98 /* ? */
99 ULONG Unused8[83];
100
101 /* Checksum of first 0x200 bytes */
102 ULONG Checksum;
103 } HIVE_HEADER, *PHIVE_HEADER;
104
105 typedef struct _BIN_HEADER
106 {
107 /* Bin identifier "hbin" (0x6E696268) */
108 ULONG HeaderId;
109
110 /* Block offset of this bin */
111 BLOCK_OFFSET BinOffset;
112
113 /* Size in bytes, multiple of the block size (4KB) */
114 ULONG BinSize;
115
116 /* ? */
117 ULONG Unused1;
118
119 /* When this bin was last modified */
120 LARGE_INTEGER DateModified;
121
122 /* ? */
123 ULONG Unused2;
124 } HBIN, *PHBIN;
125
126 typedef struct _CELL_HEADER
127 {
128 /* <0 if used, >0 if free */
129 LONG CellSize;
130 } CELL_HEADER, *PCELL_HEADER;
131
132 typedef struct _KEY_CELL
133 {
134 /* Size of this cell */
135 LONG CellSize;
136
137 /* Key cell identifier "kn" (0x6b6e) */
138 USHORT Id;
139
140 /* Flags */
141 USHORT Flags;
142
143 /* Time of last flush */
144 LARGE_INTEGER LastWriteTime;
145
146 /* ? */
147 ULONG UnUsed1;
148
149 /* Block offset of parent key cell */
150 BLOCK_OFFSET ParentKeyOffset;
151
152 /* Count of sub keys for the key in this key cell */
153 ULONG NumberOfSubKeys;
154
155 /* ? */
156 ULONG UnUsed2;
157
158 /* Block offset of has table for FIXME: subkeys/values? */
159 BLOCK_OFFSET HashTableOffset;
160
161 /* ? */
162 ULONG UnUsed3;
163
164 /* Count of values contained in this key cell */
165 ULONG NumberOfValues;
166
167 /* Block offset of VALUE_LIST_CELL */
168 BLOCK_OFFSET ValueListOffset;
169
170 /* Block offset of security cell */
171 BLOCK_OFFSET SecurityKeyOffset;
172
173 /* Block offset of registry key class */
174 BLOCK_OFFSET ClassNameOffset;
175
176 /* ? */
177 ULONG Unused4[5];
178
179 /* Size in bytes of key name */
180 USHORT NameSize;
181
182 /* Size of class name in bytes */
183 USHORT ClassSize;
184
185 /* Name of key (not zero terminated) */
186 UCHAR Name[0];
187 } KEY_CELL, *PKEY_CELL;
188
189 /* KEY_CELL.Flags constants */
190 #define REG_KEY_ROOT_CELL 0x0C
191 #define REG_KEY_LINK_CELL 0x10
192 #define REG_KEY_NAME_PACKED 0x20
193
194 /*
195 * Hash record
196 *
197 * HashValue:
198 * packed name: four letters of value's name
199 * otherwise: Zero!
200 */
201 typedef struct _HASH_RECORD
202 {
203 BLOCK_OFFSET KeyOffset;
204 ULONG HashValue;
205 } HASH_RECORD, *PHASH_RECORD;
206
207 typedef struct _HASH_TABLE_CELL
208 {
209 LONG CellSize;
210 USHORT Id;
211 USHORT HashTableSize;
212 HASH_RECORD Table[0];
213 } HASH_TABLE_CELL, *PHASH_TABLE_CELL;
214
215
216 typedef struct _VALUE_LIST_CELL
217 {
218 LONG CellSize;
219 BLOCK_OFFSET ValueOffset[0];
220 } VALUE_LIST_CELL, *PVALUE_LIST_CELL;
221
222 typedef struct _VALUE_CELL
223 {
224 LONG CellSize;
225 USHORT Id; // "kv"
226 USHORT NameSize; // length of Name
227 ULONG DataSize; // length of datas in the cell pointed by DataOffset
228 BLOCK_OFFSET DataOffset;// datas are here if high bit of DataSize is set
229 ULONG DataType;
230 USHORT Flags;
231 USHORT Unused1;
232 UCHAR Name[0]; /* warning : not zero terminated */
233 } VALUE_CELL, *PVALUE_CELL;
234
235 /* VALUE_CELL.Flags constants */
236 #define REG_VALUE_NAME_PACKED 0x0001
237
238 /* VALUE_CELL.DataSize mask constants */
239 #define REG_DATA_SIZE_MASK 0x7FFFFFFF
240 #define REG_DATA_IN_OFFSET 0x80000000
241
242
243 typedef struct _SECURITY_CELL
244 {
245 LONG CellSize;
246 USHORT Id; // "sk"
247 USHORT Reserved;
248 BLOCK_OFFSET PrevSecurityCell;
249 BLOCK_OFFSET NextSecurityCell;
250 ULONG RefCount;
251 ULONG SdSize;
252 UCHAR Data[0];
253 } SECURITY_CELL, *PSECURITY_CELL;
254
255
256 typedef struct _DATA_CELL
257 {
258 LONG CellSize;
259 UCHAR Data[0];
260 } DATA_CELL, *PDATA_CELL;
261
262 #include <poppack.h>
263
264
265 typedef struct _BLOCK_LIST_ENTRY
266 {
267 PHBIN Bin;
268 PVOID Block;
269 } BLOCK_LIST_ENTRY, *PBLOCK_LIST_ENTRY;
270
271
272 typedef struct _REGISTRY_HIVE
273 {
274 LIST_ENTRY HiveList;
275 ULONG Flags;
276 UNICODE_STRING HiveFileName;
277 UNICODE_STRING LogFileName;
278 ULONG FileSize;
279 PHIVE_HEADER HiveHeader;
280 ULONG UpdateCounter;
281 ULONG BlockListSize;
282 PBLOCK_LIST_ENTRY BlockList;
283 ULONG FreeListSize;
284 ULONG FreeListMax;
285 PCELL_HEADER *FreeList;
286 BLOCK_OFFSET *FreeListOffset;
287
288 PSECURITY_CELL RootSecurityCell;
289
290 PULONG BitmapBuffer;
291 RTL_BITMAP DirtyBitMap;
292 BOOLEAN HiveDirty;
293 } REGISTRY_HIVE, *PREGISTRY_HIVE;
294
295 /* REGISTRY_HIVE.Flags constants */
296 /* When set, the hive uses pointers instead of offsets. */
297 #define HIVE_POINTER 0x00000001
298
299 /* When set, the hive is not backed by a file.
300 Therefore, it can not be flushed to disk. */
301 #define HIVE_NO_FILE 0x00000002
302
303 /* When set, a modified (dirty) hive is not synchronized automatically.
304 Explicit synchronization (save/flush) works. */
305 #define HIVE_NO_SYNCH 0x00000004
306
307 #define IsPointerHive(Hive) ((Hive)->Flags & HIVE_POINTER)
308 #define IsNoFileHive(Hive) ((Hive)->Flags & HIVE_NO_FILE)
309 #define IsNoSynchHive(Hive) ((Hive)->Flags & HIVE_NO_SYNCH)
310
311
312 #define IsFreeCell(Cell)(Cell->CellSize >= 0)
313 #define IsUsedCell(Cell)(Cell->CellSize < 0)
314
315
316 /* KEY_OBJECT.Flags */
317
318 /* When set, the key is scheduled for deletion, and all
319 attempts to access the key must not succeed */
320 #define KO_MARKED_FOR_DELETE 0x00000001
321
322
323 /* Type defining the Object Manager Key Object */
324 typedef struct _KEY_OBJECT
325 {
326 /* Fields used by the Object Manager */
327 CSHORT Type;
328 CSHORT Size;
329
330 /* Key flags */
331 ULONG Flags;
332
333 /* Key name */
334 UNICODE_STRING Name;
335
336 /* Registry hive the key belongs to */
337 PREGISTRY_HIVE RegistryHive;
338
339 /* Block offset of the key cell this key belongs in */
340 BLOCK_OFFSET KeyCellOffset;
341
342 /* KEY_CELL this key belong in */
343 PKEY_CELL KeyCell;
344
345 /* Link to the parent KEY_OBJECT for this key */
346 struct _KEY_OBJECT *ParentKey;
347
348 /* Subkeys loaded in SubKeys */
349 ULONG NumberOfSubKeys;
350
351 /* Space allocated in SubKeys */
352 ULONG SizeOfSubKeys;
353
354 /* List of subkeys loaded */
355 struct _KEY_OBJECT **SubKeys;
356
357 /* List entry into the global key object list */
358 LIST_ENTRY ListEntry;
359
360 /* Time stamp for the last access by the parse routine */
361 ULONG TimeStamp;
362 } KEY_OBJECT, *PKEY_OBJECT;
363
364 /* Bits 31-22 (top 10 bits) of the cell index is the directory index */
365 #define CmiDirectoryIndex(CellIndex)(CellIndex & 0xffc000000)
366 /* Bits 21-12 (middle 10 bits) of the cell index is the table index */
367 #define CmiTableIndex(Cellndex)(CellIndex & 0x003ff000)
368 /* Bits 11-0 (bottom 12 bits) of the cell index is the byte offset */
369 #define CmiByteOffset(Cellndex)(CellIndex & 0x00000fff)
370
371
372 extern BOOLEAN CmiDoVerify;
373 extern PREGISTRY_HIVE CmiVolatileHive;
374 extern POBJECT_TYPE CmiKeyType;
375 extern KSPIN_LOCK CmiKeyListLock;
376
377 extern LIST_ENTRY CmiHiveListHead;
378
379 extern ERESOURCE CmiRegistryLock;
380
381 typedef enum _REG_NOTIFY_CLASS
382 {
383 RegNtDeleteKey,
384 RegNtPreDeleteKey = RegNtDeleteKey,
385 RegNtSetValueKey,
386 RegNtPreSetValueKey = RegNtSetValueKey,
387 RegNtDeleteValueKey,
388 RegNtPreDeleteValueKey = RegNtDeleteValueKey,
389 RegNtSetInformationKey,
390 RegNtPreSetInformationKey = RegNtSetInformationKey,
391 RegNtRenameKey,
392 RegNtPreRenameKey = RegNtRenameKey,
393 RegNtEnumerateKey,
394 RegNtPreEnumerateKey = RegNtEnumerateKey,
395 RegNtEnumerateValueKey,
396 RegNtPreEnumerateValueKey = RegNtEnumerateValueKey,
397 RegNtQueryKey,
398 RegNtPreQueryKey = RegNtQueryKey,
399 RegNtQueryValueKey,
400 RegNtPreQueryValueKey = RegNtQueryValueKey,
401 RegNtQueryMultipleValueKey,
402 RegNtPreQueryMultipleValueKey = RegNtQueryMultipleValueKey,
403 RegNtPreCreateKey,
404 RegNtPostCreateKey,
405 RegNtPreOpenKey,
406 RegNtPostOpenKey,
407 RegNtKeyHandleClose,
408 RegNtPreKeyHandleClose = RegNtKeyHandleClose,
409 RegNtPostDeleteKey,
410 RegNtPostSetValueKey,
411 RegNtPostDeleteValueKey,
412 RegNtPostSetInformationKey,
413 RegNtPostRenameKey,
414 RegNtPostEnumerateKey,
415 RegNtPostEnumerateValueKey,
416 RegNtPostQueryKey,
417 RegNtPostQueryValueKey,
418 RegNtPostQueryMultipleValueKey,
419 RegNtPostKeyHandleClose,
420 RegNtPreCreateKeyEx,
421 RegNtPostCreateKeyEx,
422 RegNtPreOpenKeyEx,
423 RegNtPostOpenKeyEx
424 } REG_NOTIFY_CLASS, *PREG_NOTIFY_CLASS;
425
426 /* Registry Callback Function */
427 typedef NTSTATUS (STDCALL *PEX_CALLBACK_FUNCTION ) (
428 IN PVOID CallbackContext,
429 IN PVOID Argument1,
430 IN PVOID Argument2
431 );
432
433 typedef struct _REGISTRY_CALLBACK
434 {
435 LIST_ENTRY ListEntry;
436 EX_RUNDOWN_REF RundownRef;
437 PEX_CALLBACK_FUNCTION Function;
438 PVOID Context;
439 LARGE_INTEGER Cookie;
440 BOOLEAN PendingDelete;
441 } REGISTRY_CALLBACK, *PREGISTRY_CALLBACK;
442
443 NTSTATUS
444 CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1,
445 IN PVOID Argument2);
446
447 VOID
448 CmiVerifyBinHeader(PHBIN BinHeader);
449 VOID
450 CmiVerifyKeyCell(PKEY_CELL KeyCell);
451 VOID
452 CmiVerifyRootKeyCell(PKEY_CELL RootKeyCell);
453 VOID
454 CmiVerifyKeyObject(PKEY_OBJECT KeyObject);
455 VOID
456 CmiVerifyRegistryHive(PREGISTRY_HIVE RegistryHive);
457
458 #ifdef DBG
459 #define VERIFY_BIN_HEADER CmiVerifyBinHeader
460 #define VERIFY_KEY_CELL CmiVerifyKeyCell
461 #define VERIFY_ROOT_KEY_CELL CmiVerifyRootKeyCell
462 #define VERIFY_VALUE_CELL CmiVerifyValueCell
463 #define VERIFY_VALUE_LIST_CELL CmiVerifyValueListCell
464 #define VERIFY_KEY_OBJECT CmiVerifyKeyObject
465 #define VERIFY_REGISTRY_HIVE CmiVerifyRegistryHive
466 #else
467 #define VERIFY_BIN_HEADER(x)
468 #define VERIFY_KEY_CELL(x)
469 #define VERIFY_ROOT_KEY_CELL(x)
470 #define VERIFY_VALUE_CELL(x)
471 #define VERIFY_VALUE_LIST_CELL(x)
472 #define VERIFY_KEY_OBJECT(x)
473 #define VERIFY_REGISTRY_HIVE(x)
474 #endif
475
476 NTSTATUS STDCALL
477 CmRegisterCallback(IN PEX_CALLBACK_FUNCTION Function,
478 IN PVOID Context,
479 IN OUT PLARGE_INTEGER Cookie
480 );
481
482 NTSTATUS STDCALL
483 CmUnRegisterCallback(IN LARGE_INTEGER Cookie);
484
485 NTSTATUS STDCALL
486 CmiObjectParse(IN PVOID ParsedObject,
487 OUT PVOID *NextObject,
488 IN PUNICODE_STRING FullPath,
489 IN OUT PWSTR *Path,
490 IN ULONG Attribute);
491
492 VOID STDCALL
493 CmiObjectDelete(PVOID DeletedObject);
494
495 NTSTATUS STDCALL
496 CmiObjectSecurity(PVOID ObjectBody,
497 SECURITY_OPERATION_CODE OperationCode,
498 SECURITY_INFORMATION SecurityInformation,
499 PSECURITY_DESCRIPTOR SecurityDescriptor,
500 PULONG BufferLength,
501 PSECURITY_DESCRIPTOR *OldSecurityDescriptor,
502 POOL_TYPE PoolType,
503 PGENERIC_MAPPING GenericMapping);
504
505 NTSTATUS STDCALL
506 CmiObjectQueryName (PVOID ObjectBody,
507 POBJECT_NAME_INFORMATION ObjectNameInfo,
508 ULONG Length,
509 PULONG ReturnLength);
510
511 NTSTATUS
512 CmiImportHiveBins(PREGISTRY_HIVE Hive,
513 PUCHAR ChunkPtr);
514
515 VOID
516 CmiFreeHiveBins(PREGISTRY_HIVE Hive);
517
518 NTSTATUS
519 CmiCreateHiveFreeCellList(PREGISTRY_HIVE Hive);
520
521 VOID
522 CmiFreeHiveFreeCellList(PREGISTRY_HIVE Hive);
523
524 NTSTATUS
525 CmiCreateHiveBitmap(PREGISTRY_HIVE Hive);
526
527
528 VOID
529 CmiAddKeyToList(IN PKEY_OBJECT ParentKey,
530 IN PKEY_OBJECT NewKey);
531
532 NTSTATUS
533 CmiRemoveKeyFromList(IN PKEY_OBJECT NewKey);
534
535 NTSTATUS
536 CmiScanKeyList(IN PKEY_OBJECT Parent,
537 IN PUNICODE_STRING KeyName,
538 IN ULONG Attributes,
539 PKEY_OBJECT* ReturnedObject);
540
541 NTSTATUS
542 CmiCreateVolatileHive(PREGISTRY_HIVE *RegistryHive);
543
544 NTSTATUS
545 CmiLoadHive(POBJECT_ATTRIBUTES KeyObjectAttributes,
546 PUNICODE_STRING FileName,
547 ULONG Flags);
548
549 NTSTATUS
550 CmiRemoveRegistryHive(PREGISTRY_HIVE RegistryHive);
551
552 NTSTATUS
553 CmiFlushRegistryHive(PREGISTRY_HIVE RegistryHive);
554
555 ULONG
556 CmiGetNumberOfSubKeys(PKEY_OBJECT KeyObject);
557
558 ULONG
559 CmiGetMaxNameLength(IN PKEY_OBJECT KeyObject);
560
561 ULONG
562 CmiGetMaxClassLength(IN PKEY_OBJECT KeyObject);
563
564 ULONG
565 CmiGetMaxValueNameLength(IN PREGISTRY_HIVE RegistryHive,
566 IN PKEY_CELL KeyCell);
567
568 ULONG
569 CmiGetMaxValueDataLength(IN PREGISTRY_HIVE RegistryHive,
570 IN PKEY_CELL KeyCell);
571
572 NTSTATUS
573 CmiScanForSubKey(IN PREGISTRY_HIVE RegistryHive,
574 IN PKEY_CELL KeyCell,
575 OUT PKEY_CELL *SubKeyCell,
576 OUT BLOCK_OFFSET *BlockOffset,
577 IN PUNICODE_STRING KeyName,
578 IN ACCESS_MASK DesiredAccess,
579 IN ULONG Attributes);
580
581 NTSTATUS
582 CmiAddSubKey(IN PREGISTRY_HIVE RegistryHive,
583 IN PKEY_OBJECT ParentKey,
584 OUT PKEY_OBJECT SubKey,
585 IN PUNICODE_STRING SubKeyName,
586 IN ULONG TitleIndex,
587 IN PUNICODE_STRING Class,
588 IN ULONG CreateOptions);
589
590 NTSTATUS
591 CmiRemoveSubKey(IN PREGISTRY_HIVE RegistryHive,
592 IN PKEY_OBJECT Parent,
593 IN PKEY_OBJECT SubKey);
594
595 NTSTATUS
596 CmiScanKeyForValue(IN PREGISTRY_HIVE RegistryHive,
597 IN PKEY_CELL KeyCell,
598 IN PUNICODE_STRING ValueName,
599 OUT PVALUE_CELL *ValueCell,
600 OUT BLOCK_OFFSET *VBOffset);
601
602 NTSTATUS
603 CmiGetValueFromKeyByIndex(IN PREGISTRY_HIVE RegistryHive,
604 IN PKEY_CELL KeyCell,
605 IN ULONG Index,
606 OUT PVALUE_CELL *ValueCell);
607
608 NTSTATUS
609 CmiAddValueToKey(IN PREGISTRY_HIVE RegistryHive,
610 IN PKEY_CELL KeyCell,
611 IN BLOCK_OFFSET KeyCellOffset,
612 IN PUNICODE_STRING ValueName,
613 OUT PVALUE_CELL *pValueCell,
614 OUT BLOCK_OFFSET *pValueCellOffset);
615
616 NTSTATUS
617 CmiDeleteValueFromKey(IN PREGISTRY_HIVE RegistryHive,
618 IN PKEY_CELL KeyCell,
619 IN BLOCK_OFFSET KeyCellOffset,
620 IN PUNICODE_STRING ValueName);
621
622 NTSTATUS
623 CmiAllocateHashTableCell(IN PREGISTRY_HIVE RegistryHive,
624 OUT PHASH_TABLE_CELL *HashBlock,
625 OUT BLOCK_OFFSET *HBOffset,
626 IN ULONG HashTableSize);
627
628 PKEY_CELL
629 CmiGetKeyFromHashByIndex(PREGISTRY_HIVE RegistryHive,
630 PHASH_TABLE_CELL HashBlock,
631 ULONG Index);
632
633 NTSTATUS
634 CmiAddKeyToHashTable(PREGISTRY_HIVE RegistryHive,
635 PHASH_TABLE_CELL HashCell,
636 BLOCK_OFFSET HashCellOffset,
637 PKEY_CELL NewKeyCell,
638 BLOCK_OFFSET NKBOffset);
639
640 NTSTATUS
641 CmiRemoveKeyFromHashTable(PREGISTRY_HIVE RegistryHive,
642 PHASH_TABLE_CELL HashBlock,
643 BLOCK_OFFSET NKBOffset);
644
645 NTSTATUS
646 CmiAllocateValueCell(IN PREGISTRY_HIVE RegistryHive,
647 OUT PVALUE_CELL *ValueCell,
648 OUT BLOCK_OFFSET *VBOffset,
649 IN PUNICODE_STRING ValueName);
650
651 NTSTATUS
652 CmiDestroyValueCell(PREGISTRY_HIVE RegistryHive,
653 PVALUE_CELL ValueCell,
654 BLOCK_OFFSET VBOffset);
655
656 NTSTATUS
657 CmiAllocateCell(PREGISTRY_HIVE RegistryHive,
658 LONG CellSize,
659 PVOID *Cell,
660 BLOCK_OFFSET *CellOffset);
661
662 NTSTATUS
663 CmiDestroyCell(PREGISTRY_HIVE RegistryHive,
664 PVOID Cell,
665 BLOCK_OFFSET CellOffset);
666
667 PHBIN
668 CmiGetBin (PREGISTRY_HIVE RegistryHive,
669 BLOCK_OFFSET CellOffset);
670
671 PVOID
672 CmiGetCell (PREGISTRY_HIVE RegistryHive,
673 BLOCK_OFFSET CellOffset,
674 OUT PHBIN *Bin);
675
676 VOID
677 CmiMarkBlockDirty(PREGISTRY_HIVE RegistryHive,
678 BLOCK_OFFSET BlockOffset);
679
680 VOID
681 CmiMarkBinDirty(PREGISTRY_HIVE RegistryHive,
682 BLOCK_OFFSET BinOffset);
683
684 NTSTATUS
685 CmiAddFree(PREGISTRY_HIVE RegistryHive,
686 PCELL_HEADER FreeBlock,
687 BLOCK_OFFSET FreeOffset,
688 BOOLEAN MergeFreeBlocks);
689
690 NTSTATUS
691 CmiConnectHive(POBJECT_ATTRIBUTES KeyObjectAttributes,
692 PREGISTRY_HIVE RegistryHive);
693
694 NTSTATUS
695 CmiDisconnectHive (POBJECT_ATTRIBUTES KeyObjectAttributes,
696 PREGISTRY_HIVE *RegistryHive);
697
698 NTSTATUS
699 CmiInitHives(BOOLEAN SetupBoot);
700
701 ULONG
702 CmiGetPackedNameLength(IN PUNICODE_STRING Name,
703 OUT PBOOLEAN Packable);
704
705 BOOLEAN
706 CmiComparePackedNames(IN PUNICODE_STRING Name,
707 IN PUCHAR NameBuffer,
708 IN USHORT NameBufferSize,
709 IN BOOLEAN NamePacked);
710
711 VOID
712 CmiCopyPackedName(PWCHAR NameBuffer,
713 PUCHAR PackedNameBuffer,
714 ULONG PackedNameSize);
715
716 BOOLEAN
717 CmiCompareHash(PUNICODE_STRING KeyName,
718 PCHAR HashString);
719
720 BOOLEAN
721 CmiCompareHashI(PUNICODE_STRING KeyName,
722 PCHAR HashString);
723
724 BOOLEAN
725 CmiCompareKeyNames(PUNICODE_STRING KeyName,
726 PKEY_CELL KeyCell);
727
728 BOOLEAN
729 CmiCompareKeyNamesI(PUNICODE_STRING KeyName,
730 PKEY_CELL KeyCell);
731
732
733 VOID
734 CmiSyncHives(VOID);
735
736
737 NTSTATUS
738 CmiCreateTempHive(PREGISTRY_HIVE *RegistryHive);
739
740 NTSTATUS
741 CmiCopyKey (PREGISTRY_HIVE DstHive,
742 PKEY_CELL DstKeyCell,
743 PREGISTRY_HIVE SrcHive,
744 PKEY_CELL SrcKeyCell);
745
746 NTSTATUS
747 CmiSaveTempHive (PREGISTRY_HIVE Hive,
748 HANDLE FileHandle);
749
750 #endif /*__INCLUDE_CM_H*/