[go: up one dir, main page]

CN106656916A - Device and method for switching redirection mode in real time in desktop cloud scene - Google Patents

Device and method for switching redirection mode in real time in desktop cloud scene Download PDF

Info

Publication number
CN106656916A
CN106656916A CN201510725296.8A CN201510725296A CN106656916A CN 106656916 A CN106656916 A CN 106656916A CN 201510725296 A CN201510725296 A CN 201510725296A CN 106656916 A CN106656916 A CN 106656916A
Authority
CN
China
Prior art keywords
interface
redirection
virtual machine
smart card
equipment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510725296.8A
Other languages
Chinese (zh)
Other versions
CN106656916B (en
Inventor
郑强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Cloud Computing Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201510725296.8A priority Critical patent/CN106656916B/en
Publication of CN106656916A publication Critical patent/CN106656916A/en
Application granted granted Critical
Publication of CN106656916B publication Critical patent/CN106656916B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0853Network architectures or network communication protocols for network security for authentication of entities using an additional device, e.g. smartcard, SIM or a different communication terminal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/08Protocols specially adapted for terminal emulation, e.g. Telnet
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Stored Programmes (AREA)
  • Computer And Data Communications (AREA)

Abstract

本发明涉及一种桌面云场景下实时切换智能卡重定向的方法及装置,所述方法包括:在设备接口层重定向方式下,应用模块调用与所述设备状态变化相关的接口,并在该接口阻塞时,保存与该接口相应的上下文内容;基于所述虚拟机的断开,应用钩子模块根据所述上下文内容释放所述阻塞接口,并构造该设备不在位状态的消息通知;基于所述虚拟机的连接,所述应用钩子模块将该设备重定向方式切换至API重定向。本发明解决了系统由切换重定向方式所带来系统异常的问题,提升了用户在桌面云场景下使用智能卡的体验,能够应用于桌面云场景中。

The present invention relates to a method and device for real-time switching of smart card redirection in a desktop cloud scene. The method includes: in the redirection mode of the device interface layer, the application module calls the interface related to the state change of the device, and in the interface When blocking, save the context content corresponding to the interface; based on the disconnection of the virtual machine, the application hook module releases the blocked interface according to the context content, and constructs a message notification that the device is not in place; based on the virtual machine machine connection, the application hook module switches the device redirection mode to API redirection. The invention solves the problem of system abnormality caused by switching redirection mode of the system, improves the user's experience of using the smart card in the desktop cloud scene, and can be applied in the desktop cloud scene.

Description

一种桌面云场景下实时切换重定向方式的装置及方法Device and method for real-time switching of redirection mode in desktop cloud scene

技术领域technical field

本发明涉及通信技术领域,尤其涉及重定向方法及装置。The invention relates to the field of communication technology, in particular to a redirection method and device.

背景技术Background technique

在桌面云的安全场景下,用户需要在虚拟机中使用智能卡用于认证,比如使用智能卡(Smart Card)用于虚拟机的登录。目前通用的技术是将客户端的智能卡重定向到虚拟机中使用,常用的重定向方式有设备接口层重定向和API(应用程序编程接口)重定向,设备接口层重定向主要包括总线重定向以及串口重定向、并口重定向等相应设备接口层的重定向。In the security scenario of the desktop cloud, the user needs to use a smart card in the virtual machine for authentication, such as using a smart card (Smart Card) for logging in to the virtual machine. At present, the common technology is to redirect the smart card of the client to the virtual machine for use. The commonly used redirection methods include device interface layer redirection and API (application programming interface) redirection. The device interface layer redirection mainly includes bus redirection and Serial port redirection, parallel port redirection and other corresponding device interface layer redirection.

设备接口层重定向和API重定向两种重定向方式各有优缺点,设备接口层重定向方式可以支持非PC/SC规范的智能卡重定向,API重定向方式可以满足在客户端和虚拟机同时使用智能卡的需求。用户需要根据不同的需求选择相应的重定向方式,有时也需要两种重定向方式相互切换使用。Device interface layer redirection and API redirection have their own advantages and disadvantages. The device interface layer redirection method can support non-PC/SC standard smart card redirection, and the API redirection method can meet the requirements of both the client and the virtual machine. Requirements for using smart cards. Users need to choose the corresponding redirection method according to different needs, and sometimes they need to switch between the two redirection methods.

在现有技术中,设备接口层重定向和API重定向由两个独立模块来实现。图1是现有技术中的设备接口层重定向方法示意图,其中,协议客户端101、协议服务端102、虚拟USB驱动模块103、虚拟USB驱动模块104是需要协议厂商实现的模块。In the prior art, device interface layer redirection and API redirection are implemented by two independent modules. 1 is a schematic diagram of a device interface layer redirection method in the prior art, wherein the protocol client 101, the protocol server 102, the virtual USB driver module 103, and the virtual USB driver module 104 are modules that need to be implemented by the protocol manufacturer.

图1中,在使用设备接口层重定向时,对智能卡的消息处理方法如下:In Figure 1, when using device interface layer redirection, the message processing method for the smart card is as follows:

步骤1~4,应用模块发起消息,该消息经传递到协议厂商实现的虚拟USB驱动模块;Steps 1-4, the application module initiates a message, and the message is delivered to the virtual USB driver module implemented by the protocol manufacturer;

步骤5,虚拟USB驱动模块将该消息转发给协议服务端的传输模块;Step 5, the virtual USB driver module forwards the message to the transmission module of the protocol server;

步骤6,该消息经过使用厂商定义的桌面云协议,再通过网络传输;Step 6, the message is transmitted through the network through the desktop cloud protocol defined by the manufacturer;

步骤7,该消息到达协议客户端后交给客户端的虚拟USB驱动模块;Step 7, after the message arrives at the protocol client, it is handed over to the virtual USB driver module of the client;

步骤8~10,客户端的虚拟USB驱动模块将消息传递下去,最后由客户端的智能卡设备处理该消息并给出回应;Steps 8-10, the client's virtual USB driver module passes the message down, and finally the client's smart card device processes the message and gives a response;

步骤11~20,智能卡设备处理后回应消息,最后该消息回到应用模块。In steps 11-20, the smart card device responds to the message after processing, and finally the message is returned to the application module.

图2是现有技术中的API重定向方法示意,其中,协议客户端、协议服务端、智能卡资源管理器、app hook模块是需要协议厂商实现的模块。Fig. 2 is a schematic diagram of an API redirection method in the prior art, wherein the protocol client, the protocol server, the smart card resource manager, and the app hook module are modules that need to be implemented by the protocol manufacturer.

图2中,在使用API重定向时,对智能卡的消息处理方法如下:In Figure 2, when API redirection is used, the message processing method for the smart card is as follows:

步骤21~22,应用模块发起消息,该消息传递到协议厂商实现的app hook模块(应用注入模块);Steps 21-22, the application module initiates a message, and the message is delivered to the app hook module (application injection module) implemented by the protocol manufacturer;

步骤23,app hook模块将该消息转发给协议服务端的传输模块;Step 23, the app hook module forwards the message to the transmission module of the protocol server;

步骤24,该消息经过使用厂商定义的桌面云协议通过网络传输;Step 24, the message is transmitted through the network using the desktop cloud protocol defined by the manufacturer;

步骤25,该消息到达协议客户端后交给客户端的智能卡资源管理器;Step 25, after the message arrives at the protocol client, it is handed over to the smart card resource manager of the client;

步骤26~29,智能卡资源管理器将该消息传递下去,最后由客户端的智能卡设备处理该消息并给出回应;Steps 26-29, the smart card resource manager transmits the message, and finally the client's smart card device processes the message and gives a response;

步骤30~38,智能卡设备处理后回应消息,最后该消息回到应用模块。In steps 30-38, the smart card device responds to the message after processing, and finally the message is returned to the application module.

上述两种重定向方式实质上都是在不同层次的消息栈上将消息进行截获并转发,不论采用哪种重定向方式,虚拟机的应用与智能卡资源管理器的SCard API(智能卡API)都是固定的。应用模块在使用智能卡时,通常有以下几种消息的调用:The above two redirection methods are essentially intercepting and forwarding messages on message stacks at different levels. No matter which redirection method is used, the application of the virtual machine and the SCard API (smart card API) of the smart card resource manager are the same. stable. When an application module uses a smart card, it usually calls the following messages:

1)应用模块调用SCardEstablishContext接口建立context(上下文),后续接口的调用都使用到这个context;1) The application module calls the SCardEstablishContext interface to establish a context (context), which is used in subsequent interface calls;

