3.2.5.7 NetPrintJobGetInfo Command
The Remote Administration Protocol server MUST process the NetPrintJobGetInfoRequest as follows:
The server MUST validate that the incoming ParamDesc field of the Remote Administration Protocol request contains the ASCII string "WWrLh"; 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.<75>
If the information level of the NetPrintJobGetInfoRequest is any value other than 0x0000, 0x0001, 0x0002, or 0x0003 as specified in section 2.3, the server implementing Remote Administration Protocol NetPrintJobGetInfo MUST set the Win32ErrorCode value in the Remote Administration Protocol response message to ERROR_INVALID_LEVEL (0x007C).
The server MUST call RpcOpenPrinter with the following parameters:
Parameter
Value
pPrinterName
The local machine name
pDatatype
"RAW"
pDevModeContainer
NULL
AccessRequired
If this call succeeds, the server MUST call RpcGetJob with the following parameters:
Parameter
Value
hPrinter
The handle to the printer returned from RpcOpenPrinter
JobId
The value of NetPrintJobGetInfoRequest.JobID
Level
4
pJob
NULL
cbBuf
0
The server MUST then allocate a buffer of the size specified in pcbNeeded returned by RpcGetJob, and call RpcGetJob again with the following parameters:
Parameter
Value
hPrinter
The handle to the printer returned from RpcOpenPrinter
JobId
The value of NetPrintJobGetInfoRequest.JobID
Level
2
pJob
A pointer to a buffer of size pcbNeeded
cbBuf
pcbNeeded
If the call succeeds, the server MUST construct a response based on the InfoLevel value as specified in the following steps.
If the InfoLevel is 0x0000, the RAPOutData structure MUST be filled with a PrintJobInfo0 structure, packed as specified in the marshaling rules in section 2.5.11. The PrintJobInfo0 structure MUST be constructed using the response from the RpcGetJob call, with the PrintJobInfo0.JobID field set to the value contained in JOB_INFO_2.JobId as specified in [MS-RPRN] section 2.2.1.7.2.
If the InfoLevel is 0x0001, the RAPOutData structure MUST be filled with a PrintJobInfo1 structure, packed as specified in the marshaling rules in section 2.5.11. The PrintJobInfo1 structure MUST be constructed using the response from the RpcGetJob call with the following mapping:
PrintJobInfo1 Field
JOB_INFO_2 Field
JobID
JobId
UserName
pUserName
NotifyName
pNotifyName
DataType
pDataType
PrintParameterStringLow / PrintParameterStringHigh
pParameters
JobPosition
Position
JobStatus
Status, mapped as specified in 3.2.5.7.1
JobStatusStringLow / JobStatusStringHigh
pStatus
TimeSubmitted
Submitted
JobSize
Size
JobCommentStringLow / JobCommentStatusStringHigh
pDocument<76>
If the InfoLevel is 0x0002, the RAPOutData structure MUST be filled with a PrintJobInfo2 structure, packed as specified in the marshaling rules in section 2.5.11. The PrintJobInfo2 structure MUST be constructed using the response from the RpcGetJob call with the following mapping:
PrintJobInfo2
JOB_INFO_2
JobID
JobId
Priority
Priority
UserNameLow / UserNameHigh
pUserName
JobPosition
Position
JobStatus
Status, mapped as specified in 3.2.5.7.1
TimeSubmitted
Submitted
JobSize
Size
CommentStringHigh / CommentStringLow
pDocument<77>
DocumentNameLow / DocumentNameHigh
pDocument
If the InfoLevel is 0x0003, the RAPOutData structure MUST be filled with a PrintJobInfo3 structure, packed as specified in the marshaling rules in section 2.5.11. The PrintJobInfo3 structure MUST be constructed using the response from the RpcGetJob call with the following mapping:
PrintJobInfo3
JOB_INFO_2
JobID
JobId
Priority
Priority
UserNameLow / UserNameHigh
pUserName
JobPosition
Position
JobStatus
Status, mapped as specified in 3.2.5.7.1
TimeSubmitted
Submitted
JobSize
Size
CommentStringHigh / CommentStringLow
pDocument<78>
DocumentNameLow / DocumentNameHigh
pDocument
NotifyNameLow / NotifyNameHigh
pNotifyName
DataTypeLow / DataTypeHigh
pDataType
PrintParameterStringLow / PrintParameterStringHigh
pParameters
StatusStringLow / StatusStringHigh
pStatus
QueueNameLow / QueueNameHigh
If pPrinterName contains a backslash, QueueName is set to the remaining portion of pPrinterName following the backslash. Otherwise, QueueName is set to pPrinterName.
PrintProcessorNameLow / PrintProcessorNameHigh
pPrintProcessor
PrintProcessorParamsLow / PrintProcessorParamsHigh
pParameters
DriverNameLow / DriverNameHigh
pDriverName
DriverDataOffsetLow / DriverDataOffsetHigh
NULL
PrinterNameOffsetLow / PrinterNameOffsetHigh
pPrinterName
If the request ReceiveBuffersSize field is less than the response TotalBytesAvailable field, the Remote Administration Protocol server MUST set the Win32ErrorCode value in the Remote Administration Protocol response message to ERROR_MORE_DATA (0x00EA).
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).