Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

VB6 NT challenge

Posted on 2003-04-01
6
Medium Priority
?
286 Views
Last Modified: 2010-04-07
I need some simple code for a vb6 app that a user will enter their NT name and Password.
and I need a true if the user and password is valid and false if not valid.

They will be on a NT4 or 2000
0
Comment
Question by:LeeHopkins
6 Comments
 
LVL 10

Accepted Solution

by:
aeklund earned 750 total points
ID: 8247851
This should be EXACTLY what your looking for:
http://www.mvps.org/vbnet/code/network/acceptsecuritycontext.htm
0
 
LVL 6

Expert Comment

by:DominicCronin
ID: 8247961
You need to declare the appropriate API and just call the function. It's a simple as that:

Here's the declaration (usually you stick these in a module):

Public Declare Function LogonUser _
        Lib "kernel32" Alias "LogonUserA" ( _
        ByVal lpszUsername As String, _
        ByVal lpszDomain As String, _
        ByVal lpszPassword As String, _
        ByVal dwLogonType As Long, _
        ByVal dwLogonProvider As Long, _
        phToken As Long) As Long

Once you have that you can code,

Dim lLngReturn as long
lLngReturn = LogonUser( "username", "password"....

The rest of the details you can get from
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/security/logonuser.asp

Once you go there, you'll probably find it's a bit complicated, but it's not *too* scary. You can use the API viewer addin that comes with VB to find the values of the appropriate constants mentioned in the help pages: e.g.

Public Const LOGON32_LOGON_BATCH = 4
Public Const LOGON32_LOGON_INTERACTIVE = 2
Public Const LOGON32_LOGON_SERVICE = 5
Public Const LOGON32_PROVIDER_DEFAULT = 0
Public Const LOGON32_PROVIDER_WINNT35 = 1

Good luck
0
 

Author Comment

by:LeeHopkins
ID: 8257023
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/security/logonuser.asp

This info talks about changing the logon of the computer to the net work. I am just trying to validate that a user is who they say they are not really connect to the net work

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:aeklund
ID: 8257062
LeeHopkins-
Did you try the example I posted?  It does just that, it only verifies that the user get's authenticated and does not log that use on.
0
 
LVL 6

Expert Comment

by:DominicCronin
ID: 8263921
We could get into a whole discussion here about what "logging on" means. Generally it means that you identify yourself to an authenticating authority - perhaps a domain controller. If you're not connected to the network, then you could use local accounts on the machine and connect to that.

The point is that if you want to know whether their password is valid, you have to log on. It is possible to determine whether the account exists without logging on, but then you don't know whether the password is correct.

The link given by aeklund does show some techniques for doing both these things (across a network), but all you really need to do is call LogonUser.
0
 

Expert Comment

by:CleanupPing
ID: 8531183
Hi LeeHopkins,
This old question (QID 20570499) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question