ReactOS 0.4.15-dev-8390-g075894b
connection.cpp File Reference
#include "private.hpp"
#include <debug.h>
Include dependency graph for connection.cpp:

Go to the source code of this file.

Classes

class  CUnregisterPhysicalConnection
 

Macros

#define NDEBUG
 

Functions

NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString (PUNICODE_STRING DestinationString, PCWSTR SourceString)
 
static NTSTATUS UnRegisterConnection (IN OUT PDEVICE_OBJECT DeviceObject, IN PUNKNOWN FromUnknown, IN PUNICODE_STRING FromString, IN ULONG FromPin, IN PUNKNOWN ToUnknown, IN PUNICODE_STRING ToString, IN ULONG ToPin)
 
NTSTATUS NTAPI NewIUnregisterPhysicalConnection (OUT PUNREGISTERPHYSICALCONNECTION *OutConnection)
 
NTSTATUS RegisterConnection (IN OUT PDEVICE_OBJECT DeviceObject, IN PUNKNOWN FromUnknown, IN PUNICODE_STRING FromString, IN ULONG FromPin, IN PUNKNOWN ToUnknown, IN PUNICODE_STRING ToString, IN ULONG ToPin)
 
NTSTATUS NTAPI PcRegisterPhysicalConnection (IN PDEVICE_OBJECT DeviceObject, IN PUNKNOWN FromUnknown, IN ULONG FromPin, IN PUNKNOWN ToUnknown, IN ULONG ToPin)
 
NTSTATUS NTAPI PcRegisterPhysicalConnectionFromExternal (IN PDEVICE_OBJECT DeviceObject, IN PUNICODE_STRING FromString, IN ULONG FromPin, IN PUNKNOWN ToUnknown, IN ULONG ToPin)
 
NTSTATUS NTAPI PcRegisterPhysicalConnectionToExternal (IN PDEVICE_OBJECT DeviceObject, IN PUNKNOWN FromUnknown, IN ULONG FromPin, IN PUNICODE_STRING ToString, IN ULONG ToPin)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file connection.cpp.

Function Documentation

◆ NewIUnregisterPhysicalConnection()

NTSTATUS NTAPI NewIUnregisterPhysicalConnection ( OUT PUNREGISTERPHYSICALCONNECTION OutConnection)

Definition at line 124 of file connection.cpp.

126{
127
129
130 if (!new_ptr)
132
133 new_ptr->AddRef();
134 *OutConnection = (PUNREGISTERPHYSICALCONNECTION)new_ptr;
135 return STATUS_SUCCESS;
136}
#define NULL
Definition: types.h:112
#define NonPagedPool
Definition: env_spec_w32.h:307
IUnregisterPhysicalConnection * PUNREGISTERPHYSICALCONNECTION
Definition: portcls.h:677
#define TAG_PORTCLASS
Definition: private.hpp:24
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

Referenced by CPortDMus::QueryInterface(), CPortTopology::QueryInterface(), CPortWaveCyclic::QueryInterface(), CPortWavePci::QueryInterface(), and CPortWaveRT::QueryInterface().

◆ PcRegisterPhysicalConnection()

NTSTATUS NTAPI PcRegisterPhysicalConnection ( IN PDEVICE_OBJECT  DeviceObject,
IN PUNKNOWN  FromUnknown,
IN ULONG  FromPin,
IN PUNKNOWN  ToUnknown,
IN ULONG  ToPin 
)

Definition at line 259 of file connection.cpp.

265{
266 DPRINT("PcRegisterPhysicalConnection\n");
268
269 if (!DeviceObject || !FromUnknown || !ToUnknown)
271
272 return RegisterConnection(DeviceObject, FromUnknown, NULL, FromPin, ToUnknown, NULL, ToPin);
273}
NTSTATUS RegisterConnection(IN OUT PDEVICE_OBJECT DeviceObject, IN PUNKNOWN FromUnknown, IN PUNICODE_STRING FromString, IN ULONG FromPin, IN PUNKNOWN ToUnknown, IN PUNICODE_STRING ToString, IN ULONG ToPin)
Definition: connection.cpp:139
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define PC_ASSERT_IRQL_EQUAL(x)
Definition: private.hpp:31
#define DPRINT
Definition: sndvol32.h:73
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055

