Posted on 2009-11-16 22:45
S.l.e!ep.¢% 阅读(156)
评论(0) 编辑 收藏 引用 所属分类:
RootKit
接着
About ShutDown of Windows(一)在网上看到很多挂接 ExitWindowsEx 的方法,主要还是 SetHook,于是复习下全局钩子的东东
Create了一个 HookTest 的 Project
LRESULT CALLBACK MyKeyHook(int code, WPARAM wParam, LPARAM lParam)
{
return 1;
}
BOOL CHookTestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About" menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
#ifndef WH_KEYBOARD_LL
#define WH_KEYBOARD_LL 13
#endif
SetWindowsHookEx(WH_KEYBOARD_LL, MyKeyHook, AfxGetApp()->m_hInstance, 0);
return TRUE; // return TRUE unless you set the focus to a control
} 网上的资料说,需要把 SetWindowsHookEx 的部份写入一个DLL,否则不起作用
实际尝试了一下,上述的代码可以屏蔽键盘,但对于 Ctrl + Atl +Del 键是不起作用的