ReactOS
0.4.16-dev-329-g9223134
fxdeviceinterface.cpp
Go to the documentation of this file.
1
/*++
2
3
Copyright (c) Microsoft Corporation
4
5
Module Name:
6
7
FxDeviceInterface.cpp
8
9
Abstract:
10
11
This module implements the device interface object.
12
13
Author:
14
15
16
17
Environment:
18
19
Both kernel and user mode
20
21
Revision History:
22
23
--*/
24
25
#include "
fxsupportpch.hpp
"
26
27
extern
"C"
{
28
// #include "FxDeviceInterface.tmh"
29
}
30
31
FxDeviceInterface::FxDeviceInterface
(
32
)
33
/*++
34
35
Routine Description:
36
Constructor for the object. Initializes all fields
37
38
Arguments:
39
None
40
41
Return Value:
42
None
43
44
--*/
45
{
46
RtlZeroMemory
(&
m_InterfaceClassGUID
,
sizeof
(
m_InterfaceClassGUID
));
47
48
RtlZeroMemory
(&
m_SymbolicLinkName
,
sizeof
(
m_SymbolicLinkName
));
49
RtlZeroMemory
(&
m_ReferenceString
,
sizeof
(
m_ReferenceString
));
50
51
m_Entry
.
Next
=
NULL
;
52
53
m_State
=
FALSE
;
54
55
#if (FX_CORE_MODE == FX_CORE_USER_MODE)
56
m_Device
=
NULL
;
57
#endif
58
59
}
60
61
FxDeviceInterface::~FxDeviceInterface
()
62
/*++
63
64
Routine Description:
65
Destructor for FxDeviceInterface. Cleans up any allocations previously
66
allocated.
67
68
Arguments:
69
None
70
71
Return Value:
72
None
73
74
--*/
75
{
76
// the device interface should be off now
77
ASSERT
(
m_State
==
FALSE
);
78
79
// should no longer be in any list
80
ASSERT
(
m_Entry
.
Next
==
NULL
);
81
82
if
(
m_ReferenceString
.
Buffer
!=
NULL
) {
83
FxPoolFree
(
m_ReferenceString
.
Buffer
);
84
RtlZeroMemory
(&
m_ReferenceString
,
sizeof
(
m_ReferenceString
));
85
}
86
87
if
(
m_SymbolicLinkName
.
Buffer
!=
NULL
) {
88
RtlFreeUnicodeString
(&
m_SymbolicLinkName
);
89
}
90
}
91
92
_Must_inspect_result_
93
NTSTATUS
94
FxDeviceInterface::Initialize
(
95
__in
PFX_DRIVER_GLOBALS
FxDriverGlobals,
96
__in
CONST
GUID
* InterfaceGUID,
97
__in_opt
PCUNICODE_STRING
ReferenceString
98
)
99
/*++
100
101
Routine Description:
102
Initializes the object with the interface GUID and optional reference string
103
104
Arguments:
105
InterfaceGUID - GUID describing the interface
106
107
ReferenceString - string used to differentiate between 2 interfaces on the
108
same PDO
109
110
Return Value:
111
STATUS_SUCCESS or STATUS_INSUFFICIENT_RESOURCES
112
113
--*/
114
{
115
RtlCopyMemory
(&
m_InterfaceClassGUID
, InterfaceGUID,
sizeof
(
GUID
));
116
117
if
(
ReferenceString
!=
NULL
) {
118
return
FxDuplicateUnicodeString
(FxDriverGlobals,
119
ReferenceString
,
120
&
m_ReferenceString
);
121
}
122
else
{
123
return
STATUS_SUCCESS
;
124
}
125
}
126
127
128
VOID
129
FxDeviceInterface::SetState
(
130
__in
BOOLEAN
State
131
)
132
/*++
133
134
Routine Description:
135
Sets the state of the device interface
136
137
Arguments:
138
State - the state to set
139
140
141
Return Value:
142
None.
143
144
--*/
145
{
146
m_State
=
State
;
147
148
//
149
// Only set the state if the interface has been registered
150
//
151
if
(
m_SymbolicLinkName
.
Buffer
!=
NULL
) {
152
Mx::MxSetDeviceInterfaceState
(&
m_SymbolicLinkName
,
m_State
);
153
}
154
}
155
BOOLEAN
unsigned char BOOLEAN
Definition:
ProcessorBind.h:185
NTSTATUS
LONG NTSTATUS
Definition:
precomp.h:26
FxDeviceInterface::Initialize
_Must_inspect_result_ NTSTATUS Initialize(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in CONST GUID *InterfaceGUID, __in_opt PCUNICODE_STRING ReferenceString)
Definition:
fxdeviceinterface.cpp:94
FxDeviceInterface::m_State
BOOLEAN m_State
Definition:
fxdeviceinterface.hpp:39
FxDeviceInterface::~FxDeviceInterface
~FxDeviceInterface(VOID)
Definition:
fxdeviceinterface.cpp:61
FxDeviceInterface::SetState
VOID SetState(__in BOOLEAN State)
Definition:
fxdeviceinterface.cpp:129
FxDeviceInterface::m_SymbolicLinkName
UNICODE_STRING m_SymbolicLinkName
Definition:
fxdeviceinterface.hpp:35
FxDeviceInterface::FxDeviceInterface
FxDeviceInterface(VOID)
Definition:
fxdeviceinterface.cpp:31
FxDeviceInterface::m_Device
MdDeviceObject m_Device
Definition:
fxdeviceinterface.hpp:45
FxDeviceInterface::m_ReferenceString
UNICODE_STRING m_ReferenceString
Definition:
fxdeviceinterface.hpp:33
FxDeviceInterface::m_InterfaceClassGUID
GUID m_InterfaceClassGUID
Definition:
fxdeviceinterface.hpp:31
FxDeviceInterface::m_Entry
SINGLE_LIST_ENTRY m_Entry
Definition:
fxdeviceinterface.hpp:37
Mx::MxSetDeviceInterfaceState
static __inline NTSTATUS MxSetDeviceInterfaceState(_In_ PUNICODE_STRING SymbolicLinkName, _In_ BOOLEAN Enable)
Definition:
mxgeneralkm.h:608
__in
#define __in
Definition:
dbghelp.h:35
__in_opt
#define __in_opt
Definition:
dbghelp.h:38
NULL
#define NULL
Definition:
types.h:112
FALSE
#define FALSE
Definition:
types.h:117
FxPoolFree
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
Definition:
wdfpool.cpp:361
GUID
Definition:
shobjidl.idl:2988
void
Definition:
nsiface.idl:2307
ASSERT
#define ASSERT(a)
Definition:
mode.c:44
_Must_inspect_result_
#define _Must_inspect_result_
Definition:
no_sal2.h:62
RtlFreeUnicodeString
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
CONST
#define CONST
Definition:
pedump.c:81
fxsupportpch.hpp
STATUS_SUCCESS
#define STATUS_SUCCESS
Definition:
shellext.h:65
FxDuplicateUnicodeString
_Must_inspect_result_ NTSTATUS FxDuplicateUnicodeString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in const UNICODE_STRING *Source, __out PUNICODE_STRING Destination)
Definition:
stringutil.cpp:180
State
Definition:
stack_allocator.h:18
_FX_DRIVER_GLOBALS
Definition:
fxglobals.h:165
_SINGLE_LIST_ENTRY::Next
struct _SINGLE_LIST_ENTRY * Next
Definition:
ntbasedef.h:637
_UNICODE_STRING
Definition:
env_spec_w32.h:368
_UNICODE_STRING::Buffer
PWSTR Buffer
Definition:
env_spec_w32.h:371
RtlCopyMemory
#define RtlCopyMemory(Destination, Source, Length)
Definition:
typedefs.h:263
RtlZeroMemory
#define RtlZeroMemory(Destination, Length)
Definition:
typedefs.h:262
ReferenceString
_Must_inspect_result_ _In_ WDFDEVICE _In_ CONST GUID _In_opt_ PCUNICODE_STRING ReferenceString
Definition:
wdfdevice.h:3630
sdk
lib
drivers
wdf
shared
support
fxdeviceinterface.cpp
Generated on Sat Dec 7 2024 06:13:55 for ReactOS by
1.9.6