2)应用模块调用SCardListCards接口和Scardlistreaders接口获取可用的读卡器信息;2) The application module calls the SCardListCards interface and the Scardlistreaders interface to obtain available card reader information;

3)应用模块调用SCardGetStatusChange接口查询智能卡状态,如果入参timeout参数为-1,此接口会阻塞直到卡的状态发生变化(比如由在位到不在位或者不在位变为在位),这种情况下应用模块通常会启用两个及以上的线程,其中一个线程一直阻塞用于查询状态,其它线程做相应的读写卡操作;3) The application module calls the SCardGetStatusChange interface to query the status of the smart card. If the input timeout parameter is -1, this interface will be blocked until the card status changes (for example, from in-position to out-of-position or out-of-position to in-position). In this case The lower application module usually enables two or more threads, one of which is always blocked for querying the status, and the other threads do corresponding card reading and writing operations;

4)如果智能卡在位可操作,应用模块调用SCardConnect接口进行连接智能卡操作;4) If the smart card is in place and operable, the application module calls the SCardConnect interface to connect to the smart card;

5)应用模块调用SCardTransmit接口进行传输数据;5) The application module calls the SCardTransmit interface to transmit data;

6)数据传输完后,应用模块调用SCardDisconnect接口释放连接;6) After the data transmission, the application module calls the SCardDisconnect interface to release the connection;

7)应用模块调用SCardFreeMemory接口释放内存;7) The application module calls the SCardFreeMemory interface to release the memory;

8)应用模块调用SCardReleaseContext接口释放context结束操作;8) The application module calls the SCardReleaseContext interface to release the context and end the operation;

在现有技术中,设备接口层重定向和API重定向是由两个独立的模块来实现的,从一种重定向方式切换到另一种重定向方式时,往往需要重启应用进程。然而对于系统进程比如Windows的winlogon进程、LogonUI进程等,重启应用进程会导致系统异常,甚至出现蓝屏。因此,在现有的技术方案中,如果要切换重定向方式,就需要重启操作系统,还需要用户修改虚拟机中的文件或者修改注册表项,并且还需要重启虚拟机才能够生效,影响使用效率和用户操作体验。In the prior art, device interface layer redirection and API redirection are implemented by two independent modules. When switching from one redirection method to another redirection method, it is often necessary to restart the application process. However, for system processes such as Windows winlogon process, LogonUI process, etc., restarting the application process will cause system exceptions, or even a blue screen. Therefore, in the existing technical solutions, if you want to switch the redirection mode, you need to restart the operating system, and you need to modify the files in the virtual machine or modify the registry entries, and you need to restart the virtual machine to take effect, which affects the use. efficiency and user experience.

发明内容Contents of the invention

本发明提供了一种桌面云场景下实时切换重定向方式的装置及方法,以提高用户体验。The present invention provides a device and method for switching redirection modes in real time in a desktop cloud scene, so as to improve user experience.

在第一方面,本发明提供了一种重定向方式切换方法且该重定向方式是将客户端中的设备重定向至虚拟机。该方法在设备接口层重定向方式下,应用模块调用与该设备状态变化相关的接口,并在该接口阻塞时,保存与该接口相应的上下文内容。然后基于虚拟机的断开,应用钩子模块根据该上下文内容释放该阻塞接口,并构造该设备不在位状态的消息通知。最后基于虚拟机的连接,应用钩子模块将设备重定向方式切换至API重定向。In the first aspect, the present invention provides a redirection mode switching method, and the redirection mode is to redirect a device in a client to a virtual machine. In the method, in the redirection mode of the device interface layer, the application module calls the interface related to the state change of the device, and when the interface is blocked, the context content corresponding to the interface is saved. Then, based on the disconnection of the virtual machine, the application hook module releases the blocking interface according to the context content, and constructs a message notification of the device being out of position. Finally, based on the connection of the virtual machine, the application hook module switches the device redirection mode to API redirection.

在第二方面,本发明提供了一种重定向方式切换方法,且该重定向方式是将客户端中的设备重定向至虚拟机。该方法在API重定向方式下,应用模块调用与该设备状态变化相关的接口,并在该接口需要阻塞时,应用钩子模块阻塞该接口。然后应用钩子模块轮询,以查询该设备状态变化情况,并在该设备状态发生变化时,释放该阻塞接口。基于虚拟机的断开,构造该设备不在位的消息通知。最后基于虚拟机的连接,应用钩子模块将设备重定向方式切换至设备接口层重定向。In the second aspect, the present invention provides a redirection mode switching method, and the redirection mode is to redirect a device in a client to a virtual machine. In the method, in the API redirection mode, the application module invokes an interface related to the state change of the device, and when the interface needs to be blocked, the application hook module blocks the interface. Then the hook module is used to poll to inquire about the state change of the device, and when the state of the device changes, the blocking interface is released. Based on the disconnection of the virtual machine, a message notification that the device is not in place is constructed. Finally, based on the connection of the virtual machine, the application hook module switches the device redirection mode to device interface layer redirection.

