使用Rundll32运行DLL中的函数

标签: , ,

Windows系统中包含名为Rundll32.exe的命令行实用程序,通过这个程序可调用DLL中导出的函数。

但是,使用Rundll32.exe程序并不能调用从任何DLL导出的任何函数。Rundll32只能调用使用以下原型编写 <entrypoint> 函数:

void CALLBACK
EntryPoint(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);

Rundll32执行以下步骤:

  1. 它分析命令行。
  2. 它通过 LoadLibrary() 加载指定的 DLL。
  3. 它通过 GetProcAddress() 获取 <entrypoint> 函数的地址。
  4. 它调用 <entrypoint> 函数,并传递作为 <optional arguments> 的命令行尾。
  5. 当 <entrypoint> 函数返回时,Rundll.exe 将卸载 DLL 并退出。

参考链接:http://support.microsoft.com/kb/164787/zh-cn

赞赏

微信赞赏支付宝赞赏

随机文章:

  1. “WindowsLive.Writer.CoreServices.HttpRequestHelper”的类型初始值设定项引发异常
  2. WMI工具:WMI Event Registration Tool
  3. 用JavaScript实现PHP的basename函数
  4. 使用Windows Script Encoder加密VBS
  5. jQuery设置ajax请求中的User-Agent

留下回复