FSCTL_WRITE_USN_CLOSE_RECORD - NtDoc

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

// CTL_CODE(0x0009, 0x03b, METHOD_NEITHER, FILE_ANY_ACCESS)
#define FSCTL_WRITE_USN_CLOSE_RECORD 0x000900EF
View the official Win32 API reference

NtDoc

No description available.

Win32 API reference (ni-winioctl-fsctl_write_usn_close_record)

FSCTL_WRITE_USN_CLOSE_RECORD IOCTL

Description

Generates a record in the update sequence number (USN) change journal stream for the input file. This record will have the USN_REASON_CLOSE flag.

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

C++
BOOL WINAPI DeviceIoControl( (HANDLE) hDevice, // handle to volume FSCTL_WRITE_USN_CLOSE_RECORD, // dwIoControlCodeNULL, // lpInBuffer0, // nInBufferSize(LPVOID) lpOutBuffer, // output buffer (DWORD) nOutBufferSize, // size of output buffer (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 for DeviceIoControl.

You can use FSCTL_WRITE_USN_CLOSE_RECORD to force a close record into the change journal for the input handle. The close record will contain any current USN reasons for this file as well. The output buffer will return the USN value associated with this operation.

For more information, see Creating, Modifying, and Deleting a Change Journal.

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.

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

Transacted Operations

If FSCTL_WRITE_USN_CLOSE_RECORD is called with a handle that is locked by a transaction, it always fails.

See also

Change Journals

CreateFile

DeviceIoControl

OVERLAPPED

Volume Management Control Codes