1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7     FxRelatedDevice.hpp
8 
9 Abstract:
10 
11     This module defines the "related device" class.  These objects are used
12     to handle device relations queries.
13 
14 Author:
15 
16 
17 
18 Environment:
19 
20     Both kernel and user mode
21 
22 Revision History:
23 
24 --*/
25 
26 #ifndef _FXRELATEDDEVICE_H_
27 #define _FXRELATEDDEVICE_H_
28 
29 enum FxRelatedDeviceState {
30     RelatedDeviceStateUnspecified = 0,
31     RelatedDeviceStateNeedsReportPresent,
32     RelatedDeviceStateReportedPresent,
33     RelatedDeviceStateNeedsReportMissing,
34 };
35 
36 class FxRelatedDevice : public FxObject {
37     friend FxRelatedDeviceList;
38 
39 protected:
40     FxTransactionedEntry m_TransactionedEntry;
41 
42     MdDeviceObject m_DeviceObject;
43 
44 public:
45     FxRelatedDeviceState m_State;
46 
47 public:
48     FxRelatedDevice(
49         __in MdDeviceObject DeviceObject,
50         __in PFX_DRIVER_GLOBALS FxDriverGlobals
51         );
52 
53     ~FxRelatedDevice(
54         VOID
55         );
56 
57     MdDeviceObject
GetDevice(VOID)58     GetDevice(
59         VOID
60         )
61     {
62         return m_DeviceObject;
63     }
64 
65     DECLARE_INTERNAL_NEW_OPERATOR();
66 
67 #ifdef INLINE_WRAPPER_ALLOCATION
68 #if (FX_CORE_MODE==FX_CORE_USER_MODE)
69     FORCEINLINE
70     PVOID
GetCOMWrapper()71     GetCOMWrapper(
72         )
73     {
74         PBYTE ptr = (PBYTE) this;
75         return (ptr + (USHORT) WDF_ALIGN_SIZE_UP(sizeof(*this), MEMORY_ALLOCATION_ALIGNMENT));
76     }
77 #endif
78 #endif
79 };
80 
81 #endif // _FXRELATEDDEVICE_H_
82