GetThreadId not available on Windows XP sp2/sp3 (according to MSDN, it's present only from NT 5.2)
OpenThreadToken is present in ADVAPI32.dll as API, but the same API is available in kernel32 in mingw-x86, which doesn't reflect the exported symbol of kernel32 on XP.
This patch fixes two issues on Windows XP: