EnumPrinterKey

[This is preliminary documentation and subject to change.]

The EnumPrinterKey function enumerates the subkeys of a specified key for a specified printer.

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

DWORD EnumPrinterKey(
  HANDLE hPrinter,       // handle to printer object
  LPCTSTR pKeyName,      // name of registry key
  LPTSTR pSubkey,        // receives array of subkey names
  DWORD cbSubkey,        // size, in bytes, of the pSubkey buffer
  LPDWORD pcbSubkey      // receives number of bytes of data
                         // retrieved in the pSubkey buffer
);
 

Parameters

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

If pKeyName is an empty string (""), EnumPrinterKey enumerates the top-level key for the printer. If pKeyName is NULL, EnumPrinterKey returns ERROR_INVALID_PARAMETER.

pSubkey
Pointer to a buffer that receives an array of null-terminated subkey names. The array is terminated by two null characters.
cbSubkey
Specifies the size, in bytes, of the buffer pointed to by pSubkey. If you set cbSubkey to zero, the pcbSubkey parameter returns the required buffer size.
pcbSubkey
Pointer to a variable that receives the number of bytes retrieved in the pSubkey buffer. If the buffer size specified by cbSubkey is too small, the function returns ERROR_MORE_DATA and pcbSubkey indicates the required buffer size.

Return Values

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is a Win32 error value. If pKeyName does not exist, the return value is ERROR_FILE_NOT_FOUND.

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, GetPrinterDataEx, OpenPrinter, SetPrinterDataEx