Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1570565
  • 博文数量: 596
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 173
  • 用 户 组: 普通用户
  • 注册时间: 2016-07-06 15:50
个人简介

在线笔记

文章分类

全部博文(596)

文章存档

2016年(1)

2015年(104)

2014年(228)

2013年(226)

2012年(26)

2011年(11)

分类: Windows平台

2014-07-08 15:48:24


This macro is used to create a unique system I/O control code (IOCTL).

CTL_CODE(
  DeviceType,
  Function,
  Method,
  Access
);

Parameters

DeviceType Defines the type of device for the given IOCTL. This parameter can be no bigger then a WORD value. The values used by Microsoft are in the range 0-32767 and the values 32768-65535 are reserved for use by OEMs and IHVs. The following list shows the device types defined by the system:
  • FILE_DEVICE_BEEP
  • FILE_DEVICE_CD_ROM
  • FILE_DEVICE_CD_ROM_FILE_SYSTEM
  • FILE_DEVICE_CONTROLLER
  • FILE_DEVICE_DATALINK
  • FILE_DEVICE_DFS
  • FILE_DEVICE_DISK
  • FILE_DEVICE_DISK_FILE_SYSTEM
  • FILE_DEVICE_FILE_SYSTEM
  • FILE_DEVICE_INPORT_PORT
  • FILE_DEVICE_KEYBOARD
  • FILE_DEVICE_MAILSLOT
  • FILE_DEVICE_MIDI_IN
  • FILE_DEVICE_MIDI_OUT
  • FILE_DEVICE_MOUSE
  • FILE_DEVICE_MULTI_UNC_PROVIDER
  • FILE_DEVICE_NAMED_PIPE
  • FILE_DEVICE_NETWORK
  • FILE_DEVICE_NETWORK_BROWSER
  • FILE_DEVICE_NETWORK_FILE_SYSTEM
  • FILE_DEVICE_NULL
  • FILE_DEVICE_PARALLEL_PORT
  • FILE_DEVICE_PHYSICAL_NETCARD
  • FILE_DEVICE_PRINTER
  • FILE_DEVICE_SCANNER
  • FILE_DEVICE_SERIAL_MOUSE_PORT
  • FILE_DEVICE_SERIAL_PORT
  • FILE_DEVICE_SCREEN
  • FILE_DEVICE_SOUND
  • FILE_DEVICE_DEVICE_STREAMS
  • FILE_DEVICE_TAPE
  • FILE_DEVICE_TAPE_FILE_SYSTEM
  • FILE_DEVICE_TRANSPORT
  • FILE_DEVICE_UNKNOWN
  • FILE_DEVICE_VIDEO
  • FILE_DEVICE_VIRTUAL_DISK
  • FILE_DEVICE_WAVE_IN
  • FILE_DEVICE_WAVE_OUT
  • FILE_DEVICE_8042_PORT
  • FILE_DEVICE_NETWORK_REDIRECTOR
  • FILE_DEVICE_BATTERY
  • FILE_DEVICE_BUS_EXTENDER
  • FILE_DEVICE_MODEM
  • FILE_DEVICE_VDM
  • FILE_DEVICE_MASS_STORAGE
  • FILE_DEVICE_SMB
  • FILE_DEVICE_KS
  • FILE_DEVICE_CHANGER
  • FILE_DEVICE_SMARTCARD
  • FILE_DEVICE_ACPI
  • FILE_DEVICE_DVD
  • FILE_DEVICE_FULLSCREEN_VIDEO
  • FILE_DEVICE_DFS_FILE_SYSTEM
  • FILE_DEVICE_DFS_VOLUME

The following list shows device types specific to Windows CE:

  • FILE_DEVICE_HAL
  • FILE_DEVICE_CONSOLE
  • FILE_DEVICE_PSL
  • FILE_DEVICE_SERVICE
Function Defines an action within the device category. That function codes 0-2047 are reserved for Microsoft, and 2048-4095 are reserved for OEMs and IHVs. The function code can be no larger then 4095. Method Defines the method codes for how buffers are passed for I/O and file system controls. The following list shows the possible values for this parameter:
  • METHOD_BUFFERED
  • METHOD_IN_DIRECT
  • METHOD_OUT_DIRECT
  • METHOD_NEITHER

This field is ignored under Windows CE and you should always use the METHOD_BUFFERED value unless compatibility with the desktop is required using a different Method value.

Access Defines the access check value for any access. The following table shows the possible flags for this parameter. The FILE_ACCESS_ANY is generally the correct value.
Flag Description
FILE_ANY_ACCESS Request all access.
FILE_READ_ACCESS Request read access. Can be used with FILE_WRITE_ACCESS.
FILE_WRITE_ACCESS Request write access. Can be used with FILE_READ_ACCESS.

Return Values

None.

Remarks

The macro can be used for defining IOCTL and FSCTL function control codes. All IOCTLs must be defined this way to ensure that no overlaps occur between Microsoft and OEMs and IHVs. The following illustration shows the format of the resulting IOCTL.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Windev.h

See Also

DeviceIoControl

  • METHOD_BUFFERED
  • 系统分配一个缓冲区用于输入和输出,该缓冲区的字节数应该为应用程序的输入和输出缓冲区中较大的字节数。驱动程序中通过 KIrp::IoctlBuffer获得缓冲区的地址。对于输出,驱动程序必须将输出字节数返回给I.Information(),然后由I/O管理器将 数据从系统缓冲区复制到应用程序的缓冲区中。

  • METHOD_IN_DIRECT
  • METHOD_OUT_DIRECT
  • 在这两种方式下,输入缓冲区数据被复制到一个系统缓冲区中,驱动程序可以用KIrp::IoctlBuffer访问这个缓冲区。输出缓冲区被类KMemory对象映射,驱动程序可以通过KIrp::Mdl来访问这个缓冲区。

  • METHOD_NEITHER
  • 这个比较特殊,一般不使用。


    阅读(1399) | 评论(0) | 转发(0) |
    0

    上一篇:CSV 文件处理 PERL

    下一篇:异步磁盘IO

    给主人留下些什么吧!~~