Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

cmchek2.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1991 Microsoft Corporation 00004 00005 Module Name: 00006 00007 cmchek2.c 00008 00009 Abstract: 00010 00011 This module implements consistency checking for the registry. 00012 00013 00014 Author: 00015 00016 Bryan M. Willman (bryanwi) 27-Jan-92 00017 00018 Environment: 00019 00020 00021 Revision History: 00022 00023 --*/ 00024 00025 #include "cmp.h" 00026 00027 #ifdef ALLOC_PRAGMA 00028 #pragma alloc_text(PAGE,CmpValidateHiveSecurityDescriptors) 00029 #endif 00030 00031 extern ULONG CmpUsedStorage; 00032 00033 BOOLEAN 00034 CmpValidateHiveSecurityDescriptors( 00035 IN PHHIVE Hive 00036 ) 00037 /*++ 00038 00039 Routine Description: 00040 00041 Walks the list of security descriptors present in the hive and passes 00042 each security descriptor to RtlValidSecurityDescriptor. 00043 00044 Only applies to descriptors in Stable store. Those in Volatile store 00045 cannot have come from disk and therefore do not need this treatment 00046 anyway. 00047 00048 Arguments: 00049 00050 Hive - Supplies pointer to the hive control structure 00051 00052 Return Value: 00053 00054 TRUE - All security descriptors are valid 00055 FALSE - At least one security descriptor is invalid 00056 00057 --*/ 00058 00059 { 00060 PCM_KEY_NODE RootNode; 00061 PCM_KEY_SECURITY SecurityCell; 00062 HCELL_INDEX ListAnchor; 00063 HCELL_INDEX NextCell; 00064 HCELL_INDEX LastCell; 00065 00066 CMLOG(CML_FLOW, CMS_SEC) { 00067 KdPrint(("CmpValidateHiveSecurityDescriptor: Hive = %lx\n",(ULONG_PTR)Hive)); 00068 } 00069 if (!HvIsCellAllocated(Hive,Hive->BaseBlock->RootCell)) { 00070 // 00071 // root cell HCELL_INDEX is bogus 00072 // 00073 return(FALSE); 00074 } 00075 RootNode = (PCM_KEY_NODE) HvGetCell(Hive, Hive->BaseBlock->RootCell); 00076 ListAnchor = NextCell = RootNode->Security; 00077 00078 do { 00079 if (!HvIsCellAllocated(Hive, NextCell)) { 00080 CMLOG(CML_MAJOR, CMS_SEC) { 00081 KdPrint(("CM: CmpValidateHiveSecurityDescriptors\n")); 00082 KdPrint((" NextCell: %08lx is invalid HCELL_INDEX\n",NextCell)); 00083 } 00084 return(FALSE); 00085 } 00086 SecurityCell = (PCM_KEY_SECURITY) HvGetCell(Hive, NextCell); 00087 if (NextCell != ListAnchor) { 00088 // 00089 // Check to make sure that our Blink points to where we just 00090 // came from. 00091 // 00092 if (SecurityCell->Blink != LastCell) { 00093 CMLOG(CML_MAJOR, CMS_SEC) { 00094 KdPrint((" Invalid Blink (%ld) on security cell %ld\n",SecurityCell->Blink, NextCell)); 00095 KdPrint((" should point to %ld\n", LastCell)); 00096 } 00097 return(FALSE); 00098 } 00099 } 00100 CMLOG(CML_MINOR, CMS_SEC) { 00101 KdPrint(("CmpValidSD: SD shared by %d nodes\n",SecurityCell->ReferenceCount)); 00102 } 00103 if (!SeValidSecurityDescriptor(SecurityCell->DescriptorLength, &SecurityCell->Descriptor)) { 00104 CMLOG(CML_MAJOR, CMS_SEC) { 00105 CmpDumpSecurityDescriptor(&SecurityCell->Descriptor,"INVALID DESCRIPTOR"); 00106 } 00107 return(FALSE); 00108 } 00109 SetUsed(Hive, NextCell); 00110 LastCell = NextCell; 00111 NextCell = SecurityCell->Flink; 00112 } while ( NextCell != ListAnchor ); 00113 return(TRUE); 00114 }

Generated on Sat May 15 19:39:26 2004 for test by doxygen 1.3.7