English 中文(简体)
Get Module 当COMCTL32.DLLL装载两次时,处理和处理
原标题:GetModuleHandle and GetProcAddress when COMCTL32.DLL is loaded twice

我正在参加一个过程:COMCTL32.DL两次装载,一次装上5.82.7601.17514版本,一次装上6.10.7601.17514版本。 遗产版本由一些遗留下来的DLL组成,该方案与新的DLLL联系,而另一个版本则由新的DLL组成。

If I use GetModuleHandle (L"COMCTL32.DLL") I have no control over the DLL which gets resolved.

When I call GetProcAddress to reach, for instance, TaskDialogIndirect, I get a null pointer back, which is certainly because I got back the handle of the legacy DLL.

因此,有某种手段去读到TaskDialogIndirect的地址。 这两辆DLLL车都装载。

If not, can I somehow make sure that the process loads the 6.10 version and not the 5.82, in the hope that our legacy DLL will work fine with the newer version of COMCTL32?

最佳回答

I guess you are having to use GetProcAddress() rather than implicit linking because you want your app to run on XP where task dialog is not available.

I can see three options for you:

  1. Use implicit linking, but use delay loading as supported by the MS tool chain. I m not 100% certain that will give you the correct comctl32 but it s worth a try.
  2. Use the activation context API to make sure that the comctl32 v6 manifest is in play when you call LoadLibrary(). Call LoadLibrary() rather than GetModuleHandle() to make sure that you get the manifest magic.
  3. Enumerate all the modules in the process and select the correct version of comctl32. There is a comprehensive example of how to do this on MSDN.

生态环境办法是最清洁的解决办法,但环境分析模型可以渗透进来。 我个人利用了这一系统,确保了一家Excel COM公司与Cectl32 v6的链接。

模块列举办法迅速实施,有些过于仓促,但效果良好。

问题回答

暂无回答




相关问题
How to read exact number of bytes from a stream (tcp) socket?

In winsock, both the sync recv and the async WSARecv complete as soon as there is data available in a stream socket, regardless of the size specified (which is only the upper limit). This means that ...

AcquireCredentialsHandle returns SEC_E_NO_CREDENTIALS

I created a self-signed certificate (created using OpenSSL) and installed it into the Certificate Store using the Certificates MMC snap-in (CertMgr.msc) on Windows Vista Ultimate. I have managed to ...

Calling Win32 EnumThreadWindows() in C#

I m trying to get a call to EnumThreadWindows working, but I always get a Wrong Parameter-Error, although my code is nearly the same as this example on pinvoke.net. I don t know why this doesn t work: ...

COM Basic links

folks can you provide me the tutorial link or .pdf for learning basic COM?. i do google it.. still i recommend answers of stackoverflow so please pass me.. Thanks

Handling multiple windows WIN32 API

HI I m trying to create an application in the Win32 environment containing more than one window. How do i do that? all the Win32 Tutorials on web i found only showed how to manage one window. How do i ...

Creating a thread in DllMain?

It seems that when a thread is created from within DllMain upon DLL_PROCESS_ATTACH it won t begin until all dll s have been loaded. Since I need to make sure the thread runs before I continue, I get a ...

热门标签