ReactOS 0.4.15-dev-8127-g6338913
propertyhandler.cpp File Reference
#include "private.hpp"
#include <debug.h>
Include dependency graph for propertyhandler.cpp:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS HandlePropertyInstances (IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN OUT PVOID Data, IN PSUBDEVICE_DESCRIPTOR Descriptor, IN BOOL Global, IN ISubdevice *SubDevice)
 
NTSTATUS HandleNecessaryPropertyInstances (IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN OUT PVOID Data, IN PSUBDEVICE_DESCRIPTOR Descriptor, IN ISubdevice *SubDevice)
 
NTSTATUS HandleDataIntersection (IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN OUT PVOID Data, IN ULONG DataLength, IN PSUBDEVICE_DESCRIPTOR Descriptor, IN ISubdevice *SubDevice)
 
NTSTATUS HandlePhysicalConnection (IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN ULONG RequestLength, IN OUT PVOID Data, IN ULONG DataLength, IN PSUBDEVICE_DESCRIPTOR Descriptor)
 
NTSTATUS NTAPI PinPropertyHandler (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI TopologyPropertyHandler (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file propertyhandler.cpp.

Function Documentation

◆ HandleDataIntersection()

NTSTATUS HandleDataIntersection ( IN PIO_STATUS_BLOCK  IoStatus,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data,
IN ULONG  DataLength,
IN PSUBDEVICE_DESCRIPTOR  Descriptor,
IN ISubdevice *  SubDevice 
)

Definition at line 108 of file propertyhandler.cpp.

115{
117 PKSMULTIPLE_ITEM MultipleItem;
118 PKSDATARANGE DataRange;
121
122 // Access parameters
123 MultipleItem = (PKSMULTIPLE_ITEM)(Pin + 1);
124 DataRange = (PKSDATARANGE)(MultipleItem + 1);
125
126 for(Index = 0; Index < MultipleItem->Count; Index++)
127 {
128 // Call miniport's proprietary handler
129 PC_ASSERT(Descriptor->Factory.KsPinDescriptor[Pin->PinId].DataRangesCount);
130 PC_ASSERT(Descriptor->Factory.KsPinDescriptor[Pin->PinId].DataRanges[0]);
131 Status = SubDevice->DataRangeIntersection(Pin->PinId, DataRange, (PKSDATARANGE)Descriptor->Factory.KsPinDescriptor[Pin->PinId].DataRanges[0],
133
134 if (Status == STATUS_SUCCESS)
135 {
136 IoStatus->Information = Length;
137 break;
138 }
139 DataRange = (PKSDATARANGE)((PUCHAR)DataRange + DataRange->FormatSize);
140 }
141
142 IoStatus->Status = Status;
143 return Status;
144}
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1444
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:427
Status
Definition: gdiplustypes.h:25
union KSDATAFORMAT * PKSDATARANGE
struct KSMULTIPLE_ITEM * PKSMULTIPLE_ITEM
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define STATUS_NO_MATCH
Definition: ntstatus.h:751
#define PC_ASSERT(exp)
Definition: private.hpp:26
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG Count
Definition: ks.h:1980
Definition: ks.h:642
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342

Referenced by PinPropertyHandler().

◆ HandleNecessaryPropertyInstances()

NTSTATUS HandleNecessaryPropertyInstances ( IN PIO_STATUS_BLOCK  IoStatus,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data,
IN PSUBDEVICE_DESCRIPTOR  Descriptor,
IN ISubdevice *  SubDevice 
)

Definition at line 69 of file propertyhandler.cpp.

75{
78 ULONG FilterNecessary, FilterCurrent, FilterPossible, GlobalCurrent, GlobalPossible;
80
81 if (Pin->PinId >= Descriptor->Factory.PinDescriptorCount)
82 {
83 IoStatus->Information = 0;
86 }
87
89
90 // check if the miniport supports the IPinCount interface
91 Status = SubDevice->PinCount(Pin->PinId, &FilterNecessary, &FilterCurrent, &FilterPossible, &GlobalCurrent, &GlobalPossible);
92
93 if (NT_SUCCESS(Status))
94 {
95 *Result = FilterNecessary;
96 }
97 else
98 {
99 *Result = Descriptor->Factory.Instances[Pin->PinId].MinFilterInstanceCount;
100 }
101
102 IoStatus->Information = sizeof(ULONG);
103 IoStatus->Status = STATUS_SUCCESS;
104 return STATUS_SUCCESS;
105}
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
uint32_t * PULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by PinPropertyHandler().

◆ HandlePhysicalConnection()

NTSTATUS HandlePhysicalConnection ( IN PIO_STATUS_BLOCK  IoStatus,
IN PKSIDENTIFIER  Request,
IN ULONG  RequestLength,
IN OUT PVOID  Data,
IN ULONG  DataLength,
IN PSUBDEVICE_DESCRIPTOR  Descriptor 
)

Definition at line 147 of file propertyhandler.cpp.

154{
157 //PKSPIN_PHYSICALCONNECTION Connection;
159
160 // get pin
162
163 if (RequestLength < sizeof(KSP_PIN))
164 {
165 // input buffer must be at least sizeof KSP_PIN
166 DPRINT("input length too small\n");
168 }
169
170 if (IsListEmpty(&Descriptor->PhysicalConnectionList))
171 {
172 DPRINT("no connection\n");
173 return STATUS_NOT_FOUND;
174 }
175
176 // get first item
177 Entry = Descriptor->PhysicalConnectionList.Flink;
178
179 do
180 {
182
183 if (ConEntry->FromPin == Pin->PinId)
184 {
185 //Connection = (PKSPIN_PHYSICALCONNECTION)Data;
186 DPRINT("FoundEntry %S Size %u\n", ConEntry->Connection.SymbolicLinkName, ConEntry->Connection.Size);
187 IoStatus->Information = ConEntry->Connection.Size;
188
189 if (!DataLength)
190 {
191 IoStatus->Information = ConEntry->Connection.Size;
192 return STATUS_MORE_ENTRIES;
193 }
194
195 if (DataLength < ConEntry->Connection.Size)
196 {
198 }
199
200 RtlMoveMemory(Data, &ConEntry->Connection, ConEntry->Connection.Size);
201 return STATUS_SUCCESS;
202 }
203
204 // move to next item
205 Entry = Entry->Flink;
206 }while(Entry != &Descriptor->PhysicalConnectionList);
207
208 IoStatus->Information = 0;
209 return STATUS_NOT_FOUND;
210}
struct PHYSICAL_CONNECTION_ENTRY * PPHYSICAL_CONNECTION_ENTRY
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
struct KSP_PIN * PKSP_PIN
#define STATUS_NOT_FOUND
Definition: shellext.h:72
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define DPRINT
Definition: sndvol32.h:73
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
ULONG FromPin
Definition: interfaces.hpp:182
Definition: typedefs.h:120
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define STATUS_MORE_ENTRIES
Definition: udferr_usr.h:124

Referenced by PinPropertyHandler().

◆ HandlePropertyInstances()

NTSTATUS HandlePropertyInstances ( IN PIO_STATUS_BLOCK  IoStatus,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data,
IN PSUBDEVICE_DESCRIPTOR  Descriptor,
IN BOOL  Global,
IN ISubdevice *  SubDevice 
)

Definition at line 15 of file propertyhandler.cpp.

22{
23 KSPIN_CINSTANCES * Instances;
25 ULONG FilterNecessary, FilterCurrent, FilterPossible, GlobalCurrent, GlobalPossible;
27
28 if (Pin->PinId >= Descriptor->Factory.PinDescriptorCount)
29 {
30 IoStatus->Information = 0;
33 }
34
35 Instances = (KSPIN_CINSTANCES*)Data;
36
37 // check if the miniport supports the IPinCount interface
38 Status = SubDevice->PinCount(Pin->PinId, &FilterNecessary, &FilterCurrent, &FilterPossible, &GlobalCurrent, &GlobalPossible);
39
40 if (NT_SUCCESS(Status))
41 {
42 if (Global)
43 {
44 Instances->PossibleCount = GlobalPossible;
45 Instances->CurrentCount = GlobalCurrent;
46 }
47 else
48 {
49 Instances->PossibleCount = FilterPossible;
50 Instances->CurrentCount = FilterCurrent;
51 }
52 }
53 else
54 {
55 if (Global)
56 Instances->PossibleCount = Descriptor->Factory.Instances[Pin->PinId].MaxGlobalInstanceCount;
57 else
58 Instances->PossibleCount = Descriptor->Factory.Instances[Pin->PinId].MaxFilterInstanceCount;
59
60 Instances->CurrentCount = Descriptor->Factory.Instances[Pin->PinId].CurrentPinInstanceCount;
61 }
62
63 IoStatus->Information = sizeof(KSPIN_CINSTANCES);
64 IoStatus->Status = STATUS_SUCCESS;
65 return STATUS_SUCCESS;
66}
UNICODE_STRING Global
Definition: symlink.c:37
ULONG CurrentCount
Definition: ks.h:652
ULONG PossibleCount
Definition: ks.h:651

Referenced by PinPropertyHandler().

◆ PinPropertyHandler()

NTSTATUS NTAPI PinPropertyHandler ( IN PIRP  Irp,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data 
)

Definition at line 214 of file propertyhandler.cpp.

218{
219 PIO_STACK_LOCATION IoStack;
220 //PKSOBJECT_CREATE_ITEM CreateItem;
222 IIrpTarget * IrpTarget;
223 IPort *Port;
224 ISubdevice *SubDevice;
226
228
229 Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
231
232 // get current irp stack
234
235 // get dispatch context
236 DispatchContext = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
237
238 // Get the IrpTarget
239 IrpTarget = DispatchContext->Target;
240 PC_ASSERT(IrpTarget);
241
242 // Get the parent
243 Status = IrpTarget->QueryInterface(IID_IPort, (PVOID*)&Port);
244 if (!NT_SUCCESS(Status))
245 {
246 DPRINT("Failed to obtain IPort interface from filter\n");
247 Irp->IoStatus.Information = 0;
248 Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
249 return STATUS_UNSUCCESSFUL;
250 }
251
252 // Get private ISubdevice interface
253 Status = Port->QueryInterface(IID_ISubdevice, (PVOID*)&SubDevice);
254 if (!NT_SUCCESS(Status))
255 {
256 DPRINT("Failed to obtain ISubdevice interface from port driver\n");
258 while(TRUE);
259 }
260
261 // get current stack location
263
264 switch(Request->Id)
265 {
275 Status = KsPinPropertyHandler(Irp, Request, Data, Descriptor->Factory.PinDescriptorCount, Descriptor->Factory.KsPinDescriptor);
276 break;
278 Status = HandlePropertyInstances(&Irp->IoStatus, Request, Data, Descriptor, TRUE, SubDevice);
279 break;
281 Status = HandlePropertyInstances(&Irp->IoStatus, Request, Data, Descriptor, FALSE, SubDevice);
282 break;
285 break;
286
288 Status = HandleDataIntersection(&Irp->IoStatus, Request, Data, IoStack->Parameters.DeviceIoControl.OutputBufferLength, Descriptor, SubDevice);
289 break;
291 Status = HandlePhysicalConnection(&Irp->IoStatus, Request, IoStack->Parameters.DeviceIoControl.InputBufferLength, Data, IoStack->Parameters.DeviceIoControl.OutputBufferLength, Descriptor);
292 break;
296 break;
297 default:
300 }
301
302 // Release reference
303 Port->Release();
304
305 // Release subdevice reference
306 SubDevice->Release();
307
308 return Status;
309}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
struct SUBDEVICE_DESCRIPTOR * PSUBDEVICE_DESCRIPTOR
#define UNIMPLEMENTED
Definition: debug.h:118
KSDDKAPI NTSTATUS NTAPI KsPinPropertyHandler(IN PIRP Irp, IN PKSPROPERTY Property, IN OUT PVOID Data, IN ULONG DescriptorsCount, IN const KSPIN_DESCRIPTOR *Descriptor)
Definition: connectivity.c:666
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
CPPORT Port[4]
Definition: headless.c:35
NTSYSAPI void WINAPI DbgBreakPoint(void)
nsrefcnt Release()
@ KSPROPERTY_PIN_COMMUNICATION
Definition: ks.h:632
@ KSPROPERTY_PIN_CATEGORY
Definition: ks.h:636
@ KSPROPERTY_PIN_DATAINTERSECTION
Definition: ks.h:629
@ KSPROPERTY_PIN_NECESSARYINSTANCES
Definition: ks.h:634
@ KSPROPERTY_PIN_GLOBALCINSTANCES
Definition: ks.h:633
@ KSPROPERTY_PIN_CINSTANCES
Definition: ks.h:625
@ KSPROPERTY_PIN_MEDIUMS
Definition: ks.h:631
@ KSPROPERTY_PIN_NAME
Definition: ks.h:637
@ KSPROPERTY_PIN_PROPOSEDATAFORMAT
Definition: ks.h:639
@ KSPROPERTY_PIN_CONSTRAINEDDATARANGES
Definition: ks.h:638
@ KSPROPERTY_PIN_DATARANGES
Definition: ks.h:628
@ KSPROPERTY_PIN_PHYSICALCONNECTION
Definition: ks.h:635
@ KSPROPERTY_PIN_CTYPES
Definition: ks.h:626
@ KSPROPERTY_PIN_DATAFLOW
Definition: ks.h:627
@ KSPROPERTY_PIN_INTERFACES
Definition: ks.h:630
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
struct DISPATCH_CONTEXT * PDISPATCH_CONTEXT
NTSTATUS HandlePhysicalConnection(IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN ULONG RequestLength, IN OUT PVOID Data, IN ULONG DataLength, IN PSUBDEVICE_DESCRIPTOR Descriptor)
NTSTATUS HandlePropertyInstances(IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN OUT PVOID Data, IN PSUBDEVICE_DESCRIPTOR Descriptor, IN BOOL Global, IN ISubdevice *SubDevice)
NTSTATUS HandleDataIntersection(IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN OUT PVOID Data, IN ULONG DataLength, IN PSUBDEVICE_DESCRIPTOR Descriptor, IN ISubdevice *SubDevice)
NTSTATUS HandleNecessaryPropertyInstances(IN PIO_STATUS_BLOCK IoStatus, IN PKSIDENTIFIER Request, IN OUT PVOID Data, IN PSUBDEVICE_DESCRIPTOR Descriptor, IN ISubdevice *SubDevice)
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
struct _IO_STACK_LOCATION::@1568::@1569 DeviceIoControl
union _IO_STACK_LOCATION::@1568 Parameters
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_In_ UCHAR _In_ UCHAR _In_ ULONG _In_ WDFCONTEXT _Inout_ PIRP _In_ WDFCONTEXT DispatchContext
Definition: wdfdevice.h:1708

◆ TopologyPropertyHandler()

NTSTATUS NTAPI TopologyPropertyHandler ( IN PIRP  Irp,
IN PKSIDENTIFIER  Request,
IN OUT PVOID  Data 
)

Definition at line 313 of file propertyhandler.cpp.

317{
319
320 Descriptor = (PSUBDEVICE_DESCRIPTOR)KSPROPERTY_ITEM_IRP_STORAGE(Irp);
321
323}
KSDDKAPI NTSTATUS NTAPI KsTopologyPropertyHandler(IN PIRP Irp, IN PKSPROPERTY Property, IN OUT PVOID Data, IN const KSTOPOLOGY *Topology)
Definition: topology.c:144