Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error on Api-Call "LogOnUser"

Status
Not open for further replies.

stwi1974

Programmer
Jan 29, 2002
17
0
0
DE
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!
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top