共用方式為


3.1.4.4.6 RpcGetPrinterDriver2 (Opnum 53)

RpcGetPrinterDriver2 retrieves printer driver data for the specified printer.<334>

 DWORD RpcGetPrinterDriver2(
   [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,
   [in] DWORD dwClientMajorVersion,
   [in] DWORD dwClientMinorVersion,
   [out] DWORD* pdwServerMaxVersion,
   [out] DWORD* pdwServerMinVersion
 );

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

0x00000005

Corresponds to _DRIVER_INFO_5 (section 2.2.2.4.5).

0x00000006

Corresponds to _DRIVER_INFO_6 (section 2.2.2.4.6).

0x00000008

Corresponds to _DRIVER_INFO_8 (section 2.2.2.4.8).

0x00000065

Corresponds to _DRIVER_INFO_101 (section 2.2.2.4.9).

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

BUFFER TYPE: _DRIVER_INFO.

This parameter can be NULL if cbBuf is zero.

cbBuf: A parameter specified in INFO Structures Query Parameters.

pcbNeeded: A parameter specified in INFO Structures Query Parameters.

dwClientMajorVersion: The implementation-specific major printer driver version of the client operating system.<335>

dwClientMinorVersion: The implementation-specific minor printer driver version of the client operating system.<336>

pdwServerMaxVersion: A pointer to a DWORD that receives the implementation-specific major version that the operating system supports for that printer driver.

pdwServerMinVersion: A pointer to a DWORD that receives the implementation-specific minimum version that the operating system supports for that printer driver.<337>

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 as follows:

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

  • Perform the validation steps specified in Environment Name Parameters.

  • Perform the validation steps specified in INFO Structures Query Parameters.

In addition, the print server SHOULD validate that, if the Level parameter is 0x00000065, the printer driver associated with the printer object has a driver version strictly less than 0x00000004. If that validation fails, this method MUST return ERROR_CAN_NOT_COMPLETE.<338>

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:

  • Find a printer driver that is compatible with the OS version on the specified print server that is specified by the value of the dwClientMajorVersion and dwClientMinorVersion parameters.

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

If parameter validation was successful, the server SHOULD also perform the following steps:

  • Store the actual compatible operating system version for the printer driver in the variables pointed to by the pdwServerMaxVersion and pdwServerMinVersion parameters.

  • Return the status of the operation.