简体   繁体   English

Rundll32加载顺序问题

[英]Rundll32 load order problem

My product consists of two dlls (A.dll and B.dll for clarity), A.dll depends on B.dll. 我的产品包含两个dll(为清楚起见,分别为A.dll和B.dll),A.dll依赖于B.dll。 Both A and B dlls are in the same folder (say c:\\app). A和B dll都在同一文件夹中(例如c:\\ app)。 At the same time old version of B.dll is in Windows\\System32 folder. 同时,B.dll的旧版本位于Windows \\ System32文件夹中。 When I try to run following command from command prompt (current folder is c:\\app): 当我尝试从命令提示符下运行以下命令时(当前文件夹为c:\\ app):

rundll32.exe "c:\app\A.dll",DoWork

I receive error because rundll32 uses old version of B.dll from System32 folder. 我收到错误,因为rundll32使用System32文件夹中的B.dll的旧版本。 I tried to use SetDllDirectory API from DllMain function of A.dll library to add c:\\app folder to the search path but it doesn't work for me. 我尝试使用A.dll库的DllMain函数中的SetDllDirectory API将c:\\ app文件夹添加到搜索路径,但是它对我不起作用。
I can't find any useful and complete information about rundll32 internals or any information about dll loading order. 我找不到任何有关rundll32内部的有用或完整的信息,或有关dll加载顺序的任何信息。
Is it possible to execute rundll32 successfuly in this deployment configuration? 是否可以在此部署配置中成功执行rundll32? (I mean load new B.dll version from c:\\app folder). (我的意思是从c:\\ app文件夹加载新的B.dll版本)。

I'd get rid of the old Dll, or use another name for the new dll. 我会摆脱旧的Dll,或者为新的dll使用另一个名称。 Having two versions of something that is supposed to do the same, and giving it the same name, is likely to cause havoc. 具有应该执行相同操作的两个版本,并为其赋予相同的名称,可能会造成严重破坏。

DLL Hell on SO DLL的地狱

Well, it's kind of cool in a retro sort of way. 好吧,以复古的方式有点酷。 Here is a thought: try copying rundll32.exe into the same folder as the new dll's and your product, and run it from there. 这是一个想法:尝试将rundll32.exe复制到与新dll和您的产品相同的文件夹中,然后从那里运行它。 It might work... 可能行得通...

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

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