The EnumPrinterDrivers function enumerates the printer drivers installed on a specified printer server.
BOOL EnumPrinterDrivers( _In_ LPTSTR pName, _In_ LPTSTR pEnvironment, _In_ DWORD Level, _Out_ LPBYTE pDriverInfo, _In_ DWORD cbBuf, _Out_ LPDWORD pcbNeeded, _Out_ LPDWORD pcReturned );
- pName [in]
A pointer to a null-terminated string that specifies the name of the server on which the printer drivers are enumerated.
If pName is NULL, the function enumerates the local printer drivers.
- pEnvironment [in]
A pointer to a null-terminated string that specifies the environment (for example, Windows x86, Windows IA64, Windows x64, or Windows NT R4000). If this parameter is NULL, the function uses the current environment of the caller/client (not of the destination/server).
If the pEnvironment string specifies "all", EnumPrinterDrivers enumerates printer drivers for all platforms installed on the specified server.
- Level [in]
The type of information structure returned in the pDriverInfo buffer. It can be one of the following.
- pDriverInfo [out]
A pointer to a buffer that receives an array of DRIVER_INFO_* structures, as specified by Level. Each structure contains data that describes an available printer driver. The buffer must be large enough to receive the array of structures and any strings or other data to which the structure members point.
To determine the required buffer size, call EnumPrinterDrivers with cbBuf set to zero. EnumPrinterDrivers fails, GetLastError returns ERROR_INSUFFICIENT_BUFFER, and the pcbNeeded parameter returns the size, in bytes, of the buffer required to hold the array of structures and their data.
- cbBuf [in]
The size, in bytes, of the buffer pointed to by pDriverInfo
- pcbNeeded [out]
A pointer to a variable that receives the number of bytes copied to the pDriverInfo buffer if the function succeeds. If the buffer is too small, the function fails and the variable receives the number of bytes required.
- pcReturned [out]
A pointer to a variable that receives the number of structures returned in the pDriverInfo buffer. This is the number of printer drivers installed on the specified print server.
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero.
Minimum supported client
|Windows 2000 Professional [desktop apps only]|
Minimum supported server
|Windows 2000 Server [desktop apps only]|
Unicode and ANSI names
|EnumPrinterDriversW (Unicode) and EnumPrinterDriversA (ANSI)|
- Print Spooler API Functions