3.1.4.5.5 RpcEnumForms (Opnum 34)

The RpcEnumForms method enumerates the forms that the specified printer supports.

 DWORD RpcEnumForms(
   [in] PRINTER_HANDLE hPrinter,
   [in] DWORD Level,
   [in, out, unique, size_is(cbBuf), disable_consistency_check] 
     BYTE* pForm,
   [in] DWORD cbBuf,
   [out] DWORD* pcbNeeded,
   [out] DWORD* pcReturned
 );

hPrinter: A handle to a printer object or server object that MUST have been opened by using the RpcAddPrinter, RpcAddPrinterEx, RpcOpenPrinter, or RpcOpenPrinterEx methods.

Level: This value refers to the level of form information structure, as follows.

Value

Description

0x00000001

Corresponds to _FORM_INFO_1 (section 2.2.2.5.1).

0x00000002

Corresponds to _FORM_INFO_2 (section 2.2.2.5.2).

pForm: This parameter MAY be NULL if cbBuf equals zero; otherwise, it is a pointer to the BUFFER, as specified in INFO Structures Query Parameters, section 3.1.4.1.9.

BUFFER TYPE: _FORM_INFO.

cbBuf: This parameter MUST adhere to the parameter specification in INFO Structures Query Parameters, section 3.1.4.1.9.

pcbNeeded: This parameter MUST adhere to the parameter specification in INFO Structures Query Parameters, section 3.1.4.1.9.

pcReturned: This parameter MUST adhere to the parameter specification 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 validate parameters as follows:

  • Perform the validation steps that are specified in PRINTER_HANDLE Parameters, section 3.1.4.1.11.

  • Perform the validation steps that are specified in INFO Structures Query Parameters, section 3.1.4.1.9.

  • The server MUST NOT perform access checks on the hPrinter object.

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:

  • Enumerate all forms on the printer or print server.

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

  • Return the status of the operation.