|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
This section describes the steps required to implement minimal DirectDraw HAL functionality in your display driver without using GPE. This section assumes that you do not wish to move an existing DirectDraw HAL from desktop Windows to Windows CE. For information on doing that, please see the chapter, Porting your DDHAL from the Desktop.
Before you continue, you will need the following items to implement a simple DDHAL in your display driver:
TARGETNAME=BINARYNAMEsection of your
sourcesfile, and ends with the
First, copy the following header file from the basic HAL source code into an appropriate location inside your display driver's build directory:
This header file is private to your display driver, and can be
modified to contain whatever you like. You must customize this file
to implement the
IN_BUSYmacros, since they are required by the sample
Next, copy the following source code files from the basic HAL source code into your display driver's build directory, and add them to the appropriate build files:
Then, copy the following header files from the DDGPE package into your display driver's build directory:
DirectDraw requires that your display driver export the HALInitfunction. You should modify the HalCaps.cpp file that you just added. It should implement HALInit.
EXTERN_C BOOL WINAPI HALInit ( LPDDHALINFO lpddhi, BOOL reset, DWORD modeidx );
The HALInitfunction is normally responsible for setting up various global variables. It then calls buildDDHALInfowith the appropriate parameters, so it can make DirectDraw aware of the driver's support and capabilities. Since you are responsible for writing HALInit, you can add whatever features you want.
Now you should modify the file used to export functions from your compiled binary to export the HALInitfunction you have created. You can consult the sample driver source code file DDI.def to see how this is done.
The most difficult part of this process is the actual implementation your DDHAL functions. Consult Exported DDHAL Functionsfor a list of functions that you will need to replace with your own implementation. Fill the appropriate HAL function stubs with your own code, and modify the callback structures where necessary. Consult the DirectDraw Hardware Abstraction Layer specification for more information.
Note Drivers should NOT expose the DDCAPS_CANCLIPflag, nor should they override the SetClipListfunction even if the device has hardware clipping. DirectDraw does not take advantage of hardware clipping directly. Instead, it relies on the GDI clipping engine.
You should modify the DDHFuncs.h header file to remove unneeded code that could be confusing in the future. You might also want to rename the header file to HalFuncs.h so it corresponds to the naming conventions of the other DDHAL source code files in your directory, and does not conflict with the standard DDHFuncs.h that is part of DDGPE. Remove all GPE-specific global variables and function prototypes, and add prototypes for any functions and global variables that you have added and wish to access elsewhere in your source code.
Finally, your driver initialization code should start up
DirectDraw support by loading the
Now you are ready to compile and build your display driver to ensure that it continues to work properly. Once you have verified that it is still functional, your driver is ready to be tested with DirectDraw programs. Keep in mind that the code is not in an optimized state, and will require some customization to improve performance. See Customizing Your DDHALfor more information.
Last updated on Tuesday, July 13, 2004