Driver shimming

Driver shimming techniques are described. In one or more implementations, an identification is made as to which interfaces and callbacks are utilized by a shim obtained for a driver of a computing device. The identified interfaces and callbacks are wrapped by the shim of the computing device such that calls to the wrapped interfaces and callbacks are intercepted by the shim.

BACKGROUND

Computing devices may include a variety of different hardware devices to expand the functionality available to the computing device. For example, devices may include internal devices that may be configured within a housing of the computing devices as well as external devices, such as printers, cameras, and so on. Drivers are typically employed to enable communication between an operating system of the computing device and the devices.

The continuing development of operating systems, however, may cause changes in how the operating systems interact with the drivers. Consequently, a driver that is compatible with a previous version of an operating system, for example, may not be compatible with later versions of the operating system. Traditional techniques that were used to combat this incompatibility included writing a newer version of the driver. Although this may restore functionality of the device, the writing of the driver may involve a wait until the driver is available for dissemination, involve a user locating the newer version of the driver, and so on that could lead to user frustration and lost productivity.

SUMMARY

Driver shimming techniques are described. In one or more implementations, an identification is made as to which interfaces and callbacks are utilized by a shim obtained for a driver of a computing device. The identified interfaces and callbacks are wrapped by the shim of the computing device such that calls to the wrapped interfaces and callbacks are intercepted by the shim.

In one or more implementations, an I/O request packet is intercepted by a shim executed on a computing device that relates to communication with a driver that is executing on the computing device. Data is translated, by the shim, that relates to the I/O request packet to be compatible with the driver and the translated data is transmitted for communication to the driver.

In one or more implementations, installation of a driver is initiated on a computing device and the driver to be installed is identified. Based on the identification, a determination is made that a shim is available for the driver to communicate with an operating system. The shim is obtained for installation on the computing device and callbacks are identified that are utilized by the shim. The callbacks are wrapped by the shim such that calls to the callbacks are intercepted by the shim and an in-memory image of the driver is modified by the computing device using the wrapped callbacks.

DETAILED DESCRIPTION

Overview

Computing devices may include (e.g., be communicatively coupled to) a wide variety of different devices such that functionality of the device may be utilized by the computing device. For example, a computing device may be communicatively coupled to a printer, optical disc reader/writer, thumb drive, or other peripheral device that may be internal (e.g., within a housing) or external to the computing device. A driver may be utilized to enable communication between the computing device and the device, such as to translate commands and data from an operating system of the computing device into a form that is understandable by the device and vice versa. However, changes to the operating system may cause incompatibilities with the driver and consequently with the device, which may lead to user frustration.

Driver shimming techniques are described in which a shim may be used for compatibility with a driver for a device, such as compatibility between a kernel of an operating system and the driver. This compatibility may be provided in a variety of ways by a shim. For example, the shim may be used to intercept and translate data communicated between the kernel and the driver, such as data associated with function calls to application programming interfaces (APIs), callbacks, I/O request packets (IRPs), and so on. In this way, compatibility of the kernel of the operating system with the driver may be maintained and thereby functionality of the device may still be accessed by the operating system, even in instances of newer versions of the operating system.

The shims that are obtained to promote driver compatibility may be obtained in a variety of ways. For example, a service provider may provide a service that is accessible via a network which includes identification of issues with drivers and corresponding shims for those drivers. One or more shims may therefore be provided for execution with the driver to correct these issues, such as based on identification of the driver. Further, updates may also be provided in a form of shims to correct subsequent issues that are encountered. In this way, issues that arise after shipment of an operating system with a driver may be addressed even after the operating system has been installed and distributed, further discussion of which may be found in relation toFIG. 2.

In the following discussion, an example environment is first described that may be leveraged according to driver shimming techniques. Example procedures are then described which may also be employed in the example environment as well as other environments. Accordingly, performance of the example procedures is not limited to the example environment and the example environment is not limited to performing the example procedures.

Example Environment

FIG. 1is an illustration of an environment100in an example implementation that is operable to employ techniques described herein. The illustrated environment100includes a computing device102, which may be configured in a variety of ways. For example, the computing device102may be configured as portable game device, mobile phone, a computer that is capable of communicating over a network (e.g., a desktop computer, one or more servers, an entertainment appliance), a set-top box communicatively coupled to a display device, and so forth. Thus, the computing device102may range from full resource devices with substantial memory and processor resources (e.g., personal computers, game consoles) to a low-resource device with limited memory and/or processing resources (e.g., traditional set-top boxes, hand-held game consoles). Additionally, although a single computing device102is shown, the computing device102may be representative of a plurality of different devices, such as multiple servers utilized by a business to perform operations, a remote control and set-top box combination, and so on.

The computing device102may also include an entity (e.g., software) that causes hardware of the computing device102to perform operations, e.g., processors, functional blocks, and so on. For example, the computing device102may include a computer-readable medium that may be configured to maintain instructions that cause the computing device, and more particularly hardware of the computing device102to perform operations. Thus, the instructions function to configure the hardware to perform the operations and in this way result in transformation of the hardware to perform functions. The instructions may be provided by the computer-readable medium to the computing device102through a variety of different configurations.

