I have an old VB6 application that I need to maintain.
Within the app functionality is a call to CreateProcessWithLogonW which does not work when run on Windows 10 (but runs fine on Windows 7).
The error code I'm receiving via a call to Err.LastDllError
is error code 740 which I think relates to "The requested operation requires elevation." UAC is disabled on the Win 10 machine which I'm running this on so I'm unsure what the issue is here??
Would anyone have any experience with this?? Any help is greatly appreciated!
What's really confusing me is the fact that it runs on Win7 without any problems at all.
Code sample is below:
Here is the function declaration:
Private Declare Function CreateProcessWithLogon Lib "Advapi32" Alias "CreateProcessWithLogonW" ( _
ByVal UserName As Long, _
ByVal domain As Long, _
ByVal Password As Long, _
ByVal dwLogonFlags As Long, _
ByVal ApplicationName As Long, _
ByVal strCommandLine As Long, _
ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, _
ByVal strCurrentDirectory As Long, _
ByRef lpStartupInfo As STARTUPINFO, _
ByRef lppiProcessInfo As PROCESS_INFORMATION) As Long
An here is the function call
CreateProcessWithLogon(StrPtr(UserName), StrPtr(domain), StrPtr(Password), _
LOGON_WITH_PROFILE, StrPtr(ApplicationName), StrPtr(strCommandLine), _
CREATE_DEFAULT_ERROR_MODE Or CREATE_NEW_CONSOLE Or CREATE_NEW_PROCESS_GROUP, _
ByVal 0&, StrPtr(strCurrentDirectory), suiStartUpInfo, piProcessInfo)