GetPrinterDataEx

[This is preliminary documentation and subject to change.]

The GetPrinterDataEx function retrieves configuration data stored for the specified printer-or print server by the SetPrinterDataEx or SetPrinterData functions.

DWORD GetPrinterDataEx(
  HANDLE hPrinter,     // handle to printer or print server
  LPCTSTR pKeyName,    // name of registry key
  LPCTSTR pValueName,  // name of registry value
  LPDWORD pType,       // receives type of data stored in value
  LPBYTE pData,        // buffer that receives configuration data
  DWORD nSize,         // size, in bytes, of the buffer
  LPDWORD pcbNeeded    // receives the required buffer size, in bytes 
);
 

Parameters

hPrinter
Handle to the printer or print server for which the function retrieves configuration data. Use the OpenPrinter function to retrieve this handle.
pKeyName
Pointer to a null-terminated string that specifies the key containing the value to be retrieved. Use the backslash ( \ ) character as a delimiter to specify a path that has one or more subkeys.

If hPrinter identifies a printer and pKeyName is NULL or an empty string, GetPrinterDataEx returns ERROR_INVALID_PARAMETER.

If hPrinter identifies a print server, pKeyName must be NULL.

pValueName
Pointer to a null-terminated string that identifies the data to retrieve.

For printers, this string specifies the name of a value under the pKeyName key.

For print servers, this string is one of the predefined strings listed in the following Remarks section.

pType
Pointer to a variable that receives the type of data stored in the value. The function returns the type specified in the SetPrinterDataEx call when the data was stored. This parameter can be NULL if you don't need the information.
pData
Pointer to a buffer that receives the configuration data.
nSize
Specifies the size, in bytes, of the buffer pointed to by pData.
pcbNeeded
Pointer to a variable that receives the size, in bytes, of the configuration data. If the buffer size specified by nSize is too small, the function returns ERROR_MORE_DATA, and pcbNeeded 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 an error value.

Remarks

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

If hPrinter is a handle to a print server, pValueName can specify one of the following predefined values.

SPLREG_DEFAULT_SPOOL_DIRECTORY
SPLREG_PORT_THREAD_PRIORITY_DEFAULT
SPLREG_PORT_THREAD_PRIORITY
SPLREG_SCHEDULER_THREAD_PRIORITY_DEFAULT
SPLREG_SCHEDULER_THREAD_PRIORITY
SPLREG_BEEP_ENABLED
SPLREG_NET_POPUP
SPLREG_EVENT_LOG
SPLREG_MAJOR_VERSION
SPLREG_MINOR_VERSION
SPLREG_ARCHITECTURE
SPLREG_OS_VERSION

Calling GetPrinterDataEx with the pKeyName parameter set to "PrinterDriverData" is equivalent to calling the GetPrinterData function.

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