简体   繁体   English

在另一个 Windows 进程中获取线程的当前语言环境

[英]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?是否可以获得位于另一个 Windows 进程中的线程的当前语言环境? Is there a utility that shows this or maybe a Win32 API call?是否有显示此功能的实用程序或 Win32 API 调用?

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().语言环境存储在TEB中,因此您必须能够打开具有 PROCESS_VM_READ 权限的进程和具有 THREAD_QUERY_INFORMATION 的线程,然后调用 OpenThread()+ NtQueryInformationThread ( ThreadBasicInformation ),然后在THREAD_BASIC_INFORMATION中获取 TEB 地址并使用读取进程内存()。

All of this is undocumented and could change at any time, you also need to handle WOW64 etc...所有这些都是无证的,并且可能随时更改,您还需要处理 WOW64 等...

There's no API call for this.没有 API 调用这个。 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.这允许您将代码注入到相关线程中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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