当前位置:首页 科普知识 DeviceIoControl

DeviceIoControl

发布时间:2023-09-15 03:24:26

DeviceIoControl是直接发送控制代码到指定的设备驱动程序,使相应的移动设备以执行相应的操作的函数。

DeviceIoControl介绍

DeviceIoControl是直接发送控制代码到指定的设备驱动程序,使相应的移动设备以执行相应的操作的函数。

DeviceIoControl

DeviceIoControlSyntax

BOOL WINAPI DeviceIoControl(

_In_ HANDLE hDevice,

_In_ DWORD dwIoControlCode,

_In_opt_ LPVOID lpInBuffer,

_In_ DWORD nInBufferSize,

_Out_opt_ LPVOID lpOutBuffer,

_In_ DWORD nOutBufferSize,

_Out_opt_ LPDWORD lpBytesReturned,

_Inout_opt_ LPOVERLAPPED lpOverlapped);

DeviceIoControlVB声明

Declare Function DeviceIoControl Lib "kernel32" Alias "DeviceIoControl" (ByVal hDevice As Long, ByVal dwIoControlCode As Long, lpInBuffer As Any, ByVal nInBufferSize As Long, lpOutBuffer As Any, ByVal nOutBufferSize As Long, lpBytesReturned As Long, lpOverlapped As OVERLAPPED) As Long

DeviceIoControl说明

对设备执行指定的操作

DeviceIoControl

返回值

Long,非零表示成功,零表示失败。会设置GetLastError

参数表

参数类型及说明

hDevice Long,设备句柄

dwIoControlCode Long,应用程序调用驱动程序的控制命令,就是IOCTL_XXX IOCTLs。

lpInBuffer Any,应用程序传递给驱动程序的数据缓冲区地址。

nInBufferSize Long,应用程序传递给驱动程序的数据缓冲区大小,字节数。

lpOutBuffer Any,驱动程序返回给应用程序的数据缓冲区地址。

nOutBufferSize Long,驱动程序返回给应用程序的数据缓冲区大小,字节数。

lpBytesReturned Long,驱动程序实际返回给应用程序的数据字节数地址。

DeviceIoControl

lpOverlapped OVERLAPPED,这个结构用于重叠操作。针对同步操作,请用ByVal As Long传递零值

DeviceIoControl注解

不仅可用于windows 95 和 windows nt,在window xp下也可以使用,但并非所有的操作都得到了几种操作系统的同时支持

vc下的DeviceIoControl 函数定义

DeviceIoControl Function  Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.

温馨提示:
本文【DeviceIoControl】由作者 爱百科 转载提供。 该文观点仅代表作者本人, 自学教育网 信息发布平台,仅提供信息存储空间服务, 若存在侵权问题,请及时联系管理员或作者进行删除。
(c)2008-2025 自学教育网 All Rights Reserved 汕头市灵创科技有限公司
粤ICP备2024240640号-6