3.6 Example 6: Sending a Print Job to an SMB Share

This example demonstrates the use cases described in sections 2.5.3.7.3 and 2.5.3.8.3.

This example involves the SMB protocol family [MS-SMB] and RAP [MS-RAP], supporting interoperability with non-Windows platforms.<28> This example also applies to the rare case when a Windows print client installs a local print queue with a local port specifying the UNC path of a shared print queue on a print server.

In this example, when a user performs commands from a command prompt, the user is interacting with the SMB Server Service installed on the print server. A user sends a print job to an SMB share by entering the command copy /b file \\server\printer at a command prompt.<29> The print client subsequently uses the SMB protocol family to copy the file to the specified SMB print share of the print server. The SMB/RAP Print Redirector module (part of the SMB protocol family Server Service) on the print server translates SMB calls from the print client to local calls to the print subsystem of the print server.

After sending a print job to the SMB share of the print server, the user can obtain a list of the active jobs on the specified print queue by entering net print \\server\printer at the command prompt. The print client uses RAP to obtain the list of active jobs. The SMB/RAP Print Redirector module on the print server translates the RAP calls from the print client to local calls to the print subsystem of the print server.

Prerequisites

This example has the following initial system state and prerequisites.

  • The requirements in the Assumptions and Preconditions (section 2.4) are met.

  • The SMB Server Service is installed and active on the print server.

Initial System State

This example has the following initial system state.

  • The print job is ready to be sent to the specified SMB print share.

Sequence

The following diagram illustrates this example.

Print client sending a print job to an SMB share

Figure 28: Print client sending a print job to an SMB share

Message groups

Description

References

Copying print job data to an SMB share

Using the SMB protocol, the print client copies print job data to an SMB share for redirection to the print queue.

[MS-SMB]

section 2.2

Obtaining job status

Using the RAP protocol, the print client obtains the status of the print job.

[MS-RAP]

section 3.2.5.5

The following steps describe this sequence.

  1. The print client calls the Create File method (SMB_COM_NT_CREATE_ANDX) on the print server for the UNC name of the print queue.

  2. The SMB Server Service on the print server redirects the call to a local API of the print spooler to open a handle to the print queue, and the local print spooler API returns the print queue handle and a success code to the SMB Server Service.

  3. The SMB Server Service on the print server creates a wrapping structure in which to store the print queue handle and starts the print job by invoking a local print spooler API.

  4. The SMB Server Service returns the handle of the wrapping structure and a success code to the print client as though it were a file handle.

  5. The print client calls the method (SMB_COM_WRITE_ANDX) on the print server to submit the print job data to the file handle.

  6. The SMB Server Service redirects the print job data to a local print spooler API using the print queue handle stored in the wrapping structure, and the local print spooler API returns a success code to the SMB Server Service.

  7. The SMB Server Service returns a success code to the print client.

  8. The print client ends the print job by calling the Close File method (SMB_COM_CLOSE) on the SMB Server Service.

  9. The SMB Server Service calls a local print spooler API to close the print queue handle designated in the wrapping structure, and the local print spooler API returns a success code to the SMB Server Service.

  10. The SMB Server Service frees the wrapping structure and then returns a success code to the print client.

    To then obtain information from the SMB Server Service about print job status, the user can enter the net print command [MSFT-NETPRINT] at a command prompt, to which the print client responds as follows.

  11. The print client sends the NetPrintQGetInfo command defined by RAP to send the share name of the print queue on the print server.

  12. The SMB Server Service on the print server redirects the call to a local API of the print spooler to obtain information about the jobs queued for the specified print queue, and the local print spooler API returns job information and a success code.

  13. The SMB Server Service responds to the NetPrintQGetInfo request with print job information and a success code.

Final State

A new print job has been added to the print queue on the print server and is being sent to the associated port.