## Printer Device Driver

[prev][next][parent][TOC]

### OS2_PM_DRV_ENABLE

Switches to the required Enable subfunction.

The OS2_PM_DRV_ENABLE entry point handles the DC management functions. Those functions can be placed in three categories:

Transactions involved in opening a DC.
Transactions involved in closing a DC.
Other DC functions. This includes SaveDC, RestoreDC, and ResetDC.

Opening and Closing DCs

The open and close transaction sequences are symmetric:

Open Transactions Close Transactions
FillLogDevBlk No Equivalent
FillPhyDevBlk DisablePhyDevBlk
EnableDC DisableDC
CompleteOpenDC BeginCloseDC

Each of the Close Transactions undoes the actions taken by its corresponding Open transaction. For example, the EnableDC function allocates the DDC data area within the driver and returns the HDDC handle to identify that area. The corresponding Disable DC function invalidates the HDDC handle and deallocates the DDC data area.

The FillLogDevBlk transaction occurs when some thread of a process opens the first instance of a DC for this driver. During this transaction, a dispatch table will be created for later use by the graphics engine.

Except for the OS2_PM_DRV_ENABLE, OS2_PM_DRV_DEVMODE and OS2_PM_DRV_ DEVICENAMES calls, all DDI interface calls are dispatched through the function table created here. This means that most calls go directly to the correct function rather than indirectly through a hierarchy of function layers.

The FillPhyDevBlk transaction will occur only if the result flags from the FillLogDevBlk transaction indicate that it is necessary. It is used by device drivers that support multiple types of physical devices. It will occur during the DevOpen for the first DC associated with a particular type of physical device.

This function is responsible for memory allocations and initializations relating to a physical device.

During the EnableDC transaction, the driver will allocate and format the driver-specific data (the DDC) associated with the DC being constructed.

At CompleteOpenDC time the DC is completely constructed and initialized. This transaction gives the driver an opportunity to make final adjustments to the DC before the application gains access to it.

Saving and Restoring DCs

These functions manage a stack of entries that correspond to most of the states of a DC. SaveDC pushes an entry on the stack. RestoreDC retrieves one of the pushed entries and uses it to revert the DC back to its earlier saved state. Note that a particular RevertDC call might pop more than one entry from stack of SaveDC entries.

Resetting DCs

This call resets a DC to its original initialized state as it was just after the CompleteOpenDC transaction.