GenerateCopyFilePaths function (winsplp.h)

A Point and Print DLL's GenerateCopyFilePaths function is used for modifying the source and destination paths used by print spoolers when they copy print queue-associated files to a print client.

Syntax

DWORD GenerateCopyFilePaths(
  [in]      LPCWSTR pszPrinterName,
  [in]      LPCWSTR pszDirectory,
  [in]      LPBYTE  pSplClientInfo,
  [in]      DWORD   dwLevel,
  [in, out] LPWSTR  pszSourceDir,
  [in, out] LPDWORD pcchSourceDirSize,
  [in, out] LPWSTR  pszTargetDir,
  [in, out] LPDWORD pcchTargetDirSize,
  [in]      DWORD   dwFlags
);

Parameters

[in] pszPrinterName

Caller-supplied pointer to a string representing the name of the print queue.

[in] pszDirectory

Caller-supplied pointer to a string representing the value supplied for the server's Directory entry in the registry. For more information, see Supporting Point and Print During Printer Installations.

[in] pSplClientInfo

Caller-supplied pointer to an SPLCLIENT_INFO_1 structure.

[in] dwLevel

Caller-supplied value indicating the level number of the structure pointed to by pSplClientInfo. Must be 1.

[in, out] pszSourceDir

For input, receives a caller-supplied pointer to a string representing the complete server directory path (including server name) from which files are to be copied.

For output, the function can modify this string.

[in, out] pcchSourceDirSize

Caller-supplied address containing the length of the buffer pointed to by pszSourceDir. (Note that this is the buffer length, not the string length.)

[in, out] pszTargetDir

For input, receives a caller-supplied pointer to a string representing the client directory path to which files are to be copied. The following rules apply:

  • When the function is called on the server, this path is relative to PRINT$.
  • When the function is called on the client, the string contains a complete path.
For output, the function can modify this string.

[in, out] pcchTargetDirSize

Caller-supplied address containing the length of the buffer pointed to by pszTargetDir. (Note that this is the buffer length, not the string length.)

[in] dwFlags

Caller-supplied flag. Can be one of the following:

COPYFILE_FLAG_CLIENT_SPOOLER

Indicates the function is being called by the client's spooler.

COPYFILE_FLAG_SERVER_SPOOLER

Indicates the function is being called by the server's spooler.

Return value

If the operation succeeds, the function should return ERROR_SUCCESS. Otherwise, it should return an error code defined in winerror.h.

Remarks

All Point and Print DLLs must export a GenerateCopyFilePaths function, which is called by the print spooler. Its purpose is to allow a Point and Print DLL to modify the source or destination directory path, or both, before the print spooler copies print queue-associated files from a server to a client. (The files are copied when a client connects to a print server. For a complete description of the steps involved in creating a Point and Print connection, see Supporting Point and Print.)

A Point and Print DLL executes on both the server and the client. The GenerateCopyFilePaths function should check the dwFlags argument to determine where it is executing.

Typically, this function is used to provide compatibility when different versions of the operating system are executing on the client and server. For example if the function, when executing on the server, determines (by reading the SPLCLIENT_INFO_1 structure) that its operating system is newer than the client's, it can modify the source and destination paths to be compatible with the client's older OS. On the other hand, if the function determines that the client's operating system is newer than the client's, it should probably do nothing on the server and perform modifications, if necessary, when executing on the client.

Arguments for the pszSourceDir and pszTargetDir parameters point to buffers containing strings that represent the current source and destination directory paths. If modifications to either of these strings is necessary, the function should make modifications in the supplied buffers. The maximum allowable string lengths are pointed to by the pcchSourceDirSize and pcchTargetDirSize arguments.

If no modifications to the source or destination directories are needed, the function should just return ERROR_SUCCESS.

Requirements

Requirement Value
Target Platform Universal
Header winsplp.h (include Winsplp.h)
Library Mscms.lib
DLL Mscms.dll

See also

SpoolerCopyFileEvent