Files
MemRelay/projects/ea207d36-693c-4349-b3c8-7c40c8c889f5/WinUnLock 架构与关键参数(非秘密).md

28 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: WinUnLock 架构与关键参数(非秘密)
type: decision
permalink: main/projects/ea207d36-693c-4349-b3c8-7c40c8c889f5/win-un-lock-架构与关键参数非秘密
stable_id: d821d390-15d1-484a-98e1-6d9656f69bfe
scope: project
project_id: ea207d36-693c-4349-b3c8-7c40c8c889f5
memory_type: decision
status: active
revision: 1
restored_from_commit: 6a6a895eafcca6052e81a14fca103a42635dd1c2
created_at: '2026-09-23T15:12:01.484556+00:00'
updated_at: '2026-09-23T15:12:01.484686+00:00'
---
Rust workspace,crate 划分:common(管道协议/配置/DPAPI封装) + provider(cdylib,Credential Provider COM DLL) + client(bin,定时解锁客户端) + setup(bin,交互式设置账户名/密码并DPAPI加密)。另含 install/uninstall PowerShell 脚本与 README(中文)。
关键参数(本项目专属,非秘密):
- CLSID = {E9C67B30-B120-4838-A5A3-FBC2DE03C532}(新生成,避免与示例冲突)。
- 命名管道 = \\.\pipe\WinUnLock。
- 数据目录 = %PROGRAMDATA%\WinUnLock\(config.toml;cred.bin 为 DPAPI 加密凭据;logs\provider.log、logs\client.log)。
- 已验证可编译依赖组合:edition 2024,windows 0.62.2,windows-core 0.62.2。DPAPI 用 windows Win32_Security_Cryptography 的 CryptProtectData/CryptUnprotectData。
管道协议 v1(小端,provider 为服务端):magic u32=0x554E4C4B('UNLK') | version u32=1 | user_len u32 | user(UTF-16LE) | pass_len u32 | pass(UTF-16LE) | domain_len u32 | domain(UTF-16LE)。带长度上限保护,读毕 zeroize。
数据流:每日计划任务(SYSTEM,RunLevel Highest) -> client.exe 读 cred.bin(DPAPI LocalMachine 解密) -> 连管道发凭据(带重试) -> provider 管道线程收到 -> CredentialsChanged 通知 LogonUI -> GetSerialization(CredPack 序列化) -> LSA 验证 -> 解锁恢复原桌面。
环境事实:MSVC link.exe/dumpbin 在 C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\(不在 PATH,但 rustc MSVC 后端能自动定位)。故障恢复:CP 装错可能锁死登录,需进 WinRE/安全模式删注册表 CLSID 项恢复——README 必须写明。