3.2.4.2.6 Adding a Printer to a Print Server

To add a printer to a print server, the print client performs these steps:

  1. The client can use methods defined by this protocol to query the print server for information used to initialize other data structures.<420>

  2. The client SHOULD call the print server's RpcEnumPrinterDrivers to determine whether a printer driver for the new printer is already installed on the server.

  3. If a printer driver is not already installed, the client SHOULD call RpcAddPrinterDriver or RpcAddPrinterDriverEx to install a printer driver for the new printer.

  4. The client MUST allocate a PRINTER_CONTAINER structure and populate it with a PRINTER_INFO_2 structure describing the new printer.

  5. The client MUST allocate a DEVMODE_CONTAINER and populate it with the default DEVMODE for the new printer.

  6. The client MUST allocate a SECURITY_CONTAINER and populate it with a SECURITY_DESCRIPTOR containing the security information for the new printer.

  7. The client MUST call the print server's RpcAddPrinter with the print server's name, and the CONTAINER parameters from steps 4, 5, and 6. Alternatively, the client can use the RpcAddPrinterEx and specify an additional SPLCLIENT_CONTAINER that describes the client in more detail. RpcAddPrinterEx returns a PRINTER_HANDLE to the newly added printer in the variable pointed to by pHandle. The client SHOULD close that handle using RpcClosePrinter when it no longer requires it.