从注册表项中读取用户名,其语言与英语不同 [英] Read Username from Registry entry which is in different language than English

查看:197
本文介绍了从注册表项中读取用户名,其语言与英语不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从注册表 HKEY_LOCAL_MACHINE \Software\Microsoft \ Windows \ CurrentVersion \Authentication \LogonUI 中读取用户名,密钥为
LastLoggedOnSAMUser


Key的值为印地语语言。


  RegGetValue 函数返回?????变量。


请建议一种正确读取数值的方法。

解决方案

RegGetValue返回LPCTSTR。您应该将项目定义为UNICODE。


阅读文档:


"如果数据具有REG_SZ,REG_MULTI_SZ或REG_EXPAND_SZ类型,并且使用此函数的ANSI


版本(通过显式调用
RegGetValueA
或不定义UNICODE在包含Windows.h文件之前的
之前,此函数将存储的Unicode字符串

转换为ANSI字符串,然后将其复制到
pvData
。"



此致,Guido


I want to read the username from the registry HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI with key LastLoggedOnSAMUser.

The value of the Key is in Hindi language.

The RegGetValue function returns ????? to the variable.

Please suggest a way to read the value correctly.

解决方案

RegGetValue return LPCTSTR. You should define your project as UNICODE.

Read the documentation:

"If the data has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, and the ANSI
version of this function is used (either by explicitly calling RegGetValueA or by not defining UNICODE before
including the Windows.h file), this function converts the stored Unicode string
to an ANSI string before copying it to the buffer pointed to by pvData."

Regards, Guido


这篇关于从注册表项中读取用户名,其语言与英语不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