Compartilhar via


3.1.4.3.4 RpcAddJob (Opnum 24)

RpcAddJob does not perform any function but returns a nonzero Windows error code to indicate failure.

 DWORD RpcAddJob(
   [in] PRINTER_HANDLE hPrinter,
   [in] DWORD Level,
   [in, out, unique, size_is(cbBuf), disable_consistency_check] 
     BYTE* pAddJob,
   [in] DWORD cbBuf,
   [out] DWORD* pcbNeeded
 );

hPrinter: A handle to a printer object that was opened using 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).

Level: A value that MUST be 0x00000001, 0x00000002 or 0x00000003.

pAddJob: A pointer to a buffer of undefined values. This value can be NULL if cbBuf is zero and Level is 0x00000001.

cbBuf: The size, in bytes, of the buffer pointed to by pAddJob. If Level is 0x00000002 or 0x00000003, this value SHOULD be greater than or equal to 10 bytes.

pcbNeeded: A pointer to a variable that SHOULD receive zero.

Return Values: This method MUST return a nonzero Windows error code to indicate failure [MS-ERREF].

Upon receiving this message, the server SHOULD validate parameters as follows:

  • Verify that Level is valid, and if this verification fails, return ERROR_INVALID_LEVEL.

  • If Level is 0x0000002 or 0x0000003, verify the following:

    • The value of cbBuf is greater than or equal to 10 bytes on 32-bit implementations and 18 bytes on 64-bit implementations. If this verification fails, return ERROR_INVALID_DATATYPE.

    • At offset 0 from the beginning of the pAddJob buffer, there is a 32-bit value on 32-bit implementations and a 64-bit value on 64-bit implementations, between 0 and cbBuf, inclusive. If this verification fails, return ERROR_INVALID_LEVEL.

    If parameter validation fails, the server SHOULD fail the operation immediately and return a nonzero error response to the client. Otherwise, the server MUST return ERROR_INVALID_PARAMETER.

This method MUST be implemented to ensure compatibility with protocol clients.