3.1.4.4.7 RpcDeletePrinterDriverEx (Opnum 84)

RpcDeletePrinterDriverEx removes the specified printer driver from the list of supported drivers for a server and deletes the files associated with it.<339> This method can also be used to delete specific versions of a driver.

 DWORD RpcDeletePrinterDriverEx(
   [in, string, unique] STRING_HANDLE pName,
   [in, string] wchar_t* pEnvironment,
   [in, string] wchar_t* pDriverName,
   [in] DWORD dwDeleteFlag,
   [in] DWORD dwVersionNum
 );

pName: A STRING_HANDLE structure (section 2.2.1.1.7) that conforms to the parameter specification in Print Server Name Parameters (section 3.1.4.1.4).

pEnvironment: A string that conforms to the parameter specification in Environment Name Parameters (section 3.1.4.1.3).

pDriverName: A pointer to a string that specifies the name of the printer driver to delete. For rules governing printer driver names, see section 2.2.4.3.

dwDeleteFlag: A bit field that specifies options for deleting files and versions of the printer driver. If the value of this parameter is zero, the driver MUST be removed from the list of supported drivers, and the driver files MUST remain on the print server.

These flags can be combined to specify multiple options.

Name/value

Description

DPD_DELETE_UNUSED_FILES

0x00000001

Remove unused printer driver files. In this case, an error MUST NOT be returned if some of the files are being used by another installed driver.

DPD_DELETE_SPECIFIC_VERSION

0x00000002

Delete the version specified by the value of the dwVersionNum parameter. Because more than one version of a printer driver can be installed on a print server, setting this flag does not guarantee that the driver is removed from the list of supported drivers on the server.

DPD_DELETE_ALL_FILES

0x00000004

Delete the printer driver only if all its associated files can be removed. In this case, an error MUST be returned if some of the files are being used by another installed driver.

dwVersionNum: The version of the printer driver to delete.

The value of this parameter is implementation-specific and identifies the driver version and the operating system for which the driver was written. The driver version for each printer driver object in a List of Printers (section 3.1.1). It has the same format and meaning as the cVersion members in RPC_DRIVER_INFO structures (section 2.2.1.5).<340>

This parameter MUST be ignored if the DPD_DELETE_SPECIFIC_VERSION flag in the dwDeleteFlag parameter is not set.

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 validate the following:

  • Perform the validation steps for Print Server Name Parameters.

  • Perform the validation steps for Environment Name Parameters.

  • Verify that the string pointed to by the pDriverName parameter contains the name of a driver that is part of the list of drivers that are installed on the server for the environment specified by the string pointed to by the pEnvironment parameter. If that verification fails, ERROR_UNKNOWN_PRINTER_DRIVER MUST be returned.

  • Verify that the printer driver identified by pDriverName is not being used by any printer in the system. If that verification fails, ERROR_PRINTER_DRIVER_IN_USE MUST be returned.

  • Verify that the value of the dwDeleteFlag parameter contains the result of the bitwise OR of zero or more of the DPD_DELETE defined constants and that all other bits are zero. If that verification fails, ERROR_INVALID_PARAMETER MUST be returned.

  • Additional validation MAY<341> be performed.

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:

  • Clear references to this version of the printer driver in any other data structures.

  • Delete the printer driver object and any associated driver files in compliance with the settings in the dwDeleteFlag parameter.

  • If the DPD_DELETE_SPECIFIC_VERSION bit is set in dwDeleteFlag, delete only printer drivers with a version number that matches the value of dwVersionNum.

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

  • Return the status of the operation.