A printer interface DLL's DrvConvertDevMode function is responsible for converting a printer's DEVMODE structure from one version to another.
BOOL
DrvConvertDevMode(
LPTSTR pPrinterName,
PDEVMODE pdmIn,
PDEVMODE pdmOut,
PLONG pcbNeeded,
DWORD fMode
);
| Flag | Definition |
|---|---|
| CDM_CONVERT | |
| The function should convert the contents of the input DEVMODE structure (pointed to by pdmIn) into a new DEVMODE structure, and place the result in the DEVMODE structure pointed to by pdmOut. The initial contents of the received output DEVMODE structure (pointed to by pdmOut) should be used to determine the output version. | |
| CDM_CONVERT351 | |
| The function should convert the contents of the input DEVMODE structure (pointed to by pdmIn), creating an output DEVMODE structure that is compatible with Windows NT 3.51, and place the result in the DEVMODE structure pointed to by pdmOut.
If the driver does not support a DEVMODE structure for Windows NT 3.51, the function should convert the input DEVMODE to the current version. |
|
| CDM_DRIVER_DEFAULT | |
| The function should copy the current version of its default DEVMODE structure to the buffer pointed to by pdmOut. | |
If the operation succeeds, the function should return TRUE; otherwise, it should call SetLastError to set an error code, and return FALSE.
Declared in winddiui.h. Include winddiui.h.
In a client/server environment, a client might be running one version of the operating system or printer driver while the server (spooler) is running another, which means a printer's DEVMODE structure definition might be inconsistent between the client and server. The DrvConvertDevMode function must be capable of performing conversions from one version of the printer's DEVMODE structure to another.
When converting from one DEVMODE version to another, both public and private DEVMODE members must be included.
The printer name pointed to by pPrinterName can be used as an input argument to the OpenPrinter function, which can be called to obtain stored default values when the CDM_DRIVER_DEFAULT flag is received.
The function should verify that both pdmIn and pdmOut (if applicable) point to valid DEVMODE structures. If they don't, the function should call SetLastError(ERROR_INVALID_PARAMETER) and return FALSE. If the output DEVMODE size specified by pcbNeeded is too small, the driver should overwrite the size value supplied by pcbNeeded with the required buffer size, call SetLastError(ERROR_INSUFFICIENT_BUFFER), and return FALSE.
The DrvConvertDevMode function runs in the spooler's context and must therefore not display a user interface.