FSCTL_CSV_CONTROL control code

Retrieves the results of a CSV control operation.

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

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



A handle to the file or directory. To retrieve a handle, call the CreateFile function.


The control code for the operation. Use FSCTL_CSV_CONTROL for this operation.


Either a pointer to a CSV_CONTROL_OP enumeration value or a pointer to a CSV_CONTROL_PARAM structure encapsulating that enumeration value. The enumeration value specifies the type of CSV control operation (such as start file redirection, stop file redirection, query for redirect state, query for file revision, or query for MDS path).


The size of the input buffer, in bytes.


A pointer to the output buffer. If the CSV_CONTROL_OP enumeration value in lpInBuffer is CsvControlQueryRedirectState, the output buffer is a CSV_QUERY_REDIRECT_STATE structure. If the CSV_CONTROL_OP enumeration value in lpInBuffer is CsvControlQueryFileRevision, the output buffer is a CSV_QUERY_FILE_REVISION structure. If the CSV_CONTROL_OP enumeration value in lpInBuffer is CsvControlMdsPath, the output buffer is a CSV_QUERY_MDS_PATH structure.


The size of the output buffer, in bytes.


A pointer to a variable that receives the size of the data stored in the output buffer, in bytes.

If the output buffer is too small, the call fails, GetLastError returns ERROR_INSUFFICIENT_BUFFER, and lpBytesReturned is zero.

If lpOverlapped is NULL, lpBytesReturned cannot be NULL. Even when an operation returns no output data and lpOutBuffer is NULL, DeviceIoControl makes use of lpBytesReturned. After such an operation, the value of lpBytesReturned is meaningless.

If lpOverlapped is not NULL, lpBytesReturned can be NULL. If this parameter is not NULL and the operation returns data, lpBytesReturned is meaningless until the overlapped operation has completed. To retrieve the number of bytes returned, call GetOverlappedResult. If hDevice is associated with an I/O completion port, you can retrieve the number of bytes returned by calling GetQueuedCompletionStatus.


A pointer to an OVERLAPPED structure.

If hDevice was opened without specifying FILE_FLAG_OVERLAPPED, lpOverlapped is ignored.

If hDevice was opened with the FILE_FLAG_OVERLAPPED flag, the operation is performed as an overlapped (asynchronous) operation. In this case, lpOverlapped must point to a valid OVERLAPPED structure that contains a handle to an event object. Otherwise, the function fails in unpredictable ways.

For overlapped operations, DeviceIoControl returns immediately, and the event object is signaled when the operation has been completed. Otherwise, the function does not return until the operation has been completed or an error occurs.

Return value

If the operation completes successfully, DeviceIoControl returns a nonzero value.

If the operation fails or is pending, DeviceIoControl returns zero. To get extended error information, call GetLastError.


Minimum supported client

None supported

Minimum supported server

Windows Server 2012 [desktop apps only]


WinIoCtl.h (include Windows.h)

See also

File Management Control Codes