IPrintOemUni::DevMode method

The IPrintOemUni::DevMode method, provided by rendering plug-ins for Unidrv, performs operations on private DEVMODEW members.


   DWORD       dwMode,



Specifies a caller-supplied constant. See the Remarks section for more information.


Caller-supplied pointer to an OEMDMPARAM structure.

Return value

The method must return one of the following values.

Return codeDescription

The operation succeeded.


The operation failed



A rendering plug-in for Unidrv must implement the IPrintOemUni::DevMode method.

If you are providing a user interface plug-in for Unidrv, and if you are adding private members to the driver's DEVMODEW structure, you must implement both the IPrintOemUI::DevMode and the IPrintOemUni::DevMode methods. The code implementing these methods must be identical and can be placed in a library that is statically linked to both the UI plug-in and the rendering plug-in.

The IPrintOemUni::DevMode method must perform the operation indicated by its dwMode value. Each time IPrintOemUni::DevMode is called, dwMode contains one of the following constants, which are listed in the order they are received:


Indicates that the IPrintOemUni::DevMode method should return the size of the memory allocation needed to store the render plug-in's private DEVMODEW members. This constant is set the first time the method is called. The method should place the number of bytes needed in the OEMDMPARAM structure's cbBufSize member.

The printer driver DLL allocates the specified amount of memory and passes its address to the rendering plug-in in subsequent calls to IPrintOemUni::DevMode.


Indicates that the IPrintOemUni::DevMode method should fill the private DEVMODEW members with their default values. For this operation, the OEMDMPARAM structure's pOEMDMOut and cbBufSize members contain the address and size of the area that has been allocated for storage of private DEVMODEW members. The method should write the private DEVMODEW default values into the buffer pointed to by the pOEMDMOut member, and return the number of bytes written by placing it in the cbBufSize member.


Indicates the IPrintOemUni::DevMode method should convert private DEVMODEW members to the current version, if necessary. (EMF spooling can occur over a network, and the system that spooled the EMF records might be running an older or newer version of the printer driver or user interface plug-in.) A private DEVMODEW section's version number is contained in its OEM_DMEXTRAHEADER structure.

The public and private members of the DEVMODEW structure to be converted are pointed to by the OEMDMPARAM structure's pPublicDMIn and pOEMDMIn members. The IPrintOemUni::DevMode method should place converted private members in the memory space described by the structure's pOEMDMOut and cbBufSize members, and it should return the count of written bytes by placing it in the structure's cbBufSize member. The value returned in cbBufSize cannot be larger than the value received.


Indicates that the IPrintOemUni::DevMode method should validate the information contained in private DEVMODEW members and merge validated values into a private DEVMODEW structure containing default values. For this constant, the method receives the following DEVMODEW contents:

  • The OEMDMPARAM structure's pPublicDMIn and pOEMDMIn members point to the public and private members of the DEVMODEW structure to be validated.

  • The OEMDMPARAM structure's pPublicDMOut and pOEMDMOut members point to current default DEVMODEW values (obtained from property sheet contents).

The method should validate the contents of each private DEVMODEW member pointed to by pOEMDMIn. Each valid value should be copied to the output buffer pointed to by pOEMDMOut, overwriting the default. For invalid input values, the default output value should not be modified. (Finding invalid values is not considered an error, so the method should return S_OK.)


Target platform



Prcomoem.h (include Prcomoem.h)

See also




Send comments about this topic to Microsoft