win32: Check and avoid using TLS index 0
Zero is a valid TLS index so it needs to be checked. It’s also the integer used to indicate that no TLS has been allocated yet, so it can’t be used as a TLS identifier.
Incorporates changes from Philip Withnall.
Closes: #2058 (closed)