469,927 Members | 1,747 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

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

Jul 22 '05 #1
2 1950
"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
kb******@gascad.at
Jul 22 '05 #2
Sorry about NTG... My mistake.

Mrek

Uzytkownik "Karl Heinz Buchegger" <kb******@gascad.at> napisal w wiadomosci
news:40***************@gascad.at...
ask a newsgroup dedicated to programming your operating system.

The Welcome message contains some suggestions on where to ask.

Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Caliangelas | last post: by
2 posts views Thread by Bobby | last post: by
10 posts views Thread by gonzal51 | last post: by
9 posts views Thread by kwindham | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.