在第三方面,本发明提供了一种重定向切换装置,且该重定向方式是将客户端中的设备重定向至虚拟机。该虚拟机包括应用钩子模块、应用模块。该应用模块在设备接口层重定向方式下用于调用与该设备状态变化相关的接口。该应用钩子模块用于在该与设备变化状态相关接口阻塞时,保存与该接口相应的上下文内容;以及在虚拟机断开情况下,根据该上下文内容释放该阻塞接口,构造该设备不在位状态的消息通知。并在连接该虚拟机后,将设备重定向方式切换至API重定向。In a third aspect, the present invention provides a redirection switching device, and the redirection method is to redirect a device in a client to a virtual machine. The virtual machine includes an application hook module and an application module. The application module is used to call the interface related to the state change of the device in the redirection mode of the device interface layer. The application hook module is used to save the context content corresponding to the interface when the interface related to the device changing state is blocked; and when the virtual machine is disconnected, release the blocked interface according to the context content, and construct the device out-of-position state message notification. And after connecting to the virtual machine, switch the device redirection method to API redirection.

在第四方面,本发明提供了一种重定向切换装置,且该重定向方式是将客户端中的设备重定向至虚拟机。该虚拟机包括应用钩子模块、应用模块。该应用模块在API重定向方式下用于调用与该设备状态变化相关的接口。该应用钩子模块用于在该与设备变化状态相关接口需要阻塞时阻塞该接口。以及用于轮询,以查询该设备状态变化情况,并在该设备状态发生变化时,释放所述被阻塞接口。以及在虚拟机断开时构造该设备不在位的消息通知;并用于在连接该虚拟机后,将设备重定向方式切换至设备接口层重定向。In a fourth aspect, the present invention provides a redirection switching device, and the redirection method is to redirect a device in a client to a virtual machine. The virtual machine includes an application hook module and an application module. The application module is used in the API redirection mode to call the interface related to the state change of the device. The application hook module is used for blocking the interface related to the device state change when the interface needs to be blocked. And it is used for polling, so as to inquire about the status change of the device, and release the blocked interface when the status of the device changes. And constructing a message notification that the device is not in place when the virtual machine is disconnected; and switching the device redirection mode to device interface layer redirection after the virtual machine is connected.

本发明提供的重定向方式切换装置及方法,解决了用户需要重新启动虚拟机才能够切换重定向方式的问题,减少了操作时间,降低了操作难度,解决了系统由切换重定向方式所带来系统异常的问题,提升了用户在桌面云场景下使用智能卡的体验,对智能卡的切换做到了即切即用。The device and method for switching the redirection mode provided by the present invention solve the problem that the user needs to restart the virtual machine to switch the redirection mode, reduce the operation time, reduce the difficulty of operation, and solve the problems caused by switching the redirection mode in the system. The problem of system abnormality has improved the user experience of using smart cards in the desktop cloud scene, and the switching of smart cards has been realized immediately.

较佳地,在应用模块调用与设备状态变化相关接口之前,应用钩子模块检测系统进程是否加载了与智能卡相关的模块,如果该应用钩子模块检测到已加载到该与智能卡相关的模块,则对系统进程进行注入。Preferably, before the application module calls the interface related to the device state change, the application hook module detects whether the system process has loaded a module related to the smart card, and if the application hook module detects that the module related to the smart card has been loaded, then the System process for injection.

较佳地,该设备状态变化相关的接口是智能卡获取状态变化接口。Preferably, the interface related to the state change of the device is a smart card acquisition state change interface.

较佳地,由智能卡取消接口释放阻塞接口。Preferably, the unblocked interface is released by the smart card.

较佳地,该设备接口层重定向是总线重定向、串口重定向、并口重定向中的一个。Preferably, the device interface layer redirection is one of bus redirection, serial port redirection, and parallel port redirection.

较佳地,该设备是USB智能卡、串口智能卡、并口智能卡中的一个。Preferably, the device is one of a USB smart card, a serial port smart card, and a parallel port smart card.

附图说明Description of drawings

图1为现有技术中的设备接口层重定向方法示意图;FIG. 1 is a schematic diagram of a device interface layer redirection method in the prior art;

图2为现有技术中的API重定向方法示意图;FIG. 2 is a schematic diagram of an API redirection method in the prior art;

图3为本发明一个实施例的从设备接口层重定向切换到API重定向的方法流程图;Fig. 3 is a flow chart of a method for switching from device interface layer redirection to API redirection according to an embodiment of the present invention;

图4为本发明一个实施例的重定向方式切换示意图;FIG. 4 is a schematic diagram of redirection mode switching according to an embodiment of the present invention;

图5为本发明一个实施例的从API重定向切换到设备接口层重定向的方法流程图;5 is a flowchart of a method for switching from API redirection to device interface layer redirection according to an embodiment of the present invention;

图6为本发明一个实施例的从设备接口层重定向切换至API重定向的装置示意图;6 is a schematic diagram of an apparatus for switching from device interface layer redirection to API redirection according to an embodiment of the present invention;

图7为本发明实一个实施例的从API重定向切换至设备接口层重定向的装置示意图。FIG. 7 is a schematic diagram of an apparatus for switching from API redirection to device interface layer redirection according to an embodiment of the present invention.

具体实施方式detailed description

下面通过附图和实施例,对本发明的技术方案做进一步的详细描述。The technical solutions of the present invention will be described in further detail below with reference to the accompanying drawings and embodiments.

本发明中的重定向方式包括设备接口层重定向和API重定向,且该设备接口层重定向为总线重定向、串口重定向、并口重定向等设备接口层重定向中的一个。本发明中将客户端中的设备重定向至虚拟机,所述与客户端相关的设备可以是USB智能卡、串口智能卡、并口智能卡等智能卡中的一个,也可以是其它任意一种与客户端相关的设备,如打印机等,以下实施例将以该与客户端相关设备为智能卡为例,对本发明进行详述。The redirection mode in the present invention includes device interface layer redirection and API redirection, and the device interface layer redirection is one of device interface layer redirection such as bus redirection, serial port redirection, and parallel port redirection. In the present invention, the device in the client is redirected to the virtual machine, and the device related to the client can be one of smart cards such as a USB smart card, a serial port smart card, and a parallel port smart card, or any other device related to the client. devices, such as printers, etc., the following embodiments will take the client-related device as a smart card as an example to describe the present invention in detail.

本发明在智能卡状态变化相关接口(如SCardGetStatusChange接口)阻塞时,要切换重定向方式,就需要断开虚拟机,释放阻塞接口,并构造智能卡不在位状态的消息通知。否则与该智能卡状态变化接口相对应的资源就不会得到释放,因此此时一旦切换重定向方式,资源就无法得到正常调用,出现系统异常。除非采用现有技术中的重启虚拟机方式,这样又会给用户带来不便。The present invention needs to disconnect the virtual machine, release the blocked interface, and construct the message notification of the smart card not in place state when the smart card state change related interface (such as the SCardGetStatusChange interface) is blocked, and to switch the redirection mode. Otherwise, the resource corresponding to the smart card status change interface will not be released, so once the redirection mode is switched at this time, the resource cannot be called normally, and a system exception occurs. Unless the method of restarting the virtual machine in the prior art is adopted, this will bring inconvenience to the user.

