ReactOS 0.4.15-dev-7842-g558ab78
cminit.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/config/cminit.c
5 * PURPOSE: Configuration Manager - Hive Initialization
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include "ntoskrnl.h"
12#define NDEBUG
13#include "debug.h"
14
15/* FUNCTIONS *****************************************************************/
16
20 _Out_ PCMHIVE *CmHive,
21 _In_ ULONG OperationType,
22 _In_ ULONG HiveFlags,
24 _In_opt_ PVOID HiveData,
25 _In_ HANDLE Primary,
26 _In_ HANDLE Log,
28 _In_ HANDLE Alternate,
30 _In_ ULONG CheckFlags)
31{
32 PCMHIVE Hive;
34 FILE_FS_SIZE_INFORMATION FileSizeInformation;
36 ULONG Cluster;
37
38 /* Assume failure */
39 *CmHive = NULL;
40
41 /*
42 * The following are invalid:
43 * - An external hive that is also internal.
44 * - A log hive that is not a primary hive too.
45 * - A volatile hive that is linked to permanent storage,
46 * unless this hive is a shared system hive.
47 * - An in-memory initialization without hive data.
48 * - A log hive that is not linked to a correct file type.
49 * - An alternate hive that is not linked to a correct file type.
50 * - A lonely alternate hive not backed up with its corresponding primary hive.
51 */
52 if ((External && (Primary || Log)) ||
53 (Log && !Primary) ||
54 (!CmpShareSystemHives && (HiveFlags & HIVE_VOLATILE) &&
55 (Primary || External || Log)) ||
56 ((OperationType == HINIT_MEMORY) && !HiveData) ||
57 (Log && (FileType != HFILE_TYPE_LOG)) ||
58 (Alternate && (FileType != HFILE_TYPE_ALTERNATE)) ||
59 (Alternate && !Primary))
60 {
61 /* Fail the request */
63 }
64
65 /* Check if this is a primary hive */
66 if (Primary)
67 {
68 /* Get the cluster size */
71 &FileSizeInformation,
74 if (!NT_SUCCESS(Status)) return Status;
75
76 /* Make sure it's not larger then the block size */
77 if (FileSizeInformation.BytesPerSector > HBLOCK_SIZE)
78 {
79 /* Fail */
81 }
82
83 /* Otherwise, calculate the cluster */
84 Cluster = FileSizeInformation.BytesPerSector / HSECTOR_SIZE;
85 Cluster = max(1, Cluster);
86 }
87 else
88 {
89 /* Otherwise use cluster 1 */
90 Cluster = 1;
91 }
92
93 /* Allocate the hive */
95 if (!Hive) return STATUS_INSUFFICIENT_RESOURCES;
96
97 /* Setup null fields */
98 Hive->UnloadEvent = NULL;
99 Hive->RootKcb = NULL;
100 Hive->Frozen = FALSE;
101 Hive->UnloadWorkItem = NULL;
102 Hive->GrowOnlyMode = FALSE;
103 Hive->GrowOffset = 0;
104 Hive->CellRemapArray = NULL;
105 Hive->UseCountLog.Next = 0;
106 Hive->LockHiveLog.Next = 0;
107 Hive->FileObject = NULL;
108 Hive->NotifyList.Flink = NULL;
109 Hive->NotifyList.Blink = NULL;
110
111 /* Set the loading flag */
112 Hive->HiveIsLoading = TRUE;
113
114 /* Set the current thread as creator */
116
117 /* Initialize lists */
121
122 /* Allocate the view log */
124 sizeof(KGUARDED_MUTEX),
125 TAG_CMHIVE);
126 if (!Hive->ViewLock)
127 {
128 /* Cleanup allocation and fail */
131 }
132
133 /* Allocate the flush lock */
135 sizeof(ERESOURCE),
136 TAG_CMHIVE);
137 if (!Hive->FlusherLock)
138 {
139 /* Cleanup allocations and fail */
143 }
144
145 /* Setup the handles */
146 Hive->FileHandles[HFILE_TYPE_PRIMARY] = Primary;
147 Hive->FileHandles[HFILE_TYPE_LOG] = Log;
149 Hive->FileHandles[HFILE_TYPE_ALTERNATE] = Alternate;
150
151 /* Initailize the guarded mutex */
153 Hive->ViewLockOwner = NULL;
154
155 /* Initialize the flush lock */
157
158 /* Setup hive locks */
160 Hive->HiveLockOwner = NULL;
162 Hive->WriterLockOwner = NULL;
165
166 /* Clear file names */
167 RtlInitEmptyUnicodeString(&Hive->FileUserName, NULL, 0);
168 RtlInitEmptyUnicodeString(&Hive->FileFullPath, NULL, 0);
169
170 /* Initialize the view list */
172
173 /* Initailize the security cache */
175
176 /* Setup flags */
177 Hive->Flags = 0;
178 Hive->FlushCount = 0;
179
180 /* Initialize it */
181 Status = HvInitialize(&Hive->Hive,
182 OperationType,
183 HiveFlags,
184 FileType,
185 HiveData,
187 CmpFree,
192 Cluster,
193 FileName);
194 if (!NT_SUCCESS(Status))
195 {
196 /* Cleanup allocations and fail */
201 return Status;
202 }
203
204 /* Check if we should verify the registry */
205 if ((OperationType == HINIT_FILE) ||
206 (OperationType == HINIT_MEMORY) ||
207 (OperationType == HINIT_MEMORY_INPLACE) ||
208 (OperationType == HINIT_MAPFILE))
209 {
210 /* Verify integrity */
211 CM_CHECK_REGISTRY_STATUS CheckStatus = CmCheckRegistry(Hive, CheckFlags);
212 if (!CM_CHECK_REGISTRY_SUCCESS(CheckStatus))
213 {
214 /* Cleanup allocations and fail */
220 }
221 }
222
223 /* Reset the loading flag */
224 Hive->HiveIsLoading = FALSE;
225
226 /* Lock the hive list */
228
229 /* Insert this hive */
231
232 /* Release the lock */
234
235 /* Return the hive and success */
236 *CmHive = Hive;
237 return STATUS_SUCCESS;
238}
239
241NTAPI
243{
244 /* Remove the hive from the list */
246 RemoveEntryList(&CmHive->HiveList);
248
249 /* Destroy the security descriptor cache */
251
252 /* Destroy the view list */
254
255 /* Delete the flusher lock */
256 ExDeleteResourceLite(CmHive->FlusherLock);
257 ExFreePoolWithTag(CmHive->FlusherLock, TAG_CMHIVE);
258
259 /* Delete the view lock */
260 ExFreePoolWithTag(CmHive->ViewLock, TAG_CMHIVE);
261
262 /* Free the hive storage */
263 HvFree(&CmHive->Hive);
264
265 /* Free the hive */
266 CmpFree(CmHive, TAG_CM);
267
268 return STATUS_SUCCESS;
269}
270
272NTAPI
275 OUT PHANDLE Primary,
276 OUT PHANDLE Log,
277 OUT PULONG PrimaryDisposition,
278 OUT PULONG LogDisposition,
279 IN BOOLEAN CreateAllowed,
280 IN BOOLEAN MarkAsSystemHive,
281 IN BOOLEAN NoBuffering,
283{
287 UNICODE_STRING FullName, ExtensionName;
288 PWCHAR NameBuffer;
292 ULONG AttributeFlags, ShareMode, DesiredAccess, CreateDisposition, IoFlags;
293 USHORT CompressionState;
295 FILE_FS_SIZE_INFORMATION FsSizeInformation;
296
297 /* Create event */
299 if (!NT_SUCCESS(Status)) return Status;
300
301 /* Initialize the full name */
302 RtlInitEmptyUnicodeString(&FullName, NULL, 0);
303 Length = BaseName->Length;
304
305 /* Check if we have an extension */
306 if (Extension)
307 {
308 /* Update the name length */
309 Length += (USHORT)wcslen(Extension) * sizeof(WCHAR) + sizeof(UNICODE_NULL);
310
311 /* Allocate the buffer for the full name */
313 if (!NameBuffer)
314 {
315 /* Fail */
318 return STATUS_NO_MEMORY;
319 }
320
321 /* Build the full name */
322 FullName.Buffer = NameBuffer;
324 RtlCopyUnicodeString(&FullName, BaseName);
325 }
326 else
327 {
328 /* The base name is the full name */
329 FullName = *BaseName;
330 NameBuffer = NULL;
331 }
332
333 /* Initialize the attributes */
335 &FullName,
337 NULL,
338 NULL);
339
340 /* Check if we can create the hive */
341 if (CreateAllowed && !CmpShareSystemHives)
342 {
343 /* Open only or create */
345 }
346 else
347 {
348 /* Open only */
350 }
351
352 /* Setup the flags */
353 // FIXME : FILE_OPEN_FOR_BACKUP_INTENT is unimplemented and breaks 3rd stage boot
354 IoFlags = //FILE_OPEN_FOR_BACKUP_INTENT |
357 (NoBuffering ? FILE_NO_INTERMEDIATE_BUFFERING : 0);
358
359 /* Set share and access modes */
361 {
362 /* We're on Live CD or otherwise sharing */
364 ShareMode = FILE_SHARE_READ;
365 }
366 else
367 {
368 /* We want to write exclusively */
369 ShareMode = 0;
371 }
372
373 /* Default attributes */
374 AttributeFlags = FILE_ATTRIBUTE_NORMAL;
375
376 /* Now create the file.
377 * Note: We use FILE_SYNCHRONOUS_IO_NONALERT here to simplify CmpFileRead/CmpFileWrite.
378 * Windows does async I/O and therefore does not use this flag (or SYNCHRONIZE).
379 */
380 Status = ZwCreateFile(Primary,
384 NULL,
385 AttributeFlags,
386 ShareMode,
389 NULL,
390 0);
391 /* Check if anything failed until now */
392 if (!NT_SUCCESS(Status))
393 {
394 DPRINT1("ZwCreateFile(%wZ) failed, Status 0x%08lx.\n", ObjectAttributes.ObjectName, Status);
395
396 /* Close handles and free buffers */
397 if (NameBuffer) ExFreePoolWithTag(NameBuffer, TAG_CM);
400 *Primary = NULL;
401 return Status;
402 }
403
404 if (MarkAsSystemHive)
405 {
406 /* We opened it, mark it as a system hive */
407 Status = ZwFsControlFile(*Primary,
409 NULL,
410 NULL,
413 NULL,
414 0,
415 NULL,
416 0);
417 if (Status == STATUS_PENDING)
418 {
419 /* Wait for completion */
421 Executive,
423 FALSE,
424 NULL);
426 }
427
428 /* If we don't support it, ignore the failure */
430
431 if (!NT_SUCCESS(Status))
432 {
433 /* Close handles and free buffers */
434 if (NameBuffer) ExFreePoolWithTag(NameBuffer, TAG_CM);
437 ZwClose(*Primary);
438 *Primary = NULL;
439 return Status;
440 }
441 }
442
443 /* Disable compression */
444 CompressionState = 0;
445 Status = ZwFsControlFile(*Primary,
447 NULL,
448 NULL,
451 &CompressionState,
452 sizeof(CompressionState),
453 NULL,
454 0);
455 if (Status == STATUS_PENDING)
456 {
457 /* Wait for completion */
459 Executive,
461 FALSE,
462 NULL);
463 }
464
465 /* Get the disposition */
466 *PrimaryDisposition = (ULONG)IoStatusBlock.Information;
468 {
469 /* Check how large the file is */
470 Status = ZwQueryInformationFile(*Primary,
473 sizeof(FileInformation),
475 if (NT_SUCCESS(Status))
476 {
477 /* Check if it's 0 bytes */
478 if (!FileInformation.EndOfFile.QuadPart)
479 {
480 /* Assume it's a new file */
481 *PrimaryDisposition = FILE_CREATED;
482 }
483 }
484 }
485
486 /* Check if the caller wants cluster size returned */
487 if (ClusterSize)
488 {
489 /* Query it */
492 &FsSizeInformation,
493 sizeof(FsSizeInformation),
495 if (!NT_SUCCESS(Status))
496 {
497 /* Close handles and free buffers */
498 if (NameBuffer) ExFreePoolWithTag(NameBuffer, TAG_CM);
501 return Status;
502 }
503
504 /* Check if the sector size is invalid */
505 if (FsSizeInformation.BytesPerSector > HBLOCK_SIZE)
506 {
507 /* Close handles and free buffers */
508 if (NameBuffer) ExFreePoolWithTag(NameBuffer, TAG_CM);
512 }
513
514 /* Return cluster size */
515 *ClusterSize = max(1, FsSizeInformation.BytesPerSector / HSECTOR_SIZE);
516 }
517
518 /* Check if we don't need to create a log file */
519 if (!Extension)
520 {
521 /* We're done, close handles */
524 return STATUS_SUCCESS;
525 }
526
527 /* Check if we can create the hive */
529 if (*PrimaryDisposition == FILE_CREATED)
530 {
531 /* Over-write the existing log file, since this is a new hive */
533 }
534
535 /* Setup the name */
536 RtlInitUnicodeString(&ExtensionName, Extension);
538
539 /* Initialize the attributes */
541 &FullName,
543 NULL,
544 NULL);
545
546 /* Setup the flags */
548
549 /* Check if this is a log file */
550 if (!_wcsnicmp(Extension, L".log", 4))
551 {
552 /* Hide log files */
553 AttributeFlags |= FILE_ATTRIBUTE_HIDDEN;
554 }
555
556 /* Now create the file.
557 * Note: We use FILE_SYNCHRONOUS_IO_NONALERT here to simplify CmpFileRead/CmpFileWrite.
558 * Windows does async I/O and therefore does not use this flag (or SYNCHRONIZE).
559 */
560 Status = ZwCreateFile(Log,
564 NULL,
565 AttributeFlags,
566 ShareMode,
569 NULL,
570 0);
571 if (NT_SUCCESS(Status) && MarkAsSystemHive)
572 {
573 /* We opened it, mark it as a system hive */
574 Status = ZwFsControlFile(*Log,
576 NULL,
577 NULL,
580 NULL,
581 0,
582 NULL,
583 0);
584 if (Status == STATUS_PENDING)
585 {
586 /* Wait for completion */
588 Executive,
590 FALSE,
591 NULL);
593 }
594
595 /* If we don't support it, ignore the failure */
597
598 /* If we failed, close the handle */
599 if (!NT_SUCCESS(Status)) ZwClose(*Log);
600 }
601
602 /* Check if anything failed until now */
603 if (!NT_SUCCESS(Status))
604 {
605 /* Clear the handle */
606 *Log = NULL;
607 }
608 else
609 {
610 /* Disable compression */
611 Status = ZwFsControlFile(*Log,
613 NULL,
614 NULL,
617 &CompressionState,
618 sizeof(CompressionState),
619 NULL,
620 0);
621 if (Status == STATUS_PENDING)
622 {
623 /* Wait for completion */
625 Executive,
627 FALSE,
628 NULL);
629 }
630
631 /* Return the disposition */
632 *LogDisposition = (ULONG)IoStatusBlock.Information;
633 }
634
635 /* We're done, close handles and free buffers */
636 if (NameBuffer) ExFreePoolWithTag(NameBuffer, TAG_CM);
639 return STATUS_SUCCESS;
640}
641
642VOID
643NTAPI
645{
646 ULONG i;
647
648 for (i = 0; i < HFILE_TYPE_MAX; i++)
649 {
650 if (Hive->FileHandles[i] != NULL)
651 {
652 ZwClose(Hive->FileHandles[i]);
653 Hive->FileHandles[i] = NULL;
654 }
655 }
656}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
DWORD ClusterSize
Definition: format.c:67
PVOID NTAPI CmpAllocate(_In_ SIZE_T Size, _In_ BOOLEAN Paged, _In_ ULONG Tag)
Definition: bootreg.c:90
VOID NTAPI CmpFree(_In_ PVOID Ptr, _In_ ULONG Quota)
Definition: bootreg.c:105
CM_CHECK_REGISTRY_STATUS NTAPI CmCheckRegistry(_In_ PCMHIVE RegistryHive, _In_ ULONG Flags)
Checks the registry that is consistent and its contents valid and not corrupted. More specifically th...
Definition: cmcheck.c:1633
EX_PUSH_LOCK CmpHiveListHeadLock
Definition: cmdata.c:39
BOOLEAN CmpMiniNTBoot
Definition: cmdata.c:60
BOOLEAN CmpShareSystemHives
Definition: cmdata.c:58
#define TAG_CMHIVE
Definition: cmlib.h:214
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)
#define CM_CHECK_REGISTRY_SUCCESS(StatusCode)
Definition: cmlib.h:281
ULONG CM_CHECK_REGISTRY_STATUS
Definition: cmlib.h:223
#define TAG_CM
Definition: cmlib.h:212
VOID CMAPI HvFree(PHHIVE RegistryHive)
VOID NTAPI CmpDestroyHiveViewList(IN PCMHIVE Hive)
Definition: cmmapvw.c:35
VOID NTAPI CmpInitHiveViewList(IN PCMHIVE Hive)
Definition: cmmapvw.c:21
VOID NTAPI CmpDestroySecurityCache(IN PCMHIVE Hive)
Definition: cmsecach.c:41
VOID NTAPI CmpInitSecurityCache(IN PCMHIVE Hive)
Definition: cmsecach.c:21
LIST_ENTRY CmpHiveListHead
Definition: cmsysini.c:17
BOOLEAN NTAPI CmpFileWrite(IN PHHIVE RegistryHive, IN ULONG FileType, IN PULONG FileOffset, IN PVOID Buffer, IN SIZE_T BufferLength)
Definition: cmwraprs.c:99
BOOLEAN NTAPI CmpFileSetSize(_In_ PHHIVE RegistryHive, _In_ ULONG FileType, _In_ ULONG FileSize, _In_ ULONG OldFileSize)
Definition: cmwraprs.c:132
BOOLEAN NTAPI CmpFileFlush(IN PHHIVE RegistryHive, IN ULONG FileType, IN OUT PLARGE_INTEGER FileOffset, IN ULONG Length)
Definition: cmwraprs.c:192
NTSTATUS NTAPI CmpCreateEvent(IN EVENT_TYPE EventType, OUT PHANDLE EventHandle, OUT PKEVENT *Event)
Definition: cmwraprs.c:19
BOOLEAN NTAPI CmpFileRead(IN PHHIVE RegistryHive, IN ULONG FileType, IN PULONG FileOffset, OUT PVOID Buffer, IN SIZE_T BufferLength)
Definition: cmwraprs.c:73
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertHeadList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define ExDeleteResourceLite(res)
Definition: env_spec_w32.h:647
#define NonPagedPool
Definition: env_spec_w32.h:307
ULONG ERESOURCE
Definition: env_spec_w32.h:594
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define PagedPool
Definition: env_spec_w32.h:308
FORCEINLINE VOID ExReleasePushLock(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1296
#define ExInitializePushLock
Definition: ex.h:1013
FORCEINLINE VOID ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1036
_Inout_opt_ PUNICODE_STRING Extension
Definition: fltkernel.h:1092
#define FILE_NO_COMPRESSION
Definition: from_kernel.h:43
#define FILE_OPEN
Definition: from_kernel.h:54
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
@ FileFsSizeInformation
Definition: from_kernel.h:221
#define FILE_NO_INTERMEDIATE_BUFFERING
Definition: from_kernel.h:28
#define FILE_RANDOM_ACCESS
Definition: from_kernel.h:38
#define FILE_OPEN_IF
Definition: from_kernel.h:56
#define FILE_SUPERSEDE
Definition: from_kernel.h:53
Status
Definition: gdiplustypes.h:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:31
#define KeGetCurrentThread
Definition: hal.h:55
#define HBLOCK_SIZE
Definition: hivedata.h:42
#define HINIT_FILE
Definition: hivedata.h:15
#define HINIT_MEMORY
Definition: hivedata.h:14
#define HFILE_TYPE_ALTERNATE
Definition: hivedata.h:36
#define HFILE_TYPE_MAX
Definition: hivedata.h:37
#define HFILE_TYPE_LOG
Definition: hivedata.h:34
#define HIVE_VOLATILE
Definition: hivedata.h:23
#define HFILE_TYPE_PRIMARY
Definition: hivedata.h:33
#define HINIT_MAPFILE
Definition: hivedata.h:18
#define HFILE_TYPE_EXTERNAL
Definition: hivedata.h:35
#define HINIT_MEMORY_INPLACE
Definition: hivedata.h:16
#define HSECTOR_SIZE
Definition: hivedata.h:43
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
if(dx< 0)
Definition: linetemp.h:194
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
static IDispatch External
Definition: htmldoc.c:521
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
static OUT PIO_STATUS_BLOCK OUT PVOID FileInformation
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
#define KernelMode
Definition: asm.h:34
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define SYNCHRONIZE
Definition: nt_native.h:61
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define FILE_READ_DATA
Definition: nt_native.h:628
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define FILE_CREATED
Definition: nt_native.h:770
#define FSCTL_MARK_AS_SYSTEM_HIVE
Definition: nt_native.h:845
#define FSCTL_SET_COMPRESSION
Definition: nt_native.h:842
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
@ NotificationEvent
NTSYSAPI NTSTATUS NTAPI ZwFsControlFile(IN HANDLE DeviceHandle, IN HANDLE Event OPTIONAL, IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, IN PVOID ApcContext OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, IN ULONG IoControlCode, IN PVOID InputBuffer, IN ULONG InputBufferSize, OUT PVOID OutputBuffer, IN ULONG OutputBufferSize)
NTSYSAPI NTSTATUS NTAPI ZwQueryVolumeInformationFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID FsInformation, IN ULONG Length, IN FS_INFORMATION_CLASS FsInformationClass)
VOID NTAPI CmpCloseHiveFiles(IN PCMHIVE Hive)
Definition: cminit.c:644
NTSTATUS NTAPI CmpInitializeHive(_Out_ PCMHIVE *CmHive, _In_ ULONG OperationType, _In_ ULONG HiveFlags, _In_ ULONG FileType, _In_opt_ PVOID HiveData, _In_ HANDLE Primary, _In_ HANDLE Log, _In_ HANDLE External, _In_ HANDLE Alternate, _In_opt_ PCUNICODE_STRING FileName, _In_ ULONG CheckFlags)
Definition: cminit.c:19
NTSTATUS NTAPI CmpOpenHiveFiles(IN PCUNICODE_STRING BaseName, IN PCWSTR Extension OPTIONAL, OUT PHANDLE Primary, OUT PHANDLE Log, OUT PULONG PrimaryDisposition, OUT PULONG LogDisposition, IN BOOLEAN CreateAllowed, IN BOOLEAN MarkAsSystemHive, IN BOOLEAN NoBuffering, OUT PULONG ClusterSize OPTIONAL)
Definition: cminit.c:273
NTSTATUS NTAPI CmpDestroyHive(IN PCMHIVE CmHive)
Definition: cminit.c:242
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_CANNOT_LOAD_REGISTRY_FILE
Definition: ntstatus.h:668
#define STATUS_REGISTRY_CORRUPT
Definition: ntstatus.h:568
#define STATUS_REGISTRY_IO_FAILED
Definition: ntstatus.h:569
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
#define FileStandardInformation
Definition: propsheet.cpp:61
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define STATUS_SUCCESS
Definition: shellext.h:65
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
Definition: cmlib.h:316
ULONG FlushCount
Definition: cmlib.h:356
PKTHREAD HiveSecurityLockOwner
Definition: cmlib.h:329
HHIVE Hive
Definition: cmlib.h:317
BOOLEAN HiveIsLoading
Definition: cmlib.h:357
LIST_ENTRY NotifyList
Definition: cmlib.h:319
BOOLEAN Frozen
Definition: cmlib.h:345
PKGUARDED_MUTEX ViewLock
Definition: cmlib.h:323
LIST_ENTRY HiveList
Definition: cmlib.h:320
EX_PUSH_LOCK WriterLock
Definition: cmlib.h:325
PKTHREAD HiveLockOwner
Definition: cmlib.h:322
PERESOURCE FlusherLock
Definition: cmlib.h:327
PKTHREAD WriterLockOwner
Definition: cmlib.h:326
BOOLEAN GrowOnlyMode
Definition: cmlib.h:347
LIST_ENTRY KnodeConvertListHead
Definition: cmlib.h:350
EX_PUSH_LOCK SecurityLock
Definition: cmlib.h:328
PWORK_QUEUE_ITEM UnloadWorkItem
Definition: cmlib.h:346
PKTHREAD CreatorOwner
Definition: cmlib.h:358
LIST_ENTRY TrustClassEntry
Definition: cmlib.h:355
ULONG Flags
Definition: cmlib.h:354
CM_USE_COUNT_LOG UseCountLog
Definition: cmlib.h:352
HANDLE FileHandles[HFILE_TYPE_MAX]
Definition: cmlib.h:318
LIST_ENTRY KcbConvertListHead
Definition: cmlib.h:349
PKEVENT UnloadEvent
Definition: cmlib.h:343
UNICODE_STRING FileUserName
Definition: cmlib.h:334
PFILE_OBJECT FileObject
Definition: cmlib.h:332
PCM_KEY_CONTROL_BLOCK RootKcb
Definition: cmlib.h:344
PKTHREAD ViewLockOwner
Definition: cmlib.h:324
PCM_CELL_REMAP_BLOCK CellRemapArray
Definition: cmlib.h:351
ULONG GrowOffset
Definition: cmlib.h:348
EX_PUSH_LOCK HiveLock
Definition: cmlib.h:321
CM_USE_COUNT_LOG LockHiveLog
Definition: cmlib.h:353
UNICODE_STRING FileFullPath
Definition: cmlib.h:333
USHORT Next
Definition: cmlib.h:307
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
void * Buffer
Definition: sprintf.c:453
unsigned short MaximumLength
Definition: sprintf.c:452
#define max(a, b)
Definition: svc.c:63
uint32_t * PULONG
Definition: typedefs.h:59
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658
_In_ WDFDEVICE _In_ WDF_SPECIAL_FILE_TYPE FileType
Definition: wdfdevice.h:2741
_Must_inspect_result_ _In_opt_ WDFKEY _In_ PCUNICODE_STRING _In_ ACCESS_MASK _In_ ULONG _Out_opt_ PULONG CreateDisposition
Definition: wdfregistry.h:120
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:857
@ Executive
Definition: ketypes.h:415
#define ObDereferenceObject
Definition: obfuncs.h:203
_In_ PSTRING FullName
Definition: rtlfuncs.h:1648
__wchar_t WCHAR
Definition: xmlstorage.h:180