How can I access the Windows login API (authentication) from a C ++ Service Application?

Imagine for a moment that I have a piece of equipment that can act as authentication for a user in a given system. I want to write a C ++ application to run as a service, find this device, and if it is found in the log of the corresponding user. I believe that I have found an API that I will need to use to execute the hardware and service parts of the application, but I can hardly nail the way to create a β€œreal” user login. Is it possible? If so, where would I like to find resources to achieve this? I think this is an analogue of devices such as fingerprint login.

+3
source share
2 answers

I think you are probably looking for GINA (Graphical Identity and Authentication) APIs. There is a good tutorial here.

+5
source

If you are looking for an API to verify credentials, here is one way.

Public Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal lpszUsername As [String], 
ByVal lpszDomain As [String], ByVal lpszPassword As [String], _
ByVal dwLogonType As Integer, ByVal dwLogonProvider As Integer, _
ByRef phToken As IntPtr) As Boolean

Here is the complete code β†’ http://codingforpassion.blogspot.com/2011/07/windows-logon-api-for-net.html

Thanks, Srikanth.V

-1
source

Source: https://habr.com/ru/post/1744595/


All Articles