views:

116

answers:

2

We have a dedicated Windows XP system running our VC++ application, full screen. We want to protect general user from access system resource via our application. We plan to add authorization to our VC++ application. Whenever user try to access system resource, he/she needs to pass the authorization check first. If we can use existing Windows Authorization, it will be the best because we don't need to ask user create another account and remember user name and password.

Anybody can give me a direction? Somebody mentioned winlogon.exe and msgina.dll. But I am not quiet sure about that.

thanks,

A: 

GINA is the bits that run the Windows Login screens on first boot - so it's doubtful that's what you're looking for. If you want your application to pop up a password dialog box which authenticates them against the Windows user database.

What you can do is popup a dialog asking for a username and password then attempt to impersonate using those details - see KB306158, the section entitled "Impersonate a Specific User in Code".

blowdart
It is a good reference but there is no code sample for VC++.
5YrsLaterDBA
Ah yea, missed that bit.Then as Jesse says it's time to delve into advapi32 - apologies, so used to thinking in .NET now!
blowdart
A: 

Check out LogonUser.

You need to link against advapi32

BOOL LogonUser(
  __in      LPTSTR lpszUsername,
  __in_opt  LPTSTR lpszDomain,
  __in      LPTSTR lpszPassword,
  __in      DWORD dwLogonType,
  __in      DWORD dwLogonProvider,
  __out     PHANDLE phToken
);
Jesse