WeChats.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // WeChats.cpp : 定义应用程序的类行为。
  2. //
  3. #include "stdafx.h"
  4. #include "WeChats.h"
  5. #include "WeChatsDlg.h"
  6. #include "Injection.h"
  7. #include "CDLG_Login.h"
  8. #include "WxMgr.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #endif
  12. ULONG_PTR CWeChatsApp::m_gdiplusToken;
  13. // CWeChatsApp
  14. BEGIN_MESSAGE_MAP(CWeChatsApp, CWinAppEx)
  15. ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
  16. END_MESSAGE_MAP()
  17. // CWeChatsApp 构造
  18. CWeChatsApp::CWeChatsApp()
  19. {
  20. // TODO: 在此处添加构造代码,
  21. // 将所有重要的初始化放置在 InitInstance 中
  22. }
  23. // 唯一的一个 CWeChatsApp 对象
  24. CWeChatsApp theApp;
  25. // CWeChatsApp 初始化
  26. BOOL CWeChatsApp::InitInstance()
  27. {
  28. // 如果一个运行在 Windows XP 上的应用程序清单指定要
  29. // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
  30. //则需要 InitCommonControlsEx()。否则,将无法创建窗口。
  31. INITCOMMONCONTROLSEX InitCtrls;
  32. InitCtrls.dwSize = sizeof(InitCtrls);
  33. // 将它设置为包括所有要在应用程序中使用的
  34. // 公共控件类。
  35. InitCtrls.dwICC = ICC_WIN95_CLASSES;
  36. InitCommonControlsEx(&InitCtrls);
  37. CWinAppEx::InitInstance();
  38. AfxEnableControlContainer();
  39. GdiplusStartupInput gdiplusStartupInput;
  40. GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL);
  41. // 获取配置信息;
  42. GetIniInfo();
  43. GetDebugPriv();
  44. CDLG_Login dlg_login;
  45. if (dlg_login.DoModal() == IDCANCEL)
  46. {
  47. return FALSE;
  48. }
  49. #if 0
  50. TCHAR szDllPath[MAX_PATH];
  51. ZeroMemory(szDllPath, MAX_PATH);
  52. DWORD ss = sizeof(szDllPath);
  53. DWORD sss = _tcslen(szDllPath) * sizeof(TCHAR);
  54. _stprintf_s(szDllPath, _T("%shook.dll"), g_szModulePath);
  55. vector<DWORD> vtPID = FindAllProcess(WECHAT);
  56. if (vtPID.size() != 0)
  57. {
  58. vector<DWORD>::iterator it = vtPID.begin();
  59. //for (int i = 0; i < 1; i++)
  60. for (; it != vtPID.end(); it++)
  61. {
  62. CInjection inject(*it, szDllPath);
  63. inject.InjectDynamicLibrary();
  64. Sleep(3000);
  65. inject.EjectDynamicLibrary();
  66. }
  67. }
  68. #endif
  69. // 标准初始化
  70. // 如果未使用这些功能并希望减小
  71. // 最终可执行文件的大小,则应移除下列
  72. // 不需要的特定初始化例程
  73. // 更改用于存储设置的注册表项
  74. // TODO: 应适当修改该字符串,
  75. // 例如修改为公司或组织名
  76. SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
  77. CWeChatsDlg dlg;
  78. m_pMainWnd = &dlg;
  79. INT_PTR nResponse = dlg.DoModal();
  80. if (nResponse == IDOK)
  81. {
  82. // TODO: 在此放置处理何时用
  83. // “确定”来关闭对话框的代码
  84. }
  85. else if (nResponse == IDCANCEL)
  86. {
  87. // TODO: 在此放置处理何时用
  88. // “取消”来关闭对话框的代码
  89. }
  90. // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
  91. // 而不是启动应用程序的消息泵。
  92. return FALSE;
  93. }
  94. int CWeChatsApp::ExitInstance()
  95. {
  96. // TODO: 在此添加专用代码和/或调用基类
  97. Gdiplus::GdiplusShutdown(m_gdiplusToken);
  98. return CWinAppEx::ExitInstance();
  99. }