The CM_RESOURCE_LIST structure specifies all of the system hardware resources assigned to a device.

Syntax

复制
typedef struct _CM_RESOURCE_LIST {
ULONG                       Count;
CM_FULL_RESOURCE_DESCRIPTOR List[1];
} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;

Members

Count

The number of full resource descriptors that are specified by this CM_RESOURCE_LIST structure. The List member is the header for the first full resource descriptor. For WDM drivers, Count is always 1.

List

The CM_FULL_RESOURCE_DESCRIPTOR structure that serves as the header for the first full resource descriptor. If the CM_RESOURCE_LIST structure contains more than one full resource descriptor, the second full resource descriptor immediately follows the first in memory, and so on. The size of each full resource descriptor depends on the length of the CM_PARTIAL_RESOURCE_DESCRIPTOR array that it contains. For more information, see the following Remarks section.

Remarks

This structure describes the assignment of hardware resources to a device. An IRP_MN_START_DEVICE IRP uses this structure to specify the resources that the Plug and Play manager assigns to a device. Drivers for legacy devices use this structure to pass their resource requirements to the IoReportResourceForDetection routine. For more information about hardware resource allocation, see Hardware Resources.

The CM_RESOURCE_LIST structure is a header for a larger data structure, of variable size, that contains one or more full resource descriptors. All of the data in this larger structure occupies a contiguous block of memory. Each full resource descriptor occupies a subblock within the larger block.

A full resource descriptor begins with a CM_FULL_RESOURCE_DESCRIPTOR structure, which serves as a header for an array of CM_PARTIAL_RESOURCE_DESCRIPTOR structures. The length of this array determines the size of the full resource descriptor. The last member in the CM_FULL_RESOURCE_DESCRIPTOR structure is a CM_PARTIAL_RESOURCE_LIST structure that contains, as its last member, the first element in this array. If the array contains more than one element, the remaining elements immediately follow, in memory, the end of the CM_PARTIAL_RESOURCE_LIST structure, which is also the end of the CM_FULL_RESOURCE_DESCRIPTOR structure.

Driver code can use pointer arithmetic to step from one full resource descriptor to the next. For example, if a parameter named list is a pointer to the CM_FULL_RESOURCE_DESCRIPTOR structure at the start of one full resource descriptor, list can be updated to point to the start of the next full resource descriptor as follows:

 
复制
    list = (PCM_FULL_RESOURCE_DESCRIPTOR)(list->PartialResourceList.PartialDescriptors +
list->PartialResourceList.Count);

In this example, list->PartialResourceList.PartialDescriptors is a pointer to the start of the CM_PARTIAL_RESOURCE_DESCRIPTOR array, and list->PartialResourceList.Count is the number of elements in the array. For more information about the PartialDescriptors and Count members, see CM_PARTIAL_RESOURCE_LIST.

Examples

All PnP drivers must handle IRP_MN_START_DEVICE IRPs. Typically, a driver's handler for this IRP walks the lists of assigned resources that are pointed to by the Parameters.StartDevice.AllocatedResources and Parameters.StartDevice.AllocatedResourcesTranslated members of the IO_STACK_LOCATION structure in the IRP. The following code example contains a function—named GetAssignedResources—that is called in the handler to walk each list. This function verifies that the required resources are specified in the list, and configures the device to use the resources.

The GetAssignedResources function returns TRUE if it succeeds. Otherwise, it returns FALSE (probably from the switch statement, although the details are omitted to simplify the code example).

 
复制
/* Process the assigned hardware resources. */

BOOLEAN GetAssignedResources(PCM_RESOURCE_LIST reslist)
{
PCM_FULL_RESOURCE_DESCRIPTOR list; list = reslist->List; for (int ix = 0; ix < reslist->Count; ++ix)
{
/* Process resources in CM_FULL_RESOURCE_DESCRIPTOR block number ix. */ for (int jx = 0; jx < list->PartialResourceList.Count; ++jx)
{
PCM_PARTIAL_RESOURCE_DESCRIPTOR desc; desc = list->PartialResourceList.PartialDescriptors + jx; switch (desc->Type)
{
/* Process element jx in PartialDescriptors array. */ ... }
} /* Advance to next CM_FULL_RESOURCE_DESCRIPTOR block in memory. */ list = (PCM_FULL_RESOURCE_DESCRIPTOR)(list->PartialResourceList.PartialDescriptors +
list->PartialResourceList.Count);
} return TRUE;
}

Requirements

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

See also

CM_RESOURCE_LIST
CM_FULL_RESOURCE_DESCRIPTOR
CM_PARTIAL_RESOURCE_LIST
CM_FLOPPY_DEVICE_DATA
CM_KEYBOARD_DEVICE_DATA
CM_SCSI_DEVICE_DATA
CM_SERIAL_DEVICE_DATA
IoConnectInterrupt
IoGetDeviceProperty
IoReportResourceForDetection
IRP_MN_START_DEVICE

CM_RESOURCE_LIST structure的更多相关文章

  1. [LeetCode] All O`one Data Structure 全O(1)的数据结构

    Implement a data structure supporting the following operations: Inc(Key) - Inserts a new key with va ...

  2. [LeetCode] Add and Search Word - Data structure design 添加和查找单词-数据结构设计

    Design a data structure that supports the following two operations: void addWord(word) bool search(w ...

  3. [LeetCode] Two Sum III - Data structure design 两数之和之三 - 数据结构设计

    Design and implement a TwoSum class. It should support the following operations:add and find. add - ...

  4. Theano Graph Structure

    Graph Structure Graph Definition theano's symbolic mathematical computation, which is composed of: A ...

  5. 修复 OS X 的系统盘出现 Invalid Node Structure 问题

    昨晚我的MBP突然出现启动的时候会自动关机的问题.开机进入到 Recovery 模式之后,用 Disk Utility 检查系统盘,发现 Invalid Node Structure 错误, Disk ...

  6. Finger Trees: A Simple General-purpose Data Structure

    http://staff.city.ac.uk/~ross/papers/FingerTree.html Summary We present 2-3 finger trees, a function ...

  7. AVEVA Model Data Exchange Exports Structure Models

    AVEVA Model Data Exchange Exports Structure Modelseryar@163.com Use Model Data Exchange Addin to exp ...

  8. Mesh Data Structure in OpenCascade

    Mesh Data Structure in OpenCascade eryar@163.com 摘要Abstract:本文对网格数据结构作简要介绍,并结合使用OpenCascade中的数据结构,将网 ...

  9. Structure And Representation Of MIB Object Names - SNMP Tutorial

    30.8 Structure And Representation Of MIB Object Names We said that ASN.1 specifies how to represent ...

随机推荐

  1. VC++自绘界面

    // MySkinDlg.cpp : implementation file // #include "stdafx.h" #include "MySkin.h" ...

  2. 10年程序员谈.Net程序员的职业规划(图/文)

    原文地址:http://bbs.csdn.net/topics/390736769 从事Dotnet程序开发工作近10年了,从开始的月薪3k的小程序员菜鸟,到现在年薪60w的项目总经理,从战战兢兢的去 ...

  3. linux命令之uname

    uname是linux中查询系统基本信息的命令. 命令形式: uname [选项] 选项包括:(若不跟任何选项:则默认-s选项) -s, --kernel-name 输出内核名称   -n, --no ...

  4. 【LeetCode练习题】Validate Binary Search Tree

    Validate Binary Search Tree Given a binary tree, determine if it is a valid binary search tree (BST) ...

  5. Linux学习笔记6-Linux根目录下各个目录的作用

    /bin:存放最常用命令:  /boot:启动Linux的核心文件: /dev:设备文件: /etc:存放各种配置文件: /home:用户主目录: /lib:系统最基本的动态链接共享库: /mnt:一 ...

  6. 移动端页面SEO优化需要注意的10个要点

    如今,移动互联网已经成为互联网组成的非常重要的一个分支,如果说以前对移动页面没有很规范的优化和高质量内容评判划分标准,但现在随着各大搜索引擎发布了移动建站指南,图文并茂的描述了如何提高移动站在百度质量 ...

  7. hdu 1575 Tr A(矩阵快速幂乘法优化算法)

    Problem Description A为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%. Input 数据的第一行是一个T,表示有T组数据. 每组数据的第一行有n ...

  8. 每日一dp(2)——龟兔赛跑(hdu 2059)

    比較经典的动态规划的题目了 一般动态规划的想法都是先推断是否有最优子结构,无后效性.接着从状态转移入手,尽量细分状态(即给定N得到N+1),完了再递推计算 难点:转移方程,其一般也难在怎样描写叙述一个 ...

  9. .NET程序性能优化基本要领

    想了解更多关于新的编译器的信息,可以访问     .NET Compiler Platform ("Roslyn") 基本要领 在对.NET 进行性能调优以及开发具有良好响应性的应 ...

  10. HTML需掌握的基础

    首先,我们学习web前端开发基础技术需要掌握的是HTML.CSS.JavaScript语言,那么在下先解释一下何为HTML.CSS.JavaScript语言. HTML是网页内容的载体.内容就是网页制 ...