-
November 6th, 2013, 12:09 AM
#1
need help implementing parameter argument to an exe
hi,
i have this Stealth Injector source from internet
so this program is for injecting .dll to an .exe
this program was made by someone to used for cheating in online game
but i need to use this program in my private server game online to tell the game client .exe the server IP, that is stored in a dll file..
the problem is i don't want the player to directly execute this program, but they need to run the game patcher first to do the patch..
so i need to put some secret parameter argument that will block player from direct execute..
i know nothing about c++
i only know that you need to use main(int argc, char *argv[])
i've try to put something like this
Code:
int main(int argc, char* argv[]){
stringstream sparam;
string param;
sparam << argv[1];
sparam >> param;
if(argc < 1){
MessageBox(0, "Do not run this program directly, use the Game Launcher!", "Error", MB_ICONEXCLAMATION);
close;
}
if(param != "somesecretargument"){
MessageBox(0, "Do not run this program directly, use the Game Launcher!", "Error", MB_ICONEXCLAMATION);
close;
}
return 0;
}
the code works fine but the rest of code won't executed..
i've attached the cpp and header files for you guys to check
source.rar
-
November 6th, 2013, 02:52 AM
#2
Re: need help implementing parameter argument to an exe
The source code you attached doesn't contain the main() code you wrote above. That's probably why it doesn't work as you expect. If that is intended, then you should modify the WinMain() method contained in the StealthInjector.cpp file.
-
November 6th, 2013, 06:46 AM
#3
Re: need help implementing parameter argument to an exe
If no params are specified, argc will be 1 as argv[0] is the program name. If you want to check that one command line parameter has been specified, use
You can also simplify this code
Code:
int main(int argc, char* argv[]){
if (!(argc == 2 && strcmp(argv[1], "somesecretargument") == 0)) {
MessageBox(0, "Do not run this program directly, use the Game Launcher!", "Error", MB_ICONEXCLAMATION);
//close;
}
return 0;
}
What is close?
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
November 6th, 2013, 07:39 AM
#4
Re: need help implementing parameter argument to an exe
And as with so many of these security/cheat/hack type questions...
This will prevent a novice from not running that program directly. It will have near no effect on any semi serious hacker.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|