]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/TianoTools/Strip/Strip.c
3 Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
4 This software and associated documentation (if any) is furnished
5 under a license and may only be used or copied in accordance
6 with the terms of the license. Except as permitted by such
7 license, no part of this software or documentation may be
8 reproduced, stored in a retrieval system, or transmitted in any
9 form or by any means without the express written consent of
19 Quick Exe2Bin equivalent.
37 Converts executable files to binary files.
41 argc - Number of command line arguments
42 argv[] - Array of pointers to the command line arguments
46 Zero - Function completed successfully.
47 Non-zero - Function exited with errors.
59 printf ("Need more args, such as file name to convert and output name\n");
63 InFile
= fopen (argv
[1], "rb");
64 OutFile
= fopen (argv
[2], "wb");
67 printf ("no file, exit\n");
71 if (OutFile
== NULL
) {
72 printf ("Unable to open output file.\n");
76 fseek (InFile
, 0, SEEK_END
);
77 FileSize
= ftell (InFile
);
79 if (FileSize
< 0x200) {
80 printf ("%d is not a legal size, exit\n", FileSize
);
84 fseek (InFile
, 0, SEEK_SET
);
86 Buffer
= malloc (FileSize
);
88 printf ("Error: Out of resources.\n");
92 fread (Buffer
, 1, FileSize
, InFile
);
94 Ptrx
= Buffer
+ 0x200;
96 Index
= FileSize
- 0x200;
98 fwrite (Ptrx
, Index
, 1, OutFile
);