Reload a DLL and _getptd returns zero

Piotr Caban piotr.caban at gmail.com
Tue Jan 15 15:08:50 CST 2013


On 1/15/13 7:59 PM, Michael Ost wrote:
> On 01/15/2013 03:39 AM, Piotr Caban wrote:
>> The crash is caused by incomplete FlsFree implementation. There's a
>> comment in it's code that says what needs to be added:
>> /* FIXME: add equivalent of ThreadZeroTlsCell here */
>
> Really? Are you sure that's it?
Yes. If you need a workaround to run you app you can comment FlsAlloc 
export. If this function is not available msvcrt will use TlsAlloc. I've 
also confirmed it by adding a hacky implementation of zeroing the memory 
on free.

> By the way, to aid my future Wine sleuthing, can you share any hints 
> on how you figured this out?
There's no easy answer to this question. I've looked on the relay log 
and after figuring out it may be related to Fls* functions I have added 
some more traces to it. Afterwards it was quite obvious that application 
was using a value that was supposed to be no longer valid (FlsGetValue 
was returning old pointer instead of NULL).

> OK. Do you know if it is acceptable form to post a windows binary as 
> an example case on the bug? The DLL part of the bug has to be a 
> windows binary.
I think it's ok if it's your code and compiler license is allowing to 
publish produced executable. I've already seen some executables attached 
to bugs.

Piotr



More information about the wine-devel mailing list