ReactOS  0.4.13-dev-249-gcba1a2f
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 12 of file connection.cpp.

Function Documentation

◆ NewIUnregisterPhysicalConnection()

NTSTATUS NTAPI NewIUnregisterPhysicalConnection ( OUT PUNREGISTERPHYSICALCONNECTION OutConnection)

Definition at line 148 of file connection.cpp.

150 {
151 
153 
154  if (!new_ptr)
156 
157  new_ptr->AddRef();
158  *OutConnection = (PUNREGISTERPHYSICALCONNECTION)new_ptr;
159  return STATUS_SUCCESS;
160 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
smooth NULL
Definition: ftsmooth.c:416
IUnregisterPhysicalConnection * PUNREGISTERPHYSICALCONNECTION
Definition: portcls.h:675
return STATUS_SUCCESS
Definition: btrfs.c:2745

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

◆ PcRegisterPhysicalConnection()

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

Definition at line 286 of file connection.cpp.

292 {
293  DPRINT("PcRegisterPhysicalConnection\n");
295 
296  if (!DeviceObject || !FromUnknown || !ToUnknown)
298 
299  return RegisterConnection(DeviceObject, FromUnknown, NULL, FromPin, ToUnknown, NULL, ToPin);
300 }
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:163
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define PC_ASSERT_IRQL_EQUAL(x)
Definition: private.hpp:31
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560

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 304 of file connection.cpp.

310 {
312 
313  if (!DeviceObject || !FromString || !ToUnknown)
315 
316  return RegisterConnection(DeviceObject, NULL, FromString, FromPin, ToUnknown, NULL, ToPin);
317 }
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:163
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
smooth NULL
Definition: ftsmooth.c:416
#define PC_ASSERT_IRQL_EQUAL(x)
Definition: private.hpp:31
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560

◆ PcRegisterPhysicalConnectionToExternal()

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

Definition at line 321 of file connection.cpp.

327 {
329 
330  if (!DeviceObject || !FromUnknown || !ToString)
332 
333  return RegisterConnection(DeviceObject, FromUnknown, NULL, FromPin, NULL, ToString, ToPin);
334 }
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:163
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
smooth NULL
Definition: ftsmooth.c:416
#define PC_ASSERT_IRQL_EQUAL(x)
Definition: private.hpp:31
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
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 163 of file connection.cpp.

171 {
172  PSUBDEVICE_DESCRIPTOR FromSubDeviceDescriptor = NULL, ToSubDeviceDescriptor = NULL;
173  PSYMBOLICLINK_ENTRY SymEntry;
174  ISubdevice * FromSubDevice = NULL, *ToSubDevice = NULL;
176  PPHYSICAL_CONNECTION_ENTRY FromEntry = NULL, ToEntry = NULL;
177 
178  if (FromUnknown)
179  {
180  Status = FromUnknown->QueryInterface(IID_ISubdevice, (PVOID*)&FromSubDevice);
181  if (!NT_SUCCESS(Status))
182  goto cleanup;
183 
184  Status = FromSubDevice->GetDescriptor(&FromSubDeviceDescriptor);
185  if (!NT_SUCCESS(Status))
186  goto cleanup;
187 
188  if (IsListEmpty(&FromSubDeviceDescriptor->SymbolicLinkList))
189  {
191  goto cleanup;
192  }
193 
195  FromString = &SymEntry->SymbolicLink;
196  }
197 
198 
199  if (ToUnknown)
200  {
201  Status = ToUnknown->QueryInterface(IID_ISubdevice, (PVOID*)&ToSubDevice);
202  if (!NT_SUCCESS(Status))
203  goto cleanup;
204 
205  Status = ToSubDevice->GetDescriptor(&ToSubDeviceDescriptor);
206  if (!NT_SUCCESS(Status))
207  goto cleanup;
208 
209  if (IsListEmpty(&ToSubDeviceDescriptor->SymbolicLinkList))
210  {
212  goto cleanup;
213  }
214 
215 
216  SymEntry = (PSYMBOLICLINK_ENTRY)CONTAINING_RECORD(ToSubDeviceDescriptor->SymbolicLinkList.Flink, SYMBOLICLINK_ENTRY, Entry);
217  ToString = &SymEntry->SymbolicLink;
218 
219  }
220 
221  if (FromSubDeviceDescriptor)
222  {
224  if (!FromEntry)
225  {
227  goto cleanup;
228  }
229  }
230 
231  if (ToSubDeviceDescriptor)
232  {
233  ToEntry = (PPHYSICAL_CONNECTION_ENTRY)AllocateItem(NonPagedPool, sizeof(PHYSICAL_CONNECTION_ENTRY) + FromString->MaximumLength + sizeof(WCHAR), TAG_PORTCLASS);
234  if (!ToEntry)
235  {
237  goto cleanup;
238  }
239  }
240 
241  if (FromSubDeviceDescriptor)
242  {
243  FromEntry->FromPin = FromPin;
244  FromEntry->Connection.Pin = ToPin;
245  FromEntry->Connection.Size = sizeof(KSPIN_PHYSICALCONNECTION) + ToString->MaximumLength + sizeof(WCHAR);
246  RtlMoveMemory(&FromEntry->Connection.SymbolicLinkName, ToString->Buffer, ToString->MaximumLength);
247  FromEntry->Connection.SymbolicLinkName[ToString->Length / sizeof(WCHAR)] = UNICODE_NULL;
248 
249  InsertTailList(&FromSubDeviceDescriptor->PhysicalConnectionList, &FromEntry->Entry);
250  }
251 
252 
253  if (ToSubDeviceDescriptor)
254  {
255  ToEntry->FromPin = ToPin;
256  ToEntry->Connection.Pin = FromPin;
257  ToEntry->Connection.Size = sizeof(KSPIN_PHYSICALCONNECTION) + FromString->MaximumLength + sizeof(WCHAR);
258  RtlMoveMemory(&ToEntry->Connection.SymbolicLinkName, FromString->Buffer, FromString->MaximumLength);
259  ToEntry->Connection.SymbolicLinkName[FromString->Length / sizeof(WCHAR)] = UNICODE_NULL;
260 
261  InsertTailList(&ToSubDeviceDescriptor->PhysicalConnectionList, &ToEntry->Entry);
262 
263  }
264 
265  return STATUS_SUCCESS;
266 
267 cleanup:
268 
269  if (FromSubDevice)
270  FromSubDevice->Release();
271 
272  if (ToSubDevice)
273  ToSubDevice->Release();
274 
275  if (FromEntry)
276  FreeItem(FromEntry, TAG_PORTCLASS);
277 
278  if (ToEntry)
279  FreeItem(ToEntry, TAG_PORTCLASS);
280 
281  return Status;
282 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TAG_PORTCLASS
Definition: private.hpp:24
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:30
LONG NTSTATUS
Definition: precomp.h:26
#define InsertTailList(ListHead, Entry)
WCHAR SymbolicLinkName[1]
Definition: ks.h:688
struct SYMBOLICLINK_ENTRY * PSYMBOLICLINK_ENTRY
Definition: interfaces.hpp:173
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
VOID FreeItem(IN PVOID Item)
Definition: misc.c:43
#define UNICODE_NULL
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
KSPIN_PHYSICALCONNECTION Connection
Definition: interfaces.hpp:183
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
nsrefcnt Release()
struct PHYSICAL_CONNECTION_ENTRY * PPHYSICAL_CONNECTION_ENTRY
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
ULONG FromPin
Definition: interfaces.hpp:182
Status
Definition: gdiplustypes.h:24
LIST_ENTRY PhysicalConnectionList
Definition: interfaces.hpp:220
Definition: interfaces.hpp:179
LIST_ENTRY Entry
Definition: interfaces.hpp:181
UNICODE_STRING SymbolicLink
Definition: interfaces.hpp:176
char * cleanup(char *str)
Definition: wpickclick.c:99
return STATUS_SUCCESS
Definition: btrfs.c:2745
std::string ToString(XMLHandle node)
Definition: xml2sdb.cpp:59
base of all file and directory entries
Definition: entries.h:82
LIST_ENTRY SymbolicLinkList
Definition: interfaces.hpp:219

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 88 of file connection.cpp.

96 {
99 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114