×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Error on Api-Call "LogOnUser"

Error on Api-Call "LogOnUser"

Error on Api-Call "LogOnUser"

(OP)
Hi all!

I'm developing with VB6.4 SP4 on W2K.
I'm trying to start a process with with different access as the current user logged in.
I figured out the following previous api-call of "CreateProcessAsUser":
The declaration is:
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
and the call is:
lLogOn = LogonUser("Username", "Domain", "Password", LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, mpHToken)

In further threads i got the information that there is an error using the Api-Text-Viewer. So i should use
"Advapi32.dll" instead of "kernel32". I tried, but also failed with error 453: DLL-EntryPoint LogOnUserA not found in kernel32 (or advapi32.dll). The change didnt matter at all.

Thanks for all help!

RE: Error on Api-Call "LogOnUser"

The LogonUser was removed form the newer api library.
Try this:
Declare Function CreateProcessWithLogon Lib "Advapi32" Alias "CreateProcessWithLogonW" ( _
           ByVal lpUsername As Long, _
           ByVal lpDomain As Long, _
           ByVal lpPassword As Long, _
           ByVal dwLogonFlags As Long, _
           ByVal lpApplicationName As Long, _
           ByVal lpCommandLine As Long, _
           ByVal dwCreationFlags As Long, _
           ByVal lpEnvironment As Long, _
           ByVal lpCurrentDirectory As Long, _
           lpStartupInfo As STARTUPINFO, _
           lpProcessInfo As PROCESS_INFORMATION _
) As Long

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close