Download queue-specific files
If a user decides to create a printer connection from a client system to a print server, and if an installation application has created the registry entries described in Supporting Point and Print during printer installations, the following events occur:
The user application calls AddPrinterConnection.
The client's remote print provider (Win32spl.dll) creates a connection to the server.
The server's spooler sends driver files to the client.
The client's Win32spl.dll calls EnumPrinterKey and EnumPrinterDataEx on the server to copy the printer's registry entries.
As the server's spooler enumerates registry values during processing of EnumPrinterDataEx, it performs the following operations each time it encounters a subkey of the printer's CopyFiles key, such as CopyFiles\ICM:
Loads the Point and Print DLL, if specified, and calls its GenerateCopyFilePaths function, which can modify source and/or destination paths.
Creates SourceDir and TargetDir keys, based on source and destination paths returned by GenerateCopyFilePaths, and returns them to the client spooler as EnumPrinterDataEx data. (These keys do not really exist on the server.)
The client's Win32spl.dll caches printer keys received in response to EnumPrinterData and EnumPrinterDataEx calls.
For each subkey of the printer's CopyFiles key, such as CopyFiles\ICM, the client's Win32spl.dll performs the following operations:
Loads the local Point and Print DLL, if one is provided, and calls its GenerateCopyFilePaths function, which can modify source and/or destination paths. (Inputs are the SourceDir and TargetDir keys received from the server.)
Downloads all files associated with the Files key from the server.
Logs an event, indicating Point and Print files were downloaded.
Calls the Point and Print DLL's SpoolerCopyFileEvent function, if a DLL is provided, specifying a COPYFILE_EVENT_FILES_CHANGED event.
The client spooler calls the driver's DrvPrinterEvent function, specifying a PRINTER_EVENT_CACHE_REFRESH event.
The client spooler calls the driver's DrvPrinterEvent function again, specifying a PRINTER_EVENT_ADD_CONNECTION event.
If a Point and Print DLL is provided, the client spooler calls its SpoolerCopyFileEvent function, specifying a COPYFILE_EVENT_ADD_PRINTER_CONNECTION event.
Connection Example
As an example, assume that an installation application has defined the server registry entries described in the installation example. Additionally, assume that the server is named NTPRINT and the client is named MyClient.
To connect to the print queue named HpColor on NTPRINT, a user application on MyClient calls AddPrinterConnection as follows:
AddPrinterConnection("\\NTPRINT\HpColor")
On the server, the spooler loads Mscms.dll and calls GenerateCopyFilePaths as follows:
GenerateCopyFilePaths(
"HpColor",
"Color",
&SplclientInfo1,
1,
\\NTPRINT\PRINT$\Color,
&dwSourceDirSize,
"Color",
&dwDestDirSize,
COPYFILE_FLAG_SERVER_SPOOLER)
Microsoft ICM's Mscms.dll module does not modify the source or destination paths, so it just returns ERROR_SUCCESS.
The server spooler returns the following keys to MyClient:
SourceDir: \\NTPRINT\PRINT$\Color
TargetDir: "Color"
On the client, the value for TargetDir expands to C:\Winnt\System32\Spool\Drivers\Color.
The spooler on MyClient performs the following operations:
Downloads Mscms.dll and calls GenerateCopyFilePaths as follows:
GenerateCopyFilePaths( "\\NTPRINT\HpColor", "Color", &SplclientInfo1, 1, \\NTPRINT\PRINT$\Color, &dwSourceDirSize, "C:\Winnt\System32\Spool\Drivers\Color", &dwDestDirSize, COPYFILE_FLAG_CLIENT_SPOOLER)
Microsoft ICM's Mscms.dll module does not modify the source or destination paths, so it just returns ERROR_SUCCESS.
Downloads Hpclrlsr.icm to C:\Winnt\System32\Spool\Drivers\Color.
Logs an event, indicating Point and Print files were downloaded.
Calls the SpoolerCopyFileEvent function in Mscms.dll, specifying a COPYFILE_EVENT_FILES_CHANGED event.
Calls the printer driver's DrvPrinterEvent function, specifying a PRINTER_EVENT_CACHE_REFRESH event.
Calls the printer driver's DrvPrinterEvent function again, specifying a PRINTER_EVENT_ADD_CONNECTION event.
Calls the SpoolerCopyFileEvent function in Mscms.dll, specifying a COPYFILE_EVENT_ADD_PRINTER_CONNECTION event.