]>
git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Sample/Tools/Source/Strip/strip.c
3 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this 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.
18 Quick Exe2Bin equivalent.
27 #define UTILITY_NAME "Strip"
28 #define UTILITY_VERSION "v1.0"
38 Print usage information for this utility.
52 UTILITY_NAME
" "UTILITY_VERSION
" - Intel Strip Utility",
53 " Copyright (C), 2006 - 2008 Intel Corporation",
55 #if ( defined(UTILITY_BUILD) && defined(UTILITY_VENDOR) )
56 " Built from "UTILITY_BUILD
", project of "UTILITY_VENDOR
,
60 " "UTILITY_NAME
" SOURCE DEST",
62 " Convert executable files to binary files.",
66 for (Index
= 0; Str
[Index
] != NULL
; Index
++) {
67 fprintf (stdout
, "%s\n", Str
[Index
]);
80 Converts executable files to binary files.
84 argc - Number of command line arguments
85 argv[] - Array of pointers to the command line arguments
89 Zero - Function completed successfully.
90 Non-zero - Function exited with errors.
106 InFile
= fopen (argv
[1], "rb");
107 OutFile
= fopen (argv
[2], "wb");
110 printf ("no file, exit\n");
114 if (OutFile
== NULL
) {
115 printf ("Unable to open output file.\n");
119 fseek (InFile
, 0, SEEK_END
);
120 FileSize
= ftell (InFile
);
122 if (FileSize
< 0x200) {
123 printf ("%d is not a legal size, exit\n", FileSize
);
127 fseek (InFile
, 0, SEEK_SET
);
129 Buffer
= malloc (FileSize
);
130 if (Buffer
== NULL
) {
131 printf ("Error: Out of resources.\n");
135 fread (Buffer
, 1, FileSize
, InFile
);
137 Ptrx
= Buffer
+ 0x200;
139 Index
= FileSize
- 0x200;
141 fwrite (Ptrx
, Index
, 1, OutFile
);