[This is preliminary documentation and subject to change.]
The DeletePrinterDriverEx is an extended version of the DeletePrinterDriver function.
In addition to removing the specified printer-driver name from the list of names of supported drivers for a server, DeletePrinterDriverEx can also delete the files associated with the driver.
The older DeletePrinterDriver deletes a driver only if no version of the driver is in use for the given environment. DeletePrinterDriverEx can delete specific versions of the driver.
BOOL DeletePrinterDriverEx(
LPTSTR pName, // pointer to server name
LPTSTR pEnvironment, // pointer to environment
LPTSTR pDriverName, // pointer to driver name
DWORD dwDeleteFlag, // options for deleting files and versions
DWORD dwVersionFlag // version number to delete
);
Value | Meaning |
---|---|
DPD_DELETE_SPECIFIC_VERSION | Deletes the version specified in dwVersionFlag. This does not ensure that the driver will be removed from the list of supported drivers for the server. |
DPD_DELETE_UNUSED_FILES | Removes any unused driver files. |
DPD_DELETE_ALL_FILES | Deletes the driver only if all its associated files can be removed. The delete operation fails if any of the driver's files are being used by some other installed driver. |
If DPD_DELETE_SPECIFIC_VERSION is not specified, the function deletes all versions of the driver if none of them is in use. If neither DPD_DELETE_UNUSED_FILES nor DPD_DELETE_ALL_FILES is specified, the function does not delete driver files.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Before the function deletes the driver files, it calls the driver's DrvDriverEvent function, allowing the driver to remove any private files that are not used. For more information about DrvDriverEvent, see the Microsoft Windows NT Device Driver Kit documentation.
If the driver files are currently loaded, the function moves them to a temp directory and marks them for deletion on reboot.
Windows NT: Requires version 5.0 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winspool.h.
Import Library: Use winspool.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
Printing and Print Spooler Overview, Printing and Print Spooler Functions, AddPrinterDriverEx