OpenThreadToken

OpenThreadToken

OpenThreadToken will fail with ERROR_NO_TOKEN if the thread is not impersonated. If you want to get the thread token regardless if the thread is impersonated or not, you should catch this error, and fall back to OpenProcessToken to get the process token.