FSCTL_USN_TRACK_MODIFIED_RANGES IOCTL (winioctl.h)

Enables range tracking feature for update sequence number (USN) change journal stream on a target volume, or modifies already enabled range tracking parameters.

BOOL DeviceIoControl(
  (HANDLE) hDevice,                 // handle to volume
  FSCTL_USN_TRACK_MODIFIED_RANGES,  // dwIoControlCode
  (LPDWORD) lpInBuffer,             // input buffer
  (DWORD) nInBufferSize,            // size of input buffer
  (LPDWORD) lpOutBuffer,            // lpOutbuffer
  (DWORD) nOutBufferSize,           // size of output buffer
  (LPDWORD) lpBytesReturned,        // number of bytes returned
  (LPOVERLAPPED) lpOverlapped       // OVERLAPPED structure
);

Remarks

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

You can use FSCTL_USN_TRACK_MODIFIED_RANGES to enable range tracking for the first time for a volume. After the enabling range tracking, the state and parameters will be persisted for that volume and on next reboot the range tracking will be initialized read from the persisted parameters.

You can also use FSCTL_USN_TRACK_MODIFIED_RANGES to modify an existing change journal stream range track parameter. If range tracking is already exists, FSCTL_USN_TRACK_MODIFIED_RANGES sets it to the parameters provided in the USN_TRACK_MODIFIED_RANGES structure. The chunk size or file size threshold can only be lowered from previous values. Once enabled, range tracking feature cannot be disabled unless the journal is deleted.

To retrieve a handle to a volume, call CreateFile with the lpFileName parameter set to a string in the following form:

\\.\X:

In the preceding string, X is the letter identifying the drive on which the volume appears. The volume must be NTFS 3.0 or later. To obtain the NTFS version of a volume, open a command prompt with Administrator access rights and execute the following command:

fsutil fsinfo ntfsinfo X:

where X is the drive letter of the volume.

Requirements

Requirement Value
Minimum supported client Windows 8.1 [desktop apps only]
Minimum supported server Windows Server 2012 R2 [desktop apps only]
Header winioctl.h (include Windows.h)

See also