Skip to content

Commit

Permalink
PatchMonitor update
Browse files Browse the repository at this point in the history
  • Loading branch information
MewX committed Mar 19, 2015
1 parent f2d47b3 commit e8bbd56
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
40 changes: 30 additions & 10 deletions PatchMonitor/PatchMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ int APIENTRY WinMain(_In_ HINSTANCE hInstance,

// need log
}


// read current showing text
memset( temp, 0, sizeof( temp ) );
b = ReadProcessMemory(
ph,
Expand Down Expand Up @@ -273,7 +274,7 @@ int APIENTRY WinMain(_In_ HINSTANCE hInstance,
SetActiveWindow(hWnd);
// set Font style

HANDLE hFont = CreateFont(20, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, UNICODE,
HANDLE hFont = CreateFontW(20, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, UNICODE,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, L"MS PGothic");
SendMessageW(GetDlgItem(hTextDlg, IDC_STATICTEXT), WM_SETFONT, WPARAM(hFont), TRUE);
// GetDlgItem( hDlg, IDC_DLG_LOGIN_EDIT_USERNAME )
Expand Down Expand Up @@ -316,10 +317,25 @@ int APIENTRY WinMain(_In_ HINSTANCE hInstance,
while (GetAsyncKeyState('1') < 0)
Sleep(50);

// get latest index position
unsigned long latestIndex = 0;
memset(temp, 0, sizeof(temp));
b = ReadProcessMemory(
ph,
(void*)0x6DB530, // latest index address
temp,
256,
NULL);
if (b)
latestIndex = *(unsigned long *)temp; // get it
else
latestIndex = 512; // found value is 256, but it can be a little larger

// load all history texts
wstring result;
wstring result, resultBeg, resultEnd;
const unsigned long posdelta = 0x1290;
unsigned long pos = 0x6DC6D0;
unsigned int index = 0;
while (1) {
memset(temp, 0, sizeof(temp));
b = ReadProcessMemory(
Expand All @@ -344,14 +360,18 @@ int APIENTRY WinMain(_In_ HINSTANCE hInstance,

const char *fetchResult = 0;
int r = tf.find(temp, &fetchResult);
result += r == FDR_W_NXL ? NotFound + StringToWstring(936, temp) : StringToWstring(932, fetchResult) + L"\r\n\r\n";
if (index++ < latestIndex)
resultBeg += r == FDR_W_NXL ? NotFound + StringToWstring(936, temp) : StringToWstring(932, fetchResult) + L"\r\n\r\n";
else
resultEnd += r == FDR_W_NXL ? NotFound + StringToWstring(936, temp) : StringToWstring(932, fetchResult) + L"\r\n\r\n";

#ifdef LOG_ON
log << "History Request:" << lpBuffer << endl;
log << "History Request:" << temp << endl;
#endif
}
else break;
}
result = resultEnd + resultBeg;

// set text
SetWindowTextW(GetDlgItem(hHistoryDlg, IDC_EDITHISTORY), result.c_str());
Expand Down Expand Up @@ -425,7 +445,9 @@ int APIENTRY WinMain(_In_ HINSTANCE hInstance,
}

// GC
#ifdef LOG_ON
log.close();
#endif
delete[] buff;
}
else { // Work as uninstaller
Expand All @@ -438,15 +460,13 @@ int APIENTRY WinMain(_In_ HINSTANCE hInstance,
WinExec( "cmd /c del Chip_S.chs", SW_HIDE );
WinExec( "cmd /c del Chip_T.chs", SW_HIDE );
WinExec( "cmd /c del RegFile.chs", SW_HIDE );
WinExec( "cmd /c del CROSSCHANNEL_alpha20150308.exe", SW_HIDE );
WinExec( "cmd /c del CROSSCHANNEL_v0.99.exe", SW_HIDE );
#endif

MessageBoxW( NULL, L"卸载完毕,很干净的哦!~ 我们会想你的~~\r\n再来光顾一下http://crosschannel.cn吧~~", L"卸载完毕", MB_OK );
MessageBoxW( NULL, L"卸载完毕,很干净的哦!~ 我们会想你的~~\r\n再来光顾一下http://crosschannel.cn吧~~\r\n哦对了,如果这个卸载程序没有自删除还请手动删除一下~", L"卸载完毕", MB_OK );
ShellExecuteA(NULL, "open", "http://www.crosschannel.cn", NULL, NULL, SW_SHOWNORMAL);

// Delete self

// del
char buf[MAX_PATH];
HMODULE module;

Expand Down Expand Up @@ -614,7 +634,7 @@ LRESULT CALLBACK HistoryProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar
case WM_LBUTTONDOWN:
SendMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0);
break;
/*
/*// This will cause refresh shadows, I didn't process with this problem
case WM_CTLCOLORSTATIC:
// Set Text Color, and its background
hdc = (HDC)wParam;
Expand Down
Binary file modified PatchMonitor/PatchMonitor.rc
Binary file not shown.
2 changes: 1 addition & 1 deletion PatchMonitor/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "targetver.h"
#define RELEASE_DELETE
#define LOG_ON // turn on log
//#define LOG_ON // turn on log

#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的信息
// Windows 头文件:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

其他的一些小工具,零散的代码。

- /EngineWorkOut
- EngineWorkOut/

本来准备把整个引擎脚本给逆掉的,结果还是没有完成,里面是测试的一些动画效果截图。

Expand Down

0 comments on commit e8bbd56

Please sign in to comment.