4.2 Adding a Printer Driver to a Server

To add or update a printer driver ("OEM Printer Driver") to a print server ("CORPSERV"), a client ("TESTCLT") performs the following steps.

  1. Enumerate existing printer drivers using RpcEnumPrinterDrivers.

    See 4.1 for an example using RpcEnumPrinterDrivers.

  2. If the printer driver does not already exist or the client requests to update the printer driver, use RpcAddPrinterDriver to add the driver to the print server.

    • The client ensures that the files for the printer driver are in a location accessible to the server. For that purpose, the client can share a local directory containing the files, or use [MS-SMB] to place the files into a directory on the server.

    • The client then allocates and populates a DRIVER_INFO_2 structure as follows:

       pName = L"OEM Printer Driver";
       pEnvironment = L"Windows NT x86";   /* Environment the driver is compatible with */
       pDriverPath = "\\\\CORPSERV\\C$\\DRIVERSTAGING\\OEMDRV.DLL";
       pDataFile = "\\\\CORPSERV\\C$\\DRIVERSTAGING\\OEMDATA.DLL";
       pConfigFile = "\\\\CORPSERV\\C$\\DRIVERSTAGING\\OEMUI.DLL";
      
    • The client allocates a DRIVER_CONTAINER driverContainer structure and initializes it to contain the DRIVER_INFO_2 structure.

    • The client calls RpcAddPrinterDriver.

       RpcAddPrinterDriver( L"\\\\CORPSERV", &driverContainer );
      
    • The server adds the printer driver and returns 0 (success).

Adding a printer driver to a server

Figure 6: Adding a printer driver to a server