SetProcessShutdownParameters

1. msdn介绍:

http://msdn.microsoft.com/en-us/library/ms686227(v=vs.85).aspx

Sets shutdown parameters for the currently calling process. This function sets a shutdown order for a process relative to the other processes in the system.

Syntax

BOOL WINAPI SetProcessShutdownParameters(
__in DWORD dwLevel,
__in DWORD dwFlags
);

dwLevel [in]

The shutdown priority for a process relative to other processes in the system. The system shuts down processes from high dwLevel values to low. The highest and lowest shutdown priorities are reserved for system components. This parameter must be in the following range of values.

All processes start at shutdown level 0x280.

ValueMeaning
000-0FF

System reserved last shutdown range.

100-1FF

Application reserved last shutdown range.

200-2FF

Application reserved "in between" shutdown range.

300-3FF

Application reserved first shutdown range.

400-4FF

System reserved first shutdown range.

dwFlags [in]

This parameter can be the following value.

ValueMeaning
SHUTDOWN_NORETRY
0x00000001

The system terminates the process without displaying a retry dialog box for the user.

——————————————————————————————————————————————————————————————

2. 个人理解

 该函数设置了进程相对于其它进程的关闭优先级。 系统关闭进程时会从dwLevel值高的开始,按从高到低的顺序关闭。最高和最低的关闭优先级留给了系统组件,dwLevel值必须在制定的范围内取值。

所有进程启动时默认的关闭优先级为0x280.

SHUTDOWN_NORETRY  设置了系统关闭进程时对用户不显示retry的重试窗口。

如果在进程A中调用该函数,则可以设置该进程的退出优先级。,所以可以如果该进程中执行了关机等命令,从而可以影响到其他进程的退出。


 

原文地址:https://www.cnblogs.com/rainduck/p/2160523.html