3.1.4.3.3 RpcEnumJobs (Opnum 4)

RpcEnumJobs retrieves information about a specified set of print jobs for a specified printer or port.

 DWORD RpcEnumJobs(
   [in] PRINTER_HANDLE hPrinter,
   [in] DWORD FirstJob,
   [in] DWORD NoJobs,
   [in] DWORD Level,
   [in, out, unique, size_is(cbBuf), disable_consistency_check] 
     BYTE* pJob,
   [in] DWORD cbBuf,
   [out] DWORD* pcbNeeded,
   [out] DWORD* pcReturned
 );

hPrinter: A handle to a printer object or port 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).

FirstJob: The zero-based position within the print queue of the first print job to enumerate.

NoJobs: The total number of print jobs to enumerate.

Level: The job information level.

This value MUST be 0x00000001, 0x00000002, 0x00000003, or 0x00000004.

pJob: A pointer to the BUFFER structure specified in INFO Structures Query Parameters (section 3.1.4.1.9).

BUFFER TYPE: _JOB_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, as specified in [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 or port object can be used without further access checks.

  • Perform the validation steps specified in 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:

  • If hPrinter specifies a printer object, enumerate jobs on the job queue of the printer, up to the number specified by the NoJobs parameter, starting with the job whose index is specified by the FirstJob parameter.

  • If hPrinter specifies a port object, enumerate jobs on the job queue of an arbitrary printer associated with that port, up to the number specified by the NoJobs parameter, starting with the job whose index is as specified by the FirstJob parameter. The method for selecting an arbitrary printer SHOULD match the method used when RpcStartDocPrinter (section 3.1.4.9.1) is called with a port object.

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

  • Return the status of the operation.

Show: