EVT_URS_SET_ROLE回调函数 (ursdevice.h)
当 URS 类扩展需要客户端驱动程序更改控制器的角色时,将调用此事件回调。
语法
EVT_URS_SET_ROLE EvtUrsSetRole;
NTSTATUS EvtUrsSetRole(
[in] WDFDEVICE Device,
[in] URS_ROLE Role
)
{...}
参数
[in] Device
客户端驱动程序在上一次调用 WdfDeviceCreate中检索到的框架设备对象的句柄。
[in] Role
一个 URS_ROLE 类型值,指示为控制器设备设置的角色。
返回值
如果作成功,回调函数必须返回STATUS_SUCCESS,或NT_SUCCESS(status) 等于 TRUE 的另一个状态值。 否则,它必须返回NT_SUCCESS(status)等于 FALSE 的状态值。
言论
若要注册客户端驱动程序的事件回调实现,驱动程序必须通过传递填充的结构将 URS_CONFIG 的 EvtUrsSetRole 成员设置为实现方法的函数指针,然后调用 UrsDeviceInitialize 方法。 驱动程序在为控制器创建框架设备对象后必须调用该方法。
例子
NTSTATUS
EvtUrsSetRole (
_In_ WDFDEVICE Device,
_In_ URS_ROLE Role
)
{
NTSTATUS status;
PFDO_CONTEXT fdoContext;
TRACE_FUNC_ENTRY(TRACE_FLAG);
TRY {
// Change the current role of the controller to the specified role.
// The driver might have stored the control registers in the device context.
// Read and write the register to get and set the current role.
}
TRACE_INFO(TRACE_FLAG, "[Device: 0x%p] Successfully set role to %!URS_ROLE!", Device, Role);
status = STATUS_SUCCESS;
} FINALLY {
}
TRACE_FUNC_EXIT(TRACE_FLAG);
return status;
}
要求
要求 | 价值 |
---|---|
最低支持的客户端 | Windows 10 |
支持的最低服务器 | Windows Server 2016 |
目标平台 | 窗户 |
最低 KMDF 版本 | 1.15 |
标头 | ursdevice.h (包括 Urscx.h) |
IRQL | PASSIVE_LEVEL |