用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/publieople/hermes-config-kit --skill windows-native-rust命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | windows-native-rust |
| description | Windows 原生 Rust — windows crate/winreg/COM/签名/提权/交叉编译/真机 CI。 |
| 能力 | 用 | 不用 |
|---|---|---|
| 注册表 | winreg 0.56+ (196M 下载) | 手写 RegGetValue |
| 任务计划 | windows crate Win32_System_TaskScheduler COM | taskschd crate(已死,2023 停更) |
| 签名校验 | windows crate Win32_Security_WinTrust (WinVerifyTrust) | schtasks CLI 解析(输出本地化脆弱) |
| 启动文件夹 | SHGetFolderPathW (Win32_UI_Shell) | 硬编码路径 |
[target.'cfg(windows)'.dependencies],否则 Linux 编译直接挂(winreg 有 compile_error! 守卫)。#[cfg(windows)] 模块。CLI/helper 在 Linux 也要能编译。rustup target add x86_64-pc-windows-msvc。cargo check --target 能验证 API 用法(lib 不需要 link.exe);bin 需要 link.exe,WSL 里没有 → 靠 CI 的 windows-latest 验证链接。clippy 交叉跑不需要 linker。Win32_System_Com + Win32_System_Variant + Win32_System_Ole;WINTRUST_DATA 需要 Win32_Security_Cryptography(不是 WinTrust!);ShellExecute 需要 Win32_UI_Shell + Win32_UI_WindowsAndMessaging;CloseHandle 在 Foundation。Connect 要 &VARIANT×4、GetFolder 要 &BSTR、集合用 Count() + get_Item(&VARIANT) 不是迭代器、IActionCollection::Count 是 (&mut i32) 指针形式、IExecAction::Path(&mut BSTR) 是 out-param。CLSID_CTaskScheduler,不是 TaskSchedulerClass。pwvtdata 是 *mut c_void(.cast())、action 是 *mut GUID、HWND 从 INVALID_HANDLE_VALUE.0 as *mut _ 转。// 错 — 解引用 null union 指针再赋值 → STATUS_STACK_BUFFER_OVERRUN
unsafe { *data.Anonymous.pFile = file_info; }
// 对 — 把地址赋给 union 成员;file_info 必须 mut
data.Anonymous.pFile = &mut file_info;
let Ok(x) = (unsafe { ... }) else { ... } — let-else 配 unsafe block 必须加括号。ShellExecuteW 是 6 参数函数形式(返回 HINSTANCE,hinst.0 as isize <= 32 = 错误),不是 SHELLEXECUTEINFOW 结构体版本。test-linux: ubuntu → cargo test(纯逻辑,快速反馈)
test-windows: windows-latest → cargo test + cargo clippy -D warnings
#![cfg(windows)],跑真实枚举/签名,断言"不 panic + 结构合理"而非具体数量(CI 空机可能 0 项)。-D warnings 只在 Windows job 跑——Linux 上 cfg(not(windows)) 分支的 dead-code 警告无害,别为它加 allow。让"任何 AI agent 能调用"的通用底座是稳定的 CLI,不是 skill 也不是 MCP:
枚举所有自动启动(StartType=Automatic)的 Windows 服务:
// 需要 feature: "Win32_System_Services"
use windows::Win32::System::Services::{
OpenSCManagerW, EnumServicesStatusW, OpenServiceW, QueryServiceConfigW,
CloseServiceHandle, SC_MANAGER_ENUMERATE_SERVICE, SERVICE_AUTO_START,
SERVICE_STATE_ALL, SERVICE_WIN32,
};
// 1. OpenSCManagerW(None, None, SC_MANAGER_ENUMERATE_SERVICE) — 值传递 SC_HANDLE,不加 &
// 2. 第一次 EnumServicesStatusW(None, 0, &mut bytes_needed, &mut count, None) 取 buf size
// 3. 第二次带 buf 取 ENUM_SERVICE_STATUSW 数组
// 4. 每个条目 OpenServiceW + QueryServiceConfigW 两次调用取配置块,检查 dwStartType == SERVICE_AUTO_START
// 5. EnumServicesStatusW 8 参数(比 MSDN 多 dwServiceType);SC_HANDLE 传值不传引用
// 6. SERVICE_WIN32 = ENUM_SERVICE_TYPE(48);SERVICE_STATE_ALL = ENUM_SERVICE_STATE(3)
详见 references/scmanager-services-enum.rs。
需要"提权执行 + 用户确认"时,用独立 helper 进程(ShellExecuteW runas 拉起)+ 原生 MessageBox: