chz88
驱动牛犊
驱动牛犊
  • 注册日期2003-01-08
  • 最后登录2003-02-19
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1416回复:3

deviceiocontrol()的第二个参数在哪里可以查到?

楼主#
更多 发布于:2003-01-13 14:19
哪里有DEVICEIOCONTROL()的用法的详细说明?
wavelight
驱动老牛
驱动老牛
  • 注册日期2002-08-15
  • 最后登录2016-01-09
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2003-01-13 15:16
哪里有DEVICEIOCONTROL()的用法的详细说明?


应该在DDK 的 ioctl.h 头文件里吧!
<table style="filter: glow(color=red, strength=6)"><br><font color=white><b>我cool 故我在!<br></b></font></table> [img]http://www.driverdevelop.com/forum/upload/wavelight/2002-12-13_1.gif[/img]<table style="filter: glow(color=red, strength=6)"><br><font color=white><b>我在 故我cool!<br></b></font></table>
gdc2002
驱动牛犊
驱动牛犊
  • 注册日期2003-01-14
  • 最后登录2003-01-15
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2003-01-14 23:16
查一下MSDN

DeviceIoControl
The DeviceIoControl function sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.

BOOL DeviceIoControl(
  HANDLE hDevice,              // handle to device
  DWORD dwIoControlCode,       // operation control code
  LPVOID lpInBuffer,           // input data buffer
  DWORD nInBufferSize,         // size of input data buffer
  LPVOID lpOutBuffer,          // output data buffer
  DWORD nOutBufferSize,        // size of output data buffer
  LPDWORD lpBytesReturned,     // byte count
  LPOVERLAPPED lpOverlapped    // overlapped information
);
Parameters
hDevice
[in] Handle to the device on which to perform the operation, typically a volume, directory, file, or alternate stream. Call the CreateFile function to obtain a device handle.
dwIoControlCode
[in] Specifies the control code for the operation. This value identifies the specific operation to be performed and the type of device on which to perform it.
See Device Input and Output Control Codes for a list of the control codes and a short description of each control code.

For more detailed information on each control code, see its documentation. In particular, the documentation provides details on the usage of the lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, and lpBytesReturned parameters.

lpInBuffer
[in] Pointer to a buffer that contains the data required to perform the operation.
This parameter can be NULL if the dwIoControlCode parameter specifies an operation that does not require input data.

nInBufferSize
[in] Specifies the size, in bytes, of the buffer pointed to by lpInBuffer.
lpOutBuffer
[out] Pointer to a buffer that receives the operation\'s output data.
This parameter can be NULL if the dwIoControlCode parameter specifies an operation that does not produce output data.

nOutBufferSize
[in] Specifies the size, in bytes, of the buffer pointed to by lpOutBuffer.
lpBytesReturned
[out] Pointer to a variable that receives the size, in bytes, of the data stored into the buffer pointed to by lpOutBuffer.
If the output buffer is too small to return any data, then the call fails, GetLastError returns the error code ERROR_INSUFFICIENT_BUFFER, and the returned byte count is zero.

If the output buffer is too small to hold all of the data but can hold some entries, then the operating system returns as much as fits, the call fails, GetLastError returns the error code ERROR_MORE_DATA, and lpBytesReturned indicates the amount of data returned. Your application should call DeviceIoControl again with the same operation, specifying a new starting point.

If lpOverlapped is NULL, lpBytesReturned cannot be NULL. Even when an operation produces no output data, and lpOutBuffer can be NULL, DeviceIoControl 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.

lpOverlapped
[in] Pointer to an OVERLAPPED structure.
If hDevice was opened with the FILE_FLAG_OVERLAPPED flag, lpOverlapped must point to a valid OVERLAPPED structure. In this case, the operation 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, lpOverlapped is ignored and DeviceIoControl does not return until the operation has been completed, or an error occurs.

Return Values
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.

Remarks
If hDevice was opened with FILE_FLAG_OVERLAPPED and the lpOverlapped parameter points to an OVERLAPPED structure, the operation 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.

Requirements
  Windows NT/2000: Requires Windows NT 3.1 or later.
  Windows 95/98: Requires Windows 95 or later.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Kernel32.lib.

See Also
Device Input and Output Overview, Device Input and Output Functions, CreateEvent, CreateFile, GetOverlappedResult, GetQueuedCompletionStatus, OVERLAPPED

Built on Friday, May 12, 2000
65度乙醇
LIUTANG
驱动大牛
驱动大牛
  • 注册日期2001-03-30
  • 最后登录2020-12-27
  • 粉丝0
  • 关注0
  • 积分8分
  • 威望58点
  • 贡献值0点
  • 好评度12点
  • 原创分0分
  • 专家分0分
  • 社区居民
地板#
发布于:2003-01-16 00:19
DeviceIoControl中的第二个参数表示控制码,不同的设备驱动程序里会有不同的取值,如果驱动程序是你自己写的,你可以在你的驱动程序里加入响应你自定义的CONTROLCODE的代码,然后你就可以用DeviceIoControl来访问你的驱动程序了。
游客

返回顶部