#include "le_header.hpp" #include #include #include #include int main(int argc, char* argv[]) { boost::program_options::options_description description; description.add_options() ("help,h", "produces this help message") ("offset,o", boost::program_options::value(), "the offset of the LE header") ("exe,e", boost::program_options::value(), "The LE executable to parse the header for.") ; boost::program_options::variables_map vm; boost::program_options::store(boost::program_options::parse_command_line(argc, argv, description), vm); boost::program_options::notify(vm); if(vm.count("help")) { std::cout << description << std::endl; return 0; } boost::filesystem::path file_path; if(vm.count("exe")) { std::string exe_file = vm["exe"].as(); if(boost::filesystem::exists(exe_file)) { if(!boost::filesystem::is_directory(exe_file)) { file_path = exe_file; } else { std::cerr << exe_file << " is a folder" << std::endl; std::cerr << std::endl; std::cerr << description << std::endl; return -1; } } else { std::cerr << "file: " << exe_file << " does not exist" << std::endl; std::cerr << std::endl; std::cerr << description << std::endl; return -1; } } else { std::cerr << "Option \"exe_file\" is required"; std::cerr << std::endl; std::cerr << description << std::endl; return -1; } uint32_t offset; if(vm.count("offset")) { offset = vm["offset"].as(); } std::ifstream file(file_path.string()); //offset for WAR.exe = 10920 file.ignore(offset); auto x = le::parse_header(file); std::cout << x << std::endl; return 0; }