return EFI_SUCCESS;\r
}\r
\r
+EFI_STATUS\r
+PutFileImage (\r
+ IN CHAR8 *OutputFileName,\r
+ IN CHAR8 *OutputFileImage,\r
+ IN UINT32 BytesToWrite\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ This function opens a file and writes OutputFileImage into the file.\r
+\r
+Arguments:\r
+\r
+ OutputFileName The name of the file to write.\r
+ OutputFileImage A pointer to the memory buffer.\r
+ BytesToWrite The size of the memory buffer.\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The function completed successfully.\r
+ EFI_INVALID_PARAMETER One of the input parameters was invalid.\r
+ EFI_ABORTED An error occurred.\r
+ EFI_OUT_OF_RESOURCES No resource to complete operations.\r
+\r
+--*/\r
+{\r
+ FILE *OutputFile;\r
+ UINT32 BytesWrote;\r
+\r
+ //\r
+ // Verify input parameters.\r
+ //\r
+ if (OutputFileName == NULL || strlen (OutputFileName) == 0 || OutputFileImage == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ //\r
+ // Open the file and copy contents into a memory buffer.\r
+ //\r
+ //\r
+ // Open the file\r
+ //\r
+ OutputFile = fopen (OutputFileName, "wb");\r
+ if (OutputFile == NULL) {\r
+ printf ("ERROR: E0001: Could not open output file \"%s\".\n", OutputFileName);\r
+ return EFI_ABORTED;\r
+ }\r
+\r
+ //\r
+ // Write all of the file contents.\r
+ //\r
+ BytesWrote = fwrite (OutputFileImage, sizeof (UINT8), BytesToWrite, OutputFile);\r
+ if (BytesWrote != sizeof (UINT8) * BytesToWrite) {\r
+ printf ("ERROR: E0004: Writing file \"%s\"%i.\n", OutputFileName);\r
+ fclose (OutputFile);\r
+ return EFI_ABORTED;\r
+ }\r
+ //\r
+ // Close the file\r
+ //\r
+ fclose (OutputFile);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
UINT8\r
CalculateChecksum8 (\r
IN UINT8 *Buffer,\r
)\r
;\r
\r
+EFI_STATUS\r
+PutFileImage (\r
+ IN CHAR8 *OutputFileName,\r
+ IN CHAR8 *OutputFileImage,\r
+ IN UINT32 BytesToWrite\r
+ )\r
+;\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ This function opens a file and writes OutputFileImage into the file.\r
+\r
+Arguments:\r
+\r
+ OutputFileName The name of the file to write.\r
+ OutputFileImage A pointer to the memory buffer.\r
+ BytesToWrite The size of the memory buffer.\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The function completed successfully.\r
+ EFI_INVALID_PARAMETER One of the input parameters was invalid.\r
+ EFI_ABORTED An error occurred.\r
+ EFI_OUT_OF_RESOURCES No resource to complete operations.\r
+\r
+--*/\r
+\r
UINT8\r
CalculateChecksum8 (\r
IN UINT8 *Buffer,\r