• R/O
  • SSH
  • HTTPS

pefrm-units: 提交


Commit MetaInfo

修订版45 (tree)
时间2019-02-12 02:01:33
作者quiret

Log Message

- started working on peresembed tool

更改概述

差异

--- peresembed/src/main.cpp (revision 44)
+++ peresembed/src/main.cpp (revision 45)
@@ -1,7 +1,87 @@
11 #include <peframework.h>
2-#include <CFileSyste.h>
2+#include <CFileSystem.h>
3+#include <gtaconfig/include.h>
34
4-int main( int argc, char *argv[] )
5+int main( int argc, const char *argv[] )
56 {
7+ if ( argc < 1 )
8+ {
9+ return -1;
10+ }
611
12+ // We do not care about the application path.
13+ argc--;
14+
15+ // Parse the command line.
16+ OptionParser parser( &argv[1], (size_t)argc );
17+
18+ enum class eProcessingMode
19+ {
20+ UNKNOWN,
21+ FOLDER_ZIP_EMBED,
22+ FILE_EMBED,
23+ RESOURCE_EMBED
24+ };
25+
26+ // Check out what the user wants.
27+ bool wantsHelp = false;
28+ eProcessingMode mode = eProcessingMode::UNKNOWN;
29+
30+ while ( true )
31+ {
32+ std::string curOpt = parser.FetchOption();
33+
34+ if ( curOpt.empty() )
35+ {
36+ break;
37+ }
38+
39+ if ( curOpt == "h" || curOpt == "help" || curOpt == "?" )
40+ {
41+ wantsHelp = true;
42+ }
43+ }
44+
45+ printf(
46+ "peresembed - PE File Resource Embedding Tool by (c)Martin Turski\n"
47+ "Allows you to put resources into executables post-compilation\n\n"
48+ );
49+
50+ if ( wantsHelp || mode == eProcessingMode::UNKNOWN )
51+ {
52+ printf(
53+ "-h/-help/-?: displays this help text\n"
54+ "-zipfldr: compresses a target folder as .ZIP and puts it into application memory space\n"
55+ "-file: puts a file into application memory space\n"
56+ "-resfldr: puts all files from a folder into the application resource tree\n"
57+ );
58+
59+ if ( mode == eProcessingMode::UNKNOWN )
60+ {
61+ printf( "no processing mode selected; aborting.\n" );
62+ }
63+
64+ return 0;
65+ }
66+
67+ size_t argToStartFrom = parser.GetArgIndex();
68+
69+ if ( mode == eProcessingMode::FOLDER_ZIP_EMBED )
70+ {
71+
72+ }
73+ else if ( mode == eProcessingMode::FILE_EMBED )
74+ {
75+
76+ }
77+ else if ( mode == eProcessingMode::RESOURCE_EMBED )
78+ {
79+
80+ }
81+ else
82+ {
83+ return -2;
84+ }
85+
86+ return 0;
787 }
\ No newline at end of file
Show on old repository browser