/** @file
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Abstract:
Creates and EFILDR image.
This tool combines several PE Image files together using following format denoted as EBNF:
FILE := EFILDR_HEADER
EFILDR_IMAGE +
<PeImageFileContent> +
The order of EFILDR_IMAGE is same as the order of placing PeImageFileContent.
Revision History
**/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ParseInf.h"
#include "CommonLib.h"
#include "EfiUtilityMsgs.h"
#define FILE_TYPE_FIXED_LOADER 0
typedef struct {
} EFILDR_IMAGE;
typedef struct {
//
// Utility Name
//
//
// Utility version information
//
#define UTILITY_MAJOR_VERSION 0
void
Version (
void
)
/*++
Routine Description:
Displays the standard utility information to SDTOUT
Arguments:
None
Returns:
None
--*/
{
printf ("%s v%d.%d %s -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);
printf ("Copyright (c) 1999-2010 Intel Corporation. All rights reserved.\n");
}
Usage (
)
{
printf ("Usage: EfiLdrImage -o OutImage LoaderImage PeImage1 PeImage2 ... PeImageN\n");
exit (1);
}
)
{
UINT64 i = 0;
for (;i < Length; ++i) {
return EFI_ABORTED;
}
++(*ReturnValue);
}
return EFI_SUCCESS;
}
)
/*++
Routine Description:
Write all the content of input file to output file.
Arguments:
in - input file pointer
out - output file pointer
Return:
UINT64 : file size of input file
--*/
{
offset = 0;
}
}
return filesize;
}
int
main (
int argc,
char *argv[]
)
/*++
Routine Description:
Arguments:
Returns:
--*/
{
UINT64 i;
if (argc == 1) {
Usage();
return STATUS_ERROR;
}
argc --;
argv ++;
Usage();
return STATUS_SUCCESS;
}
Version();
return STATUS_SUCCESS;
}
while (argc > 0) {
if (OutputFileName == NULL) {
return STATUS_ERROR;
}
argc -= 2;
argv += 2;
continue;
}
argc --;
argv ++;
continue;
}
if ((strlen(argv[0]) >= 2 && argv[0][0] == '-' && (argv[0][1] == 'v' || argv[0][1] == 'V')) || (stricmp (argv[0], "--verbose") == 0)) {
VerboseLevel = 1;
return STATUS_ERROR;
}
}
argc --;
argv ++;
continue;
}
return STATUS_ERROR;
}
argc -= 2;
argv += 2;
continue;
}
//
// Don't recognize the parameter, should be regarded as the input file name.
//
argc--;
argv++;
}
if (InputFileCount == 0) {
return STATUS_ERROR;
}
//
// Open output file for write
//
if (OutputFileName == NULL) {
return STATUS_ERROR;
}
if (!fpOut) {
return STATUS_ERROR;
}
//
// Skip the file header first
//
//
// copy all the input files to the output file
//
for(i=0;i<InputFileCount;i++) {
//
// Copy the content of PeImage file to output file
//
if (!fpIn) {
return STATUS_ERROR;
}
//
// And in the same time update the EfiLdrHeader and EfiLdrImage array
//
strncpy ((CHAR8*) EfiLdrImage[i].FileName, InputFileNames[i], sizeof (EfiLdrImage[i].FileName) - 1);
}
//
// Write the image header to the output file finally
//
return 0;
}