Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider Using Windows Subsystem #28

Open
93aef0ce4dd141ece6f5 opened this issue Apr 28, 2017 · 3 comments
Open

Consider Using Windows Subsystem #28

93aef0ce4dd141ece6f5 opened this issue Apr 28, 2017 · 3 comments
Labels
enhancement help wanted windows Issue with Windows version

Comments

@93aef0ce4dd141ece6f5
Copy link

93aef0ce4dd141ece6f5 commented Apr 28, 2017

Problem

I believe that this is built under the console subsystem which relies on the method of using ShowWindow to hide the console window (correct me if I'm wrong). The issue is that it will flash the console on execution and is therefore not an elegant solution.

My Proposal

Build and compile the code under the Windows subsystem and entirely move away from the use of a console. This change renders the Stealth function and #define (in)visible obsolete.

Adjustments

Microsoft Visual C++:
Change:
int main()
to:
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShow)

For UNICODE, use:
int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShow)

Create project under Win32 Project or change the SubSystem setting to Windows (/SUBSYSTEM:WINDOWS) under Properties -> Linker -> System.

GCC/G++:
Build using the -mwindows flag. The above steps are optional.

If visibility is desired, use:

#include <cstdio>

...

AllocConsole();
AttachConsole(GetCurrentProcessId());
freopen("CON", "w", stdout);

...

FreeConsole();
@GiacomoLaw
Copy link
Owner

I like the way it is - however, I am open to improvements. With the console flashing on startup, it does occur in the pcs I have used in my experience, but I'm not sure if it is standard.

Do you have any other advantages of using it along with the console flash?

Thanks for the awesomely structured pr! 😄

@93aef0ce4dd141ece6f5
Copy link
Author

Not that I can think of, no. The reason why I proposed this is because keyloggers are stealth malware and having the console flash may raise suspicion against it. Perhaps someone who might use it would prefer no console flash but if you're fine with the way it currently is, then so be it.

@GiacomoLaw GiacomoLaw added the windows Issue with Windows version label Mar 22, 2019
@GiacomoLaw
Copy link
Owner

Coming back to this, this is a great issue - would appreciate a PR implementing it :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted windows Issue with Windows version
Projects
None yet
Development

No branches or pull requests

2 participants