图3是本发明一个实施例的从设备接口层重定向切换到API重定向的方法流程图。Fig. 3 is a flowchart of a method for switching from device interface layer redirection to API redirection according to an embodiment of the present invention.

下述步骤301至步骤305阐述的是,如何通过设备接口层重定向方式将客户端的智能卡重定向至虚拟机。The following steps 301 to 305 describe how to redirect the smart card of the client to the virtual machine through device interface layer redirection.

S301,启动虚拟机。S301, start the virtual machine.

S302,app hook模块(应用钩子模块)检测系统进程是否加载了与智能卡相关的模块,例如检测是否加载了windows系统的winscard模块。S302. The app hook module (application hook module) detects whether a module related to the smart card is loaded in the system process, for example, detects whether the winscard module of the windows system is loaded.

S303,如果app hook模块检测到已加载到该与智能卡相关的模块,则对系统进程进行HOOK(注入)。S303. If the app hook module detects that the module related to the smart card has been loaded, perform HOOK (injection) on the system process.

S304,此时,如果虚拟机的会话管理模块尚未提示连接虚拟机,则所有接口会返回一个值,如返回值SCARD_E_NO_SERVICE,该返回值表示系统的智能卡服务还未开始。S304. At this time, if the session management module of the virtual machine has not prompted to connect to the virtual machine, all interfaces will return a value, such as the return value SCARD_E_NO_SERVICE, which indicates that the smart card service of the system has not started yet.

S305,如果虚拟机的会话管理模块提示连接该虚拟机,则用户连接上虚拟机,该app hook模块检测当前重定向方式,此时重定向方式为设备接口层重定向。S305, if the session management module of the virtual machine prompts to connect to the virtual machine, then the user connects to the virtual machine, and the app hook module detects the current redirection mode, and the redirection mode at this time is device interface layer redirection.

在该设备接口层重定向方式下,该智能卡中消息的处理过程参见图4。具体地,首先由应用模块发起消息,该消息传递到协议厂商实现的虚拟USB驱动模块。该虚拟USB驱动模块将该消息转发给协议服务端的传输模块。该消息经过使用厂商定义的桌面云协议,再通过网络传输。然后该消息到达协议客户端后交给客户端的虚拟USB驱动模块。该客户端的虚拟USB驱动模块将消息传递下去,再由客户端的智能卡设备处理该消息并给出回应。最后经该智能卡设备处理后,回应消息至应用模块。In the device interface layer redirection mode, refer to FIG. 4 for the message processing process in the smart card. Specifically, firstly, the application module initiates a message, and the message is delivered to the virtual USB driver module implemented by the protocol manufacturer. The virtual USB driver module forwards the message to the transmission module of the protocol server. The message is transmitted over the network using the desktop cloud protocol defined by the vendor. Then the message arrives at the protocol client and is handed over to the client's virtual USB driver module. The virtual USB driver module of the client transmits the message, and then the smart card device of the client processes the message and gives a response. Finally, after being processed by the smart card device, a response message is sent to the application module.

S306,所有设备API,如SCard API(智能卡API),均经过该app hook模块,此时该app hook模块单独启用一个线程a,以监控阻塞的context(上下文内容),且该context(上下文内容)能够示出智能卡、接口以及阻塞情况之间的对应关系。S306, all device APIs, such as SCard API (smart card API), all go through the app hook module, and now the app hook module independently enables a thread a to monitor the blocked context (context content), and the context (context content) The correspondence between smart cards, interfaces and blocking situations can be shown.

下述步骤S307至步骤S312阐述的是,如何实时地将重定向方式切换至API重定向。The following steps S307 to S312 describe how to switch the redirection mode to API redirection in real time.

S307,该app hook模块判定用户是否登陆虚拟机。S307, the app hook module determines whether the user logs in to the virtual machine.

S308,如果用户未登录虚拟机,所有接口返回一个值,如返回值SCARD_E_NO_SERVICE,表示智能卡服务还未开始。S308, if the user has not logged into the virtual machine, all interfaces return a value, such as the return value SCARD_E_NO_SERVICE, indicating that the smart card service has not started yet.

S309,如果用户登录虚拟机,根据配置模块可知,此时已配置重定向方式为设备接口层重定向,则调用与该智能卡状态变化相关的接口,并在该接口阻塞时,保存与该接口相应的context(上下文内容)。S309, if the user logs in to the virtual machine, according to the configuration module, the configured redirection mode is device interface layer redirection at this time, then call the interface related to the state change of the smart card, and save the corresponding information corresponding to the interface when the interface is blocked. The context (context content).

一个例子中,由应用模块(applications)进行接口调用,调用SCardGetStatusChange接口(智能卡获取状态变化接口)查询智能卡状态。如果入参timeout(超时)的参数值为-1等负数,说明该接口SCardGetStatusChange需要被阻塞。此时由驱动完成对该接口的阻塞,apphook模块仅需保存该接口相应的context(上下文内容),该context(上下文内容)能够示出智能卡、接口以及被阻塞情况之间的对应关系。例如context示出了智能卡1中的SCardGetStatusChange接口阻塞、智能卡2中的SCardGetStatusChange接口不阻塞、智能卡3中的SCardGetStatusChange接口阻塞等;也就是说,该context示出了多个与智能卡状态变化相关接口的阻塞情况;因此,保存该context是为了根据该context中的信息,释放阻塞的接口。一个例子中,在智能卡数量为多个情况下,如果需要切换重定向方式,则该多个智能卡重定向方式同时切换,且均由设备接口层重定向切换至API重定向,或者同时由API重定向切换至设备接口层重定向。S310,基于虚拟机的断开,app hook模块(应用钩子模块)释放该阻塞接口,并构造智能卡不在位状态的消息通知。In one example, the application module (applications) calls the interface, and calls the SCardGetStatusChange interface (the interface for obtaining the status change of the smart card) to query the status of the smart card. If the input parameter timeout (timeout) has a negative value such as -1, it means that the interface SCardGetStatusChange needs to be blocked. At this moment, the blocking of the interface is completed by the driver, and the apphook module only needs to save the corresponding context (context content) of the interface, and the context (context content) can show the corresponding relationship between the smart card, the interface and the blocked situation. For example, the context shows that the SCardGetStatusChange interface in smart card 1 is blocked, the SCardGetStatusChange interface in smart card 2 is not blocked, the SCardGetStatusChange interface in smart card 3 is blocked, etc.; that is to say, the context shows the blocking of multiple interfaces related to smart card status changes situation; therefore, saving the context is to release the blocked interface according to the information in the context. In one example, if the number of smart cards is multiple, if the redirection method needs to be switched, the multiple smart card redirection methods are switched at the same time, and all of them are switched from device interface layer redirection to API redirection, or at the same time by API redirection. Directed switch to device interface layer redirection. S310, based on the disconnection of the virtual machine, the app hook module (application hook module) releases the blocking interface, and constructs a message notification of the smart card not in place state.

