HostProtectionResource Enumeration

Definition

Achtung

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

Gibt Kategorien von Funktionen an, die potenziell schädlich für den Host sind, wenn sie von einer Methode oder Klasse aufgerufen werden.

Diese Enumeration unterstützt eine bitweise Kombination ihrer Memberwerte.

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
Vererbung
HostProtectionResource
Attribute

Felder

All 511

Macht alle Hostressourcen verfügbar.

ExternalProcessMgmt 4

Erstellt oder zerstört möglicherweise andere Prozesse.

ExternalThreading 16

Erstellt oder bearbeitet Threads anderer Objekte, die möglicherweise schädlich für den Host sind.

MayLeakOnAbort 256

Verursacht beim Beenden möglicherweise Ressourcenverluste, wenn kein Schutz durch einen SafeHandle oder eine andere Möglichkeit zum Sicherstellen der Freigabe von Ressourcen vorhanden ist.

None 0

Macht keine Hostressourcen verfügbar.

SecurityInfrastructure 64

Macht die Sicherheitsinfrastruktur verfügbar.

SelfAffectingProcessMgmt 8

Beendet möglicherweise durch Beenden des Servers den aktuellen Prozess.

SelfAffectingThreading 32

Bearbeitet Threads so, dass nur Benutzercode beeinflusst wird.

SharedState 2

Macht den Zustand verfügbar, der möglicherweise von Threads gemeinsam verwendet wird.

Synchronization 1

Macht die Synchronisierung verfügbar.

UI 128

Macht die Benutzeroberfläche verfügbar.

Beispiele

Das folgende Codebeispiel zeigt die Verwendung der HostProtectionResource Enumeration mit dem HostProtectionAttribute Attribut. Dieses Beispiel ist Teil eines größeren Beispiels, das für die HostProtectionAttribute Klasse bereitgestellt wird.

// 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

Hinweise

Diese Enumeration wird vom HostProtectionAttribute Attribut verwendet.

Gilt für