BUG: DeletePrintProcessor on Windows Does Not Delete Print Processor (242394)
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API), when used with:
- the operating system: Microsoft Windows 95
- the operating system: Microsoft Windows 98
- the operating system: Microsoft Windows 98 Second Edition
- the operating system: Microsoft Windows Millennium Edition
This article was previously published under Q242394 IMPORTANT: This article contains information about modifying the registry. Before you
modify the registry, make sure to back it up and make sure that you understand how to restore
the registry if a problem occurs. For information about how to back up, restore, and edit the
registry, click the following article number to view the article in the Microsoft Knowledge Base:
256986 Description of the Microsoft Windows Registry
SYMPTOMS
A call to the DeletePrintProcessor function succeeds and returns TRUE, but the print processor remains installed, even after a reboot.
CAUSE
The DeletePrintProcessor function does nothing on Windows 95, Windows 98, Windows 98 Second Edition, and Windows Millennium Edition when it is routed through the local print provider. Despite doing nothing, it returns TRUE and does not set an error code.
RESOLUTIONWARNING: If you use Registry Editor incorrectly, you may cause serious problems that may
require you to reinstall your operating system. Microsoft cannot guarantee that you can solve
problems that result from using Registry Editor incorrectly. Use Registry Editor at your own
risk.
To remove a print processor, delete the appropriately named registry key under:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Environments\Windows 4.0\Print Processors
Deleting the registry entry that refers to the print processor will prevent it from being initialized on the next reboot of the operating system. Once the registry key has been removed, reboot Windows to initialize the spooler process and its print processors.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. MORE INFORMATION
The spooler's DeletePrintProcessor function forwards the function call to the local print provider. The local print provider's implementation of the DeletePrintProcessor function returns without deleting the print processor.
To work around the problem, an application must remove the registry entries that cause the print processor to be loaded when the operating system starts. The registry key mentioned in this article contains the keys for the installed print processors. Use the name of the print processor given by the PRINTPROCESSOR_INFO_1 structure to locate the registry key and then delete the key with the registry functions or the registry editor. The EnumPrintProcessors function is used to obtain PRINTPROCESSOR_INFO_1 structures.
Deleting the Print Processor's Registry Entry
The following sample code can be used instead of the registry editor to remove the print processor key by its name. NOTE: The warnings included in this article about changing the registry apply also to program code. This code is provided to show how to delete a specific print processor's registry key.
Note that before a print processor registry key is deleted, a careful audit of the installed printers should be performed to ensure that no printer is dependant upon the print processor that is to be deleted. The audit can be done using the EnumPrinters function and the PRINTER_INFO_2 structure.
Note also that this article describes how to prevent the print processor from being loaded at the next reboot of the operating system. Removing the registry entry does not remove the print processor dynamic link library (DLL). The DLL would have to be removed after the operating system has been rebooted, when the DLL is no longer in use.
BOOL RegDeletePrintProcessor(LPCSTR pszProcName)
{
BOOL fSuccess = FALSE;
HKEY hPrintProcKey;
TCHAR regKey[MAX_PATH] = "System\\CurrentControlSet\\Control\\Print\\Environments\\Windows 4.0\\Print Processors";
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, regKey, 0, KEY_ALL_ACCESS, &hPrintProcKey) != ERROR_SUCCESS)
return FALSE;
fSuccess = (ERROR_SUCCESS == RegDeleteKey(hPrintProcKey, pszProcName));
RegCloseKey(hPrintProcKey);
return fSuccess;
}
REFERENCESFor additional information, click the article numbers below
to view the articles in the Microsoft Knowledge Base:
140570 HOWTO: Move Files That Are Currently in Use
158828 HOWTO: Call Win32 Spooler Enumeration APIs Properly
Platform SDK Documentation:
Modification Type: | Minor | Last Reviewed: | 5/3/2006 |
---|
Keywords: | kbDSWGDI2003Swept kbbug kbGDI kbnofix kbSpooler KB242394 |
---|
|