共用方式為


3.1.4.2.6 RpcGetPrinter (Opnum 8)

RpcGetPrinter retrieves information about a specified printer.

 DWORD RpcGetPrinter(
   [in] PRINTER_HANDLE hPrinter,
   [in] DWORD Level,
   [in, out, unique, size_is(cbBuf), disable_consistency_check] 
     BYTE* pPrinter,
   [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). This value MAY be a handle to a print server object.<277>

Level: The level of printer information structure, as follows.

Value

Description

0x00000000

Corresponds to _PRINTER_INFO_STRESS (section 2.2.2.9.1).

0x00000001

Corresponds to _PRINTER_INFO_1 (section 2.2.2.9.2).

0x00000002

Corresponds to _PRINTER_INFO_2 (section 2.2.2.9.3).

0x00000003

Corresponds to _PRINTER_INFO_3 (section 2.2.2.9.4).

0x00000004

Corresponds to _PRINTER_INFO_4 (section 2.2.2.9.5).

0x00000005

Corresponds to _PRINTER_INFO_5 (section 2.2.2.9.6).

0x00000006

Corresponds to PRINTER_INFO_6 (section 2.2.2.9.7).

0x00000007

Corresponds to PRINTER_INFO_7 (section 2.2.2.9.8).

0x00000008

Corresponds to _PRINTER_INFO_8 (section 2.2.2.9.9).

0x00000009

Not valid remotely; the server MUST respond by returning ERROR_NOT_SUPPORTED.

pPrinter: A pointer to a BUFFER (INFO Structures Query Parameters (section 3.1.4.1.9)).

BUFFER TYPE: PRINTER_INFO.

cbBuf: A parameter specified in INFO Structures Query Parameters.

pcbNeeded: A parameter 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 as follows:

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:

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

  • Return the status of the operation.