One such configuration of a computer-readable medium is signal bearing medium and thus is configured to transmit the instructions (e.g., as a carrier wave) to the hardware of the computing device, such as via a network. The computer-readable medium may also be configured as a computer-readable storage medium and thus is not a signal bearing medium. Examples of a computer-readable storage medium include a random-access memory (RAM), read-only memory (ROM), an optical disc, flash memory, hard disk memory, and other memory devices that may use magnetic, optical, and other techniques to store instructions and other data.

The computing device102is also illustrated as including a processor104and memory106. Processors are not limited by the materials from which they are formed or the processing mechanisms employed therein. For example, processors may be comprised of semiconductor(s) and/or transistors (e.g., electronic integrated circuits (ICs)). In such a context, processor-executable instructions may be electronically-executable instructions. Alternatively, the mechanisms of or for processors, and thus of or for a computing device, may include, but are not limited to, quantum computing, optical computing, mechanical computing (e.g., using nanotechnology), and so forth. Additionally, although a single processor104and memory106are shown, a wide variety of types and combinations of memory and/or processors may be employed.

The computing device102is illustrated as also includes an operating system108having a kernel110and one or more drivers114that are configured to support communication between the kernel110of the operating system108and one or more devices112. The kernel110represents a component of the operating system108that is typically employed to abstract functionality of underlying devices such as the processor108, memory106, and other devices112to applications and other software that are executed by the computing device102. Although the operating system108and kernel110are illustrated as being executed on the processor104, these modules are also storable in memory106.

The devices112may be representative of a variety of different devices that may be employed by the computing device102. For example, the devices112may include peripheral devices, such as printers, scanners, hard drives, and so on. The devices112may also represent functionality of other computing devices that may be leveraged by the computing device102, such as to use a mobile phone as a storage device, access photos on the mobile phone, and so on. Thus, the computing device102may leverage a variety of different devices112to add to the functionality of the computing device102.

In order for the devices112to communicate with the computing device102, and more particularly the operating system108and kernel110of the computing device, one or more drivers114may be employed. Drivers114are typically employed to abstract functionality of a corresponding device112. For example, the driver114may be configured as a series of layers to translate commands from the kernel110of the operating system108into device specific commands that are “understandable” by a respective device.

As previously described, however, there may be some instances in which the driver114is not longer compatible with the kernel110of the operating system108. For example, the operating system108may be updated to a newer version, have a service pack applied, and so on that may change how the operating system108is configured to communicate with the driver114.

Accordingly, the computing device102may employ a shim engine116that is representative of functionality to provide one or more shims118to support compatibility of the drivers114with the kernel110of the operating system108. A shim118, for instance, may be configured as code that serves as an intermediary between the kernel110and the drivers114such that the kernel110is compatible with the drivers114and vice versa. A variety of different techniques118may be employed by the shim118to support compatibility, such as to translate or redirect commands, further discussion of which may be found in relation toFIG. 2.

Generally, any of the functions described herein can be implemented using software, firmware, hardware (e.g., fixed logic circuitry), manual processing, or a combination of these implementations. The terms “module,” “engine,” and “functionality” as used herein generally represent hardware, software, firmware, or a combination thereof. In the case of a software implementation, the module, functionality, or logic represents instructions and hardware that performs operations specified by the hardware, e.g., one or more processors and/or functional blocks.

FIG. 2is an illustration of a system200in an example implementation showing example operation of a shim engine116ofFIG. 1. The system200includes a computing device102communicatively coupled to a service provider202via a network204. The service provider202is illustrated as including a shim manager module206that is representative of functionality to manage a repository208to provide shims116for use with drivers114.

For example, the repository208may include driver identifiers210and corresponding issues212of the identified drivers. This information may then be used to provide shims to the computing device102when loading a driver114. In this way, the service provider202may provide a service such that up-to-date shims may be disseminated to computing devices102as warranted.

The computing device102, for instance, may initiate a loader214of the operating system108to install a driver114such that an operating system108may communicate with a device112. Accordingly, the loader214may employ the shim engine116to determine whether a shim118is available for the driver114being installed, such as by communicating an identifier of the driver114to the shim manager module206. The shim manager module206may then use the driver identifier210to determine if there are any issues212with the driver114and then whether there are shims116available for driver114. If so, the shim118may be communicated to the shim engine116for installation along with the driver114. A variety of other examples of communication of the shim118are also contemplated, such as through part of a scheduled update to the operating system108(e.g., a service pack) and so on.

The shim118may be used to promote compatibility of the operating system108with the driver114in a variety of ways. For instance, drivers114may interact with components of the computing device102(e.g., kernel110, other drivers) by calling exported interfaces (e.g., APIs), declaring callbacks to be called when certain events happen in the system (I/O manager request callbacks), and so on. Accordingly, the shim engine116may employ hooking such that addresses in an import address table (IAT) for one or more application programming interfaces are replaced with addresses corresponding to the shim118. The shim118may also be configured to intercept callbacks, e.g., to be called upon occurrence of an event by the computing device102. In this way, the shim118may intercept calls made to and from the APIs that are no longer compatible and translate data associated with the call such that it is compatible. In one such example, the shim118may translate the data to mimic a previous version of an operating system108such that the driver114may understand commands received by the driver.

