Use the NtCurrentTeb API instead of using some inline asm, this is much nicer and also more portable. Closes #4645