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