EnumPrinterDataEx

[This is preliminary documentation and subject to change.]

The EnumPrinterDataEx function enumerates all value names and data for a specified printer and key.

Printer data is stored in the registry. While enumerating printer data, do not call registry functions that might change the data.

DWORD EnumPrinterDataEx(
  HANDLE hPrinter,       // handle to printer object
  LPCTSTR pKeyName,      // name of registry key
  LPBYTE pEnumValues,    // receives array of PRINTER_ENUM_VALUES 
  DWORD cbEnumValues,    // size, in bytes, of the pEnumValues buffer
  LPDWORD pcbEnumValues, // receives number of bytes of data
                         // retrieved in the pEnumValues buffer
  LPDWORD pnEnumValues   // receives number of enumerated values
);
 

Parameters

hPrinter
Handle to the printer for which the function retrieves configuration data. Use the OpenPrinter function to retrieve a printer handle.
pKeyName
Pointer to a null-terminated string that specifies the key containing the values to enumerate. Use the backslash ( \ ) character as a delimiter to specify a path with one or more subkeys. EnumPrinterDataEx enumerates all values of the key, but does not enumerate values of subkeys of the specified key. Use the EnumPrinterKey function to enumerate subkeys.

If pKeyName is NULL or an empty string, EnumPrinterDataEx returns ERROR_INVALID_PARAMETER.

pEnumValues
Pointer to a buffer that receives an array of PRINTER_ENUM_VALUES structures. Each structure contains the value name, type, data, and sizes of a value under the key.
cbEnumValues
Specifies the size, in bytes, of the buffer pointed to by pData. If you set cbEnumValues to zero, the pcbEnumValues parameter returns the required buffer size.
pcbEnumValues
Pointer to a variable that receives the size, in bytes, of the retrieved configuration data. If the buffer size specified by cbEnumValues is too small, the function returns ERROR_MORE_DATA and pcbEnumValues indicates the required buffer size.
pnEnumValues
Pointer to a variable that receives the number of PRINTER_ENUM_VALUES structures returned in pEnumValues.

Return Values

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is a Win32 error value.

Remarks

EnumPrinterDataEx retrieves printer configuration data set by the SetPrinterDataEx and SetPrinterData functions.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in winspool.h.
  Import Library: Use winspool.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Printing and Print Spooler Overview, Printing and Print Spooler Functions, DeletePrinterDataEx, EnumPrinterKey, GetPrinterDataEx, OpenPrinter, PRINTER_ENUM_VALUES, SetPrinterData, SetPrinterDataEx