UNIDRV_PRIVATE_DEVMODE structure

The UNIDRV_PRIVATE_DEVMODE structure enables Unidrv plug-ins to determine the size of the private portion of Unidrv's DEVMODEW structure.

Syntax

typedef struct _UNIDRV_PRIVATE_DEVMODE {
  WORD wReserved[4];
  WORD wSize;
} UNIDRV_PRIVATE_DEVMODE, *PUNIDRV_PRIVATE_DEVMODE;

Members

wReserved

Reserved for system use.

wSize

The size, in bytes, of the private portion of Unidrv's DEVMODEW structure.

Remarks

For information about the public and private sections of the DEVMODEW structure, see The DEVMODEW Structure.

Printoem.h defines a macro for determining the size of the private portion of Unidrv's DEVMODEW structure.

#define GET_UNIDRV_PRIVATE_DEVMODE_SIZE(pdm)\
    ( ( (pdm)->dmDriverExtra > (FIELD_OFFSET(UNIDRV_PRIVATE_DEVMODE, wSize) + sizeof(WORD)) ) ? \
    ((PUNIDRV_PRIVATE_DEVMODE)((PBYTE)(pdm) + (pdm)-> dmSize)) -> wSize : 0 )

The pdm argument in the GET_UNIDRV_PRIVATE_DEVMODE_SIZE macro is a pointer to a DEVMODEW structure. The macro determines whether the value of the dmDriverExtra member of the DEVMODEW structure is larger than the byte offset of the wSize member of the UNIDRV_PRIVATE_DEVMODE structure. If so, the macro returns the value of the wSize member in the UNIDRV_PRIVATE_DEVMODE structure. If not, the macro returns zero.

To safely determine the address of the private portion of your plug-in's DEVMODEW structure, do the following:

  1. Call the GET_UNIDRV_PRIVATE_DEVMODE_SIZE macro, passing the address of the DEVMODEW structure in the call.

  2. Verify that (pdm)->dmDriverExtra is larger than the value returned by the macro. (The macro returns the value of the wSize member of the UNIDRV_PRIVATE_DEVMODE structure.)

  3. Determine the address of the private portion of your plug-in's DEVMODEW structure as follows.

    pdmPlugin = (PBYTE)(pdm) + (pdm)->dmSize + wSize;
    

    The preceding example starts with the address of the public DEVMODEW structure (pdm), adds the number of bytes of this structure (pdm->dmSize), and then adds the size in bytes of the Unidrv private DEVMODEW structure (wSize). A plug-in's private DEVMODEW data begins at this memory address. If there are multiple plug-ins chained together, the address returned by this example is that of the first plug-in's private DEVMODEW data. The second plug-in's private DEVMODEW data follows the first plug-in's private DEVMODEW data, the third plug-in's private DEVMODEW data follows that of the second plug-in's private DEVMODEW data, and so on. A plug-in developer who needs to determine the address of the n-th plug-in's private DEVMODEW data must know the sizes of the private DEVMODEW data for the first n - 1 plug-ins.

  4. Verify that the private portion of your plug-in's DEVMODEW structure begins with a valid OEM_DMEXTRAHEADER structure.

Requirements

   
Header printoem.h (include Printoem.h)

See Also

PSCRIPT5_PRIVATE_DEVMODE