From bfdbb837089909912b8cacf27baed1bc20db6abe Mon Sep 17 00:00:00 2001 From: tdx Date: Mon, 9 Feb 2026 01:56:27 +0000 Subject: [PATCH] SVN r1118 SVN-Revision: r1118 --- 其他程序/Lskj.GetSecretKey/FrmPsdChange.cs | 25 +- .../Lskj.GetSecretKey/LoginFrm.Designer.cs | 98 ++++ 其他程序/Lskj.GetSecretKey/LoginFrm.cs | 432 ++++++++++++++++++ 其他程序/Lskj.GetSecretKey/LoginFrm.resx | 120 +++++ .../Lskj.GetSecretKey.csproj | 33 +- 其他程序/Lskj.GetSecretKey/Program.cs | Bin 686 -> 753 bytes 其他程序/Lskj.GetSecretKey/logo.ico | Bin 0 -> 67646 bytes 其他程序/Lskj.GetSecretKey/winApi.cs | 370 +++++++++++++++ 8 files changed, 1047 insertions(+), 31 deletions(-) create mode 100644 其他程序/Lskj.GetSecretKey/LoginFrm.Designer.cs create mode 100644 其他程序/Lskj.GetSecretKey/LoginFrm.cs create mode 100644 其他程序/Lskj.GetSecretKey/LoginFrm.resx create mode 100644 其他程序/Lskj.GetSecretKey/logo.ico create mode 100644 其他程序/Lskj.GetSecretKey/winApi.cs diff --git a/其他程序/Lskj.GetSecretKey/FrmPsdChange.cs b/其他程序/Lskj.GetSecretKey/FrmPsdChange.cs index d186906..cf82dbc 100644 --- a/其他程序/Lskj.GetSecretKey/FrmPsdChange.cs +++ b/其他程序/Lskj.GetSecretKey/FrmPsdChange.cs @@ -74,27 +74,4 @@ namespace Lskj.GetSecretKey { SqlHelper.ExecuteNonQuery(sqlNameStr); this.oldUserName = this.userName; - } - string sqlPsdStr = "ALTER LOGIN {0} WITH PASSWORD = '{1}'"; - sqlPsdStr = string.Format(sqlPsdStr, userName, passWord); - string nConnection = "Server={0};Database={1};Persist Security Info=True;User ID=" + userName + ";Password=" + oldPassWord + ";Connection Timeout=5;MultipleActiveResultSets=true"; - nConnection = AESUtil.Encrypt(nConnection); - SqlHelper._connection = null; - if (DBConfig.Instance.CreateConnection(nConnection)) - { - SqlHelper.ExecuteNonQuery(sqlPsdStr); - this.oldPassWord = passWord; - } - } - catch (Exception ex) - { - MessageUtil.Show(ex.Message); - return; - } - this.DialogResult = DialogResult.OK; - this.Close(); - - } - } - } -} + \ No newline at end of file diff --git a/其他程序/Lskj.GetSecretKey/LoginFrm.Designer.cs b/其他程序/Lskj.GetSecretKey/LoginFrm.Designer.cs new file mode 100644 index 0000000..7720b4b --- /dev/null +++ b/其他程序/Lskj.GetSecretKey/LoginFrm.Designer.cs @@ -0,0 +1,98 @@ + +namespace Lskj.GetSecretKey +{ + partial class LoginFrm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.userNameEdit = new DevExpress.XtraEditors.TextEdit(); + this.labelControl2 = new DevExpress.XtraEditors.LabelControl(); + this.passWordEidt = new DevExpress.XtraEditors.TextEdit(); + this.labelControl1 = new DevExpress.XtraEditors.LabelControl(); + this.setPanel = new System.Windows.Forms.Panel(); + ((System.ComponentModel.ISupportInitialize)(this.userNameEdit.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.passWordEidt.Properties)).BeginInit(); + this.SuspendLayout(); + // + // userNameEdit + // + this.userNameEdit.AllowDrop = true; + this.userNameEdit.Location = new System.Drawing.Point(85, 24); + this.userNameEdit.Margin = new System.Windows.Forms.Padding(2); + this.userNameEdit.Name = "userNameEdit"; + this.userNameEdit.Properties.Appearance.Font = new System.Drawing.Font("宋体", 12F); + this.userNameEdit.Properties.Appearance.Options.UseFont = true; + this.userNameEdit.Size = new System.Drawing.Size(155, 22); + this.userNameEdit.TabIndex = 7; + // + // labelControl2 + // + this.labelControl2.Appearance.Font = new System.Drawing.Font("宋体", 12F); + this.labelControl2.Location = new System.Drawing.Point(39, 27); + this.labelControl2.Margin = new System.Windows.Forms.Padding(2); + this.labelControl2.Name = "labelControl2"; + this.labelControl2.Size = new System.Drawing.Size(48, 16); + this.labelControl2.TabIndex = 6; + this.labelControl2.Text = "账号:"; + // + // passWordEidt + // + this.passWordEidt.Location = new System.Drawing.Point(86, 64); + this.passWordEidt.Margin = new System.Windows.Forms.Padding(2); + this.passWordEidt.Name = "passWordEidt"; + this.passWordEidt.Properties.Appearance.Font = new System.Drawing.Font("宋体", 12F); + this.passWordEidt.Properties.Appearance.Options.UseFont = true; + this.passWordEidt.Size = new System.Drawing.Size(155, 22); + this.passWordEidt.TabIndex = 5; + // + // labelControl1 + // + this.labelControl1.Appearance.Font = new System.Drawing.Font("宋体", 12F); + this.labelControl1.Location = new System.Drawing.Point(39, 66); + this.labelControl1.Margin = new System.Windows.Forms.Padding(2); + this.labelControl1.Name = "labelControl1"; + this.labelControl1.Size = new System.Drawing.Size(48, 16); + this.labelControl1.TabIndex = 4; + this.labelControl1.Text = "密码:"; + // + // setPanel + // + this.setPanel.BackgroundImage = global::Lskj.GetSecretKey.Properties.Resources.修改密码; + this.setPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.setPanel.Location = new System.Drawing.Point(261, 47); + this.setPanel.Name = "setPanel"; + this.setPanel.Size = new System.Drawing.Size(32, 32); + this.setPanel.TabIndex = 25; + // + // LoginFrm + // + this.Appearance.BackColor = System.Drawing.SystemColors.Control; + this.Appearance.Options.UseBackColor = true; + this.Appearance.Options.UseFont = true; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + \ No newline at end of file diff --git a/其他程序/Lskj.GetSecretKey/LoginFrm.cs b/其他程序/Lskj.GetSecretKey/LoginFrm.cs new file mode 100644 index 0000000..09ff1a4 --- /dev/null +++ b/其他程序/Lskj.GetSecretKey/LoginFrm.cs @@ -0,0 +1,432 @@ +using Lskj.Control; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Security.Cryptography; +using System.Security.Principal; +using System.Text; +using System.Windows.Forms; + +namespace Lskj.GetSecretKey +{ + public partial class LoginFrm : BaseForm + { + private ContextMenuStrip _ctx; + + public LoginFrm() + { + InitializeComponent(); + SecureUserStore.EnsureInitialized(); // 初始化本地存储(含默认账号) + InitUi(); + WireEvents(); + } + + #region UI & 事件 + private void InitUi() + { + // 密码框设置为 * 掩码(兼容 TextBox / DevExpress TextEdit) + SetPasswordMask(passWordEidt); + + // 回填上次成功登录账号 + var last = SecureUserStore.GetLastUser(); + if (!string.IsNullOrEmpty(last)) { userNameEdit.Text = last; passWordEidt.Focus(); } + else userNameEdit.Focus(); + + // 提示 + try + { + setPanel.Cursor = Cursors.Hand; + var tip = new ToolTip(); + tip.SetToolTip(setPanel, "左键:修改密码(需当前密码验证)\r\n右键:更多操作(重置密码…)"); + } + catch { /* ignore */ } + + // 右键菜单 + _ctx = new ContextMenuStrip(); + var miChange = new ToolStripMenuItem("修改密码…", null, (s, e) => DoChangePassword()); + var miReset = new ToolStripMenuItem("重置密码…", null, (s, e) => DoResetPassword()); + _ctx.Items.AddRange(new ToolStripItem[] { miChange, new ToolStripSeparator(), miReset }); + setPanel.ContextMenuStrip = _ctx; + } + + private void WireEvents() + { + // 回车登录 + passWordEidt.KeyDown += (s, e) => { if (e.KeyCode == Keys.Enter) TryLogin(); }; + + // 左键点击 setPanel -> 修改密码(需当前密码验证通过) + setPanel.Click += (s, e) => { + if (e is MouseEventArgs me && me.Button == MouseButtons.Right) return; + DoChangePassword(); + }; + + // 右键已经由 ContextMenuStrip 处理 + } + #endregion + + #region 登录/改密/重置 + private void TryLogin() + { + string user = (userNameEdit.Text ?? "").Trim(); + string pwd = passWordEidt.Text ?? ""; + + if (string.IsNullOrEmpty(user) || string.IsNullOrEmpty(pwd)) + { + MessageBox.Show("请输入账号和密码。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + if (SecureUserStore.Validate(user, pwd)) + { + SecureUserStore.SetLastUser(user); // 记住本次成功登录账号 + this.DialogResult = DialogResult.OK; + this.Close(); + } + else + { + MessageBox.Show("账号或密码错误。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + passWordEidt.SelectAll(); + passWordEidt.Focus(); + } + } + + private void DoChangePassword() + { + string user = (userNameEdit.Text ?? "").Trim(); + string currPwd = passWordEidt.Text ?? ""; + + if (string.IsNullOrEmpty(user)) + { + MessageBox.Show("请先在账号框输入要修改密码的账号(例如:管理员、管理员1)。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + userNameEdit.Focus(); + return; + } + if (!SecureUserStore.Exists(user)) + { + MessageBox.Show("账号不存在,仅支持:管理员、管理员1。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + userNameEdit.Focus(); userNameEdit.SelectAll(); + return; + } + // 必须先通过“账号+当前密码”验证 + if (!SecureUserStore.Validate(user, currPwd)) + { + MessageBox.Show("请先在密码框输入该账号的当前密码并验证通过,然后再修改。", "需要验证", MessageBoxButtons.OK, MessageBoxIcon.Warning); + passWordEidt.Focus(); passWordEidt.SelectAll(); + return; + } + + using (var dlg = new ChangePasswordDialog(user)) + { + if (dlg.ShowDialog(this) == DialogResult.OK) + { + SecureUserStore.SetPassword(user, dlg.NewPassword); + MessageBox.Show("密码已更新并安全保存到本地。", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } + + private void DoResetPassword() + { + // 仅管理员权限允许重置 + if (!SecurityUtil.IsAdministrator()) + { + MessageBox.Show("需要以【管理员身份运行】程序后才能重置密码。", "权限不足", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + using (var dlg = new ResetConfirmDialog()) + { + if (dlg.ShowDialog(this) != DialogResult.OK) return; + + // 校验重置口令(你可以修改 SecureReset.ResetSecret 自定义口令) + if (!SecureReset.VerifyResetCode(dlg.ResetCode)) + { + MessageBox.Show("重置口令不正确。", "校验失败", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + + string user = (userNameEdit.Text ?? "").Trim(); + + if (string.IsNullOrEmpty(user)) + { + // 未指定账号 -> 询问是否重置所有内置账号 + if (MessageBox.Show("未填写账号,是否重置所有内置账号为默认密码 123456?", + "重置确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + foreach (var u in SecureUserStore.BuiltinUsers) SecureUserStore.ResetToDefault(u); + MessageBox.Show("所有内置账号已重置为 123456。", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + else + { + if (!SecureUserStore.Exists(user)) + { + MessageBox.Show("账号不存在,无法重置。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + if (MessageBox.Show($"确定将「{user}」密码重置为 123456?", + "重置确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + SecureUserStore.ResetToDefault(user); + MessageBox.Show("已重置为 123456。", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } + #endregion + + #region 工具:为控件设置 * 掩码(兼容 TextBox / DevExpress TextEdit) + private static void SetPasswordMask(System.Windows.Forms.Control ctrl) + { + try + { + var t = ctrl.GetType(); + var propPwdChar = t.GetProperty("PasswordChar"); + if (propPwdChar != null && propPwdChar.CanWrite) propPwdChar.SetValue(ctrl, '*', null); + + var propUseSys = t.GetProperty("UseSystemPasswordChar"); + if (propUseSys != null && propUseSys.CanWrite) propUseSys.SetValue(ctrl, true, null); + + var propProperties = t.GetProperty("Properties"); + if (propProperties != null) + { + var propsObj = propProperties.GetValue(ctrl, null); + if (propsObj != null) + { + var px = propsObj.GetType(); + var p1 = px.GetProperty("PasswordChar"); if (p1 != null && p1.CanWrite) p1.SetValue(propsObj, '*', null); + var p2 = px.GetProperty("UseSystemPasswordChar"); if (p2 != null && p2.CanWrite) p2.SetValue(propsObj, true, null); + } + } + } + catch { /* ignore */ } + } + #endregion + } + + #region 安全工具 & 重置口令校验 + internal static class SecurityUtil + { + public static bool IsAdministrator() + { + try + { + using (var identity = WindowsIdentity.GetCurrent()) + { + var principal = new WindowsPrincipal(identity); + return principal.IsInRole(WindowsBuiltInRole.Administrator); + } + } + catch { return false; } + } + + public static string Sha256(string s) + { + using (var sha = SHA256.Create()) + { + var bytes = sha.ComputeHash(Encoding.UTF8.GetBytes(s ?? "")); + var sb = new StringBuilder(bytes.Length * 2); + foreach (var b in bytes) sb.Append(b.ToString("x2")); + return sb.ToString(); + } + } + } + + internal static class SecureReset + { + // ★ 重置口令(明文)。建议你改成自己的:仅内部人员知悉。 + private const string ResetSecret = "Lskj#Reset2025"; + private static readonly string ResetHash = SecurityUtil.Sha256(ResetSecret); + + public static bool VerifyResetCode(string input) + => string.Equals(SecurityUtil.Sha256(input ?? ""), ResetHash, StringComparison.OrdinalIgnoreCase); + } + #endregion + + #region 本地安全存储(DPAPI 加密 + 记住上次账号) + internal static class SecureUserStore + { + // %LOCALAPPDATA%\Lskj.GetSecretKey\ + private static readonly string AppDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Lskj.GetSecretKey"); + private static readonly string StorePath = Path.Combine(AppDir, "users.sec"); // 用户: 密文 + private static readonly string LastUserPath = Path.Combine(AppDir, "lastuser.dat"); // 纯文本:上一次成功登录账号 + private static readonly byte[] Entropy = Encoding.UTF8.GetBytes("Lskj.GetSecretKey|DPAPI|v1"); + internal static readonly string[] BuiltinUsers = new[] { "管理员", "管理员1" }; // 供外部枚举使用 + private const string DefaultPassword = "123456"; + + // 缓存:用户名 -> Base64(Protect(UTF8(pwd))) + private static readonly Dictionary _cipherMap = new Dictionary(StringComparer.Ordinal); + private static bool _initialized; + private static readonly object _lock = new object(); + + public static void EnsureInitialized() + { + if (_initialized) return; + lock (_lock) + { + if (_initialized) return; + Directory.CreateDirectory(AppDir); + + if (!File.Exists(StorePath)) + { + foreach (var u in BuiltinUsers) _cipherMap[u] = ProtectToBase64(DefaultPassword); + Persist(); + } + else + { + Load(); + bool changed = false; + foreach (var u in BuiltinUsers) + if (!_cipherMap.ContainsKey(u)) { _cipherMap[u] = ProtectToBase64(DefaultPassword); changed = true; } + if (changed) Persist(); + } + _initialized = true; + } + } + + public static bool Exists(string user) { EnsureInitialized(); return _cipherMap.ContainsKey(user); } + + public static bool Validate(string user, string plainPwd) + { + EnsureInitialized(); + if (!_cipherMap.TryGetValue(user, out var b64)) return false; + try { return UnprotectFromBase64(b64) == (plainPwd ?? ""); } + catch { return false; } + } + + public static void SetPassword(string user, string newPwd) + { + EnsureInitialized(); + if (string.IsNullOrEmpty(user)) return; + _cipherMap[user] = ProtectToBase64(newPwd ?? ""); + Persist(); + } + + public static void ResetToDefault(string user) + { + EnsureInitialized(); + if (string.IsNullOrEmpty(user)) return; + _cipherMap[user] = ProtectToBase64(DefaultPassword); + Persist(); + } + + public static void SetLastUser(string user) + { + try { File.WriteAllText(LastUserPath, user ?? "", Encoding.UTF8); } + catch { /* ignore */ } + } + + public static string GetLastUser() + { + try { return File.Exists(LastUserPath) ? (File.ReadAllText(LastUserPath, Encoding.UTF8).Trim()) : ""; } + catch { return ""; } + } + + private static void Load() + { + _cipherMap.Clear(); + foreach (var line in File.ReadAllLines(StorePath, Encoding.UTF8)) + { + if (string.IsNullOrWhiteSpace(line)) continue; + var idx = line.IndexOf('='); + if (idx <= 0) continue; + var key = line.Substring(0, idx); + var val = line.Substring(idx + 1); + if (!_cipherMap.ContainsKey(key)) _cipherMap[key] = val; + } + } + + private static void Persist() + { + var sb = new StringBuilder(); + foreach (var kv in _cipherMap) sb.Append(kv.Key).Append('=').Append(kv.Value).Append('\n'); + File.WriteAllText(StorePath, sb.ToString(), Encoding.UTF8); + } + + private static string ProtectToBase64(string plain) + { + var bytes = Encoding.UTF8.GetBytes(plain ?? ""); + var cipher = ProtectedData.Protect(bytes, Entropy, DataProtectionScope.CurrentUser); + return Convert.ToBase64String(cipher); + } + + private static string UnprotectFromBase64(string base64) + { + var cipher = Convert.FromBase64String(base64 ?? ""); + var plain = ProtectedData.Unprotect(cipher, Entropy, DataProtectionScope.CurrentUser); + return Encoding.UTF8.GetString(plain); + } + } + #endregion + + #region 修改密码对话框 + internal sealed class ChangePasswordDialog : Form + { + private readonly string _user; + private TextBox txtNew, txtConfirm; + private Button btnOk, btnCancel; + public string NewPassword { get; private set; } + + public ChangePasswordDialog(string user) + { + _user = user; + BuildUi(); + } + + private void BuildUi() + { + this.Text = $"修改密码 - {_user}"; + this.FormBorderStyle = FormBorderStyle.FixedDialog; + this.StartPosition = FormStartPosition.CenterParent; + this.ClientSize = new Size(340, 170); + this.MaximizeBox = false; this.MinimizeBox = false; + + var lbl1 = new Label { Text = "新密码:", AutoSize = true, Location = new Point(20, 28) }; + var lbl2 = new Label { Text = "确认新密码:", AutoSize = true, Location = new Point(20, 68) }; + + txtNew = new TextBox { Location = new Point(130, 24), Width = 180, UseSystemPasswordChar = true, PasswordChar = '*' }; + txtConfirm = new TextBox { Location = new Point(130, 64), Width = 180, UseSystemPasswordChar = true, PasswordChar = '*' }; + + btnOk = new Button { Text = "确定", DialogResult = DialogResult.OK, Location = new Point(130, 110), Width = 80 }; + btnCancel = new Button { Text = "取消", DialogResult = DialogResult.Cancel, Location = new Point(230, 110), Width = 80 }; + + btnOk.Click += (s, e) => + { + if (string.IsNullOrEmpty(txtNew.Text)) + { + MessageBox.Show("新密码不能为空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + this.DialogResult = DialogResult.None; return; + } + if (txtNew.Text != txtConfirm.Text) + { + MessageBox.Show("两次输入的密码不一致。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + this.DialogResult = DialogResult.None; return; + } + NewPassword = txtNew.Text; + }; + + this.Controls.AddRange(new System.Windows.Forms.Control[] { lbl1, txtNew, lbl2, txtConfirm, btnOk, btnCancel }); + this.AcceptButton = btnOk; this.CancelButton = btnCancel; + } + } + #endregion + + #region 重置口令对话框 + internal sealed class ResetConfirmDialog : Form + { + private TextBox txtCode; + private Button btnOk, btnCancel; + public string ResetCode { get; private set; } + + public ResetConfirmDialog() { BuildUi(); } + + private void BuildUi() + { + this.Text = "输入重置口令"; + this.FormBorderStyle = FormBorderStyle.FixedDialog; + this.StartPosition = FormStartPosition.CenterParent; + this.ClientSize = new Size(360, 150); + this.MaximizeBox = false; this.MinimizeBox = false; + + var lbl = new Label { Text = "重置口令:", AutoSize = true, Location = new Point(20, 30) \ No newline at end of file diff --git a/其他程序/Lskj.GetSecretKey/LoginFrm.resx b/其他程序/Lskj.GetSecretKey/LoginFrm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/其他程序/Lskj.GetSecretKey/LoginFrm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/其他程序/Lskj.GetSecretKey/Lskj.GetSecretKey.csproj b/其他程序/Lskj.GetSecretKey/Lskj.GetSecretKey.csproj index ff07deb..e66f1c6 100644 --- a/其他程序/Lskj.GetSecretKey/Lskj.GetSecretKey.csproj +++ b/其他程序/Lskj.GetSecretKey/Lskj.GetSecretKey.csproj @@ -35,22 +35,27 @@ prompt 4 + + logo.ico + - - ..\..\Debug\Lskj.Control.dll + + ..\..\..\..\下载\xwechat_files\wxid_9htys9sllfcy22_4c66\msg\file\2025-09\Lskj.Business.dll - - False - ..\..\Debug\Lskj.Core.dll + + ..\..\..\..\下载\xwechat_files\wxid_9htys9sllfcy22_4c66\msg\file\2025-09\Lskj.Control.dll + + + ..\..\..\..\下载\xwechat_files\wxid_9htys9sllfcy22_4c66\msg\file\2025-09\Lskj.Core.dll - ..\..\Debug\Lskj.Data.dll + ..\..\..\..\下载\xwechat_files\wxid_9htys9sllfcy22_4c66\msg\file\2025-09\Lskj.Data.dll - ..\..\Debug\Lskj.Util.dll + ..\..\..\..\下载\xwechat_files\wxid_9htys9sllfcy22_4c66\msg\file\2025-09\Lskj.Util.dll packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll @@ -70,6 +75,7 @@ packages\Microsoft.Bcl.1.1.10\lib\net40\System.Runtime.dll + packages\Microsoft.Bcl.1.1.10\lib\net40\System.Threading.Tasks.dll @@ -95,14 +101,24 @@ FrmPsdChange.cs + + Form + + + LoginFrm.cs + + FrmMain.cs FrmPsdChange.cs + + LoginFrm.cs + ResXFileCodeGenerator @@ -129,6 +145,9 @@ + + + diff --git a/其他程序/Lskj.GetSecretKey/Program.cs b/其他程序/Lskj.GetSecretKey/Program.cs index 7e7e1fe5af44e8ebf50ff2e3fb6044b9024926b3..76ab1749380ef5dc711929298e5e9839be3edcc6 100644 GIT binary patch literal 753 zcmVcKTSZ9t@Q-|- zWzicCda^I%^$Hvcokc14VL4+{2KECNWf3qi_*7s4Pxik~E*wA3|MAZUc_% z5?xWXf}lQNyjupG!f27>oa3 z^hh9b`Os1o+eJf4veS>8scfZR*d*g(UVujtqFW%N-I(+%UM za9e)uAj~h^@u|qh%*gWYt@oU!cE@K&xW(#d&Zraa<3!%TW9RlMk7P1G90D7Rw)$m8 jz(Ln1W+%80>H;z)xHT3^y7(&p|NsC0|NsC0|NsC0iDG!N literal 686 zcmaJ;%WlFj5WMFrEKcEKJ^)k+@#vu-RU~Z>RS#~m1Q&aqdL1CD__7}QN&SU7p+HC< zzIkVMX0-G9{!x&`j723m(EXtK<0GRKBu*M6ehmm#CN0KH;%jU4ATc#t;!|Ta9kDTN zCcE4M5x*m_(OTkf*kALRG3z0wQvlTu0u&l37YVQ#tzUdH7eQjd-9Q<<1IV76 z)}Z%8>@kXm@ydcopH9^8WE&$>HuolB_XM4@RY`^oqX~*<1^1E)p(0l*ps?FN?X}qv zxRKGh&*+z8*trE@>bt{i3`|$|WOLUT diff --git a/其他程序/Lskj.GetSecretKey/logo.ico b/其他程序/Lskj.GetSecretKey/logo.ico new file mode 100644 index 0000000000000000000000000000000000000000..1ffcc3cb848f316f4fd601bf18cc1c03fceb3125 GIT binary patch literal 67646 zcmeI536vehb%uwqI*vu+I6!O%!!eGr>^LNGyl`yGHiS4{2#FIMa!xSBK#UU%AqEE% zgA4|YS%mhH#Arbptqj^1gv1C*2*fIZcCic=LI|M+38c|l`M+0F^Sb->_IlpD8R>P+ zxzn$^mcDiWTeogicURTb9i_kCz3cSc%RUQKQ7VS1|z!+yES@UU-Z`Ai(xXUuNp-M^>& zyj_>$!Z;leTRl>J!Gy zyvUdhb4$~6<-Lt6U*$a@TJkf0nm3mi!@U|s8=L)cq~$t1zOkqnw|$LxxXPG`n!+0X zApRyK(}w+8G18bR-&Nj^7*j9)8%{Rn!EYGzY#*gQ6qci7*IK2U zv=wwTjLL6EJ)(3#j53duE{xPv(9i0Oxl{CiB7Qr%M88K!F5a+J)0O=tubUNjhv*hj zZ_%x7zd3*I7H>Q18Yw>^&x_?qEQjekB?toc6r!a%Ma3dsq0LWc3r-pl2MX$x+5Ol`#C5-6PC@Q%vW6?cO5n ze$VO>vTT{@VvKo0HUoKcFZAiTdy8@W+R&`_r#4F6(2fS2(}erC zgtf|_cd5-!8yTX0bIGkb-)FCFc-Y#y$+A(&VYU~4B|kMeOCW{AAH94nL3I}Xr>zfo zJQCtwV(acv9A#nCXxlDC;Xm~&wq4K;u|L@HDeBW*h{E5+haCsE;SZm#&!Ep8EZYLM zwC_b%h2>NmSZs9z`#_tZzsnj{HQ2U=Oa^?=m~G4CTF3@9sm^o0XG?8;L$>dI;!SqT z1#Hmx&$zRsBs#3k`w{99&}MEfqx{(IXNk>ARpzNq$-2h@Mjw$S;lE7~uI zw*TFmtsSPnSbViHznx=s0olJNxe&_1|F!w*pJd;WA2!O1AGQlSN7)08wZ53WL+SsA z)TdDg_B~1iRZQV+|5MMk*RkQ)M{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;FR&+Y;TnfLF zXAe<<=Wo214-aATDqbre|D=7*-&hnrPQwns5B^{lVjLOfXHl0V{9C45nR#`xD1&Gj zksfSXW=2Wc81{Dy>N{np!GH8=R(I0*>XuK&8|?qbUZ7E7$2xoeQRT}SLc}e)Y z=d|VWLVBL>#oO!socaxAmesZPlKkWzG6X$z4oqTQ05M6J~lAqeL7GJGBa<8)QTRrw8)$IzsV}6mgcO)J9`1~F5HHFv0J0O96HVyteTQnB> znDytlR~$dYaUXoYu^P*?Zj0uNF-d`^5Lx+US6=^5UfR&elcMk4nK4iPJbbL327mb4 z^0ekhC7T!edA>!~x$hg~ws_KQc_z6w%>Q5~{Blj_|5N&*J$jF5jQElr3G(4PA7In0 znUKuW>~FP=Ndr0==}bIpB>irkx{krXU?~;-m`(P^z$y+@u%L5SFi((nv2@d-1&O2 z=$baaR`+h#L;YqxneXrqb?_adq#A5or0*ZTXWJOq$I02@&o@Gy8Fp?kX0iNY<`KX? zY<(oJto*;T<4-y00R0T}5%>g?HJ)8D%$T<|UOphdw$kD8{|U#Rc`5LJdzqb^;@#X# z^rkVpH`{L*z-?o*{dN((8?P}JV;{y<_7!{R!IzbhX-puXq<{yDzqh?DKJv!*ZEb(xyJ zpkr40qW$h{LVQ><>y(!{U=%;&_m=573O4PWYW%$Fe?3B8T@_as!!niAM7JCV|-KzVjixb zLr2m2v8{xyp~*k6(3U$gjw{TVs_HH-flbqd0NeXavFrvvN3 zo*?XR%ki%{{BN`97w|td$G_(AKh@#iW&>vDI#4q@Fx!iL8~#0W{A&jPoA;1#4ji#MaA6$wE>8G2UcTgYb;{7 + /// 表示 Hook 回调函数。 + /// + /// + /// + /// + /// + public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam); + /// + /// 表示进程间传递的数据结构 + /// + public struct COPYDATASTRUCT + { + public IntPtr dwData; + public int cbData; + [MarshalAs(UnmanagedType.LPStr)] + public string lpData; + } + + /// + /// 用于通过 API 获取位置信息的结构。 + /// + public struct Rect + { + public int Left; + public int Top; + public int Right; + public int Bottom; + } + + /// + /// 与非托管通信的鼠标位置结构。 + /// + [StructLayout(LayoutKind.Sequential)] + public struct POINT + { + public int X; + public int Y; + } + + /// + /// 鼠标事件标识。 + /// + public enum MouseEventFlags + { + Move = 0x0001, + LeftDown = 0x0002, + LeftUp = 0x0004, + RightDown = 0x0008, + RightUp = 0x0010, + MiddleDown = 0x0020, + MiddleUp = 0x0040, + Wheel = 0x0800, + Absolute = 0x8000 + } + } + public class FormatSystemDatetime + { + [DllImport("kernel32.dll", EntryPoint = "GetSystemDefaultLCID")] + public static extern int GetSystemDefaultLCID(); + [DllImport("kernel32.dll", EntryPoint = "SetLocaleInfoA")] + public static extern int SetLocaleInfo(int Locale, int LCType, string lpLCData); + [DllImport("user32.dll", EntryPoint = "SendMessageTimeout")] + public static extern long SendMessageTimeout(int hWnd, int Msg, int wParam, int lParam, int fuFlags, int uTimeout, ref int lpdwResult); + public const int LOCALE_SSHORTDATE = 0x1F; + public const int LOCALE_SLONGDATE = 0x20; + public const int LOCALE_STIME = 0x1003; + public const int HWND_BROADCAST = 0xFFFF; + public const int WM_SETTINGCHANGE = 0x001A; + public const int SMTO_ABORTIFHUNG = 2; + + public void SetDateTimeFormat() + { + try + { + int p = 0; + int x = GetSystemDefaultLCID(); + SetLocaleInfo(x, LOCALE_SSHORTDATE, "yyyy-M-d"); //短日期格式 + SetLocaleInfo(x, LOCALE_SLONGDATE, "yyyy年M月d日"); //长日期格式 + SetLocaleInfo(x, LOCALE_STIME, "H:mm:ss"); //时间格式 + SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0, SMTO_ABORTIFHUNG, 10, ref p); + } + catch (Exception ex) + { + Console.WriteLine(ex); + } + } + } + /// + /// DevExpress + /// + public class AboutDevCompanion + { + private int Interval; + private bool ResidentMode; + private bool StopCompanion; + private Thread m_Thread; + + /// + /// 按指定的模式创建 对象实例。 + /// 检测Dev注册弹框的时间间隔(以毫秒为单位)。 + /// 检测程序是否以常驻模式运行(默认值 true)。 + /// + public AboutDevCompanion(int interval, bool resident = true) + { + Interval = interval; + ResidentMode = resident; + StopCompanion = true; + } + + /// + /// 关闭 DevExpress 控件的注册弹框(如果调用时找到并关闭了DevExpress注册弹框则返回true,否则返回false)。 + /// + /// + private bool CloseAboutDev() + { + IntPtr devHwnd = WinAPI.FindWindow(null, "About DevExpress"); + if (devHwnd != IntPtr.Zero) + { + WinAPI.SendMessage(devHwnd, WinAPI.WM_CLOSE, 0, 0); + return true; + } + return false; + \ No newline at end of file