winmine 학습 노트
8007 단어 2021년 대학원생 학습 노트
// ( ), ( ), ( ), (error/warning/ok)
int MessageBox{
__in HWND hWnd,
__in LPSTSTR lpText,
__in LPCTSTR lpCaption,
__in UNIT uType
}
// ( ), , ,
LRESULT CALLBACK WindowProc{
__in HWND hwnd,
__in UINT uMsg,
__in WPARAM wParam,
__in LPARAM lParam
}
// ,WindowProc ,uMsg=WM_COMMAND,wParam ID( )
게임의 기본 주소
기본 주소 개념: 전역 변수, 문자 상수 등 주소, 매번 열기
MFC 조종 메뉴
/* VS ctrl+f1 VS , SendMessage FindWindow API
SendMessage :
LRESULT WINAPI SendMessage(
_In_ HWND hWnd,
_In_ UINT Msg,
_In_ WPARAM wParam,
_In_ LPARAM lParam
);
*/
// MFC 4 ,
void CwinmineDlg::OnBnClickedButton1(){
HWND hWnd = ::FindWindow(NULL, _T(" "));
if (NULL == hWnd) {
::MessageBox(NULL, _T(" "),_T(" "),MB_OK);
return ;
}
::SendMessage(hWnd, WM_COMMAND, 0x209, 0);
}
void CwinmineDlg::OnBnClickedButton2(){
HWND hWnd = ::FindWindow(NULL, _T(" "));
if (NULL == hWnd) {
::MessageBox(NULL, _T(" "),_T(" "), MB_OK);
return;
}
::SendMessage(hWnd, WM_COMMAND, 0x20A, 0);
}
void CwinmineDlg::OnBnClickedButton3(){
HWND hWnd = ::FindWindow(NULL, _T(" "));
if (NULL == hWnd) {
::MessageBox(NULL, _T(" "), _T(" "), MB_OK);
return;
}
::SendMessage(hWnd, WM_COMMAND, 0x20B, 0);
}
void CwinmineDlg::OnBnClickedButton4(){
for (int i = 0; i < 3; i++) {
OnBnClickedButton1();
Sleep(1000);
OnBnClickedButton2();
Sleep(1000);
OnBnClickedButton3();
Sleep(1000);
}
}
//
MFC 기본 주소 읽기
// , , , int, m_num_mine
// , , VS
void CwinmineDlg::OnBnClickedButton5(){
DWORD pid;
HWND hWnd = ::FindWindow(NULL, _T(" "));
if (NULL == hWnd) {
::MessageBox(NULL, _T(" "), _T(" "), MB_OK);
return;
}
GetWindowThreadProcessId(hWnd, &pid);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
if (NULL == hProcess) {
::MessageBox(NULL, _T(" "), _T(" "), MB_OK);
return;
}
ReadProcessMemory(hProcess, (LPCVOID)0x1005194, &m_num_mine, sizeof(m_num_mine), &pid);
UpdateData(FALSE);
}
CE 지뢰밭 정보 찾기
char a[24][32];//
Spy++ 메시지 찾기
편집 상자 만들기, 속성 비헤이비어 True 설정, 읽기 전용, 바인딩 변수 생성, 변수 이름 mstrshowdata, 범주value
창설 버튼, 설명 텍스트: 자동 지뢰 제거, 두 번 클릭 사실 현대 코드
BOOL PostMessage(
__in HWND hWnd,
__in UINT Msg,
__in WPARAM wParam,
__in LPARAM lParam,
)// ,SendMessage
void CwinmineDlg::OnBnClickedButton6(){
DWORD pid;
HWND hWnd = ::FindWindow(NULL, _T(" "));
if (NULL == hWnd) {
::MessageBox(NULL, _T(" "), _T(" "), MB_OK);
return;
}
GetWindowThreadProcessId(hWnd, &pid);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
if (NULL == hProcess) {
::MessageBox(NULL, _T(" "), _T(" "), MB_OK);
return;
}
/*
0x01005361 ,0x8F
0x01005338 , 16
0x01005334 , 16
*/
unsigned char gamedata[24][32] = { 0 };
if (!ReadProcessMemory(hProcess, (LPCVOID)0x01005361, &gamedata, 24 * 32, &pid)) {
::MessageBox(NULL, _T(" "), _T(" "), MB_OK);
return;
}
DWORD rows;
if (!ReadProcessMemory(hProcess, (LPCVOID)0x01005338, &rows, sizeof(rows), &pid)) {
::MessageBox(NULL, _T(" "), _T(" "), MB_OK);
return;
}
DWORD columns;
if (!ReadProcessMemory(hProcess, (LPCVOID)0x01005334, &columns, sizeof(columns), &pid)) {
::MessageBox(NULL, _T(" "), _T(" "), MB_OK);
return;
}
m_strshowdata.Empty();
CString strTemp = _T("");
short gamex = 20;
short gamey = 60;
unsigned short xypos[2] = { 0 };
for (int i = 0; i < rows; i++) {
for (int j = 0; j < 32; j++) {
if (0x10 == gamedata[i][j]) {
break;
}
xypos[0] = gamex + j * 16;
xypos[1] = gamey + i * 16;
if (0x8F != gamedata[i][j]) {
::PostMessage(hWnd, WM_LBUTTONDOWN, MK_LBUTTON, *(int*)xypos);
::PostMessage(hWnd, WM_LBUTTONUP, 0, *(int*)xypos);
}
strTemp.Format(_T("%02x "), gamedata[i][j]);
m_strshowdata += strTemp;
}
m_strshowdata += _T("\r
");
}
UpdateData(FALSE);
}
넓히다