MINIPORT_CANCEL_DIRECT_OID_REQUEST回调函数 (ndis.h)

NDIS 调用微型端口驱动程序的 MiniportCancelDirectOidRequest 函数来取消直接 OID 请求。

注意 必须使用 MINIPORT_CANCEL_DIRECT_OID_REQUEST 类型声明函数。 有关详细信息,请参阅以下示例部分。
 

语法

MINIPORT_CANCEL_DIRECT_OID_REQUEST MiniportCancelDirectOidRequest;

void MiniportCancelDirectOidRequest(
  [in] NDIS_HANDLE MiniportAdapterContext,
  [in] PVOID RequestId
)
{...}

参数

[in] MiniportAdapterContext

微型端口驱动程序在其 MiniportInitializeEx 函数中分配的上下文区域的句柄。 微型端口驱动程序使用此上下文区域来维护微型端口适配器的状态信息。

[in] RequestId

请求的取消标识符。 此标识符指定与 NDIS_OID_REQUEST 结构的 RequestId 成员中的此值匹配的直接 OID 请求。

返回值

没有

言论

MiniportCancelDirectOidRequest 是一个可选函数。 微型端口驱动程序在处理直接 OID 请求时注册此函数。 驱动程序在调用 时,驱动程序指定 MiniportCancelDirectOidRequest 入口点 NdisMRegisterMiniportDriver 函数。 注册 MiniportDirectOidRequest 函数还必须注册 MiniportCancelDirectOidRequest

当 NDIS 调用 MiniportCancelDirectOidRequest时,微型端口驱动程序应尝试调用 NdisMDirectOidRequestComplete 函数尽快。

当请求的发起方取消请求时,NDIS 调用 MiniportCancelDirectOidRequest。 对于直接 OID 请求,如果超时过期,NDIS 不会调用 MiniportCancelDirectOidRequest。 (超时是在每个 NDIS_OID_REQUEST 结构的 超时 成员处指定的。

如果请求处理在微型端口驱动程序中仍未完成,驱动程序将调用 NdisMDirectOidRequestComplete 函数,并将状态设置为NDIS_STATUS_REQUEST_ABORTED。

如果请求处理仍未在中间驱动程序中完成,并且请求已传播到基础驱动程序,则中间驱动程序将调用 NdisCancelDirectOidRequest 函数,OidRequest 参数设置为发送到基础驱动程序的值。

NDIS 在 IRQL <= DISPATCH_LEVEL 调用 MiniportCancelDirectOidRequest

示例

若要定义 MiniportCancelDirectOidRequest 函数,必须先提供用于标识要定义的函数类型的函数声明。 Windows 为驱动程序提供了一组函数类型。 使用函数类型声明函数有助于 驱动程序代码分析静态驱动程序验证程序(SDV)和其他验证工具查找错误,这是为 Windows作系统编写驱动程序的要求。

例如,若要定义名为“MyCancelDirectOidRequest”的 MiniportCancelDirectOidRequest 函数,请使用 MINIPORT_CANCEL_DIRECT_OID_REQUEST 类型,如以下代码示例所示:

MINIPORT_CANCEL_DIRECT_OID_REQUEST MyCancelDirectOidRequest;

然后,按如下所示实现函数:

_Use_decl_annotations_
VOID
 MyCancelDirectOidRequest(
    NDIS_HANDLE  MiniportAdapterContext,
    PVOID  RequestId
    )
  {...}

MINIPORT_CANCEL_DIRECT_OID_REQUEST 函数类型在 Ndis.h 头文件中定义。 若要在运行代码分析工具时更准确地识别错误,请务必将 Use_decl_annotations 注释添加到函数定义。 Use_decl_annotations 批注可确保使用应用于头文件中 MINIPORT_CANCEL_DIRECT_OID_REQUEST 函数类型的批注。 有关函数声明要求的详细信息,请参阅 使用 NDIS 驱动程序的函数角色类型声明函数。

有关 Use_decl_annotations的信息,请参阅 批注函数行为

要求

要求 价值
最低支持的客户端 NDIS 6.1 及更高版本中受支持。
目标平台 窗户
标头 ndis.h (包括 Ndis.h)
IRQL <= DISPATCH_LEVEL

另请参阅

MiniportDirectOidRequest

MiniportInitializeEx

NDIS_OID_REQUEST

NdisCancelDirectOidRequest

NdisMDirectOidRequestComplete

NdisMRegisterMiniportDriver