使用 WSD 质询器质询断开连接的扫描仪Challenging a Disconnected Scanner with the WSD Challenger

重要

WSD 占领功能已弃用,将在 2018年中删除所有与 WSD 占领相关文档。WSD Challenger functionality has been deprecated and all WSD Challenger-related documentation will be removed in 2018.

Web 服务扫描程序驱动程序可以质询已断开连接的扫描程序以与设备重新建立通信,扫描程序重新联机时。A web services scanner driver can challenge a disconnected scanner to reestablish communication with the device when the scanner comes back online. 质询已断开连接的扫描程序,则驱动程序使用 WSD 占领 DLL (WSDCHNGR.DLL) 提供与 Windows Vista。To challenge a disconnected scanner, the driver uses the WSD Challenger DLL (WSDCHNGR.DLL) that is provided with Windows Vista. Windows 图像采集 (WIA) 服务还使用WSDCHNGR.DLL来主动监视所有 WSDScan 扫描程序设备并启用驱动程序来响应设备通信发生故障之后的一项挑战。The Windows Image Acquisition (WIA) Service also uses WSDCHNGR.DLL to actively monitor all WSDScan scanner devices and enable drivers to respond to a challenge following a device communication failure.

由启动某类设备的难题WSDCHNGRChallengeDeviceClass WSD 质询函数。The challenge for a class of devices is initiated by the WSDCHNGRChallengeDeviceClass WSD Challenge function. WIA 驱动程序通常无需直接调用此函数,因为 WIA 服务进行的调用 WIA 的所有设备。A WIA driver typically does not have to directly call this function because the WIA service calls it for all WIA devices.

它支持的设备已断开连接后不久,WIA 驱动程序被卸载,因为不能保持驱动程序本身WSDCHNGR.DLL加载。Because a WIA driver is unloaded shortly after the device that it supports is disconnected, the driver itself cannot keep WSDCHNGR.DLL loaded. 该驱动程序,因此,无法继续监视 WSD 具有挑战性,并且无法重新连接到设备重新联机时。The driver, therefore, cannot continue monitoring WSD challenging and cannot reconnect to the device when it comes back online. 相反,通过使用安装的 WIA 驱动程序WSDScan.sys内核模式驱动程序可以使用 WIA 服务质询的设备类和启用的具有挑战性的监视以卸载该驱动程序后继续。Instead, WIA drivers that are installed by using the WSDScan.sys kernel-mode driver can use the WIA service to challenge the device class and enable the challenging of monitoring to continue after the driver is unloaded.

通常情况下,一个正在使用的 WIA 驱动程序才能WSDScan.sys使用仅以下 WSD 占领函数:Typically, a WIA driver that is using WSDScan.sys uses only the following WSD Challenger functions:

WSDCHNGRInitializeWSDCHNGRInitialize
初始化 WIA 驱动程序客户端使用的 WSD 占领接口。Initializes the WSD Challenger interface that the WIA driver client uses. 加载驱动程序,请调用此函数。Call this function when the driver is loaded.

WSDCHNGRShutdownWSDCHNGRShutdown
关闭 WIA 驱动程序客户端使用的 WSD 占领接口。Shuts down the WSD Challenger interface that the WIA driver client uses. 卸载该驱动程序时,请调用此函数。Call this function when the driver is unloaded.

请注意   WIA 服务在此关闭情况下,如果设备是 WSDScan 类设备,继续运行 WSD 质询监视设备后驱动程序已被卸载并终止其 web 服务的挑战接口.Note   When this shutdown happens, if the device is a WSDScan-class device, the WIA service continues to run WSD challenge monitoring for the device after the driver has been unloaded and terminated its web services Challenge interface.

WSDCHNGRRegisterDeviceToChallengeWSDCHNGRRegisterDeviceToChallenge
注册设备质询。Registers the device to be challenged. 调用此函数后,驱动程序在遇到任何潜在的通信失败。Call this function after the driver encounters any potential communication failure. 同一个设备可以多次注册质询。The same device can be registered for a challenge more than once. WSDCHNGRRegisterDeviceToChallenge返回 S_如果成功注册第一台设备,确定。WSDCHNGRRegisterDeviceToChallenge returns S_OK if the first device is registered successfully. 此函数将返回 S_FALSE 时调用的设备的已注册为又一个难题。This function returns S_FALSE when it is called for a device that is already registered to be challenged.

下面的代码示例演示如何使用这些 WSD 质询函数来初始化 WSD 占领以及如何注册适用于潜在的通信发生故障后具有挑战性的扫描程序设备:The following code examples show how to use these WSD Challenge functions to initialize the WSD Challenger and how to register the scanner device for challenging after potential communication failures:

若要筛选错误代码的宏示例Macro Example to Filter Error Codes

针对具有挑战性可能断开连接的设备的代码示例Code Example for Challenging a Potentially Disconnected Device

实现帮助器方法的代码示例Code Example for Implementing Helper Methods

有关定义和这些示例中使用的变量的详细信息,请参阅定义和示例中使用变量For more information about the definitions and variables that are used in these examples, see Definitions and Variables Used in the Examples.