在LogonUser之后无法执行本地exes [英] Not able to execute local exes after LogonUser
问题描述
我有一个Win 2003服务器,其文件夹完全与 abc@domain.com 用户分享
I have a Win 2003 server with a folder fully shared to abc@domain.com user
我有一个Win XP桌面,我使用 zyz@domain.com 登录。
I have a Win XP desktop where I login with zyz@domain.com.
关于此XP机器我正在尝试运行.Net C#程序,该程序使用 abc@domain.com 执行LogonUser
On this XP machine I am trying to run a .Net C# program which does a LogonUser using abc@domain.com
登录成功完整
我可以使用File.IO复制文件,创建文件等等。
I can use File.IO to copy files , create files etc etc.
但是当我想打开遥控器时TXT文件使用记事本(c:\ windows \\\
otepad.exe),我收到一个错误 - 访问被拒绝。我正在使用stanndard Process.start方法
However when I want to open the remote TXT file using Notepad (c:\windows\notepad.exe) , I get an error - Access denied. I am using the stanndard Process.start approach
在本地复制文件,撤消冒充,然后执行不是一个选项。
Copying the file locally , undoing the impersontation , and then executing is not an option.
我认为这是我们承诺的一个根本错误。任何人都可以告诉我,我们想要实现的目标是否可行?
I think it is a fundamental error we are committing. Can anybody tell me if what we are trying to achieve is actually possible ?
提前致谢
热烈的问候,
Parag
推荐答案
创建流程时不使用模拟。您需要使用CreateProcessAsUser来创建具有另一个令牌的进程。
Impersonation isn't used when creating processes. You need to use CreateProcessAsUser to create a process with another token.
如果您有密码,则可以使用ProcessStartInfo的UserName和Password;否则,你必须P / Invoke CreateProcessAsUser。
If you have the password, you can use ProcessStartInfo's UserName and Password; otherwise, you'd have to P/Invoke CreateProcessAsUser.
-Steve
这篇关于在LogonUser之后无法执行本地exes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!