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

parseini.h File Reference

Go to the source code of this file.

Functions

PVOID CmpOpenInfFile (IN PVOID InfImage, IN ULONG ImageSize)
VOID CmpCloseInfFile (PVOID InfHandle)
PCHAR CmpGetKeyName (IN PVOID INFHandle, IN PCHAR SectionName, IN ULONG LineIndex)
BOOLEAN CmpSearchInfSection (IN PVOID InfHandle, IN PCHAR SectionName)
BOOLEAN CmpSearchInfLine (IN PVOID INFHandle, IN PCHAR SectionName, IN ULONG LineIndex)
PCHAR CmpGetSectionLineIndex (IN PVOID INFHandle, IN PCHAR SectionName, IN ULONG LineIndex, IN ULONG ValueIndex)
ULONG CmpGetSectionLineIndexValueCount (IN PVOID INFHandle, IN PCHAR SectionName, IN ULONG LineIndex)
BOOLEAN CmpGetIntField (IN PVOID INFHandle, IN PCHAR SectionName, IN ULONG LineIndex, IN ULONG ValueIndex, IN OUT PULONG Data)
BOOLEAN CmpGetBinaryField (IN PVOID INFHandle, IN PCHAR SectionName, IN ULONG LineIndex, IN ULONG ValueIndex, IN OUT PVOID Buffer, IN ULONG BufferSize, IN OUT PULONG ActualSize)


Function Documentation

VOID CmpCloseInfFile PVOID  InfHandle  ) 
 

Definition at line 1832 of file parseini.c.

References CmpFreeSectionList(), ExFreePool(), and PINF.

Referenced by CmpMatchInfList().

01838 : 01839 01840 This routine closes the inf handle by releasing any 01841 memory allocated for it during parsing. 01842 01843 Input Parameters: 01844 01845 InfHandle - Handle to the inf to be closed. 01846 01847 Return Value: 01848 01849 None. 01850 01851 --*/ 01852 01853 { 01854 if (InfHandle) 01855 { 01856 CmpFreeSectionList(((PINF)InfHandle)->pSection); 01857 ExFreePool(InfHandle); 01858 } 01859 }

BOOLEAN CmpGetBinaryField IN PVOID  INFHandle,
IN PCHAR  SectionName,
IN ULONG  LineIndex,
IN ULONG  ValueIndex,
IN OUT PVOID  Buffer,
IN ULONG  BufferSize,
IN OUT PULONG  ActualSize
 

Definition at line 2177 of file parseini.c.

References Buffer, BufferSize, CmpGetSectionLineIndex(), CmpGetSectionLineIndexValueCount(), CmpSearchLineInSectionByIndex(), CmpSearchSectionByName(), FALSE, NULL, PINF, PLINE, PSECTION, PVALUE, and TRUE.

Referenced by CmpGetAddRegInfData().

