TlsAlloc limitation in winxp mode

Jon Griffiths jon_p_griffiths at
Fri Mar 18 02:50:15 CST 2005

Hi Michael,

> With the emulation mode set to "winxp" I can only TlsAlloc 64
> indexes, even though the MSDN docs say there should be at least
> 20 million.

You're misreading that page, the limits are:
Win 2000/2003 & XP - 1088 indexes per process
Win Me/98 	   - 80 indexes per process
Win NT and 95 	   - 64 indexes per process

So it seems that Me/98 add 16 on top of the original 64 limit, while
from Win2k onwards another 1024 indices were added.

You can almost certainly work around this if you have the source for
the app you are trying to run, unless your app has more than 64
threads running at once.

Just take all of the per-thread data you need and stick it into a
structure, store only the pointer to that for each thread (1 slot).
This adds a layer of indirection but means you are limited only by
the heap, provided you don't have more than 64 threads. See
dlls/msvcrt/thread.c for an implementation example.


"Don't wait for the seas to part, or messiahs to come;
 Don't you sit around and waste this chance..." - Live

jon_p_griffiths at

Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site! 

More information about the wine-devel mailing list