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