一个例子中,用户主动断开虚拟机或者由于网络异常导致客户端与虚拟机之间协议消息回应超时,此时线程a监控到虚拟机断开消息,则该apphook模块释放该阻塞的SCardGetStatusChange接口,并向应用模块(applications)构造智能卡拔出的消息通知,即智能卡不在位的消息通知。In one example, the user actively disconnects the virtual machine or the protocol message response between the client and the virtual machine times out due to a network abnormality. At this time, thread a monitors the virtual machine disconnection message, and the apphook module releases the blocked SCardGetStatusChange interface. And construct the message notification of smart card pulling out to the application module (applications), that is, the message notification of smart card not in place.

进一步地,该app hook模块使用SCardCancel(智能卡取消)接口释放所有阻塞接口。Further, the app hook module uses the SCardCancel (smart card cancellation) interface to release all blocked interfaces.

S311,应用模块(applications)调用SCard API(智能卡API),所有接口返回一个数值,如返回值SCARD_E_NO_SERVICE,表示智能卡服务未开始。S311, the application module (applications) calls the SCard API (smart card API), and all interfaces return a value, such as the return value SCARD_E_NO_SERVICE, indicating that the smart card service has not started.

S312,用户重连虚拟机。依据配置模块中的配置信息,app hook模块将智能卡的重定向方式切换至API重定向。S312, the user reconnects to the virtual machine. According to the configuration information in the configuration module, the app hook module switches the redirection mode of the smart card to API redirection.

在此API重定向方式下,智能卡的消息处理过程参见图4。具体地,首先由应用模块发起消息,该消息传递到协议厂商实现的app hook模块。该app hook模块将该消息转发给协议服务端的传输模块,该消息经过使用厂商定义的桌面云协议通过网络传输。然后该消息到达协议客户端后交给客户端的智能卡资源管理器。该智能卡资源管理器将该消息传递下去,再由客户端的智能卡设备处理该消息并给出回应。最后经该智能卡设备处理后,回应消息至该应用模块。In this API redirection mode, see Figure 4 for the message processing process of the smart card. Specifically, firstly, the application module initiates a message, and the message is delivered to the app hook module implemented by the protocol manufacturer. The app hook module forwards the message to the transmission module of the protocol server, and the message is transmitted through the network by using the desktop cloud protocol defined by the manufacturer. The message then arrives at the protocol client and is handed over to the client's smart card resource manager. The smart card resource manager transmits the message, and then the smart card device of the client processes the message and gives a response. Finally, after being processed by the smart card device, a response message is sent to the application module.

图5为本发明一个实施例的从API重定向切换到设备接口层重定向的方法流程图。FIG. 5 is a flowchart of a method for switching from API redirection to device interface layer redirection according to an embodiment of the present invention.

下述步骤501至步骤505产生的是,如何通过API重定向方式将客户端的智能卡重定向至虚拟机。The following steps 501 to 505 result in how to redirect the smart card of the client to the virtual machine through API redirection.

S501,启动虚拟机。S501, start the virtual machine.

S502,app hook模块(应用钩子模块)检测系统进程是否加载了与智能卡相关的模块,例如检测是否加载了windows系统的winscard模块。S502. The app hook module (application hook module) detects whether a module related to the smart card is loaded in the system process, for example, detects whether the winscard module of the windows system is loaded.

S503,如果app hook模块检测到已加载到该与智能卡相关的模块,则对系统进程进行HOOK(注入)。S503. If the app hook module detects that the module related to the smart card has been loaded, perform HOOK (injection) on the system process.

S504,此时,如果虚拟机的会话管理模块尚未提示连接虚拟机,则apphook模块返回一个值,如返回值SCARD_E_NO_SERVICE,该返回值表示系统的智能卡服务还未开始。S504. At this time, if the session management module of the virtual machine has not prompted to connect to the virtual machine, the apphook module returns a value, such as the return value SCARD_E_NO_SERVICE, which indicates that the smart card service of the system has not started yet.

S505,如果虚拟机的会话管理模块提示连接该虚拟机,则用户连接上该虚拟机,该app hook模块检测当前重定向方式,此时重定向方式为API重定向。S505, if the session management module of the virtual machine prompts to connect to the virtual machine, the user connects to the virtual machine, and the app hook module detects the current redirection mode, which is API redirection at this time.

在该API重定向方式下,该智能卡消息处理过程参见图4。具体地,首先由应用模块发起消息,该消息传递到协议厂商实现的app hook模块。该app hook模块将该消息转发给协议服务端的传输模块,该消息经过使用厂商定义的桌面云协议通过网络传输。然后该消息到达协议客户端后交给客户端的智能卡资源管理器。该智能卡资源管理器将该消息传递下去,再由客户端的智能卡设备处理该消息并给出回应。最后经该智能卡设备处理后,回应消息至该应用模块。In the API redirection mode, refer to FIG. 4 for the message processing process of the smart card. Specifically, firstly, the application module initiates a message, and the message is delivered to the app hook module implemented by the protocol manufacturer. The app hook module forwards the message to the transmission module of the protocol server, and the message is transmitted through the network by using the desktop cloud protocol defined by the manufacturer. The message then arrives at the protocol client and is handed over to the client's smart card resource manager. The smart card resource manager transmits the message, and then the smart card device of the client processes the message and gives a response. Finally, after being processed by the smart card device, a response message is sent to the application module.

S506,所有设备API,如SCard API(智能卡API),均经过该app hook模块,此时该app hook模块单独启用一个线程b,以监控阻塞的context(上下文内容),且该context(上下文内容)能够示出智能卡、接口以及阻塞情况之间的对应关系。S506, all device APIs, such as SCard API (smart card API), pass through the app hook module. At this time, the app hook module independently enables a thread b to monitor the blocked context (context content), and the context (context content) The correspondence between smart cards, interfaces and blocking situations can be shown.

下述步骤S507至步骤S513阐述的是,如何实时地将重定向方式切换至设备接口层重定向。The following steps S507 to S513 illustrate how to switch the redirection mode to device interface layer redirection in real time.

S507,该app hook模块判定用户是否登陆虚拟机。S507, the app hook module determines whether the user logs in the virtual machine.

S508,如果用户未登录虚拟机,所有接口返回一个值,如返回值SCARD_E_NO_SERVICE,表示智能卡服务尚未开始。S508, if the user has not logged into the virtual machine, all interfaces return a value, such as the return value SCARD_E_NO_SERVICE, indicating that the smart card service has not started yet.

S509,如果用户登录虚拟机,根据配置模块可知,此时已配置重定向方式为API重定向,则调用与该智能卡状态变化相关的接口,并在该接口需要阻塞时,app hook模块阻塞该接口。S509, if the user logs in to the virtual machine, according to the configuration module, the configured redirection mode is API redirection at this time, then call the interface related to the state change of the smart card, and when the interface needs to be blocked, the app hook module blocks the interface .

