如何从注册表中读取本地化的名称? [英] How does one read a localized name from the registry?
问题描述
请考虑以下注册表导出:
Consider the following registry export:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\WinSock2\Parameters\Protocol_Catalog9\Catalog_Entries\000000000001]
;...
"ProtocolName"="@%SystemRoot%\\System32\\wshtcpip.dll,-60100"
要为某人加载有问题的DLL,并使用某种形式的API检索实际名称。但我不知道那个API是什么:/
The intention here appears to be for someone to load the DLL in question, and use some form of API retrieve the actual name. But I don't know what that API is :/
我想避免加载DLL到我的地址空间(因此调用 DLL_PROCESS_ATTACH
)如果可能的话;不能真正信任第三方DLL是值得信赖的。
I'd like to avoid loading the DLL into my address space (and thus call DLL_PROCESS_ATTACH
) if at all possible; can't really trust third party DLLs to be trustworthy.
推荐答案
RegLoadMUIString
会为您做必要的。但是,注意,它是在Vista中引入的,如果你需要支持XP,将不会有帮助。
RegLoadMUIString
will do the necessary for you. Note however, that it was introduced in Vista so won't help if you need to support XP.
如果你想避免代码在DLL运行时, ,请使用 LoadLibraryEx
传递 LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_AS_DATAFILE
,或可能 LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE
。完成后,您可以致电 LoadString
提取MUI值。
If you want to avoid code in the DLL running whilst you extract resources, use LoadLibraryEx
passing LOAD_LIBRARY_AS_IMAGE_RESOURCE | LOAD_LIBRARY_AS_DATAFILE
, or possibly LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE
. Once you have done that, you can call LoadString
to extract the MUI value.
这篇关于如何从注册表中读取本地化的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!