HostProtectionResource Enumeración

Definición

Especifica categorías de funcionalidad potencialmente dañina para el host si lo invoca un método o una clase.Specifies categories of functionality potentially harmful to the host if invoked by a method or class.

Esta enumeración tiene el atributo FlagsAttribute, que permite una combinación bit a bit de sus valores de miembro.

public enum class HostProtectionResource
[System.Flags]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum HostProtectionResource
type HostProtectionResource = 
Public Enum HostProtectionResource
Herencia
HostProtectionResource
Atributos

Campos

All 511

Expone todos los recursos del host.Exposes all host resources.

ExternalProcessMgmt 4

Podría crear o destruir otros procesos.Might create or destroy other processes.

ExternalThreading 16

Crea o manipula los subprocesos distintos de los suyos propios, lo que podría ser dañino para el host.Creates or manipulates threads other than its own, which might be harmful to the host.

MayLeakOnAbort 256

Si no está protegido por un controlador seguro o algún otro medio para garantizar la liberación de recursos, se podría producir una pérdida de recursos al finalizar.Might cause a resource leak on termination, if not protected by a safe handle or some other means of ensuring the release of resources.

None 0

No expone ningún recurso del host.Exposes no host resources.

SecurityInfrastructure 64

Expone la infraestructura de seguridad.Exposes the security infrastructure.

SelfAffectingProcessMgmt 8

Podría salir del proceso actual, finalizando el servidor.Might exit the current process, terminating the server.

SelfAffectingThreading 32

Manipula los subprocesos de un modo que sólo afecta al código del usuario.Manipulates threads in a way that only affects user code.

SharedState 2

Expone el estado que se podría compartir entre los subprocesos.Exposes state that might be shared between threads.

Synchronization 1

Expone la sincronización.Exposes synchronization.

UI 128

Expone la interfaz de usuario.Exposes the user interface.

Ejemplos

En el ejemplo de código siguiente se muestra el HostProtectionResource uso de la HostProtectionAttribute enumeración con el atributo.The following code example shows the use of the HostProtectionResource enumeration with the HostProtectionAttribute attribute. Este ejemplo forma parte de un ejemplo más extenso proporcionado para HostProtectionAttribute la clase.This example is part of a larger example provided for the HostProtectionAttribute class.

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

Comentarios

Esta enumeración la usa el HostProtectionAttribute atributo.This enumeration is used by the HostProtectionAttribute attribute.

Se aplica a