Referenced by StartDevice().

◆ PcRegisterPhysicalConnectionFromExternal()

NTSTATUS NTAPI PcRegisterPhysicalConnectionFromExternal ( IN PDEVICE_OBJECT  DeviceObject,
IN PUNICODE_STRING  FromString,
IN ULONG  FromPin,
IN PUNKNOWN  ToUnknown,
IN ULONG  ToPin 
)

Definition at line 277 of file connection.cpp.

283{
285
286 if (!DeviceObject || !FromString || !ToUnknown)
288
289 return RegisterConnection(DeviceObject, NULL, FromString, FromPin, ToUnknown, NULL, ToPin);
290}

◆ PcRegisterPhysicalConnectionToExternal()

NTSTATUS NTAPI PcRegisterPhysicalConnectionToExternal ( IN PDEVICE_OBJECT  DeviceObject,
IN PUNKNOWN  FromUnknown,
IN ULONG  FromPin,
IN PUNICODE_STRING  ToString,
IN ULONG  ToPin 
)

Definition at line 294 of file connection.cpp.

300{
302
303 if (!DeviceObject || !FromUnknown || !ToString)
305
306 return RegisterConnection(DeviceObject, FromUnknown, NULL, FromPin, NULL, ToString, ToPin);
307}
std::string ToString(XMLHandle node)
Definition: xml2sdb.cpp:59

◆ RegisterConnection()

NTSTATUS RegisterConnection ( IN OUT PDEVICE_OBJECT  DeviceObject,
IN PUNKNOWN  FromUnknown,
IN PUNICODE_STRING  FromString,
IN ULONG  FromPin,
IN PUNKNOWN  ToUnknown,
IN PUNICODE_STRING  ToString,
IN ULONG  ToPin 
)

Definition at line 139 of file connection.cpp.

