UMDF Driver Structure


To begin, it is helpful to understand how UMDF drivers use COM. UMDF drivers are implemented as in-process COM objects, sometimes abbreviated to InProc objects or COM servers. In-process objects are packaged in a DLL and run in the context of their host process. A DLL can contain any number of in-process COM objects.

All UMDF DLLs contain at least three required COM servers and typically several optional ones, depending on the requirements of the device. The DLL must also export two standard functions. Figure 18-1 shows the contents of a typical UMDF driver DLL.

image from book
Figure 18-1: Schematic drawing of a UMDF driver DLL

The following list provides a brief description of the key components of the figure. These components are discussed in detail later in this chapter:

  • DllMain and DllGetClassObject

    These standard functions provide the basic DLL infrastructure and are usually the only functions that are exported by name.

  • The driver callback object's class factory

    A class factory is a specialized COM object that a client can use to create an instance of a particular COM object.

    The UMDF runtime starts loading the driver by using a class factory to create a driver callback object, which is the only callback object that requires a class factory.

  • UMDF callback objects

    UMDF drivers consist largely of a set of COM-based callback objects that the UMDF runtime uses to communicate with the driver.

    The two callback objects in Figure 18-1 are required for all drivers; any others are optional and depend on the requirements of the particular driver.

  • Interfaces

    COM objects do not expose individual methods. Instead, COM objects group methods into interfaces and expose the interfaces.

    All UMDF callback objects expose at least two and sometimes many interfaces.

The UMDF runtime also contains a number of COM objects that drivers must use to interact with the runtime. A process that uses a COM object is referred to as a COM client. Implementing a UMDF driver thus consists largely of implementing several COM callback objects, which act as COM clients to interact with the UMDF runtime. This chapter discusses the basics of how COM is used to implement the components of the DLL shown in Figure 18-1.




Developing Drivers with the Microsoft Windows Driver Foundation
Developing Drivers with the Windows Driver Foundation (Pro Developer)
ISBN: 0735623740
EAN: 2147483647
Year: 2007
Pages: 224

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net