+ if (DummyFileName != NULL) {\r
+ //\r
+ // Open file and read contents\r
+ //\r
+ DummyFile = fopen (LongFilePath (DummyFileName), "rb");\r
+ if (DummyFile == NULL) {\r
+ Error (NULL, 0, 0001, "Error opening file", DummyFileName);\r
+ goto Finish;\r
+ }\r
+\r
+ fseek (DummyFile, 0, SEEK_END);\r
+ DummyFileSize = ftell (DummyFile);\r
+ fseek (DummyFile, 0, SEEK_SET);\r
+ DummyFileBuffer = (UINT8 *) malloc (DummyFileSize);\r
+ if (DummyFileBuffer == NULL) {\r
+ fclose(DummyFile);\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");\r
+ goto Finish;\r
+ }\r
+\r
+ fread(DummyFileBuffer, 1, DummyFileSize, DummyFile);\r
+ fclose(DummyFile);\r
+ DebugMsg (NULL, 0, 9, "Dummy files", "the dummy file name is %s and the size is %u bytes", DummyFileName, (unsigned) DummyFileSize);\r
+\r
+ if (InputFileName == NULL) {\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");\r
+ goto Finish;\r
+ }\r
+ InFile = fopen(LongFilePath(InputFileName[0]), "rb");\r
+ if (InFile == NULL) {\r
+ Error (NULL, 0, 0001, "Error opening file", InputFileName[0]);\r
+ goto Finish;\r
+ }\r
+\r
+ fseek (InFile, 0, SEEK_END);\r
+ InFileSize = ftell (InFile);\r
+ fseek (InFile, 0, SEEK_SET);\r
+ InFileBuffer = (UINT8 *) malloc (InFileSize);\r
+ if (InFileBuffer == NULL) {\r
+ fclose(InFile);\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");\r
+ goto Finish;\r
+ }\r
+\r
+ fread(InFileBuffer, 1, InFileSize, InFile);\r
+ fclose(InFile);\r
+ DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[0], (unsigned) InFileSize);\r
+ if (InFileSize > DummyFileSize){\r
+ if (stricmp((CHAR8 *)DummyFileBuffer, (CHAR8 *)(InFileBuffer + (InFileSize - DummyFileSize))) == 0){\r
+ SectGuidHeaderLength = InFileSize - DummyFileSize;\r
+ }\r
+ }\r
+ if (SectGuidHeaderLength == 0) {\r
+ SectGuidAttribute |= EFI_GUIDED_SECTION_PROCESSING_REQUIRED;\r
+ }\r
+ if (DummyFileBuffer != NULL) {\r
+ free (DummyFileBuffer);\r
+ DummyFileBuffer = NULL;\r
+ }\r
+ if (InFileBuffer != NULL) {\r
+ free (InFileBuffer);\r
+ }\r
+ }\r
+\r