]>
git.proxmox.com Git - mirror_edk2.git/blob - Common/ParseInf.h
3 Copyright (c) 2004, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Header file for helper functions useful for parsing INF files.
22 #ifndef _EFI_PARSE_INF_H
23 #define _EFI_PARSE_INF_H
28 #include <Common/UefiBaseTypes.h>
31 // Common data structures
36 CHAR8
*CurrentFilePointer
;
40 // Functions declarations
44 IN MEMORY_FILE
*InputFile
,
45 IN OUT CHAR8
*InputBuffer
,
54 This function reads a line, stripping any comments.
55 The function reads a string from the input stream argument and stores it in
56 the input string. ReadLine reads characters from the current file position
57 to and including the first newline character, to the end of the stream, or
58 until the number of characters read is equal to MaxLength - 1, whichever
59 comes first. The newline character, if read, is replaced with a \0.
63 InputFile Memory file image.
64 InputBuffer Buffer to read into, must be _MAX_PATH size.
65 MaxLength The maximum size of the input buffer.
75 IN MEMORY_FILE
*InputFile
,
84 This function parses a file from the beginning to find a section.
85 The section string may be anywhere within a line.
89 InputFile Memory file image.
90 Section Section to search for
100 IN MEMORY_FILE
*InputFile
,
112 Finds a token value given the section and token to search for.
116 InputFile Memory file image.
117 Section The section to search for, a string within [].
118 Token The token to search for, e.g. EFI_PEIM_RECOVERY, followed by an = in the INF file.
119 Instance The instance of the token to search for. Zero is the first instance.
120 Value The string that holds the value following the =. Must be _MAX_PATH in size.
124 EFI_SUCCESS Value found.
125 EFI_ABORTED Format error detected in INF file.
126 EFI_INVALID_PARAMETER Input argument was null.
127 EFI_LOAD_ERROR Error reading from the file.
128 EFI_NOT_FOUND Section/Token/Value not found.
133 IN CHAR8
*AsciiGuidBuffer
,
134 OUT EFI_GUID
*GuidBuffer
142 Converts a string to an EFI_GUID. The string must be in the
143 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
147 GuidBuffer - pointer to destination Guid
148 AsciiGuidBuffer - pointer to ascii string
152 EFI_ABORTED Could not convert the string
153 EFI_SUCCESS The string was successfully converted
157 AsciiStringToUint64 (
158 IN CONST CHAR8
*AsciiString
,
160 OUT UINT64
*ReturnValue
168 Converts a null terminated ascii string that represents a number into a
169 UINT64 value. A hex number may be preceeded by a 0x, but may not be
170 succeeded by an h. A number without 0x or 0X is considered to be base 10
171 unless the IsHex input is true.
175 AsciiString The string to convert.
176 IsHex Force the string to be treated as a hex number.
177 ReturnValue The return value.
181 EFI_SUCCESS Number successfully converted.
182 EFI_ABORTED Invalid character encountered.
188 IN OUT CHAR8
*InputBuffer
196 This function reads a line, stripping any comments.
200 InputFile Stream pointer.
201 InputBuffer Buffer to read into, must be _MAX_PATH size.
206 InputBuffer otherwise
210 FindSectionInStream (
220 This function parses a stream file from the beginning to find a section.
221 The section string may be anywhere within a line.
225 InputFile Stream pointer.
226 Section Section to search for
230 FALSE if error or EOF
231 TRUE if section found