The DeviceIoControl function sends a control code directly to a specified device driver, causing the corresponding device to perform the specified operation.
BOOL DeviceIoControl(
HANDLE hDevice, |
// handle to device of interest |
DWORD dwIoControlCode, |
// control code of operation to perform |
LPVOID lpInBuffer, |
// pointer to buffer to supply input data |
DWORD nInBufferSize, |
// size of input buffer |
LPVOID lpOutBuffer, |
// pointer to buffer to receive output data |
DWORD nOutBufferSize, |
// size of output buffer |
LPDWORD lpBytesReturned, |
// pointer to variable to receive output byte count |
LPOVERLAPPED lpOverlapped |
// pointer to overlapped structure for asynchronous operation |
); |
Value |
Meaning |
Dismounts a volume. | |
Obtains the compression state of a file or directory | |
Locks a volume. | |
FSCTL_READ_COMPRESSION |
Reserved for future use. |
Sets the compression state of a file or directory. | |
Unlocks a volume. | |
FSCTL_WRITE_COMPRESSION |
Reserved for future use. |
Obsolete. Use IOCTL_STORAGE_CHECK_VERIFY | |
Obsolete. Use IOCTL_STORAGE_EJECT_MEDIA | |
Formats a contiguous set of disk tracks. | |
Obtains information on the physical disk’s geometry. | |
Provides information about each partition on a disk. | |
Obsolete. Use IOCTL_STORAGE_GET_MEDIA_TYPES | |
Obtains disk partition information. | |
Obsolete. Use IOCTL_STORAGE_LOAD_MEDIA | |
Obsolete. Use IOCTL_STORAGE_MEDIA_REMOVAL | |
Provides disk performance information. | |
Maps disk blocks to spare-block pool. | |
Partitions a disk. | |
Sets the disk partition type. | |
Performs logical format of a disk extent. | |
Enables or disables placement of a line and modem status data into the data stream. | |
Checks for change in a removable-media device. | |
Ejects media from a SCSI device. | |
Obtains information about media support. | |
Loads media into a device. | |
Enables or disables the media eject mechanism. |
For more detailed information on each control code, see its topic. In
particular, each topic provides details on the usage of the lpInBuffer,
nInBufferSize, lpOutBuffer, nOutBufferSize, and lpBytesReturned
parameters.
This parameter can be NULL if the dwIoControlCode parameter specifies
an operation that does not require input data.
This parameter can be NULL if the dwIoControlCode parameter specifies
an operation that does not produce output data.
If lpOverlapped is NULL, lpBytesReturned cannot be NULL. Even when an operation produces no output data, and lpOutBuffer can be NULL, the DeviceIoControl function makes use of the variable pointed to by lpBytesReturned. After such an operation, the value of the variable is without meaning.
If lpOverlapped is not NULL, lpBytesReturned can be NULL. If
this is an overlapped operation, you can get the number of bytes returned by
calling GetOverlappedResult. If hDevice
is associated with an I/O completion port, you can get the number of bytes
returned by calling GetQueuedCompletionStatus.
If hDevice was opened with the FILE_FLAG_OVERLAPPED flag, this parameter must point to a valid OVERLAPPED structure. In this case, DeviceIoControl is performed as an overlapped (asynchronous) operation. If the device was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is NULL, the function fails in unpredictable ways.
If hDevice was opened without specifying the FILE_FLAG_OVERLAPPED flag, this parameter is ignored and the DeviceIoControl function does not return until the operation has been completed, or an error occurs.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If hDevice was opened with FILE_FLAG_OVERLAPPED and the lpOverlapped parameter points to an OVERLAPPED structure, DeviceIoControl is performed as an overlapped (asynchronous) operation. In this case, the OVERLAPPED structure must contain a handle to a manual-reset event object created by a call to the CreateEvent function. For more information on manual-reset event objects, see Synchronization.
If the overlapped operation cannot be completed immediately, the function returns FALSE, and GetLastError returns ERROR_IO_PENDING, indicating that the operation is executing in the background. When this happens, the operating system sets the event object in the OVERLAPPED structure to the nonsignaled state before DeviceIoControl returns. The system then sets the event object to the signaled state when the operation has been completed. The calling thread can use any of the wait functions to wait for the event object to be signaled, and then use the GetOverlappedResult function to determine the results of the operation. The GetOverlappedResult function reports the success or failure of the operation and the number of bytes returned in the lpOutBuffer buffer.
CreateEvent, CreateFile, GetOverlappedResult, GetQueuedCompletionStatus, OVERLAPPED
file: /Techref/os/win/api/win32/func/src/f16_13.htm, 14KB, , updated: 2000/4/7 11:19, local time: 2024/11/24 08:46,
18.217.10.200:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/TECHREF/os/win/api/win32/func/src/f16_13.htm"> DeviceIoControl</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.