]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/TianoTools/Strip/Strip.c
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.
36 Converts executable files to binary files.
40 argc - Number of command line arguments
41 argv[] - Array of pointers to the command line arguments
45 Zero - Function completed successfully.
46 Non-zero - Function exited with errors.
58 printf ("Need more args, such as file name to convert and output name\n");
62 InFile
= fopen (argv
[1], "rb");
63 OutFile
= fopen (argv
[2], "wb");
66 printf ("no file, exit\n");
70 if (OutFile
== NULL
) {
71 printf ("Unable to open output file.\n");
75 fseek (InFile
, 0, SEEK_END
);
76 FileSize
= ftell (InFile
);
78 if (FileSize
< 0x200) {
79 printf ("%d is not a legal size, exit\n", FileSize
);
83 fseek (InFile
, 0, SEEK_SET
);
85 Buffer
= (char *) malloc (FileSize
);
87 printf ("Error: Out of resources.\n");
91 fread (Buffer
, 1, FileSize
, InFile
);
93 Ptrx
= Buffer
+ 0x200;
95 Index
= FileSize
- 0x200;
97 fwrite (Ptrx
, Index
, 1, OutFile
);