我有一个CreateProcessWithTokenW调用失败,拒绝访问。任何想法如何调试?为什么CreateProcessWithTokenW失败,ERROR_ACCESS_DENIED
到CreateProcessWithTokenW的通话是在这里:https://github.com/fschwiet/PShochu/blob/master/PShochu/PInvoke/NetWrappers/ProcessUtil.cs
现在我使用一个访问令牌当前进程,最终我将使用一个令牌从另一个用户。现在,我使用https://github.com/fschwiet/PShochu/blob/master/PShochu/PInvoke/NetWrappers/AccessToken.cs来获取访问令牌。
如果您想调试,请拉下源代码并运行build_and_test.ps1。错误堆栈:
1) Test Error : PShochu.Tests.can_run_remote_interactive_tasks, given a psake script which writes the current process id to output, when that script is invoked interactively, then the script succeeds
System.ComponentModel.Win32Exception : Access is denied
at PShochu.PInvoke.NetWrappers.ProcessUtil.CreateProcessWithToken(IntPtr userPrincipalToken, String applicationName,
String applicationCommand, Boolean dontCreateWindow, Boolean createWithProfile, StreamReader& consoleOutput, StreamReader& errorOutput) in c:\src\PShochu\PShochu\PInvoke\NetWrappers\ProcessUtil.cs:line 52
at PShochu.ProcessHandling.RunNoninteractiveConsoleProcessForStreams2(String command, String commandArguments, String& newLine) in c:\src\PShochu\PShochu\ProcessHandling.cs:line 36
at PShochu.ProcessHandling.RunNoninteractiveConsoleProcess(String command, String commandArguments) in c:\src\PShochu\PShochu\ProcessHandling.cs:line 20
at PShochu.Tests.can_run_remote_interactive_tasks.<>c__DisplayClass16.<>c__DisplayClass18.<Specify>b__2() in c:\src\PShochu\PShochu.Tests\can_run_remote_interactive_tasks.cs:line 27
at NJasmine.Core.Execution.DescribeState.<>c__DisplayClass7`1.<visitBeforeEach>b__3() in c:\src\NJasmine\NJasmine\Core\Execution\DescribeState.cs:line 62
后来更新:我在一些文档所需要的额外特权(http://msdn.microsoft.com/en-us/library/aa374905%28v=vs.85%29.aspx)看到。我遇到了麻烦测试来验证我的这些个别证券(它们在secpol.msc预先设定重启)
SE_ASSIGNPRIMARYTOKEN_NAME "Replace a process level token"
SE_TCB_NAME "Act as part of the operatin system"
SE_INCREASE_QUOTA_NAME "Adjust memory quotas for a process"
这些测试一直告诉我,我没有,我在设置权限UI,https://github.com/fschwiet/PShochu/blob/master/PShochu.Tests/verify_privileges.cs
没有发生?是的,我也不想碰它。 :P – 2011-03-28 22:16:33
它是什么操作系统?您可以尝试运行Process Monitor并查看它是否与文件或注册表访问有关(考虑到它是同一用户,似乎不太可能)。 – Luke 2011-03-28 23:22:46
Windows 7.我不知道如何在进程资源管理器中看到它,因为我明白错误,进程没有启动。 – 2011-03-29 00:25:59