Share via


FSCTL_SET_ZERO_DATA (Compact 2013)

3/26/2014

This I/O control fills a specified range of a file with zeros.

Syntax

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

Parameters

  • hDevice
    [in] Handle to the file or alternate stream to which the data is written. To obtain a handle, call the CreateFile function.
  • dwIoControlCode
    [in] Set to FSCTL_SET_ZERO_DATA.
  • lpInBuf
    [in] Pointer to a FILE_ZERO_DATA_INFORMATION structure that specifies the range of the file to set to zero. The FileOffset member of the structure is the byte offset of the first byte to set to zero, and the BeyondFinalZero member is the byte offset of the first byte beyond the last byte set to zero.
  • nInBufSize
    [in] Size of the input buffer, in bytes.
  • lpOutBuf
    Not used. Set to NULL.
  • nOutBufSize
    Not used. Set to NULL.
  • lpBytesReturned
    [out] Pointer to a variable that receives the size of the data stored in the output buffer, in bytes.
  • lpOverlapped
    Not used.

Return Values

If the operation succeeds, the DeviceIoControl function returns a nonzero value.

If the operation fails, DeviceIoControl returns zero. For extended error information, call GetLastError.

Requirements

Header

fsioctl.h

See Also

Reference

FS I/O Controls
CreateFile
FILE_ZERO_DATA_INFORMATION

Other Resources

DeviceIoControl