简体   繁体   中英

Get current locale of a thread in another Windows process

Is it possible to get current locale of a thread living inside another Windows process? Is there a utility that shows this or maybe a Win32 API call?

The locale is stored in the TEB , so you would have to be able to open the process with PROCESS_VM_READ rights and the thread with THREAD_QUERY_INFORMATION and then call OpenThread()+ NtQueryInformationThread ( ThreadBasicInformation ) and then get the TEB address in THREAD_BASIC_INFORMATION and read it with ReadProcessMemory().

All of this is undocumented and could change at any time, you also need to handle WOW64 etc...

There's no API call for this. Assuming that you can't modify the target app to provide the information on demand, the only solution I can see is a global hook. This allows you to inject your code into the thread in question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM