get CREATE_NO_WINDOW from windows crate
This commit is contained in:
@@ -3,9 +3,9 @@
|
|||||||
use crate::util::consts::{ENHANCED, LEGACY};
|
use crate::util::consts::{ENHANCED, LEGACY};
|
||||||
use std::{os::windows::process::CommandExt, path::Path, process::Command};
|
use std::{os::windows::process::CommandExt, path::Path, process::Command};
|
||||||
use sysinfo::System;
|
use sysinfo::System;
|
||||||
|
use windows::Win32::System::Threading::CREATE_NO_WINDOW;
|
||||||
|
|
||||||
const FILTER_NAME: &str = "[GTA Tools] Block all traffic for GTA V";
|
const FILTER_NAME: &str = "[GTA Tools] Block all traffic for GTA V";
|
||||||
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
|
|
||||||
|
|
||||||
fn get_game_exe_path(sysinfo: &mut System) -> Option<&Path> {
|
fn get_game_exe_path(sysinfo: &mut System) -> Option<&Path> {
|
||||||
sysinfo.refresh_all();
|
sysinfo.refresh_all();
|
||||||
@@ -37,7 +37,7 @@ pub fn block_all(sysinfo: &mut System) {
|
|||||||
"protocol=ANY",
|
"protocol=ANY",
|
||||||
&format!("program={exe_path}"),
|
&format!("program={exe_path}"),
|
||||||
])
|
])
|
||||||
.creation_flags(CREATE_NO_WINDOW)
|
.creation_flags(CREATE_NO_WINDOW.0)
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
Command::new("netsh")
|
Command::new("netsh")
|
||||||
@@ -52,7 +52,7 @@ pub fn block_all(sysinfo: &mut System) {
|
|||||||
"protocol=ANY",
|
"protocol=ANY",
|
||||||
&format!("program={exe_path}"),
|
&format!("program={exe_path}"),
|
||||||
])
|
])
|
||||||
.creation_flags(CREATE_NO_WINDOW)
|
.creation_flags(CREATE_NO_WINDOW.0)
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ pub fn unblock_all() {
|
|||||||
"rule",
|
"rule",
|
||||||
&format!("name={FILTER_NAME}"),
|
&format!("name={FILTER_NAME}"),
|
||||||
])
|
])
|
||||||
.creation_flags(CREATE_NO_WINDOW)
|
.creation_flags(CREATE_NO_WINDOW.0)
|
||||||
.spawn()
|
.spawn()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user