LZCopy

  LONG LZCopy(hfSource, hfDest)    
  INT hfSource; /* handle identifying source file */
  INT hfDest; /* handle identifying destination file */

The LZCopy function copies a source file to a destination file. If the source file was compressed with the COMPRESS.EXE utility, this function creates a decompressed destination file. If the source file was not compressed, this function duplicates the original file.

Parameters

hfSource

Identifies the source file. (This handle is returned by LZOpenFile when a compressed file is opened.)

hfDest

Identifies the destination file.

Return Value

The return value specifies the size of the destination file in bytes if the function is successful; if an error occurs, the return value is less than zero. The following list identifies possible error return values and their meaning:

Value Meaning

LZERROR_BADINHANDLE The handle identifying the source file, hfSource, was not valid.
LZERROR_BADOUTHANDLE The handle identifying the destination file, hfDest, was not valid.
LZERROR_READ The source file format was not valid.
LZERROR_WRITE There is insufficient space for the output file.
LZERROR_GLOBALLOC There is insufficient memory for the required buffers.
LZERROR_GLOBLOCK The handle identifying the internal data structures is invalid.
LZERROR_UNKNOWNALG The source file was compressed with an unrecognized compression algorithm.

Comments

This function is designed for single-file copy operations. (Use the CopyLZFile function for multiple-file copy operations.)

If the function is successful, the file identified by hfDest is always uncompressed.

If the source or destination files are opened using a C-runtime function (rather than _lopen or OpenFile) they must be opened in binary mode.

See Also

_lopen, OpenFile, CopyLZFile