EngGetPrinterDriver function (winddi.h)

The EngGetPrinterDriver function retrieves driver data for the specified printer.


ENGAPI BOOL EngGetPrinterDriver(
  [in]            HANDLE hPrinter,
  [in, optional]  LPWSTR pEnvironment,
  [in]            DWORD  dwLevel,
  [out, optional] BYTE   *lpbDrvInfo,
  [in]            DWORD  cbBuf,
  [out]           DWORD  *pcbNeeded


[in] hPrinter

Handle to the printer for which the driver data should be retrieved.

[in, optional] pEnvironment

Pointer to a null-terminated string that specifies the environment. For example, "Windows NT x86" specifies an NT-based operating system running on an Intel processor. If pEnvironment is NULL, the current environment of the calling driver and client machine is used.

[in] dwLevel

Specifies the version of the structure to which lpbDrvInfo points. This parameter must be one of the following values:

Value Meaning
1 GDI writes a DRIVER_INFO_1 structure in the buffer to which lpbDrvInfo points.
2 GDI writes a DRIVER_INFO_2 structure in the buffer to which lpbDrvInfo points.
3 GDI writes a DRIVER_INFO_3 structure in the buffer to which lpbDrvInfo points.

[out, optional] lpbDrvInfo

Pointer to a buffer in which GDI places the requested DRIVER_INFO_X structure.

[in] cbBuf

Specifies the size, in bytes, of the buffer to which lpbDrvInfo points.

[out] pcbNeeded

Pointer to a memory location in which GDI places the number of bytes copied into the buffer to which lpbDrvInfo points upon success, or the number of bytes required if cbBuf is too small.

Return value

EngGetPrinterDriver returns TRUE upon success; otherwise it reports an error and returns FALSE.


A printer driver DLL can work with multiple data files to support different printer models. The printer driver calls EngGetPrinterDriver to determine which data file to use. For example, the Unidrv renderer calls this function to determine the name of a GPD file, and the postscript driver calls this function to determine the name of a PPD file. The DRIVER_INFO_2 and DRIVER_INFO_3 structures contain a full path and file name specifying the location of the data file. The printer driver can then use the returned path and file name to load the data file by calling EngLoadModule with the path and file name as a single argument.

The DRIVER_INFO_X structures are described in the Microsoft Windows SDK documentation.


Minimum supported client Available in Windows 2000 and later versions of the Windows operating systems.
Target Platform Universal
Header winddi.h (include Winddi.h)
Library Win32k.lib
DLL Win32k.sys

See also