DrvConvertDevMode

BOOL DrvConvertDevMode(

LPTSTR pPrinterName,
PDEVMODE pdmIn,
PDEVMODE pdmOut,
PLONG pcbNeeded,
DWORD fMode
);

DrvConvertDevMode converts the specified DEVMODE.

Parameters

pPrinterName

Pointer to the name of the printer whose DEVMODE is to be converted. The driver passes this string to the Win32 OpenPrinter function to get related printer data.

pdmIn

Pointer to the input DEVMODE structure. If pdmIn is null, the driver need not perform a DEVMODE conversion. Otherwise, pdmIn must point to a DEVMODE that is valid to the driver.

pdmOut

Pointer to an output DEVMODE buffer. If fMode is CDM_CONVERT, the buffer must be a valid DEVMODE from this driver.

pcbNeeded

As input, pcbNeeded points to a LONG value that specifies the size, in bytes, of pdmOut. As output, pcbNeeded specifies the number of bytes converted and copied into pdmOut if the function succeeds. If the function fails because pdmOut is too small, pcbNeeded specifies the number of bytes required to perform the conversion.

fMode

Specifies the conversion to be performed. One of the following constants is specified to indicate how the converted or default DEVMODE should be returned:

Value Meaning
CDM_CONVERT The driver should determine that both pdmIn and pdmOut point to valid DEVMODEs that were previously returned by it. If either DEVMODE is null or invalid, the driver should set the last-error code to ERROR_INVALID_PARAMETER and return FALSE. Otherwise, the driver should convert the input DEVMODE to the output DEVMODE.
CDM_CONVERT351 If the input value of pcbNeeded specifies an output buffer of sufficient size, the driver should copy its Windows NT Version 3.51 default DEVMODE to pdmOut. Then, if pdmIn is not null, the driver should convert the input DEVMODE to its Windows NT 3.51 DEVMODE, merging the results in the buffer to which pdmOut points. If pcbNeeded does not point to a buffer of sufficient size, the driver should update pcbNeeded with the required buffer size, set the last-error code to ERROR_INSUFFICIENT_BUFFER, and return FALSE.
The driver should simply convert the DEVMODE to the current version if it does not have a Windows NT 3.51 DEVMODE version.
CDM_DRIVER_DEFAULT If the input value of pcbNeeded specifies an output buffer of sufficient size, the driver should copy the current version of its default DEVMODE to pdmOut. If pcbNeeded does not point to a buffer of sufficient size, the driver should update pcbNeeded with the required buffer size, set the last-error code to ERROR_INSUFFICIENT_BUFFER, and return FALSE. The pdmIn parameter is always null.

Return Value

DrvConvertDevMode returns TRUE when it succeeds; otherwise, it sets a last-error code and returns FALSE.

Comments

The spooler calls DrvConvertDevMode when a call is made to the Win32 SetPrinter or GetPrinter function. DrvConvertDevMode translates the DEVMODE from another operating system version to the DEVMODE of the spooler's operating system version. The interoperation of a network of machines with different operating system levels requires that a DEVMODE be converted so that it matches the version of the driver/operating system on a particular machine.