Help User Password Check

  • Follow


Please help...

My problem is I need to write simple function which checks if user (system
user - Windows 2000 Professional), and password matches. Someone told me I
should use function LogonUser. So I wrote quite a simple program which looks
like below:

<code>
void main()
{
 HANDLE han;
 BOOL bRet;
 DWORD err;

 for( int i = 0; i < 10; i++ )                    // point 1
  for( int j = 0; j < 10; j++ )
  {
   bRet = LogonUser( "userName",
       ".",
       "password",
       i,
       j,
       &han );
   if( bRet )
   {
    cout << "OK i = " << i << " j = " << j << endl;    // point2
    CloseHandle( han );
   }
   else
   {
    err = GetLastError();
    if( err != 87 && err != 1314 )            // point3
     cout << err << endl;
   }
  }
 return;
}
</code>

ad. point 1.

I know that this iteration is not elegant, but now I am sure, that I use all
posible combination of :
  DWORD dwLogonType,      // type of logon operation
  DWORD dwLogonProvider,  // logon provider

dwLogonType/dwLogonProvider may be:
#define LOGON32_LOGON_INTERACTIVE   2
#define LOGON32_LOGON_NETWORK       3
#define LOGON32_LOGON_BATCH         4
#define LOGON32_LOGON_SERVICE       5

#define LOGON32_PROVIDER_DEFAULT    0
#define LOGON32_PROVIDER_WINNT35    1
#if(_WIN32_WINNT >= 0x0400)
#define LOGON32_PROVIDER_WINNT40    2
#endif /* _WIN32_WINNT >= 0x0400 */
#if(_WIN32_WINNT >= 0x0500)
#define LOGON32_PROVIDER_WINNT50    3
#endif // (_WIN32_WINNT >= 0x0500)

so it is from 0 to 10, I've checked all combination.

ad. point 2.
If one of combination was correct I put it on the screan. Unfortunetally
nothing was presented on the screan.

ad. point 3
If some error occure, but not one of known than I want it to be presented.
Till that moment only errors 87, and 1314 occure.

Error 87:
The parameter is incorrect - This is a thing I understand. There are illegal
combinations of dwLogonType/dwLogonProvider

Error 1314:
A required privilege is not held by the client. - hmmm at first it seemed
interesting, because I've tried loging on user which had administrative
privilidges. After some tests, and reading MSDN I suppose the problem is,
that even administrator do not have Log On Locally permission on the local
computer. Especially administrator should not have such a privilidge,
because it would make possibility of direct login, so danger, that sombody
would do it from outside. (I hope I didn't mess up). But if I think
correctly after instalation nobody has this privilidge.

So the question is:
1. is there any other way to check if combination password and user is
correct ?
2. if not how to setup on Windows 2000 Professional this privilidge ?

Thank you for any help
Marek Szarafi�ski junior



0
Reply no3408 (4) 6/23/2004 8:01:16 AM

"Marek Szarafi�ski junior" wrote:
> 
> 
> So the question is:
> 1. is there any other way to check if combination password and user is
> correct ?
> 2. if not how to setup on Windows 2000 Professional this privilidge ?

your problem is not about C++ per se but about a using a system
specific extension your operating system provides. You should
ask a newsgroup dedicated to programming your operating system.

The Welcome message contains some suggestions on where to ask.
http://www.slack.net/~shiva/welcome.txt

-- 
Karl Heinz Buchegger
kbuchegg@gascad.at
0
Reply kbuchegg (2095) 6/23/2004 8:19:22 AM


Sorry about NTG... My mistake.

Mrek

Uzytkownik "Karl Heinz Buchegger" <kbuchegg@gascad.at> napisal w wiadomosci
news:40D93D0A.90BCA359@gascad.at...
> ask a newsgroup dedicated to programming your operating system.
>
> The Welcome message contains some suggestions on where to ask.


0
Reply no3408 (4) 6/23/2004 8:31:56 AM

2 Replies
24 Views

(page loaded in 0.066 seconds)


Reply: