网站首页  词典首页

请输入您要查询的函数:

 

术语 lzopenfile
释义 LZOpenFile
语法:
C++
INT WINAPI LZOpenFile(
__in LPTSTR lpFileName,
__out LPOFSTRUCT lpReOpenBuf,
__in WORD wStyle
);
LZOpenFile功能
创建,打开,重新打开,或删除指定的文件。
参数
lpFileName [in]
该文件的名称。
lpReOpenBuf [out]
向OFSTRUCT结构,收到有关文件时第一个打开的文件信息的指针。该结构可用于向LZOpenFile后续调用函数看到打开的文件。
这一结构szPathName成员包含从原始设备制造商(OEM)字符集的字符。
wStyle [in]
该采取的行动。此参数可以是一个或多个下列值。
ValueMeaning
OF_CANCEL
0x0800Ignored。仅提供了与16位Windows的兼容性。使用OF_PROMPT样式来显示一个对话框包含一个取消按钮。
OF_CREATE
0x1000Directs LZOpenFile创建一个新的文件。如果该文件已经存在,它被截断为长度为零。
OF_DELETE
0x0200Deletes文件。
OF_EXIST
0x4000Opens该文件,然后关闭它来测试文件的存在。
OF_PARSE
0x0100Fills的OFSTRUCT结构,但没有进行其他行动。
OF_PROMPT
0x2000Displays一个对话框,如果请求的文件不存在。该对话框通知用户,系统无法找到该文件,它包含重试和取消按钮。单击取消按钮指示LZOpenFile返回文件未找到错误信息。
OF_READ
0x0000Opens为只读文件。
OF_READWRITE
0x0002Opens的读取和写入文件。
OF_REOPEN
0x8000Opens文件使用资料,重新缓冲。
OF_SHARE_DENY_NONE
0x0040Opens不否认其他进程读或写访问文件的文件。 LZOpenFile文件失败如果已在兼容模式打开的任何其他进程。
OF_SHARE_DENY_READ
0x0030Opens文件,并否认其他程序读取该文件。 LZOpenFile失败如果文件已被打开,或在兼容模式已读取任何其他进程访问打开。
OF_SHARE_DENY_WRITE
0x0020Opens文件,并否认其他进程写访问该文件。 LZOpenFile失败如果文件已被打开,或在兼容模式已写入任何其他进程访问打开。
OF_SHARE_EXCLUSIVE
0x0010Opens在独占模式文件,拒绝其他进程读写访问该文件。 LZOpenFile失败如果文件已被打开,在任何读或写访问其他方式甚至当前进程。
OF_WRITE
0x0001Opens唯一的书面文件。
返回值
如果函数成功和wStyle参数不OF_READ,返回值是一个句柄识别文件中指定的值。如果该文件是压缩和wStyle设置为OF_READ打开,返回值是一个特殊的文件句柄。
如果函数失败,返回值是一个LZERROR_ *代码。这些代码都小于零的数值。没有此功能扩展的错误信息,不要调用GetLastError函数。
注意LZOpenFile要求既不SetLastError也不SetLastErrorEx,因此,它的故障不会影响线程的最后错误代码。
以下是错误代码列表LZOpenFile可以返回时失败。
返回代码/ valueDescription
LZERROR_BADINHANDLE
- 1The处理识别源文件是无效的。该文件无法读取。
LZERROR_GLOBALLOC
,调取开放的压缩文件的最大数量已超过或本地内存不能分配。
备注
如果wStyle参数是OF_READ标志(或OF_READ和任何OF_SHARE_ *标志)和文件被压缩,LZOpenFile调用LZInit功能,它执行的减压行动所需的初始化。
在处理这个函数返回是只兼容的LzExpand.dll的职能,它不应该为其他文件操作。
如果LZOpenFile无法打开lpFileName指定的文件,在某些版本的Windows尝试打开它几乎相同的文件名的文件,除了最后一个字符,是用下划线("_").取代因此,如果试图打开“MyProgram.exe”失败,LZOpenFile尝试打开“MyProgram.ex_”。安装软件包常常替换为一个文件的扩展名的最后一个字母下划线表明该文件被压缩。例如,“MyProgram.exe”压缩可能被命名为“MyProgram.ex_”。要确定文件名打开(如有的话),研究在lpReOpenBuf参数OFSTRUCT结构szPathName成员。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderLzExpand.h(头文件:winuser.h)
LibraryLz32.lib
DLLLz32.dll
Unicode和ANSI namesLZOpenFileW(Unicode)和LZOpenFileA(ANSI)的
参见
文件压缩和解压
文件管理函数
LZClose
LZInit
LZRead
OFSTRUCT
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年9月3日
==英文原文==LZOpenFile Function
Creates, opens, reopens, or deletes the specified file.
Syntax
C++
INT WINAPI LZOpenFile(
__in LPTSTR lpFileName,
__out LPOFSTRUCT lpReOpenBuf,
__in WORD wStyle
);
Parameters
lpFileName [in]
The name of the file.
lpReOpenBuf [out]
A pointer 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 see the open file.
The szPathName member of this structure contains characters from the original equipment manufacturer (OEM) character set.
wStyle [in]
The action to be taken. This parameter can be one or more of the following values.
ValueMeaning
OF_CANCEL
0x0800Ignored. Provided only for compatibility with 16-bit Windows. Use the OF_PROMPT style to display a dialog box containing a Cancel button.
OF_CREATE
0x1000Directs LZOpenFile to create a new file. If the file already exists, it is truncated to zero length.
OF_DELETE
0x0200Deletes the file.
OF_EXIST
0x4000Opens the file and then closes it to test for a file's existence.
OF_PARSE
0x0100Fills the OFSTRUCT structure but carries out no other action.
OF_PROMPT
0x2000Displays a dialog box if the requested file does not exist. The dialog box informs the user that the system cannot find the file, and it contains Retry and Cancel buttons. Clicking the Cancel button directs LZOpenFile to return a file not found error message.
OF_READ
0x0000Opens the file for reading only.
OF_READWRITE
0x0002Opens the file for reading and writing.
OF_REOPEN
0x8000Opens the file using information in the reopen buffer.
OF_SHARE_DENY_NONE
0x0040Opens 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.
OF_SHARE_DENY_READ
0x0030Opens 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.
OF_SHARE_DENY_WRITE
0x0020Opens 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.
OF_SHARE_EXCLUSIVE
0x0010Opens 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.
OF_WRITE
0x0001Opens the file for writing only.

