]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/CCode/Source/Strip/Strip.c
a7efd54936ed85265b658525fd07b80dee5e7d04
3 Copyright (c) 2004-2006 Intel Corporation. All rights reserved
4 This program and the accompanying materials are licensed and made available
5 under the terms and conditions of the BSD License which accompanies this
6 distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 Quick Exe2Bin equivalent.
28 #define UTILITY_NAME "Strip"
29 #define UTILITY_MAJOR_VERSION 1
30 #define UTILITY_MINOR_VERSION 1
41 Print out version information for Strip.
53 printf ("%s v%d.%d -EDK Utility to Convert EXE to BIN\n", UTILITY_NAME
, UTILITY_MAJOR_VERSION
, UTILITY_MINOR_VERSION
);
54 printf ("Copyright (c) 2005-2006 Intel Corporation. All rights reserved.\n");
65 Print out usage information for Strip.
78 printf ("\nUsage: %s InputFile OutputFile\n", UTILITY_NAME
);
90 Converts executable files to binary files.
94 argc - Number of command line arguments
95 argv[] - Array of pointers to the command line arguments
99 Zero - Function completed successfully.
100 Non-zero - Function exited with errors.
116 if ((strcmp(argv
[1], "-h") == 0) || (strcmp(argv
[1], "--help") == 0) ||
117 (strcmp(argv
[1], "-?") == 0) || (strcmp(argv
[1], "/?") == 0)) {
122 if ((strcmp(argv
[1], "-V") == 0) || (strcmp(argv
[1], "--version") == 0)) {
132 InFile
= fopen (argv
[1], "rb");
133 OutFile
= fopen (argv
[2], "wb");
136 printf ("Unable to open input file, exit\n");
140 if (OutFile
== NULL
) {
141 printf ("Unable to open output file, exit.\n");
145 fseek (InFile
, 0, SEEK_END
);
146 FileSize
= ftell (InFile
);
148 if (FileSize
< 0x200) {
149 printf ("%d is not a legal file size, exit\n", FileSize
);
153 fseek (InFile
, 0, SEEK_SET
);
155 Buffer
= (char *) malloc (FileSize
);
156 if (Buffer
== NULL
) {
157 printf ("Error: Out of resources.\n");
161 fread (Buffer
, 1, FileSize
, InFile
);
163 Ptrx
= Buffer
+ 0x200;
165 Index
= FileSize
- 0x200;
167 fwrite (Ptrx
, Index
, 1, OutFile
);