一个例子中,由应用模块(applications)进行接口调用,调用SCardGetStatusChange接口(智能卡获取状态变化接口)查询智能卡状态。如果入参timeout的参数值为-1,说明该接口SCardGetStatusChange需要阻塞,则由app hook模块阻塞该接口。需要说明的是,该SCardGetStatusChange接口什么时候需要被阻塞由运行该智能卡的系统决定,只要该系统发送至该SCardGetStatusChange接口的入参timetout为负数,则该SCardGetStatusChange接口需要被阻塞,直到智能卡状态发生变化。In one example, the application module (applications) calls the interface, and calls the SCardGetStatusChange interface (the interface for obtaining the status change of the smart card) to query the status of the smart card. If the parameter value of the input parameter timeout is -1, it means that the interface SCardGetStatusChange needs to be blocked, and the app hook module blocks this interface. It should be noted that when the SCardGetStatusChange interface needs to be blocked is determined by the system running the smart card, as long as the input parameter timetout sent by the system to the SCardGetStatusChange interface is negative, the SCardGetStatusChange interface needs to be blocked until the smart card status changes.

S510,app hook模块定时轮询,以查询智能卡状态变化情况,如果智能卡状态发生变化,则释放该阻塞的接口。S510, the app hook module periodically polls to inquire about changes in the state of the smart card, and releases the blocked interface if the state of the smart card changes.

一个例子中,app hook模块定时轮询,去客户端查询智能卡状态是否发生变化,如果智能卡由在位状态变为不在位状态或者由不在位状态变为在位状态,则释放阻塞的SCardGetStatusChange接口。In one example, the app hook module periodically polls to check whether the status of the smart card has changed on the client side. If the smart card changes from the on-position state to the off-position state or from the off-position state to the on-position state, release the blocked SCardGetStatusChange interface.

S511,基于虚拟机的断开(用户主动断开虚拟机或者由于网络异常导致客户端与虚拟机之间协议消息回应超时),应用模块调用智能卡API(SCard API),构造智能卡不在位的消息通知,即向应用模块发送智能卡不在位的消息通知。所有接口(包括SCardGetStatusChange接口)返回一个值,如返回值SCARD_E_NO_SERVICE,表示智能卡服务未开始。S511, based on the disconnection of the virtual machine (the user actively disconnects the virtual machine or the protocol message response between the client and the virtual machine times out due to network abnormality), the application module calls the smart card API (SCard API) to construct a message notification that the smart card is not in place , that is, send a message notification that the smart card is not in place to the application module. All interfaces (including the SCardGetStatusChange interface) return a value, such as the return value SCARD_E_NO_SERVICE, indicating that the smart card service has not started.

S512,用户重连虚拟机。依据配置模块中的配置信息,app hook模块将智能卡的重定向方式切换至设备接口层重定向。S512, the user reconnects to the virtual machine. According to the configuration information in the configuration module, the app hook module switches the redirection mode of the smart card to device interface layer redirection.

在此设备接口层重定向方式下,智能卡中消息的处理过程参见图4。具体地,首先由应用模块发起消息,该消息传递到协议厂商实现的虚拟USB驱动模块。该虚拟USB驱动模块将该消息转发给协议服务端的传输模块。该消息经过使用厂商定义的桌面云协议,再通过网络传输。然后该消息到达协议客户端后交给客户端的虚拟USB驱动模块。该客户端的虚拟USB驱动模块将消息传递下去,再由客户端的智能卡设备处理该消息并给出回应。最后经该智能卡设备处理后,回应消息至应用模块。In this device interface layer redirection mode, refer to Figure 4 for the message processing process in the smart card. Specifically, firstly, the application module initiates a message, and the message is delivered to the virtual USB driver module implemented by the protocol manufacturer. The virtual USB driver module forwards the message to the transmission module of the protocol server. The message is transmitted over the network using the desktop cloud protocol defined by the vendor. Then the message arrives at the protocol client and is handed over to the client's virtual USB driver module. The virtual USB driver module of the client transmits the message, and then the smart card device of the client processes the message and gives a response. Finally, after being processed by the smart card device, a response message is sent to the application module.

图6是本发明一个实施例的从设备接口层重定向切换至API重定向的装置示意图。Fig. 6 is a schematic diagram of an apparatus for switching from device interface layer redirection to API redirection according to an embodiment of the present invention.

客户端通过网络将该客户端中的智能卡重定向至虚拟机,该智能卡被插入至客户端,该虚拟机包括app hook模块601(应用钩子模块601)、配置模块602、会话管理模块603、应用模块604。The client redirects the smart card in the client to a virtual machine through the network, and the smart card is inserted into the client. The virtual machine includes an app hook module 601 (application hook module 601), a configuration module 602, a session management module 603, an application Module 604.

该应用模块604在该虚拟机被登录情况下,用于调用与该智能卡状态变化相关的接口。The application module 604 is used for invoking an interface related to the status change of the smart card when the virtual machine is logged in.

该app hook模块601用于在该与智能卡变化状态相关接口需要被阻塞时,保存与该接口相应的上下文内容(context);该app hook模块601还用于虚拟机断开情况下,释放该被阻塞接口,并构造该智能卡不在位状态的消息通知;并在该虚拟机被连接后,用于将该智能卡重定向方式切换至API重定向。The app hook module 601 is used to save the context content (context) corresponding to the interface when the interface related to the change state of the smart card needs to be blocked; the app hook module 601 is also used to release the blocked interface when the virtual machine is disconnected Blocking the interface, and constructing a message notification that the smart card is not in place; and switching the smart card redirection mode to API redirection after the virtual machine is connected.

该会话管理模块603用于提示用户已连接虚拟机。The session management module 603 is used to prompt the user that the virtual machine has been connected.

该配置模块602用于提供配置信息,包括由设备接口层重定向切换至API重定向的配置信息、由API重定向切换至设备接口层重定向的配置信息、设备接口层重定向的配置信息、API重定向的配置信息等等。The configuration module 602 is used to provide configuration information, including configuration information switched from device interface layer redirection to API redirection, configuration information switched from API redirection to device interface layer redirection, configuration information of device interface layer redirection, Configuration information for API redirection, etc.

进一步地,该app hook模块601在虚拟机被启动后,还用于检测系统进程是否加载了与智能卡相关的模块(例如检测是否加载了windows系统的winscard模块),若加载了该模块,则对系统进程进行HOOK(注入)。Further, after the virtual machine is started, the app hook module 601 is also used to detect whether the system process has loaded a module related to the smart card (such as detecting whether the winscard module of the windows system is loaded), and if the module is loaded, the The system process performs HOOK (injection).

进一步地,该app hook模块601还用于启动线程,以监控阻塞的context(上下文内容)。Further, the app hook module 601 is also used to start a thread to monitor the blocked context (context content).

