litth
驱动牛犊
驱动牛犊
  • 注册日期2001-04-26
  • 最后登录2018-05-30
  • 粉丝0
  • 关注0
  • 积分4分
  • 威望110点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
  • 社区居民
阅读:1971回复:5

如何移动文件的指针

楼主#
更多 发布于:2003-06-14 11:58
我已用ZwOpenFile打开C:盘的的某个文件
如何移动文件的指针。
好像没有ZwSetFilePointer?

最新喜欢:

aasa2aasa2
------------------------------------ 天涯飞云 http://www.my66.com
swf2003
驱动中牛
驱动中牛
  • 注册日期2003-02-13
  • 最后登录2011-10-28
  • 粉丝0
  • 关注0
  • 积分4分
  • 威望22点
  • 贡献值0点
  • 好评度20点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2003-06-16 09:50
在 ZwReadFile ZwWriteFile 时,都会提供一个 ByteOffset 相当于一个文件指针,读写操作从它开始。
你的认可是对我最大的鼓励!
hero_wzhj
驱动牛犊
驱动牛犊
  • 注册日期2002-12-20
  • 最后登录2003-06-21
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2003-06-16 13:43
同意楼上的看法!
paladinii
驱动中牛
驱动中牛
  • 注册日期2003-10-28
  • 最后登录2012-03-09
  • 粉丝0
  • 关注0
  • 积分282分
  • 威望74点
  • 贡献值0点
  • 好评度23点
  • 原创分0分
  • 专家分0分
地板#
发布于:2005-02-01 14:42
dui
Ideas for life!
zhangshengyu
驱动老牛
驱动老牛
  • 注册日期2003-10-03
  • 最后登录2016-07-26
  • 粉丝0
  • 关注0
  • 积分792分
  • 威望696点
  • 贡献值41点
  • 好评度499点
  • 原创分0分
  • 专家分0分
  • 社区居民
地下室#
发布于:2005-02-01 17:49
FilePositionInformation

ZwSetInformationFile
---内核开发合作或提供基础技术服务QQ:22863668 ---
wowocock
VIP专家组
VIP专家组
  • 注册日期2002-04-08
  • 最后登录2016-01-09
  • 粉丝16
  • 关注2
  • 积分601分
  • 威望1651点
  • 贡献值1点
  • 好评度1227点
  • 原创分1分
  • 专家分0分
5楼#
发布于:2005-02-01 21:43
ZwSetInformationFile
The ZwSetInformationFile routine changes various kinds of information about a given file object.

NTSTATUS
  ZwSetInformationFile(
    IN HANDLE  FileHandle,
    OUT PIO_STATUS_BLOCK  IoStatusBlock,
    IN PVOID  FileInformation,
    IN ULONG  Length,
    IN FILE_INFORMATION_CLASS  FileInformationClass
    );
Parameters
FileHandle
Handle to a file object. The handle is created by a successful call to ZwCreateFile or ZwOpenFile.
IoStatusBlock
Pointer to a variable that receives the final completion status and information about the operation.
FileInformation
Pointer to a buffer or variable containing the information to be set for the file. The contents of FileInformation are defined by the FileInformationClass parameter, described later. Setting any member of the structure in this buffer or variable to zero tells ZwSetInformationFile to leave the current information about the file for that member unchanged.
Length
Specifies the size in bytes of FileInformation, which the caller should set according to the given FileInformationClass.
FileInformationClass
Specifies the type of information, supplied in the buffer specified by FileInformation, to be reset for the file. Device and intermediate drivers, can specify any of the following. FileInformationClass Value Meaning
FileBasicInformation Change information supplied in a FILE_BASIC_INFORMATION structure. The caller must have opened the file with the DesiredAccess FILE_WRITE_ATTRIBUTES flag set.
FileDispositionInformation Usually, sets DeleteFile in FILE_DISPOSITION_INFORMATION to TRUE, so the file can be deleted when ZwClose is called to release the last open handle for the file object. The caller must have opened the file with the DesiredAccess DELETE flag set.
FileEndOfFileInformation Change the current end-of-file information, supplied in a FILE_END_OF_FILE_INFORMATION structure, for the file: Either truncate or extend the amount of valid data in the file by moving the current end-of-file position. The caller must have opened the file with the DesiredAccess FILE_WRITE_DATA flag set.
FilePositionInformation Change the current position information, supplied in a FILE_POSITION_INFORMATION structure, for the file. The caller must have opened the file with the DesiredAccess FILE_READ_DATA or FILE_WRITE_DATA flag set and with either of the CreateOptions FILE_SYNCHRONOUS_IO_ALERT or FILE_SYNCHRONOUS_IO_NONALERT.
FileShortNameInformation Change the current short file name, supplied in a FILE_NAME_INFORMATION structure. File must be on an NTFS volume, and the caller must have opened the file with the DesiredAccess DELETE flag set.
FileValidDataLengthInformation Change the current valid data length for the file, supplied in a FILE_VALID_DATA_LENGTH_INFORMATION structure. The file must be on an NTFS volume, and the caller must have opened the file with the DesiredAccess FILE_WRITE_DATA flag set. Nonadministrators and remote users must have the SeManageVolumePrivilege privilege.


Return Value
ZwSetInformationFile returns STATUS_SUCCESS or an appropriate error status. It also returns the number of bytes set on the file in the Information member of IoStatusBlock.

Headers
Declared in ntddk.h. Include ntddk.h.

Comments
ZwSetInformationFile changes information about a file. It ignores any member of a FILE_XXX_INFORMATION structure that is not supported by a particular device or file system.

A caller that sets FileInformationClass to FileDispositionInformation can pass the FileHandle subsequently to ZwClose but to no other ZwXxxFile routine. On return from ZwSetInformationFile, the file has been marked for deletion. It is a programming error to attempt any subsequent operation on the open file except closing it.

If the caller sets FileInformationClass to FilePositionInformation and the preceding call to ZwCreateFile set the CreateOptions flag FILE_NO_INTERMEDIATE_BUFFERING, certain restrictions on the input FILE_POSITION_INFORMATION CurrentByteOffset are enforced. For more information, see ZwCreateFile.

If the caller sets FileInformationClass to FileEndOfFileInformation and the EndOfFile member of FILE_END_OF_FILE_INFORMATION specifies an offset beyond the current end-of-file mark, ZwSetInformationFile extends the file and writes pad bytes of zeros between the old and new end-of-file marks.

Callers of ZwSetInformationFile must be running at IRQL = PASSIVE_LEVEL.

花开了,然后又会凋零,星星是璀璨的,可那光芒也会消失。在这样 一瞬间,人降生了,笑者,哭着,战斗,伤害,喜悦,悲伤憎恶,爱。一切都只是刹那间的邂逅,而最后都要归入死亡的永眠
游客

返回顶部