nog icon indicating copy to clipboard operation
nog copied to clipboard

Crash when attempting to manage a program running as administrator while wwm is not running administrator

Open ramirezmike opened this issue 5 years ago • 1 comments

This isn't too big of a deal but if you're not running wwm as administrator and try to manage a window that is running as administrator it will first seem like it's ignoring your attempt to manage the window and then if you try to navigate to the workspace that you attempted to add it to wwm will crash.

Here's an example log:

[2020-07-24 18:12:09.412845 -04:00] DEBUG [src/main.rs:109] Drawing the workspace
[2020-07-24 18:12:09.412845 -04:00] DEBUG [src/tile_grid.rs:576] Drawing grid
[2020-07-24 18:12:09.412845 -04:00] DEBUG [src/tile_grid.rs:584] Tile(id: 788940, title: 'Microsoft Visual Studio  (Administrator)', row: None column: None)
[2020-07-24 18:12:09.412845 -04:00] DEBUG [src/main.rs:111] Showing the workspace
[2020-07-24 18:12:09.412845 -04:00] ERROR [src/main.rs:329] PANIC: unknown

It crashes here

main.rs

    debug!("Drawing the workspace");
    new_grid.draw_grid();
    debug!("Showing the workspace");
    new_grid.show();  <--

Might be here specifically? window.rs

    pub fn show(&self) {
        unsafe {
            ShowWindow(self.id as HWND, SW_SHOW); <--
        }
    }

But, it doesn't really matter where because I'm assuming this is something that can't really be handled in a way that makes it work. Maybe I'm wrong?

If I'm right though, maybe this should ignore a request of an administrator window and show a notification somewhere to the user that they're unable to manage that window? Not sure what's the preferred balance of user friendliness for the target audience.

ramirezmike avatar Jul 28 '20 01:07 ramirezmike

You are right that wwm can't handle applications that have administrator privileges when not having them itself.

I don't know whether it is possible to check for the privileges that an application has.

TimUntersberger avatar Jul 28 '20 06:07 TimUntersberger