Compartilhar via


Driver Initialization in Direct3D Mobile (Windows CE 5.0)

Send Feedback

Display driver initialization is a complex process that involves bus enumeration, the Graphics Device Interface (GDI) and many other Windows CE technologies. Before trying to develop a Microsoft® Direct3D® Mobile driver, you should already have developed a full display driver based for the Windows CE Device Driver Interface (DDI). This driver can use the Graphics Primitive Engine (GPE), but it is not required to do so. For more information, see How to Decide Whether to Use GPE in a Display Driver.

From the Direct3D Mobile middleware's perspective, initializing your driver involves finding its dynamically linked library (DLL), finding the entry point within that DLL, and then determining the driver's function names and the driver's properties.

Driver Naming

Remotely hooked Direct3D Mobile drivers exist in the Graphics, Windowing, and Events Subsystem (GWES) process as a DLL. In most cases, the Direct3D Mobile driver code and all other display driver functions will be linked into the same DLL. However, this is not a requirement.   The following list shows the procedure that Direct3D Mobile's GWES code follows to determine the driver's name.

  1. It opens and reads the registry key HKEY_LOCAL_MACHINE\System\GDI\Drivers\D3DMOverride to see if it contains a string value that contains the driver's file name.
  2. If the previous step fails, Direct3D Mobile opens and reads the registry key HKEY_LOCAL_MACHINE\System\GDI\Drivers\MainDisplay to see if it contains a string value that contains the driver's file name. This string value identifies the primary display driver for the device and is populated by GWES and the bus enumerator.
  3. If the previous step fails, Direct3D Mobile assumes the driver name Ddi.dll.

Direct3D Mobile Entry

After the Direct3D Mobile middleware has determined the name of the driver, it attempts to load the driver DLL into the GWES process space. It then attempts to use GetProcAddress to determine the entry point for D3DM_Initialize.

Note   For IDirect3DMobile::RegisterSoftwareDevice, the application passes a pointer to the software device's D3DM_Initialize routine directly to the middleware.

The middleware assumes that the initialization has the following prototype shown in the following code example.

DWORD D3DM_Initialize(D3DM_INITIALIZE_DATA *);

If the middleware is unable to locate the driver DLL or the driver's entry point, Direct3D Mobile will be unusable on the device.

After the entry point is located, the middleware calls the address of a D3DM_INITIALIZE_DATA structure. The Direct3D Mobile driver must fill out this structure with function pointers to the driver's interfacing functions. The middleware assumes that all of these pointers are valid function addresses. After the structure has been initialized, the driver should return D3DM_DRIVER_HANDLED. The driver must initialize every member of the structure.

The Direct3D Mobile device driver has its own entry point. It is not dependent on the DirectDraw device driver interface, unlike earlier versions of Direct3D on Windows CE.

Gathering Data

The Direct3D Mobile middleware uses the D3DM_GetAdapterInfo function to gather information from the device. The D3DM_GETADAPTERINFO_DATA structure defines all of the data that Direct3D Mobile will use from this call. Each time D3DM_GetAdapterInfo is called, the driver must provide as much information possible to the middleware, and it must provide this information as accurately as possible.

The middleware does not cache any device information. Each time it needs a specific piece of information, the middleware makes another call to D3DM_GetAdapterInfo. This allows the driver to continually report the most current information to the middleware.

See Also

Driver Interactions with the Direct3D Mobile Middleware | D3DM_DRIVER Values

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.