?? hooklocaldlg.cpp
字號:
// HookLocalDlg.cpp : implementation file
//
#include "stdafx.h"
#include "HookLocal.h"
#include "HookLocalDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CHookLocalDlg dialog
CHookLocalDlg::CHookLocalDlg(CWnd* pParent /*=NULL*/)
: CDialog(CHookLocalDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CHookLocalDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CHookLocalDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CHookLocalDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CHookLocalDlg, CDialog)
//{{AFX_MSG_MAP(CHookLocalDlg)
ON_BN_CLICKED(IDC_OK, OnOk)
ON_BN_CLICKED(IDC_RADIO_IAT, OnRadioIat)
ON_BN_CLICKED(IDC_RADIO_JMP, OnRadioJmp)
ON_BN_CLICKED(IDC_RADIO_UNHOOK, OnRadioUnhook)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CHookLocalDlg message handlers
BOOL CHookLocalDlg::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
m_nLabel=0; // 0 for unhook, 1 for IAT, 2 for JMP
m_hLib = NULL;
ButtonCheck();
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CHookLocalDlg::ButtonCheck()
{
CButton *pBtnOff=(CButton*)GetDlgItem(IDC_RADIO_UNHOOK);
CButton *pBtnIAT=(CButton*)GetDlgItem(IDC_RADIO_IAT);
CButton *pBtnJMP=(CButton*)GetDlgItem(IDC_RADIO_JMP);
pBtnOff->SetCheck(m_nLabel==0);
pBtnIAT->SetCheck(m_nLabel==1);
pBtnJMP->SetCheck(m_nLabel==2);
}
void CHookLocalDlg::OnRadioIat()
{
// DLL文件全路徑名.
CString lpDllFullPathName;
char cCurDir[MAX_PATH];
GetCurrentDirectory(MAX_PATH,cCurDir);
lpDllFullPathName=CString(cCurDir)+TEXT("\\HookIAT.Dll");
// 裝載DLL文件.
if(m_hLib) FreeLibrary(m_hLib);
m_hLib=LoadLibrary(lpDllFullPathName);
m_nLabel=1;
ButtonCheck();
}
void CHookLocalDlg::OnRadioJmp()
{
// DLL文件全路徑名.
CString lpDllFullPathName;
char cCurDir[MAX_PATH];
GetCurrentDirectory(MAX_PATH,cCurDir);
lpDllFullPathName=CString(cCurDir)+TEXT("\\HookJMP.Dll");
// 裝載DLL文件.
if(m_hLib) FreeLibrary(m_hLib);
m_hLib=LoadLibrary(lpDllFullPathName);
m_nLabel=2;
ButtonCheck();
}
void CHookLocalDlg::OnRadioUnhook()
{
m_nLabel=0;
FreeLibrary(m_hLib);
m_hLib=NULL;
ButtonCheck();
}
void CHookLocalDlg::OnOk()
{
::MessageBoxA(0,"Hello!","Test",MB_OK);
// CDialog::OnOK();
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -