Connecting Tech Pros Worldwide Help | Site Map

Help User Password Check

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 22nd, 2005, 02:06 PM
Marek Szarafiński junior
Guest
 
Posts: n/a
Default Help User Password Check

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




  #2  
Old July 22nd, 2005, 02:06 PM
Karl Heinz Buchegger
Guest
 
Posts: n/a
Default Re: Help User Password Check

"Marek Szarafiński junior" wrote:[color=blue]
>
>
> 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 ?[/color]

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
  #3  
Old July 22nd, 2005, 02:06 PM
Marek Szarafinski junior
Guest
 
Posts: n/a
Default Re: Help User Password Check

Sorry about NTG... My mistake.

Mrek

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


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.