The ExpandFile function can only expand files that were
previously compressed using the CompressFile function. It
cannot expand the contents of a file stored in an archive format used
by third-party applications such as PKZip or WinZip.
This function will use the default Deflate algorithm to expand
the contents of the file. If the file was compressed using
CompressFileEx using anything other than COMPRESSION_TYPE_DEFLATE,
the file must be expanded using the ExpandFileEx function. This
function will fail if a different compression algorithm was used to
compress the file.
If the output file already exists, it will be replaced with the
expanded contents of the compressed input file. If the input file
cannot be expanded for any reason, the output file will be deleted
and the last error code will be updated indicating the cause of the
failure. If you want to ensure an existing output file will be preserved
if an error occurs, you should create a temporary file and use it
as the output file. If this function succeeds, then you can rename
or move the temporary file using a function like MoveFileEx.
It is possible to expand the input file in-place by specifying
the lpszOutputFile parameter as a NULL pointer or zero-length
string. In this case, the contents of the input file will be
expanded to a temporary file and if the operation is successful, the
original compressed input file will be replaced by the temporary file. If an
error occurs, the input file will remain unchanged.