本文介绍了:: AfxMessageBox()函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图创建一个简单的Loader,所以我创建了一个新的 Win32 项目.一切正常,但是当我尝试添加
I am trying to create a simple Loader, so I created a new Win32 Project. All went right but when I tryed to add
::AfxMessageBox()
函数时,出现编译器错误.
这是我的代码:
StdAfx.h
Function I got compiler Error.
This is my code:
StdAfx.h
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
&
StdAfx.cpp
&
StdAfx.cpp
// stdafx.cpp : source file that includes just the standard includes
// EasyServerLoader.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
&
resource.h
&
resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by EasyServerLoader.rc
//
#define IDI_MAINICON 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
&主要的cpp文件是
EasyServerLoader.cpp
& the main cpp file is
EasyServerLoader.cpp
// EasyServerLoader.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
PROCESS_INFORMATION pInfo;
STARTUPINFO sInfo;
sInfo.cb = sizeof(STARTUPINFO);
sInfo.lpReserved = NULL;
sInfo.lpReserved2 = NULL;
sInfo.cbReserved2 = 0;
sInfo.lpDesktop = NULL;
sInfo.lpTitle = NULL;
sInfo.dwFlags = 0;
sInfo.dwX = 0;
sInfo.dwY = 0;
sInfo.dwFillAttribute = 0;
sInfo.wShowWindow = SW_SHOW;
try
{
::CreateProcess("EasyServer.exe",
NULL,
NULL,
NULL,
FALSE,
CREATE_SUSPENDED,
NULL,
NULL,
&sInfo,
&pInfo);
}
catch(...)
{
//::AfxMessageBox("Oops!, Something went wrong!");
return -1;
}
BYTE bToWrite[13] = {0x01,
0x01,
0x01,
0xB2,
0xFE,
0xB8,
0xFE,
0x68,
0xB8,
0x12,
0x48,
0x90,
0x90};
LPVOID lpBaseAddress[13] = {(void*)0x62DD74,
(void*)0x62E272,
(void*)0x62E31A,
(void*)0x62E389,
(void*)0x62E38A,
(void*)0x62E469,
(void*)0x62E46A,
(void*)0x644561,
(void*)0x644562,
(void*)0x644563,
(void*)0x644564,
(void*)0x644566,
(void*)0x644567};
DWORD dNumberOfBytesReadWritten;
BYTE bRead;
LPVOID lpLastAddress = (void*)0x6645FA;
try
{
do
{
::ResumeThread(pInfo.hThread);
::Sleep(1);
::SuspendThread(pInfo.hThread);
::ReadProcessMemory(pInfo.hProcess,
lpLastAddress,
&bRead,
1,
&dNumberOfBytesReadWritten);
}while (bRead != 0x72);
::ResumeThread(pInfo.hThread);
::Sleep(100);
::SuspendThread(pInfo.hThread);
}
catch(...)
{
//::AfxMessageBox("Oops!, Something went wrong!");
return -1;
}
try
{
for (int i=0; i<13; i++)
::WriteProcessMemory(pInfo.hProcess,
lpBaseAddress[i],
&bToWrite[i],
1,
&dNumberOfBytesReadWritten);
::ResumeThread(pInfo.hThread);
}
catch(...)
{
//::AfxMessageBox("Oops!, Something went wrong!");
return -1;
}
return 0;
}
请帮助我解决此问题.
&我还需要使用
Help me please to solve this issue.
& I need code block of getting "EasyServer.exe" file size using
GetFileSize()
函数获取"EasyServer.exe" 文件大小的代码块.
无论如何,谢谢;)
function also.
Thank you anyway ;)
推荐答案
MessageBox (NULL, "message", "title", MB_OK);
这篇关于:: AfxMessageBox()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!