共用方式為


3.1.4.4.3 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 3.1.4.2.3), RpcAddPrinterEx (section 3.1.4.2.15), RpcOpenPrinter (section 3.1.4.2.2), or RpcOpenPrinterEx (section 3.1.4.2.14).

pEnvironment: A parameter specified in Environment Name Parameters (section 3.1.4.1.3).

Level: The driver information level.

Value

Description

0x00000001

Corresponds to _DRIVER_INFO_1 (section 2.2.2.4.1).

0x00000002

Corresponds to _DRIVER_INFO_2 (section 2.2.2.4.2).

0x00000003

Corresponds to _DRIVER_INFO_3 (section 2.2.2.4.3).

0x00000004

Corresponds to _DRIVER_INFO_4 (section 2.2.2.4.4).

0x00000006

Corresponds to _DRIVER_INFO_6 (section 2.2.2.4.6).

0x00000008

Corresponds to _DRIVER_INFO_8 (section 2.2.2.4.8).

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

BUFFER TYPE: _DRIVER_INFO.

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 3.1.4.1.11)). This method SHOULD assume that the handle to the printer object can be used without further access checks.

  • Environment Name Parameters (section 3.1.4.1.3).

  • INFO Structures Query Parameters (section 3.1.4.1.9).

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.<331>

  • 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.