EnumPrinterDrivers

  BOOL EnumPrinterDrivers(lpPrinterServer, lpEnvironment, lpDriverInfo, cbBuf, pcbNeeded, lpcReturned)    
  LPPRINTERSERVER lpPrinterServer;    
  LPSTR lpEnvironment;    
  LPDRIVERINFO lpDriverInfo;    
  DWORD cbBuf;    
  LPDWORD pcbNeeded;    
  LPDWORD lpcReturned;    

The EnumPrinterDrivers function enumerates all the printer drivers installed on a specified printer server.

Parameters

lpPrinterServer

Pointer to a PRINTERSERVER data structure that specifies the printer server whose printer drivers will be enumerated.

The PRINTERSERVER data structure has the following form:

typedef struct tagPRINTERSERVER { /* psrv */

HANDLE hProvidor;

LPTSTR lpName;

LPTSTR lpDescription;

LPTSTR lpLocation;

LPVOID lpVendorSpecificVariable;

} PRINTERSERVER;

lpEnvironment

Pointer to a string that specifies the machine and operating system environment. An example is the string “Win32.486”.

lpDriverInfo

Pointer to a buffer that the function will fill with DRIVERINFO data structures for the enumerated printer drivers.

The DRIVERINFO data structure has the following form:

typedef struct tagDRIVERINFO { /* drvi */

DWORD cVersion;

LPSTR lpDriverName;

LPSTR lpEnvironment;

LPSTR lpDriverPath;

LPSTR lpDeviceName;

LPSTR lpDataFile;

LPSTR lpConfigFile;

} DRIVERINFO;

cbBuf

Specifies the size in bytes of the buffer pointed to by lpDriverInfo.

pcbNeeded

Pointer to a DWORD that the function will set to the number of bytes required to store all the DRIVERINFO data structures the function will return. The function sets this to zero if cbBuf was large enough.

lpcReturned

Pointer to a DWORD that the function will set to the number of printer drivers enumerated.

Return Value

If the function is successful, the return value is TRUE.

If the function fails, the return value is FALSE/NULL. Further information can be obtained by calling GetLastError.

See Also

AddPrinterDriver, GetPrinterDriver