<div class="content"><p>RpcEnumJobs retrieves information about a specified set of <a href="831cd729-be7c-451e-b729-bd8d84ce4d24#gt_12a6e569-e97c-4761-92f0-e397f8d5125f" data-linktype="relative-path">print jobs</a> for a specified
printer or <a href="831cd729-be7c-451e-b729-bd8d84ce4d24#gt_ac027425-6043-4ad3-be27-56a381b75d38" data-linktype="relative-path">port</a>.</p><dl>
<dd>
<div><pre> 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
 );
</pre></div>
</dd></dl><p><b>hPrinter: </b>A handle to a printer object or port
object that was opened by <a href="bd0bb8d5-26fd-4705-81f5-614d32b9f38f" data-linktype="relative-path">RpcAddPrinter (section 3.1.4.2.3)</a>,
<a href="3af45717-308f-4b4f-8428-430d12856110" data-linktype="relative-path">RpcAddPrinterEx (section 3.1.4.2.15)</a>,
<a href="989357e2-446e-4872-bb38-1dce21e1313f" data-linktype="relative-path">RpcOpenPrinter (section 3.1.4.2.2)</a>,
or <a href="0e81ce18-72b1-46c3-8584-a205393b04ff" data-linktype="relative-path">RpcOpenPrinterEx (section 3.1.4.2.14)</a>.</p><p><b>FirstJob: </b>The zero-based position within the <a href="831cd729-be7c-451e-b729-bd8d84ce4d24#gt_569f1f1c-f426-46fa-91d2-3d1eb0b19aa1" data-linktype="relative-path">print queue</a> of the first
print job to enumerate.</p><p><b>NoJobs: </b>The total number of print jobs to
enumerate.</p><p><b>Level: </b>The job information level.</p><dl>
<dd>
<p>This value MUST be 0x00000001, 0x00000002,
0x00000003, or 0x00000004.</p>
</dd></dl><p><b>pJob: </b>A pointer to the <a href="f29e9057-df29-40d4-9c51-c615c0da62a1" data-linktype="relative-path">BUFFER</a> structure specified
in INFO Structures Query Parameters (section 3.1.4.1.9). </p><p><b>BUFFER TYPE:</b> _JOB_INFO.</p><dl>
<dd>
<p>This parameter can be NULL if <i>cbBuf</i> equals
zero.</p>
</dd></dl><p><b>cbBuf: </b>Specified in INFO Structures Query
Parameters (section 3.1.4.1.9).</p><p><b>pcbNeeded: </b>Specified in INFO Structures Query
Parameters (section 3.1.4.1.9).</p><p><b>pcReturned: </b>Specified in INFO Structures Query
Parameters (section 3.1.4.1.9).</p><p><b>Return Values: </b>This method MUST return zero
(ERROR_SUCCESS) to indicate successful completion or a nonzero Windows error
code to indicate failure <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>.</p><p>Upon receiving this message, the server MUST validate
parameters as follows:</p><ul><li><p><span><span> 
</span></span>Perform the validation steps specified in <a href="10bfa8c2-d456-4ad0-912d-e674766a36c8" data-linktype="relative-path">PRINTER_HANDLE
Parameters (section 3.1.4.1.11)</a>. This method SHOULD assume that
the handle to the printer or port object can be used without further access checks.</p>
</li><li><p><span><span> 
</span></span>Perform the validation steps specified in INFO Structures Query
Parameters (section 3.1.4.1.9).</p>
</li></ul><p>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:</p><ul><li><p><span><span> 
</span></span>If <i>hPrinter</i> specifies a printer object, enumerate jobs on
the job queue of the printer, up to the number specified by the <i>NoJobs</i>
parameter, starting with the job whose index is specified by the <i>FirstJob</i>
parameter.</p>
</li><li><p><span><span> 
</span></span>If <i>hPrinter</i> 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 <i>NoJobs</i> parameter, starting with the job whose index is
as specified by the <i>FirstJob</i> parameter. The method for selecting an
arbitrary printer SHOULD match the method used when <a href="90f95ff0-3ae0-4dde-a83d-35f457c710a6" data-linktype="relative-path">RpcStartDocPrinter (section 3.1.4.9.1)</a>
is called with a port object.</p>
</li><li><p><span><span> 
</span></span>Using the enumerated objects, perform the processing and response
steps specified in section 3.1.4.1.9.</p>
</li><li><p><span><span> 
</span></span>Return the status of the operation.</p>
</li></ul></div>