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:
The client can use methods defined by this protocol to query the print server for information used to initialize other data structures.<420>
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.
If a printer driver is not already installed, the client SHOULD call RpcAddPrinterDriver or RpcAddPrinterDriverEx to install a printer driver for the new printer.
The client MUST allocate a PRINTER_CONTAINER structure and populate it with a PRINTER_INFO_2 structure describing the new printer.
The client MUST allocate a DEVMODE_CONTAINER and populate it with the default DEVMODE for the new printer.
The client MUST allocate a SECURITY_CONTAINER and populate it with a SECURITY_DESCRIPTOR containing the security information for the new printer.
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.