IOCTL_DISK_FORMAT_VOLUME (Compact 2013)
3/26/2014
This I/O control message is issued to the FAT to be formatted to perform a high-level format of the volume. Send this message with DeviceIoControl.
Syntax
BOOL DeviceIoControl(
HANDLE hDevice, // handle to device
DWORD dwIoControlCode, // use IOCTL_DISK_FORMAT_VOLUME
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
The handle to the device.
- dwIoControlCode
[in] Control code for the operation. Use IOCTL_DISK_FORMAT_VOLUME for this operation.
- lpInBuffer
[in] Not used; set to NULL.
- nInBufferSize
[in] Not used; set to zero.
- lpOutBuffer
[out] Not used; set to NULL.
- nOutBufferSize
[out] Not used; set to zero.
- lpBytesReturned
[out] Pointer to a DWORD to receive the total number of bytes returned.
- lpOverlapped
Not used.
Return Values
Returns TRUE if successful; otherwise, returns FALSE.
Remarks
The following steps describe how to format a drive:
Open a handle to the volume.
The name of the volume to open has the format \FolderName\Vol:, where FolderName is the FAT file system name for the root directory of the mounted volume.Call the DeviceIoControl function with the volume handle and this I/O control.
The following code example shows this procedure.hVolume = CreateFile(TEXT("\Storage Card\Vol:"), GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); DeviceIoControl(hVolume, IOCTL_DISK_FORMAT_VOLUME, NULL, 0, NULL, 0, NULL, NULL);
Requirements
Header |
diskio.h |