Reload a DLL and _getptd returns zero

Michael Ost most at museresearch.com
Mon Jan 14 17:32:23 CST 2013


On 01/12/2013 05:21 PM, Dan Kegel wrote:
>> The library in question is using static vc runtime linkage, so _getptd()
>> is linked in
>
> That's somewhat worrisome.  So you have multiple instances
> of the C runtime library active in the same app?
>
> Maybe you're not unloading that dll gracefully enough.
>
> Might be heap corruption.  I wonder if Valgrind might be helpful.
>
> I second the suggestion to post a minimal testcase.

Here's a link to a zip file that includes the prebuilt .exe and .dll 
windows binaries that crash in wine. Plus the code.

https://dl.dropbox.com/u/97386125/msvcrt-dll-problem.zip

So, again, the bug is that MSVCRT calls are failing when called from a 
DLL that has been reloaded. If the calls come from a thread and if the 
DLL is built with static MSVCRT runtimes.

There is no crash for the program in Windows.

I also tried rebuilding the code for winelib, and it doesn't appear to 
have the same behavior. So the problem doesn't happen if Wine's MSVCRT 
is used, only if a windows DLL that uses static MSVCRT linkage is reloaded.

Thanks -- mo



More information about the wine-devel mailing list