yangbo50304
yangbo50304
采纳率100%
2015-10-20 00:48 阅读 3.6k
已采纳

Win7下如何屏蔽ctrl+alt+del键?

10

hook什么的已经失效了,而且将winlogon.exe挂起的方法有问题(挂起中按下ctrl+alt+del,再恢复时弹出了界面),请问还有别的方法没?不要汇编的,只要vc的

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

5条回答 默认 最新

  • 已采纳
    jok_219 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
        }
    
    
    点赞 评论 复制链接分享
  • lzp_lrp WorldMobile 2015-10-20 00:59
    点赞 评论 复制链接分享
  • lzp_lrp WorldMobile 2015-10-20 01:12

    是进程冻结与解冻

    管用,Win7和XP系统下都可以屏蔽Ctrl+Alt+Del。但是在解冻winlogon.exe时,会自动弹出系统界面(就是手工按Ctrl+Alt+Del出来的那个界面)。

    你试试抓取一个弹出界面的handle,然后通过sendmessage把窗口隐藏

    点赞 评论 复制链接分享
  • qq744097731 qq744097731 2015-10-20 01:47

    们经过加工加工环节改价格

    点赞 评论 复制链接分享
  • wawd74520 失落的神庙 2015-10-20 01:47

    如果要禁用任务管理器
    http://jingyan.baidu.com/article/cbf0e500eafe592eaa2893c4.html

    如果实在是想禁止。
    可以hook按键 del 键。 接收到del按键 消息判断 ctrl和alt是否按下。 如果按下 那么发送 keybd_event 弹起。
    不知道可行不。

    点赞 评论 复制链接分享

相关推荐