Vb.net 无法加载";shell32.dll“;将DLL插入内存

Vb.net 无法加载";shell32.dll“;将DLL插入内存,vb.net,visual-studio,impersonation,Vb.net,Visual Studio,Impersonation,我在VB.net中编写的程序有问题。它是在远程服务器上启动第三方服务的程序。当我运行该程序时,它工作正常,但我有管理员权限。这个想法是,当某项服务停止时,某些人可以使用这个程序 我使用模拟通过使用以下代码授予程序管理员权限: Public Sub ImpersonateStart(ByVal Domain As String, ByVal userName As String, ByVal Password As String) Try tokenHandle = In

我在VB.net中编写的程序有问题。它是在远程服务器上启动第三方服务的程序。当我运行该程序时,它工作正常,但我有管理员权限。这个想法是,当某项服务停止时,某些人可以使用这个程序

我使用模拟通过使用以下代码授予程序管理员权限:

Public Sub ImpersonateStart(ByVal Domain As String, ByVal userName As 
String, ByVal Password As String)
    Try
        tokenHandle = IntPtr.Zero
        ' Call LogonUser to obtain a handle to an access token.
        Dim returnValue As Boolean = LogonUser(userName, Domain, Password, 
 2, 0, tokenHandle)
        'check if logon successful

        If returnValue = False Then
            Dim ret As Integer = Marshal.GetLastWin32Error()
            Console.WriteLine("LogonUser failed with error code : {0}", ret)
            Throw New System.ComponentModel.Win32Exception(ret)
            Exit Sub

        End If
        'Logon succeeded
        ' Use the token handle returned by LogonUser.
        Dim newId As New WindowsIdentity(tokenHandle)
        impersonatedUser = newId.Impersonate()
    Catch ex As Exception

        Throw ex
        Exit Sub
    End Try

End Sub
在我实际使用的代码中 imp.ImpersonalTestart(“域”、“管理员”、“密码”)

但当我运行程序时,我得到以下错误: 我做错了什么

Thnx