共用方式為


3.1.4.4.2 RpcEnumPrinterDrivers (Opnum 10)

RpcEnumPrinterDrivers enumerates the printer drivers installed on a specified print server.

 DWORD RpcEnumPrinterDrivers(
   [in, string, unique] STRING_HANDLE pName,
   [in, string, unique] wchar_t* pEnvironment,
   [in] DWORD Level,
   [in, out, unique, size_is(cbBuf), disable_consistency_check] 
     BYTE* pDrivers,
   [in] DWORD cbBuf,
   [out] DWORD* pcbNeeded,
   [out] DWORD* pcReturned
 );

pName: Specified in Print Server Name Parameters (section 3.1.4.1.4).

pEnvironment: Specified in Environment Name Parameters (section 3.1.4.1.3).<327>

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

pDrivers: 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 equals zero.

cbBuf: Specified in INFO Structures Query Parameters (section 3.1.4.1.9).

pcbNeeded: Specified in INFO Structures Query Parameters (section 3.1.4.1.9).

pcReturned: Specified in INFO Structures Query Parameters (section 3.1.4.1.9).

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 perform the validation steps specified in the following sections:

  • Print Server Name Parameters (section 3.1.4.1.4).

  • Environment Name Parameters (section 3.1.4.1.3).

  • INFO Structures Query Parameters (section 3.1.4.1.9).

Additional validation MAY<328> be performed.

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:<329>

  • Enumerate all drivers on the specified print server that match the requested environment.

  • Using the enumerated objects, perform the processing and response steps specified in INFO Structures Query Parameters (section 3.1.4.1.9).

  • If at any point during the operation the print server failed to calculate the size of the INFO structure for any printer driver, the print server SHOULD fail the operation immediately and return ERROR_CAN_NOT_COMPLETE.<330>

  • Return the status of the operation.