hook什么的已经失效了,而且将winlogon.exe挂起的方法有问题(挂起中按下ctrl+alt+del,再恢复时弹出了界面),请问还有别的方法没?不要汇编的,只要vc的
5条回答 默认 最新
- jok_219 2015-10-23 00:57关注
win7下,登录页面是无法通过hook屏蔽的,因为系统登录页面会优先获取到组合键。我之前用过一个方法可以屏蔽ALT+CTRL+DEL,就是注入方式锁定登录页面管理进程**winlogon**,但是如果按了组合键只是暂时不触发,锁定解除后,还会继续触发。在某些情况下,还会造成卡登陆页面。所以我建议你通过注入方式锁定explorer进程,会好一点。进程锁定代码如下
public static class ProcessFrozenController { private const int THREADACCESS_SUSPEND_RESUME = 0x0002; [DllImport("kernel32.dll", SetLastError = true)] private static extern IntPtr OpenThread(uint dwDesiredAccess, bool bInheritHandle, uint threadId); [DllImport("kernel32.dll", SetLastError = true)] private static extern int SuspendThread(IntPtr hThread); [DllImport("kernel32.dll", SetLastError = true)] private static extern int ResumeThread(IntPtr hThread); [DllImport("kernel32.dll")] private static extern uint GetLastError(); [DllImport("kernel32.dll", CharSet = CharSet.Auto)] private static extern bool CloseHandle(IntPtr hobject); public static bool FreezeProcess(string processName, ref string msg) { Process[] processArray = Process.GetProcesses(); Process operateProcess = null; foreach (Process p in processArray) { if (p.ProcessName.ToLower().Trim() != processName) continue; operateProcess = p; break; } if (operateProcess == null) { msg = "未找到进程"; return false; } List<ProcessThread> handledList = new List<ProcessThread>(); foreach (ProcessThread pthd in operateProcess.Threads) { if (SuspendProcessThread(pthd)) { handledList.Add(pthd); continue; } foreach (ProcessThread hpthd in handledList) { ResumeProcessThread(hpthd); } msg = "冻结进程失败"; return false; } operateProcess.Dispose(); return true; } public static void UnfreezeProcess(string processName) { Process[] processArray = Process.GetProcesses(); Process operateProcess = null; foreach (Process p in processArray) { if (p.ProcessName.ToLower().Trim() != processName) continue; operateProcess = p; break; } if (operateProcess == null) { return; } foreach (ProcessThread thd in operateProcess.Threads) { ResumeProcessThread(thd); } operateProcess.Dispose(); } #region 私有函数 private static bool SuspendProcessThread(ProcessThread thread) { IntPtr threadHandle = OpenThread(THREADACCESS_SUSPEND_RESUME, false, (uint)thread.Id); // Open thread with required permissions if (threadHandle == IntPtr.Zero) // If thread pointer is zero, means that the 'OpenThread' function has failed { return false; } if (SuspendThread(threadHandle) == -1) // If the result is -1, the funtion has failed { CloseHandle(threadHandle); return false; } CloseHandle(threadHandle); return true; } private static bool ResumeProcessThread(ProcessThread thread) { IntPtr threadHandle = OpenThread(THREADACCESS_SUSPEND_RESUME, false, (uint)thread.Id); // Open thread with required permissions if (threadHandle == IntPtr.Zero) // If thread pointer is zero, means that the 'OpenThread' function has failed { return false; } if (ResumeThread(threadHandle) == -1) // If the result is -1, the funtion has failed { CloseHandle(threadHandle); return false; } CloseHandle(threadHandle); // Don't forget close thread handle return true; } #endregion }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
- ¥88 找成都本地经验丰富懂小程序开发的技术大咖
- ¥15 如何处理复杂数据表格的除法运算
- ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
- ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
- ¥200 uniapp长期运行卡死问题解决
- ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
- ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
- ¥15 乘性高斯噪声在深度学习网络中的应用
- ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决