Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

pnprlist.h

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1998 Microsoft Corporation 00004 00005 Module Name: 00006 00007 pnprlist.h 00008 00009 Abstract: 00010 00011 This file declares the routines and data structures used to manipulate 00012 relations list. Relation lists are used by Plug and Play during the 00013 processing of device removal and ejection. 00014 00015 Author: 00016 00017 Robert Nelson (robertn) Apr, 1998. 00018 00019 Revision History: 00020 00021 --*/ 00022 00023 // 00024 // A RELATION_LIST_ENTRY is an element of a relation list. 00025 // 00026 // It contains all the PDEVICE_OBJECTS which exist at the same level in the 00027 // DEVICE_NODE tree. 00028 // 00029 // Individual PDEVICE_OBJECT entries are tagged by setting their lowest bit. 00030 // 00031 // MaxCount indicates the size of the Devices array. Count indicates the number 00032 // of elements which are currently being used. When a relation list is 00033 // compressed Count will equal MaxCount. 00034 // 00035 typedef struct _RELATION_LIST_ENTRY { 00036 ULONG Count; // Number of current entries 00037 ULONG MaxCount; // Size of Entries list 00038 PDEVICE_OBJECT Devices[1]; // Variable length list of device objects 00039 } RELATION_LIST_ENTRY, *PRELATION_LIST_ENTRY; 00040 00041 // 00042 // A RELATION_LIST contains a number of RELATION_LIST_ENTRY structures. 00043 // 00044 // Each entry in Entries describes all the devices of a given level in the 00045 // DEVICE_NODE tree. In order to conserve memory, space is only allocated for 00046 // the entries between the lowest and highest levels inclusive. The member 00047 // FirstLevel indicates which level is at index 0 of Entries. MaxLevel 00048 // indicates the last level represented in Entries. The number of entries is 00049 // determined by the formula MaxLevel - FirstLevel + 1. The Entries array can 00050 // be sparse. Each element of Entries will either be a PRELATION_LIST_ENTRY or 00051 // NULL. 00052 // 00053 // The total number of PDEVICE_OBJECTs in all PRELATION_LIST_ENTRYs is kept in 00054 // Count. Individual PDEVICE_OBJECTS may be tagged. The tag is maintained in 00055 // Bit 0 of the PDEVICE_OBJECT. The total number of PDEVICE_OBJECTs tagged is 00056 // kept in TagCount. This is used to rapidly determine whether or not all 00057 // objects have been tagged. 00058 // 00059 typedef struct _RELATION_LIST { 00060 ULONG Count; // Count of Devices in all Entries 00061 ULONG TagCount; // Count of Tagged Devices 00062 ULONG FirstLevel; // Level Number of Entries[0] 00063 ULONG MaxLevel; // - FirstLevel + 1 = Number of Entries 00064 PRELATION_LIST_ENTRY Entries[1]; // Variable length list of entries 00065 } RELATION_LIST, *PRELATION_LIST; 00066 00067 // 00068 // A PENDING_RELATIONS_LIST_ENTRY is used to track relation lists for operations 00069 // which may pend. This includes removal when open handles exist and device 00070 // ejection. 00071 // 00072 // The Link field is used to link the PENDING_RELATIONS_LIST_ENTRYs together. 00073 // 00074 // The DeviceObject field is the DEVICE_OBJECT to which the operation was 00075 // originally targetted. It will also exist as a member of the relations list. 00076 // 00077 // The RelationsList is a list of BusRelations, RemovalRelations, (and 00078 // EjectionRelations in the case of eject) which are related to DeviceObject and 00079 // its relations. 00080 // 00081 // The EjectIrp is pointer to the Eject IRP which has been sent to the PDO. If 00082 // this is a pending surprise removal then EjectIrp is not used. 00083 // 00084 typedef struct _PENDING_RELATIONS_LIST_ENTRY { 00085 LIST_ENTRY Link; 00086 WORK_QUEUE_ITEM WorkItem; 00087 PPNP_DEVICE_EVENT_ENTRY DeviceEvent; 00088 PDEVICE_OBJECT DeviceObject; 00089 PRELATION_LIST RelationsList; 00090 PIRP EjectIrp; 00091 ULONG Problem; 00092 BOOLEAN ProfileChangingEject; 00093 BOOLEAN DisplaySafeRemovalDialog; 00094 SYSTEM_POWER_STATE LightestSleepState; 00095 PDOCK_INTERFACE DockInterface; 00096 } PENDING_RELATIONS_LIST_ENTRY, *PPENDING_RELATIONS_LIST_ENTRY; 00097 00098 // 00099 // Functions exported to other kernel modules. 00100 // 00101 NTSTATUS 00102 IopAddRelationToList( 00103 IN PRELATION_LIST List, 00104 IN PDEVICE_OBJECT DeviceObject, 00105 IN BOOLEAN DirectDescendant, 00106 IN BOOLEAN Tagged 00107 ); 00108 00109 PRELATION_LIST 00110 IopAllocateRelationList( 00111 VOID 00112 ); 00113 00114 NTSTATUS 00115 IopCompressRelationList( 00116 IN OUT PRELATION_LIST *List 00117 ); 00118 00119 BOOLEAN 00120 IopEnumerateRelations( 00121 IN PRELATION_LIST List, 00122 IN OUT PULONG Marker, 00123 OUT PDEVICE_OBJECT *PhysicalDevice, 00124 OUT BOOLEAN *DirectDescendant, OPTIONAL 00125 OUT BOOLEAN *Tagged, OPTIONAL 00126 BOOLEAN Reverse 00127 ); 00128 00129 VOID 00130 IopFreeRelationList( 00131 IN PRELATION_LIST List 00132 ); 00133 00134 ULONG 00135 IopGetRelationsCount( 00136 IN PRELATION_LIST List 00137 ); 00138 00139 ULONG 00140 IopGetRelationsTaggedCount( 00141 IN PRELATION_LIST List 00142 ); 00143 00144 BOOLEAN 00145 IopIsRelationInList( 00146 IN PRELATION_LIST List, 00147 IN PDEVICE_OBJECT DeviceObject 00148 ); 00149 00150 NTSTATUS 00151 IopMergeRelationLists( 00152 IN OUT PRELATION_LIST TargetList, 00153 IN PRELATION_LIST SourceList, 00154 IN BOOLEAN Tagged 00155 ); 00156 00157 NTSTATUS 00158 IopRemoveIndirectRelationsFromList( 00159 IN PRELATION_LIST List 00160 ); 00161 00162 NTSTATUS 00163 IopRemoveRelationFromList( 00164 IN PRELATION_LIST List, 00165 IN PDEVICE_OBJECT DeviceObject 00166 ); 00167 00168 VOID 00169 IopSetAllRelationsTags( 00170 IN PRELATION_LIST List, 00171 IN BOOLEAN Tagged 00172 ); 00173 00174 NTSTATUS 00175 IopSetRelationsTag( 00176 IN PRELATION_LIST List, 00177 IN PDEVICE_OBJECT DeviceObject, 00178 IN BOOLEAN Tagged 00179 ); 00180

Generated on Sat May 15 19:41:23 2004 for test by doxygen 1.3.7