02189 : 02190 02191 This routine reads binary data from the inf. 02192 02193 Input Parameters: 02194 02195 InfHandle - Handle to the inf to be read. 02196 02197 Section - Name of the section to be read. 02198 02199 LineIndex - Index of the line to be read. 02200 02201 ValueIndex - Index of the value to be read. 02202 02203 Buffer - Receives the binary data read. 02204 02205 BufferSize - Size of the buffer. 02206 02207 ActualSize - Receives the size of the data buffer required. 02208 02209 Return Value: 02210 02211 TRUE iff successful. 02212 02213 --*/ 02214 02215 { 02216 BOOLEAN result = FALSE; 02217 ULONG requiredSize; 02218 PSECTION pSection; 02219 PLINE pLine; 02220 PVALUE pValue; 02221 ULONG count; 02222 PCHAR valueStr; 02223 02224 // 02225 // Compute the size of buffer required to read in the binary data. 02226 // 02227 02228 requiredSize = (CmpGetSectionLineIndexValueCount( InfHandle, 02229 Section, 02230 LineIndex) - ValueIndex) * sizeof(UCHAR); 02231 // 02232 // Validate input parameters. 02233 // 02234 02235 if (Buffer && BufferSize >= requiredSize) 02236 { 02237 // 02238 // Search the section in the inf. 02239 // 02240 02241 pSection = CmpSearchSectionByName((PINF)InfHandle, Section); 02242 if(pSection) 02243 { 02244 // 02245 // Search the line in this section. 02246 // 02247 02248 pLine = CmpSearchLineInSectionByIndex(pSection, LineIndex); 02249 if (pLine) 02250 { 02251 // 02252 // Go to the specified value. 02253 // 02254 02255 for( pValue = pLine->pValue, count = 0; 02256 pValue && count < ValueIndex; 02257 pValue = pValue->pNext, count++); 02258 02259 // 02260 // Read in and convert the binary data. 02261 // 02262 02263 for ( ; 02264 pValue; 02265 pValue = pValue->pNext) 02266 { 02267 valueStr = CmpGetSectionLineIndex( InfHandle, 02268 Section, 02269 LineIndex, 02270 ValueIndex++); 02271 if (valueStr == NULL) 02272 { 02273 break; 02274 } 02275 *((PUCHAR)Buffer)++ = (UCHAR)strtoul(valueStr, NULL, 16); 02276 } 02277 if (valueStr) 02278 { 02279 result = TRUE; 02280 } 02281 } 02282 } 02283 } 02284 02285 // 02286 // The caller wants to know the buffer size required. 02287 // 02288 02289 if (ActualSize) 02290 { 02291 *ActualSize = requiredSize; 02292 result = TRUE; 02293 } 02294 02295 return (result); 02296 } }

BOOLEAN CmpGetIntField IN PVOID  INFHandle,
IN PCHAR  SectionName,
IN ULONG  LineIndex,
IN ULONG  ValueIndex,
IN OUT PULONG  Data
 

Definition at line 2120 of file parseini.c.

References CmpGetSectionLineIndex(), FALSE, NULL, and TRUE.

Referenced by CmpGetAddRegInfData(), CmpProcessAddRegLine(), and CmpProcessBitRegLine().

02130 : 02131 02132 This routine reads integer data from the inf. 02133 02134 Input Parameters: 02135 02136 InfHandle - Handle to the inf to be read. 02137 02138 Section - Name of the section to be read. 02139 02140 LineIndex - Index of the line to be read. 02141 02142 ValueIndex - Index of the value to be read. 02143 02144 Data - Receives the integer data. 02145 02146 Return Value: 02147 02148 TRUE iff successful. 02149 02150 --*/ 02151 02152 { 02153 PCHAR valueStr; 02154 02155 // 02156 // Get the specified value. 02157 // 02158 02159 valueStr = CmpGetSectionLineIndex( InfHandle, 02160 Section, 02161 LineIndex, 02162 ValueIndex); 02163 // 02164 // If valid value is found, convert it to an integer. 02165 // 02166 02167 if (valueStr && *valueStr) 02168 { 02169 *Data = strtoul(valueStr, NULL, 16); 02170 return (TRUE); 02171 } 02172 02173 return (FALSE); 02174 }

PCHAR CmpGetKeyName IN PVOID  INFHandle,
IN PCHAR  SectionName,
IN ULONG  LineIndex
 

Definition at line 1890 of file parseini.c.

References CmpSearchLineInSectionByIndex(), CmpSearchSectionByName(), NULL, PINF, PLINE, and PSECTION.

Referenced by CmpGenInstall(), and CmpMatchDescription().

01898 : 01899 01900 This routine returns the name of the specified line in the inf. 01901 01902 Input Parameters: 01903 01904 InfHandle - Handle to the inf to be read. 01905 01906 Section - Name of the section to be read. 01907 01908 LineIndex - Index of the line to be read. 01909 01910 Return Value: 01911 01912 Pointer to the name of line in the inf iff successful. Else NULL. 01913 01914 --*/ 01915 01916 { 01917 PSECTION pSection; 01918 PLINE pLine; 01919 01920 // 01921 // First search the section. 01922 // 01923 01924 pSection = CmpSearchSectionByName((PINF)InfHandle, Section); 01925 if(pSection) 01926 { 01927 // 01928 // Get the line in the section. 01929 // 01930 01931 pLine = CmpSearchLineInSectionByIndex(pSection, LineIndex); 01932 if(pLine) 01933 { 01934 return(pLine->pName); 01935 } 01936 } 01937 01938 return (NULL); 01939 }

PCHAR CmpGetSectionLineIndex IN PVOID  INFHandle,
IN PCHAR  SectionName,
IN ULONG  LineIndex,
IN ULONG  ValueIndex
 

Definition at line 1991 of file parseini.c.

References CmpProcessForSimpleStringSub(), CmpSearchLineInSectionByIndex(), CmpSearchSectionByName(), CmpSearchValueInLine(), NULL, PINF, PLINE, PSECTION, and PVALUE.

Referenced by CmpGenInstall(), CmpGetAddRegInfData(), CmpGetBinaryField(), CmpGetInfData(), CmpGetIntField(), CmpMatchAcpiCreatorIdRule(), CmpMatchAcpiCreatorRevisionRule(), CmpMatchAcpiOemIdRule(), CmpMatchAcpiOemRevisionRule(), CmpMatchAcpiOemTableIdRule(), CmpMatchAcpiRevisionRule(), CmpMatchDateRule(), CmpMatchInfList(), CmpMatchInstallRule(), CmpMatchMemoryRule(), CmpMatchNextMatchRule(), CmpMatchOemIdRule(), CmpMatchPointerRule(), CmpMatchSearchRule(), CmpProcessAddRegLine(), CmpProcessBitRegLine(), and CmpProcessDelRegLine().

02000 : 02001 02002 This routine returns the value at the specified location in the inf. 02003 02004 Input Parameters: 02005 02006 InfHandle - Handle to the inf to be read. 02007 02008 Section - Name of the section to be read. 02009 02010 LineIndex - Index of the line to be read. 02011 02012 ValueIndex - Index of the value to be read. 02013 02014 Return Value: 02015 02016 Pointer to the value iff successful. Else NULL. 02017 02018 --*/ 02019 02020 { 02021 PSECTION pSection; 02022 PLINE pLine; 02023 PVALUE pValue; 02024 02025 // 02026 // Search the section in the inf. 02027 // 02028 02029 pSection = CmpSearchSectionByName((PINF)InfHandle, Section); 02030 if(pSection) 02031 { 02032 // 02033 // Search the line in the section. 02034 // 02035 02036 pLine = CmpSearchLineInSectionByIndex(pSection, LineIndex); 02037 if(pLine) 02038 { 02039 // 02040 // Search the value in the line. 02041 // 02042 02043 pValue = CmpSearchValueInLine(pLine, ValueIndex); 02044 if(pValue) 02045 { 02046 // 02047 // The value may need to be replaced by one of the strings 02048 // from the string section. 02049 // 02050 02051 return(CmpProcessForSimpleStringSub(InfHandle, pValue->pName)); 02052 } 02053 } 02054 } 02055 02056 return(NULL); 02057 }

ULONG CmpGetSectionLineIndexValueCount IN PVOID  INFHandle,
IN PCHAR  SectionName,
IN ULONG  LineIndex
 

Definition at line 2060 of file parseini.c.

References CmpSearchLineInSectionByIndex(), CmpSearchSectionByName(), PINF, PLINE, PSECTION, and PVALUE.

Referenced by CmpGetAddRegInfData(), and CmpGetBinaryField().

02068 : 02069 02070 This routine returns the number of values in the inf line. 02071 02072 Input Parameters: 02073 02074 InfHandle - Handle to the inf to be read. 02075 02076 Section - Name of the section to be read. 02077 02078 LineIndex - Index of the line to be read. 02079 02080 Return Value: 02081 02082 Number of values in the inf line. 02083 02084 --*/ 02085 02086 { 02087 PSECTION pSection; 02088 PLINE pLine; 02089 PVALUE pValue; 02090 ULONG count = 0; 02091 02092 // 02093 // Search the section in the inf. 02094 // 02095 02096 pSection = CmpSearchSectionByName((PINF)InfHandle, Section); 02097 if(pSection) 02098 { 02099 // 02100 // Search the line in the section. 02101 // 02102 02103 pLine = CmpSearchLineInSectionByIndex(pSection, LineIndex); 02104 if (pLine) 02105 { 02106 // 02107 // Count the number of values in this line. 02108 // 02109 02110 for( pValue = pLine->pValue; 02111 pValue; 02112 pValue = pValue->pNext, count++); 02113 } 02114 } 02115 02116 return (count); 02117 }

PVOID CmpOpenInfFile IN PVOID  InfImage,
IN ULONG  ImageSize
 

Definition at line 1790 of file parseini.c.

References CmpParseInfBuffer(), DbgPrint, NULL, and PINF.

Referenced by CmpMatchInfList().

01797 : 01798 01799 This routine opens an handle to the inf. 01800 01801 Input Parameters: 01802 01803 InfImage - Pointer to the inf image read into memory. 01804 01805 ImageSize - Image size. 01806 01807 Return Value: 01808 01809 Returns handle to the inf iff successful. Else NULL. 01810 01811 --*/ 01812 01813 { 01814 PINF infHandle; 01815 ULONG errorLine = 0; 01816 01817 // 01818 // Parse the inf buffer. 01819 // 01820 01821 infHandle = CmpParseInfBuffer(InfImage, ImageSize, &errorLine); 01822 01823 if (infHandle == NULL) 01824 { 01825 DbgPrint("Error on line %d in CmpOpenInfFile!\n", errorLine); 01826 } 01827 01828 return (infHandle); 01829 }

BOOLEAN CmpSearchInfLine IN PVOID  INFHandle,
IN PCHAR  SectionName,
IN ULONG  LineIndex
 

Definition at line 1942 of file parseini.c.

References CmpSearchLineInSectionByIndex(), CmpSearchSectionByName(), NULL, PINF, PLINE, and PSECTION.

Referenced by CmpProcessReg().

01950 : 01951 01952 This routine searches for the specified line in the inf. 01953 01954 Input Parameters: 01955 01956 InfHandle - Handle to the inf to be read. 01957 01958 Section - Name of the section to be read. 01959 01960 LineIndex - Index of the line to be read. 01961 01962 Return Value: 01963 01964 TRUE iff line is found in the section in the inf. 01965 01966 --*/ 01967 01968 { 01969 PSECTION pSection; 01970 PLINE pLine = NULL; 01971 01972 // 01973 // First search the section. 01974 // 01975 01976 pSection = CmpSearchSectionByName((PINF)InfHandle, Section); 01977 if(pSection) 01978 { 01979 // 01980 // Search the line in the section. 01981 // 01982 01983 pLine = CmpSearchLineInSectionByIndex(pSection, LineIndex); 01984 } 01985 01986 return (pLine != NULL); 01987 }

BOOLEAN CmpSearchInfSection IN PVOID  InfHandle,
IN PCHAR  SectionName
 

Referenced by CmpGenInstall(), and CmpMatchDescription().


Generated on Sat May 15 19:45:01 2004 for test by doxygen 1.3.7