共用方式為


3.1.4.4.1 RpcAddPrinterDriver (Opnum 9)

RpcAddPrinterDriver installs a printer driver on the print server and links the configuration, data, and printer driver files.

 DWORD RpcAddPrinterDriver(
   [in, string, unique] STRING_HANDLE pName,
   [in] DRIVER_CONTAINER* pDriverContainer
 );

pName: Specified in Print Server Name Parameters (section 3.1.4.1.4).

pDriverContainer: Specified in DRIVER_CONTAINER Parameters (section 3.1.4.1.8.3). The Level member of the DRIVER_CONTAINER MUST be 0x00000002, 0x00000003, or 0x00000004.

Return Values: This method MUST return zero (ERROR_SUCCESS) to indicate successful completion or a nonzero Windows error code to indicate failure [MS-ERREF].

Upon receiving this message, the server MUST perform the validation steps specified in:

  • Print Server Name Parameters (section 3.1.4.1.4).

  • DRIVER_CONTAINER Parameters.

Additional validation MAY<324> be performed.

In addition, print servers SHOULD<325> validate parameters as follows:

  • Validate that the cVersion member of the DRIVER_INFO structure contained in the DRIVER_CONTAINER pointed to by the pDriverContainer is strictly less than 0x00000004. If this validation fails, return ERROR_PRINTER_DRIVER_BLOCKED.

  • Validate that the pEnvironment member of the DRIVER_INFO structure contained in the DRIVER_CONTAINER pointed to by the pDriverContainer parameter is not "Windows ARM". If this validation fails, return ERROR_NOT_SUPPORTED.

If the installation requested by the print client is a printer driver upgrade, print servers SHOULD perform the following additional validation steps:

  • Validate that the currently installed printer driver is not a class printer driver.

  • Validate that if the currently installed printer driver has a driver version of 0x00000004, the currently installed printer driver does not have a newer driver date, or if the driver dates are the same, that the currently installed printer driver does not have a newer manufacturer-provided driver version number.

  • Validate that if the currently installed printer driver has a driver version of 0x00000004, there are no printers on the print server that are shared and also use the currently installed printer driver.

If this validation fails, the print server MUST return ERROR_PRINTER_DRIVER_BLOCKED.

If parameter validation fails, the server MUST fail the operation immediately and return a nonzero error response to the client. Otherwise, the server MUST process the message and compose a response to the client as follows:

  • Copy the printer driver files to their destination. If the copy operation fails, the server MUST fail the call immediately and return a nonzero error response to the client.

  • Create the printer driver object, using an implementation-specific mechanism to determine the Boolean values of each of the attributes of the printer driver object.<326>

  • If any clients have registered for notification of server object changes, a notification MUST be broadcast to them.

  • Return the status of the operation.