Compartilhar via


2.4.30 FileModeInformation

The FileModeInformation information class is used to query or set the mode of the file. The mode returned by a query corresponds to the CreateOptions used in the initial create operation, modified by any set FileModeInformation operations performed since the create operation.<133>

A FILE_MODE_INFORMATION data element, defined as follows, is returned by the server or provided by the client.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Mode

Mode (4 bytes): A 32-bit unsigned integer that specifies how the file will subsequently be accessed.

Value

Meaning

FILE_WRITE_THROUGH

0x00000002

When set, any system services, file system drivers (FSDs), and drivers that write data to the file are required to actually transfer the data into the file before any requested write operation is considered complete.

FILE_SEQUENTIAL_ONLY

0x00000004

This is a hint that informs the cache that it SHOULD<134> optimize for sequential access. Non-sequential access of the file can result in performance degradation.

FILE_NO_INTERMEDIATE_BUFFERING

0x00000008

When set, the file cannot be cached or buffered in a driver's internal buffers.

FILE_SYNCHRONOUS_IO_ALERT

0x00000010

When set, all operations on the file are performed synchronously. Any wait on behalf of the caller is subject to premature termination from alerts. This flag also causes the I/O system to maintain the file position context.

FILE_SYNCHRONOUS_IO_NONALERT

0x00000020

When set, all operations on the file are performed synchronously. Wait requests in the system to synchronize I/O queuing and completion are not subject to alerts. This flag also causes the I/O system to maintain the file position context.

FILE_DELETE_ON_CLOSE

0x00001000

 This flag is not implemented and is always returned as not set.

This operation returns a status code as specified in section 2.2. Upon success, the status code returned by the function that processes this file information class is STATUS_SUCCESS. The most common error codes are listed in the following table.

Error code

Meaning

STATUS_INFO_LENGTH_MISMATCH

0xC0000004

The specified information record length does not match the length that is required for the specified information class.

STATUS_INVALID_PARAMETER

An attempt to set the file mode returns STATUS_INVALID_PARAMETER in any of the following cases:

  • The Mode field contains any flag other than FILE_WRITE_THROUGH, FILE_SEQUENTIAL_ONLY, FILE_SYNCHRONOUS_IO_ALERT, or FILE_SYNCHRONOUS_IO_NONALERT.

  • FILE_SYNCHRONOUS_IO_ALERT or FILE_SYNCHRONOUS_IO_NONALERT is set and the file was not opened for synchronous I/O.

  • Neither FILE_SYNCHRONOUS_IO_ALERT nor FILE_SYNCHRONOUS_IO_NONALERT are set and the file was opened for synchronous I/O.

  • FILE_SYNCHRONOUS_IO_ALERT and FILE_SYNCHRONOUS_IO_NONALERT are both set.