ProcessStartInfo.UseShellExecute有什么大不了的?

时间:2023-01-01 05:29:39

How will ProcessStartInfo.UseShellExecute affect my running process?

如何将ProcessStartInfo。UseShellExecute会影响我的运行过程吗?

Do i need special permissions from UAC to UseShellExecute?

我是否需要UAC对UseShellExecute的特殊权限?

Will it run on diffrent user?

它会运行在不同的用户上吗?

Will it give me new permissions?

它会给我新的权限吗?

1 个解决方案

#1


8  

Windows has two distinct api functions to get a process started. The low-level one is CreateProcess(), it directly maps to a native api function. And there's ShellExecuteEx(), a function that's implemented by the shell (Explorer). It has a much higher level of abstraction.

Windows有两个不同的api函数来启动进程。底层的是CreateProcess(),它直接映射到本机api函数。还有ShellExecuteEx(),一个由shell (Explorer)实现的函数。它有一个更高层次的抽象。

They are very different capabilities and that's something you see back in the documentation for ProcessStartInfo. CreateProcess() can only start executable files but it has good support to control a console mode program, including the ability to redirect I/O and control the appearance of the console window. ShellExecuteEx() takes advantage of the capabilities added by the shell, file associations being the big one, so you can start the executable that's registered for a specific filename extension.

它们是非常不同的功能,您可以在ProcessStartInfo文档中看到这一点。CreateProcess()只能启动可执行文件,但是它对控制控制台模式程序有很好的支持,包括重定向I/O和控制控制台窗口外观的能力。ShellExecuteEx()利用shell添加的功能,文件关联是最大的功能,因此可以启动为特定文件名扩展注册的可执行文件。

Both api functions have options to affect the way the process execute. You'll see a close correlation between the properties of the ProcessStartInfo class and the Process Creation Flags supported by CreateProcess and the fields in the SHELLEXECUTEINFO structure that ShellExecuteEx() uses. But these features don't overlap so that's why you need to tinker with UseShellExecute.

这两个api函数都有影响进程执行方式的选项。您将看到ProcessStartInfo类的属性与CreateProcess支持的进程创建标志以及SHELLEXECUTEINFO结构中ShellExecuteEx()使用的字段之间的密切关联。但是这些特性并没有重叠,这就是为什么需要修改UseShellExecute的原因。

#1


8  

Windows has two distinct api functions to get a process started. The low-level one is CreateProcess(), it directly maps to a native api function. And there's ShellExecuteEx(), a function that's implemented by the shell (Explorer). It has a much higher level of abstraction.

Windows有两个不同的api函数来启动进程。底层的是CreateProcess(),它直接映射到本机api函数。还有ShellExecuteEx(),一个由shell (Explorer)实现的函数。它有一个更高层次的抽象。

They are very different capabilities and that's something you see back in the documentation for ProcessStartInfo. CreateProcess() can only start executable files but it has good support to control a console mode program, including the ability to redirect I/O and control the appearance of the console window. ShellExecuteEx() takes advantage of the capabilities added by the shell, file associations being the big one, so you can start the executable that's registered for a specific filename extension.

它们是非常不同的功能,您可以在ProcessStartInfo文档中看到这一点。CreateProcess()只能启动可执行文件,但是它对控制控制台模式程序有很好的支持,包括重定向I/O和控制控制台窗口外观的能力。ShellExecuteEx()利用shell添加的功能,文件关联是最大的功能,因此可以启动为特定文件名扩展注册的可执行文件。

Both api functions have options to affect the way the process execute. You'll see a close correlation between the properties of the ProcessStartInfo class and the Process Creation Flags supported by CreateProcess and the fields in the SHELLEXECUTEINFO structure that ShellExecuteEx() uses. But these features don't overlap so that's why you need to tinker with UseShellExecute.

这两个api函数都有影响进程执行方式的选项。您将看到ProcessStartInfo类的属性与CreateProcess支持的进程创建标志以及SHELLEXECUTEINFO结构中ShellExecuteEx()使用的字段之间的密切关联。但是这些特性并没有重叠,这就是为什么需要修改UseShellExecute的原因。