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!
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"
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