为什么 我的DLL注入到 EXplorer成功后 没有执行相关的代码呢 还有 就是机器重新启动之后 怎么就没有呢呢

解决方案 »

  1.   

    把主要代码写出来,大家才能帮你进行分析,光这样几句文字是说明不了问题的。我个人认为,既然已将DLL成功注入到了EXplorer中,除非你的DLL中的语句有问题,否则应该能够执行成功。
      

  2.   

    语句如下:
    ############################
    library implementd;{ Important note about DLL memory management: ShareMem must be the
      first unit in your library's USES clause AND your project's (select
      Project-View Source) USES clause if your DLL exports any procedures or
      functions that pass strings as parameters or function results. This
      applies to all strings passed to and from your DLL--even those that
      are nested in records and classes. ShareMem is the interface unit to
      the BORLNDMM.DLL shared memory manager, which must be deployed along
      with your DLL. To avoid using BORLNDMM.DLL, pass string information
      using PChar or ShortString parameters. }uses
      SysUtils,
      Classes,
      Dialogs,
      myhook in 'myhook.pas',
      define in 'define.pas';{$R *.RES}
    exports
    SetHook,Unhook;begin
      if SetHook() then showmessage('Install hook ok');
    end.
    #################################################################
    unit myhook;interface
    uses windows,Dialogs,SysUtils;
    var
        OldHook,NewHook:HHOOK;        //用来保存HOOK的返回值
        OldProc:FARPROC;      //用来指向窗口消息 字串8 
        Function SetHook:Boolean;stdcall;
        function Unhook:boolean;stdcall;
        Function HookProc(nCode,wParam,lParam:Integer):Integer;stdcall export;
        Function WinProc(Hwnd,Msg,wParam,lParam:longint):LRESULT; stdcall;
        
    implementation
    {###################################################################################}
    //安装HOOK
    Function SetHook:Boolean;stdcall;
    begin
      //安装HOOK
      showmessage('begin install');
      OldHook:=SetWindowsHookEx(WH_GETMESSAGE,@HookProc,Hinstance,0);
      //NewHook:=SetWindowsHookEx(WH_KEYBOARD,@HookProc,Hinstance,0);
      Result := False;
      if (OldHook=0) then exit else Result:=True;
    end;function Unhook:boolean;stdcall;
    Begin
        if UnhookWindowsHookEx(OldHook) then
          showmessage('测试卸载')
        else
          showmessage('测试卸载失败');
    End;
                                                {###################################################################################}
    //HOOK回调函数
    Function HookProc(nCode,wParam,lParam:Integer):integer;stdcall export;
    var
    WinStr:HWND;
    begin
      //设置热键
      showmessage('测试安装');
      if (wParam=VK_F2) then
        begin
          showmessage('测试安装' + inttostr(VK_F2));
        end
      else if(wParam=VK_F3) then
        Unhook();
      //将HOOK传递给Windows处理
      Result:=CallNextHookEx(OldHook,nCode,wParam,lParam);
    end;{###################################################################################}
    //自定义Windows消息处理函数
    Function WinProc(Hwnd,Msg,wParam,lParam:longint):LRESULT; stdcall;
    begin
    {在这做出对消息的处理 字串3
      case Msg of
        WM_ACTIVATEAPP:exit;
        WM_ACTIVATE:exit;
        WM_KILLFOCUS:exit;
        WM_SETFOCUS:exit;
      end;
    上面这些消息是窗口失去焦点和获得焦点的屏蔽
    }
    //将窗口消息传递给Windows处理
    Result:=CallWindowProc(OldProc,Hwnd,Msg,wParam,lParam);
    end;
    end. 
      

  3.   

    确认你的DLL的确注入到了explorer: 用一个进程察看工具就可以看到模块列表.因为现在的杀毒软件一般会拦截DLL注入.    还有,你所说的"没有执行相关的代码"是指哪一段?所有的吗?    "就是机器重新启动之后 怎么就没有呢呢".....汗......注入,并没有改变原来的exe文件,别说你重启,就是explorer结束后重新启动,注入的都没了.
        补充一点: 不要搞盗密码的东西.BS搞这样的东西的人.技术研究可.