147{
148 PSUBDEVICE_DESCRIPTOR FromSubDeviceDescriptor = NULL, ToSubDeviceDescriptor = NULL;
149 PSYMBOLICLINK_ENTRY SymEntry;
150 ISubdevice * FromSubDevice = NULL, *ToSubDevice = NULL;
152 PPHYSICAL_CONNECTION_ENTRY FromEntry = NULL, ToEntry = NULL;
153
154 if (FromUnknown)
155 {
156 Status = FromUnknown->QueryInterface(IID_ISubdevice, (PVOID*)&FromSubDevice);
157 if (!NT_SUCCESS(Status))
158 goto cleanup;
159
160 Status = FromSubDevice->GetDescriptor(&FromSubDeviceDescriptor);
161 if (!NT_SUCCESS(Status))
162 goto cleanup;
163
164 if (IsListEmpty(&FromSubDeviceDescriptor->SymbolicLinkList))
165 {
167 goto cleanup;
168 }
169
171 FromString = &SymEntry->SymbolicLink;
172 }
173
174 if (ToUnknown)
175 {
176 Status = ToUnknown->QueryInterface(IID_ISubdevice, (PVOID*)&ToSubDevice);
177 if (!NT_SUCCESS(Status))
178 goto cleanup;
179
180 Status = ToSubDevice->GetDescriptor(&ToSubDeviceDescriptor);
181 if (!NT_SUCCESS(Status))
182 goto cleanup;
183
184 if (IsListEmpty(&ToSubDeviceDescriptor->SymbolicLinkList))
185 {
187 goto cleanup;
188 }
189
190 SymEntry = (PSYMBOLICLINK_ENTRY)CONTAINING_RECORD(ToSubDeviceDescriptor->SymbolicLinkList.Flink, SYMBOLICLINK_ENTRY, Entry);
191 ToString = &SymEntry->SymbolicLink;
192
193 }
194
195 if (FromSubDeviceDescriptor)
196 {
198 if (!FromEntry)
199 {
201 goto cleanup;
202 }
203 }
204
205 if (ToSubDeviceDescriptor)
206 {
207 ToEntry = (PPHYSICAL_CONNECTION_ENTRY)AllocateItem(NonPagedPool, sizeof(PHYSICAL_CONNECTION_ENTRY) + FromString->MaximumLength + sizeof(WCHAR), TAG_PORTCLASS);
208 if (!ToEntry)
209 {
211 goto cleanup;
212 }
213 }
214
215 if (FromSubDeviceDescriptor)
216 {
217 FromEntry->FromPin = FromPin;
218 FromEntry->Connection.Pin = ToPin;
219 FromEntry->Connection.Size = sizeof(KSPIN_PHYSICALCONNECTION) + ToString->MaximumLength + sizeof(WCHAR);
220 RtlMoveMemory(&FromEntry->Connection.SymbolicLinkName, ToString->Buffer, ToString->MaximumLength);
221 FromEntry->Connection.SymbolicLinkName[ToString->Length / sizeof(WCHAR)] = UNICODE_NULL;
222
223 InsertTailList(&FromSubDeviceDescriptor->PhysicalConnectionList, &FromEntry->Entry);
224 }
225
226 if (ToSubDeviceDescriptor)
227 {
228 ToEntry->FromPin = ToPin;
229 ToEntry->Connection.Pin = FromPin;
230 ToEntry->Connection.Size = sizeof(KSPIN_PHYSICALCONNECTION) + FromString->MaximumLength + sizeof(WCHAR);
231 RtlMoveMemory(&ToEntry->Connection.SymbolicLinkName, FromString->Buffer, FromString->MaximumLength);
232 ToEntry->Connection.SymbolicLinkName[FromString->Length / sizeof(WCHAR)] = UNICODE_NULL;
233
234 InsertTailList(&ToSubDeviceDescriptor->PhysicalConnectionList, &ToEntry->Entry);
235
236 }
237
238 return STATUS_SUCCESS;
239
240cleanup:
241
242 if (FromSubDevice)
243 FromSubDevice->Release();
244
245 if (ToSubDevice)
246 ToSubDevice->Release();
247
248 if (FromEntry)
249 FreeItem(FromEntry, TAG_PORTCLASS);
250
251 if (ToEntry)
252 FreeItem(ToEntry, TAG_PORTCLASS);
253
254 return Status;
255}
struct PHYSICAL_CONNECTION_ENTRY * PPHYSICAL_CONNECTION_ENTRY
struct SYMBOLICLINK_ENTRY * PSYMBOLICLINK_ENTRY
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
static void cleanup(void)
Definition: main.c:1335
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
Status
Definition: gdiplustypes.h:25
nsrefcnt Release()
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:29
VOID FreeItem(IN PVOID Item)
Definition: misc.c:37
#define UNICODE_NULL
base of all file and directory entries
Definition: entries.h:83
WCHAR SymbolicLinkName[1]
Definition: ks.h:658
Definition: interfaces.hpp:180
KSPIN_PHYSICALCONNECTION Connection
Definition: interfaces.hpp:183
LIST_ENTRY Entry
Definition: interfaces.hpp:181
ULONG FromPin
Definition: interfaces.hpp:182
LIST_ENTRY PhysicalConnectionList
Definition: interfaces.hpp:220
LIST_ENTRY SymbolicLinkList
Definition: interfaces.hpp:219
Definition: interfaces.hpp:174
UNICODE_STRING SymbolicLink
Definition: interfaces.hpp:176
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by PcRegisterPhysicalConnection(), PcRegisterPhysicalConnectionFromExternal(), and PcRegisterPhysicalConnectionToExternal().

◆ RtlCreateUnicodeString()

◆ UnRegisterConnection()

static NTSTATUS UnRegisterConnection ( IN OUT PDEVICE_OBJECT  DeviceObject,
IN PUNKNOWN  FromUnknown,
IN PUNICODE_STRING  FromString,
IN ULONG  FromPin,
IN PUNKNOWN  ToUnknown,
IN PUNICODE_STRING  ToString,
IN ULONG  ToPin 
)
static

Definition at line 64 of file connection.cpp.

72{
75}
#define UNIMPLEMENTED
Definition: debug.h:118
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239