Return Value
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.
The following is the list of the error codes that LZOpenFile can return upon failure.
Return code/valueDescription
LZERROR_BADINHANDLE
-1The handle identifying the source file is not valid. The file cannot be read.
LZERROR_GLOBALLOC
-5The maximum number of open compressed files has been exceeded or local memory cannot be allocated.

Remarks
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.
If LZOpenFile is unable to open the file specified by lpFileName, on some versions of Windows it attempts to open a file with almost the same file name, except the last character is replaced with an underscore ("_"). Thus, if an attempt to open "MyProgram.exe" fails, LZOpenFile tries to open "MyProgram.ex_". Installation packages often substitute the underscore for the last letter of a file name extension to indicate that the file is compressed. For example, "MyProgram.exe" compressed might be named "MyProgram.ex_". To determine the name of the file opened (if any), examine the szPathName member of the OFSTRUCT structure in the lpReOpenBuf parameter.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderLzExpand.h (include Windows.h)
LibraryLz32.lib
DLLLz32.dll
Unicode and ANSI namesLZOpenFileW (Unicode) and LZOpenFileA (ANSI)
See Also
File Compression and Decompression
File Management Functions
LZClose
LZInit
LZRead
OFSTRUCT
Send comments about this topic to Microsoft
Build date: 9/3/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa365225(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 9:25:23