In another instance, the shim118may be configured to intercept I/O request packets (IRPs) that may be used to support communication between the kernel110and the driver114without involving actual calls to an API. The shim engine116, for instance, may modify declared addresses in a dispatch table such that the I/O request packets (IRPs) may be intercepted by the shim118. The shim118may then translate data associated with the IRPs and forward this data for receipt by the intended driver114.

Although these techniques described compatibility of the driver114with a kernel110of an operating system108, the shim118may be used to promote compatibility with other drivers216of the computing device102. Thus, the shim engine116may be employed to redirect the execution of calls and other communications by wrapping them inside a shim118. Although illustrated separately, a fragment of code that implements the shim118may “live” inside a system component, driver114, and so on. In one or more implementations, shims declare wrappers for interfaces or callbacks. If such a wrapper is applied towards a shim (e.g., at runtime), than a call to or from the driver to a system component is processed through the wrapper. Thus, the shim wrapper may control both inputs and outputs of an interface call and modify them to correct incompatibilities.

For example, the shim118may be configured to intercept callbacks (e.g., functions inside the driver) which may be called when a corresponding event occurs in the computing device102. This technique is typically employed to support asynchronous code. Accordingly, the shim118may be used to wrap execution of such callbacks, also. In this way, the shim118may correct behavior even for callbacks that may be completed later in an asynchronous manner.

Example Procedures

FIG. 3depicts a procedure300in an example implementation in which identification of a driver is used as a basis for installing a shim during an installation process of the driver. Installation of a drive on a computing device is initiated (block302). A user, for instance, may connect a device112to the computing device102, detection of which may automatically cause initiation of driver114installation on the computing device102. A variety of other examples are also contemplated, such as manual initiation of the process by a user of the computing device102.

A driver being installed is identified (block304), which may be based on a identification of the driver114itself, a device112that corresponds to the driver114, functionality of the driver114, and so on. Based on the identification, a determination is made that a shim is available (block306). This determination may be performed locally by the shim engine116, involve communication with a service provider202via a network204, and so on.

The shim may then be obtained for installation on the computing device (block308). Continuing with the previous example, the shim manager module206may query a repository208based on a driver identifier210to locate issues that pertain to the driver and/or locate one or more shims118directly. The one or more shims118that are located may then be communicated back to the computing device102for installation.

FIG. 4depicts a procedure400in an example implementation in which a shim is installed on a computing device to promote compatibility of a driver with a kernel of an operating system as well as other drivers of the computing device. An identification is made as to which interfaces and callbacks are utilized by a shim obtained for a driver of a computing device (block402). A shim engine116, for instance, may determine which APIs and/or event declarations involve a shim118that is being stalled on a computing device102.

The identified interfaces and callbacks are then wrapped by the shim so that calls to the wrapped interfaces and callbacks will be intercepted by the shim (block404). The shim engine116, for instance, may replace entries in an import access table (IAT), dispatch table, and so on such that communications between the driver114and other components of the computing device (e.g., the kernel110, other drivers216, and so on) are intercepted by the shim118. This process may involve resolving addresses of the interfaces to be wrapped, which can be exports from various other drivers in a kernel, class drivers, and so on.

An in-memory image of the driver is modified by the computing device (block406) and loading of the driver is continued such that the shimming engine is not called again and that interaction of the wrapped interfaces is first processed by the shim (block408). Thus, the shim engine116may be employed to install the shim118as part of the driver114or other component of the computing device102but then is not involved further such that execution is not slowed. Therefore, the driver114may execute at near full speed with the difference being that execution of the wrapped interfaces and callbacks will go first through the wrappers declared in the applied shims. Although installation of a single shim was described, it should be readily apparent that this process may be employed for multiple shims, e.g., for multiple identified issues of a driver114.

FIG. 5depicts a procedure500in an example implementation in which I/O request packet (IRPs) are intercepted by a shim to promote driver114compatibility. An I/O request packet (IRP) is intercepted by a shim executed on a computing device that relates to communication with a driver that is executing on the computing device (block502). The IRP, for instance, may be generated responsive to occurrence of an event on a computing device102. The IRP may then be intercepted by the shim118by modifying a dispatch table such that the IRP is routed to the shim118and not the driver114upon communication of the IRP responsive to the event.

Data is translated, through execution of the shim, that relates to the I/O request packet to be compatible with the driver (block504). The data, for instance, may be a payload of the packet, data located at an address that referenced by a pointer in the IRP, and so on. This data may be translated by the shim118for compatibility with communications that involve the driver114, such as communications to or from the driver114to another component, such as the kernel110, other driver216, and so on. The translated data may then be transmitted through execution of the shim for communication to the driver (block506), such as by employing the IRP techniques previously describe such that an originally intended driver may receive the data, either directly or indirectly through communication through another shim118. A variety of other examples are also contemplated as described above.

Conclusion