123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #ifndef __WX_OBJECT__
- #define __WX_OBJECT__
- #pragma once
- typedef struct _WNDINFO_
- {
- // 返回的窗口句柄;
- HWND hWxWnd;
- // 要遍历的进程id;
- DWORD dwWxProcId;
- // 返回的窗口线程id;
- DWORD dwThreadId;
- // 窗口名称;
- TCHAR szWndName[MAX_PATH];
- // 窗口类名;
- TCHAR szClassName[MAX_PATH];
- // 窗口原始大小;
- CRect rcWnd;
- }WNDINFO, *pWNDINFO;
- class CWxObject
- {
- public:
- CWxObject();
- explicit CWxObject(DWORD dwProcId, LPCTSTR lpDynamicLibraryPath);
- ~CWxObject();
- public:
- // 进程id;
- DWORD m_dwWxProcId;
- // 进程句柄;
- HANDLE m_hWxProcess;
- // 进程窗口句柄;
- HWND m_hWxMainWnd;
- HWND m_hWxLoginWnd;
- // 窗口大小;
- CRect m_rcWxWnd;
- // 是否附加到主窗口;
- BOOL m_bAttached;
- private:
- // 动态库路径;
- WCHAR m_wszDllPath[MAX_PATH];
- CHAR m_szDllPath[MAX_PATH];
- // 路径分配的内存;
- LPVOID m_lpInjectData;
- LPVOID m_lpEjectData;
- // 路径长度;
- DWORD m_dwPathLen;
- // 注入线程句柄;
- HANDLE m_hInjectThread;
- // 卸载线程句柄;
- HANDLE m_hEjectThread;
- public:
- inline DWORD GetWxProcId() { return m_dwWxProcId; }
- inline HWND GetWxMainWnd() { return m_hWxMainWnd; }
- inline HWND GetWxLoginWnd() { return m_hWxLoginWnd; }
- // dll路径和要注入的进程id;
- void setInjectionObj(DWORD dwProcId, LPCTSTR lpDynamicLibraryPath);
- BOOL InjectDynamicLibrary();
- BOOL EjectDynamicLibrary();
- BOOL FindWxMainWnd();
- BOOL FindWxLoginWnd();
- BOOL Attach2MainWnd(CWnd *pMainWnd, BOOL bLoginWnd = FALSE);
- BOOL DetachWxWnd();
- static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam);
- };
- #endif //__WX_OBJECT__
|