C# Class BelhardTraining.LessonMultithreading.ProccessIntegrityLevelHelper

ファイルを表示 Open project: bazile/Training

Public Methods

Method Description
CreateLowIntegrityProcess ( string commandLine ) : void

The function launches an application at low integrity level.

To start a low-integrity process, 1) Duplicate the handle of the current process, which is at medium integrity level. 2) Use SetTokenInformation to set the integrity level in the access token to Low. 3) Use CreateProcessAsUser to create a new process using the handle to the low integrity access token.

GetCurrentProcessIntegrityLevel ( ) : IntegrityLevel
GetProcessIntegrityLevel ( IntPtr processHandle ) : IntegrityLevel

Method Details

CreateLowIntegrityProcess() public static method

The function launches an application at low integrity level.
To start a low-integrity process, 1) Duplicate the handle of the current process, which is at medium integrity level. 2) Use SetTokenInformation to set the integrity level in the access token to Low. 3) Use CreateProcessAsUser to create a new process using the handle to the low integrity access token.
public static CreateLowIntegrityProcess ( string commandLine ) : void
commandLine string /// The command line to be executed. The maximum length of this string is 32K /// characters. ///
return void

GetCurrentProcessIntegrityLevel() public static method

public static GetCurrentProcessIntegrityLevel ( ) : IntegrityLevel
return IntegrityLevel

GetProcessIntegrityLevel() public static method

public static GetProcessIntegrityLevel ( IntPtr processHandle ) : IntegrityLevel
processHandle System.IntPtr
return IntegrityLevel