-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix(#1606): Remove console window for GUI apps, without changing the manifests. #5559
Conversation
Hey, all! Umm.. any reasons for rejecting/keeping this pull request stale? |
Hey @spider2048! I apologize for letting this PR get stale - I recently switched jobs so I haven't been active on GitHub for a long while. I just have a couple of hunches - post which I'll merge this ASAP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, could you provide a brief list of validation steps to test this PR?
Thanks again!
Hello @rashil2000! For example, if you have neovim/firefox/brave installed, force updating them using this PR would patch their shim, which removes the console window. I've fixed the parts of the code you pointed out. |
Great! I have tested it with Notepad++ and Paint.NET. Final step: please add an entry in the Changelog.md |
Hello @rashil2000, I've added an entry in the changelog.md as you requested. |
Co-authored-by: Rashil Gandhi <[email protected]>
* Change shim subsystem to prevent console window for GUI apps. * Removed redundant log * Update core.ps1 * Fixes file access rights and the log message * update changelog * Update CHANGELOG.md (PR Number) Co-authored-by: Rashil Gandhi <[email protected]> --------- Co-authored-by: Quasar <[email protected]> Co-authored-by: Rashil Gandhi <[email protected]>
This is not a bug technically, but consider this scene. |
Hello @r15ch13! Also, if we look at the error message:
The error occurs in the So, compiling the shim wouldn't really fix this issue as the user would try to run the false positive anyway. Edit:
Look at the VT Report of the file with which Windows Defender is unhappy with. |
Another program that kinda has some weird behavior with this PR is rufus, which has a cli mode pbatard/rufus#111 (comment) but it can't be accessed due to:
You can ofc get around this with |
Hello, @brian6932! Rufus' CLI developement has a very low priority. As a result, we have the following:
So, when an application (like Rufus) compiled with the windows subsystem wants a console window, they use If we use the CLI version of the shim (without the PR), Rufus would think that it is operating from a shell which wouldn't be the case everytime. Also, it creates some weird lag because the main Rufus application blocks the console and the keystrokes events get processed after the application quits (creating weird lag). And because I use powershell:
... which is not a good experience for a user who needs to use Rufus' GUI. If we wanted to use the CLI features:
... which is an okay-ish experience (~3.5 seconds for showing the help). On the other hand, using the GUI version of the shim (with the PR), Rufus won't be able to attach to the console. This would not create any weird lags if the user had to use only the GUI features. We can't use the CLI features using this shim. So, if we wanted the CLI features, we would prefer to use the workaround you proposed. But the GUI features work perfectly.
... which is a good experience (~0.2s to show the UAC prompt) So, I would like to conclude that:
|
Yea I agree that Rufus' CLI implementation is scuffed, I just wanted to point out what I witnessed, as I don't doubt there could be other GUI+CLI bins that experience similar issues. Potentially a manual setting for GUI/CLI bin shims could be required for certain programs. |
Yes, I agree with you. I think we can probably adjust the manifests and add a command line flag, if we experience issues. (for packages like Rufus). Choosing between |
Is there a way to enforce this feature? I'm trying to create a manifest for the rio terminal, but the shim creates a visible terminal running the shim that stays open but at least can be closed, but I tried to make a shortcut and this creates a "conhost.exe" in the background that I have to force quit. |
Hello @melMass! I've tried to install
The above picture is the process tree after running On the other hand, if you didn't use this PR, you would see a blank console window (if you run the shim using the shortcut in the startmenu) along with the Rio's main window. I would also like to point out that, using the shortcut to the actual It's because the shortcut uses the variable Now, there's something I am worried about: here, which would not work if we are using this PR, but I will make a fix for it soon. |
Thanks a lot for this answer, I will try out more based on it |
Description
Added 2 functions to get the subsystem of the shimmed PE binaries and change the subsystem of the shim executable while installing.
Motivation and Context
Closes #1606 as it is annoying to deal with the Console Window.
How Has This Been Tested?
I've checked my code changes by installing packages: nvim, vim, wireshark, firefox.
Every GUI app from the above packages (nvim-qt, gvim, gvimdiff, wireshark, firefox) doesn't pop-up a console window and works fine.
The changed code only affects the
subsystem
value in the PEOptional Headers
of the shim exe.Checklist:
develop
branch.