ReactOS  0.4.15-dev-3163-gf17c2c0
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 
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 {
47 
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 
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) {
85  }
86 
89  }
90 }
91 
95  __in PFX_DRIVER_GLOBALS FxDriverGlobals,
96  __in CONST GUID* InterfaceGUID,
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,
121  }
122  else {
123  return STATUS_SUCCESS;
124  }
125 }
126 
127 
128 VOID
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) {
153  }
154 }
155 
UNICODE_STRING m_ReferenceString
#define __in_opt
Definition: dbghelp.h:38
_Must_inspect_result_ NTSTATUS Initialize(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in CONST GUID *InterfaceGUID, __in_opt PCUNICODE_STRING ReferenceString)
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONG _In_ ULONG State
Definition: potypes.h:516
UNICODE_STRING m_SymbolicLinkName
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
VOID SetState(__in BOOLEAN State)
#define ASSERT(a)
Definition: mode.c:44
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:629
_Must_inspect_result_ NTSTATUS FxDuplicateUnicodeString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in const UNICODE_STRING *Source, __out PUNICODE_STRING Destination)
Definition: stringutil.cpp:180
static __inline NTSTATUS MxSetDeviceInterfaceState(_In_ PUNICODE_STRING SymbolicLinkName, _In_ BOOLEAN Enable)
Definition: mxgeneralkm.h:608
#define _Must_inspect_result_
Definition: ms_sal.h:558
_Must_inspect_result_ _In_ WDFDEVICE _In_ CONST GUID _In_opt_ PCUNICODE_STRING ReferenceString
Definition: wdfdevice.h:3625
#define NULL
Definition: types.h:112
SINGLE_LIST_ENTRY m_Entry
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
MdDeviceObject m_Device
#define STATUS_SUCCESS
Definition: shellext.h:65
void FxPoolFree(__in_xcount(ptr is at an offset from AllocationStart) PVOID ptr)
Definition: wdfpool.cpp:361
#define __in
Definition: dbghelp.h:35
#define CONST
Definition: pedump.c:81