473,385 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 2111
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Trogdor | last post by:
I set up a server on an AMD 650 machine running gentoo linux. I installed Apachie 2, MySQL 4.1 and PHP 4.3.11 I use another computer on my local net (192.168.0.x) to access the server as a...
1
by: Caliangelas | last post by:
Hello, I need a routine to check for a number called CPF (just like Social Security Number in USA). I already have a validation routine for that number, but I still need to check if it exists on...
2
by: Bobby | last post by:
Hello everyone I have a question. The school I am working for is in the beginning process of having a webpage that will direct students to download there homework and be able to view there info...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
10
by: gonzal51 | last post by:
Hi, I'm a student learning C++ and my professor isn't much help, her view is if you dont get it I ain't helping you.... We are supposed to do a basic program as a logon system. I got as far as I...
9
by: kwindham | last post by:
This program doesn't seem like it should be too hard, but I cannot figure it out. Here is the assignment: Password Verifier - Write a program to verify passwords, satisfying the following...
6
by: phamn1985 | last post by:
I m trying to make a login page via Microsoft access. This is my table .. Table name : tblLogin PK : loginID(Auto number) Attributes : username , password. I make a login form in Microsoft...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
5
by: Mai Le | last post by:
Hello Experts. Coul you please help me to fix my program. I created a login from with 2 levels. Admin an User. If Admin login will open A form and If User login will open B form I had table...
6
by: priyajohal | last post by:
#include<fstream.h> #include<process.h> #include<stdlib.h> #include<conio.h> #include<string.h> #include<dos.h> #include<ctype.h> #include<stdio.h> void setup() void help();
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.