RegistryPermission Classe
Definição
Cuidado
Code Access Security is not supported or honored by the runtime.
Controla a capacidade de acessar variáveis de Registro.Controls the ability to access registry variables. Essa classe não pode ser herdada.This class cannot be inherited.
public ref class RegistryPermission sealed : System::Security::CodeAccessPermission, System::Security::Permissions::IUnrestrictedPermission
public sealed class RegistryPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public sealed class RegistryPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission
[System.Serializable]
public sealed class RegistryPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class RegistryPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission
type RegistryPermission = class
inherit CodeAccessPermission
interface IUnrestrictedPermission
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type RegistryPermission = class
inherit CodeAccessPermission
interface IUnrestrictedPermission
[<System.Serializable>]
type RegistryPermission = class
inherit CodeAccessPermission
interface IUnrestrictedPermission
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type RegistryPermission = class
inherit CodeAccessPermission
interface IUnrestrictedPermission
Public NotInheritable Class RegistryPermission
Inherits CodeAccessPermission
Implements IUnrestrictedPermission
- Herança
- Atributos
- Implementações
Comentários
RegistryPermission Descreve as operações protegidas em variáveis de registro.RegistryPermission describes protected operations on registry variables. As variáveis de Registro não devem ser armazenadas em locais de memória em que o código sem RegistryPermission possa acessá-los.Registry variables should not be stored in memory locations where code without RegistryPermission can access them. Se o objeto do registro for passado para um chamador não confiável, ele poderá ser usado.If the registry object is passed to an untrusted caller it can be misused.
Os tipos de acesso de registro permitidos são definidos pelo RegistryPermissionAccess .The allowed registry access types are defined by RegistryPermissionAccess. Se mais de um tipo de acesso for desejado, eles poderão ser combinados usando a operação OR bit a bit, conforme mostrado no exemplo de código a seguir.If more than one type of access is desired, they can be combined using the bitwise OR operation as shown in the code sample that follows.
A permissão de registro é definida em termos de caminhos absolutos canônicos; as verificações sempre devem ser feitas com caminhos canônicos.Registry permission is defined in terms of canonical absolute paths; checks should always be made with canonical pathnames. O acesso à chave implica o acesso a todos os valores que ele contém e todas as variáveis sob ele.Key access implies access to all values it contains and all variables under it.
Observação
Nas versões do .NET Framework antes do .NET Framework 4, você poderia usar o CodeAccessPermission.Deny método para impedir o acesso inadvertido aos recursos do sistema por código confiável.In versions of the .NET Framework before the .NET Framework 4, you could use the CodeAccessPermission.Deny method to prevent inadvertent access to system resources by trusted code. Deny Agora é obsoleto, e o acesso aos recursos agora é determinado exclusivamente pelo conjunto de permissões concedidas para um assembly.Deny is now obsolete, and access to resources is now determined solely by the granted permission set for an assembly. Para limitar o acesso a arquivos, você deve executar código parcialmente confiável em uma área restrita e atribuir permissões a ele somente a recursos que o código tem permissão para acessar.To limit access to files, you must run partially trusted code in a sandbox and assign it permissions only to resources that the code is allowed to access. Para obter informações sobre como executar um aplicativo em uma área restrita, consulte como: executar código parcialmente confiável em uma área restrita.For information about running an application in a sandbox, see How to: Run Partially Trusted Code in a Sandbox.
Construtores
| RegistryPermission(PermissionState) |
Inicializa uma nova instância da classe RegistryPermission com permissão irrestrita ou totalmente restrita, conforme especificado.Initializes a new instance of the RegistryPermission class with either fully restricted or unrestricted permission as specified. |
| RegistryPermission(RegistryPermissionAccess, AccessControlActions, String) |
Inicializa uma nova instância da classe RegistryPermission com o acesso especificado às variáveis de Registro especificadas e os direitos de acesso especificados nas informações de controle do Registro.Initializes a new instance of the RegistryPermission class with the specified access to the specified registry variables and the specified access rights to registry control information. |
| RegistryPermission(RegistryPermissionAccess, String) |
Inicializa uma nova instância da classe RegistryPermission com o acesso especificado às variáveis de Registro especificadas.Initializes a new instance of the RegistryPermission class with the specified access to the specified registry variables. |
Métodos
| AddPathList(RegistryPermissionAccess, AccessControlActions, String) |
Adiciona acesso às variáveis de Registro especificadas ao estado existente da permissão, especificando a permissão de acesso ao Registro e as ações de controle de acesso.Adds access for the specified registry variables to the existing state of the permission, specifying registry permission access and access control actions. |
| AddPathList(RegistryPermissionAccess, String) |
Adiciona o acesso para as variáveis de Registro especificadas para o estado existente da permissão.Adds access for the specified registry variables to the existing state of the permission. |
| Assert() |
Declara que o código de chamada pode acessar o recurso protegido por uma demanda de permissão através do código que chama este método, mesmo que os chamadores na pilha não tenham recebido permissão para acessar o recurso.Declares that the calling code can access the resource protected by a permission demand through the code that calls this method, even if callers higher in the stack have not been granted permission to access the resource. Usar Assert() pode criar problemas de segurança.Using Assert() can create security issues. (Herdado de CodeAccessPermission) |
| Copy() |
Cria e retorna uma cópia idêntica da permissão atual.Creates and returns an identical copy of the current permission. |
| Demand() |
Força um SecurityException no tempo de execução se todos os chamadores no topo da pilha de chamadas não receberam as permissões especificadas pela instância atual.Forces a SecurityException at run time if all callers higher in the call stack have not been granted the permission specified by the current instance. (Herdado de CodeAccessPermission) |
| Deny() |
Obsoleto.
Obsoleto.
Impede que os chamadores no nível superior da pilha de chamadas usem o código que chama esse método para acessar o recurso especificado pela instância atual.Prevents callers higher in the call stack from using the code that calls this method to access the resource specified by the current instance. (Herdado de CodeAccessPermission) |
| Equals(Object) |
Determina se o objeto CodeAccessPermission especificado é igual ao CodeAccessPermission atual.Determines whether the specified CodeAccessPermission object is equal to the current CodeAccessPermission. (Herdado de CodeAccessPermission) |
| FromXml(SecurityElement) |
Reconstrói um a permissão com um estado especificado de uma codificação XML.Reconstructs a permission with a specified state from an XML encoding. |
| GetHashCode() |
Obtém um código hash para o objeto CodeAccessPermission atual, adequado para algoritmos de hash e estruturas de dados, tais como uma tabela de hash.Gets a hash code for the CodeAccessPermission object that is suitable for use in hashing algorithms and data structures such as a hash table. (Herdado de CodeAccessPermission) |
| GetPathList(RegistryPermissionAccess) |
Obtém os caminhos para todas as variáveis do Registro com o RegistryPermissionAccess especificado.Gets paths for all registry variables with the specified RegistryPermissionAccess. |
| GetType() |
Obtém o Type da instância atual.Gets the Type of the current instance. (Herdado de Object) |
| Intersect(IPermission) |
Cria e retorna uma permissão que é a interseção de permissão atual e da permissão especificada.Creates and returns a permission that is the intersection of the current permission and the specified permission. |
| IsSubsetOf(IPermission) |
Determina se a permissão atual é um subconjunto da permissão especificada.Determines whether the current permission is a subset of the specified permission. |
| IsUnrestricted() |
Retorna um valor que indica se a permissão atual é irrestrita.Returns a value indicating whether the current permission is unrestricted. |
| MemberwiseClone() |
Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object. (Herdado de Object) |
| PermitOnly() |
Impede que os chamadores no topo da pilha de chamadas usem o código que chama esse método para acessar todos os recursos, com exceção do recurso especificado pela instância atual.Prevents callers higher in the call stack from using the code that calls this method to access all resources except for the resource specified by the current instance. (Herdado de CodeAccessPermission) |
| SetPathList(RegistryPermissionAccess, String) |
Define um novo acesso para os nomes das variáveis de Registro especificados para o estado existente da permissão.Sets new access for the specified registry variable names to the existing state of the permission. |
| ToString() |
Cria e retorna uma representação de cadeia de caracteres do objeto de permissão atual.Creates and returns a string representation of the current permission object. (Herdado de CodeAccessPermission) |
| ToXml() |
Cria uma codificação XML da permissão e de seu estado atual.Creates an XML encoding of the permission and its current state. |
| Union(IPermission) |
Cria uma permissão que é a união entre a permissão atual e a permissão especificada.Creates a permission that is the union of the current permission and the specified permission. |
Implantações explícitas de interface
| IPermission.Demand() |
Gera um SecurityException em tempo de execução se o requisito de segurança não é atendido.Throws a SecurityException at run time if the security requirement is not met. (Herdado de CodeAccessPermission) |
| IStackWalk.Assert() |
Declara que código de chamada pode acessar o recurso identificado pelo objeto de permissão atual, mesmo que os chamadores na pilha não tenham recebido permissão para acessar o recurso.Asserts that the calling code can access the resource identified by the current permission object, even if callers higher in the stack have not been granted permission to access the resource. (Herdado de CodeAccessPermission) |
| IStackWalk.Demand() |
Determina em tempo de execução se a permissão especificada pelo objeto de permissão atual foi ou não concedida a todos os chamadores na pilha de chamadas.Determines at run time whether all callers in the call stack have been granted the permission specified by the current permission object. (Herdado de CodeAccessPermission) |
| IStackWalk.Deny() |
Faz com que cada Demand() para o objeto atual que passa pelo código de chamada falhe.Causes every Demand() for the current object that passes through the calling code to fail. (Herdado de CodeAccessPermission) |
| IStackWalk.PermitOnly() |
Causa a falha de cada Demand() de todos os objetos que passam pelo código de chamada, exceto o atual, mesmo que o código superior na pilha de chamadas tenha recebido permissão para acessar outros recursos.Causes every Demand() for all objects except the current one that pass through the calling code to fail, even if code higher in the call stack has been granted permission to access other resources. (Herdado de CodeAccessPermission) |