]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/Common/MemoryFile.h
BaseTools: Fix compile error on VS2010
[mirror_edk2.git] / BaseTools / Source / C / Common / MemoryFile.h
CommitLineData
30fdf114 1/** @file\r
97fa0ee9 2Header file for helper functions useful for accessing files.\r
30fdf114 3\r
1be2ed90 4Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
40d841f6 5This program and the accompanying materials \r
30fdf114
LG
6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php \r
9 \r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
30fdf114
LG
13**/\r
14\r
15#ifndef _EFI_MEMORY_FILE_H\r
16#define _EFI_MEMORY_FILE_H\r
17\r
18#include <stdio.h>\r
19#include <stdlib.h>\r
20#include <Common/UefiBaseTypes.h>\r
21\r
30fdf114
LG
22//\r
23// Common data structures\r
24//\r
25typedef struct {\r
26 CHAR8 *FileImage;\r
27 CHAR8 *Eof;\r
28 CHAR8 *CurrentFilePointer;\r
29} MEMORY_FILE;\r
30\r
31\r
32//\r
33// Functions declarations\r
34//\r
35\r
36EFI_STATUS\r
37GetMemoryFile (\r
38 IN CHAR8 *InputFileName,\r
39 OUT EFI_HANDLE *OutputMemoryFile\r
40 )\r
41;\r
42/**\r
43\r
44Routine Description:\r
45\r
46 This opens a file, reads it into memory and returns a memory file\r
47 object.\r
48\r
49Arguments:\r
50\r
51 InputFile Memory file image.\r
52 OutputMemoryFile Handle to memory file\r
53\r
54Returns:\r
55\r
56 EFI_STATUS\r
57 OutputMemoryFile is valid if !EFI_ERROR\r
58\r
59**/\r
60\r
61\r
62EFI_STATUS\r
63FreeMemoryFile (\r
64 IN EFI_HANDLE InputMemoryFile\r
65 )\r
66;\r
67/**\r
68\r
69Routine Description:\r
70\r
71 Frees all memory associated with the input memory file.\r
72\r
73Arguments:\r
74\r
75 InputMemoryFile Handle to memory file\r
76\r
77Returns:\r
78\r
79 EFI_STATUS\r
80\r
81**/\r
82\r
83\r
84CHAR8 *\r
85ReadMemoryFileLine (\r
86 IN EFI_HANDLE InputMemoryFile\r
87 )\r
88;\r
89/**\r
90\r
91Routine Description:\r
92\r
93 This function reads a line from the memory file. The newline characters\r
94 are stripped and a null terminated string is returned.\r
95\r
96 If the string pointer returned is non-NULL, then the caller must free the\r
97 memory associated with this string.\r
98\r
99Arguments:\r
100\r
101 InputMemoryFile Handle to memory file\r
102\r
103Returns:\r
104\r
105 NULL if error or EOF\r
106 NULL character termincated string otherwise (MUST BE FREED BY CALLER)\r
107\r
108**/\r
109\r
110\r
111#endif\r