PSCRIPT5_PRIVATE_DEVMODE structure (printoem.h)
The PSCRIPT5_PRIVATE_DEVMODE structure enables Pscript5 plug-ins to determine the size of the private portion of Pscript5's DEVMODEW structure.
Syntax
typedef struct _PSCRIPT5_PRIVATE_DEVMODE {
WORD wReserved[57];
WORD wSize;
} PSCRIPT5_PRIVATE_DEVMODE, *PPSCRIPT5_PRIVATE_DEVMODE;
Members
wReserved[57]
Reserved for system use.
wSize
The size, in bytes, of the private portion of Pscript5's DEVMODEW structure.
Remarks
For information about the public and private sections of the DEVMODEW structure, see DEVMODEW.
Printoem.h defines a macro that you can use to determine the size of the private portion of Pscript5's DEVMODEW structure.
#define GET_PSCRIPT5_PRIVATE_DEVMODE_SIZE(pdm)\
( ( (pdm)->dmDriverExtra > (FIELD_OFFSET(PSCRIPT5_PRIVATE_DEVMODE, wSize) + sizeof(WORD)) ) ? \
((PPSCRIPT5_PRIVATE_DEVMODE)((PBYTE)(pdm) + (pdm)-> dmSize)) -> wSize : 0 )
The pdm argument in the GET_PSCRIPT5_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 PSCRIPT5_PRIVATE_DEVMODE structure. If so, the macro returns the value of the wSize member in the PSCRIPT5_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:
Call the GET_PSCRIPT5_PRIVATE_DEVMODE_SIZE macro, passing the address of the DEVMODEW structure in the call.
Verify that (pdm)->dmDriverExtra is larger than the value returned by the macro. (The macro returns the value of the wSize member of the PSCRIPT5_PR****IVATE_DEVMODE structure.)
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 Pscript5 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.
Verify that the private portion of your plug-in's DEVMODEW structure begins with a valid OEM_DMEXTRAHEADER structure.
Requirements
Requirement | Value |
---|---|
Header | printoem.h (include Printoem.h) |