forget update de.rc
[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 major version (1) */
74 ULONG MajorVersion;
75
76 /* Registry format minor version (3)
77 Version 3 added fast indexes, version 5 has large value optimizations */
78 ULONG MinorVersion;
79
80 /* Registry file type (0 - Primary, 1 - Log) */
81 ULONG Type;
82
83 /* Registry format (1 is the only defined value so far) */
84 ULONG Format;
85
86 /* Offset into file from the byte after the end of the base block.
87 If the hive is volatile, this is the actual pointer to the KEY_CELL */
88 BLOCK_OFFSET RootKeyOffset;
89
90 /* Size of each hive block ? */
91 ULONG BlockSize;
92
93 /* (1?) */
94 ULONG Unused7;
95
96 /* Name of hive file */
97 WCHAR FileName[48];
98
99 ULONG Reserved[99];
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 ULONG Reserved[2];
117
118 /* When this bin was last modified */
119 LARGE_INTEGER DateModified;
120
121 /* ? (In-memory only) */
122 ULONG MemAlloc;
123 } HBIN, *PHBIN;
124
125 typedef struct _CELL_HEADER
126 {
127 /* <0 if used, >0 if free */
128 LONG CellSize;
129 } CELL_HEADER, *PCELL_HEADER;
130
131 typedef struct _KEY_CELL
132 {
133 /* Size of this cell */
134 LONG CellSize;
135
136 /* Key cell identifier "kn" (0x6b6e) */
137 USHORT Id;
138
139 /* Flags */
140 USHORT Flags;
141
142 /* Time of last flush */
143 LARGE_INTEGER LastWriteTime;
144
145 /* ? */
146 ULONG UnUsed1;
147
148 /* Block offset of parent key cell */
149 BLOCK_OFFSET ParentKeyOffset;
150
151 /* Count of sub keys for the key in this key cell */
152 ULONG NumberOfSubKeys;
153
154 /* ? */
155 ULONG UnUsed2;
156
157 /* Block offset of has table for FIXME: subkeys/values? */
158 BLOCK_OFFSET HashTableOffset;
159
160 /* ? */
161 ULONG UnUsed3;
162
163 /* Count of values contained in this key cell */
164 ULONG NumberOfValues;
165
166 /* Block offset of VALUE_LIST_CELL */
167 BLOCK_OFFSET ValueListOffset;
168
169 /* Block offset of security cell */
170 BLOCK_OFFSET SecurityKeyOffset;
171
172 /* Block offset of registry key class */
173 BLOCK_OFFSET ClassNameOffset;
174
175 /* ? */
176 ULONG Unused4[5];
177
178 /* Size in bytes of key name */
179 USHORT NameSize;
180
181 /* Size of class name in bytes */
182 USHORT ClassSize;
183
184 /* Name of key (not zero terminated) */
185 UCHAR Name[0];
186 } KEY_CELL, *PKEY_CELL;
187
188 /* KEY_CELL.Flags constants */
189 #define REG_KEY_ROOT_CELL 0x0C
190 #define REG_KEY_LINK_CELL 0x10
191 #define REG_KEY_NAME_PACKED 0x20
192
193 /*
194 * Hash record
195 *
196 * HashValue:
197 * packed name: four letters of value's name
198 * otherwise: Zero!
199 */
200 typedef struct _HASH_RECORD
201 {
202 BLOCK_OFFSET KeyOffset;
203 ULONG HashValue;
204 } HASH_RECORD, *PHASH_RECORD;
205
206 typedef struct _HASH_TABLE_CELL
207 {
208 LONG CellSize;
209 USHORT Id;
210 USHORT HashTableSize;
211 HASH_RECORD Table[0];
212 } HASH_TABLE_CELL, *PHASH_TABLE_CELL;
213
214
215 typedef struct _VALUE_LIST_CELL
216 {
217 LONG CellSize;
218 BLOCK_OFFSET ValueOffset[0];
219 } VALUE_LIST_CELL, *PVALUE_LIST_CELL;
220
221 typedef struct _VALUE_CELL
222 {
223 LONG CellSize;
224 USHORT Id; // "kv"
225 USHORT NameSize; // length of Name
226 ULONG DataSize; // length of datas in the cell pointed by DataOffset
227 BLOCK_OFFSET DataOffset;// datas are here if high bit of DataSize is set
228 ULONG DataType;
229 USHORT Flags;
230 USHORT Unused1;
231 UCHAR Name[0]; /* warning : not zero terminated */
232 } VALUE_CELL, *PVALUE_CELL;
233
234 /* VALUE_CELL.Flags constants */
235 #define REG_VALUE_NAME_PACKED 0x0001
236
237 /* VALUE_CELL.DataSize mask constants */
238 #define REG_DATA_SIZE_MASK 0x7FFFFFFF
239 #define REG_DATA_IN_OFFSET 0x80000000
240
241
242 typedef struct _SECURITY_CELL
243 {
244 LONG CellSize;
245 USHORT Id; // "sk"
246 USHORT Reserved;
247 BLOCK_OFFSET PrevSecurityCell;
248 BLOCK_OFFSET NextSecurityCell;
249 ULONG RefCount;
250 ULONG SdSize;
251 UCHAR Data[0];
252 } SECURITY_CELL, *PSECURITY_CELL;
253
254
255 typedef struct _DATA_CELL
256 {
257 LONG CellSize;
258 UCHAR Data[0];
259 } DATA_CELL, *PDATA_CELL;
260
261 #include <poppack.h>
262
263
264 typedef struct _BLOCK_LIST_ENTRY
265 {
266 PHBIN Bin;
267 PVOID Block;
268 } BLOCK_LIST_ENTRY, *PBLOCK_LIST_ENTRY;
269
270
271 typedef struct _REGISTRY_HIVE
272 {
273 LIST_ENTRY HiveList;
274 ULONG Flags;
275 UNICODE_STRING HiveFileName;
276 UNICODE_STRING LogFileName;
277 ULONG FileSize;
278 PHIVE_HEADER HiveHeader;
279 ULONG UpdateCounter;
280 ULONG BlockListSize;
281 PBLOCK_LIST_ENTRY BlockList;
282 ULONG FreeListSize;
283 ULONG FreeListMax;
284 PCELL_HEADER *FreeList;
285 BLOCK_OFFSET *FreeListOffset;
286
287 PSECURITY_CELL RootSecurityCell;
288
289 PULONG BitmapBuffer;
290 RTL_BITMAP DirtyBitMap;
291 BOOLEAN HiveDirty;
292 } REGISTRY_HIVE, *PREGISTRY_HIVE;
293
294 /* REGISTRY_HIVE.Flags constants */
295 /* When set, the hive uses pointers instead of offsets. */
296 #define HIVE_POINTER 0x00000001
297
298 /* When set, the hive is not backed by a file.
299 Therefore, it can not be flushed to disk. */
300 #define HIVE_NO_FILE 0x00000002
301
302 /* When set, a modified (dirty) hive is not synchronized automatically.
303 Explicit synchronization (save/flush) works. */
304 #define HIVE_NO_SYNCH 0x00000004
305
306 #define IsPointerHive(Hive) ((Hive)->Flags & HIVE_POINTER)
307 #define IsNoFileHive(Hive) ((Hive)->Flags & HIVE_NO_FILE)
308 #define IsNoSynchHive(Hive) ((Hive)->Flags & HIVE_NO_SYNCH)
309
310
311 #define IsFreeCell(Cell)(Cell->CellSize >= 0)
312 #define IsUsedCell(Cell)(Cell->CellSize < 0)
313
314
315 /* KEY_OBJECT.Flags */
316
317 /* When set, the key is scheduled for deletion, and all
318 attempts to access the key must not succeed */
319 #define KO_MARKED_FOR_DELETE 0x00000001
320
321
322 /* Type defining the Object Manager Key Object */
323 typedef struct _KEY_OBJECT
324 {
325 /* Fields used by the Object Manager */
326 CSHORT Type;
327 CSHORT Size;
328
329 /* Key flags */
330 ULONG Flags;
331
332 /* Key name */
333 UNICODE_STRING Name;
334
335 /* Registry hive the key belongs to */
336 PREGISTRY_HIVE RegistryHive;
337
338 /* Block offset of the key cell this key belongs in */
339 BLOCK_OFFSET KeyCellOffset;
340
341 /* KEY_CELL this key belong in */
342 PKEY_CELL KeyCell;
343
344 /* Link to the parent KEY_OBJECT for this key */
345 struct _KEY_OBJECT *ParentKey;
346
347 /* Subkeys loaded in SubKeys */
348 ULONG NumberOfSubKeys;
349
350 /* Space allocated in SubKeys */
351 ULONG SizeOfSubKeys;
352
353 /* List of subkeys loaded */
354 struct _KEY_OBJECT **SubKeys;
355
356 /* List entry into the global key object list */
357 LIST_ENTRY ListEntry;
358
359 /* Time stamp for the last access by the parse routine */
360 ULONG TimeStamp;
361 } KEY_OBJECT, *PKEY_OBJECT;
362
363 /* Bits 31-22 (top 10 bits) of the cell index is the directory index */
364 #define CmiDirectoryIndex(CellIndex)(CellIndex & 0xffc000000)
365 /* Bits 21-12 (middle 10 bits) of the cell index is the table index */
366 #define CmiTableIndex(Cellndex)(CellIndex & 0x003ff000)
367 /* Bits 11-0 (bottom 12 bits) of the cell index is the byte offset */
368 #define CmiByteOffset(Cellndex)(CellIndex & 0x00000fff)
369
370
371 extern BOOLEAN CmiDoVerify;
372 extern PREGISTRY_HIVE CmiVolatileHive;
373 extern POBJECT_TYPE CmiKeyType;
374 extern KSPIN_LOCK CmiKeyListLock;
375
376 extern LIST_ENTRY CmiHiveListHead;
377
378 extern ERESOURCE CmiRegistryLock;
379
380
381 /* Registry Callback Function */
382 typedef NTSTATUS (STDCALL *PEX_CALLBACK_FUNCTION ) (
383 IN PVOID CallbackContext,
384 IN REG_NOTIFY_CLASS Argument1,
385 IN PVOID Argument2
386 );
387
388 typedef struct _REGISTRY_CALLBACK
389 {
390 LIST_ENTRY ListEntry;
391 EX_RUNDOWN_REF RundownRef;
392 PEX_CALLBACK_FUNCTION Function;
393 PVOID Context;
394 LARGE_INTEGER Cookie;
395 BOOLEAN PendingDelete;
396 } REGISTRY_CALLBACK, *PREGISTRY_CALLBACK;
397
398 NTSTATUS
399 CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1,
400 IN PVOID Argument2);
401
402 VOID
403 CmiVerifyBinHeader(PHBIN BinHeader);
404 VOID
405 CmiVerifyKeyCell(PKEY_CELL KeyCell);
406 VOID
407 CmiVerifyRootKeyCell(PKEY_CELL RootKeyCell);
408 VOID
409 CmiVerifyKeyObject(PKEY_OBJECT KeyObject);
410 VOID
411 CmiVerifyRegistryHive(PREGISTRY_HIVE RegistryHive);
412
413 #ifdef DBG
414 #define VERIFY_BIN_HEADER CmiVerifyBinHeader
415 #define VERIFY_KEY_CELL CmiVerifyKeyCell
416 #define VERIFY_ROOT_KEY_CELL CmiVerifyRootKeyCell
417 #define VERIFY_VALUE_CELL CmiVerifyValueCell
418 #define VERIFY_VALUE_LIST_CELL CmiVerifyValueListCell
419 #define VERIFY_KEY_OBJECT CmiVerifyKeyObject
420 #define VERIFY_REGISTRY_HIVE CmiVerifyRegistryHive
421 #else
422 #define VERIFY_BIN_HEADER(x)
423 #define VERIFY_KEY_CELL(x)
424 #define VERIFY_ROOT_KEY_CELL(x)
425 #define VERIFY_VALUE_CELL(x)
426 #define VERIFY_VALUE_LIST_CELL(x)
427 #define VERIFY_KEY_OBJECT(x)
428 #define VERIFY_REGISTRY_HIVE(x)
429 #endif
430
431 NTSTATUS STDCALL
432 CmRegisterCallback(IN PEX_CALLBACK_FUNCTION Function,
433 IN PVOID Context,
434 IN OUT PLARGE_INTEGER Cookie
435 );
436
437 NTSTATUS STDCALL
438 CmUnRegisterCallback(IN LARGE_INTEGER Cookie);
439
440 NTSTATUS STDCALL
441 CmiObjectParse(IN PVOID ParsedObject,
442 OUT PVOID *NextObject,
443 IN PUNICODE_STRING FullPath,
444 IN OUT PWSTR *Path,
445 IN ULONG Attribute);
446
447 VOID STDCALL
448 CmiObjectDelete(PVOID DeletedObject);
449
450 NTSTATUS STDCALL
451 CmiObjectSecurity(PVOID ObjectBody,
452 SECURITY_OPERATION_CODE OperationCode,
453 SECURITY_INFORMATION SecurityInformation,
454 PSECURITY_DESCRIPTOR SecurityDescriptor,
455 PULONG BufferLength,
456 PSECURITY_DESCRIPTOR *OldSecurityDescriptor,
457 POOL_TYPE PoolType,
458 PGENERIC_MAPPING GenericMapping);
459
460 NTSTATUS STDCALL
461 CmiObjectQueryName (PVOID ObjectBody,
462 POBJECT_NAME_INFORMATION ObjectNameInfo,
463 ULONG Length,
464 PULONG ReturnLength);
465
466 NTSTATUS
467 CmiImportHiveBins(PREGISTRY_HIVE Hive,
468 PUCHAR ChunkPtr);
469
470 VOID
471 CmiFreeHiveBins(PREGISTRY_HIVE Hive);
472
473 NTSTATUS
474 CmiCreateHiveFreeCellList(PREGISTRY_HIVE Hive);
475
476 VOID
477 CmiFreeHiveFreeCellList(PREGISTRY_HIVE Hive);
478
479 NTSTATUS
480 CmiCreateHiveBitmap(PREGISTRY_HIVE Hive);
481
482
483 VOID
484 CmiAddKeyToList(IN PKEY_OBJECT ParentKey,
485 IN PKEY_OBJECT NewKey);
486
487 NTSTATUS
488 CmiRemoveKeyFromList(IN PKEY_OBJECT NewKey);
489
490 NTSTATUS
491 CmiScanKeyList(IN PKEY_OBJECT Parent,
492 IN PUNICODE_STRING KeyName,
493 IN ULONG Attributes,
494 PKEY_OBJECT* ReturnedObject);
495
496 NTSTATUS
497 CmiCreateVolatileHive(PREGISTRY_HIVE *RegistryHive);
498
499 NTSTATUS
500 CmiLoadHive(POBJECT_ATTRIBUTES KeyObjectAttributes,
501 PUNICODE_STRING FileName,
502 ULONG Flags);
503
504 NTSTATUS
505 CmiRemoveRegistryHive(PREGISTRY_HIVE RegistryHive);
506
507 NTSTATUS
508 CmiFlushRegistryHive(PREGISTRY_HIVE RegistryHive);
509
510 ULONG
511 CmiGetNumberOfSubKeys(PKEY_OBJECT KeyObject);
512
513 ULONG
514 CmiGetMaxNameLength(IN PKEY_OBJECT KeyObject);
515
516 ULONG
517 CmiGetMaxClassLength(IN PKEY_OBJECT KeyObject);
518
519 ULONG
520 CmiGetMaxValueNameLength(IN PREGISTRY_HIVE RegistryHive,
521 IN PKEY_CELL KeyCell);
522
523 ULONG
524 CmiGetMaxValueDataLength(IN PREGISTRY_HIVE RegistryHive,
525 IN PKEY_CELL KeyCell);
526
527 NTSTATUS
528 CmiScanForSubKey(IN PREGISTRY_HIVE RegistryHive,
529 IN PKEY_CELL KeyCell,
530 OUT PKEY_CELL *SubKeyCell,
531 OUT BLOCK_OFFSET *BlockOffset,
532 IN PUNICODE_STRING KeyName,
533 IN ACCESS_MASK DesiredAccess,
534 IN ULONG Attributes);
535
536 NTSTATUS
537 CmiAddSubKey(IN PREGISTRY_HIVE RegistryHive,
538 IN PKEY_OBJECT ParentKey,
539 OUT PKEY_OBJECT SubKey,
540 IN PUNICODE_STRING SubKeyName,
541 IN ULONG TitleIndex,
542 IN PUNICODE_STRING Class,
543 IN ULONG CreateOptions);
544
545 NTSTATUS
546 CmiRemoveSubKey(IN PREGISTRY_HIVE RegistryHive,
547 IN PKEY_OBJECT Parent,
548 IN PKEY_OBJECT SubKey);
549
550 NTSTATUS
551 CmiScanKeyForValue(IN PREGISTRY_HIVE RegistryHive,
552 IN PKEY_CELL KeyCell,
553 IN PUNICODE_STRING ValueName,
554 OUT PVALUE_CELL *ValueCell,
555 OUT BLOCK_OFFSET *VBOffset);
556
557 NTSTATUS
558 CmiGetValueFromKeyByIndex(IN PREGISTRY_HIVE RegistryHive,
559 IN PKEY_CELL KeyCell,
560 IN ULONG Index,
561 OUT PVALUE_CELL *ValueCell);
562
563 NTSTATUS
564 CmiAddValueToKey(IN PREGISTRY_HIVE RegistryHive,
565 IN PKEY_CELL KeyCell,
566 IN BLOCK_OFFSET KeyCellOffset,
567 IN PUNICODE_STRING ValueName,
568 OUT PVALUE_CELL *pValueCell,
569 OUT BLOCK_OFFSET *pValueCellOffset);
570
571 NTSTATUS
572 CmiDeleteValueFromKey(IN PREGISTRY_HIVE RegistryHive,
573 IN PKEY_CELL KeyCell,
574 IN BLOCK_OFFSET KeyCellOffset,
575 IN PUNICODE_STRING ValueName);
576
577 NTSTATUS
578 CmiAllocateHashTableCell(IN PREGISTRY_HIVE RegistryHive,
579 OUT PHASH_TABLE_CELL *HashBlock,
580 OUT BLOCK_OFFSET *HBOffset,
581 IN ULONG HashTableSize);
582
583 PKEY_CELL
584 CmiGetKeyFromHashByIndex(PREGISTRY_HIVE RegistryHive,
585 PHASH_TABLE_CELL HashBlock,
586 ULONG Index);
587
588 NTSTATUS
589 CmiAddKeyToHashTable(PREGISTRY_HIVE RegistryHive,
590 PHASH_TABLE_CELL HashCell,
591 BLOCK_OFFSET HashCellOffset,
592 PKEY_CELL NewKeyCell,
593 BLOCK_OFFSET NKBOffset);
594
595 NTSTATUS
596 CmiRemoveKeyFromHashTable(PREGISTRY_HIVE RegistryHive,
597 PHASH_TABLE_CELL HashBlock,
598 BLOCK_OFFSET NKBOffset);
599
600 NTSTATUS
601 CmiAllocateValueCell(IN PREGISTRY_HIVE RegistryHive,
602 OUT PVALUE_CELL *ValueCell,
603 OUT BLOCK_OFFSET *VBOffset,
604 IN PUNICODE_STRING ValueName);
605
606 NTSTATUS
607 CmiDestroyValueCell(PREGISTRY_HIVE RegistryHive,
608 PVALUE_CELL ValueCell,
609 BLOCK_OFFSET VBOffset);
610
611 NTSTATUS
612 CmiAllocateCell(PREGISTRY_HIVE RegistryHive,
613 LONG CellSize,
614 PVOID *Cell,
615 BLOCK_OFFSET *CellOffset);
616
617 NTSTATUS
618 CmiDestroyCell(PREGISTRY_HIVE RegistryHive,
619 PVOID Cell,
620 BLOCK_OFFSET CellOffset);
621
622 PHBIN
623 CmiGetBin (PREGISTRY_HIVE RegistryHive,
624 BLOCK_OFFSET CellOffset);
625
626 PVOID
627 CmiGetCell (PREGISTRY_HIVE RegistryHive,
628 BLOCK_OFFSET CellOffset,
629 OUT PHBIN *Bin);
630
631 VOID
632 CmiMarkBlockDirty(PREGISTRY_HIVE RegistryHive,
633 BLOCK_OFFSET BlockOffset);
634
635 VOID
636 CmiMarkBinDirty(PREGISTRY_HIVE RegistryHive,
637 BLOCK_OFFSET BinOffset);
638
639 NTSTATUS
640 CmiAddFree(PREGISTRY_HIVE RegistryHive,
641 PCELL_HEADER FreeBlock,
642 BLOCK_OFFSET FreeOffset,
643 BOOLEAN MergeFreeBlocks);
644
645 NTSTATUS
646 CmiConnectHive(POBJECT_ATTRIBUTES KeyObjectAttributes,
647 PREGISTRY_HIVE RegistryHive);
648
649 NTSTATUS
650 CmiDisconnectHive (POBJECT_ATTRIBUTES KeyObjectAttributes,
651 PREGISTRY_HIVE *RegistryHive);
652
653 NTSTATUS
654 CmiInitHives(BOOLEAN SetupBoot);
655
656 ULONG
657 CmiGetPackedNameLength(IN PUNICODE_STRING Name,
658 OUT PBOOLEAN Packable);
659
660 BOOLEAN
661 CmiComparePackedNames(IN PUNICODE_STRING Name,
662 IN PUCHAR NameBuffer,
663 IN USHORT NameBufferSize,
664 IN BOOLEAN NamePacked);
665
666 VOID
667 CmiCopyPackedName(PWCHAR NameBuffer,
668 PUCHAR PackedNameBuffer,
669 ULONG PackedNameSize);
670
671 BOOLEAN
672 CmiCompareHash(PUNICODE_STRING KeyName,
673 PCHAR HashString);
674
675 BOOLEAN
676 CmiCompareHashI(PUNICODE_STRING KeyName,
677 PCHAR HashString);
678
679 BOOLEAN
680 CmiCompareKeyNames(PUNICODE_STRING KeyName,
681 PKEY_CELL KeyCell);
682
683 BOOLEAN
684 CmiCompareKeyNamesI(PUNICODE_STRING KeyName,
685 PKEY_CELL KeyCell);
686
687
688 VOID
689 CmiSyncHives(VOID);
690
691
692 NTSTATUS
693 CmiCreateTempHive(PREGISTRY_HIVE *RegistryHive);
694
695 NTSTATUS
696 CmiCopyKey (PREGISTRY_HIVE DstHive,
697 PKEY_CELL DstKeyCell,
698 PREGISTRY_HIVE SrcHive,
699 PKEY_CELL SrcKeyCell);
700
701 NTSTATUS
702 CmiSaveTempHive (PREGISTRY_HIVE Hive,
703 HANDLE FileHandle);
704
705 #endif /*__INCLUDE_CM_H*/