HostProtectionResource 열거형

정의

주의

Code Access Security is not supported or honored by the runtime.

메서드나 클래스에 의해 호출되는 경우 호스트를 손상시킬 가능성이 있는 기능의 범주를 지정합니다.

이 열거형은 멤버 값의 비트 조합을 지원합니다.

public enum class HostProtectionResource
[System.Flags]
public enum HostProtectionResource
[System.Flags]
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public enum HostProtectionResource
[System.Flags]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum HostProtectionResource
[<System.Flags>]
type HostProtectionResource = 
[<System.Flags>]
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type HostProtectionResource = 
[<System.Flags>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type HostProtectionResource = 
Public Enum HostProtectionResource
상속
HostProtectionResource
특성

필드

All 511

모든 호스트 리소스를 노출합니다.

ExternalProcessMgmt 4

다른 프로세스를 만들거나 소멸시킬 수 있습니다.

ExternalThreading 16

해당 스레드를 제외하고 호스트를 손상시킬 수 있는 스레드를 만들거나 조작합니다.

MayLeakOnAbort 256

안전한 핸들이나 다른 리소스 해제 방법을 사용하여 보호되지 않은 상태에서 종료하면 리소스 누수가 발생할 수 있습니다.

None 0

호스트 리소스를 노출하지 않습니다.

SecurityInfrastructure 64

보안 인프라를 노출합니다.

SelfAffectingProcessMgmt 8

현재 프로세스를 끝내고 서버를 종료시킬 수 있습니다.

SelfAffectingThreading 32

사용자 코드에만 영향을 주는 방법으로 스레드를 조작합니다.

SharedState 2

스레드 사이에서 공유할 수 있는 상태를 노출합니다.

Synchronization 1

동기화를 노출합니다.

UI 128

사용자 인터페이스를 노출합니다.

예제

다음 코드 예제에서는 특성과 HostProtectionResource 함께 열거형을 사용하는 방법을 HostProtectionAttribute 보여 있습니다. 이 예제는에 대해 제공 된 큰 예제의 일부는 HostProtectionAttribute 클래스입니다.

// Use the enumeration flags to indicate that this method exposes shared state and 
// self-affecting process management.
// Either of the following attribute statements can be used to set the 
// resource flags.
// Exit the sample when an exception is thrown.

[HostProtection(SharedState=true,SelfAffectingProcessMgmt=true)]
[HostProtection(Resources=HostProtectionResource::SharedState|
HostProtectionResource::SelfAffectingProcessMgmt)]
static void Exit( String^ Message, int Code )
{
   Console::WriteLine( "\nFAILED: {0} {1}", Message, Code );
   Environment::ExitCode = Code;
   Environment::Exit( Code );
}
// Use the enumeration flags to indicate that this method exposes 
// shared state and self-affecting process management.
// Either of the following attribute statements can be used to set the
// resource flags.
[HostProtectionAttribute(SharedState = true, 
    SelfAffectingProcessMgmt = true)]
[HostProtectionAttribute(Resources = HostProtectionResource.SharedState |
     HostProtectionResource.SelfAffectingProcessMgmt)]
private static void Exit(string Message, int Code)
{
    // Exit the sample when an exception is thrown.
    Console.WriteLine("\nFAILED: " + Message + " " + Code.ToString());
    Environment.ExitCode = Code;
    Environment.Exit(Code);
}
' Use the enumeration flags to indicate that this method exposes 
' shared state and self-affecting process management.
' Either of the following attribute statements can be used to set the 
' resource flags.
<HostProtectionAttribute(SharedState := True, _
    SelfAffectingProcessMgmt := True), _
    HostProtectionAttribute( _
    Resources := HostProtectionResource.SharedState Or _
    HostProtectionResource.SelfAffectingProcessMgmt)> _
Private Shared Sub [Exit](ByVal Message As String, ByVal Code As Integer)

    ' Exit the sample when an exception is thrown.
    Console.WriteLine((ControlChars.Lf & "FAILED: " & Message & " " & _
        Code.ToString()))
    Environment.ExitCode = Code
    Environment.Exit(Code)
End Sub

설명

이 열거형은 특성에서 HostProtectionAttribute 사용됩니다.

적용 대상