0

我有一个需要维护的旧 VB6 应用程序。

在应用程序功能中调用了 CreateProcessWithLogonW,它在 Windows 10 上运行时不起作用(但在 Windows 7 上运行良好)。

我通过调用收到的错误代码Err.LastDllError错误代码 740,我认为它与“请求的操作需要提升”有关。UAC 在我运行它的 Win 10 机器上被禁用,所以我不确定是什么问题来了??

有人有这方面的经验吗??任何帮助是极大的赞赏!

真正让我困惑的是它在 Win7 上运行没有任何问题。

代码示例如下:

这是函数声明:

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

这里是函数调用

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)
4

0 回答 0