简体   繁体   English

需要RUNDLL32的替代方法来调用DLL

[英]Need An alternative to RUNDLL32 for calling DLLs

I want to call a Windows DLL's exports by command line or by means of a batch file. 我想通过命令行或批处理文件来调用Windows DLL的导出。 The DLL is winscard.dll , which is located at \\windows\\system32 . DLL是winscard.dll ,它位于\\windows\\system32

But I don't want to use RUNDLL or RUNDLL32, because the functions I want to call, don't have the standard signature to call by RUNDLL32. 但是我不想使用RUNDLL或RUNDLL32,因为我要调用的函数没有RUNDLL32调用的标准签名。

The signature has to be like: 签名必须像:

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

So I am looking for a different way to call those functions. 因此,我正在寻找一种不同的方式来调用这些函数。 Has anybody done this before? 有人做过吗?

Try this: http://pastebin.com/U8XvZsvA (in case the link is not working: https://paste.ee/p/clnzM ) 尝试以下操作: http : //pastebin.com/U8XvZsvA (如果链接不起作用: https : //paste.ee/p/clnzM

Compile with GCC. 用GCC编译。

Use it like this rundll winscard.dll EntryPoint [arguments in order from left to right] . rundll winscard.dll EntryPoint [arguments in order from left to right]这样使用它rundll winscard.dll EntryPoint [arguments in order from left to right]

To pass a string argument, prefix it with a . 要传递字符串参数,请在其前面加上. , otherwise it will be taken as a numeric value (as recognised by strtol ). ,否则它将被视为一个数值(由strtol识别)。

Of course it will most probably not work if the function takes pointer arguments, which you cannot pass from command line. 当然,如果该函数使用指针参数(您不能从命令行传递该参数),则很可能无法正常工作。 You can edit the code to suit your needs, but it's likely that what you want to do will not be possible to do from a batch file. 您可以编辑代码以适合您的需要,但是可能无法从批处理文件中执行想要执行的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM