IoGetConfigurationInformation 接口使用--增加系统设备数量

           在编写USB转虚拟串口驱动程序过程中,PC上每插入一个USB设备,我们就需要生成一个串口设备。这样我们就需要增加系统的串口设备数量,这时就需要用到 IoGetConfigurationInformation 接口了。

           这个接口使用的频率相对不高,因此整理下,方便后续查看以及消化理解。

           接口定义如下:   

PCONFIGURATION_INFORMATION IoGetConfigurationInformation(void);

          调用返回的数据结构如下:

typedef struct _CONFIGURATION_INFORMATION {

    //
    // This field indicates the total number of disks in the system. This
    // number should be used by the driver to determine the names of new
    // disks. This field should be updated by the driver as it finds new
    // disks.
    //

    ULONG DiskCount;                // Count of hard disks thus far
    ULONG FloppyCount;              // Count of floppy disks thus far
    ULONG CdRomCount;               // Count of CD-ROM drives thus far
    ULONG TapeCount;                // Count of tape drives thus far
    ULONG ScsiPortCount;            // Count of SCSI port adapters thus far
    ULONG SerialCount;              // Count of serial devices thus far
    ULONG ParallelCount;            // Count of parallel devices thus far

    //
    // These next two fields indicate ownership of the two I/O address
    // spaces that are used by WD1003-compatible disk controllers.
    //

    BOOLEAN AtDiskPrimaryAddressClaimed;    // 0x1F0 - 0x1FF
    BOOLEAN AtDiskSecondaryAddressClaimed;  // 0x170 - 0x17F

    //
    // Indicates the structure version, as anything value beyond this will have been added.
    // Use the structure size as the version.
    //

    ULONG Version;

    //
    // Indicates the total number of medium changer devices in the system.
    // This field will be updated by the drivers as it determines that
    // new devices have been found and will be supported.
    //

    ULONG MediumChangerCount;

} CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;

         通过返回的结构体我们可以知道系统中原本的设备的数量,同时我们可以增加或者减少设备数量,不仅仅是串口设备,可以是磁盘,并口等其它设备。

      

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值