diff --git a/crates/squid-platform/src/permissions.rs b/crates/squid-platform/src/permissions.rs index 2c39cf4..9c16963 100644 --- a/crates/squid-platform/src/permissions.rs +++ b/crates/squid-platform/src/permissions.rs @@ -636,6 +636,7 @@ mod windows { /// one is a 残留项). fn decorate_display_names(entries: &mut [StartupEntry]) { let vendors = vendor_icon_map(); + let products = product_icon_map(); let mut cache: std::collections::HashMap = Default::default(); for entry in entries { let Some(exe) = exe_from_command(&entry.command) else { @@ -656,11 +657,16 @@ mod windows { .or_insert_with(|| { let (description, product, _company) = version_strings(&probed); let usable = |text: Option| text.filter(|t| !is_placeholder_label(t)); - ( - usable(description), - usable(product), - software_icon(&probed, &vendors), - ) + let (description, product) = (usable(description), usable(product)); + // A stub's own PE strings name the product it serves; + // hand that label to the icon lookup so the uninstall + // registry can point at the real binary's icon. + let label = product + .as_deref() + .or(description.as_deref()) + .map(clean_module_name); + let icon = software_icon(&probed, &vendors, &products, label.as_deref()); + (description, product, icon) }) .clone(); entry.display_name = @@ -823,13 +829,100 @@ mod windows { map } + /// Lower-case product identity of a PE label: cut parenthetical + /// editions ("WeChat (64-bit)") and trim, so a stub's FileDescription + /// can be matched against uninstall-registry keys. + fn clean_module_name(text: &str) -> String { + text.split(['(', '(', '[', '【']) + .next() + .unwrap_or(text) + .trim() + .to_lowercase() + } + + /// Product name → `DisplayIcon` from the uninstall registry. Stubs that + /// ship no icon resources carry the product in their PE strings + /// (`WemeetUpdateSvc.exe` says "腾讯会议", `WXWorkUpgrader.exe` says + /// "WXWorkService"); this map turns that claim into the real binary's + /// icon. Keyed by both the cleaned `DisplayName` and the DisplayIcon + /// file stem so either form finds its product. Built once per scan. + fn product_icon_map() -> std::collections::HashMap { + const UNINSTALLS: [&str; 3] = [ + r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", + r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall", + r"Software\Microsoft\Windows\CurrentVersion\Uninstall", + ]; + let mut map: std::collections::HashMap = Default::default(); + for hive in [HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER] { + for base in UNINSTALLS { + let Ok(root) = RegKey::predef(hive).open_subkey_with_flags(base, KEY_READ) else { + continue; + }; + for name in root.enum_keys().filter_map(Result::ok) { + let Ok(app) = root.open_subkey_with_flags(&name, KEY_READ) else { + continue; + }; + let Some(spec): Option = app.get_value("DisplayIcon").ok() else { + continue; + }; + let Some((path, index)) = parse_display_icon(&spec) else { + continue; + }; + if !Path::new(&path).exists() { + continue; + } + if let Ok(display) = app.get_value::("DisplayName") { + let key = clean_module_name(&display); + if !key.is_empty() { + map.entry(key).or_insert_with(|| (path.clone(), index)); + } + } + let stem = Path::new(&path) + .file_stem() + .map(|s| s.to_string_lossy().to_lowercase()) + .unwrap_or_default(); + if !stem.is_empty() { + map.entry(stem).or_insert_with(|| (path.clone(), index)); + } + } + } + } + map + } + + /// Registry key for a stub's claimed product: exact first, then the + /// longest alias that stretches to it ("wxworkservice" → the `wxwork` + /// stem). Aliases shorter than four characters never stretch, so + /// generic words cannot borrow an unrelated tile. + fn product_icon_spec<'a>( + label: &str, + products: &'a std::collections::HashMap, + ) -> Option<&'a (String, u16)> { + if let Some(found) = products.get(label) { + return Some(found); + } + products + .iter() + .filter(|(key, _)| { + key.len() >= 4 && (label.starts_with(key.as_str()) || key.starts_with(label)) + }) + .max_by(|(left, _), (right, _)| left.len().cmp(&right.len())) + .map(|(_, spec)| spec) + } + /// Startup-list icon with the vendor fallbacks the generic extraction /// lacks: real resources first, then App Paths, then the uninstall - /// registry's DisplayIcon for the same folder, then a sibling file. - /// `None` (a neutral placeholder in the UI) beats a misleading tile. + /// registry's DisplayIcon for the same folder, then the DisplayIcon of + /// the *named* product (a stub's PE strings say which app it belongs to + /// — 腾讯会议's updater lives alone in `Tencent\UpdateSvr\` and ships no + /// icon, while the real `WeMeetApp.exe` is one DisplayIcon away), then a + /// sibling file. `None` (a neutral placeholder in the UI) beats a + /// misleading tile. fn software_icon( path: &str, vendors: &std::collections::HashMap, + products: &std::collections::HashMap, + product_label: Option<&str>, ) -> Option> { if has_icon_resources(path) { return exe_icon_png(path, 0); @@ -850,6 +943,13 @@ mod windows { return Some(icon); } } + if let Some(label) = product_label { + if let Some((spec, index)) = product_icon_spec(&label.to_lowercase(), products) { + if let Some(icon) = exe_icon_png(spec, *index) { + return Some(icon); + } + } + } if let Some((spec, index)) = file.parent().and_then(sibling_icon_spec) { if let Some(icon) = exe_icon_png(&spec, index) { return Some(icon); @@ -2519,9 +2619,10 @@ mod windows { #[cfg(test)] mod tests { use super::{ - approved_enabled, attribute_vendor_suites, clean_module_path, exe_from_command, - friendly_program_name, has_cjk, is_component_role_label, is_placeholder_label, - module_folder_name, parse_csv_line, split_run_path, suite_path, task_settings_enabled, + approved_enabled, attribute_vendor_suites, clean_module_name, clean_module_path, + exe_from_command, friendly_program_name, has_cjk, is_component_role_label, + is_placeholder_label, module_folder_name, parse_csv_line, product_icon_map, + product_icon_spec, split_run_path, suite_path, task_settings_enabled, windows_store_product, write_approved, StartupEntry, CURRENT_VERSION, }; use winreg::RegKey; @@ -2589,6 +2690,73 @@ mod windows { ); } + #[test] + fn clean_module_names_drop_editions_and_case() { + assert_eq!(clean_module_name("WeChat (64-bit)"), "wechat"); + assert_eq!(clean_module_name("腾讯会议(企业版) "), "腾讯会议"); + assert_eq!(clean_module_name(" WXWorkService "), "wxworkservice"); + } + + #[test] + fn a_stub_borrows_its_products_icon_by_label() { + // Two shapes of the same problem: 腾讯会议's stub says exactly + // what the uninstall `DisplayName` says, 企业微信's says + // "WXWorkService" while the registry keys are 企业微信 / + // `wxwork.exe`. The first matches by name, the second must + // stretch to the longest alias. + let products = product_icon_map(); + let Some(wechat) = products.get("企业微信").or_else(|| products.get("wxwork")) + else { + eprintln!("skipping: 企业微信 not installed"); + return; + }; + assert!( + product_icon_spec("wxworkservice", &products).is_some_and(|found| found == wechat), + "the upgrader label did not resolve to the product icon" + ); + // Too-short keys never stretch, or "ab" would own everything; + // a label stretching *down* to a shorter alias is the rule. + let mut tiny: std::collections::HashMap = Default::default(); + tiny.insert("ab".into(), ("unrelated.exe".into(), 0)); + tiny.insert("wemeet".into(), wechat.clone()); + assert!(product_icon_spec("wemeetupd", &tiny).is_some_and(|found| found == wechat)); + assert!(product_icon_spec("zeta", &tiny).is_none()); + } + + #[test] + fn the_live_scan_icons_the_stubbin_updaters() { + // 腾讯会议 keeps `WemeetUpdateSvc.exe` alone in + // `Tencent\UpdateSvr\` with zero icon resources, and 企业微信's + // `WXWorkUpgrader.exe` is the same trick; both used to render a + // grey initial tile in the startup groups. Skips off those boxes. + let meetings = std::path::Path::new(r"C:\Program Files (x86)\Tencent\UpdateSvr"); + let wechat = std::path::Path::new(r"D:\Program Files (x86)\WXWork"); + if !meetings.exists() && !wechat.exists() { + eprintln!("skipping: no Tencent updater stubs on this machine"); + return; + } + let entries = super::scan_startup(); + let stubs: Vec<_> = entries + .iter() + .filter(|entry| { + entry.target.to_lowercase().contains("wemeetupdatesvc") + || entry.target.to_lowercase().contains("wxworkupgrader") + }) + .collect(); + assert!( + !stubs.is_empty(), + "the updater stubs vanished from the scan" + ); + for stub in &stubs { + assert!( + stub.icon.is_some(), + "{} has no icon: {:?}", + stub.name, + stub.target + ); + } + } + #[test] fn the_live_scan_folds_h3c_into_one_suite_group() { // The real complaint on the H3C VDI machine: cameraservice, diff --git a/release/0.1.13/RELEASE_NOTES.md b/release/0.1.13/RELEASE_NOTES.md index d16e73b..66beb51 100644 --- a/release/0.1.13/RELEASE_NOTES.md +++ b/release/0.1.13/RELEASE_NOTES.md @@ -36,6 +36,12 @@ Squid 0.1.13 更新说明 看着像系统组件实为第三方库,此前在启动列表里开了一个独立的假软件组; 现在这类「Windows/Microsoft + Proxy/Host/Service…)」的角色名一律归入 「其他软件」,真实产品名不受影响。 +- 软件图标获取机制加强:不带任何图标资源的「更新服务」类小程序,现在会 + 按它自己声称归属的产品去卸载注册表里借图标——腾讯会议的 + `WemeetUpdateSvc.exe`(单独躺在 `Tencent\UpdateSvr\`,自己零图标)取到 + 腾讯会议图标,企业微信的 `WXWorkUpgrader.exe` 经 `WXWorkService` 顺到 + `WXWork.exe` 的图标;同名厂商目录、App Paths、同目录兄弟程序的既有兜底 + 顺序不变,实在认不出的仍显示中性占位,绝不张冠李戴。 - 商店应用归组修复:ChatGPT 等微软商店安装的应用此前因为读不到程序信息 而全部堆在「其他软件」,现在按安装包名自动归组(ChatGPT 独立成组,带 自己的图标);「其他软件」组头改用中性九宫格图标,不再借用组内某个 diff --git a/release/0.1.13/SHA256SUMS.txt b/release/0.1.13/SHA256SUMS.txt index fa28391..3428798 100644 --- a/release/0.1.13/SHA256SUMS.txt +++ b/release/0.1.13/SHA256SUMS.txt @@ -1,2 +1,2 @@ -b7fbe841d65a0ffb478096609615bd92b94396878d1cb742050685c6eacf8427 Squid-Setup-0.1.13-win-x64.exe -a68aa796ce23a7afb148032b858b843aa299641c2b0844655c7d157ff52e5b5c Squid-0.1.13-portable-win-x64.zip +5ed5247bc85e8b5157b2d1ed797a586c4bd8cecaa848ee628ca5b406978249d8 Squid-Setup-0.1.13-win-x64.exe +3ef89d39e19d9a1b4eb625168827a7d968f77bd9cf449832db615b61ec5ccda9 Squid-0.1.13-portable-win-x64.zip \ No newline at end of file diff --git a/release/0.1.13/Squid-0.1.13-portable-win-x64.zip b/release/0.1.13/Squid-0.1.13-portable-win-x64.zip index e5c6000..0a813b3 100644 Binary files a/release/0.1.13/Squid-0.1.13-portable-win-x64.zip and b/release/0.1.13/Squid-0.1.13-portable-win-x64.zip differ diff --git a/release/0.1.13/Squid-Setup-0.1.13-win-x64.exe b/release/0.1.13/Squid-Setup-0.1.13-win-x64.exe index d0e8ff5..e68f8a7 100644 Binary files a/release/0.1.13/Squid-Setup-0.1.13-win-x64.exe and b/release/0.1.13/Squid-Setup-0.1.13-win-x64.exe differ diff --git a/release/0.1.13/squid-update.json b/release/0.1.13/squid-update.json index 920da57..38279aa 100644 --- a/release/0.1.13/squid-update.json +++ b/release/0.1.13/squid-update.json @@ -1,13 +1,13 @@ -{ +{ "schema": 1, "version": "0.1.13", "date": "2026-11-25", - "notes": "Squid 0.1.13 更新说明\n\n新增\n- 开机启动项大升级(权限管理内,位置不变):\n · 状态筛选段:全部 / 已启用 / 已禁用 / 残留,每档带实时计数,一点即筛。\n · 残留项自动识别:程序文件已不在磁盘上、只剩启动配置的,标红并给出\n 「删除启动项」按钮——只删注册表值/快捷方式/计划任务本身,绝不动\n 程序文件;残留服务改为「禁用」而非卸载,删除前弹窗讲清影响范围。\n · 「显示系统项」开关:微软签名或位于 Windows 目录的启动项默认折进\n 「系统组件」组隐藏,列表只剩真正拖累开机的第三方软件。\n · 每行显示来源与路径明细,展开可见完整命令行,并可一键「打开所在\n 文件夹」。\n- 重复文件:保留副本也可以勾选了。勾上即「本组一份不剩」,行与组标题\n 变琥珀警示,顶部汇总显示有几组将被完全删除,确认条同时变红并要求\n 「确认完全删除」;删除仍走回收站,可从历史撤销。\n- 右键菜单扩展按软件分组:同一个软件注册在多个菜单位置的条目合并成一张\n 卡片(组头 = 软件图标 + 名称 + 开启状态 + 组级总开关),和开机启动项\n 同一套样式;认不出归属的落入「其他软件」。菜单位置类别与计数不变。\n\n调整\n- 电脑概览页排版改版:处理器与内存合并为一张卡(上下分布),存储空间卡\n 加宽、每个盘符收成一行的表格感排版(盘符|进度条|用量与容量),日常\n 维护三个入口竖排进右列——指标行按 30% / 42% / 28% 三列分布,区块间距\n 整体加大,页面更透气。\n- 「开始智能扫描」不再停留在概览页:点击立即跳转到空间清理页,两阶段\n 扫描(缓存垃圾 → 构建残留)在那边继续执行;「空间清理」快捷卡同此。\n- 套件归组:同一厂商装在 Program Files 下多个子目录的产品(如新华三\n H3C Workspace 的 SpaceAgent、摄像头/打印机/USB/串并口重定向等一组服务,\n 每个程序都不带产品名信息)自动合并为一组「H3C Workspace」,不再散成\n 单行组和「其他软件」;带真实产品名的软件不受影响。\n- 电脑概览继续微调:页头三行文字(问候/标题/副标题)间距拉开、整块连同\n 下方模块适度下移,页面不再顶格;处理器/内存的进度条左缘与图标对齐;\n 明细小字(CPU 型号、进程数)与存储卡的盘符信息统一字号与颜色;\n 「实时监控」按钮升级为与「开始智能扫描」同款的橙色主按钮。\n- 角色名不再自成一组:WinFsp 的启动服务自称「Windows File System Proxy」,\n 看着像系统组件实为第三方库,此前在启动列表里开了一个独立的假软件组;\n 现在这类「Windows/Microsoft + Proxy/Host/Service…)」的角色名一律归入\n 「其他软件」,真实产品名不受影响。\n- 商店应用归组修复:ChatGPT 等微软商店安装的应用此前因为读不到程序信息\n 而全部堆在「其他软件」,现在按安装包名自动归组(ChatGPT 独立成组,带\n 自己的图标);「其他软件」组头改用中性九宫格图标,不再借用组内某个\n 软件的图标误导。\n- 空间清理三个页签统一扫描交互:同一颗大号「开始扫描」主按钮,固定在各\n 自配置栏的最右侧(垃圾清理原先孤悬的小按钮、重复文件的「开始查找」、\n 大文件的小按钮全部归一);未扫描 → 开始扫描,扫描中 → 扫描中…,扫过\n 之后 → 重新扫描,三页文案与状态一致;大文件页补上扫描前的引导空态。\n- 大文件扫描不再列出 pagefile.sys / swapfile.sys——系统全程持有,谁都\n 删不掉,列出来只会误导;hiberfil.sys 保留并注明可「关闭休眠」释放。\n- 权限管理开机启动项与进阶启动项共用同一套签名核验批处理:一次系统\n 调用覆盖整页,翻页不再重复等待。\n\n移除\n- 电脑概览右上角的「智能扫描」大按钮(与卡内的「开始智能扫描」重复)。\n\n修复\n- 重复文件「清理 N 个副本」按钮深红字压在红底上看不清:移除页面级\n 配色覆盖,回归全局危险按钮样式(红底白字),并禁止页面再覆盖按钮\n 颜色。\n- 打开权限管理(开机启动项 / 进阶启动项)时会闪出一个黑色命令行窗口:\n 批量签名核验调用 PowerShell 时漏了隐藏窗口标志,GUI 程序拉起控制台\n 程序就会新建窗口;现已全部静默。同类漏网(清理扫描里的 git 探测)\n 一并堵上。\n- 一键安装.bat 重写:先自动退出正在运行的 Squid、前台同步安装、每步\n 有进度输出与错误码,不再出现「双击后只剩空命令行」的无响应窗口。\n", + "notes": "Squid 0.1.13 更新说明\n\n新增\n- 开机启动项大升级(权限管理内,位置不变):\n · 状态筛选段:全部 / 已启用 / 已禁用 / 残留,每档带实时计数,一点即筛。\n · 残留项自动识别:程序文件已不在磁盘上、只剩启动配置的,标红并给出\n 「删除启动项」按钮——只删注册表值/快捷方式/计划任务本身,绝不动\n 程序文件;残留服务改为「禁用」而非卸载,删除前弹窗讲清影响范围。\n · 「显示系统项」开关:微软签名或位于 Windows 目录的启动项默认折进\n 「系统组件」组隐藏,列表只剩真正拖累开机的第三方软件。\n · 每行显示来源与路径明细,展开可见完整命令行,并可一键「打开所在\n 文件夹」。\n- 重复文件:保留副本也可以勾选了。勾上即「本组一份不剩」,行与组标题\n 变琥珀警示,顶部汇总显示有几组将被完全删除,确认条同时变红并要求\n 「确认完全删除」;删除仍走回收站,可从历史撤销。\n- 右键菜单扩展按软件分组:同一个软件注册在多个菜单位置的条目合并成一张\n 卡片(组头 = 软件图标 + 名称 + 开启状态 + 组级总开关),和开机启动项\n 同一套样式;认不出归属的落入「其他软件」。菜单位置类别与计数不变。\n\n调整\n- 电脑概览页排版改版:处理器与内存合并为一张卡(上下分布),存储空间卡\n 加宽、每个盘符收成一行的表格感排版(盘符|进度条|用量与容量),日常\n 维护三个入口竖排进右列——指标行按 30% / 42% / 28% 三列分布,区块间距\n 整体加大,页面更透气。\n- 「开始智能扫描」不再停留在概览页:点击立即跳转到空间清理页,两阶段\n 扫描(缓存垃圾 → 构建残留)在那边继续执行;「空间清理」快捷卡同此。\n- 套件归组:同一厂商装在 Program Files 下多个子目录的产品(如新华三\n H3C Workspace 的 SpaceAgent、摄像头/打印机/USB/串并口重定向等一组服务,\n 每个程序都不带产品名信息)自动合并为一组「H3C Workspace」,不再散成\n 单行组和「其他软件」;带真实产品名的软件不受影响。\n- 电脑概览继续微调:页头三行文字(问候/标题/副标题)间距拉开、整块连同\n 下方模块适度下移,页面不再顶格;处理器/内存的进度条左缘与图标对齐;\n 明细小字(CPU 型号、进程数)与存储卡的盘符信息统一字号与颜色;\n 「实时监控」按钮升级为与「开始智能扫描」同款的橙色主按钮。\n- 角色名不再自成一组:WinFsp 的启动服务自称「Windows File System Proxy」,\n 看着像系统组件实为第三方库,此前在启动列表里开了一个独立的假软件组;\n 现在这类「Windows/Microsoft + Proxy/Host/Service…)」的角色名一律归入\n 「其他软件」,真实产品名不受影响。\n- 软件图标获取机制加强:不带任何图标资源的「更新服务」类小程序,现在会\n 按它自己声称归属的产品去卸载注册表里借图标——腾讯会议的\n `WemeetUpdateSvc.exe`(单独躺在 `Tencent\\UpdateSvr\\`,自己零图标)取到\n 腾讯会议图标,企业微信的 `WXWorkUpgrader.exe` 经 `WXWorkService` 顺到\n `WXWork.exe` 的图标;同名厂商目录、App Paths、同目录兄弟程序的既有兜底\n 顺序不变,实在认不出的仍显示中性占位,绝不张冠李戴。\n- 商店应用归组修复:ChatGPT 等微软商店安装的应用此前因为读不到程序信息\n 而全部堆在「其他软件」,现在按安装包名自动归组(ChatGPT 独立成组,带\n 自己的图标);「其他软件」组头改用中性九宫格图标,不再借用组内某个\n 软件的图标误导。\n- 空间清理三个页签统一扫描交互:同一颗大号「开始扫描」主按钮,固定在各\n 自配置栏的最右侧(垃圾清理原先孤悬的小按钮、重复文件的「开始查找」、\n 大文件的小按钮全部归一);未扫描 → 开始扫描,扫描中 → 扫描中…,扫过\n 之后 → 重新扫描,三页文案与状态一致;大文件页补上扫描前的引导空态。\n- 大文件扫描不再列出 pagefile.sys / swapfile.sys——系统全程持有,谁都\n 删不掉,列出来只会误导;hiberfil.sys 保留并注明可「关闭休眠」释放。\n- 权限管理开机启动项与进阶启动项共用同一套签名核验批处理:一次系统\n 调用覆盖整页,翻页不再重复等待。\n\n移除\n- 电脑概览右上角的「智能扫描」大按钮(与卡内的「开始智能扫描」重复)。\n\n修复\n- 重复文件「清理 N 个副本」按钮深红字压在红底上看不清:移除页面级\n 配色覆盖,回归全局危险按钮样式(红底白字),并禁止页面再覆盖按钮\n 颜色。\n- 打开权限管理(开机启动项 / 进阶启动项)时会闪出一个黑色命令行窗口:\n 批量签名核验调用 PowerShell 时漏了隐藏窗口标志,GUI 程序拉起控制台\n 程序就会新建窗口;现已全部静默。同类漏网(清理扫描里的 git 探测)\n 一并堵上。\n- 一键安装.bat 重写:先自动退出正在运行的 Squid、前台同步安装、每步\n 有进度输出与错误码,不再出现「双击后只剩空命令行」的无响应窗口。", "artifacts": { "windows": { "file": "Squid-Setup-0.1.13-win-x64.exe", - "sha256": "b7fbe841d65a0ffb478096609615bd92b94396878d1cb742050685c6eacf8427", - "size": 3867839 + "sha256": "5ed5247bc85e8b5157b2d1ed797a586c4bd8cecaa848ee628ca5b406978249d8", + "size": 3872554 } } -} +} \ No newline at end of file