RpcGetPrinterDriver (Opnum 11)

RpcGetPrinterDriver retrieves printer driver data for the specified printer.

 DWORD RpcGetPrinterDriver(
   [in] PRINTER_HANDLE hPrinter,
   [in, string, unique] wchar_t* pEnvironment,
   [in] DWORD Level,
   [in, out, unique, size_is(cbBuf), disable_consistency_check] 
     BYTE* pDriver,
   [in] DWORD cbBuf,
   [out] DWORD* pcbNeeded

hPrinter: A handle to a printer object that was opened by RpcAddPrinter (section, RpcAddPrinterEx (section, RpcOpenPrinter (section, or RpcOpenPrinterEx (section

pEnvironment: A parameter specified in Environment Name Parameters (section

Level: The driver information level.




Corresponds to _DRIVER_INFO_1 (section


Corresponds to _DRIVER_INFO_2 (section


Corresponds to _DRIVER_INFO_3 (section


Corresponds to _DRIVER_INFO_4 (section


Corresponds to _DRIVER_INFO_6 (section


Corresponds to _DRIVER_INFO_8 (section

pDriver: An optional pointer to BUFFER, as specified in INFO Structures Query Parameters (section


This parameter SHOULD be NULL if cbBuf is zero.

cbBuf: Specified in INFO Structures Query Parameters.

pcbNeeded: Specified in INFO Structures Query Parameters.

Return Values: This method MUST return zero (ERROR_SUCCESS) to indicate successful completion or a nonzero Windows error code to indicate failure [MS-ERREF].

Upon receiving this message, the server MUST validate parameters by performing the validation steps specified in:

  • PRINTER_HANDLE Parameters (section This method SHOULD assume that the handle to the printer object can be used without further access checks.

  • Environment Name Parameters (section

  • INFO Structures Query Parameters (section

If parameter validation fails, the server MUST fail the operation immediately and return a nonzero error response to the client. Otherwise, the server MUST process the message and compose a response to the client as follows:

  • The server SHOULD select a printer driver that meets the following specifications:

    • Compatible with the environment specified by the pEnvironment parameter.

    • Compatible with one of the printer drivers listed in the pszzPreviousNames member of the DRIVER_INFO of the printer driver that is associated with the printer.

      If such a printer driver cannot be located, the server SHOULD return ERROR_UNKNOWN_PRINTER_DRIVER.<315>

  • Using the information about the printer driver, perform the processing and response steps specified in INFO Structures Query Parameters.

  • Return the status of the operation.