type_strict_context_handle 属性

在 ACF 文件中使用 [type_strict_context_handle] 可设置对上下文句柄的限制。

[ 
    type_strict_context_handle 
    [, interface-attribute-list] 
] 
interface interface-name
{
    interface-definition-statements
}

parameters

interface-attribute-list

应用于接口的其他 ACF 属性作为一个整体。 有效属性包括 auto_handleimplicit_handleexplicit_handle优化代码nocode。 用逗号分隔多个属性。

interface-name

接口的名称。

interface-definition-statements

一个或多个用于定义 接口元素的 MIDL 语句。

备注

若要使用此属性,在运行 midl.exe 时,必须将 -target 标志设置为 NT60 (或更高版本) 。

[type_strict_context_handle] 是 [strict_context_handle] 的功能超集。 在 [strict_context_handle]中,句柄的类型 ID 始终为 0;[type_strict_context_handle]中,MIDL 编译器分配唯一的类型 ID。

建议使用 [type_strict_context_handle] 而不是 [strict_context_handle]。 默认情况下,上下文句柄不与特定类型关联。 在同一进程中使用多种类型的上下文句柄时,恶意客户端可能会传递上下文句柄来代替另一个上下文句柄,从而产生不良结果。 使用 [type_strict_context_handle] 允许应用程序强制实施上下文句柄类型一致性,并防止任何不匹配的上下文句柄类型用法。

使用 [type_strict_context_handle] 特性化上下文句柄也不能通过 [strict_context_handle] 进行特性化。

另请参阅

应用程序配置文件 (ACF)

代码

上下文句柄

context_handle_serialize

context_handle_noserialize

explicit_handle

implicit_handle

nocode

优化

strict_context_handle