Platform SDK: Files and I/O

LZCopy

The LZCopy function copies a source file to a destination file. If the source file is compressed with the Microsoft File Compression Utility (COMPRESS.EXE), this function creates a decompressed destination file. If the source file is not compressed, this function duplicates the original file.

LONG LZCopy(
  INT hfSource,  // LZ file handle for source file
  INT hfDest     // LZ file handle for destination file
);

Parameters

hfSource
[in] Handle to the source file.
hfDest
[in] Handle to the destination file.

Return Values

If the function succeeds, the return value specifies the size, in bytes, of the destination file.

If the function fails, the return value is an LZERROR_* code. These codes have values less than zero. Note that LZCopy calls neither SetLastError nor SetLastErrorEx; thus, its failure does not affect a thread's last-error code.

The following is a list of error codes that LZCopy can return upon failure.

Value Meaning
LZERROR_BADINHANDLE The handle identifying the source file is not valid. The file cannot be read.
LZERROR_BADOUTHANDLE The handle identifying the destination file is not valid. The file cannot be written.
LZERROR_GLOBALLOC The maximum number of open compressed files has been exceeded or local memory cannot be allocated.
LZERROR_GLOBLOCK The LZ file handle cannot be locked down.
LZERROR_READ The source file format is not valid.

There is no extended error information for this function; do not call GetLastError.

Remarks

The handles identifying the source and destination files must be retrieved by calling the LZInit or LZOpenFile function.

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

Requirements

  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Lzexpand.h; include Windows.h.
  Library: Use Lz32.lib.

See Also

Data Decompression Library Overview, Data Decompression Library Functions, LZInit, LZOpenFile