如何在VC ++中使用LogonUser? [英] How to use LogonUser in VC++ ?

查看:71
本文介绍了如何在VC ++中使用LogonUser?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写Vc ++程序,我想在其中检查网络中是否存在给定的用户名和密码.如果用户存在于Windows中并且密码正确,那么我必须返回一个正值;如果用户存在但密码不正确,那么我必须返回一个负值.我知道我可以使用LogonUser进行检查,但是直到现在我还没有成功地正确执行此操作.
请提供示例代码.

I''m trying to write a Vc++ program in where I want to check whether a given username and password exists in the network. If the user exists in the Windows and the password is correct then I have to return a positive value, if the user exists but the password is not correct then I have to return a negative value. I know that I can use LogonUser to check this, but until now I haven''t succeeded to do this correctly.
please give the sample code .

推荐答案

如果您阅读了^ ]文档,您会发现建议使用SSPI API来验证凭据(您要尝试做的事情), ^ ]用于模拟.
LogonUser [如何验证Microsoft操作系统上的用户凭据 [ ^ ]关于如何执行此操作,本文包含一个示例.
If you read the LogonUser[^] documentation you will see that it is recommended to use the SSPI API to validate credentials (what you are trying to do I assume), LogonUser[^] should be used for impersonation.
The LogonUser[^] documentation refers to How to validate user credentials on Microsoft operating systems[^] on how to do this, this article contains a sample.


这篇关于如何在VC ++中使用LogonUser?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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