|
@@ -61,30 +61,29 @@ DWORD WINAPI WorkThreadProc(LPVOID lParam)
|
|
|
Sleep(5000);
|
|
|
#endif
|
|
|
TCHAR szLog[MAX_PATH] = {0};
|
|
|
- TCHAR szWndTitle[MAXBYTE] = {0};
|
|
|
// 获取DLL所在窗口句柄;
|
|
|
- HWND hWnd = GetMainWnd();
|
|
|
- if ( hWnd == NULL )
|
|
|
+ Utility::g_WndInfo.hWnd = GetMainWnd();
|
|
|
+ if ( Utility::g_WndInfo.hWnd == NULL )
|
|
|
{
|
|
|
OutputDebugString(_T("<Injecter> 没有找到窗口句柄"));
|
|
|
- FreeLibraryAndExitThread(Utility::g_hDLLModule, 0);
|
|
|
+ Utility::FreeLibraryAndExit();
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
// 得到窗口名称
|
|
|
- GetWindowText(hWnd,szWndTitle,sizeof(szWndTitle));
|
|
|
+ GetWindowText(Utility::g_WndInfo.hWnd, Utility::g_WndInfo.szWindowTitle, sizeof(Utility::g_WndInfo.szWindowTitle));
|
|
|
#if _MSC_VER >= 1200 && _MSC_VER < 1500
|
|
|
- sprintf(szLog, _T("找到窗口名称:%s\n"), szWndTitle);
|
|
|
+ sprintf(szLog, _T("找到窗口名称:%s\n"), Utility::g_WndInfo.szWindowTitle);
|
|
|
#else
|
|
|
- _stprintf_s(szLog, _T("找到窗口名称:%s\n"), szWndTitle);
|
|
|
+ _stprintf_s(szLog, _T("找到窗口名称:%s\n"), Utility::g_WndInfo.szWindowTitle);
|
|
|
#endif
|
|
|
OutputDebugString(szLog);
|
|
|
//是否名称是计算器
|
|
|
- if( _tcsstr(szWndTitle, Utility::g_cfgCtx.szWindowTitel) )
|
|
|
+ if( _tcsstr(Utility::g_WndInfo.szWindowTitle, Utility::g_cfgCtx.szWindowTitel) )
|
|
|
{
|
|
|
OutputDebugString(_T("<Injecter> 找到指定窗口!!!"));
|
|
|
// 2、创建后台线程;
|
|
|
- MessageBox(NULL, szWndTitle, Utility::g_cfgCtx.szWindowTitel, MB_OK);
|
|
|
+ MessageBox(NULL, Utility::g_WndInfo.szWindowTitle, Utility::g_cfgCtx.szWindowTitel, MB_OK);
|
|
|
if ( Utility::g_pPipeClient == NULL )
|
|
|
{
|
|
|
Utility::g_pPipeClient = new CPipeClient(Utility::g_cfgCtx.szPipeName);
|