UtilProcessSetCurrentProcessPrivileges(ProcessPrivileges, PrivilegeStates) Method

Enable or disable a process privilege for the current 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 SetCurrentProcessPrivileges(
	ProcessPrivileges privileges,
	PrivilegeStates newPrivilegeState
)

Parameters

privileges  ProcessPrivileges
One or more privileges to set.
newPrivilegeState  PrivilegeStates
The new state for the privileges.

See Also