我写一了个DLL,并用CreateRemoteThread的方式注入到Explorer.exe中。DLL可以正常工作。可是我现在想终止这个DLL的线程。我试过在DLL中直接
CloseHandle\ExitThread\TerminateThread,因为我的DLL载入时会显示一个窗体,用到上述三个中任何一个时,我都可以看到我的窗体已经消失不见了。应该来说,DLL这个线程已经被终止掉了。可是我试着重新编译、删除、重命名那个DLL时,系统提示DLL正在使用中....有什么解决的方法?急盼回复。多谢

解决方案 »

  1.   

    http://expert.csdn.net/Expert/topic/2604/2604943.xml?temp=.7332117没人回答吗?
    如果有人给个完美的答案。这两张贴的两百分都是他的。急盼。
      

  2.   

    非常抱歉,你的dll必须等Explorer.exe退出后才会被真正的释放调,你也知道kill Explorer.exe意味着什么:-)
      

  3.   

    /winnt/debuggers/bin/kill "explorer.exe"
    然后在任务管理器中重新启动"explorer.exe"
      

  4.   

    dwProcessID := GetProcessID(STR_INJECT_EXE);//得到进程ID;
      if dwProcessID=0 then begin
        ShowMessage('Can not get the process ID');
        exit;
      end;  hProcess := 0;
      hProcess := OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessID);//打开进程  if hProcess=0 then begin
        ShowMessage('Can not Open the process!');
        exit;
      end;  try
        UnLoadDllFromProcess(hProcess, hMod, bOK);//释放DLL;
        ShowMessage(Format('UnLoad, Module Handle : %X, BOK: %X', [hMod, DWORD(bOK)]));
      finally
        CloseHandle(hProcess);
        hMod := 0;
      end;
      

  5.   

    UnLoadDllFromProcess(hProcess, hMod, bOK);//释放DLL;
    我就是想知道这个hMod是怎么来的。
      

  6.   

    Hmod就是你注入DLL的时候返回的啊;LOAD函数的第三个参数;