如何使用Rundll32执行DLL功能? [英] How to use Rundll32 to execute DLL Function?

查看:655
本文介绍了如何使用Rundll32执行DLL功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 ShellExecute文档作为参考:

我从命令行运行以下命令:

I run the following from the command line:

C:\>RUNDLL32.EXE SHELL32.DLL,ShellExecute handle,"open","C:\Documents and Settings\admin\Desktop\tmp",NULL,NULL,SW_SHOWNORMAL

这将导致异常错误.

我不知道这是什么意思:

I don't know what this means:

HINSTANCE ShellExecute(
  __in_opt  HWND hwnd,
  __in_opt  LPCTSTR lpOperation,
  __in      LPCTSTR lpFile,
  __in_opt  LPCTSTR lpParameters,
  __in_opt  LPCTSTR lpDirectory,
  __in      INT nShowCmd
);

但是在描述中,提到了句柄(HWND)和指向以空值结尾的字符串的指针(LPCTSTR),但这非常令人困惑.

But in the description, a handle (HWND), and a pointer to a null-terminated string (LPCTSTR), are mentioned, but it is very confusing.

任何帮助将不胜感激.我还想了解更多信息,因此任何参考(书籍,网络链接等)也将很棒!

Any help would be greatly appreciated. I would also like to learn more, so any references (book, web links, etc) would also be great!

推荐答案

Rundll32仅支持运行具有以下签名的DLL导出:

Rundll32 only supports running DLL exports with the following signature:

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

它不支持运行任意入口点.由于ShellExecute没有该签名,因此显然会发生不好的事情.

It does not support running arbitrary entry points. Since ShellExecute does not have that signature, clearly bad things will happen.

信息:Windows Rundll和Rundll32接口具有有关rundll32接口的更多信息.

INFO: Windows Rundll and Rundll32 Interface has more info on the rundll32 interface.

如果要从命令行执行ShellExecute的等效操作,只需使用start:

If you want to do the equivelent of ShellExecute from the command line, just use start:

C:\>start "C:\Documents and Settings\admin\Desktop\tmp"

这篇关于如何使用Rundll32执行DLL功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