Skip to content

Commit

Permalink
Shouldn't use OwnedHandle GetShellWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
Legend-Master committed Jun 5, 2024
1 parent 08f20df commit 58a259c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/nsis-process/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ fn get_processes(name: &str) -> Vec<u32> {
///
/// Ported from https://devblogs.microsoft.com/oldnewthing/20190425-00/?p=102443
unsafe fn run_as_user(command: &str, arguments: &str) -> bool {
let hwnd = OwnedHandle::new(GetShellWindow());
if hwnd.is_invalid() {
let hwnd = GetShellWindow();
if hwnd == 0 {
return false;
}

let mut proccess_id = 0;
if GetWindowThreadProcessId(*hwnd, &mut proccess_id) == 0 {
if GetWindowThreadProcessId(hwnd, &mut proccess_id) == 0 {
return false;
}

Expand Down

0 comments on commit 58a259c

Please sign in to comment.