phra / PEzor

Open-Source Shellcode & PE Packer
https://iwantmore.pizza/posts/PEzor.html
GNU General Public License v3.0
1.81k stars 320 forks source link

Prevent executables from spawning a console #56

Closed A32AN closed 2 years ago

A32AN commented 3 years ago

Hi,

I put in a fix to prevent executables generated by PEzor from spawning a console, which is mentioned in #52.

I did not go with the solution suggested in this issue (FreeConsole()) since that route still spawns a console, it just quickly hides it. Another solution would have been to call ShowWindow(GetConsoleWindow(), SW_HIDE);, but this has the same effect as FreeConsole()

My solution is to pass the -subsystem=windows flag to the linked upon compilation to compile as a GUI Application instead of Console Application.

I applied this fix to both "exe" as well as "service-exe". I'm not sure if it's necessary in the last case.. I also made sure that debug builds don't compile with this flag.