Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

perdroption.cpp

Go to the documentation of this file.
00001 /*
00002 PeRdr - PE file disassembler
00003 Copyright (C) 1999-2002 Frediano Ziglio
00004 -----
00005 
00006 This program is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2 of the License, or
00009 (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 -----
00020 
00021 INFORMATION
00022   www: https://freddy77.tripod.com/perdr/
00023   e-mail: freddy77@angelfire.com
00024 */
00025 #include "global.h"
00026 #ifdef HAVE_HDRSTOP
00027 #pragma hdrstop
00028 #endif
00029 
00030 #include "options.h"
00031 #include "perdroptions.h"
00032 
00033 PeRdrOption options = {
00034   false, // showBytes
00035   false, // disableP3
00036   false, // disable3DNow
00037   false, // disableEnh3DNow
00038   false, // showVersion
00039   false, // showHelp
00040   false, // showPriority
00041   false, // rawDumping
00042   false, // extractIconRes
00043   false, // showHeaders
00044   false, // showImports
00045   false, // showRelocations
00046   false, // showExports
00047   false, // showResources
00048   false  // showCode
00049 };
00050 
00051 static option allOptions[] =
00052 {
00053   { "b\0bytes\0",                &options.showBytes,       optionBool },
00054   { "\0disable-3dnow\0",         &options.disable3DNow,    optionBool },
00055   { "\0disable-enh3dnow\0",      &options.disableEnh3DNow, optionBool },
00056   { "\0disable-pentium3\0",      &options.disableP3,       optionBool },
00057   { "\0disable-athlon\0",        &options.disableAthlon,   optionBool },
00058   { "\0version\0",               &options.showVersion,     optionBool },
00059   { "\0help\0",                  &options.showHelp,        optionBool },
00060   { "\0show-priority\0",         &options.showPriority,    optionBool },
00061   { "\0raw-dump\0",              &options.rawDumping,      optionBool },
00062   { "\0extract-icon-resource\0", &options.extractIconRes,  optionBool },
00063   { "\0show-headers\0",          &options.showHeaders,     optionBool },
00064   { "\0show-imports\0",          &options.showImports,     optionBool },
00065   { "\0show-relocations\0",      &options.showRelocations, optionBool },
00066   { "\0show-exports\0",          &options.showExports,     optionBool },
00067   { "\0show-resources\0",        &options.showResources,   optionBool },
00068   { "\0show-code\0",             &options.showCode,        optionBool },
00069   { NULL,                        NULL,                     optionBool }
00070 };
00071 
00072 int ReadOptions(int argc,char** argv)
00073 {
00074   // !!! use GNU getopt_long instead !!!
00075   int res = get_options(argc,argv,allOptions);
00076 
00077   // adjust option
00078   if (options.disable3DNow)
00079     options.disableEnh3DNow = true;
00080 
00081   if (!options.showHeaders && !options.showImports && !options.showRelocations 
00082                   && !options.showExports && !options.showCode
00083                   && !options.showResources)
00084   {
00085     options.showHeaders = true;
00086     options.showImports = true;
00087     options.showRelocations = true;
00088     options.showExports = true;
00089     options.showCode = true;
00090     options.showResources = true;
00091   }
00092             
00093   return res;
00094 }

Generated on Mon Jan 13 22:20:34 2003 for perdr by doxygen1.2.15