Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validating userid x password
Message
From
27/02/2004 14:22:09
 
 
To
26/02/2004 10:06:27
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00881067
Message ID:
00881592
Views:
25
Just for the record.

So far I could find a great article ("The LogonUser API" http://authors.aspalliance.com/bdesmond/ArticleViewer.aspx?ArticleID=2 ) and assembled this working example.
 Declare Integer LogonUser In advapi32 String  lpszUsername,; 
                                       String  lpszDomain,; 
                                       String  lpszPassword,; 
                                       Integer dwLogonType,; 
                                       Integer dwLogonProvider,; 
                                       Integer @phToken 
* dwLogonProvider:

 #Define LOGON32_PROVIDER_DEFAULT  0
 #Define LOGON32_PROVIDER_WINNT50  3
 #Define LOGON32_PROVIDER_WINNT40  2
 #Define LOGON32_PROVIDER_WINNT35  1

* dwLogonType:

 #Define LOGON32_LOGON_INTERACTIVE 2
 #Define LOGON32_LOGON_NETWORK     3
 #Define LOGON32_LOGON_BATCH       4
 #Define LOGON32_LOGON_SERVICE     5

 cUserId   = "myuserid"
 cPassword = "mypassword"
 cDomain   = "mydomain"

 nToken  = 0

 nHandle = LogonUser (cUserId                  , ;
                      cDomain                  , ;
                      cPassword                , ;
                      LOGON32_LOGON_INTERACTIVE, ;
                      LOGON32_PROVIDER_DEFAULT , ;
                      nToken)

 If nHandle > 0
    MessageBox ("Password is correct!")
 else
    MessageBox ("Password is NOT correct!")
 endif
Still on search for problems in the above aproach or other ways to accomplish the task I'm wanting to.

Fernando
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform