please dont rip this site Prev Next

LZOpenFile info  Overview  Group

The LZOpenFile function creates, opens, reopens, or deletes the specified file.

INT LZOpenFile(

    LPTSTR lpFileName,

// address of name of file to be opened

    LPOFSTRUCT lpReOpenBuf,

// address of open file structure

    WORD wStyle 

// action to take



Points to a string that specifies the name of a file.
Points to the OFSTRUCT structure that is to receive information about the file when the file is first opened. The structure can be used in subsequent calls to the LZOpenFile function to refer to the open file.

The szPathName member of this structure contains characters from the original equipment manufacturer (OEM) character set.

Specifies the action to take. This parameter can be a combination of the following values:




Ignored. In the Win32-based application programming interface (API), the OF_PROMPT style produces a dialog box containing a Cancel button.


Directs LZOpenFile to create a new file. If the file already exists, it is truncated to zero length.


Deletes the file.


Opens the file and then closes it to test for a file’s existence.


Fills the OFSTRUCT structure but carries out no other action.


Displays a dialog box if the requested file does not exist. The dialog box informs the user that Windows cannot find the file, and it contains Retry and Cancel buttons. Choosing the Cancel button directs LZOpenFile to return a “file not found” error message.


Opens the file for reading only.


Opens the file for reading and writing.


Opens the file using information in the reopen buffer.


Opens the file without denying other processes read or write access to the file. LZOpenFile fails if the file has been opened in compatibility mode by any other process.


Opens the file and denies other processes read access to the file. LZOpenFile fails if the file has been opened in compatibility mode or has been opened for read access by any other process.


Opens the file and denies other processes write access to the file. LZOpenFile fails if the file has been opened in compatibility mode or has been opened for write access by any other process.


Opens the file in exclusive mode, denying other processes both read and write access to the file. LZOpenFile fails if the file has been opened in any other mode for read or write access, even by the current process.


Opens the file for writing only.

Return Values

If the function succeeds and the value specified by the wStyle parameter is not OF_READ, the return value is a handle identifying the file. If the file is compressed and opened with wStyle set to OF_READ, the return value is a special file handle.

If the function fails, the return value is an LZERROR_* code. These codes have values less than zero. There is no extended error information for this function; do not call GetLastError.

Note  LZOpenFile calls neither SetLastError nor SetLastErrorEx; thus, its failure does not affect a thread’s last-error code.

Here is a list of the LZERROR_* codes that LZOpenFile can return upon failure:




The handle identifying the source file is not valid. The file cannot be read.


The maximum number of open compressed files has been exceeded or local memory cannot be allocated.


If the wStyle parameter is the OF_READ flag (or OF_READ and any of the OF_SHARE_ flags) and the file is compressed, LZOpenFile calls the LZInit function, which performs the required initialization for the decompression operations.

The handle this function returns is compatible only with the functions in LZEXPAND.DLL; it should not be used for other file operations.

See Also

LZClose, LZInit, LZRead

See also:

file: /Techref/os/win/api/win32/func/src/f56_7.htm, 9KB, , updated: 2001/6/24 02:06, local time: 2022/5/20 10:01,

 ©2022 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> LZOpenFile</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2022 contributors:
o List host: MIT, Site host, Top posters @20220520
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!