1 /*++ 2 3 Copyright (c) Microsoft Corporation 4 5 ModuleName: 6 7 MxDeviceObjectUm.cpp 8 9 Abstract: 10 11 User Mode implementation of Device Object defined in MxDeviceObject.h 12 13 --*/ 14 15 #include "fxmin.hpp" 16 17 CCHAR 18 MxDeviceObject::GetStackSize( 19 VOID 20 ) 21 { 22 return (CCHAR) (static_cast<IWudfDevice2*>(m_DeviceObject))->GetStackSize2(); 23 } 24 25 VOID 26 MxDeviceObject::ReferenceObject( 27 ) 28 { 29 m_DeviceObject->AddRef(); 30 31 // 32 // We take a reference on device stack object as it is the reference on 33 // device stack object that keeps the driver loaded 34 // 35 m_DeviceObject->GetDeviceStackInterface()->AddRef(); 36 } 37 38 MdDeviceObject 39 MxDeviceObject::GetAttachedDeviceReference( 40 VOID 41 ) 42 { 43 FX_VERIFY(INTERNAL, TRAPMSG("MxDeviceObject::GetAttachedDeviceReference " 44 "not implemented for UMDF")); 45 return NULL; 46 } 47 48 VOID 49 MxDeviceObject::DereferenceObject( 50 ) 51 { 52 m_DeviceObject->Release(); 53 54 // 55 // We also take a device stack reference (see ReferenceObject) 56 // release it now 57 // 58 m_DeviceObject->GetDeviceStackInterface()->Release(); 59 } 60 61 ULONG 62 MxDeviceObject::GetFlags( 63 VOID 64 ) 65 { 66 return m_DeviceObject->GetDeviceObjectWdmFlags(); 67 } 68 69 POWER_STATE 70 MxDeviceObject::SetPowerState( 71 __in POWER_STATE_TYPE /*Type*/, 72 __in POWER_STATE State 73 ) 74 { 75 ULONG oldState; 76 POWER_STATE oldStateEnum; 77 78 m_DeviceObject->GetDeviceStackInterface()->SetPowerState( 79 State.DeviceState, 80 &oldState 81 ); 82 83 oldStateEnum.DeviceState = (DEVICE_POWER_STATE) oldState; 84 85 return oldStateEnum; 86 } 87 88 VOID 89 MxDeviceObject::InvalidateDeviceRelations( 90 __in DEVICE_RELATION_TYPE Type 91 ) 92 { 93 UNREFERENCED_PARAMETER(Type); 94 95 ASSERTMSG("Not implemented for UMDF\n", FALSE); 96 97 //IoInvalidateDeviceRelations(DeviceObject, Type); 98 } 99 100 VOID 101 MxDeviceObject::InvalidateDeviceState( 102 __in MdDeviceObject Fdo 103 ) 104 { 105 // 106 // DO NOT use m_DeviceObject. That specifies PDO in this case which is 107 // currently NULL for UMDF. Use the passed in Fdo instead. 108 // 109 Fdo->GetDeviceStackInterface()->InvalidateDeviceState(); 110 } 111 112 PVOID 113 MxDeviceObject::GetDeviceExtension( 114 VOID 115 ) 116 { 117 ASSERTMSG("Not implemented for UMDF\n", FALSE); 118 return NULL; 119 } 120 121 VOID 122 MxDeviceObject::SetDeviceExtension( 123 PVOID Value 124 ) 125 { 126 // 127 // This will set the context 128 // 129 (static_cast<IWudfDevice2*>(m_DeviceObject))->SetContext(Value); 130 } 131 132 DEVICE_TYPE 133 MxDeviceObject::GetDeviceType( 134 VOID 135 ) 136 { 137 ASSERTMSG("Not implemented for UMDF\n", FALSE); 138 return (DEVICE_TYPE) 0; 139 } 140 141 ULONG 142 MxDeviceObject::GetCharacteristics( 143 VOID 144 ) 145 { 146 ASSERTMSG("Not implemented for UMDF\n", FALSE); 147 return 0; 148 } 149 150 VOID 151 MxDeviceObject::SetDeviceType( 152 DEVICE_TYPE /* Value */ 153 ) 154 { 155 ASSERTMSG("Not implemented for UMDF\n", FALSE); 156 } 157 158 VOID 159 MxDeviceObject::SetCharacteristics( 160 ULONG /* Characteristics */ 161 ) 162 { 163 ASSERTMSG("Not implemented for UMDF\n", FALSE); 164 } 165 166 VOID 167 MxDeviceObject::SetAlignmentRequirement( 168 _In_ ULONG /* Value */ 169 ) 170 { 171 ASSERTMSG("Not implemented for UMDF\n", FALSE); 172 } 173 174 ULONG 175 MxDeviceObject::GetAlignmentRequirement( 176 VOID 177 ) 178 { 179 ASSERTMSG("Not implemented for UMDF\n", FALSE); 180 return 0; 181 } 182 183 VOID 184 MxDeviceObject::SetStackSize( 185 _In_ CCHAR Size 186 ) 187 { 188 (static_cast<IWudfDevice2*>(m_DeviceObject))->SetStackSize2((ULONG)Size); 189 } 190 191 VOID 192 MxDeviceObject::SetFlags( 193 ULONG Flags 194 ) 195 { 196 UNREFERENCED_PARAMETER(Flags); 197 198 199 200 201 202 203 204 205 } 206 207