UtilProcessSetProcessPrivileges(Int32, ProcessPrivileges, PrivilegeStates) Method

Enable or disable a process privilege for the specified process.

Note that this method cannot add or remove privileges for external processes. It can only enable existing privileges that are currently disabled, or disable existing privileges that are currently enabled.

Trying to enable or disable a removed privilege will result in a exception.

In order to avoid this exception, it is recommended to call GetProcessPrivilegeState(Process, ProcessPrivileges) to determine whether a privilege is removed before calling this method.

Definition

Namespace: DevCase.Core.Diagnostics.Processes
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static void SetProcessPrivileges(
	int pid,
	ProcessPrivileges privileges,
	PrivilegeStates newPrivilegeState
)

Parameters

pid  Int32
The process identifier (PID).
privileges  ProcessPrivileges
One or more privileges to set.
newPrivilegeState  PrivilegeStates
The new state for the privileges.

See Also