Reactos

[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.

+103 -107
+16 -17
ntoskrnl/config/cmapi.c
··· 67 67 if (Hive->Frozen) 68 68 { 69 69 /* FIXME: TODO */ 70 - DPRINT1("ERROR: Hive is frozen\n"); 71 - while (TRUE); 70 + UNIMPLEMENTED_DBGBREAK("ERROR: Hive is frozen\n"); 72 71 } 73 72 } 74 73 ··· 105 104 CmpLockHiveFlusherExclusive(Hive); 106 105 107 106 /* Check for illegal state */ 108 - if ((ForceFlush) && (Hive->UseCount)) 107 + if (ForceFlush && Hive->UseCount) 109 108 { 110 109 /* Registry needs to be locked down */ 111 110 CMP_ASSERT_EXCLUSIVE_REGISTRY_LOCK(); 112 - DPRINT1("FIXME: Hive is damaged and needs fixup\n"); 113 - while (TRUE); 111 + UNIMPLEMENTED_DBGBREAK("FIXME: Hive is damaged and needs fixup\n"); 114 112 } 115 113 116 114 /* Only sync if we are forced to or if it won't cause a hive shrink */ 117 - if ((ForceFlush) || (!HvHiveWillShrink(&Hive->Hive))) 115 + if (ForceFlush || !HvHiveWillShrink(&Hive->Hive)) 118 116 { 119 117 /* Do the sync */ 120 118 Status = HvSyncHive(&Hive->Hive); 121 119 122 120 /* If something failed - set the flag and continue looping */ 123 - if (!NT_SUCCESS(Status)) Result = FALSE; 121 + if (!NT_SUCCESS(Status)) 122 + Result = FALSE; 124 123 } 125 124 else 126 125 { ··· 708 707 } 709 708 710 709 /* We need the exclusive KCB lock now */ 711 - if (!(CmpIsKcbLockedExclusive(Kcb)) && 712 - !(CmpTryToConvertKcbSharedToExclusive(Kcb))) 710 + if (!CmpIsKcbLockedExclusive(Kcb) && 711 + !CmpTryToConvertKcbSharedToExclusive(Kcb)) 713 712 { 714 713 /* Acquire exclusive lock */ 715 714 CmpConvertKcbSharedToExclusive(Kcb); ··· 873 872 Kcb->KcbLastWriteTime = Parent->LastWriteTime; 874 873 875 874 /* Check if the cell is cached */ 876 - if ((Found) && (CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList))) 875 + if (Found && CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList)) 877 876 { 878 877 /* Shouldn't happen */ 879 878 ASSERT(FALSE); ··· 884 883 CmpCleanUpKcbValueCache(Kcb); 885 884 886 885 /* Sanity checks */ 887 - ASSERT(!(CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList))); 886 + ASSERT(!CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList)); 888 887 ASSERT(!(Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND)); 889 888 890 889 /* Set the value cache */ ··· 901 900 902 901 /* Release the cells */ 903 902 Quickie: 904 - if ((ParentCell != HCELL_NIL) && (Hive)) HvReleaseCell(Hive, ParentCell); 905 - if ((ChildCell != HCELL_NIL) && (Hive)) HvReleaseCell(Hive, ChildCell); 903 + if ((ParentCell != HCELL_NIL) && Hive) HvReleaseCell(Hive, ParentCell); 904 + if ((ChildCell != HCELL_NIL) && Hive) HvReleaseCell(Hive, ChildCell); 906 905 907 906 /* Release the locks */ 908 907 if (FlusherLocked) CmpUnlockHiveFlusher((PCMHIVE)Hive); ··· 972 971 if (ChildCell == HCELL_NIL) goto Quickie; 973 972 974 973 /* We found the value, mark all relevant cells dirty */ 975 - if (!((HvMarkCellDirty(Hive, Cell, FALSE)) && 976 - (HvMarkCellDirty(Hive, Parent->ValueList.List, FALSE)) && 977 - (HvMarkCellDirty(Hive, ChildCell, FALSE)))) 974 + if (!(HvMarkCellDirty(Hive, Cell, FALSE) && 975 + HvMarkCellDirty(Hive, Parent->ValueList.List, FALSE) && 976 + HvMarkCellDirty(Hive, ChildCell, FALSE))) 978 977 { 979 978 /* Not enough log space, fail */ 980 979 Status = STATUS_NO_LOG_SPACE; ··· 1037 1036 CmpCleanUpKcbValueCache(Kcb); 1038 1037 1039 1038 /* Sanity checks */ 1040 - ASSERT(!(CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList))); 1039 + ASSERT(!CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList)); 1041 1040 ASSERT(!(Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND)); 1042 1041 1043 1042 /* Set the value cache */
+1 -2
ntoskrnl/config/cmcontrl.c
··· 208 208 } 209 209 210 210 /* Sanity check if this is a small key */ 211 - ASSERT((IsSmallKey ? 212 - (Length <= CM_KEY_VALUE_SMALL) : TRUE)); 211 + ASSERT(IsSmallKey ? (Length <= CM_KEY_VALUE_SMALL) : TRUE); 213 212 214 213 /* Copy the data in the buffer */ 215 214 RtlCopyMemory(ControlVector->Buffer, Buffer, Length);
+11 -11
ntoskrnl/config/cminit.c
··· 49 49 * - An alternate hive that is not linked to a correct file type. 50 50 * - A lonely alternate hive not backed up with its corresponding primary hive. 51 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))) 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 60 { 61 61 /* Fail the request */ 62 62 return STATUS_INVALID_PARAMETER; ··· 338 338 NULL); 339 339 340 340 /* Check if we can create the hive */ 341 - if ((CreateAllowed) && !(CmpShareSystemHives)) 341 + if (CreateAllowed && !CmpShareSystemHives) 342 342 { 343 343 /* Open only or create */ 344 344 CreateDisposition = FILE_OPEN_IF; ··· 357 357 (NoBuffering ? FILE_NO_INTERMEDIATE_BUFFERING : 0); 358 358 359 359 /* Set share and access modes */ 360 - if ((CmpMiniNTBoot) && (CmpShareSystemHives)) 360 + if (CmpMiniNTBoot && CmpShareSystemHives) 361 361 { 362 362 /* We're on Live CD or otherwise sharing */ 363 363 DesiredAccess = FILE_READ_DATA; ··· 568 568 FILE_SYNCHRONOUS_IO_NONALERT | IoFlags, 569 569 NULL, 570 570 0); 571 - if ((NT_SUCCESS(Status)) && (MarkAsSystemHive)) 571 + if (NT_SUCCESS(Status) && MarkAsSystemHive) 572 572 { 573 573 /* We opened it, mark it as a system hive */ 574 574 Status = ZwFsControlFile(*Log,
+9 -9
ntoskrnl/config/cmkcbncb.c
··· 619 619 CMP_ASSERT_KCB_LOCK(Kcb); 620 620 621 621 /* Check if we should do a direct delete */ 622 - if (((CmpHoldLazyFlush) && 622 + if ((CmpHoldLazyFlush && 623 623 !(Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND) && 624 624 !(Kcb->Flags & KEY_SYM_LINK)) || 625 625 (Kcb->ExtFlags & CM_KCB_NO_DELAY_CLOSE) || 626 - (Kcb->Delete)) 626 + Kcb->Delete) 627 627 { 628 628 /* Clean up the KCB*/ 629 629 CmpCleanUpKcbCacheWithLock(Kcb, LockHeldExclusively); ··· 683 683 NodeName = *KeyName; 684 684 685 685 /* Remove leading slash */ 686 - while ((NodeName.Length) && (*NodeName.Buffer == OBJ_NAME_PATH_SEPARATOR)) 686 + while (NodeName.Length && (*NodeName.Buffer == OBJ_NAME_PATH_SEPARATOR)) 687 687 { 688 688 /* Move the buffer by one */ 689 689 NodeName.Buffer++; ··· 764 764 else 765 765 { 766 766 /* Check if we're not creating a fake one, but it used to be fake */ 767 - if ((Kcb->ExtFlags & CM_KCB_KEY_NON_EXIST) && !(IsFake)) 767 + if ((Kcb->ExtFlags & CM_KCB_KEY_NON_EXIST) && !IsFake) 768 768 { 769 769 /* Set the hive and cell */ 770 770 Kcb->KeyHive = Hive; ··· 801 801 { 802 802 /* Reference the parent */ 803 803 if (((Parent->TotalLevels + 1) < 512) && 804 - (CmpReferenceKeyControlBlock(Parent))) 804 + CmpReferenceKeyControlBlock(Parent)) 805 805 { 806 806 /* Link it */ 807 807 Kcb->ParentKcb = Parent; ··· 863 863 } 864 864 865 865 /* Check if this is a KCB inside a frozen hive */ 866 - if ((Kcb) && (((PCMHIVE)Hive)->Frozen) && (!(Kcb->Flags & KEY_SYM_LINK))) 866 + if (Kcb && ((PCMHIVE)Hive)->Frozen && !(Kcb->Flags & KEY_SYM_LINK)) 867 867 { 868 868 /* Don't add these to the delay close */ 869 869 Kcb->ExtFlags |= CM_KCB_NO_DELAY_CLOSE; 870 870 } 871 871 872 872 /* Sanity check */ 873 - ASSERT((!Kcb) || (Kcb->Delete == FALSE)); 873 + ASSERT(!Kcb || !Kcb->Delete); 874 874 875 875 /* Check if we had locked the hashes */ 876 876 if (!HashLock) ··· 950 950 /* Sanity checks for deleted and fake keys */ 951 951 if ((!MyKcb->KeyCell && !MyKcb->Delete) || 952 952 !MyKcb->KeyHive || 953 - MyKcb->ExtFlags & CM_KCB_KEY_NON_EXIST) 953 + (MyKcb->ExtFlags & CM_KCB_KEY_NON_EXIST)) 954 954 { 955 955 /* Failure */ 956 956 CmpFree(KeyName, 0); ··· 1109 1109 for (i = 0; i < 4; i++) 1110 1110 { 1111 1111 /* Add it into the list */ 1112 - if (InterlockedCompareExchangePointer((VOID*)&KeyBody->KeyControlBlock-> 1112 + if (InterlockedCompareExchangePointer((PVOID*)&KeyBody->KeyControlBlock-> 1113 1113 KeyBodyArray[i], 1114 1114 NULL, 1115 1115 KeyBody) == KeyBody)
+6 -6
ntoskrnl/config/cmlazy.c
··· 92 92 CmHive->FlushCount = CmpLazyFlushCount; 93 93 } 94 94 } 95 - else if ((CmHive->Hive.DirtyCount) && 96 - (!(CmHive->Hive.HiveFlags & HIVE_VOLATILE)) && 97 - (!(CmHive->Hive.HiveFlags & HIVE_NOLAZYFLUSH))) 95 + else if (CmHive->Hive.DirtyCount && 96 + !(CmHive->Hive.HiveFlags & HIVE_VOLATILE) && 97 + !(CmHive->Hive.HiveFlags & HIVE_NOLAZYFLUSH)) 98 98 { 99 99 /* Use another lazy flusher for this hive */ 100 100 ASSERT(CmHive->FlushCount == CmpLazyFlushCount); ··· 145 145 { 146 146 /* Check if we should queue the lazy flush worker */ 147 147 DPRINT("Flush pending: %s, Holding lazy flush: %s.\n", CmpLazyFlushPending ? "yes" : "no", CmpHoldLazyFlush ? "yes" : "no"); 148 - if ((!CmpLazyFlushPending) && (!CmpHoldLazyFlush)) 148 + if (!CmpLazyFlushPending && !CmpHoldLazyFlush) 149 149 { 150 150 CmpLazyFlushPending = TRUE; 151 151 ExQueueWorkItem(&CmpLazyWorkItem, DelayedWorkQueue); ··· 160 160 PAGED_CODE(); 161 161 162 162 /* Check if we should set the lazy flush timer */ 163 - if ((!CmpNoWrite) && (!CmpHoldLazyFlush)) 163 + if (!CmpNoWrite && !CmpHoldLazyFlush) 164 164 { 165 165 /* Do it */ 166 166 DueTime.QuadPart = Int32x32To64(CmpLazyFlushIntervalInSeconds, ··· 400 400 (Status == STATUS_ACCOUNT_EXPIRED) || 401 401 (Status == STATUS_ACCOUNT_DISABLED) || 402 402 (Status == STATUS_ACCOUNT_RESTRICTION)) && 403 - (ImpersonationContext)) 403 + ImpersonationContext) 404 404 { 405 405 /* We failed due to an account/security error, impersonate SYSTEM */ 406 406 Status = SeImpersonateClientEx(ImpersonationContext, NULL);
+7 -7
ntoskrnl/config/cmparse.c
··· 39 39 } 40 40 41 41 /* Check if we have a path separator */ 42 - while ((RemainingName->Length) && 42 + while (RemainingName->Length && 43 43 (*RemainingName->Buffer == OBJ_NAME_PATH_SEPARATOR)) 44 44 { 45 45 /* Skip it */ ··· 50 50 51 51 /* Start loop at where the current buffer is */ 52 52 NextName->Buffer = RemainingName->Buffer; 53 - while ((RemainingName->Length) && 53 + while (RemainingName->Length && 54 54 (*RemainingName->Buffer != OBJ_NAME_PATH_SEPARATOR)) 55 55 { 56 56 /* Move to the next character */ ··· 1873 1873 PAGED_CODE(); 1874 1874 1875 1875 /* Loop path separators at the end */ 1876 - while ((RemainingName->Length) && 1876 + while (RemainingName->Length && 1877 1877 (RemainingName->Buffer[(RemainingName->Length / sizeof(WCHAR)) - 1] == 1878 1878 OBJ_NAME_PATH_SEPARATOR)) 1879 1879 { ··· 1888 1888 Current = *RemainingName; 1889 1889 1890 1890 /* Check if this is a create */ 1891 - if (!(ParseContext) || !(ParseContext->CreateOperation)) 1891 + if (!ParseContext || !ParseContext->CreateOperation) 1892 1892 { 1893 1893 /* It isn't, so no context */ 1894 1894 ParseContext = NULL; ··· 2043 2043 { 2044 2044 /* Get the next component */ 2045 2045 Result = CmpGetNextName(&Current, &NextName, &Last); 2046 - if ((Result) && (NextName.Length)) 2046 + if (Result && NextName.Length) 2047 2047 { 2048 2048 /* See if this is a sym link */ 2049 2049 if (!(Kcb->Flags & KEY_SYM_LINK)) ··· 2150 2150 else 2151 2151 { 2152 2152 /* Check if this was the last key for a create */ 2153 - if ((Last) && (ParseContext)) 2153 + if (Last && ParseContext) 2154 2154 { 2155 2155 /* Check if we're doing a link node */ 2156 2156 if (ParseContext->CreateLink) ··· 2246 2246 break; 2247 2247 } 2248 2248 } 2249 - else if ((Result) && (Last)) 2249 + else if (Result && Last) 2250 2250 { 2251 2251 /* Opening the root. Is this an exit node? */ 2252 2252 if (Node->Flags & KEY_HIVE_EXIT)
+1 -1
ntoskrnl/config/cmse.c
··· 40 40 Sid[3] = ExAllocatePoolWithTag(PagedPool, SidLength, TAG_CMSD); 41 41 42 42 /* Make sure all SIDs were allocated */ 43 - if (!(Sid[0]) || !(Sid[1]) || !(Sid[2]) || !(Sid[3])) 43 + if (!Sid[0] || !Sid[1] || !Sid[2] || !Sid[3]) 44 44 { 45 45 /* Bugcheck */ 46 46 KeBugCheckEx(REGISTRY_ERROR, 11, 1, 0, 0);
+10 -10
ntoskrnl/config/cmsysini.c
··· 228 228 229 229 /* Check if the provided buffer is too small to fit even anything */ 230 230 if ((Length <= sizeof(OBJECT_NAME_INFORMATION)) || 231 - ((Length < (*ReturnLength)) && (BytesToCopy < sizeof(WCHAR)))) 231 + ((Length < *ReturnLength) && (BytesToCopy < sizeof(WCHAR)))) 232 232 { 233 233 /* Free the buffer allocated by CmpConstructName */ 234 234 ExFreePoolWithTag(KeyName, TAG_CM); ··· 238 238 } 239 239 240 240 /* Check if the provided buffer can be partially written */ 241 - if (Length < (*ReturnLength)) 241 + if (Length < *ReturnLength) 242 242 { 243 243 /* Yes, indicate so in the return status */ 244 244 Status = STATUS_INFO_LENGTH_MISMATCH; ··· 687 687 ValueInfo = (PKEY_VALUE_FULL_INFORMATION)ValueInfoBuffer; 688 688 689 689 /* Check if we failed or got a non DWORD-value */ 690 - if (!(NT_SUCCESS(Status)) || (ValueInfo->Type != REG_DWORD)) 690 + if (!NT_SUCCESS(Status) || (ValueInfo->Type != REG_DWORD)) 691 691 { 692 692 Status = STATUS_SUCCESS; 693 693 goto Cleanup; ··· 728 728 Status = NtOpenKey(&ProfileHandle, 729 729 KEY_READ | KEY_WRITE, 730 730 &ObjectAttributes); 731 - if (!NT_SUCCESS (Status)) 731 + if (!NT_SUCCESS(Status)) 732 732 { 733 733 /* Cleanup and exit */ 734 734 Status = STATUS_SUCCESS; ··· 1319 1319 &CmHive, 1320 1320 &CmpMachineHiveList[i].Allocate, 1321 1321 CM_CHECK_REGISTRY_PURGE_VOLATILES); 1322 - if (!(NT_SUCCESS(Status)) || 1323 - (!(CmpShareSystemHives) && !(CmHive->FileHandles[HFILE_TYPE_LOG]))) 1322 + if (!NT_SUCCESS(Status) || 1323 + (!CmpShareSystemHives && !CmHive->FileHandles[HFILE_TYPE_LOG])) 1324 1324 { 1325 1325 /* 1326 1326 * We failed, or could not get a log file (unless ··· 1356 1356 TRUE, 1357 1357 FALSE, 1358 1358 &ClusterSize); 1359 - if (!(NT_SUCCESS(Status)) || !(AlternateHandle)) 1359 + if (!NT_SUCCESS(Status) || !AlternateHandle) 1360 1360 { 1361 1361 /* Couldn't open the hive or its alternate file, raise a hard error */ 1362 1362 ErrorParameters = &FileName; ··· 2111 2111 Index1 = GET_HASH_INDEX(ConvKey1); 2112 2112 Index2 = GET_HASH_INDEX(ConvKey2); 2113 2113 ASSERT((GET_HASH_ENTRY(CmpCacheTable, ConvKey2)->Owner == KeGetCurrentThread()) || 2114 - (CmpTestRegistryLockExclusive())); 2114 + CmpTestRegistryLockExclusive()); 2115 2115 2116 2116 /* See which one is highest */ 2117 2117 if (Index1 < Index2) 2118 2118 { 2119 2119 /* Grab them in the proper order */ 2120 2120 ASSERT((GET_HASH_ENTRY(CmpCacheTable, ConvKey1)->Owner == KeGetCurrentThread()) || 2121 - (CmpTestRegistryLockExclusive())); 2121 + CmpTestRegistryLockExclusive()); 2122 2122 CmpReleaseKcbLockByKey(ConvKey2); 2123 2123 CmpReleaseKcbLockByKey(ConvKey1); 2124 2124 } ··· 2128 2128 if (Index1 != Index2) 2129 2129 { 2130 2130 ASSERT((GET_HASH_ENTRY(CmpCacheTable, ConvKey1)->Owner == KeGetCurrentThread()) || 2131 - (CmpTestRegistryLockExclusive())); 2131 + CmpTestRegistryLockExclusive()); 2132 2132 CmpReleaseKcbLockByKey(ConvKey1); 2133 2133 } 2134 2134 CmpReleaseKcbLockByKey(ConvKey2);
+10 -10
ntoskrnl/config/cmvalche.c
··· 69 69 else 70 70 { 71 71 /* Make sure the KCB is locked exclusive */ 72 - if (!(CmpIsKcbLockedExclusive(Kcb)) && 73 - !(CmpTryToConvertKcbSharedToExclusive(Kcb))) 72 + if (!CmpIsKcbLockedExclusive(Kcb) && 73 + !CmpTryToConvertKcbSharedToExclusive(Kcb)) 74 74 { 75 75 /* We need the exclusive lock */ 76 76 return SearchNeedExclusiveLock; ··· 79 79 /* Select the value list as our cell, and get the actual list array */ 80 80 CellToRelease = ChildList->ValueList; 81 81 *CellData = (PCELL_DATA)HvGetCell(Hive, CellToRelease); 82 - if (!(*CellData)) return SearchFail; 82 + if (!*CellData) return SearchFail; 83 83 84 84 /* FIXME: Here we would cache the value */ 85 85 ··· 229 229 if (SearchResult != SearchSuccess) 230 230 { 231 231 /* We either failed or need the exclusive lock */ 232 - ASSERT((SearchResult == SearchFail) || !(CmpIsKcbLockedExclusive(Kcb))); 232 + ASSERT((SearchResult == SearchFail) || !CmpIsKcbLockedExclusive(Kcb)); 233 233 ASSERT(Cell == HCELL_NIL); 234 234 return SearchResult; 235 235 } ··· 260 260 if (SearchResult != SearchSuccess) 261 261 { 262 262 /* We either failed or need the exclusive lock */ 263 - ASSERT((SearchResult == SearchFail) || !(CmpIsKcbLockedExclusive(Kcb))); 263 + ASSERT((SearchResult == SearchFail) || !CmpIsKcbLockedExclusive(Kcb)); 264 264 ASSERT(Cell == HCELL_NIL); 265 265 return SearchResult; 266 266 } ··· 552 552 } 553 553 554 554 /* Sanity check */ 555 - ASSERT((IsSmall ? (Size <= CM_KEY_VALUE_SMALL) : TRUE)); 555 + ASSERT(IsSmall ? (Size <= CM_KEY_VALUE_SMALL) : TRUE); 556 556 557 557 /* Make sure we have a valid buffer */ 558 558 if (Buffer) ··· 658 658 } 659 659 660 660 /* Sanity check */ 661 - ASSERT((IsSmall ? (Size <= CM_KEY_VALUE_SMALL) : TRUE)); 661 + ASSERT(IsSmall ? (Size <= CM_KEY_VALUE_SMALL) : TRUE); 662 662 663 663 /* Make sure we have a valid buffer */ 664 664 if (Buffer) ··· 719 719 if (Kcb->Flags & KEY_SYM_LINK) 720 720 { 721 721 /* We need the exclusive lock */ 722 - if (!(CmpIsKcbLockedExclusive(Kcb)) && 723 - !(CmpTryToConvertKcbSharedToExclusive(Kcb))) 722 + if (!CmpIsKcbLockedExclusive(Kcb) && 723 + !CmpTryToConvertKcbSharedToExclusive(Kcb)) 724 724 { 725 725 /* We need the exclusive lock */ 726 726 return SearchNeedExclusiveLock; ··· 734 734 CmpCleanUpKcbValueCache(Kcb); 735 735 736 736 /* Sanity checks */ 737 - ASSERT(!(CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList))); 737 + ASSERT(!CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList)); 738 738 ASSERT(!(Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND)); 739 739 740 740 /* Set the value cache */
+7 -7
ntoskrnl/config/ntapi.c
··· 805 805 goto Quit; 806 806 807 807 /* Make sure the name is aligned properly */ 808 - if ((ValueNameCopy.Length & (sizeof(WCHAR) - 1))) 808 + if (ValueNameCopy.Length & (sizeof(WCHAR) - 1)) 809 809 { 810 810 /* It isn't, so we'll fail */ 811 811 Status = STATUS_INVALID_PARAMETER; ··· 813 813 } 814 814 815 815 /* Ignore any null characters at the end */ 816 - while ((ValueNameCopy.Length) && 816 + while (ValueNameCopy.Length && 817 817 !(ValueNameCopy.Buffer[ValueNameCopy.Length / sizeof(WCHAR) - 1])) 818 818 { 819 819 /* Skip it */ ··· 947 947 KeyHandle, &ValueNameCopy, TitleIndex, Type, DataSize); 948 948 949 949 /* Make sure the name is aligned, not too long, and the data under 4GB */ 950 - if ( (ValueNameCopy.Length > 32767) || 951 - ((ValueNameCopy.Length & (sizeof(WCHAR) - 1))) || 952 - (DataSize > 0x80000000)) 950 + if ((ValueNameCopy.Length > 32767) || 951 + (ValueNameCopy.Length & (sizeof(WCHAR) - 1)) || 952 + (DataSize > 0x80000000)) 953 953 { 954 954 /* Fail */ 955 955 Status = STATUS_INVALID_PARAMETER; ··· 957 957 } 958 958 959 959 /* Ignore any null characters at the end */ 960 - while ((ValueNameCopy.Length) && 960 + while (ValueNameCopy.Length && 961 961 !(ValueNameCopy.Buffer[ValueNameCopy.Length / sizeof(WCHAR) - 1])) 962 962 { 963 963 /* Skip it */ ··· 1039 1039 goto Quit; 1040 1040 1041 1041 /* Make sure the name is aligned properly */ 1042 - if ((ValueNameCopy.Length & (sizeof(WCHAR) - 1))) 1042 + if (ValueNameCopy.Length & (sizeof(WCHAR) - 1)) 1043 1043 { 1044 1044 /* It isn't, so we'll fail */ 1045 1045 Status = STATUS_INVALID_PARAMETER;
+25 -27
sdk/lib/cmlib/hivewrt.c
··· 101 101 * The hive log we are going to write data into 102 102 * has to be writable and with a sane storage. 103 103 */ 104 - ASSERT(RegistryHive->ReadOnly == FALSE); 104 + ASSERT(!RegistryHive->ReadOnly); 105 105 ASSERT(RegistryHive->BaseBlock->Length == 106 106 RegistryHive->Storage[Stable].Length * HBLOCK_SIZE); 107 107 ··· 109 109 HvpValidateBaseHeader(RegistryHive); 110 110 111 111 /* 112 - * The sequences can diverge in an occurrence of forced 113 - * shutdown of the system such as during a power failure, 114 - * the hardware crapping itself or during a system crash 115 - * when one of the sequences have been modified during 116 - * writing into the log or hive. In such cases the hive 117 - * needs a repair. 112 + * The sequences can diverge during a forced system shutdown 113 + * occurrence, such as during a power failure, a hardware 114 + * failure or during a system crash, and when one of the 115 + * sequences have been modified during writing into the log 116 + * or hive. In such cases the hive needs a repair. 118 117 */ 119 118 if (RegistryHive->BaseBlock->Sequence1 != 120 119 RegistryHive->BaseBlock->Sequence2) ··· 324 323 ULONG LastIndex; 325 324 PVOID Block; 326 325 327 - ASSERT(RegistryHive->ReadOnly == FALSE); 326 + ASSERT(!RegistryHive->ReadOnly); 328 327 ASSERT(RegistryHive->BaseBlock->Length == 329 328 RegistryHive->Storage[Stable].Length * HBLOCK_SIZE); 330 329 ASSERT(RegistryHive->BaseBlock->RootCell != HCELL_NIL); ··· 333 332 HvpValidateBaseHeader(RegistryHive); 334 333 335 334 /* 336 - * The sequences can diverge in an occurrence of forced 337 - * shutdown of the system such as during a power failure, 338 - * the hardware crapping itself or during a system crash 339 - * when one of the sequences have been modified during 340 - * writing into the log or hive. In such cases the hive 341 - * needs a repair. 335 + * The sequences can diverge during a forced system shutdown 336 + * occurrence, such as during a power failure, a hardware 337 + * failure or during a system crash, and when one of the 338 + * sequences have been modified during writing into the log 339 + * or hive. In such cases the hive needs a repair. 342 340 */ 343 341 if (RegistryHive->BaseBlock->Sequence1 != 344 342 RegistryHive->BaseBlock->Sequence2) ··· 372 370 while (BlockIndex < RegistryHive->Storage[Stable].Length) 373 371 { 374 372 /* 375 - * If we have to syncrhonize the registry hive we 373 + * If we have to synchronize the registry hive we 376 374 * want to look for dirty blocks to reflect the new 377 375 * updates done to the hive. Otherwise just write 378 376 * all the blocks as if we were doing a regular 379 - * writing of the hive. 377 + * hive write. 380 378 */ 381 379 if (OnlyDirty) 382 380 { ··· 420 418 421 419 /* 422 420 * Increment the secondary sequence number and 423 - * update the checksum. A successful transaction 424 - * writing of hive is both of sequences are the 425 - * same indicating the writing operation didn't 421 + * update the checksum. A successful hive write 422 + * transaction is when both of sequences are the 423 + * same, indicating the write operation didn't 426 424 * fail. 427 425 */ 428 426 RegistryHive->BaseBlock->Sequence2++; ··· 476 474 BOOLEAN HardErrors; 477 475 #endif 478 476 479 - ASSERT(RegistryHive->ReadOnly == FALSE); 477 + ASSERT(!RegistryHive->ReadOnly); 480 478 ASSERT(RegistryHive->Signature == HV_HHIVE_SIGNATURE); 481 479 482 480 /* ··· 522 520 KeQuerySystemTime(&RegistryHive->BaseBlock->TimeStamp); 523 521 #endif 524 522 525 - /* Update the log file of hive if present */ 526 - if (RegistryHive->Log == TRUE) 523 + /* Update the hive log file if present */ 524 + if (RegistryHive->Log) 527 525 { 528 526 if (!HvpWriteLog(RegistryHive)) 529 527 { ··· 546 544 } 547 545 548 546 /* Update the alternate hive file if present */ 549 - if (RegistryHive->Alternate == TRUE) 547 + if (RegistryHive->Alternate) 550 548 { 551 549 if (!HvpWriteHive(RegistryHive, TRUE, HFILE_TYPE_ALTERNATE)) 552 550 { ··· 615 613 HvWriteHive( 616 614 _In_ PHHIVE RegistryHive) 617 615 { 618 - ASSERT(RegistryHive->ReadOnly == FALSE); 616 + ASSERT(!RegistryHive->ReadOnly); 619 617 ASSERT(RegistryHive->Signature == HV_HHIVE_SIGNATURE); 620 618 621 619 #if !defined(_BLDR_) ··· 653 651 HvWriteAlternateHive( 654 652 _In_ PHHIVE RegistryHive) 655 653 { 656 - ASSERT(RegistryHive->ReadOnly == FALSE); 654 + ASSERT(!RegistryHive->ReadOnly); 657 655 ASSERT(RegistryHive->Signature == HV_HHIVE_SIGNATURE); 658 - ASSERT(RegistryHive->Alternate == TRUE); 656 + ASSERT(RegistryHive->Alternate); 659 657 660 658 #if !defined(_BLDR_) 661 659 /* Update hive header modification time */ ··· 691 689 HvSyncHiveFromRecover( 692 690 _In_ PHHIVE RegistryHive) 693 691 { 694 - ASSERT(RegistryHive->ReadOnly == FALSE); 692 + ASSERT(!RegistryHive->ReadOnly); 695 693 ASSERT(RegistryHive->Signature == HV_HHIVE_SIGNATURE); 696 694 697 695 /* Call the private API call to do the deed for us */