SharkCagey / SharkCage

1 stars 3 forks source link

25 show metadata in sidebar and face lift of labeler #50

Closed SailReal closed 6 years ago

SailReal commented 6 years ago

Without additional app: screen shot 2018-06-09 at 7 31 53 pm

With keepass as additional app: screen shot 2018-06-09 at 7 32 21 pm

DonatJR commented 6 years ago

@SailReal On my end, IE + Keepass and a few other configurations now work as expected. I achieved it by enumerating all visible windows on the desktop and sending WM_CLOSE to all of them when exiting (and closing all processes belonging to those windows if they don't respond to that). This is not foolproof as there could be processes with invisible windows or processes with no windows at all, but I think this is the best we can do for now.

To avoid having such processes with invisible windows spawn on the next iteration of the desktop, we could randomize the desktop class name each time we open it so it doesn't get reused.

Also, there is a lot of debug print stuff and a message box in the code which I will remove before merging once everything works properly.

CAUTION: running the application on the default desktop now terminates all processes living on this desktop, i.e. windows is pretty much unusable afterwards - if you need to run ich on the default desktop comment out the ::PostMessage(..., WM_CLOSE, ...) and ::TerminateProces(...) calls ;)

SailReal commented 6 years ago

Sounds pretty awesome and thanks for the hint with the default desktop๐Ÿ‘

Playing around, I discovered these things:

After switching back to the default desktop, all applications were finished ๐Ÿ‘

DonatJR commented 6 years ago

@SailReal

  1. I can't reproduce this at all. On my system properly waits for the IE explorer instance to close before switiching back Edit: The issue seems to be IE specific, the process launches itself in protected mode if the specified / default URL is not trusted: https://social.msdn.microsoft.com/Forums/en-US/ecabf0d5-2fa0-4f4e-895d-cea2ce2e289e/waitforsingleobject-doesnt-work-for-internet-explorer?forum=windowsgeneraldevelopmentissues Proposal: Add a flag to the config with which the user can specify if the cage can ONLY be exited by pressing the exit button on the labeler. This prevents the cage to shut down prematurely because it can't wait on the handle for the new instance of IE / other as of yet unkown protected mode processes
  2. Also can't reproduce this, but this could be due to different Keepass configs. If Keepass isn't shutting down when receiving the WM_CLOSE message I can't do anything about it. And you are right, 5s later the timeout kicks in and terminates Keepass.
DonatJR commented 6 years ago

@SailReal I added a new option to the config which disables closing of the secure desktop when all apps are closed. This can, for now (until we find a better solution), be used for problematic applications like IE in your case. With this I hope we can finally close this PR... ๐Ÿ˜…

SailReal commented 6 years ago

Awesome ๐Ÿ‘ and thx for your help!!! If you approve the review I will merge the PR

DonatJR commented 6 years ago

I'm going to remove the debug print stuff tomorrow and then approve it :)