0 out of 1 rated this helpful - Rate this topic

FSCTL_SET_REPAIR control code

Applies to: desktop apps only

Sets the mode of an NTFS file system's self-healing capability.

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

BOOL WINAPI DeviceIoControl(
  (HANDLE) hDevice,             // handle to device
  FSCTL_SET_REPAIR,             // dwIoControlCode
  (PUSHORT) lpInBuffer,         // input buffer
  (DWORD) nInBufferSize,        // size of input buffer
  NULL,                         // not used
  0,                            // not used
  (LPDWORD) lpBytesReturned,    // bytes returned
  (LPOVERLAPPED) lpOverlapped); // OVERLAPPED structure

Parameters

hDevice

A handle to the device. To obtain a device handle, call the CreateFile function.

dwIoControlCode

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

lpInBuffer

A pointer to a USHORT that indicates whether to turn the self-healing capability on or off. Valid values are:

ValueMeaning
SET_REPAIR_ENABLED
0x00000001

Self-healing is turned on.

SET_REPAIR_VOLUME_BITMAP_SCAN
0x00000002

Not implemented. If set DeviceIoControl will return zero (0) and GetLastError will return ERROR_INVALID_FUNCTION.

SET_REPAIR_DELETE_CROSSLINK
0x00000004

Not implemented. If set DeviceIoControl will return zero (0) and GetLastError will return ERROR_INVALID_FUNCTION.

SET_REPAIR_WARN_ABOUT_DATA_LOSS
0x00000008

If set, an error message is displayed when a data loss occurs.

SET_REPAIR_DISABLED_AND_BUGCHECK_ON_CORRUPT
0x00000010

If set, and the NtfsBugCheckOnCorrupt NTFS registry value has been set to one (1) using FsUtil.exe Behavior Set NtfsBugCheckOnCorrupt 1, the system will issue a system stop error 0x24 (also called a bugcheck or blue screen) if the volume is corrupt. This setting is cleared before the system stop error is issued to avoid repeated reboot cycles. This is primarily useful to capture a dump file of the system so that the problem can better be analyzed by support personnel. To manually clear the NtfsBugCheckOnCorrupt registry value, run FsUtil.exe Behavior Set NtfsBugCheckOnCorrupt 0.

 

nInBufferSize

The size of the input buffer, in bytes.

lpOutBuffer

Not used with this operation.

Set to NULL.

nOutBufferSize

Not used with this operation.

Set to zero (0).

lpBytesReturned

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.

lpOverlapped

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.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

WinIoCtl.h

See also

DeviceIoControl
File Management Control Codes
FSCTL_GET_REPAIR
FSCTL_INITIATE_REPAIR
FSCTL_WAIT_FOR_REPAIR

 

 

Send comments about this topic to Microsoft

Build date: 4/17/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