MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / FindToken

Function FindToken

BaseTools/Source/C/Common/ParseInf.c:193–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193EFI_STATUS
194FindToken (
195 IN MEMORY_FILE *InputFile,
196 IN CHAR8 *Section,
197 IN CHAR8 *Token,
198 IN UINTN Instance,
199 OUT CHAR8 *Value
200 )
201/*++
202
203Routine Description:
204
205 Finds a token value given the section and token to search for.
206
207Arguments:
208
209 InputFile Memory file image.
210 Section The section to search for, a string within [].
211 Token The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
212 Instance The instance of the token to search for. Zero is the first instance.
213 Value The string that holds the value following the =. Must be MAX_LONG_FILE_PATH in size.
214
215Returns:
216
217 EFI_SUCCESS Value found.
218 EFI_ABORTED Format error detected in INF file.
219 EFI_INVALID_PARAMETER Input argument was null.
220 EFI_LOAD_ERROR Error reading from the file.
221 EFI_NOT_FOUND Section/Token/Value not found.
222
223--*/
224{
225 CHAR8 InputBuffer[MAX_LONG_FILE_PATH];
226 CHAR8 *CurrentToken;
227 CHAR8 *Delimiter;
228 BOOLEAN ParseError;
229 BOOLEAN ReadError;
230 UINTN Occurrence;
231
232 //
233 // Check input parameters
234 //
235 if (InputFile->FileImage == NULL ||
236 InputFile->Eof == NULL ||
237 InputFile->CurrentFilePointer == NULL ||
238 Section == NULL ||
239 strlen (Section) == 0 ||
240 Token == NULL ||
241 strlen (Token) == 0 ||
242 Value == NULL
243 ) {
244 return EFI_INVALID_PARAMETER;
245 }
246 //
247 // Initialize error codes
248 //
249 ParseError = FALSE;
250 ReadError = FALSE;

Callers 2

ParseFvInfFunction · 0.85
ParseCapInfFunction · 0.85

Calls 6

FindSectionFunction · 0.85
ReadLineFunction · 0.85
strchrFunction · 0.85
strlenFunction · 0.50
strcmpFunction · 0.50
strcpyFunction · 0.50

Tested by

no test coverage detected