进一步地,该app hook模块601还用于判定用户是否已经登陆虚拟机。Further, the app hook module 601 is also used to determine whether the user has logged into the virtual machine.

进一步地,该app hook模块601还用于释放被阻塞的接口,并构造智能卡不在位状态的消息通知。Further, the app hook module 601 is also used for releasing the blocked interface, and constructing a message notification of the smart card not in place state.

进一步地,该应用模块604用于调用SCardGetStatusChange接口(智能卡获取状态变化接口),以查询智能卡状态。Further, the application module 604 is used to call the SCardGetStatusChange interface (a smart card acquisition status change interface) to query the status of the smart card.

图7是本发明一个实施例的的从API重定向切换至设备接口层重定向的装置示意图。Fig. 7 is a schematic diagram of an apparatus for switching from API redirection to device interface layer redirection according to an embodiment of the present invention.

客户端通过网络将该客户端中的智能卡重定向至虚拟机,该智能卡被插入至客户端,该虚拟机包括app hook模块701(应用钩子模块701)、配置模块702、会话管理模块703、应用模块704。The client redirects the smart card in the client to the virtual machine through the network, the smart card is inserted into the client, and the virtual machine includes an app hook module 701 (application hook module 701), a configuration module 702, a session management module 703, an application Module 704.

该应用模块704在该虚拟机被登录情况下,用于调用与该智能卡状态变化相关的接口。The application module 704 is used to call an interface related to the status change of the smart card when the virtual machine is logged in.

该app hook模块701用于在该与智能卡状态变化相关接口需要被阻塞时,阻塞该接口;以及用于定时轮询,以查询该智能卡状态变化情况,并在其状态发生变化时,释放该被阻塞接口;以及在虚拟机断开时构造智能卡不在位的消息通知;并在该虚拟机被连接后,将该智能卡重定向方式切换至设备接口层重定向。The app hook module 701 is used to block the interface related to the status change of the smart card when the interface needs to be blocked; and is used for regular polling to inquire about the status change of the smart card, and when the status of the smart card changes, release the interface. Blocking the interface; and constructing a message notification that the smart card is not in place when the virtual machine is disconnected; and switching the smart card redirection mode to device interface layer redirection after the virtual machine is connected.

该会话管理模块703用于提示用户已连接虚拟机。The session management module 703 is used to prompt the user that the virtual machine has been connected.

该配置模块702用于提供配置信息,包括由设备接口层重定向切换至API重定向、由API重定向切换至设备接口层重定向、仅设备接口层重定向、仅API重定向等等。The configuration module 702 is used to provide configuration information, including switching from device interface layer redirection to API redirection, switching from API redirection to device interface layer redirection, only device interface layer redirection, only API redirection, and so on.

进一步地,该app hook模块701还用于在虚拟机被启动后,检测系统进程是否加载了与智能卡相关的模块(例如检测是否加载了windows系统的winscard模块),若加载了该模块,则对系统进程进行HOOK(注入)。Further, the app hook module 701 is also used to detect whether the system process has loaded a module related to the smart card (such as detecting whether the winscard module of the windows system is loaded) after the virtual machine is started. If the module is loaded, the The system process performs HOOK (injection).

进一步地,该app hook模块701还用于启动线程,以监控阻塞的context(上下文内容)。Further, the app hook module 701 is also used to start a thread to monitor the blocked context (context content).

进一步地,该app hook模块701还用于判定用户是否已经登陆虚拟机。Further, the app hook module 701 is also used to determine whether the user has logged into the virtual machine.

进一步地,该应用模块704在虚拟机被断开后,还用于调用智能卡API(SCard API)。Further, the application module 704 is also used to call a smart card API (SCard API) after the virtual machine is disconnected.

进一步地,该应用模块704还用于调用SCardGetStatusChange接口(智能卡获取状态变化接口),以查询智能卡状态。Further, the application module 704 is also used to call the SCardGetStatusChange interface (a smart card acquisition status change interface) to query the status of the smart card.

综上,本发明切换重定向方式,仅需要用户断开虚拟机后再连接虚拟机,就能够实现,不需要用户重新启动虚拟机。在现有技术中,如果要切换重定向方式,就需要热启动虚拟机还要用户修改虚拟机中的与新的定向方式相对应的文件或者需要用户修改注册表项。并且重连虚拟机相对于热启动虚拟机来说,操作时间更短,用户体验更佳。To sum up, switching the redirection mode in the present invention can be realized only after the user disconnects the virtual machine and then connects to the virtual machine, and does not require the user to restart the virtual machine. In the prior art, if the redirection mode needs to be switched, the virtual machine needs to be hot-started and the user needs to modify the file corresponding to the new redirection mode in the virtual machine or the user needs to modify the registry entry. In addition, reconnecting the virtual machine takes shorter operation time and better user experience than warm-starting the virtual machine.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the foregoing embodiments, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.

专业人员应该还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals should further realize that the units and algorithm steps described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the relationship between hardware and software Interchangeability. In the above description, the composition and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.

结合本文中所公开的实施例描述的方法或算法的步骤可以用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be implemented by hardware, software modules executed by a processor, or a combination of both. Software modules can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any Any other known storage medium.

以上所述的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The specific embodiments described above have further described the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above descriptions are only specific embodiments of the present invention and are not intended to limit the scope of the present invention. Protection scope, within the spirit and principles of the present invention, any modification, equivalent replacement, improvement, etc., shall be included in the protection scope of the present invention.

Claims (18)

