UIPermission 类

定义

控制与用户界面和剪贴板相关的权限。Controls the permissions related to user interfaces and the Clipboard. 此类不能被继承。This class cannot be inherited.

public ref class UIPermission sealed : System::Security::CodeAccessPermission, System::Security::Permissions::IUnrestrictedPermission
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public sealed class UIPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission
type UIPermission = class
    inherit CodeAccessPermission
    interface IUnrestrictedPermission
Public NotInheritable Class UIPermission
Inherits CodeAccessPermission
Implements IUnrestrictedPermission
继承
属性
实现

注解

Windows 中的绘图和用户输入事件是用户界面。Drawing and user input events in windows are user interfaces.

使用 windows 的权限可以是以下项之一: "无限制"、" SafeTopLevelWindows仅限SafeSubWindows"、"仅限" 或 "不允许的窗口绘制" 或 "用户输入事件访问"。The permission to use windows can be one of the following: unrestricted, limited to SafeTopLevelWindows, only SafeSubWindows, or no window drawing or user input event access allowed. SafeTopLevelWindowsSafeSubWindows将限制为标题和大小,以防止可能存在有害代码的欺骗。SafeTopLevelWindows and SafeSubWindows are restricted in title and size to prevent possible spoofing by potentially harmful code.

使用剪贴板的权限可以是以下项之一:无限制、只写或不允许剪贴板访问。The permission to use the Clipboard can be one of the following: unrestricted, write-only, or no Clipboard access allowed. 粘贴限制可防止潜在有害的应用程序在没有用户同意的情况下从剪贴板获取数据,同时在用户通过键盘命令启动时仍允许剪切、复制和粘贴操作。The paste limitation prevents potentially harmful applications from taking data from the Clipboard without the user's consent, while still allowing the cut, copy, and paste operations when initiated by the user through keyboard commands.

构造函数

UIPermission(PermissionState)

初始化 UIPermission 类的新实例,该实例可根据指定具有完全受限制的访问权限或不受限制的访问权限。Initializes a new instance of the UIPermission class with either fully restricted or unrestricted access, as specified.

UIPermission(UIPermissionClipboard)

在具有使用剪贴板的权限,但没有对窗口的访问权限的情况下,初始化 UIPermission 类的新实例。Initializes a new instance of the UIPermission class with the permissions for the Clipboard, and no access to windows.

UIPermission(UIPermissionWindow)

在具有使用窗口的权限,但没有对剪贴板的访问权限的情况下,初始化 UIPermission 类的新实例。Initializes a new instance of the UIPermission class with the permissions for windows, and no access to the Clipboard.

UIPermission(UIPermissionWindow, UIPermissionClipboard)

用指定的窗口和剪贴板权限初始化 UIPermission 类的新实例。Initializes a new instance of the UIPermission class with the specified permissions for windows and the Clipboard.

属性

Clipboard

获取或设置由该权限表示的剪贴板访问权限。Gets or sets the Clipboard access represented by the permission.

Window

获取或设置由该权限表示的窗口访问权限。Gets or sets the window access represented by the permission.

方法

Assert()

声明调用代码能够通过调用此方法的代码,访问受权限请求保护的资源,即使未对堆栈中处于较高位置的调用方授予访问该资源的权限。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. 使用 Assert() 会引起安全问题。Using Assert() can create security issues.

(继承自 CodeAccessPermission)
Copy()

创建并返回当前权限的相同副本。Creates and returns an identical copy of the current permission.

Demand()

如果未对调用堆栈中处于较高位置的所有调用方授予当前实例所指定的权限,则在运行时强制 SecurityExceptionForces a SecurityException at run time if all callers higher in the call stack have not been granted the permission specified by the current instance.

(继承自 CodeAccessPermission)
Deny()

防止处于调用堆栈较高位置的调用函数使用可以调用此方法来访问当前实例指定资源的代码。Prevents callers higher in the call stack from using the code that calls this method to access the resource specified by the current instance.

(继承自 CodeAccessPermission)
Equals(Object)

确定指定的 CodeAccessPermission 对象是否等于当前的 CodeAccessPermissionDetermines whether the specified CodeAccessPermission object is equal to the current CodeAccessPermission.

(继承自 CodeAccessPermission)
FromXml(SecurityElement)

从 XML 编码重新构造具有指定状态的权限。Reconstructs a permission with a specified state from an XML encoding.

GetHashCode()

获取 CodeAccessPermission 对象的哈希代码,此代码适合在哈希算法和数据结构(例如哈希表)中使用。Gets a hash code for the CodeAccessPermission object that is suitable for use in hashing algorithms and data structures such as a hash table.

(继承自 CodeAccessPermission)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
Intersect(IPermission)

创建并返回一个权限,该权限是当前权限与指定权限的交集。Creates and returns a permission that is the intersection of the current permission and the specified permission.

IsSubsetOf(IPermission)

确定当前权限是否为指定权限的子集。Determines whether the current permission is a subset of the specified permission.

IsUnrestricted()

返回一个值,该值指示当前权限是否不受限制。Returns a value indicating whether the current permission is unrestricted.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
PermitOnly()

防止处于调用堆栈较高位置的调用函数使用此代码,此代码将调用此方法来访问除当前实例指定的资源以外的所有资源。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.

(继承自 CodeAccessPermission)
ToString()

创建并返回当前权限对象的字符串表示形式。Creates and returns a string representation of the current permission object.

(继承自 CodeAccessPermission)
ToXml()

创建权限及其当前状态的 XML 编码。Creates an XML encoding of the permission and its current state.

Union(IPermission)

创建一个权限,该权限是当前权限和指定权限的并集。Creates a permission that is the union of the permission and the specified permission.

显式界面实现

IPermission.Demand() (继承自 CodeAccessPermission)
IStackWalk.Assert() (继承自 CodeAccessPermission)
IStackWalk.Demand() (继承自 CodeAccessPermission)
IStackWalk.Deny() (继承自 CodeAccessPermission)
IStackWalk.PermitOnly() (继承自 CodeAccessPermission)

适用于

另请参阅