CProtectXDlg::CProtectXDlg(CWnd* pParent /*=NULL*/)
: CDialog(CProtectXDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CProtectXDlg)
// 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 CProtectXDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CProtectXDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
// 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
typedef int (__stdcall *Func_RtlAdjustPrivilege)(int, bool, bool, int*);
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CProtectXDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
// Center icon in client rectangle
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;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HKEY hKey;
HCURSOR CProtectXDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CProtectXDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
HWND hWnd;
hWnd = ::FindWindow("heyohi",NULL);
if (hWnd==0)
{
return;
}
DWORD dwProcessID;
HANDLE hProcess;
HMODULE hMod;
int lApiSend;
DWORD CurByte=0;
GetWindowThreadProcessId(hWnd,&dwProcessID);
hProcess = OpenProcess(PROCESS_ALL_ACCESS,NULL,dwProcessID);
if (hProcess==0)
{
return;
}
hMod = LoadLibrary("ws2_32.dll");
lApiSend = (int)GetProcAddress(hMod,"send");
ReadProcessMemory(hProcess,(LPVOID)lApiSend,&CurByte,2,NULL);
if (CurByte!=0xFF8B)
{
if (::RegQueryValueEx(hKkey,"PackedCatalogItem",0,&dwType,NULL,&Lenit)==ERROR_SUCCESS)
{
BYTE *pbuf = new BYTE[Lenit];
::RegQueryValueEx(hKkey,"PackedCatalogItem",0,0,(BYTE*)pbuf,&Lenit);
if (strcmp("%SystemRoot%\\system32\\mswsock.dll",(char*)pbuf)!=0)
{
AfxMessageBox("4!");
return;
}