FSCTL_MARK_HANDLE - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// ntifs.h

// CTL_CODE(0x0009, 0x03f, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define FSCTL_MARK_HANDLE 0x000900FC

View the official Windows Driver Kit DDI reference
// winioctl.h

// CTL_CODE(0x0009, 0x03f, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define FSCTL_MARK_HANDLE 0x000900FC

View the official Win32 API reference

NtDoc

No description available.

Windows Driver Kit DDI reference (ni-ntifs-fsctl_mark_handle)

Description

The FSCTL_MARK_HANDLE control code marks a specified file or directory and its change journal record with information about changes to that file or directory.

Parameters

Major code

FSCTL_MARK_HANDLE

Input buffer

Pointer to a MARK_HANDLE_INFO structure containing the information to use to mark a specified file or directory, and its update sequence number (USN) change journal record with data about changes.

Input buffer length

Size of the MARK_HANDLE_INFO structure that InputBuffer points to, in bytes.

Output buffer

Set to NULL.

Output buffer length

n/a (ignored)

Input/output buffer

n/a

Input/output buffer length

n/a

Status block

Reserved for system use.

Remarks

To perform this operation, call FltFsControlFile or ZwFsControlFile with the following parameters.

Parameter Description
Instance [in] For FltFsControlFile only. An opaque instance pointer for the caller. This parameter is required and cannot be NULL.
FileObject [in] For FltFsControlFile only. A file object pointer for the file or directory that is the target of this request. This parameter is required and cannot be NULL.
FileHandle [in] For ZwFsControlFile only. File handle of the file or directory that is the target of this request. This parameter is required and cannot be NULL.
FsControlCode [in] Set to FSCTL_MARK_HANDLE.
InputBuffer [in] Pointer to a MARK_HANDLE_INFO structure containing the information to use to mark a specified file or directory, and its update sequence number (USN) change journal record with data about changes.
InputBufferLength [in] Size of the buffer that InputBuffer points to, in bytes.
OutputBuffer [out] Set to NULL for this FSCTL.
OutputBufferLength [in] Ignored when OutputBuffer is NULL.
LengthReturned [out] Set to NULL.

See also

FltFsControlFile

ZwFsControlFile


Win32 API reference (ni-winioctl-fsctl_mark_handle)

FSCTL_MARK_HANDLE IOCTL

Description

Marks a specified file or directory and its change journal record with information about changes to that file or directory.

To perform this operation, call the DeviceIoControl function using the following parameters.

BOOL DeviceIoControl(
  (HANDLE) hDevice,             // handle to file or directory
  FSCTL_MARK_HANDLE,            // dwIoControlCode
  (LPVOID)lpInBuffer,           // input buffer
  (DWORD)nInBufferSize,         // size of input buffer
  NULL,                         // lpOutBuffer
  0,                            // nOutBufferSize
  (LPDWORD) lpBytesReturned,    // number of bytes returned
  (LPOVERLAPPED) lpOverlapped   // OVERLAPPED structure
);

Parameters

Input buffer

Input buffer length

Output buffer

Output buffer length

Input/output buffer

Input/output buffer length

Status block

Irp->IoStatus.Status is set to STATUS_SUCCESS if the request is successful.

Otherwise, Status to the appropriate error condition as a NTSTATUS code.

For more information, see NTSTATUS Values.

Remarks

For the implications of overlapped I/O on this operation, see the Remarks section of the DeviceIoControl topic.

FSCTL_MARK_HANDLE is the only change journal operation that operates on an individual file or directory. It does not affect anything the user can do with the item. Instead, it adds information to the file or directory, either providing information on how the operating system changed the item or adding a private data stream to the item.

If there are any changes to the file or directory, then the information added with FSCTL_MARK_HANDLE is also copied into the USN record created for the file or directory. Note that these two operations can occur independently of each other—for example, it is not necessary for a USN record to exist to be able to mark a file as unable to be defragmented and it is not necessary to mark a file or directory to update the contents of the corresponding USN record. For details on the information with which FSCTL_MARK_HANDLE can mark an item (see MARK_HANDLE_INFO for more information).

It is not an error to use FSCTL_MARK_HANDLE while the volume's change journal is being deleted or is inactive. The appropriate information is applied to the file or directory regardless of the state of the change journal, as long as the change journal exists.

Note that the time stamps may not be updated correctly for a remote file. To ensure consistent results, use unbuffered I/O.

The volume must be NTFS.

In Windows 8 and Windows Server 2012, this code is supported by the following technologies.

Technology Supported
Server Message Block (SMB) 3.0 protocol No
SMB 3.0 Transparent Failover (TFO) No
SMB 3.0 with Scale-out File Shares (SO) No
Cluster Shared Volume File System (CsvFS) Yes

CsvFs always issues USN_SOURCE_REPLICATION_MANAGEMENT and MARK_HANDLE_PROTECT_CLUSTERS for the files eligible for direct IO.

See also