| 1139 | } |
| 1140 | |
| 1141 | EFI_STATUS |
| 1142 | AddFile ( |
| 1143 | IN OUT MEMORY_FILE *FvImage, |
| 1144 | IN FV_INFO *FvInfo, |
| 1145 | IN UINTN Index, |
| 1146 | IN OUT EFI_FFS_FILE_HEADER **VtfFileImage, |
| 1147 | IN FILE *FvMapFile, |
| 1148 | IN FILE *FvReportFile |
| 1149 | ) |
| 1150 | /*++ |
| 1151 | |
| 1152 | Routine Description: |
| 1153 | |
| 1154 | This function adds a file to the FV image. The file will pad to the |
| 1155 | appropriate alignment if required. |
| 1156 | |
| 1157 | Arguments: |
| 1158 | |
| 1159 | FvImage The memory image of the FV to add it to. The current offset |
| 1160 | must be valid. |
| 1161 | FvInfo Pointer to information about the FV. |
| 1162 | Index The file in the FvInfo file list to add. |
| 1163 | VtfFileImage A pointer to the VTF file within the FvImage. If this is equal |
| 1164 | to the end of the FvImage then no VTF previously found. |
| 1165 | FvMapFile Pointer to FvMap File |
| 1166 | FvReportFile Pointer to FvReport File |
| 1167 | |
| 1168 | Returns: |
| 1169 | |
| 1170 | EFI_SUCCESS The function completed successfully. |
| 1171 | EFI_INVALID_PARAMETER One of the input parameters was invalid. |
| 1172 | EFI_ABORTED An error occurred. |
| 1173 | EFI_OUT_OF_RESOURCES Insufficient resources exist to complete the add. |
| 1174 | |
| 1175 | --*/ |
| 1176 | { |
| 1177 | FILE *NewFile; |
| 1178 | UINTN FileSize; |
| 1179 | UINT8 *FileBuffer; |
| 1180 | UINTN NumBytesRead; |
| 1181 | UINT32 CurrentFileAlignment; |
| 1182 | EFI_STATUS Status; |
| 1183 | UINTN Index1; |
| 1184 | UINT8 FileGuidString[PRINTED_GUID_BUFFER_SIZE]; |
| 1185 | |
| 1186 | Index1 = 0; |
| 1187 | // |
| 1188 | // Verify input parameters. |
| 1189 | // |
| 1190 | if (FvImage == NULL || FvInfo == NULL || FvInfo->FvFiles[Index][0] == 0 || VtfFileImage == NULL) { |
| 1191 | return EFI_INVALID_PARAMETER; |
| 1192 | } |
| 1193 | |
| 1194 | // |
| 1195 | // Read the file to add |
| 1196 | // |
| 1197 | NewFile = fopen (LongFilePath (FvInfo->FvFiles[Index]), "rb"); |
| 1198 |
no test coverage detected