From c362fedabec757ec1fae1b69e2f7b656f8b12aeb Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Wed, 27 May 2026 18:27:23 +0800 Subject: [PATCH] fix: hide terminal window when checking system proxy on Windows Use CREATE_NO_WINDOW flag to prevent reg.exe from flashing console windows during update checks. Closes #483 --- crates/dbx-core/src/update.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/dbx-core/src/update.rs b/crates/dbx-core/src/update.rs index c46a91622..d83895aa4 100644 --- a/crates/dbx-core/src/update.rs +++ b/crates/dbx-core/src/update.rs @@ -82,9 +82,20 @@ fn system_proxy_url_from_platform() -> Option { #[cfg(target_os = "windows")] fn system_proxy_url_from_platform() -> Option { + use std::os::windows::process::CommandExt; + let key = r"HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"; - let proxy_enable = std::process::Command::new("reg").args(["query", key, "/v", "ProxyEnable"]).output().ok()?; - let proxy_server = std::process::Command::new("reg").args(["query", key, "/v", "ProxyServer"]).output().ok()?; + const CREATE_NO_WINDOW: u32 = 0x08000000; + let proxy_enable = std::process::Command::new("reg") + .args(["query", key, "/v", "ProxyEnable"]) + .creation_flags(CREATE_NO_WINDOW) + .output() + .ok()?; + let proxy_server = std::process::Command::new("reg") + .args(["query", key, "/v", "ProxyServer"]) + .creation_flags(CREATE_NO_WINDOW) + .output() + .ok()?; if !proxy_enable.status.success() || !proxy_server.status.success() { return None; }