mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
[NTOS:CM][CMLIB] Minor code styling
In particular remove some extra-parentheses around single code tokens, and replace few "DPRINT1 + while (TRUE);" by UNIMPLEMENTED_DBGBREAK. + Improve some comments.
This commit is contained in:
parent
d41dec2e07
commit
76f1da5631
11 changed files with 103 additions and 107 deletions
|
@ -67,8 +67,7 @@ CmpIsHiveAlreadyLoaded(IN HANDLE KeyHandle,
|
||||||
if (Hive->Frozen)
|
if (Hive->Frozen)
|
||||||
{
|
{
|
||||||
/* FIXME: TODO */
|
/* FIXME: TODO */
|
||||||
DPRINT1("ERROR: Hive is frozen\n");
|
UNIMPLEMENTED_DBGBREAK("ERROR: Hive is frozen\n");
|
||||||
while (TRUE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,22 +104,22 @@ CmpDoFlushAll(IN BOOLEAN ForceFlush)
|
||||||
CmpLockHiveFlusherExclusive(Hive);
|
CmpLockHiveFlusherExclusive(Hive);
|
||||||
|
|
||||||
/* Check for illegal state */
|
/* Check for illegal state */
|
||||||
if ((ForceFlush) && (Hive->UseCount))
|
if (ForceFlush && Hive->UseCount)
|
||||||
{
|
{
|
||||||
/* Registry needs to be locked down */
|
/* Registry needs to be locked down */
|
||||||
CMP_ASSERT_EXCLUSIVE_REGISTRY_LOCK();
|
CMP_ASSERT_EXCLUSIVE_REGISTRY_LOCK();
|
||||||
DPRINT1("FIXME: Hive is damaged and needs fixup\n");
|
UNIMPLEMENTED_DBGBREAK("FIXME: Hive is damaged and needs fixup\n");
|
||||||
while (TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only sync if we are forced to or if it won't cause a hive shrink */
|
/* Only sync if we are forced to or if it won't cause a hive shrink */
|
||||||
if ((ForceFlush) || (!HvHiveWillShrink(&Hive->Hive)))
|
if (ForceFlush || !HvHiveWillShrink(&Hive->Hive))
|
||||||
{
|
{
|
||||||
/* Do the sync */
|
/* Do the sync */
|
||||||
Status = HvSyncHive(&Hive->Hive);
|
Status = HvSyncHive(&Hive->Hive);
|
||||||
|
|
||||||
/* If something failed - set the flag and continue looping */
|
/* If something failed - set the flag and continue looping */
|
||||||
if (!NT_SUCCESS(Status)) Result = FALSE;
|
if (!NT_SUCCESS(Status))
|
||||||
|
Result = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -708,8 +707,8 @@ DoAgain:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need the exclusive KCB lock now */
|
/* We need the exclusive KCB lock now */
|
||||||
if (!(CmpIsKcbLockedExclusive(Kcb)) &&
|
if (!CmpIsKcbLockedExclusive(Kcb) &&
|
||||||
!(CmpTryToConvertKcbSharedToExclusive(Kcb)))
|
!CmpTryToConvertKcbSharedToExclusive(Kcb))
|
||||||
{
|
{
|
||||||
/* Acquire exclusive lock */
|
/* Acquire exclusive lock */
|
||||||
CmpConvertKcbSharedToExclusive(Kcb);
|
CmpConvertKcbSharedToExclusive(Kcb);
|
||||||
|
@ -873,7 +872,7 @@ DoAgain:
|
||||||
Kcb->KcbLastWriteTime = Parent->LastWriteTime;
|
Kcb->KcbLastWriteTime = Parent->LastWriteTime;
|
||||||
|
|
||||||
/* Check if the cell is cached */
|
/* Check if the cell is cached */
|
||||||
if ((Found) && (CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList)))
|
if (Found && CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList))
|
||||||
{
|
{
|
||||||
/* Shouldn't happen */
|
/* Shouldn't happen */
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
|
@ -884,7 +883,7 @@ DoAgain:
|
||||||
CmpCleanUpKcbValueCache(Kcb);
|
CmpCleanUpKcbValueCache(Kcb);
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(!(CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList)));
|
ASSERT(!CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList));
|
||||||
ASSERT(!(Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND));
|
ASSERT(!(Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND));
|
||||||
|
|
||||||
/* Set the value cache */
|
/* Set the value cache */
|
||||||
|
@ -901,8 +900,8 @@ DoAgain:
|
||||||
|
|
||||||
/* Release the cells */
|
/* Release the cells */
|
||||||
Quickie:
|
Quickie:
|
||||||
if ((ParentCell != HCELL_NIL) && (Hive)) HvReleaseCell(Hive, ParentCell);
|
if ((ParentCell != HCELL_NIL) && Hive) HvReleaseCell(Hive, ParentCell);
|
||||||
if ((ChildCell != HCELL_NIL) && (Hive)) HvReleaseCell(Hive, ChildCell);
|
if ((ChildCell != HCELL_NIL) && Hive) HvReleaseCell(Hive, ChildCell);
|
||||||
|
|
||||||
/* Release the locks */
|
/* Release the locks */
|
||||||
if (FlusherLocked) CmpUnlockHiveFlusher((PCMHIVE)Hive);
|
if (FlusherLocked) CmpUnlockHiveFlusher((PCMHIVE)Hive);
|
||||||
|
@ -972,9 +971,9 @@ CmDeleteValueKey(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||||
if (ChildCell == HCELL_NIL) goto Quickie;
|
if (ChildCell == HCELL_NIL) goto Quickie;
|
||||||
|
|
||||||
/* We found the value, mark all relevant cells dirty */
|
/* We found the value, mark all relevant cells dirty */
|
||||||
if (!((HvMarkCellDirty(Hive, Cell, FALSE)) &&
|
if (!(HvMarkCellDirty(Hive, Cell, FALSE) &&
|
||||||
(HvMarkCellDirty(Hive, Parent->ValueList.List, FALSE)) &&
|
HvMarkCellDirty(Hive, Parent->ValueList.List, FALSE) &&
|
||||||
(HvMarkCellDirty(Hive, ChildCell, FALSE))))
|
HvMarkCellDirty(Hive, ChildCell, FALSE)))
|
||||||
{
|
{
|
||||||
/* Not enough log space, fail */
|
/* Not enough log space, fail */
|
||||||
Status = STATUS_NO_LOG_SPACE;
|
Status = STATUS_NO_LOG_SPACE;
|
||||||
|
@ -1037,7 +1036,7 @@ CmDeleteValueKey(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||||
CmpCleanUpKcbValueCache(Kcb);
|
CmpCleanUpKcbValueCache(Kcb);
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(!(CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList)));
|
ASSERT(!CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList));
|
||||||
ASSERT(!(Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND));
|
ASSERT(!(Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND));
|
||||||
|
|
||||||
/* Set the value cache */
|
/* Set the value cache */
|
||||||
|
|
|
@ -208,8 +208,7 @@ CmGetSystemControlValues(IN PVOID SystemHiveData,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check if this is a small key */
|
/* Sanity check if this is a small key */
|
||||||
ASSERT((IsSmallKey ?
|
ASSERT(IsSmallKey ? (Length <= CM_KEY_VALUE_SMALL) : TRUE);
|
||||||
(Length <= CM_KEY_VALUE_SMALL) : TRUE));
|
|
||||||
|
|
||||||
/* Copy the data in the buffer */
|
/* Copy the data in the buffer */
|
||||||
RtlCopyMemory(ControlVector->Buffer, Buffer, Length);
|
RtlCopyMemory(ControlVector->Buffer, Buffer, Length);
|
||||||
|
|
|
@ -49,14 +49,14 @@ CmpInitializeHive(
|
||||||
* - An alternate hive that is not linked to a correct file type.
|
* - An alternate hive that is not linked to a correct file type.
|
||||||
* - A lonely alternate hive not backed up with its corresponding primary hive.
|
* - A lonely alternate hive not backed up with its corresponding primary hive.
|
||||||
*/
|
*/
|
||||||
if (((External) && ((Primary) || (Log))) ||
|
if ((External && (Primary || Log)) ||
|
||||||
((Log) && !(Primary)) ||
|
(Log && !Primary) ||
|
||||||
(!(CmpShareSystemHives) && (HiveFlags & HIVE_VOLATILE) &&
|
(!CmpShareSystemHives && (HiveFlags & HIVE_VOLATILE) &&
|
||||||
((Primary) || (External) || (Log))) ||
|
(Primary || External || Log)) ||
|
||||||
((OperationType == HINIT_MEMORY) && (!HiveData)) ||
|
((OperationType == HINIT_MEMORY) && !HiveData) ||
|
||||||
((Log) && (FileType != HFILE_TYPE_LOG)) ||
|
(Log && (FileType != HFILE_TYPE_LOG)) ||
|
||||||
((Alternate) && (FileType != HFILE_TYPE_ALTERNATE)) ||
|
(Alternate && (FileType != HFILE_TYPE_ALTERNATE)) ||
|
||||||
((Alternate) && !(Primary)))
|
(Alternate && !Primary))
|
||||||
{
|
{
|
||||||
/* Fail the request */
|
/* Fail the request */
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
@ -338,7 +338,7 @@ CmpOpenHiveFiles(IN PCUNICODE_STRING BaseName,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* Check if we can create the hive */
|
/* Check if we can create the hive */
|
||||||
if ((CreateAllowed) && !(CmpShareSystemHives))
|
if (CreateAllowed && !CmpShareSystemHives)
|
||||||
{
|
{
|
||||||
/* Open only or create */
|
/* Open only or create */
|
||||||
CreateDisposition = FILE_OPEN_IF;
|
CreateDisposition = FILE_OPEN_IF;
|
||||||
|
@ -357,7 +357,7 @@ CmpOpenHiveFiles(IN PCUNICODE_STRING BaseName,
|
||||||
(NoBuffering ? FILE_NO_INTERMEDIATE_BUFFERING : 0);
|
(NoBuffering ? FILE_NO_INTERMEDIATE_BUFFERING : 0);
|
||||||
|
|
||||||
/* Set share and access modes */
|
/* Set share and access modes */
|
||||||
if ((CmpMiniNTBoot) && (CmpShareSystemHives))
|
if (CmpMiniNTBoot && CmpShareSystemHives)
|
||||||
{
|
{
|
||||||
/* We're on Live CD or otherwise sharing */
|
/* We're on Live CD or otherwise sharing */
|
||||||
DesiredAccess = FILE_READ_DATA;
|
DesiredAccess = FILE_READ_DATA;
|
||||||
|
@ -568,7 +568,7 @@ CmpOpenHiveFiles(IN PCUNICODE_STRING BaseName,
|
||||||
FILE_SYNCHRONOUS_IO_NONALERT | IoFlags,
|
FILE_SYNCHRONOUS_IO_NONALERT | IoFlags,
|
||||||
NULL,
|
NULL,
|
||||||
0);
|
0);
|
||||||
if ((NT_SUCCESS(Status)) && (MarkAsSystemHive))
|
if (NT_SUCCESS(Status) && MarkAsSystemHive)
|
||||||
{
|
{
|
||||||
/* We opened it, mark it as a system hive */
|
/* We opened it, mark it as a system hive */
|
||||||
Status = ZwFsControlFile(*Log,
|
Status = ZwFsControlFile(*Log,
|
||||||
|
|
|
@ -619,11 +619,11 @@ CmpDereferenceKeyControlBlockWithLock(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||||
CMP_ASSERT_KCB_LOCK(Kcb);
|
CMP_ASSERT_KCB_LOCK(Kcb);
|
||||||
|
|
||||||
/* Check if we should do a direct delete */
|
/* Check if we should do a direct delete */
|
||||||
if (((CmpHoldLazyFlush) &&
|
if ((CmpHoldLazyFlush &&
|
||||||
!(Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND) &&
|
!(Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND) &&
|
||||||
!(Kcb->Flags & KEY_SYM_LINK)) ||
|
!(Kcb->Flags & KEY_SYM_LINK)) ||
|
||||||
(Kcb->ExtFlags & CM_KCB_NO_DELAY_CLOSE) ||
|
(Kcb->ExtFlags & CM_KCB_NO_DELAY_CLOSE) ||
|
||||||
(Kcb->Delete))
|
Kcb->Delete)
|
||||||
{
|
{
|
||||||
/* Clean up the KCB*/
|
/* Clean up the KCB*/
|
||||||
CmpCleanUpKcbCacheWithLock(Kcb, LockHeldExclusively);
|
CmpCleanUpKcbCacheWithLock(Kcb, LockHeldExclusively);
|
||||||
|
@ -683,7 +683,7 @@ CmpCreateKeyControlBlock(IN PHHIVE Hive,
|
||||||
NodeName = *KeyName;
|
NodeName = *KeyName;
|
||||||
|
|
||||||
/* Remove leading slash */
|
/* Remove leading slash */
|
||||||
while ((NodeName.Length) && (*NodeName.Buffer == OBJ_NAME_PATH_SEPARATOR))
|
while (NodeName.Length && (*NodeName.Buffer == OBJ_NAME_PATH_SEPARATOR))
|
||||||
{
|
{
|
||||||
/* Move the buffer by one */
|
/* Move the buffer by one */
|
||||||
NodeName.Buffer++;
|
NodeName.Buffer++;
|
||||||
|
@ -764,7 +764,7 @@ CmpCreateKeyControlBlock(IN PHHIVE Hive,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Check if we're not creating a fake one, but it used to be fake */
|
/* Check if we're not creating a fake one, but it used to be fake */
|
||||||
if ((Kcb->ExtFlags & CM_KCB_KEY_NON_EXIST) && !(IsFake))
|
if ((Kcb->ExtFlags & CM_KCB_KEY_NON_EXIST) && !IsFake)
|
||||||
{
|
{
|
||||||
/* Set the hive and cell */
|
/* Set the hive and cell */
|
||||||
Kcb->KeyHive = Hive;
|
Kcb->KeyHive = Hive;
|
||||||
|
@ -801,7 +801,7 @@ CmpCreateKeyControlBlock(IN PHHIVE Hive,
|
||||||
{
|
{
|
||||||
/* Reference the parent */
|
/* Reference the parent */
|
||||||
if (((Parent->TotalLevels + 1) < 512) &&
|
if (((Parent->TotalLevels + 1) < 512) &&
|
||||||
(CmpReferenceKeyControlBlock(Parent)))
|
CmpReferenceKeyControlBlock(Parent))
|
||||||
{
|
{
|
||||||
/* Link it */
|
/* Link it */
|
||||||
Kcb->ParentKcb = Parent;
|
Kcb->ParentKcb = Parent;
|
||||||
|
@ -863,14 +863,14 @@ CmpCreateKeyControlBlock(IN PHHIVE Hive,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if this is a KCB inside a frozen hive */
|
/* Check if this is a KCB inside a frozen hive */
|
||||||
if ((Kcb) && (((PCMHIVE)Hive)->Frozen) && (!(Kcb->Flags & KEY_SYM_LINK)))
|
if (Kcb && ((PCMHIVE)Hive)->Frozen && !(Kcb->Flags & KEY_SYM_LINK))
|
||||||
{
|
{
|
||||||
/* Don't add these to the delay close */
|
/* Don't add these to the delay close */
|
||||||
Kcb->ExtFlags |= CM_KCB_NO_DELAY_CLOSE;
|
Kcb->ExtFlags |= CM_KCB_NO_DELAY_CLOSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
ASSERT((!Kcb) || (Kcb->Delete == FALSE));
|
ASSERT(!Kcb || !Kcb->Delete);
|
||||||
|
|
||||||
/* Check if we had locked the hashes */
|
/* Check if we had locked the hashes */
|
||||||
if (!HashLock)
|
if (!HashLock)
|
||||||
|
@ -950,7 +950,7 @@ CmpConstructName(IN PCM_KEY_CONTROL_BLOCK Kcb)
|
||||||
/* Sanity checks for deleted and fake keys */
|
/* Sanity checks for deleted and fake keys */
|
||||||
if ((!MyKcb->KeyCell && !MyKcb->Delete) ||
|
if ((!MyKcb->KeyCell && !MyKcb->Delete) ||
|
||||||
!MyKcb->KeyHive ||
|
!MyKcb->KeyHive ||
|
||||||
MyKcb->ExtFlags & CM_KCB_KEY_NON_EXIST)
|
(MyKcb->ExtFlags & CM_KCB_KEY_NON_EXIST))
|
||||||
{
|
{
|
||||||
/* Failure */
|
/* Failure */
|
||||||
CmpFree(KeyName, 0);
|
CmpFree(KeyName, 0);
|
||||||
|
@ -1109,7 +1109,7 @@ DelistKeyBodyFromKCB(IN PCM_KEY_BODY KeyBody,
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
/* Add it into the list */
|
/* Add it into the list */
|
||||||
if (InterlockedCompareExchangePointer((VOID*)&KeyBody->KeyControlBlock->
|
if (InterlockedCompareExchangePointer((PVOID*)&KeyBody->KeyControlBlock->
|
||||||
KeyBodyArray[i],
|
KeyBodyArray[i],
|
||||||
NULL,
|
NULL,
|
||||||
KeyBody) == KeyBody)
|
KeyBody) == KeyBody)
|
||||||
|
|
|
@ -92,9 +92,9 @@ CmpDoFlushNextHive(_In_ BOOLEAN ForceFlush,
|
||||||
CmHive->FlushCount = CmpLazyFlushCount;
|
CmHive->FlushCount = CmpLazyFlushCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((CmHive->Hive.DirtyCount) &&
|
else if (CmHive->Hive.DirtyCount &&
|
||||||
(!(CmHive->Hive.HiveFlags & HIVE_VOLATILE)) &&
|
!(CmHive->Hive.HiveFlags & HIVE_VOLATILE) &&
|
||||||
(!(CmHive->Hive.HiveFlags & HIVE_NOLAZYFLUSH)))
|
!(CmHive->Hive.HiveFlags & HIVE_NOLAZYFLUSH))
|
||||||
{
|
{
|
||||||
/* Use another lazy flusher for this hive */
|
/* Use another lazy flusher for this hive */
|
||||||
ASSERT(CmHive->FlushCount == CmpLazyFlushCount);
|
ASSERT(CmHive->FlushCount == CmpLazyFlushCount);
|
||||||
|
@ -145,7 +145,7 @@ CmpLazyFlushDpcRoutine(IN PKDPC Dpc,
|
||||||
{
|
{
|
||||||
/* Check if we should queue the lazy flush worker */
|
/* Check if we should queue the lazy flush worker */
|
||||||
DPRINT("Flush pending: %s, Holding lazy flush: %s.\n", CmpLazyFlushPending ? "yes" : "no", CmpHoldLazyFlush ? "yes" : "no");
|
DPRINT("Flush pending: %s, Holding lazy flush: %s.\n", CmpLazyFlushPending ? "yes" : "no", CmpHoldLazyFlush ? "yes" : "no");
|
||||||
if ((!CmpLazyFlushPending) && (!CmpHoldLazyFlush))
|
if (!CmpLazyFlushPending && !CmpHoldLazyFlush)
|
||||||
{
|
{
|
||||||
CmpLazyFlushPending = TRUE;
|
CmpLazyFlushPending = TRUE;
|
||||||
ExQueueWorkItem(&CmpLazyWorkItem, DelayedWorkQueue);
|
ExQueueWorkItem(&CmpLazyWorkItem, DelayedWorkQueue);
|
||||||
|
@ -160,7 +160,7 @@ CmpLazyFlush(VOID)
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Check if we should set the lazy flush timer */
|
/* Check if we should set the lazy flush timer */
|
||||||
if ((!CmpNoWrite) && (!CmpHoldLazyFlush))
|
if (!CmpNoWrite && !CmpHoldLazyFlush)
|
||||||
{
|
{
|
||||||
/* Do it */
|
/* Do it */
|
||||||
DueTime.QuadPart = Int32x32To64(CmpLazyFlushIntervalInSeconds,
|
DueTime.QuadPart = Int32x32To64(CmpLazyFlushIntervalInSeconds,
|
||||||
|
@ -400,7 +400,7 @@ CmpCmdHiveOpen(IN POBJECT_ATTRIBUTES FileAttributes,
|
||||||
(Status == STATUS_ACCOUNT_EXPIRED) ||
|
(Status == STATUS_ACCOUNT_EXPIRED) ||
|
||||||
(Status == STATUS_ACCOUNT_DISABLED) ||
|
(Status == STATUS_ACCOUNT_DISABLED) ||
|
||||||
(Status == STATUS_ACCOUNT_RESTRICTION)) &&
|
(Status == STATUS_ACCOUNT_RESTRICTION)) &&
|
||||||
(ImpersonationContext))
|
ImpersonationContext)
|
||||||
{
|
{
|
||||||
/* We failed due to an account/security error, impersonate SYSTEM */
|
/* We failed due to an account/security error, impersonate SYSTEM */
|
||||||
Status = SeImpersonateClientEx(ImpersonationContext, NULL);
|
Status = SeImpersonateClientEx(ImpersonationContext, NULL);
|
||||||
|
|
|
@ -39,7 +39,7 @@ CmpGetNextName(IN OUT PUNICODE_STRING RemainingName,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we have a path separator */
|
/* Check if we have a path separator */
|
||||||
while ((RemainingName->Length) &&
|
while (RemainingName->Length &&
|
||||||
(*RemainingName->Buffer == OBJ_NAME_PATH_SEPARATOR))
|
(*RemainingName->Buffer == OBJ_NAME_PATH_SEPARATOR))
|
||||||
{
|
{
|
||||||
/* Skip it */
|
/* Skip it */
|
||||||
|
@ -50,7 +50,7 @@ CmpGetNextName(IN OUT PUNICODE_STRING RemainingName,
|
||||||
|
|
||||||
/* Start loop at where the current buffer is */
|
/* Start loop at where the current buffer is */
|
||||||
NextName->Buffer = RemainingName->Buffer;
|
NextName->Buffer = RemainingName->Buffer;
|
||||||
while ((RemainingName->Length) &&
|
while (RemainingName->Length &&
|
||||||
(*RemainingName->Buffer != OBJ_NAME_PATH_SEPARATOR))
|
(*RemainingName->Buffer != OBJ_NAME_PATH_SEPARATOR))
|
||||||
{
|
{
|
||||||
/* Move to the next character */
|
/* Move to the next character */
|
||||||
|
@ -1873,7 +1873,7 @@ CmpParseKey(IN PVOID ParseObject,
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Loop path separators at the end */
|
/* Loop path separators at the end */
|
||||||
while ((RemainingName->Length) &&
|
while (RemainingName->Length &&
|
||||||
(RemainingName->Buffer[(RemainingName->Length / sizeof(WCHAR)) - 1] ==
|
(RemainingName->Buffer[(RemainingName->Length / sizeof(WCHAR)) - 1] ==
|
||||||
OBJ_NAME_PATH_SEPARATOR))
|
OBJ_NAME_PATH_SEPARATOR))
|
||||||
{
|
{
|
||||||
|
@ -1888,7 +1888,7 @@ CmpParseKey(IN PVOID ParseObject,
|
||||||
Current = *RemainingName;
|
Current = *RemainingName;
|
||||||
|
|
||||||
/* Check if this is a create */
|
/* Check if this is a create */
|
||||||
if (!(ParseContext) || !(ParseContext->CreateOperation))
|
if (!ParseContext || !ParseContext->CreateOperation)
|
||||||
{
|
{
|
||||||
/* It isn't, so no context */
|
/* It isn't, so no context */
|
||||||
ParseContext = NULL;
|
ParseContext = NULL;
|
||||||
|
@ -2043,7 +2043,7 @@ CmpParseKey(IN PVOID ParseObject,
|
||||||
{
|
{
|
||||||
/* Get the next component */
|
/* Get the next component */
|
||||||
Result = CmpGetNextName(&Current, &NextName, &Last);
|
Result = CmpGetNextName(&Current, &NextName, &Last);
|
||||||
if ((Result) && (NextName.Length))
|
if (Result && NextName.Length)
|
||||||
{
|
{
|
||||||
/* See if this is a sym link */
|
/* See if this is a sym link */
|
||||||
if (!(Kcb->Flags & KEY_SYM_LINK))
|
if (!(Kcb->Flags & KEY_SYM_LINK))
|
||||||
|
@ -2150,7 +2150,7 @@ KeyCachedOpenNow:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Check if this was the last key for a create */
|
/* Check if this was the last key for a create */
|
||||||
if ((Last) && (ParseContext))
|
if (Last && ParseContext)
|
||||||
{
|
{
|
||||||
/* Check if we're doing a link node */
|
/* Check if we're doing a link node */
|
||||||
if (ParseContext->CreateLink)
|
if (ParseContext->CreateLink)
|
||||||
|
@ -2246,7 +2246,7 @@ KeyCachedOpenNow:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((Result) && (Last))
|
else if (Result && Last)
|
||||||
{
|
{
|
||||||
/* Opening the root. Is this an exit node? */
|
/* Opening the root. Is this an exit node? */
|
||||||
if (Node->Flags & KEY_HIVE_EXIT)
|
if (Node->Flags & KEY_HIVE_EXIT)
|
||||||
|
|
|
@ -40,7 +40,7 @@ CmpHiveRootSecurityDescriptor(VOID)
|
||||||
Sid[3] = ExAllocatePoolWithTag(PagedPool, SidLength, TAG_CMSD);
|
Sid[3] = ExAllocatePoolWithTag(PagedPool, SidLength, TAG_CMSD);
|
||||||
|
|
||||||
/* Make sure all SIDs were allocated */
|
/* Make sure all SIDs were allocated */
|
||||||
if (!(Sid[0]) || !(Sid[1]) || !(Sid[2]) || !(Sid[3]))
|
if (!Sid[0] || !Sid[1] || !Sid[2] || !Sid[3])
|
||||||
{
|
{
|
||||||
/* Bugcheck */
|
/* Bugcheck */
|
||||||
KeBugCheckEx(REGISTRY_ERROR, 11, 1, 0, 0);
|
KeBugCheckEx(REGISTRY_ERROR, 11, 1, 0, 0);
|
||||||
|
|
|
@ -228,7 +228,7 @@ CmpQueryKeyName(IN PVOID ObjectBody,
|
||||||
|
|
||||||
/* Check if the provided buffer is too small to fit even anything */
|
/* Check if the provided buffer is too small to fit even anything */
|
||||||
if ((Length <= sizeof(OBJECT_NAME_INFORMATION)) ||
|
if ((Length <= sizeof(OBJECT_NAME_INFORMATION)) ||
|
||||||
((Length < (*ReturnLength)) && (BytesToCopy < sizeof(WCHAR))))
|
((Length < *ReturnLength) && (BytesToCopy < sizeof(WCHAR))))
|
||||||
{
|
{
|
||||||
/* Free the buffer allocated by CmpConstructName */
|
/* Free the buffer allocated by CmpConstructName */
|
||||||
ExFreePoolWithTag(KeyName, TAG_CM);
|
ExFreePoolWithTag(KeyName, TAG_CM);
|
||||||
|
@ -238,7 +238,7 @@ CmpQueryKeyName(IN PVOID ObjectBody,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the provided buffer can be partially written */
|
/* Check if the provided buffer can be partially written */
|
||||||
if (Length < (*ReturnLength))
|
if (Length < *ReturnLength)
|
||||||
{
|
{
|
||||||
/* Yes, indicate so in the return status */
|
/* Yes, indicate so in the return status */
|
||||||
Status = STATUS_INFO_LENGTH_MISMATCH;
|
Status = STATUS_INFO_LENGTH_MISMATCH;
|
||||||
|
@ -687,7 +687,7 @@ CmpCreateControlSet(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
ValueInfo = (PKEY_VALUE_FULL_INFORMATION)ValueInfoBuffer;
|
ValueInfo = (PKEY_VALUE_FULL_INFORMATION)ValueInfoBuffer;
|
||||||
|
|
||||||
/* Check if we failed or got a non DWORD-value */
|
/* Check if we failed or got a non DWORD-value */
|
||||||
if (!(NT_SUCCESS(Status)) || (ValueInfo->Type != REG_DWORD))
|
if (!NT_SUCCESS(Status) || (ValueInfo->Type != REG_DWORD))
|
||||||
{
|
{
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
|
@ -728,7 +728,7 @@ CmpCreateControlSet(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
Status = NtOpenKey(&ProfileHandle,
|
Status = NtOpenKey(&ProfileHandle,
|
||||||
KEY_READ | KEY_WRITE,
|
KEY_READ | KEY_WRITE,
|
||||||
&ObjectAttributes);
|
&ObjectAttributes);
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Cleanup and exit */
|
/* Cleanup and exit */
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
@ -1319,8 +1319,8 @@ CmpLoadHiveThread(IN PVOID StartContext)
|
||||||
&CmHive,
|
&CmHive,
|
||||||
&CmpMachineHiveList[i].Allocate,
|
&CmpMachineHiveList[i].Allocate,
|
||||||
CM_CHECK_REGISTRY_PURGE_VOLATILES);
|
CM_CHECK_REGISTRY_PURGE_VOLATILES);
|
||||||
if (!(NT_SUCCESS(Status)) ||
|
if (!NT_SUCCESS(Status) ||
|
||||||
(!(CmpShareSystemHives) && !(CmHive->FileHandles[HFILE_TYPE_LOG])))
|
(!CmpShareSystemHives && !CmHive->FileHandles[HFILE_TYPE_LOG]))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We failed, or could not get a log file (unless
|
* We failed, or could not get a log file (unless
|
||||||
|
@ -1356,7 +1356,7 @@ CmpLoadHiveThread(IN PVOID StartContext)
|
||||||
TRUE,
|
TRUE,
|
||||||
FALSE,
|
FALSE,
|
||||||
&ClusterSize);
|
&ClusterSize);
|
||||||
if (!(NT_SUCCESS(Status)) || !(AlternateHandle))
|
if (!NT_SUCCESS(Status) || !AlternateHandle)
|
||||||
{
|
{
|
||||||
/* Couldn't open the hive or its alternate file, raise a hard error */
|
/* Couldn't open the hive or its alternate file, raise a hard error */
|
||||||
ErrorParameters = &FileName;
|
ErrorParameters = &FileName;
|
||||||
|
@ -2111,14 +2111,14 @@ CmpReleaseTwoKcbLockByKey(IN ULONG ConvKey1,
|
||||||
Index1 = GET_HASH_INDEX(ConvKey1);
|
Index1 = GET_HASH_INDEX(ConvKey1);
|
||||||
Index2 = GET_HASH_INDEX(ConvKey2);
|
Index2 = GET_HASH_INDEX(ConvKey2);
|
||||||
ASSERT((GET_HASH_ENTRY(CmpCacheTable, ConvKey2)->Owner == KeGetCurrentThread()) ||
|
ASSERT((GET_HASH_ENTRY(CmpCacheTable, ConvKey2)->Owner == KeGetCurrentThread()) ||
|
||||||
(CmpTestRegistryLockExclusive()));
|
CmpTestRegistryLockExclusive());
|
||||||
|
|
||||||
/* See which one is highest */
|
/* See which one is highest */
|
||||||
if (Index1 < Index2)
|
if (Index1 < Index2)
|
||||||
{
|
{
|
||||||
/* Grab them in the proper order */
|
/* Grab them in the proper order */
|
||||||
ASSERT((GET_HASH_ENTRY(CmpCacheTable, ConvKey1)->Owner == KeGetCurrentThread()) ||
|
ASSERT((GET_HASH_ENTRY(CmpCacheTable, ConvKey1)->Owner == KeGetCurrentThread()) ||
|
||||||
(CmpTestRegistryLockExclusive()));
|
CmpTestRegistryLockExclusive());
|
||||||
CmpReleaseKcbLockByKey(ConvKey2);
|
CmpReleaseKcbLockByKey(ConvKey2);
|
||||||
CmpReleaseKcbLockByKey(ConvKey1);
|
CmpReleaseKcbLockByKey(ConvKey1);
|
||||||
}
|
}
|
||||||
|
@ -2128,7 +2128,7 @@ CmpReleaseTwoKcbLockByKey(IN ULONG ConvKey1,
|
||||||
if (Index1 != Index2)
|
if (Index1 != Index2)
|
||||||
{
|
{
|
||||||
ASSERT((GET_HASH_ENTRY(CmpCacheTable, ConvKey1)->Owner == KeGetCurrentThread()) ||
|
ASSERT((GET_HASH_ENTRY(CmpCacheTable, ConvKey1)->Owner == KeGetCurrentThread()) ||
|
||||||
(CmpTestRegistryLockExclusive()));
|
CmpTestRegistryLockExclusive());
|
||||||
CmpReleaseKcbLockByKey(ConvKey1);
|
CmpReleaseKcbLockByKey(ConvKey1);
|
||||||
}
|
}
|
||||||
CmpReleaseKcbLockByKey(ConvKey2);
|
CmpReleaseKcbLockByKey(ConvKey2);
|
||||||
|
|
|
@ -69,8 +69,8 @@ CmpGetValueListFromCache(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Make sure the KCB is locked exclusive */
|
/* Make sure the KCB is locked exclusive */
|
||||||
if (!(CmpIsKcbLockedExclusive(Kcb)) &&
|
if (!CmpIsKcbLockedExclusive(Kcb) &&
|
||||||
!(CmpTryToConvertKcbSharedToExclusive(Kcb)))
|
!CmpTryToConvertKcbSharedToExclusive(Kcb))
|
||||||
{
|
{
|
||||||
/* We need the exclusive lock */
|
/* We need the exclusive lock */
|
||||||
return SearchNeedExclusiveLock;
|
return SearchNeedExclusiveLock;
|
||||||
|
@ -79,7 +79,7 @@ CmpGetValueListFromCache(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||||
/* Select the value list as our cell, and get the actual list array */
|
/* Select the value list as our cell, and get the actual list array */
|
||||||
CellToRelease = ChildList->ValueList;
|
CellToRelease = ChildList->ValueList;
|
||||||
*CellData = (PCELL_DATA)HvGetCell(Hive, CellToRelease);
|
*CellData = (PCELL_DATA)HvGetCell(Hive, CellToRelease);
|
||||||
if (!(*CellData)) return SearchFail;
|
if (!*CellData) return SearchFail;
|
||||||
|
|
||||||
/* FIXME: Here we would cache the value */
|
/* FIXME: Here we would cache the value */
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ CmpFindValueByNameFromCache(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||||
if (SearchResult != SearchSuccess)
|
if (SearchResult != SearchSuccess)
|
||||||
{
|
{
|
||||||
/* We either failed or need the exclusive lock */
|
/* We either failed or need the exclusive lock */
|
||||||
ASSERT((SearchResult == SearchFail) || !(CmpIsKcbLockedExclusive(Kcb)));
|
ASSERT((SearchResult == SearchFail) || !CmpIsKcbLockedExclusive(Kcb));
|
||||||
ASSERT(Cell == HCELL_NIL);
|
ASSERT(Cell == HCELL_NIL);
|
||||||
return SearchResult;
|
return SearchResult;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ CmpFindValueByNameFromCache(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||||
if (SearchResult != SearchSuccess)
|
if (SearchResult != SearchSuccess)
|
||||||
{
|
{
|
||||||
/* We either failed or need the exclusive lock */
|
/* We either failed or need the exclusive lock */
|
||||||
ASSERT((SearchResult == SearchFail) || !(CmpIsKcbLockedExclusive(Kcb)));
|
ASSERT((SearchResult == SearchFail) || !CmpIsKcbLockedExclusive(Kcb));
|
||||||
ASSERT(Cell == HCELL_NIL);
|
ASSERT(Cell == HCELL_NIL);
|
||||||
return SearchResult;
|
return SearchResult;
|
||||||
}
|
}
|
||||||
|
@ -552,7 +552,7 @@ CmpQueryKeyValueData(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
ASSERT((IsSmall ? (Size <= CM_KEY_VALUE_SMALL) : TRUE));
|
ASSERT(IsSmall ? (Size <= CM_KEY_VALUE_SMALL) : TRUE);
|
||||||
|
|
||||||
/* Make sure we have a valid buffer */
|
/* Make sure we have a valid buffer */
|
||||||
if (Buffer)
|
if (Buffer)
|
||||||
|
@ -658,7 +658,7 @@ CmpQueryKeyValueData(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
ASSERT((IsSmall ? (Size <= CM_KEY_VALUE_SMALL) : TRUE));
|
ASSERT(IsSmall ? (Size <= CM_KEY_VALUE_SMALL) : TRUE);
|
||||||
|
|
||||||
/* Make sure we have a valid buffer */
|
/* Make sure we have a valid buffer */
|
||||||
if (Buffer)
|
if (Buffer)
|
||||||
|
@ -719,8 +719,8 @@ CmpCompareNewValueDataAgainstKCBCache(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||||
if (Kcb->Flags & KEY_SYM_LINK)
|
if (Kcb->Flags & KEY_SYM_LINK)
|
||||||
{
|
{
|
||||||
/* We need the exclusive lock */
|
/* We need the exclusive lock */
|
||||||
if (!(CmpIsKcbLockedExclusive(Kcb)) &&
|
if (!CmpIsKcbLockedExclusive(Kcb) &&
|
||||||
!(CmpTryToConvertKcbSharedToExclusive(Kcb)))
|
!CmpTryToConvertKcbSharedToExclusive(Kcb))
|
||||||
{
|
{
|
||||||
/* We need the exclusive lock */
|
/* We need the exclusive lock */
|
||||||
return SearchNeedExclusiveLock;
|
return SearchNeedExclusiveLock;
|
||||||
|
@ -734,7 +734,7 @@ CmpCompareNewValueDataAgainstKCBCache(IN PCM_KEY_CONTROL_BLOCK Kcb,
|
||||||
CmpCleanUpKcbValueCache(Kcb);
|
CmpCleanUpKcbValueCache(Kcb);
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(!(CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList)));
|
ASSERT(!CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList));
|
||||||
ASSERT(!(Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND));
|
ASSERT(!(Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND));
|
||||||
|
|
||||||
/* Set the value cache */
|
/* Set the value cache */
|
||||||
|
|
|
@ -805,7 +805,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
|
||||||
goto Quit;
|
goto Quit;
|
||||||
|
|
||||||
/* Make sure the name is aligned properly */
|
/* Make sure the name is aligned properly */
|
||||||
if ((ValueNameCopy.Length & (sizeof(WCHAR) - 1)))
|
if (ValueNameCopy.Length & (sizeof(WCHAR) - 1))
|
||||||
{
|
{
|
||||||
/* It isn't, so we'll fail */
|
/* It isn't, so we'll fail */
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
|
@ -813,7 +813,7 @@ NtQueryValueKey(IN HANDLE KeyHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ignore any null characters at the end */
|
/* Ignore any null characters at the end */
|
||||||
while ((ValueNameCopy.Length) &&
|
while (ValueNameCopy.Length &&
|
||||||
!(ValueNameCopy.Buffer[ValueNameCopy.Length / sizeof(WCHAR) - 1]))
|
!(ValueNameCopy.Buffer[ValueNameCopy.Length / sizeof(WCHAR) - 1]))
|
||||||
{
|
{
|
||||||
/* Skip it */
|
/* Skip it */
|
||||||
|
@ -947,9 +947,9 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
||||||
KeyHandle, &ValueNameCopy, TitleIndex, Type, DataSize);
|
KeyHandle, &ValueNameCopy, TitleIndex, Type, DataSize);
|
||||||
|
|
||||||
/* Make sure the name is aligned, not too long, and the data under 4GB */
|
/* Make sure the name is aligned, not too long, and the data under 4GB */
|
||||||
if ( (ValueNameCopy.Length > 32767) ||
|
if ((ValueNameCopy.Length > 32767) ||
|
||||||
((ValueNameCopy.Length & (sizeof(WCHAR) - 1))) ||
|
(ValueNameCopy.Length & (sizeof(WCHAR) - 1)) ||
|
||||||
(DataSize > 0x80000000))
|
(DataSize > 0x80000000))
|
||||||
{
|
{
|
||||||
/* Fail */
|
/* Fail */
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
|
@ -957,7 +957,7 @@ NtSetValueKey(IN HANDLE KeyHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ignore any null characters at the end */
|
/* Ignore any null characters at the end */
|
||||||
while ((ValueNameCopy.Length) &&
|
while (ValueNameCopy.Length &&
|
||||||
!(ValueNameCopy.Buffer[ValueNameCopy.Length / sizeof(WCHAR) - 1]))
|
!(ValueNameCopy.Buffer[ValueNameCopy.Length / sizeof(WCHAR) - 1]))
|
||||||
{
|
{
|
||||||
/* Skip it */
|
/* Skip it */
|
||||||
|
@ -1039,7 +1039,7 @@ NtDeleteValueKey(IN HANDLE KeyHandle,
|
||||||
goto Quit;
|
goto Quit;
|
||||||
|
|
||||||
/* Make sure the name is aligned properly */
|
/* Make sure the name is aligned properly */
|
||||||
if ((ValueNameCopy.Length & (sizeof(WCHAR) - 1)))
|
if (ValueNameCopy.Length & (sizeof(WCHAR) - 1))
|
||||||
{
|
{
|
||||||
/* It isn't, so we'll fail */
|
/* It isn't, so we'll fail */
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
|
|
|
@ -101,7 +101,7 @@ HvpWriteLog(
|
||||||
* The hive log we are going to write data into
|
* The hive log we are going to write data into
|
||||||
* has to be writable and with a sane storage.
|
* has to be writable and with a sane storage.
|
||||||
*/
|
*/
|
||||||
ASSERT(RegistryHive->ReadOnly == FALSE);
|
ASSERT(!RegistryHive->ReadOnly);
|
||||||
ASSERT(RegistryHive->BaseBlock->Length ==
|
ASSERT(RegistryHive->BaseBlock->Length ==
|
||||||
RegistryHive->Storage[Stable].Length * HBLOCK_SIZE);
|
RegistryHive->Storage[Stable].Length * HBLOCK_SIZE);
|
||||||
|
|
||||||
|
@ -109,12 +109,11 @@ HvpWriteLog(
|
||||||
HvpValidateBaseHeader(RegistryHive);
|
HvpValidateBaseHeader(RegistryHive);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The sequences can diverge in an occurrence of forced
|
* The sequences can diverge during a forced system shutdown
|
||||||
* shutdown of the system such as during a power failure,
|
* occurrence, such as during a power failure, a hardware
|
||||||
* the hardware crapping itself or during a system crash
|
* failure or during a system crash, and when one of the
|
||||||
* when one of the sequences have been modified during
|
* sequences have been modified during writing into the log
|
||||||
* writing into the log or hive. In such cases the hive
|
* or hive. In such cases the hive needs a repair.
|
||||||
* needs a repair.
|
|
||||||
*/
|
*/
|
||||||
if (RegistryHive->BaseBlock->Sequence1 !=
|
if (RegistryHive->BaseBlock->Sequence1 !=
|
||||||
RegistryHive->BaseBlock->Sequence2)
|
RegistryHive->BaseBlock->Sequence2)
|
||||||
|
@ -324,7 +323,7 @@ HvpWriteHive(
|
||||||
ULONG LastIndex;
|
ULONG LastIndex;
|
||||||
PVOID Block;
|
PVOID Block;
|
||||||
|
|
||||||
ASSERT(RegistryHive->ReadOnly == FALSE);
|
ASSERT(!RegistryHive->ReadOnly);
|
||||||
ASSERT(RegistryHive->BaseBlock->Length ==
|
ASSERT(RegistryHive->BaseBlock->Length ==
|
||||||
RegistryHive->Storage[Stable].Length * HBLOCK_SIZE);
|
RegistryHive->Storage[Stable].Length * HBLOCK_SIZE);
|
||||||
ASSERT(RegistryHive->BaseBlock->RootCell != HCELL_NIL);
|
ASSERT(RegistryHive->BaseBlock->RootCell != HCELL_NIL);
|
||||||
|
@ -333,12 +332,11 @@ HvpWriteHive(
|
||||||
HvpValidateBaseHeader(RegistryHive);
|
HvpValidateBaseHeader(RegistryHive);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The sequences can diverge in an occurrence of forced
|
* The sequences can diverge during a forced system shutdown
|
||||||
* shutdown of the system such as during a power failure,
|
* occurrence, such as during a power failure, a hardware
|
||||||
* the hardware crapping itself or during a system crash
|
* failure or during a system crash, and when one of the
|
||||||
* when one of the sequences have been modified during
|
* sequences have been modified during writing into the log
|
||||||
* writing into the log or hive. In such cases the hive
|
* or hive. In such cases the hive needs a repair.
|
||||||
* needs a repair.
|
|
||||||
*/
|
*/
|
||||||
if (RegistryHive->BaseBlock->Sequence1 !=
|
if (RegistryHive->BaseBlock->Sequence1 !=
|
||||||
RegistryHive->BaseBlock->Sequence2)
|
RegistryHive->BaseBlock->Sequence2)
|
||||||
|
@ -372,11 +370,11 @@ HvpWriteHive(
|
||||||
while (BlockIndex < RegistryHive->Storage[Stable].Length)
|
while (BlockIndex < RegistryHive->Storage[Stable].Length)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If we have to syncrhonize the registry hive we
|
* If we have to synchronize the registry hive we
|
||||||
* want to look for dirty blocks to reflect the new
|
* want to look for dirty blocks to reflect the new
|
||||||
* updates done to the hive. Otherwise just write
|
* updates done to the hive. Otherwise just write
|
||||||
* all the blocks as if we were doing a regular
|
* all the blocks as if we were doing a regular
|
||||||
* writing of the hive.
|
* hive write.
|
||||||
*/
|
*/
|
||||||
if (OnlyDirty)
|
if (OnlyDirty)
|
||||||
{
|
{
|
||||||
|
@ -420,9 +418,9 @@ HvpWriteHive(
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Increment the secondary sequence number and
|
* Increment the secondary sequence number and
|
||||||
* update the checksum. A successful transaction
|
* update the checksum. A successful hive write
|
||||||
* writing of hive is both of sequences are the
|
* transaction is when both of sequences are the
|
||||||
* same indicating the writing operation didn't
|
* same, indicating the write operation didn't
|
||||||
* fail.
|
* fail.
|
||||||
*/
|
*/
|
||||||
RegistryHive->BaseBlock->Sequence2++;
|
RegistryHive->BaseBlock->Sequence2++;
|
||||||
|
@ -476,7 +474,7 @@ HvSyncHive(
|
||||||
BOOLEAN HardErrors;
|
BOOLEAN HardErrors;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ASSERT(RegistryHive->ReadOnly == FALSE);
|
ASSERT(!RegistryHive->ReadOnly);
|
||||||
ASSERT(RegistryHive->Signature == HV_HHIVE_SIGNATURE);
|
ASSERT(RegistryHive->Signature == HV_HHIVE_SIGNATURE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -522,8 +520,8 @@ HvSyncHive(
|
||||||
KeQuerySystemTime(&RegistryHive->BaseBlock->TimeStamp);
|
KeQuerySystemTime(&RegistryHive->BaseBlock->TimeStamp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Update the log file of hive if present */
|
/* Update the hive log file if present */
|
||||||
if (RegistryHive->Log == TRUE)
|
if (RegistryHive->Log)
|
||||||
{
|
{
|
||||||
if (!HvpWriteLog(RegistryHive))
|
if (!HvpWriteLog(RegistryHive))
|
||||||
{
|
{
|
||||||
|
@ -546,7 +544,7 @@ HvSyncHive(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the alternate hive file if present */
|
/* Update the alternate hive file if present */
|
||||||
if (RegistryHive->Alternate == TRUE)
|
if (RegistryHive->Alternate)
|
||||||
{
|
{
|
||||||
if (!HvpWriteHive(RegistryHive, TRUE, HFILE_TYPE_ALTERNATE))
|
if (!HvpWriteHive(RegistryHive, TRUE, HFILE_TYPE_ALTERNATE))
|
||||||
{
|
{
|
||||||
|
@ -615,7 +613,7 @@ CMAPI
|
||||||
HvWriteHive(
|
HvWriteHive(
|
||||||
_In_ PHHIVE RegistryHive)
|
_In_ PHHIVE RegistryHive)
|
||||||
{
|
{
|
||||||
ASSERT(RegistryHive->ReadOnly == FALSE);
|
ASSERT(!RegistryHive->ReadOnly);
|
||||||
ASSERT(RegistryHive->Signature == HV_HHIVE_SIGNATURE);
|
ASSERT(RegistryHive->Signature == HV_HHIVE_SIGNATURE);
|
||||||
|
|
||||||
#if !defined(_BLDR_)
|
#if !defined(_BLDR_)
|
||||||
|
@ -653,9 +651,9 @@ CMAPI
|
||||||
HvWriteAlternateHive(
|
HvWriteAlternateHive(
|
||||||
_In_ PHHIVE RegistryHive)
|
_In_ PHHIVE RegistryHive)
|
||||||
{
|
{
|
||||||
ASSERT(RegistryHive->ReadOnly == FALSE);
|
ASSERT(!RegistryHive->ReadOnly);
|
||||||
ASSERT(RegistryHive->Signature == HV_HHIVE_SIGNATURE);
|
ASSERT(RegistryHive->Signature == HV_HHIVE_SIGNATURE);
|
||||||
ASSERT(RegistryHive->Alternate == TRUE);
|
ASSERT(RegistryHive->Alternate);
|
||||||
|
|
||||||
#if !defined(_BLDR_)
|
#if !defined(_BLDR_)
|
||||||
/* Update hive header modification time */
|
/* Update hive header modification time */
|
||||||
|
@ -691,7 +689,7 @@ CMAPI
|
||||||
HvSyncHiveFromRecover(
|
HvSyncHiveFromRecover(
|
||||||
_In_ PHHIVE RegistryHive)
|
_In_ PHHIVE RegistryHive)
|
||||||
{
|
{
|
||||||
ASSERT(RegistryHive->ReadOnly == FALSE);
|
ASSERT(!RegistryHive->ReadOnly);
|
||||||
ASSERT(RegistryHive->Signature == HV_HHIVE_SIGNATURE);
|
ASSERT(RegistryHive->Signature == HV_HHIVE_SIGNATURE);
|
||||||
|
|
||||||
/* Call the private API call to do the deed for us */
|
/* Call the private API call to do the deed for us */
|
||||||
|
|
Loading…
Reference in a new issue