Losing and Restoring DirectDraw Surfaces

Surface object lifetimes are longer for the runtime's surface objects than they are for the driver's surface objects. In a few situations, most notably mode changes, surfaces become lost. This means that the driver's surface object is destroyed when DdDestroySurface is called, but the runtime's surface object is placed into a suspended state. Later, the runtime object can be restored, which corresponds to a DdCreateSurface call at the driver level.

Normally, drivers do not have to be aware of this intermediate lost state. However, there are some cases where an understanding of this process will help the driver writer.

Driver writers can elect to handle complex surface restoration in one atomic call. At surface restoration time, the DirectDraw runtime examines the driver's D3dCreateSurfaceEx entry point. If this entry point is defined, then the DirectDraw runtime restores all complex surfaces in one call to DdCreateSurface. The driver probably will not be able to differentiate between the original creation and the creation caused by restoring a surface.