3.2.5.6 NetPrintJobSetInfo Command

The Remote Administration Protocol server MUST process the NetPrintJobSetInfoRequest as follows:

  1. The server MUST validate that the incoming ParamDesc field of the Remote Administration Protocol request contains the ASCII string "WWsTP"; if it does not, the server SHOULD format a Remote Administration Protocol response with the Win32ErrorCode set to ERROR_INVALID_PARAMETER (0x0057), and then return the response to the client.<73>

  2. If the information level is any value other than 0x0001 or 0x0003, the server implementing Remote Administration Protocol NetPrintJobSetInfo MUST set the Win32ErrorCode value in the Remote Administration Protocol response message to ERROR_INVALID_LEVEL (0x007C).<74>

  3. If the information level is not 0x0001, or if NetPrintJobSetInfoRequest.ParamNum is not equal to JobComment, the server implementing this command SHOULD set the Win32ErrorCode value in the Remote Administration Protocol response message to ERROR_NOT_SUPPORTED.

  4. The server MUST call RpcOpenPrinter (section 3.1.4.2.2)) with the following parameters.

    Parameter

    Value

    pPrinterName

    The local machine name

    pDatatype

    "RAW"

    pDevModeContainer

    NULL

    AccessRequired

    PRINTER_ACCESS_USE

    If the call succeeds, the server MUST call RpcGetJob, as specified in [MS-RPRN] section 3.1.4.3.2, with the following parameters.

    Parameter

    Value

    hPrinter

    The handle to the printer returned from RpcOpenPrinter

    JobId

    The value of NetPrintJobSetInfoRequest.JobId

    Level

    1

    pJob

    NULL

    cbBuf

    0

    The server MUST allocate a buffer of the size specified in the value pcbNeeded returned from the RpcGetJob call. The server MUST then call RpcGetJob again with the following parameters.

    Parameter

    Value

    hPrinter

    The handle to the printer returned from RpcOpenPrinter

    JobId

    The value of NetPrintJobSetInfoRequest.JobId

    Level

    1

    pJob

    A pointer to a buffer of size pcbNeeded

    cbBuf

    pcbNeeded

    If the call succeeds, the server MUST set the pDocument field in the returned JOB_INFO_1 structure as specified in [MS-RPRN] section 2.2.1.7.1 to the string received in the RapInData field. The server MUST then call RpcSetJob with the following parameters based on the input level.

    Parameter

    Value

    hPrinter

    The handle to the printer returned from RpcOpenPrinter

    JobId

    The value of NetPrintJobSetInfoRequest.JobId

    pJobContainer

    A JOB_CONTAINER structure with the Level field set to 1, and Level1 pointer set to the address of the JOB_INFO_1 structure containing the document name string from the RAPInData field.

    Command

    0

  5. If any other errors occur during the response processing, the Remote Administration Protocol server MUST fill in the Win32ErrorCode value in the Remote Administration Protocol response message with the Win32 error code corresponding to the error. Otherwise, the Remote Administration Protocol server MUST set Win32ErrorCode to ERROR_SUCCESS (0X0000).