1 /*++ 2 3 Copyright (c) Microsoft Corporation 4 5 ModuleName: 6 7 MxDeviceObjectKm.h 8 9 Abstract: 10 11 Kernel Mode implementation of Device Object defined in MxDeviceObject.h 12 13 --*/ 14 15 #pragma once 16 17 #include "mxdeviceobject.h" 18 19 __inline 20 CCHAR 21 MxDeviceObject::GetStackSize( 22 VOID 23 ) 24 { 25 return m_DeviceObject->StackSize; 26 } 27 28 __inline 29 VOID 30 MxDeviceObject::SetStackSize( 31 _In_ CCHAR Size 32 ) 33 { 34 m_DeviceObject->StackSize = Size; 35 } 36 37 __inline 38 VOID 39 MxDeviceObject::ReferenceObject( 40 ) 41 { 42 ObReferenceObject(m_DeviceObject); 43 } 44 45 __inline 46 MdDeviceObject 47 MxDeviceObject::GetAttachedDeviceReference( 48 VOID 49 ) 50 { 51 return IoGetAttachedDeviceReference(m_DeviceObject); 52 } 53 54 __inline 55 VOID 56 MxDeviceObject::DereferenceObject( 57 ) 58 { 59 ObDereferenceObject(m_DeviceObject); 60 } 61 62 __inline 63 ULONG 64 MxDeviceObject::GetFlags( 65 VOID 66 ) 67 { 68 #ifdef _MSC_VER 69 #pragma warning(disable:28129) 70 #endif 71 return m_DeviceObject->Flags; 72 } 73 74 __inline 75 VOID 76 MxDeviceObject::SetFlags( 77 ULONG Flags 78 ) 79 { 80 #ifdef _MSC_VER 81 #pragma warning(disable:28129) 82 #endif 83 m_DeviceObject->Flags = Flags; 84 } 85 86 __inline 87 POWER_STATE 88 MxDeviceObject::SetPowerState( 89 __in POWER_STATE_TYPE Type, 90 __in POWER_STATE State 91 ) 92 { 93 return PoSetPowerState(m_DeviceObject, Type, State); 94 } 95 96 __inline 97 VOID 98 MxDeviceObject::InvalidateDeviceRelations( 99 __in DEVICE_RELATION_TYPE Type 100 ) 101 { 102 IoInvalidateDeviceRelations(m_DeviceObject, Type); 103 } 104 105 __inline 106 VOID 107 MxDeviceObject::InvalidateDeviceState( 108 __in MdDeviceObject Fdo 109 ) 110 { 111 // 112 // UMDF currently needs Fdo for InvalidateDeviceState 113 // FDO is not used in km. 114 // 115 // m_DeviceObject holds PDO that is what is used below. 116 // 117 118 UNREFERENCED_PARAMETER(Fdo); 119 120 IoInvalidateDeviceState(m_DeviceObject); 121 } 122 123 __inline 124 PVOID 125 MxDeviceObject::GetDeviceExtension( 126 VOID 127 ) 128 { 129 return m_DeviceObject->DeviceExtension; 130 } 131 132 __inline 133 VOID 134 MxDeviceObject::SetDeviceExtension( 135 PVOID Value 136 ) 137 { 138 m_DeviceObject->DeviceExtension = Value; 139 } 140 141 __inline 142 DEVICE_TYPE 143 MxDeviceObject::GetDeviceType( 144 VOID 145 ) 146 { 147 return m_DeviceObject->DeviceType; 148 } 149 150 __inline 151 ULONG 152 MxDeviceObject::GetCharacteristics( 153 VOID 154 ) 155 { 156 return m_DeviceObject->Characteristics; 157 } 158 159 __inline 160 VOID 161 MxDeviceObject::SetDeviceType( 162 DEVICE_TYPE Value 163 ) 164 { 165 m_DeviceObject->DeviceType = Value; 166 } 167 168 __inline 169 VOID 170 MxDeviceObject::SetCharacteristics( 171 ULONG Characteristics 172 ) 173 { 174 m_DeviceObject->Characteristics = Characteristics; 175 } 176 177 __inline 178 VOID 179 MxDeviceObject::SetAlignmentRequirement( 180 _In_ ULONG Value 181 ) 182 { 183 m_DeviceObject->AlignmentRequirement = Value; 184 } 185 186 __inline 187 ULONG 188 MxDeviceObject::GetAlignmentRequirement( 189 VOID 190 ) 191 { 192 return m_DeviceObject->AlignmentRequirement; 193 } 194