1. a kind of redirection mode changing method, wherein, the redirection mode is by the equipment in client Virtual machine is redirected to, the method includes:
Step a, under device interface layer redirection mode, application module is called and equipment state change Related interface, and when the interface blocks, preserve context corresponding with the interface;
Step b, based on the disconnection of the virtual machine, discharges using hook module according to the context The blocking interface, and construct the message informing of equipment state not in place;
Step c, based on the connection of the virtual machine, the application hook module is by the device redirection mode Switch to API redirections.
2. redirection mode changing method according to claim 1, it is characterised in that the equipment The related interface of state change is that smart card obtains state change interface.
3. redirection mode changing method according to claim 1 and 2, it is characterised in that in institute In stating step b, interface is cancelled by smart card and discharges the blocking interface.
4. the redirection mode changing method according to one of claims 1 to 3, it is characterised in that It is complete by system drive when the interface needs blocked when the interface blocks in step a The obstruction of the paired interface.
5. the redirection mode changing method according to one of Claims 1-4, it is characterised in that The context is illustrated that, the equipment, the corresponding relation between interface and congestion situations.
6. the redirection mode changing method according to one of claim 1 to 5, it is characterised in that Also include before step c after step b:
Application module calls smart card API, total interface to return a numerical value, to represent the equipment clothes Business does not start.
7. a kind of redirection mode changing method, wherein, the redirection mode is by the equipment in client Virtual machine is redirected to, the method includes:
Step d, under API redirection modes, application module calls related to equipment state change Interface, and when the interface needs obstruction, using hook module the interface is blocked;
Step e, the application hook module poll, to inquire about the equipment state situation of change, and at this When equipment state changes, the blocking interface is discharged;
Step f, based on the disconnection of virtual machine, constructs equipment message informing not in place;
Step g, based on the connection of the virtual machine, the application hook module is by the device redirection mode Switch to device interface layer redirection.
8. redirection mode changing method according to claim 7, it is characterised in that the equipment The related interface of state change is that smart card obtains state change interface.
9. the redirection mode changing method according to claim 7 or 8, it is characterised in that in institute In stating step b, interface is cancelled by smart card and discharges the blocking interface
10. the redirection changing method according to one of claim 7 to 9, it is characterised in that Include after step f, total interface returns a value, to represent that the device service not yet starts.
A kind of 11. redirection switching devices, wherein, the redirection mode is by the equipment weight in client It is directed to virtual machine, it is characterised in that the virtual machine is included using hook module, application module;
The application module is used to call and equipment state change under device interface layer redirection mode Related interface;
The application hook module be used for it is described block with equipment variations state relevant interface when, preserve with The corresponding context of the interface;And under virtual machine disconnection, according to the context The blocking interface is discharged, the message informing of equipment state not in place is constructed;And after the virtual machine is connected, Device redirection mode is switched to into API to redirect.
12. redirection mode switching devices according to claim 11, it is characterised in that described to set The related interface of standby state change is that smart card obtains state change interface.
The 13. redirection mode switching devices according to claim 11 or 12, it is characterised in that The application hook module cancels interface and discharges the blocking interface by smart card.
The 14. redirection mode switching devices according to one of claim 11 to 13, its feature exists In described is by system drive when the interface needs blocked with equipment variations state relevant interface obstruction Complete the obstruction to the interface.
The 15. redirection mode switching devices according to one of claim 11 to 14, its feature exists In the context is illustrated that, the equipment, the correspondence pass between interface and congestion situations System.
A kind of 16. redirection switching devices, wherein, the redirection mode is by the equipment weight in client It is directed to virtual machine, it is characterised in that the virtual machine is included using hook module, application module;
The application module is related to equipment state change for calling under API redirection modes Interface;
The application hook module is used to block when described and equipment variations state relevant interface needs obstruction The interface;And for poll, to inquire about the equipment state situation of change, and occur in the equipment state During change, the blocked interface is discharged;And construct that the equipment is not in place to disappear when virtual machine disconnects Breath is notified;And for after the virtual machine is connected, the device redirection mode being switched to into device interface layer Redirect.
17. redirection mode switching devices according to claim 16, it is characterised in that described to set The related interface of standby state change is that smart card obtains state change interface.
The 18. redirection mode switching devices according to claim 16 or 17, it is characterised in that Interface is cancelled by smart card when described and equipment variations state same-interface needs obstruction and discharges the obstruction Interface.
CN201510725296.8A 2015-10-30 2015-10-30 Switch the device and method of redirection mode under a kind of desktop cloud scene in real time Active CN106656916B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510725296.8A CN106656916B (en) 2015-10-30 2015-10-30 Switch the device and method of redirection mode under a kind of desktop cloud scene in real time

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510725296.8A CN106656916B (en) 2015-10-30 2015-10-30 Switch the device and method of redirection mode under a kind of desktop cloud scene in real time

Publications (2)

Publication Number Publication Date
CN106656916A true CN106656916A (en) 2017-05-10
CN106656916B CN106656916B (en) 2019-10-01

Family

ID=58830830

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510725296.8A Active CN106656916B (en) 2015-10-30 2015-10-30 Switch the device and method of redirection mode under a kind of desktop cloud scene in real time

Country Status (1)

Country Link
CN (1) CN106656916B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7742398B1 (en) * 2004-04-12 2010-06-22 Azul Systems, Inc. Information redirection
CN103685508A (en) * 2013-08-28 2014-03-26 东方证券股份有限公司 Calling method based on video image and text transmission in cloud desktop platform low-bandwidth mode
CN103714020A (en) * 2013-12-27 2014-04-09 普华基础软件股份有限公司 USB device redirecting system based on network
CN104539685A (en) * 2014-12-19 2015-04-22 华南理工大学 USB disk identifying system and method for OpenStack cloud desktop

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7742398B1 (en) * 2004-04-12 2010-06-22 Azul Systems, Inc. Information redirection
CN103685508A (en) * 2013-08-28 2014-03-26 东方证券股份有限公司 Calling method based on video image and text transmission in cloud desktop platform low-bandwidth mode
CN103714020A (en) * 2013-12-27 2014-04-09 普华基础软件股份有限公司 USB device redirecting system based on network
CN104539685A (en) * 2014-12-19 2015-04-22 华南理工大学 USB disk identifying system and method for OpenStack cloud desktop

Also Published As

Publication number Publication date
CN106656916B (en) 2019-10-01

Similar Documents

Publication Publication Date Title
CN108683618B (en) Communication equipment and intelligent terminal
CN105704157A (en) Remote control method and system, intelligent terminal and service terminal application to remote control method and system
CN104410526A (en) Call control method, Diameter protocol forwarding equipment and system
CN102662776B (en) Inter-application communication method, client side and application process manager of online application platform
CN107645517A (en) Data push method and device
EP3209005A1 (en) Task processing device, intelligent apparatus, task processing method and baseband processor
US10142832B2 (en) Information sending and processing method and apparatus
CN104883279B (en) Heartbeat message processing method, equipment and system
EP2814201B1 (en) Notification message sending method and management control apparatus
CN115134344B (en) Control method and component of virtual machine console
CN102111728A (en) Network connection management module and method of mobile terminal
US9749422B2 (en) Method and system for telecommunication device monitoring
CN106330513A (en) Method and device for processing tr069 protocol information
KR20230010744A (en) Wi-Fi control methods, devices and electronic facilities
CN106656916B (en) Switch the device and method of redirection mode under a kind of desktop cloud scene in real time
US20140297719A1 (en) Receiving a communication event
CN107465669A (en) The equipment safety partition method and device of a kind of multi-user
CN105100125A (en) Sleep control method, sleep control device and sleep control system for virtual desktop
CN108632355B (en) A home appliance network routing method, control terminal, readable storage medium and device
US20090172155A1 (en) Method and system for monitoring, communicating, and handling a degraded enterprise information system
JP7627778B2 (en) Call establishment method, device, electronic device and readable storage medium
WO2022041923A1 (en) Network slice connection method, terminal, and computer-readable storage medium
JP2014182441A (en) Information processing device and program
CN115118760A (en) Session connection control method, session connection control device, and computer storage medium
CN114531257A (en) Network attack handling method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220224

Address after: 550025 Huawei cloud data center, jiaoxinggong Road, Qianzhong Avenue, Gui'an New District, Guiyang City, Guizhou Province

Patentee after: Huawei Cloud Computing Technologies Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.