ReactOS 0.4.16-dev-320-g3bd9ddc
pin.c File Reference
#include "precomp.h"
#include <bdamedia.h>
#include <debug.h>
Include dependency graph for pin.c:

Go to the source code of this file.

Classes

struct  _KSISTREAM_POINTER
 
struct  IKsPinImpl
 

Macros

#define NDEBUG
 

Typedefs

typedef struct _KSISTREAM_POINTER KSISTREAM_POINTER
 
typedef struct _KSISTREAM_POINTERPKSISTREAM_POINTER
 

Functions

NTSTATUS NTAPI IKsPin_PinStatePropertyHandler (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI IKsPin_PinDataFormatPropertyHandler (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI IKsPin_PinAllocatorFramingPropertyHandler (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI IKsPin_PinStreamAllocator (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI IKsPin_PinMasterClock (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
NTSTATUS NTAPI IKsPin_PinPipeId (IN PIRP Irp, IN PKSIDENTIFIER Request, IN OUT PVOID Data)
 
 DEFINE_KSPROPERTY_CONNECTIONSET (PinConnectionSet, IKsPin_PinStatePropertyHandler, IKsPin_PinDataFormatPropertyHandler, IKsPin_PinAllocatorFramingPropertyHandler)
 
 DEFINE_KSPROPERTY_STREAMSET (PinStreamSet, IKsPin_PinStreamAllocator, IKsPin_PinMasterClock, IKsPin_PinPipeId)
 
NTSTATUS NTAPI IKsPin_fnQueryInterface (IKsPin *iface, IN REFIID refiid, OUT PVOID *Output)
 
ULONG NTAPI IKsPin_fnAddRef (IKsPin *iface)
 
ULONG NTAPI IKsPin_fnRelease (IKsPin *iface)
 
NTSTATUS NTAPI IKsPin_fnTransferKsIrp (IN IKsPin *iface, IN PIRP Irp, IN IKsTransport **OutTransport)
 
VOID NTAPI IKsPin_fnDiscardKsIrp (IN IKsPin *iface, IN PIRP Irp, IN IKsTransport **OutTransport)
 
NTSTATUS NTAPI IKsPin_fnConnect (IN IKsPin *iface, IN IKsTransport *TransportIn, OUT IKsTransport **OutTransportIn, OUT IKsTransport **OutTransportOut, IN KSPIN_DATAFLOW DataFlow)
 
NTSTATUS NTAPI IKsPin_fnSetDeviceState (IN IKsPin *iface, IN KSSTATE OldState, IN KSSTATE NewState, IN IKsTransport **OutTransport)
 
VOID NTAPI IKsPin_fnSetResetState (IN IKsPin *iface, IN KSRESET ResetState, OUT IKsTransport **OutTransportOut)
 
NTSTATUS NTAPI IKsPin_fnGetTransportConfig (IN IKsPin *iface, IN struct KSPTRANSPORTCONFIG *TransportConfig, OUT IKsTransport **OutTransportIn, OUT IKsTransport **OutTransportOut)
 
NTSTATUS NTAPI IKsPin_fnSetTransportConfig (IN IKsPin *iface, IN struct KSPTRANSPORTCONFIG const *TransportConfig, OUT IKsTransport **OutTransportIn, OUT IKsTransport **OutTransportOut)
 
NTSTATUS NTAPI IKsPin_fnResetTransportConfig (IN IKsPin *iface, OUT IKsTransport **OutTransportIn, OUT IKsTransport **OutTransportOut)
 
PKSPIN NTAPI IKsPin_fnGetStruct (IN IKsPin *iface)
 
PKSPROCESSPIN NTAPI IKsPin_fnGetProcessPin (IN IKsPin *iface)
 
NTSTATUS NTAPI IKsPin_fnAttemptBypass (IN IKsPin *iface)
 
NTSTATUS NTAPI IKsPin_fnAttemptUnbypass (IN IKsPin *iface)
 
VOID NTAPI IKsPin_fnGenerateConnectionEvents (IN IKsPin *iface, IN ULONG EventMask)
 
NTSTATUS NTAPI IKsPin_fnClientSetDeviceState (IN IKsPin *iface, IN KSSTATE StateIn, IN KSSTATE StateOut)
 
NTSTATUS NTAPI IKsReferenceClock_fnQueryInterface (IKsReferenceClock *iface, IN REFIID refiid, OUT PVOID *Output)
 
ULONG NTAPI IKsReferenceClock_fnAddRef (IKsReferenceClock *iface)
 
ULONG NTAPI IKsReferenceClock_fnRelease (IKsReferenceClock *iface)
 
LONGLONG NTAPI IKsReferenceClock_fnGetTime (IKsReferenceClock *iface)
 
LONGLONG NTAPI IKsReferenceClock_fnGetPhysicalTime (IKsReferenceClock *iface)
 
LONGLONG NTAPI IKsReferenceClock_fnGetCorrelatedTime (IKsReferenceClock *iface, OUT PLONGLONG SystemTime)
 
LONGLONG NTAPI IKsReferenceClock_fnGetCorrelatedPhysicalTime (IKsReferenceClock *iface, OUT PLONGLONG SystemTime)
 
NTSTATUS NTAPI IKsReferenceClock_fnGetResolution (IKsReferenceClock *iface, OUT PKSRESOLUTION Resolution)
 
NTSTATUS NTAPI IKsReferenceClock_fnGetState (IKsReferenceClock *iface, OUT PKSSTATE State)
 
VOID NTAPI KsPinAcquireProcessingMutex (IN PKSPIN Pin)
 
VOID NTAPI KsPinAttachAndGate (IN PKSPIN Pin, IN PKSGATE AndGate OPTIONAL)
 
VOID NTAPI KsPinAttachOrGate (IN PKSPIN Pin, IN PKSGATE OrGate OPTIONAL)
 
PKSGATE NTAPI KsPinGetAndGate (IN PKSPIN Pin)
 
VOID NTAPI KsPinAttemptProcessing (IN PKSPIN Pin, IN BOOLEAN Asynchronous)
 
NTSTATUS NTAPI KsPinGetAvailableByteCount (IN PKSPIN Pin, OUT PLONG InputDataBytes OPTIONAL, OUT PLONG OutputBufferBytes OPTIONAL)
 
NTSTATUS NTAPI KsPinGetConnectedFilterInterface (IN PKSPIN Pin, IN const GUID *InterfaceId, OUT PVOID *Interface)
 
PDEVICE_OBJECT NTAPI KsPinGetConnectedPinDeviceObject (IN PKSPIN Pin)
 
PFILE_OBJECT NTAPI KsPinGetConnectedPinFileObject (IN PKSPIN Pin)
 
NTSTATUS NTAPI KsPinGetConnectedPinInterface (IN PKSPIN Pin, IN const GUID *InterfaceId, OUT PVOID *Interface)
 
VOID NTAPI KsPinGetCopyRelationships (IN PKSPIN Pin, OUT PKSPIN *CopySource, OUT PKSPIN *DelegateBranch)
 
PKSPIN NTAPI KsPinGetNextSiblingPin (IN PKSPIN Pin)
 
PKSFILTER NTAPI KsPinGetParentFilter (IN PKSPIN Pin)
 
NTSTATUS NTAPI KsPinGetReferenceClockInterface (IN PKSPIN Pin, OUT PIKSREFERENCECLOCK *Interface)
 
VOID NTAPI KsPinRegisterFrameReturnCallback (IN PKSPIN Pin, IN PFNKSPINFRAMERETURN FrameReturn)
 
VOID NTAPI KsPinRegisterHandshakeCallback (IN PKSPIN Pin, IN PFNKSPINHANDSHAKE Handshake)
 
VOID NTAPI KsPinRegisterIrpCompletionCallback (IN PKSPIN Pin, IN PFNKSPINIRPCOMPLETION IrpCompletion)
 
VOID NTAPI KsPinRegisterPowerCallbacks (IN PKSPIN Pin, IN PFNKSPINPOWER Sleep OPTIONAL, IN PFNKSPINPOWER Wake OPTIONAL)
 
VOID NTAPI KsPinReleaseProcessingMutex (IN PKSPIN Pin)
 
KSDDKAPI PKSPIN NTAPI KsGetPinFromIrp (IN PIRP Irp)
 
VOID NTAPI KsPinSetPinClockTime (IN PKSPIN Pin, IN LONGLONG Time)
 
NTSTATUS NTAPI KsPinSubmitFrame (IN PKSPIN Pin, IN PVOID Data OPTIONAL, IN ULONG Size OPTIONAL, IN PKSSTREAM_HEADER StreamHeader OPTIONAL, IN PVOID Context OPTIONAL)
 
KSDDKAPI NTSTATUS NTAPI KsPinSubmitFrameMdl (IN PKSPIN Pin, IN PMDL Mdl OPTIONAL, IN PKSSTREAM_HEADER StreamHeader OPTIONAL, IN PVOID Context OPTIONAL)
 
KSDDKAPI BOOLEAN NTAPI KsProcessPinUpdate (IN PKSPROCESSPIN ProcessPin)
 
NTSTATUS IKsPin_PrepareStreamHeader (IN IKsPinImpl *This, IN PKSISTREAM_POINTER StreamPointer)
 
KSDDKAPI PKSSTREAM_POINTER NTAPI KsPinGetLeadingEdgeStreamPointer (IN PKSPIN Pin, IN KSSTREAM_POINTER_STATE State)
 
KSDDKAPI PKSSTREAM_POINTER NTAPI KsPinGetTrailingEdgeStreamPointer (IN PKSPIN Pin, IN KSSTREAM_POINTER_STATE State)
 
KSDDKAPI NTSTATUS NTAPI KsStreamPointerSetStatusCode (IN PKSSTREAM_POINTER StreamPointer, IN NTSTATUS Status)
 
KSDDKAPI NTSTATUS NTAPI KsStreamPointerLock (IN PKSSTREAM_POINTER StreamPointer)
 
KSDDKAPI VOID NTAPI KsStreamPointerUnlock (IN PKSSTREAM_POINTER StreamPointer, IN BOOLEAN Eject)
 
KSDDKAPI VOID NTAPI KsStreamPointerAdvanceOffsetsAndUnlock (IN PKSSTREAM_POINTER StreamPointer, IN ULONG InUsed, IN ULONG OutUsed, IN BOOLEAN Eject)
 
KSDDKAPI VOID NTAPI KsStreamPointerDelete (IN PKSSTREAM_POINTER StreamPointer)
 
KSDDKAPI NTSTATUS NTAPI KsStreamPointerClone (IN PKSSTREAM_POINTER StreamPointer, IN PFNKSSTREAMPOINTER CancelCallback OPTIONAL, IN ULONG ContextSize, OUT PKSSTREAM_POINTER *CloneStreamPointer)
 
KSDDKAPI NTSTATUS NTAPI KsStreamPointerAdvanceOffsets (IN PKSSTREAM_POINTER StreamPointer, IN ULONG InUsed, IN ULONG OutUsed, IN BOOLEAN Eject)
 
KSDDKAPI NTSTATUS NTAPI KsStreamPointerAdvance (IN PKSSTREAM_POINTER StreamPointer)
 
KSDDKAPI PMDL NTAPI KsStreamPointerGetMdl (IN PKSSTREAM_POINTER StreamPointer)
 
KSDDKAPI PIRP NTAPI KsStreamPointerGetIrp (IN PKSSTREAM_POINTER StreamPointer, OUT PBOOLEAN FirstFrameInIrp OPTIONAL, OUT PBOOLEAN LastFrameInIrp OPTIONAL)
 
KSDDKAPI VOID NTAPI KsStreamPointerScheduleTimeout (IN PKSSTREAM_POINTER StreamPointer, IN PFNKSSTREAMPOINTER Callback, IN ULONGLONG Interval)
 
KSDDKAPI VOID NTAPI KsStreamPointerCancelTimeout (IN PKSSTREAM_POINTER StreamPointer)
 
KSDDKAPI PKSSTREAM_POINTER NTAPI KsPinGetFirstCloneStreamPointer (IN PKSPIN Pin)
 
KSDDKAPI PKSSTREAM_POINTER NTAPI KsStreamPointerGetNextClone (IN PKSSTREAM_POINTER StreamPointer)
 
VOID NTAPI IKsPin_PinCentricWorker (IN PVOID Parameter)
 
NTSTATUS NTAPI IKsPin_DispatchKsStream (PDEVICE_OBJECT DeviceObject, PIRP Irp, IKsPinImpl *This)
 
NTSTATUS NTAPI IKsPin_DispatchDeviceIoControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI IKsPin_Close (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI IKsPin_DispatchCreateAllocator (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI IKsPin_DispatchCreateClock (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS NTAPI IKsPin_DispatchCreateNode (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
NTSTATUS KspCreatePin (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PKSDEVICE KsDevice, IN IKsFilterFactory *FilterFactory, IN IKsFilter *Filter, IN PKSPIN_CONNECT Connect, IN KSPIN_DESCRIPTOR_EX *Descriptor)
 

Variables

KSPROPERTY_SET PinPropertySet []
 
const GUID KSPROPSETID_Connection = {0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}
 
const GUID KSPROPSETID_Stream = {0x65aaba60L, 0x98ae, 0x11cf, {0xa1, 0x0d, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4}}
 
const GUID KSPROPSETID_Clock = {0xDF12A4C0L, 0xAC17, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}
 
static IKsPinVtbl vt_IKsPin
 
static IKsReferenceClockVtbl vt_ReferenceClock
 
static KSDISPATCH_TABLE PinDispatchTable
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file pin.c.

Typedef Documentation

◆ KSISTREAM_POINTER

◆ PKSISTREAM_POINTER

Function Documentation

◆ DEFINE_KSPROPERTY_CONNECTIONSET()

DEFINE_KSPROPERTY_CONNECTIONSET ( PinConnectionSet  ,
IKsPin_PinStatePropertyHandler  ,
IKsPin_PinDataFormatPropertyHandler  ,
IKsPin_PinAllocatorFramingPropertyHandler   
)

◆ DEFINE_KSPROPERTY_STREAMSET()

DEFINE_KSPROPERTY_STREAMSET ( PinStreamSet  ,
IKsPin_PinStreamAllocator  ,
IKsPin_PinMasterClock  ,
IKsPin_PinPipeId   
)

◆ IKsPin_Close()

NTSTATUS NTAPI IKsPin_Close ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 2111 of file pin.c.

2114{
2115 PIO_STACK_LOCATION IoStack;
2116 PKSIOBJECT_HEADER ObjectHeader;
2117 IKsPinImpl * This;
2119
2120 /* get current irp stack */
2122
2123 /* sanity check */
2124 ASSERT(IoStack->FileObject);
2125 ASSERT(IoStack->FileObject->FsContext2);
2126
2127 /* get the object header */
2128 ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
2129
2130 /* locate ks pin implementation fro KSPIN offset */
2132
2133 if (This->Pin.Descriptor->Dispatch->Close)
2134 {
2135 /* call pin close routine */
2136 Status = This->Pin.Descriptor->Dispatch->Close(&This->Pin, Irp);
2137
2138 if (!NT_SUCCESS(Status))
2139 {
2140 /* abort closing */
2141 Irp->IoStatus.Status = Status;
2143 return Status;
2144 }
2145
2146 /* remove pin from filter pin list and decrement reference count */
2147 IKsFilter_RemovePin(This->Filter->lpVtbl->GetStruct(This->Filter), &This->Pin);
2148
2149 if (Status != STATUS_PENDING)
2150 {
2151 Irp->IoStatus.Status = Status;
2153 return Status;
2154 }
2155 }
2156
2157 return Status;
2158}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_PENDING
Definition: d3dkmdt.h:43
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
NTSTATUS NTAPI CompleteRequest(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
Definition: dispatch.c:19
VOID IKsFilter_RemovePin(PKSFILTER Filter, PKSPIN Pin)
Definition: filter.c:1378
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:428
Status
Definition: gdiplustypes.h:25
struct KSIOBJECT_HEADER * PKSIOBJECT_HEADER
#define ASSERT(a)
Definition: mode.c:44
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: pin.c:32
PVOID ObjectType
Definition: kstypes.h:30
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ IKsPin_DispatchCreateAllocator()

NTSTATUS NTAPI IKsPin_DispatchCreateAllocator ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 2162 of file pin.c.

2165{
2167
2168 Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
2171}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42

Referenced by KspCreatePin().

◆ IKsPin_DispatchCreateClock()

NTSTATUS NTAPI IKsPin_DispatchCreateClock ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 2175 of file pin.c.

2178{
2179 PKSPIN Pin;
2181 IKsPinImpl * This;
2183 PKSRESOLUTION pResolution = NULL;
2184 PKSOBJECT_CREATE_ITEM CreateItem;
2185
2186 DPRINT("IKsPin_DispatchCreateClock\n");
2187
2188 /* get the create item */
2189 CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp);
2190
2191 /* sanity check */
2192 ASSERT(CreateItem);
2193
2194 /* get the pin object */
2195 Pin = (PKSPIN)CreateItem->Context;
2196
2197 /* sanity check */
2198 ASSERT(Pin);
2199
2200 /* locate ks pin implementation fro KSPIN offset */
2202
2203 /* sanity check */
2204 ASSERT(This->BasicHeader.Type == KsObjectTypePin);
2205 ASSERT(This->BasicHeader.ControlMutex);
2206
2207 /* acquire control mutex */
2209
2210 if ((This->Pin.Descriptor->PinDescriptor.Communication != KSPIN_COMMUNICATION_NONE &&
2211 This->Pin.Descriptor->Dispatch) ||
2212 (This->Pin.Descriptor->Flags & KSPIN_FLAG_IMPLEMENT_CLOCK))
2213 {
2214 if (!This->DefaultClock)
2215 {
2216 if (This->Pin.Descriptor->Dispatch && This->Pin.Descriptor->Dispatch->Clock)
2217 {
2218 if (This->Pin.Descriptor->Dispatch->Clock->Resolution)
2219 {
2220 This->Pin.Descriptor->Dispatch->Clock->Resolution(&This->Pin, &Resolution);
2221 pResolution = &Resolution;
2222 }
2223
2224 Status = KsAllocateDefaultClockEx(&This->DefaultClock,
2225 (PVOID)&This->Pin,
2226 (PFNKSSETTIMER)This->Pin.Descriptor->Dispatch->Clock->SetTimer,
2227 (PFNKSCANCELTIMER)This->Pin.Descriptor->Dispatch->Clock->CancelTimer,
2228 (PFNKSCORRELATEDTIME)This->Pin.Descriptor->Dispatch->Clock->CorrelatedTime,
2229 pResolution,
2230 0);
2231 }
2232 else
2233 {
2234 Status = KsAllocateDefaultClockEx(&This->DefaultClock, (PVOID)&This->Pin, NULL, NULL, NULL, NULL, 0);
2235 }
2236 }
2237
2238 if (NT_SUCCESS(Status))
2239 {
2240 Status = KsCreateDefaultClock(Irp, This->DefaultClock);
2241 }
2242 }
2243
2244 DPRINT("IKsPin_DispatchCreateClock %lx\n", Status);
2245
2246 /* release control mutex */
2248
2249 /* done */
2250 Irp->IoStatus.Status = Status;
2252 return Status;
2253}
KSDDKAPI NTSTATUS NTAPI KsCreateDefaultClock(IN PIRP Irp, IN PKSDEFAULTCLOCK DefaultClock)
Definition: clocks.c:383
KSDDKAPI NTSTATUS NTAPI KsAllocateDefaultClockEx(OUT PKSDEFAULTCLOCK *DefaultClock, IN PVOID Context OPTIONAL, IN PFNKSSETTIMER SetTimer OPTIONAL, IN PFNKSCANCELTIMER CancelTimer OPTIONAL, IN PFNKSCORRELATEDTIME CorrelatedTime OPTIONAL, IN const KSRESOLUTION *Resolution OPTIONAL, IN ULONG Flags)
Definition: clocks.c:446
#define NULL
Definition: types.h:112
KSDDKAPI VOID NTAPI KsAcquireControl(IN PVOID Object)
Definition: api.c:1587
VOID NTAPI KsReleaseControl(IN PVOID Object)
Definition: api.c:1604
@ KsObjectTypePin
Definition: ks.h:1211
@ KSPIN_COMMUNICATION_NONE
Definition: ks.h:1254
#define DPRINT
Definition: sndvol32.h:73
static BYTE Resolution
Definition: mouse.c:35

Referenced by KspCreatePin().

◆ IKsPin_DispatchCreateNode()

NTSTATUS NTAPI IKsPin_DispatchCreateNode ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 2257 of file pin.c.

2260{
2262
2263 Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
2266}

Referenced by KspCreatePin().

◆ IKsPin_DispatchDeviceIoControl()

NTSTATUS NTAPI IKsPin_DispatchDeviceIoControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 1988 of file pin.c.

1991{
1992 PIO_STACK_LOCATION IoStack;
1993 PKSIOBJECT_HEADER ObjectHeader;
1994 IKsPinImpl * This;
1998 ULONG SetCount = 0;
1999
2000 /* get current irp stack */
2002
2003 /* sanity check */
2004 ASSERT(IoStack->FileObject);
2005 ASSERT(IoStack->FileObject->FsContext2);
2006
2007 /* get the object header */
2008 ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
2009
2010 /* locate ks pin implementation from KSPIN offset */
2012
2013 /* current irp stack */
2015
2016 if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_READ_STREAM ||
2017 IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_WRITE_STREAM)
2018 {
2019 /* handle ks stream packets */
2021 }
2022
2023 /* get property from input buffer */
2024 Property = (PKSPROPERTY)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
2025
2026 /* sanity check */
2027 ASSERT(IoStack->Parameters.DeviceIoControl.InputBufferLength >= sizeof(KSIDENTIFIER));
2028 ASSERT(This->Pin.Descriptor->AutomationTable);
2029
2031 DPRINT("IKsPin_DispatchDeviceIoControl property Set |%S| Id %u Flags %x\n", GuidString.Buffer, Property->Id, Property->Flags);
2033
2034
2035 if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_METHOD)
2036 {
2037 const KSMETHOD_SET *MethodSet = NULL;
2038 ULONG MethodItemSize = 0;
2039
2040 /* check if the driver supports method sets */
2041 if (This->Pin.Descriptor->AutomationTable->MethodSetsCount)
2042 {
2043 SetCount = This->Pin.Descriptor->AutomationTable->MethodSetsCount;
2044 MethodSet = This->Pin.Descriptor->AutomationTable->MethodSets;
2045 MethodItemSize = This->Pin.Descriptor->AutomationTable->MethodItemSize;
2046 }
2047
2048 /* call method set handler */
2049 Status = KspMethodHandlerWithAllocator(Irp, SetCount, MethodSet, NULL, MethodItemSize);
2050 }
2051 else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY)
2052 {
2053 const KSPROPERTY_SET *PropertySet = NULL;
2054 ULONG PropertyItemSize = 0;
2055
2056 /* check if the driver supports method sets */
2057 if (This->Pin.Descriptor->AutomationTable->PropertySetsCount)
2058 {
2059 SetCount = This->Pin.Descriptor->AutomationTable->PropertySetsCount;
2060 PropertySet = This->Pin.Descriptor->AutomationTable->PropertySets;
2061 PropertyItemSize = This->Pin.Descriptor->AutomationTable->PropertyItemSize;
2062 }
2063
2064 /* needed for our property handlers */
2065 KSPROPERTY_ITEM_IRP_STORAGE(Irp) = (KSPROPERTY_ITEM*)This;
2066
2067 /* call property handler */
2068 Status = KspPropertyHandler(Irp, SetCount, PropertySet, NULL, PropertyItemSize);
2069 }
2070 else
2071 {
2072 /* sanity check */
2073 ASSERT(IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_ENABLE_EVENT ||
2074 IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_DISABLE_EVENT);
2075
2076 if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_ENABLE_EVENT)
2077 {
2078 /* call enable event handlers */
2080 This->Pin.Descriptor->AutomationTable->EventSetsCount,
2081 (PKSEVENT_SET)This->Pin.Descriptor->AutomationTable->EventSets,
2082 &This->BasicHeader.EventList,
2084 (PVOID)&This->BasicHeader.EventListLock,
2085 NULL,
2086 This->Pin.Descriptor->AutomationTable->EventItemSize);
2087 }
2088 else
2089 {
2090 /* disable event handler */
2091 Status = KsDisableEvent(Irp, &This->BasicHeader.EventList, KSEVENTS_SPINLOCK, &This->BasicHeader.EventListLock);
2092 }
2093 }
2094
2096 DPRINT("IKsPin_DispatchDeviceIoControl property Set |%S| Id %u Flags %x Status %lx ResultLength %lu\n", GuidString.Buffer, Property->Id, Property->Flags, Status, Irp->IoStatus.Information);
2098
2099 if (Status != STATUS_PENDING)
2100 {
2101 Irp->IoStatus.Status = Status;
2103 }
2104
2105 /* done */
2106 return Status;
2107}
KSDDKAPI NTSTATUS NTAPI KsDisableEvent(IN PIRP Irp, IN OUT PLIST_ENTRY EventsList, IN KSEVENTS_LOCKTYPE EventsFlags, IN PVOID EventsLock)
Definition: event.c:469
NTSTATUS KspEnableEvent(IN PIRP Irp, IN ULONG EventSetsCount, IN const KSEVENT_SET *EventSet, IN OUT PLIST_ENTRY EventsList OPTIONAL, IN KSEVENTS_LOCKTYPE EventsFlags OPTIONAL, IN PVOID EventsLock OPTIONAL, IN PFNKSALLOCATOR Allocator OPTIONAL, IN ULONG EventItemSize OPTIONAL)
Definition: event.c:87
NTSTATUS NTAPI IKsPin_DispatchKsStream(PDEVICE_OBJECT DeviceObject, PIRP Irp, IKsPinImpl *This)
Definition: pin.c:1851
struct KSIDENTIFIER * PKSPROPERTY
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
#define IOCTL_KS_METHOD
Definition: ks.h:136
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
@ KSEVENTS_SPINLOCK
Definition: ks.h:1233
#define IOCTL_KS_READ_STREAM
Definition: ks.h:142
#define IOCTL_KS_ENABLE_EVENT
Definition: ks.h:130
#define IOCTL_KS_WRITE_STREAM
Definition: ks.h:139
#define IOCTL_KS_DISABLE_EVENT
Definition: ks.h:133
NTSTATUS KspPropertyHandler(IN PIRP Irp, IN ULONG PropertySetsCount, IN const KSPROPERTY_SET *PropertySet, IN PFNKSALLOCATOR Allocator OPTIONAL, IN ULONG PropertyItemSize OPTIONAL)
Definition: property.c:138
NTSTATUS NTAPI KspMethodHandlerWithAllocator(IN PIRP Irp, IN ULONG MethodSetsCount, IN const KSMETHOD_SET *MethodSet, IN PFNKSALLOCATOR Allocator OPTIONAL, IN ULONG MethodItemSize OPTIONAL)
Definition: methods.c:99
static PWSTR GuidString
Definition: apphelp.c:93
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
struct _IO_STACK_LOCATION::@1580::@1581 DeviceIoControl
union _IO_STACK_LOCATION::@1580 Parameters
uint32_t ULONG
Definition: typedefs.h:59
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055

◆ IKsPin_DispatchKsStream()

NTSTATUS NTAPI IKsPin_DispatchKsStream ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp,
IKsPinImpl This 
)

Definition at line 1851 of file pin.c.

1855{
1856 PKSPROCESSPIN_INDEXENTRY ProcessPinIndex;
1858 ULONG NumHeaders;
1859 PKSFILTER Filter;
1860 PIO_STACK_LOCATION IoStack;
1862
1863 DPRINT("IKsPin_DispatchKsStream\n");
1864
1865 /* FIXME handle reset states */
1866 ASSERT(This->Pin.ResetState == KSRESET_END);
1867
1868 /* get current stack location */
1870
1871 /* probe stream pointer */
1872 if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_WRITE_STREAM)
1873 Status = KsProbeStreamIrp(Irp, KSSTREAM_WRITE | KSPROBE_ALLOCATEMDL | KSPROBE_PROBEANDLOCK | KSPROBE_SYSTEMADDRESS, This->Pin.StreamHeaderSize);
1874 else
1875 Status = KsProbeStreamIrp(Irp, KSSTREAM_READ | KSPROBE_ALLOCATEMDL | KSPROBE_PROBEANDLOCK | KSPROBE_SYSTEMADDRESS, This->Pin.StreamHeaderSize);
1876
1877 if (!NT_SUCCESS(Status))
1878 {
1879 DPRINT1("KsProbeStreamIrp failed with %x\n", Status);
1880
1881 Irp->IoStatus.Status = Status;
1883 return Status;
1884 }
1885
1886 if (Irp->RequestorMode == UserMode)
1887 Header = (PKSSTREAM_HEADER)Irp->AssociatedIrp.SystemBuffer;
1888 else
1889 Header = (PKSSTREAM_HEADER)Irp->UserBuffer;
1890
1891 if (!Header)
1892 {
1893 DPRINT("NoHeader Canceling Irp %p\n", Irp);
1894 Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
1896 return Status;
1897 }
1898
1899 /* calculate num headers */
1900 NumHeaders = IoStack->Parameters.DeviceIoControl.OutputBufferLength / Header->Size;
1901
1902 /* assume headers of same length */
1903 ASSERT(IoStack->Parameters.DeviceIoControl.OutputBufferLength % Header->Size == 0);
1904
1905 /* FIXME support multiple stream headers */
1906 ASSERT(NumHeaders == 1);
1907
1908 if (Irp->RequestorMode == UserMode)
1909 {
1910 /* prepare header */
1911 ASSERT(Irp->MdlAddress);
1913
1914 if (!Header->Data)
1915 {
1916 DPRINT("NoHeader->Data Canceling Irp %p\n", Irp);
1917 Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
1919 return Status;
1920 }
1921
1922 }
1923
1924
1925
1926 if (This->Pin.Descriptor->Dispatch->Process)
1927 {
1928 /* it is a pin centric avstream */
1929
1930 /* mark irp as pending */
1932
1933 /* add irp to cancelable queue */
1934 KsAddIrpToCancelableQueue(&This->IrpList, &This->IrpListLock, Irp, KsListEntryTail, NULL /* FIXME */);
1935
1936 /* sanity checks */
1937 ASSERT(!(This->Pin.Descriptor->Flags & KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING));
1938 ASSERT(This->PinWorker);
1939
1940 InterlockedIncrement(&This->IrpCount);
1941
1942 DPRINT("IKsPin_DispatchKsStream IrpCount %lu\n", This->IrpCount);
1943
1944 /* start the processing loop */
1945 KsIncrementCountedWorker(This->PinWorker);
1946
1948 }
1949 else
1950 {
1951 /* filter-centric avstream */
1952 ASSERT(This->Filter);
1953
1954 ProcessPinIndex = This->Filter->lpVtbl->GetProcessDispatch(This->Filter);
1955 Filter = This->Filter->lpVtbl->GetStruct(This->Filter);
1956
1957 ASSERT(ProcessPinIndex);
1958 ASSERT(Filter);
1959 ASSERT(Filter->Descriptor);
1960 ASSERT(Filter->Descriptor->Dispatch);
1961
1962 if (!Filter->Descriptor->Dispatch->Process)
1963 {
1964 /* invalid device request */
1965 DPRINT("Filter Centric Processing No Process Routine\n");
1966 Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
1968 return STATUS_UNSUCCESSFUL;
1969 }
1970
1971 /* mark irp as pending */
1973
1974 /* add irp to cancelable queue */
1975 KsAddIrpToCancelableQueue(&This->IrpList, &This->IrpListLock, Irp, KsListEntryTail, NULL /* FIXME */);
1976
1977 Status = Filter->Descriptor->Dispatch->Process(Filter, ProcessPinIndex);
1978
1979 DPRINT("IKsPin_DispatchKsStream FilterCentric: Status %lx \n", Status);
1980
1981 }
1982
1983 return Status;
1984}
#define InterlockedIncrement
Definition: armddk.h:53
#define DPRINT1
Definition: precomp.h:8
Definition: Header.h:9
KSDDKAPI VOID NTAPI KsAddIrpToCancelableQueue(IN OUT PLIST_ENTRY QueueHead, IN PKSPIN_LOCK SpinLock, IN PIRP Irp, IN KSLIST_ENTRY_LOCATION ListLocation, IN PDRIVER_CANCEL DriverCancel OPTIONAL)
Definition: irp.c:1666
KSDDKAPI NTSTATUS NTAPI KsProbeStreamIrp(IN PIRP Irp, IN ULONG ProbeFlags, IN ULONG HeaderSize)
Definition: irp.c:680
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1801
IoMarkIrpPending(Irp)
@ KSRESET_END
Definition: ks.h:1228
struct _KSPROCESSPIN_INDEXENTRY * PKSPROCESSPIN_INDEXENTRY
Definition: ks.h:3028
struct KSSTREAM_HEADER * PKSSTREAM_HEADER
@ KsListEntryTail
Definition: ks.h:1262
@ NormalPagePriority
Definition: imports.h:54
#define UserMode
Definition: asm.h:35
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
KSDDKAPI ULONG NTAPI KsIncrementCountedWorker(IN PKSWORKER Worker)
Definition: worker.c:222
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)

Referenced by IKsPin_DispatchDeviceIoControl().

◆ IKsPin_fnAddRef()

ULONG NTAPI IKsPin_fnAddRef ( IKsPin *  iface)

Definition at line 517 of file pin.c.

519{
520 IKsPinImpl * This = (IKsPinImpl*)CONTAINING_RECORD(iface, IKsPinImpl, BasicHeader.OuterUnknown);
521
522 return InterlockedIncrement(&This->ref);
523}

Referenced by IKsReferenceClock_fnAddRef().

◆ IKsPin_fnAttemptBypass()

NTSTATUS NTAPI IKsPin_fnAttemptBypass ( IN IKsPin *  iface)

Definition at line 655 of file pin.c.

657{
660}

◆ IKsPin_fnAttemptUnbypass()

NTSTATUS NTAPI IKsPin_fnAttemptUnbypass ( IN IKsPin *  iface)

Definition at line 664 of file pin.c.

666{
669}

◆ IKsPin_fnClientSetDeviceState()

NTSTATUS NTAPI IKsPin_fnClientSetDeviceState ( IN IKsPin *  iface,
IN KSSTATE  StateIn,
IN KSSTATE  StateOut 
)

Definition at line 682 of file pin.c.

686{
689}

◆ IKsPin_fnConnect()

NTSTATUS NTAPI IKsPin_fnConnect ( IN IKsPin *  iface,
IN IKsTransport *  TransportIn,
OUT IKsTransport **  OutTransportIn,
OUT IKsTransport **  OutTransportOut,
IN KSPIN_DATAFLOW  DataFlow 
)

Definition at line 567 of file pin.c.

573{
576}

◆ IKsPin_fnDiscardKsIrp()

VOID NTAPI IKsPin_fnDiscardKsIrp ( IN IKsPin *  iface,
IN PIRP  Irp,
IN IKsTransport **  OutTransport 
)

Definition at line 556 of file pin.c.

560{
562}

◆ IKsPin_fnGenerateConnectionEvents()

VOID NTAPI IKsPin_fnGenerateConnectionEvents ( IN IKsPin *  iface,
IN ULONG  EventMask 
)

Definition at line 673 of file pin.c.

676{
678}

◆ IKsPin_fnGetProcessPin()

PKSPROCESSPIN NTAPI IKsPin_fnGetProcessPin ( IN IKsPin *  iface)

Definition at line 646 of file pin.c.

648{
650 return NULL;
651}

◆ IKsPin_fnGetStruct()

PKSPIN NTAPI IKsPin_fnGetStruct ( IN IKsPin *  iface)

Definition at line 637 of file pin.c.

639{
641 return NULL;
642}

◆ IKsPin_fnGetTransportConfig()

NTSTATUS NTAPI IKsPin_fnGetTransportConfig ( IN IKsPin *  iface,
IN struct KSPTRANSPORTCONFIG *  TransportConfig,
OUT IKsTransport **  OutTransportIn,
OUT IKsTransport **  OutTransportOut 
)

Definition at line 602 of file pin.c.

607{
610}

◆ IKsPin_fnQueryInterface()

NTSTATUS NTAPI IKsPin_fnQueryInterface ( IKsPin *  iface,
IN REFIID  refiid,
OUT PVOID Output 
)

Definition at line 483 of file pin.c.

487{
489 IKsPinImpl * This = (IKsPinImpl*)CONTAINING_RECORD(iface, IKsPinImpl, BasicHeader.OuterUnknown);
490
491 if (IsEqualGUIDAligned(refiid, &IID_IUnknown))
492 {
493 *Output = &This->BasicHeader.OuterUnknown;
495 return STATUS_SUCCESS;
496 }
497
498
499 if (This->BasicHeader.ClientAggregate)
500 {
501 /* using client aggregate */
502 Status = This->BasicHeader.ClientAggregate->lpVtbl->QueryInterface(This->BasicHeader.ClientAggregate, refiid, Output);
503
504 if (NT_SUCCESS(Status))
505 {
506 /* client aggregate supports interface */
507 return Status;
508 }
509 }
510
511 DPRINT("IKsPin_fnQueryInterface no interface\n");
513}
const GUID IID_IUnknown
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
long __cdecl _InterlockedIncrement(_Interlocked_operand_ long volatile *_Addend)
@ Output
Definition: arc.h:85
#define IsEqualGUIDAligned(guid1, guid2)
Definition: wdm.template.h:235

Referenced by IKsReferenceClock_fnQueryInterface().

◆ IKsPin_fnRelease()

ULONG NTAPI IKsPin_fnRelease ( IKsPin *  iface)

Definition at line 527 of file pin.c.

529{
530 IKsPinImpl * This = (IKsPinImpl*)CONTAINING_RECORD(iface, IKsPinImpl, BasicHeader.OuterUnknown);
531
533
534 if (This->ref == 0)
535 {
536 FreeItem(This);
537 return 0;
538 }
539 /* Return new reference count */
540 return This->ref;
541}
#define InterlockedDecrement
Definition: armddk.h:52
VOID FreeItem(IN PVOID Item)
Definition: misc.c:37

Referenced by IKsReferenceClock_fnRelease().

◆ IKsPin_fnResetTransportConfig()

NTSTATUS NTAPI IKsPin_fnResetTransportConfig ( IN IKsPin *  iface,
OUT IKsTransport **  OutTransportIn,
OUT IKsTransport **  OutTransportOut 
)

Definition at line 626 of file pin.c.

630{
633}

◆ IKsPin_fnSetDeviceState()

NTSTATUS NTAPI IKsPin_fnSetDeviceState ( IN IKsPin *  iface,
IN KSSTATE  OldState,
IN KSSTATE  NewState,
IN IKsTransport **  OutTransport 
)

Definition at line 580 of file pin.c.

585{
588}

◆ IKsPin_fnSetResetState()

VOID NTAPI IKsPin_fnSetResetState ( IN IKsPin *  iface,
IN KSRESET  ResetState,
OUT IKsTransport **  OutTransportOut 
)

Definition at line 592 of file pin.c.

596{
598}

◆ IKsPin_fnSetTransportConfig()

NTSTATUS NTAPI IKsPin_fnSetTransportConfig ( IN IKsPin *  iface,
IN struct KSPTRANSPORTCONFIG const TransportConfig,
OUT IKsTransport **  OutTransportIn,
OUT IKsTransport **  OutTransportOut 
)

Definition at line 614 of file pin.c.

619{
622}

◆ IKsPin_fnTransferKsIrp()

NTSTATUS NTAPI IKsPin_fnTransferKsIrp ( IN IKsPin *  iface,
IN PIRP  Irp,
IN IKsTransport **  OutTransport 
)

Definition at line 545 of file pin.c.

549{
552}

◆ IKsPin_PinAllocatorFramingPropertyHandler()

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

Definition at line 340 of file pin.c.

344{
345 PIO_STACK_LOCATION IoStack;
346 PKSIOBJECT_HEADER ObjectHeader;
348 ULONG Size;
350
351 /* get current irp stack */
353
354 /* sanity check */
355 ASSERT(IoStack->FileObject);
356 ASSERT(IoStack->FileObject->FsContext2);
357
358 /* get the object header */
359 ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
360
361 /* locate ks pin implementation from KSPIN offset */
363
364 /* setting allocator flags is not supported */
366
367 /* acquire control mutex */
368 KeWaitForSingleObject(This->BasicHeader.ControlMutex, Executive, KernelMode, FALSE, NULL);
369
370 if (This->Pin.Descriptor->AllocatorFraming)
371 {
372 /* calculate size */
373 Size = FIELD_OFFSET(KSALLOCATOR_FRAMING_EX, FramingItem[0]) + This->Pin.Descriptor->AllocatorFraming->CountItems * sizeof(KS_FRAMING_ITEM);
374
375 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength == 0)
376 {
377 /* no buffer */
379 }
380 else if (Size > IoStack->Parameters.DeviceIoControl.OutputBufferLength)
381 {
382 /* buffer too small */
384 }
385 else
386 {
387 /* copy buffer */
388 RtlMoveMemory(Data, This->Pin.Descriptor->AllocatorFraming, Size);
389 }
390
391 /* store size */
392 Irp->IoStatus.Information = Size;
393 }
394 else
395 {
396 /* no allocator framing details */
398 }
399
400 /* release processing mutex */
401 KeReleaseMutex(This->BasicHeader.ControlMutex, FALSE);
402
403 DPRINT("IKsPin_PinAllocatorFramingPropertyHandler Status %lx\n", Status);
404
405 return Status;
406}
#define FALSE
Definition: types.h:117
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KernelMode
Definition: asm.h:34
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
Definition: mutex.c:189
#define STATUS_NOT_FOUND
Definition: shellext.h:72
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
@ Executive
Definition: ketypes.h:415

◆ IKsPin_PinCentricWorker()

VOID NTAPI IKsPin_PinCentricWorker ( IN PVOID  Parameter)

Definition at line 1818 of file pin.c.

1820{
1823
1824 DPRINT("IKsPin_PinCentricWorker\n");
1825
1826 /* sanity checks */
1827 ASSERT(This);
1828 ASSERT(This->Pin.Descriptor);
1829 ASSERT(This->Pin.Descriptor->Dispatch);
1830 ASSERT(This->Pin.Descriptor->Dispatch->Process);
1832 ASSERT(!(This->Pin.Descriptor->Flags & KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING));
1833 ASSERT(!(This->Pin.Descriptor->Flags & KSPIN_FLAG_GENERATE_MAPPINGS));
1834
1835 do
1836 {
1837 DPRINT("IKsPin_PinCentricWorker calling Pin Process Routine\n");
1838
1839 Status = This->Pin.Descriptor->Dispatch->Process(&This->Pin);
1840 DPRINT("IKsPin_PinCentricWorker Status %lx, Offset %lu Length %lu\n", Status,
1841 This->LeadingEdgeStreamPointer.Offset,
1842 This->LeadingEdgeStreamPointer.Length);
1843 break;
1844
1845 }while(This->IrpCount);
1846}
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
_Inout_opt_ PVOID Parameter
Definition: rtltypes.h:336

Referenced by KspCreatePin().

◆ IKsPin_PinDataFormatPropertyHandler()

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

Definition at line 410 of file pin.c.

414{
415 PIO_STACK_LOCATION IoStack;
416 PKSIOBJECT_HEADER ObjectHeader;
419
420 /* get current irp stack */
422
423 DPRINT("IKsPin_PinDataFormatPropertyHandler\n");
424
425 /* sanity check */
426 ASSERT(IoStack->FileObject);
427 ASSERT(IoStack->FileObject->FsContext2);
428
429 /* get the object header */
430 ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
431
432 /* locate ks pin implementation from KSPIN offset */
434
435 /* acquire control mutex */
436 KeWaitForSingleObject(This->BasicHeader.ControlMutex, Executive, KernelMode, FALSE, NULL);
437
438 if (Request->Flags & KSPROPERTY_TYPE_GET)
439 {
440 if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < This->Pin.ConnectionFormat->FormatSize)
441 {
442 /* buffer too small */
443 Irp->IoStatus.Information = This->Pin.ConnectionFormat->FormatSize;
445 }
446 else
447 {
448 /* copy format */
449 RtlMoveMemory(Data, This->Pin.ConnectionFormat, This->Pin.ConnectionFormat->FormatSize);
450 }
451 }
452 else if (Request->Flags & KSPROPERTY_TYPE_SET)
453 {
454 /* set format */
455 if (This->Pin.Descriptor->Flags & KSPIN_FLAG_FIXED_FORMAT)
456 {
457 /* format cannot be changed */
459 }
460 else
461 {
462 /* FIXME check if the format is supported */
463 Status = _KsEdit(This->Pin.Bag, (PVOID*)&This->Pin.ConnectionFormat, IoStack->Parameters.DeviceIoControl.OutputBufferLength, This->Pin.ConnectionFormat->FormatSize, 0);
464
465 if (NT_SUCCESS(Status))
466 {
467 /* store new format */
468 RtlMoveMemory(This->Pin.ConnectionFormat, Data, IoStack->Parameters.DeviceIoControl.OutputBufferLength);
469 }
470 }
471 }
472
473 /* release processing mutex */
474 KeReleaseMutex(This->BasicHeader.ControlMutex, FALSE);
475
476 DPRINT("IKsPin_PinDataFormatPropertyHandler Status %lx\n", Status);
477
478 return Status;
479}
KSDDKAPI NTSTATUS NTAPI _KsEdit(IN KSOBJECT_BAG ObjectBag, IN OUT PVOID *PointerToPointerToItem, IN ULONG NewSize, IN ULONG OldSize, IN ULONG Tag)
Definition: bag.c:358
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138

◆ IKsPin_PinMasterClock()

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

Definition at line 130 of file pin.c.

134{
135 PIO_STACK_LOCATION IoStack;
136 PKSIOBJECT_HEADER ObjectHeader;
144
145 /* get current irp stack */
147
148 DPRINT("IKsPin_PinMasterClock\n");
149
150 /* sanity check */
151 ASSERT(IoStack->FileObject);
152 ASSERT(IoStack->FileObject->FsContext2);
153
154 /* get the object header */
155 ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
156
157 /* sanity check */
158 ASSERT(ObjectHeader);
159
160 /* locate ks pin implementation from KSPIN offset */
162
163 /* sanity check */
164 ASSERT(This);
165
167
168 if (Request->Flags & KSPROPERTY_TYPE_GET)
169 {
170 if (This->Pin.Descriptor->PinDescriptor.Communication != KSPIN_COMMUNICATION_NONE &&
171 This->Pin.Descriptor->Dispatch &&
172 (This->Pin.Descriptor->Flags & KSPIN_FLAG_IMPLEMENT_CLOCK))
173 {
174 *Handle = NULL;
176 }
177 else
178 {
179 /* no clock available */
181 }
182 }
183 else if (Request->Flags & KSPROPERTY_TYPE_SET)
184 {
185 if (This->Pin.ClientState != KSSTATE_STOP)
186 {
187 /* can only set in stopped state */
189 }
190 else
191 {
192 if (*Handle)
193 {
195
197
198 DPRINT("IKsPin_PinMasterClock ObReferenceObjectByHandle %lx\n", Status);
199 if (NT_SUCCESS(Status))
200 {
202 Property.Id = KSPROPERTY_CLOCK_FUNCTIONTABLE;
204
205 Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY, &Property, sizeof(KSPROPERTY), &This->ClockTable, sizeof(KSCLOCK_FUNCTIONTABLE), &BytesReturned);
206
207 DPRINT("IKsPin_PinMasterClock KSPROPERTY_CLOCK_FUNCTIONTABLE %lx\n", Status);
208
209 if (NT_SUCCESS(Status))
210 {
211 This->ClockFileObject = FileObject;
212 }
213 else
214 {
216 }
217 }
218 }
219 else
220 {
221 /* zeroing clock handle */
222 RtlZeroMemory(&This->ClockTable, sizeof(KSCLOCK_FUNCTIONTABLE));
224 if (This->ClockFileObject)
225 {
226 FileObject = This->ClockFileObject;
227 This->ClockFileObject = NULL;
228
229 ObDereferenceObject(This->ClockFileObject);
230 }
231 }
232 }
233 }
234
235 DPRINT("IKsPin_PinMasterClock Status %lx\n", Status);
236 return Status;
237}
KSDDKAPI NTSTATUS NTAPI KsSynchronousIoControlDevice(IN PFILE_OBJECT FileObject, IN KPROCESSOR_MODE RequestorMode, IN ULONG IoControl, IN PVOID InBuffer, IN ULONG InSize, OUT PVOID OutBuffer, IN ULONG OutSize, OUT PULONG BytesReturned)
Definition: api.c:1099
const GUID KSPROPSETID_Clock
Definition: pin.c:115
#define ExGetPreviousMode
Definition: ex.h:140
ULONG Handle
Definition: gdb_input.c:15
_In_ ULONG Mode
Definition: hubbusif.h:303
POBJECT_TYPE IoFileObjectType
Definition: iomgr.c:36
@ KSSTATE_STOP
Definition: ks.h:1215
#define SYNCHRONIZE
Definition: nt_native.h:61
#define DIRECTORY_QUERY
Definition: nt_native.h:1254
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:494
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesReturned
Definition: wdfiotarget.h:1052
* PFILE_OBJECT
Definition: iotypes.h:1998
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
#define ObDereferenceObject
Definition: obfuncs.h:203

◆ IKsPin_PinPipeId()

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

Definition at line 243 of file pin.c.

247{
250}

◆ IKsPin_PinStatePropertyHandler()

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

Definition at line 255 of file pin.c.

259{
260 PIO_STACK_LOCATION IoStack;
261 PKSIOBJECT_HEADER ObjectHeader;
264 KSSTATE OldState;
265 PKSSTATE NewState;
266
267 /* get current irp stack */
269
270 DPRINT("IKsPin_PinStatePropertyHandler\n");
271
272 /* sanity check */
273 ASSERT(IoStack->FileObject);
274 ASSERT(IoStack->FileObject->FsContext2);
275
276 /* get the object header */
277 ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
278
279 /* locate ks pin implementation from KSPIN offset */
281
282 /* acquire control mutex */
283 KeWaitForSingleObject(This->BasicHeader.ControlMutex, Executive, KernelMode, FALSE, NULL);
284
285 /* grab state */
286 NewState = (PKSSTATE)Data;
287
288 if (Request->Flags & KSPROPERTY_TYPE_GET)
289 {
290 *NewState = This->Pin.DeviceState;
291 Irp->IoStatus.Information = sizeof(KSSTATE);
292 }
293 else if (Request->Flags & KSPROPERTY_TYPE_SET)
294 {
295 if (This->Pin.Descriptor->Dispatch->SetDeviceState)
296 {
297 /* backup old state */
298 OldState = This->Pin.ClientState;
299
300 /* set new state */
301 This->Pin.ClientState = *NewState;
302 This->Pin.DeviceState = KSSTATE_RUN;
303
304 /* check if it supported */
305 Status = This->Pin.Descriptor->Dispatch->SetDeviceState(&This->Pin, *NewState, OldState);
306
307 DPRINT("IKsPin_PinStatePropertyHandler NewState %lu Result %lx\n", *NewState, Status);
308
309 if (!NT_SUCCESS(Status))
310 {
311 /* revert to old state */
312 This->Pin.ClientState = OldState;
313 This->Pin.DeviceState = OldState;
314 DPRINT("IKsPin_PinStatePropertyHandler failed to set state %lx Result %lx\n", *NewState, Status);
316 }
317 else
318 {
319 /* update device state */
320 This->Pin.DeviceState = *NewState;
321 }
322 }
323 else
324 {
325 /* just set new state */
326 This->Pin.DeviceState = *NewState;
327 This->Pin.ClientState = *NewState;
328 }
329 }
330
331 /* release processing mutex */
332 KeReleaseMutex(This->BasicHeader.ControlMutex, FALSE);
333
334 DPRINT("IKsPin_PinStatePropertyHandler Status %lx\n", Status);
335 return Status;
336}
NTSYSAPI void WINAPI DbgBreakPoint(void)
enum KSSTATE * PKSSTATE
KSSTATE
Definition: ks.h:1214
@ KSSTATE_RUN
Definition: ks.h:1218

◆ IKsPin_PinStreamAllocator()

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

Definition at line 119 of file pin.c.

123{
126}

◆ IKsPin_PrepareStreamHeader()

NTSTATUS IKsPin_PrepareStreamHeader ( IN IKsPinImpl This,
IN PKSISTREAM_POINTER  StreamPointer 
)

Definition at line 1297 of file pin.c.

1300{
1302 ULONG Length;
1303
1304 /* grab new irp */
1305 StreamPointer->Irp = KsRemoveIrpFromCancelableQueue(&This->IrpList, &This->IrpListLock, KsListEntryHead, KsAcquireAndRemoveOnlySingleItem);
1306 if (!StreamPointer->Irp)
1307 {
1308 /* run out of mappings */
1309 DPRINT("OutOfMappings\n");
1311 }
1312
1313 InterlockedDecrement(&This->IrpCount);
1314 KsDecrementCountedWorker(This->PinWorker);
1315
1316 /* get stream header */
1317 if (StreamPointer->Irp->RequestorMode == UserMode)
1318 Header = (PKSSTREAM_HEADER)StreamPointer->Irp->AssociatedIrp.SystemBuffer;
1319 else
1320 Header = (PKSSTREAM_HEADER)StreamPointer->Irp->UserBuffer;
1321
1322 /* initialize stream pointer */
1323 StreamPointer->Callback = NULL;
1324 StreamPointer->Length = max(Header->DataUsed, Header->FrameExtent);
1325 StreamPointer->Next = NULL;
1326 StreamPointer->Offset = 0;
1327 StreamPointer->Pin = &This->Pin;
1328 StreamPointer->Data = Header->Data;
1329
1330 StreamPointer->StreamPointer.Context = NULL;
1331 StreamPointer->StreamPointer.Pin = &This->Pin;
1332 StreamPointer->StreamPointer.StreamHeader = Header;
1333
1334 if (This->Pin.Descriptor->PinDescriptor.DataFlow == KSPIN_DATAFLOW_IN)
1335 StreamPointer->StreamPointer.Offset = &StreamPointer->StreamPointer.OffsetIn;
1336 else
1337 StreamPointer->StreamPointer.Offset = &StreamPointer->StreamPointer.OffsetOut;
1338
1339#ifndef _WIN64
1340 StreamPointer->StreamPointer.Offset->Alignment = 0;
1341#endif
1342 StreamPointer->StreamPointer.Offset->Count = 0;
1343 StreamPointer->StreamPointer.Offset->Data = NULL;
1344 StreamPointer->StreamPointer.Offset->Remaining = 0;
1345
1346 ASSERT(StreamPointer->StreamPointer.Offset->Remaining == 0);
1347
1348 //StreamPointer->Offset += StreamPointer->StreamPointer.Offset->Count;
1349
1350 ASSERT(StreamPointer->Length > StreamPointer->Offset);
1351 ASSERT(StreamPointer->StreamPointer.StreamHeader);
1352 ASSERT(This->FrameSize);
1353
1354 /* calculate length */
1355 /* TODO split into frames */
1356 Length = StreamPointer->Length;
1357
1358 /* FIXME */
1359 ASSERT(Length);
1360
1361#ifndef _WIN64
1362 StreamPointer->StreamPointer.Offset->Alignment = 0;
1363#endif
1364 StreamPointer->StreamPointer.Context = NULL;
1365 StreamPointer->StreamPointer.Pin = &This->Pin;
1366 StreamPointer->StreamPointer.Offset->Count = Length;
1367 StreamPointer->StreamPointer.Offset->Remaining = Length;
1368 StreamPointer->StreamPointer.Offset->Data = (PVOID)((ULONG_PTR)StreamPointer->Data + StreamPointer->Offset);
1369 StreamPointer->StreamPointer.StreamHeader->FrameExtent = Length;
1370 if (StreamPointer->StreamPointer.StreamHeader->DataUsed)
1371 StreamPointer->StreamPointer.StreamHeader->DataUsed = Length;
1372
1373 StreamPointer->StreamPointer.StreamHeader->Data = StreamPointer->StreamPointer.Offset->Data;
1374
1375 return STATUS_SUCCESS;
1376}
KSDDKAPI PIRP NTAPI KsRemoveIrpFromCancelableQueue(IN OUT PLIST_ENTRY QueueHead, IN PKSPIN_LOCK SpinLock, IN KSLIST_ENTRY_LOCATION ListLocation, IN KSIRP_REMOVAL_OPERATION RemovalOperation)
Definition: irp.c:1408
@ KsListEntryHead
Definition: ks.h:1263
@ KSPIN_DATAFLOW_IN
Definition: ks.h:1249
@ KsAcquireAndRemoveOnlySingleItem
Definition: ks.h:1276
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:70
#define max(a, b)
Definition: svc.c:63
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:65
KSDDKAPI ULONG NTAPI KsDecrementCountedWorker(IN PKSWORKER Worker)
Definition: worker.c:198

Referenced by KsPinGetLeadingEdgeStreamPointer(), KsStreamPointerAdvanceOffsets(), and KsStreamPointerClone().

◆ IKsReferenceClock_fnAddRef()

ULONG NTAPI IKsReferenceClock_fnAddRef ( IKsReferenceClock *  iface)

Definition at line 729 of file pin.c.

731{
732 IKsPinImpl * This = (IKsPinImpl*)CONTAINING_RECORD(iface, IKsPinImpl, lpVtblReferenceClock);
733
734 return IKsPin_fnAddRef((IKsPin*)&This->BasicHeader.OuterUnknown);
735}
ULONG NTAPI IKsPin_fnAddRef(IKsPin *iface)
Definition: pin.c:517

◆ IKsReferenceClock_fnGetCorrelatedPhysicalTime()

LONGLONG NTAPI IKsReferenceClock_fnGetCorrelatedPhysicalTime ( IKsReferenceClock *  iface,
OUT PLONGLONG  SystemTime 
)

Definition at line 823 of file pin.c.

826{
828
829 IKsPinImpl * This = (IKsPinImpl*)CONTAINING_RECORD(iface, IKsPinImpl, lpVtblReferenceClock);
830
831 DPRINT1("IKsReferenceClock_fnGetCorrelatedPhysicalTime\n");
832
833 if (!This->ClockFileObject || !This->ClockTable.GetCorrelatedPhysicalTime)
834 {
835 Result = 0;
836 }
837 else
838 {
839 Result = This->ClockTable.GetCorrelatedPhysicalTime(This->ClockFileObject, SystemTime);
840 }
841
842 return Result;
843}
int64_t LONGLONG
Definition: typedefs.h:68
_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

◆ IKsReferenceClock_fnGetCorrelatedTime()

LONGLONG NTAPI IKsReferenceClock_fnGetCorrelatedTime ( IKsReferenceClock *  iface,
OUT PLONGLONG  SystemTime 
)

Definition at line 798 of file pin.c.

801{
803
804 IKsPinImpl * This = (IKsPinImpl*)CONTAINING_RECORD(iface, IKsPinImpl, lpVtblReferenceClock);
805
806 DPRINT1("IKsReferenceClock_fnGetCorrelatedTime\n");
807
808 if (!This->ClockFileObject || !This->ClockTable.GetCorrelatedTime)
809 {
810 Result = 0;
811 }
812 else
813 {
814 Result = This->ClockTable.GetCorrelatedTime(This->ClockFileObject, SystemTime);
815 }
816
817 return Result;
818}

◆ IKsReferenceClock_fnGetPhysicalTime()

LONGLONG NTAPI IKsReferenceClock_fnGetPhysicalTime ( IKsReferenceClock *  iface)

Definition at line 773 of file pin.c.

775{
777
778 IKsPinImpl * This = (IKsPinImpl*)CONTAINING_RECORD(iface, IKsPinImpl, lpVtblReferenceClock);
779
780 DPRINT1("IKsReferenceClock_fnGetPhysicalTime\n");
781
782
783 if (!This->ClockFileObject || !This->ClockTable.GetPhysicalTime)
784 {
785 Result = 0;
786 }
787 else
788 {
789 Result = This->ClockTable.GetPhysicalTime(This->ClockFileObject);
790 }
791
792 return Result;
793}

◆ IKsReferenceClock_fnGetResolution()

NTSTATUS NTAPI IKsReferenceClock_fnGetResolution ( IKsReferenceClock *  iface,
OUT PKSRESOLUTION  Resolution 
)

Definition at line 847 of file pin.c.

850{
853
854 IKsPinImpl * This = (IKsPinImpl*)CONTAINING_RECORD(iface, IKsPinImpl, lpVtblReferenceClock);
855
856 DPRINT1("IKsReferenceClock_fnGetResolution\n");
857
858 if (!This->ClockFileObject)
859 {
860 Resolution->Error = 0;
861 Resolution->Granularity = 1;
862 DPRINT1("IKsReferenceClock_fnGetResolution Using HACK\n");
863 return STATUS_SUCCESS;
864 }
865
866
867 if (!This->ClockFileObject)
869
870
874
876
877}
@ KSPROPERTY_CLOCK_RESOLUTION
Definition: ks.h:322

◆ IKsReferenceClock_fnGetState()

NTSTATUS NTAPI IKsReferenceClock_fnGetState ( IKsReferenceClock *  iface,
OUT PKSSTATE  State 
)

Definition at line 881 of file pin.c.

884{
887
888 IKsPinImpl * This = (IKsPinImpl*)CONTAINING_RECORD(iface, IKsPinImpl, lpVtblReferenceClock);
889
890 DPRINT1("IKsReferenceClock_fnGetState\n");
891
892 if (!This->ClockFileObject)
893 {
894 *State = This->Pin.ClientState;
895 DPRINT1("IKsReferenceClock_fnGetState Using HACK\n");
896 return STATUS_SUCCESS;
897 }
898
899
900 if (!This->ClockFileObject)
902
903
907
909}

◆ IKsReferenceClock_fnGetTime()

LONGLONG NTAPI IKsReferenceClock_fnGetTime ( IKsReferenceClock *  iface)

Definition at line 749 of file pin.c.

751{
753
754 IKsPinImpl * This = (IKsPinImpl*)CONTAINING_RECORD(iface, IKsPinImpl, lpVtblReferenceClock);
755
756
757 DPRINT1("IKsReferenceClock_fnGetTime\n");
758
759 if (!This->ClockFileObject || !This->ClockTable.GetTime)
760 {
761 Result = 0;
762 }
763 else
764 {
765 Result = This->ClockTable.GetTime(This->ClockFileObject);
766 }
767
768 return Result;
769}

◆ IKsReferenceClock_fnQueryInterface()

NTSTATUS NTAPI IKsReferenceClock_fnQueryInterface ( IKsReferenceClock *  iface,
IN REFIID  refiid,
OUT PVOID Output 
)

Definition at line 717 of file pin.c.

721{
722 IKsPinImpl * This = (IKsPinImpl*)CONTAINING_RECORD(iface, IKsPinImpl, lpVtblReferenceClock);
723
724 return IKsPin_fnQueryInterface((IKsPin*)&This->BasicHeader.OuterUnknown, refiid, Output);
725}
NTSTATUS NTAPI IKsPin_fnQueryInterface(IKsPin *iface, IN REFIID refiid, OUT PVOID *Output)
Definition: pin.c:483

◆ IKsReferenceClock_fnRelease()

ULONG NTAPI IKsReferenceClock_fnRelease ( IKsReferenceClock *  iface)

Definition at line 739 of file pin.c.

741{
742 IKsPinImpl * This = (IKsPinImpl*)CONTAINING_RECORD(iface, IKsPinImpl, lpVtblReferenceClock);
743
744 return IKsPin_fnRelease((IKsPin*)&This->BasicHeader.OuterUnknown);
745}
ULONG NTAPI IKsPin_fnRelease(IKsPin *iface)
Definition: pin.c:527

◆ KsGetPinFromIrp()

KSDDKAPI PKSPIN NTAPI KsGetPinFromIrp ( IN PIRP  Irp)

Definition at line 1211 of file pin.c.

1213{
1214 PKSIOBJECT_HEADER ObjectHeader;
1215 PKSPIN Pin;
1218
1219 DPRINT("KsGetPinFromIrp\n");
1220
1221 /* get object header */
1222 ObjectHeader = (PKSIOBJECT_HEADER)IoStack->FileObject->FsContext2;
1223
1224 if (!ObjectHeader)
1225 return NULL;
1226
1227 Pin = (PKSPIN)ObjectHeader->ObjectType;
1229
1230 /* sanity check */
1231 ASSERT(Header->Type == KsObjectTypePin);
1232
1233 /* return object type */
1234 return Pin;
1235}
#define ULONG_PTR
Definition: config.h:101
if(dx< 0)
Definition: linetemp.h:194

Referenced by AudioPositionPropertyHandler(), and BdaPropertyGetPinControl().

◆ KspCreatePin()

NTSTATUS KspCreatePin ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PKSDEVICE  KsDevice,
IN IKsFilterFactory *  FilterFactory,
IN IKsFilter *  Filter,
IN PKSPIN_CONNECT  Connect,
IN KSPIN_DESCRIPTOR_EX *  Descriptor 
)

Definition at line 2283 of file pin.c.

2291{
2292 IKsPinImpl * This;
2293 PIO_STACK_LOCATION IoStack;
2294 IKsDevice * Device;
2295 PDEVICE_EXTENSION DeviceExtension;
2296 PKSOBJECT_CREATE_ITEM CreateItem;
2299 PKSBASIC_HEADER BasicHeader;
2300 ULONG Index;
2301 ULONG FrameSize = 0;
2302 ULONG NumFrames = 0;
2303 KSAUTOMATION_TABLE AutomationTable;
2304
2305 /* sanity checks */
2306 ASSERT(Descriptor->Dispatch);
2307
2308 DPRINT("KspCreatePin PinId %lu Flags %x\n", Connect->PinId, Descriptor->Flags);
2309
2310//Output Pin: KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY
2311//Input Pin: KSPIN_FLAG_FIXED_FORMAT|KSPIN_FLAG_DO_NOT_USE_STANDARD_TRANSPORT|KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING
2312
2313 DPRINT("KspCreatePin Dataflow %lu\n", Descriptor->PinDescriptor.DataFlow);
2314 DPRINT("KspCreatePin Communication %lu\n", Descriptor->PinDescriptor.Communication);
2315 if (Descriptor->AllocatorFraming)
2316 {
2317 DPRINT("KspCreatePin CountItems %lu\n", Descriptor->AllocatorFraming->CountItems);
2318 DPRINT("KspCreatePin PinFlags %lx\n", Descriptor->AllocatorFraming->PinFlags);
2319 DPRINT("KspCreatePin OutputCompression RatioNumerator %lu RatioDenominator %lu RatioConstantMargin %lu\n", Descriptor->AllocatorFraming->OutputCompression.RatioNumerator,
2320 Descriptor->AllocatorFraming->OutputCompression.RatioDenominator, Descriptor->AllocatorFraming->OutputCompression.RatioConstantMargin);
2321 DPRINT("KspCreatePin PinWeight %lx\n", Descriptor->AllocatorFraming->PinWeight);
2322
2323 for(Index = 0; Index < Descriptor->AllocatorFraming->CountItems; Index++)
2324 {
2325 DPRINT("KspCreatePin Index %lu MemoryFlags %lx\n", Index, Descriptor->AllocatorFraming->FramingItem[Index].MemoryFlags);
2326 DPRINT("KspCreatePin Index %lu BusFlags %lx\n", Index, Descriptor->AllocatorFraming->FramingItem[Index].BusFlags);
2327 DPRINT("KspCreatePin Index %lu Flags %lx\n", Index, Descriptor->AllocatorFraming->FramingItem[Index].Flags);
2328 DPRINT("KspCreatePin Index %lu Frames %lu\n", Index, Descriptor->AllocatorFraming->FramingItem[Index].Frames);
2329 DPRINT("KspCreatePin Index %lu FileAlignment %lx\n", Index, Descriptor->AllocatorFraming->FramingItem[Index].FileAlignment);
2330 DPRINT("KspCreatePin Index %lu MemoryTypeWeight %lx\n", Index, Descriptor->AllocatorFraming->FramingItem[Index].MemoryTypeWeight);
2331 DPRINT("KspCreatePin Index %lu PhysicalRange MinFrameSize %lu MaxFrameSize %lu Stepping %lu\n", Index, Descriptor->AllocatorFraming->FramingItem[Index].PhysicalRange.MinFrameSize,
2332 Descriptor->AllocatorFraming->FramingItem[Index].PhysicalRange.MaxFrameSize,
2333 Descriptor->AllocatorFraming->FramingItem[Index].PhysicalRange.Stepping);
2334
2335 DPRINT("KspCreatePin Index %lu FramingRange MinFrameSize %lu MaxFrameSize %lu Stepping %lu InPlaceWeight %lu NotInPlaceWeight %lu\n",
2336 Index,
2337 Descriptor->AllocatorFraming->FramingItem[Index].FramingRange.Range.MinFrameSize,
2338 Descriptor->AllocatorFraming->FramingItem[Index].FramingRange.Range.MaxFrameSize,
2339 Descriptor->AllocatorFraming->FramingItem[Index].FramingRange.Range.Stepping,
2340 Descriptor->AllocatorFraming->FramingItem[Index].FramingRange.InPlaceWeight,
2341 Descriptor->AllocatorFraming->FramingItem[Index].FramingRange.NotInPlaceWeight);
2342
2343 FrameSize = Descriptor->AllocatorFraming->FramingItem[Index].FramingRange.Range.MaxFrameSize;
2344 NumFrames = Descriptor->AllocatorFraming->FramingItem[Index].Frames;
2345 }
2346 }
2347
2348 for (Index = 0; Index < Descriptor->PinDescriptor.DataRangesCount; Index++)
2349 {
2351 /* convert the guid to string */
2352 RtlStringFromGUID(&Descriptor->PinDescriptor.DataRanges[Index]->MajorFormat, &GuidString);
2353 DPRINT("Index %lu MajorFormat %S\n", Index, GuidString.Buffer);
2354 RtlStringFromGUID(&Descriptor->PinDescriptor.DataRanges[Index]->SubFormat, &GuidString);
2355 DPRINT("Index %lu SubFormat %S\n", Index, GuidString.Buffer);
2356 RtlStringFromGUID(&Descriptor->PinDescriptor.DataRanges[Index]->Specifier, &GuidString);
2357 DPRINT("Index %lu Specifier %S\n", Index, GuidString.Buffer);
2358 RtlStringFromGUID(&Descriptor->PinDescriptor.DataRanges[Index]->Specifier, &GuidString);
2359 DPRINT("Index %lu FormatSize %lu Flags %lu SampleSize %lu Reserved %lu KSDATAFORMAT %lu\n", Index,
2360 Descriptor->PinDescriptor.DataRanges[Index]->FormatSize, Descriptor->PinDescriptor.DataRanges[Index]->Flags, Descriptor->PinDescriptor.DataRanges[Index]->SampleSize, Descriptor->PinDescriptor.DataRanges[Index]->Reserved, sizeof(KSDATAFORMAT));
2361
2362 if (IsEqualGUIDAligned(&Descriptor->PinDescriptor.DataRanges[Index]->SubFormat, &KSDATAFORMAT_SUBTYPE_BDA_MPEG2_TRANSPORT))
2363 {
2364#if !defined(NDEBUG)
2365 PKS_DATARANGE_BDA_TRANSPORT Transport = (PKS_DATARANGE_BDA_TRANSPORT)&Descriptor->PinDescriptor.DataRanges[Index];
2366 DPRINT("KSDATAFORMAT_SUBTYPE_BDA_MPEG2_TRANSPORT AvgTimePerFrame %I64u ulcbPhyiscalFrame %lu ulcbPhyiscalFrameAlignment %lu ulcbPhyiscalPacket %lu\n", Transport->BdaTransportInfo.AvgTimePerFrame, Transport->BdaTransportInfo.ulcbPhyiscalFrame,
2368#endif
2369 }
2370 }
2371 if (!FrameSize)
2372 {
2373 /* default to 50 * 188 (MPEG2 TS packet size) */
2374 FrameSize = 9400;
2375 }
2376
2377 if (!NumFrames)
2378 {
2379 NumFrames = 8;
2380 }
2381
2382 /* get current irp stack */
2384
2385 /* get device extension */
2386 DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension;
2387
2388 /* get ks device interface */
2389 Device = (IKsDevice*)&DeviceExtension->DeviceHeader->BasicHeader.OuterUnknown;
2390
2391 /* first allocate pin ctx */
2393 if (!This)
2394 {
2395 /* not enough memory */
2397 }
2398
2399 /* allocate create item */
2400 CreateItem = AllocateItem(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM) * 3);
2401 if (!CreateItem)
2402 {
2403 /* not enough memory */
2404 FreeItem(This);
2405 DPRINT("KspCreatePin OutOfMemory\n");
2407 }
2408
2409 /* initialize basic header */
2410 This->BasicHeader.KsDevice = KsDevice;
2411 This->BasicHeader.Type = KsObjectTypePin;
2412 This->BasicHeader.Parent.KsFilter = Filter->lpVtbl->GetStruct(Filter);
2413 This->BasicHeader.OuterUnknown = (PUNKNOWN)&vt_IKsPin;
2414 InitializeListHead(&This->BasicHeader.EventList);
2415 KeInitializeSpinLock(&This->BasicHeader.EventListLock);
2416
2417 ASSERT(This->BasicHeader.Parent.KsFilter);
2418
2419 BasicHeader = (PKSBASIC_HEADER)((ULONG_PTR)This->BasicHeader.Parent.KsFilter - sizeof(KSBASIC_HEADER));
2420
2421 This->BasicHeader.ControlMutex = BasicHeader->ControlMutex;
2422 ASSERT(This->BasicHeader.ControlMutex);
2423
2424 InitializeListHead(&This->BasicHeader.EventList);
2425 KeInitializeSpinLock(&This->BasicHeader.EventListLock);
2426
2427 /* initialize pin */
2428 This->FrameSize = FrameSize;
2429 This->NumFrames = NumFrames;
2430 This->lpVtblReferenceClock = &vt_ReferenceClock;
2431 This->ref = 1;
2432 This->FileObject = IoStack->FileObject;
2433 This->Filter = Filter;
2434 KeInitializeMutex(&This->ProcessingMutex, 0);
2435 InitializeListHead(&This->IrpList);
2436 KeInitializeSpinLock(&This->IrpListLock);
2437
2438 /* allocate object bag */
2439 This->Pin.Bag = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_BAG));
2440 if (!This->Pin.Bag)
2441 {
2442 /* not enough memory */
2443 FreeItem(This);
2444 FreeItem(CreateItem);
2446 }
2447
2448 /* initialize object bag */
2449 Device->lpVtbl->InitializeObjectBag(Device, This->Pin.Bag, NULL);
2450
2451 /* allocate pin descriptor */
2452 This->Pin.Descriptor = AllocateItem(NonPagedPool, sizeof(KSPIN_DESCRIPTOR_EX));
2453 if (!This->Pin.Descriptor)
2454 {
2455 /* not enough memory */
2456 KsFreeObjectBag(This->Pin.Bag);
2457 FreeItem(This);
2458 FreeItem(CreateItem);
2460 }
2461
2462 /* copy pin descriptor */
2463 RtlMoveMemory((PVOID)This->Pin.Descriptor, Descriptor, sizeof(KSPIN_DESCRIPTOR_EX));
2464
2465 /* initialize automation table */
2466 RtlZeroMemory(&AutomationTable, sizeof(KSAUTOMATION_TABLE));
2467
2468 AutomationTable.PropertyItemSize = sizeof(KSPROPERTY_ITEM);
2469 AutomationTable.PropertySets = PinPropertySet;
2470 AutomationTable.PropertySetsCount = sizeof(PinPropertySet) / sizeof(KSPROPERTY_SET);
2471
2472 /* merge in pin property sets */
2473 Status = KsMergeAutomationTables((PKSAUTOMATION_TABLE*)&This->Pin.Descriptor->AutomationTable, (PKSAUTOMATION_TABLE)Descriptor->AutomationTable, &AutomationTable, This->Pin.Bag);
2474
2475 if (!NT_SUCCESS(Status))
2476 {
2477 /* not enough memory */
2478 KsFreeObjectBag(This->Pin.Bag);
2479 FreeItem(This);
2480 FreeItem(CreateItem);
2481 return Status;
2482 }
2483
2484 /* get format */
2486
2487 /* initialize pin descriptor */
2488 This->Pin.Context = NULL;
2489 This->Pin.Id = Connect->PinId;
2490 This->Pin.Communication = Descriptor->PinDescriptor.Communication;
2491 This->Pin.ConnectionIsExternal = FALSE; //FIXME
2492 RtlMoveMemory(&This->Pin.ConnectionInterface, &Connect->Interface, sizeof(KSPIN_INTERFACE));
2493 RtlMoveMemory(&This->Pin.ConnectionMedium, &Connect->Medium, sizeof(KSPIN_MEDIUM));
2494 RtlMoveMemory(&This->Pin.ConnectionPriority, &Connect->Priority, sizeof(KSPRIORITY));
2495
2496 /* allocate format */
2497 Status = _KsEdit(This->Pin.Bag, (PVOID*)&This->Pin.ConnectionFormat, DataFormat->FormatSize, DataFormat->FormatSize, 0);
2498 if (!NT_SUCCESS(Status))
2499 {
2500 /* failed to allocate format */
2502 FreeItem(This);
2503 FreeItem(CreateItem);
2505 }
2506
2507 /* copy format */
2508 RtlMoveMemory((PVOID)This->Pin.ConnectionFormat, DataFormat, DataFormat->FormatSize);
2509
2510 This->Pin.AttributeList = NULL; //FIXME
2511 This->Pin.StreamHeaderSize = sizeof(KSSTREAM_HEADER);
2512 This->Pin.DataFlow = Descriptor->PinDescriptor.DataFlow;
2513 This->Pin.DeviceState = KSSTATE_STOP;
2514 This->Pin.ResetState = KSRESET_END;
2515 This->Pin.ClientState = KSSTATE_STOP;
2516
2517 /* initialize allocator create item */
2518 CreateItem[0].Context = (PVOID)&This->Pin;
2519 CreateItem[0].Create = IKsPin_DispatchCreateAllocator;
2520 CreateItem[0].Flags = KSCREATE_ITEM_FREEONSTOP;
2521 RtlInitUnicodeString(&CreateItem[0].ObjectClass, KSSTRING_Allocator);
2522
2523 /* initialize clock create item */
2524 CreateItem[1].Context = (PVOID)&This->Pin;
2525 CreateItem[1].Create = IKsPin_DispatchCreateClock;
2526 CreateItem[1].Flags = KSCREATE_ITEM_FREEONSTOP;
2527 RtlInitUnicodeString(&CreateItem[1].ObjectClass, KSSTRING_Clock);
2528
2529 /* initialize topology node create item */
2530 CreateItem[2].Context = (PVOID)&This->Pin;
2531 CreateItem[2].Create = IKsPin_DispatchCreateNode;
2532 CreateItem[2].Flags = KSCREATE_ITEM_FREEONSTOP;
2533 RtlInitUnicodeString(&CreateItem[2].ObjectClass, KSSTRING_TopologyNode);
2534
2535 /* now allocate object header */
2536 Status = KsAllocateObjectHeader((KSOBJECT_HEADER*)&This->ObjectHeader, 3, CreateItem, Irp, &PinDispatchTable);
2537 if (!NT_SUCCESS(Status))
2538 {
2539 /* failed to create object header */
2540 DPRINT("KspCreatePin KsAllocateObjectHeader failed %lx\n", Status);
2542 FreeItem(This);
2543 FreeItem(CreateItem);
2544
2545 /* return failure code */
2546 return Status;
2547 }
2548
2549 /* add extra info to object header */
2550 This->ObjectHeader->Type = KsObjectTypePin;
2551 This->ObjectHeader->Unknown = (PUNKNOWN)&This->BasicHeader.OuterUnknown;
2552 This->ObjectHeader->ObjectType = (PVOID)&This->Pin;
2553
2554 if (!Descriptor->Dispatch || !Descriptor->Dispatch->Process)
2555 {
2556 /* the pin is part of filter-centric processing filter
2557 * add process pin to filter
2558 */
2559 This->ProcessPin.BytesAvailable = 0;
2560 This->ProcessPin.BytesUsed = 0;
2561 This->ProcessPin.CopySource = NULL;
2562 This->ProcessPin.Data = NULL;
2563 This->ProcessPin.DelegateBranch = NULL;
2564 This->ProcessPin.Flags = 0;
2565 This->ProcessPin.InPlaceCounterpart = NULL;
2566 This->ProcessPin.Pin = &This->Pin;
2567 This->ProcessPin.StreamPointer = (PKSSTREAM_POINTER)&This->LeadingEdgeStreamPointer.StreamPointer;
2568 This->ProcessPin.Terminate = FALSE;
2569
2570 Status = Filter->lpVtbl->AddProcessPin(Filter, &This->ProcessPin);
2571 DPRINT("KspCreatePin AddProcessPin %lx\n", Status);
2572
2573 if (!NT_SUCCESS(Status))
2574 {
2575 /* failed to add process pin */
2577 KsFreeObjectHeader(&This->ObjectHeader);
2578 FreeItem(This);
2579 FreeItem(CreateItem);
2580 /* return failure code */
2581 return Status;
2582 }
2583 }
2584 else if (Descriptor->Dispatch && Descriptor->Dispatch->Process)
2585 {
2586 /* pin centric processing filter */
2587
2588 /* initialize work item */
2590
2591 /* allocate counted work item */
2592 Status = KsRegisterCountedWorker(HyperCriticalWorkQueue, &This->PinWorkQueueItem, &This->PinWorker);
2593
2594 if (!NT_SUCCESS(Status))
2595 {
2596 DPRINT("Failed to register Worker %lx\n", Status);
2598 KsFreeObjectHeader(&This->ObjectHeader);
2599 FreeItem(This);
2600 FreeItem(CreateItem);
2601 return Status;
2602 }
2603
2604 if (This->Pin.Descriptor->PinDescriptor.DataFlow == KSPIN_DATAFLOW_IN)
2605 This->LeadingEdgeStreamPointer.StreamPointer.Offset = &This->LeadingEdgeStreamPointer.StreamPointer.OffsetIn;
2606 else
2607 This->LeadingEdgeStreamPointer.StreamPointer.Offset = &This->LeadingEdgeStreamPointer.StreamPointer.OffsetOut;
2608
2609
2610 KeInitializeEvent(&This->FrameComplete, NotificationEvent, FALSE);
2611
2612 }
2613
2614 /* FIXME add pin instance to filter instance */
2615 IKsFilter_AddPin(Filter->lpVtbl->GetStruct(Filter), &This->Pin);
2616
2617 if (Descriptor->Dispatch && Descriptor->Dispatch->SetDataFormat)
2618 {
2619 Status = Descriptor->Dispatch->SetDataFormat(&This->Pin, NULL, NULL, This->Pin.ConnectionFormat, NULL);
2620 DPRINT("KspCreatePin SetDataFormat %lx\n", Status);
2621 }
2622
2623
2624 /* does the driver have a pin dispatch */
2625 if (Descriptor->Dispatch && Descriptor->Dispatch->Create)
2626 {
2627 /* now inform the driver to create a new pin */
2628 Status = Descriptor->Dispatch->Create(&This->Pin, Irp);
2629 DPRINT("KspCreatePin DispatchCreate %lx\n", Status);
2630 }
2631
2632
2633 DPRINT("KspCreatePin Status %lx KsDevice %p\n", Status, KsDevice);
2634
2636 {
2637 /* failed to create pin, release resources */
2638 IKsFilter_RemovePin(Filter->lpVtbl->GetStruct(Filter), &This->Pin);
2640 KsFreeObjectHeader((KSOBJECT_HEADER)This->ObjectHeader);
2641 FreeItem(This);
2642
2643 /* return failure code */
2644 return Status;
2645 }
2646
2647 return Status;
2648}
KSDDKAPI VOID NTAPI KsFreeObjectBag(IN KSOBJECT_BAG ObjectBag)
Definition: bag.c:308
#define KSDATAFORMAT_SUBTYPE_BDA_MPEG2_TRANSPORT
Definition: bdamedia.h:365
struct tagKS_DATARANGE_BDA_TRANSPORT * PKS_DATARANGE_BDA_TRANSPORT
IUnknown * PUNKNOWN
Definition: com_apitest.h:45
KSDATAFORMAT * PKSDATAFORMAT
struct _BEEP_DEVICE_EXTENSION * PDEVICE_EXTENSION
NTSTATUS NTAPI KsMergeAutomationTables(OUT PKSAUTOMATION_TABLE *AutomationTableAB, IN PKSAUTOMATION_TABLE AutomationTableA OPTIONAL, IN PKSAUTOMATION_TABLE AutomationTableB OPTIONAL, IN KSOBJECT_BAG Bag OPTIONAL)
Definition: api.c:2303
KSDDKAPI VOID NTAPI KsFreeObjectHeader(IN PVOID Header)
Definition: api.c:720
KSDDKAPI NTSTATUS NTAPI KsAllocateObjectHeader(OUT KSOBJECT_HEADER *Header, IN ULONG ItemsCount, IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL, IN PIRP Irp, IN KSDISPATCH_TABLE *Table)
Definition: api.c:610
VOID IKsFilter_AddPin(PKSFILTER Filter, PKSPIN Pin)
Definition: filter.c:1337
KSPROPERTY_SET PinPropertySet[]
Definition: pin.c:95
VOID NTAPI IKsPin_PinCentricWorker(IN PVOID Parameter)
Definition: pin.c:1818
static IKsReferenceClockVtbl vt_ReferenceClock
Definition: pin.c:911
static IKsPinVtbl vt_IKsPin
Definition: pin.c:691
NTSTATUS NTAPI IKsPin_DispatchCreateClock(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pin.c:2175
NTSTATUS NTAPI IKsPin_DispatchCreateAllocator(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pin.c:2162
NTSTATUS NTAPI IKsPin_DispatchCreateNode(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pin.c:2257
static KSDISPATCH_TABLE PinDispatchTable
Definition: pin.c:2268
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
#define KSSTRING_Allocator
Definition: ks.h:50
#define KSSTRING_TopologyNode
Definition: ks.h:52
_In_ PKSPIN_CONNECT Connect
Definition: ks.h:4536
#define KSSTRING_Clock
Definition: ks.h:49
PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
Definition: misc.c:29
struct KSBASIC_HEADER * PKSBASIC_HEADER
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
@ NotificationEvent
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
Definition: mutex.c:67
PRKMUTEX ControlMutex
Definition: kstypes.h:58
ULONG PinId
Definition: ks.h:2603
KSPIN_MEDIUM Medium
Definition: ks.h:2602
KSPRIORITY Priority
Definition: ks.h:2605
KSPIN_INTERFACE Interface
Definition: ks.h:2601
REFERENCE_TIME AvgTimePerFrame
Definition: bdamedia.h:340
ULONG ulcbPhyiscalFrameAlignment
Definition: bdamedia.h:339
BDA_TRANSPORT_INFO BdaTransportInfo
Definition: bdamedia.h:345
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
KSDDKAPI NTSTATUS NTAPI KsRegisterCountedWorker(IN WORK_QUEUE_TYPE WorkQueueType, IN PWORK_QUEUE_ITEM CountedWorkItem, OUT PKSWORKER *Worker)
Definition: worker.c:166
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
@ HyperCriticalWorkQueue
Definition: extypes.h:191

Referenced by IKsFilter_DispatchCreatePin().

◆ KsPinAcquireProcessingMutex()

VOID NTAPI KsPinAcquireProcessingMutex ( IN PKSPIN  Pin)

Definition at line 933 of file pin.c.

Referenced by CaptureGateOnWorkItem().

◆ KsPinAttachAndGate()

VOID NTAPI KsPinAttachAndGate ( IN PKSPIN  Pin,
IN PKSGATE AndGate  OPTIONAL 
)

Definition at line 946 of file pin.c.

949{
951
952 /* FIXME attach to filter's and gate (filter-centric processing) */
953
954 This->AttachedGate = AndGate;
955 This->OrGate = FALSE;
956}

◆ KsPinAttachOrGate()

VOID NTAPI KsPinAttachOrGate ( IN PKSPIN  Pin,
IN PKSGATE OrGate  OPTIONAL 
)

Definition at line 963 of file pin.c.

966{
968
969 /* FIXME attach to filter's and gate (filter-centric processing) */
970
971 This->AttachedGate = OrGate;
972 This->OrGate = TRUE;
973}
#define TRUE
Definition: types.h:120

◆ KsPinAttemptProcessing()

VOID NTAPI KsPinAttemptProcessing ( IN PKSPIN  Pin,
IN BOOLEAN  Asynchronous 
)

Definition at line 993 of file pin.c.

996{
997 DPRINT("KsPinAttemptProcessing\n");
1000}

Referenced by CaptureGateOnWorkItem().

◆ KsPinGetAndGate()

PKSGATE NTAPI KsPinGetAndGate ( IN PKSPIN  Pin)

Definition at line 980 of file pin.c.

982{
984
985 return This->AttachedGate;
986}

Referenced by CaptureGateOnWorkItem(), InitCapturePin(), and PinCaptureProcess().

◆ KsPinGetAvailableByteCount()

NTSTATUS NTAPI KsPinGetAvailableByteCount ( IN PKSPIN  Pin,
OUT PLONG InputDataBytes  OPTIONAL,
OUT PLONG OutputBufferBytes  OPTIONAL 
)

Definition at line 1007 of file pin.c.

1011{
1014}

◆ KsPinGetConnectedFilterInterface()

NTSTATUS NTAPI KsPinGetConnectedFilterInterface ( IN PKSPIN  Pin,
IN const GUID InterfaceId,
OUT PVOID Interface 
)

Definition at line 1021 of file pin.c.

1025{
1028}

◆ KsPinGetConnectedPinDeviceObject()

PDEVICE_OBJECT NTAPI KsPinGetConnectedPinDeviceObject ( IN PKSPIN  Pin)

Definition at line 1035 of file pin.c.

1037{
1039 return NULL;
1040}

◆ KsPinGetConnectedPinFileObject()

PFILE_OBJECT NTAPI KsPinGetConnectedPinFileObject ( IN PKSPIN  Pin)

Definition at line 1047 of file pin.c.

1049{
1051 return NULL;
1052}

Referenced by AudioPositionPropertyHandler().

◆ KsPinGetConnectedPinInterface()

NTSTATUS NTAPI KsPinGetConnectedPinInterface ( IN PKSPIN  Pin,
IN const GUID InterfaceId,
OUT PVOID Interface 
)

Definition at line 1059 of file pin.c.

1063{
1066}

◆ KsPinGetCopyRelationships()

VOID NTAPI KsPinGetCopyRelationships ( IN PKSPIN  Pin,
OUT PKSPIN *  CopySource,
OUT PKSPIN *  DelegateBranch 
)

Definition at line 1073 of file pin.c.

1077{
1079}

◆ KsPinGetFirstCloneStreamPointer()

KSDDKAPI PKSSTREAM_POINTER NTAPI KsPinGetFirstCloneStreamPointer ( IN PKSPIN  Pin)

Definition at line 1776 of file pin.c.

1778{
1779 IKsPinImpl * This;
1780
1781 DPRINT("KsPinGetFirstCloneStreamPointer %p\n", Pin);
1782
1784
1785 if (!This->ClonedStreamPointer)
1786 return NULL;
1787
1788 /* return first cloned stream pointer */
1789 return &This->ClonedStreamPointer->StreamPointer;
1790}

◆ KsPinGetLeadingEdgeStreamPointer()

KSDDKAPI PKSSTREAM_POINTER NTAPI KsPinGetLeadingEdgeStreamPointer ( IN PKSPIN  Pin,
IN KSSTREAM_POINTER_STATE  State 
)

Definition at line 1385 of file pin.c.

1388{
1389 IKsPinImpl * This;
1391
1393
1394 DPRINT("KsPinGetLeadingEdgeStreamPointer Pin %p State %x Count %lu Remaining %lu\n", Pin, State,
1395 This->LeadingEdgeStreamPointer.Length,
1396 This->LeadingEdgeStreamPointer.Offset);
1397
1398 /* sanity check */
1400
1402 {
1403 if (!This->LeadingEdgeStreamPointer.Irp || This->LeadingEdgeStreamPointer.StreamPointer.Offset->Remaining == 0)
1404 {
1405 Status = IKsPin_PrepareStreamHeader(This, &This->LeadingEdgeStreamPointer);
1406 if (!NT_SUCCESS(Status))
1407 return NULL;
1408 }
1409
1410 DPRINT("KsPinGetLeadingEdgeStreamPointer NewOffset %lu TotalLength %lu\n", This->LeadingEdgeStreamPointer.Offset, This->LeadingEdgeStreamPointer.Length);
1411 }
1412
1413 return &This->LeadingEdgeStreamPointer.StreamPointer;
1414}
NTSTATUS IKsPin_PrepareStreamHeader(IN IKsPinImpl *This, IN PKSISTREAM_POINTER StreamPointer)
Definition: pin.c:1297
@ KSSTREAM_POINTER_STATE_LOCKED
Definition: ks.h:3025

Referenced by PinCaptureProcess(), and PinRenderProcess().

◆ KsPinGetNextSiblingPin()

PKSPIN NTAPI KsPinGetNextSiblingPin ( IN PKSPIN  Pin)

Definition at line 1086 of file pin.c.

1088{
1089 return KsGetNextSibling((PVOID)Pin);
1090}
KSDDKAPI PVOID NTAPI KsGetNextSibling(IN PVOID Object)
Definition: api.c:1882

Referenced by IKsFilter_AddPin(), and IKsFilter_RemovePin().

◆ KsPinGetParentFilter()

PKSFILTER NTAPI KsPinGetParentFilter ( IN PKSPIN  Pin)

Definition at line 1097 of file pin.c.

1099{
1101
1102 /* return parent filter */
1103 return This->BasicHeader.Parent.KsFilter;
1104}

Referenced by AudioPositionPropertyHandler(), BdaPropertyGetPinControl(), KsGetFilterFromIrp(), PinCreate(), PinReset(), PinState(), and USBAudioPinCreate().

◆ KsPinGetReferenceClockInterface()

NTSTATUS NTAPI KsPinGetReferenceClockInterface ( IN PKSPIN  Pin,
OUT PIKSREFERENCECLOCK *  Interface 
)

Definition at line 1111 of file pin.c.

1114{
1117
1118 if (This->ClockFileObject)
1119 {
1120 /* clock is available */
1121 *Interface = (PIKSREFERENCECLOCK)&This->lpVtblReferenceClock;
1123 }
1124
1125 DPRINT("KsPinGetReferenceClockInterface Pin %p Interface %p Status %x\n", Pin, Interface, Status);
1126 return Status;
1127}
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE Interface
Definition: wdffdo.h:465

◆ KsPinGetTrailingEdgeStreamPointer()

KSDDKAPI PKSSTREAM_POINTER NTAPI KsPinGetTrailingEdgeStreamPointer ( IN PKSPIN  Pin,
IN KSSTREAM_POINTER_STATE  State 
)

Definition at line 1422 of file pin.c.

1425{
1427 return NULL;
1428}

◆ KsPinRegisterFrameReturnCallback()

VOID NTAPI KsPinRegisterFrameReturnCallback ( IN PKSPIN  Pin,
IN PFNKSPINFRAMERETURN  FrameReturn 
)

Definition at line 1134 of file pin.c.

1137{
1139
1140 /* register frame return callback */
1141 This->FrameReturn = FrameReturn;
1142}

◆ KsPinRegisterHandshakeCallback()

VOID NTAPI KsPinRegisterHandshakeCallback ( IN PKSPIN  Pin,
IN PFNKSPINHANDSHAKE  Handshake 
)

Definition at line 1149 of file pin.c.

1152{
1154
1155 /* register private protocol handshake callback */
1156 This->Handshake = Handshake;
1157}

◆ KsPinRegisterIrpCompletionCallback()

VOID NTAPI KsPinRegisterIrpCompletionCallback ( IN PKSPIN  Pin,
IN PFNKSPINIRPCOMPLETION  IrpCompletion 
)

Definition at line 1164 of file pin.c.

1167{
1169
1170 /* register irp completion callback */
1171 This->IrpCompletion = IrpCompletion;
1172}

◆ KsPinRegisterPowerCallbacks()

VOID NTAPI KsPinRegisterPowerCallbacks ( IN PKSPIN  Pin,
IN PFNKSPINPOWER Sleep  OPTIONAL,
IN PFNKSPINPOWER Wake  OPTIONAL 
)

Definition at line 1179 of file pin.c.

1183{
1185
1186 /* register power callbacks */
1187 This->Sleep = Sleep;
1188 This->Wake = Wake;
1189}
static VOID Wake(_In_ UCHAR Csn)
Definition: hardware.c:154
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790

◆ KsPinReleaseProcessingMutex()

VOID NTAPI KsPinReleaseProcessingMutex ( IN PKSPIN  Pin)

Definition at line 1196 of file pin.c.

1198{
1200
1201 /* release processing mutex */
1202 KeReleaseMutex(&This->ProcessingMutex, FALSE);
1203}

Referenced by CaptureGateOnWorkItem().

◆ KsPinSetPinClockTime()

VOID NTAPI KsPinSetPinClockTime ( IN PKSPIN  Pin,
IN LONGLONG  Time 
)

Definition at line 1244 of file pin.c.

1247{
1249}

◆ KsPinSubmitFrame()

NTSTATUS NTAPI KsPinSubmitFrame ( IN PKSPIN  Pin,
IN PVOID Data  OPTIONAL,
IN ULONG Size  OPTIONAL,
IN PKSSTREAM_HEADER StreamHeader  OPTIONAL,
IN PVOID Context  OPTIONAL 
)

Definition at line 1256 of file pin.c.

1262{
1264 return STATUS_UNSUCCESSFUL;
1265}

◆ KsPinSubmitFrameMdl()

KSDDKAPI NTSTATUS NTAPI KsPinSubmitFrameMdl ( IN PKSPIN  Pin,
IN PMDL Mdl  OPTIONAL,
IN PKSSTREAM_HEADER StreamHeader  OPTIONAL,
IN PVOID Context  OPTIONAL 
)

Definition at line 1273 of file pin.c.

1278{
1280 return STATUS_UNSUCCESSFUL;
1281}

◆ KsProcessPinUpdate()

KSDDKAPI BOOLEAN NTAPI KsProcessPinUpdate ( IN PKSPROCESSPIN  ProcessPin)

Definition at line 1289 of file pin.c.

1291{
1293 return FALSE;
1294}

◆ KsStreamPointerAdvance()

KSDDKAPI NTSTATUS NTAPI KsStreamPointerAdvance ( IN PKSSTREAM_POINTER  StreamPointer)

Definition at line 1688 of file pin.c.

1690{
1692 DbgBreakPoint();
1694}

Referenced by PinRenderProcess().

◆ KsStreamPointerAdvanceOffsets()

KSDDKAPI NTSTATUS NTAPI KsStreamPointerAdvanceOffsets ( IN PKSSTREAM_POINTER  StreamPointer,
IN ULONG  InUsed,
IN ULONG  OutUsed,
IN BOOLEAN  Eject 
)

Definition at line 1628 of file pin.c.

1633{
1634 PKSISTREAM_POINTER CurFrame;
1635 IKsPinImpl * This;
1637
1638 DPRINT("KsStreamPointerAdvanceOffsets StreamPointer %p InUsed %lu OutUsed %lu Eject %lu\n", StreamPointer, InUsed, OutUsed, Eject);
1639
1640 /* get stream pointer */
1641 CurFrame = (PKSISTREAM_POINTER)CONTAINING_RECORD(StreamPointer, KSISTREAM_POINTER, StreamPointer);
1642
1643 /* locate pin */
1645
1646 /* TODO */
1647 ASSERT(InUsed == 0);
1648 ASSERT(Eject == 0);
1649 ASSERT(OutUsed);
1650
1651 DPRINT("KsStreamPointerAdvanceOffsets Offset %lu Length %lu NewOffset %lu Remaining %lu LeadingEdge %p DataUsed %lu\n", CurFrame->Offset, CurFrame->Length, CurFrame->Offset + OutUsed,
1652CurFrame->StreamPointer.OffsetOut.Remaining, &This->LeadingEdgeStreamPointer.StreamPointer, CurFrame->StreamPointer.StreamHeader->DataUsed);
1654
1655 if (This->Pin.Descriptor->PinDescriptor.DataFlow == KSPIN_DATAFLOW_IN)
1656 {
1657 ASSERT(CurFrame->StreamPointer.OffsetIn.Remaining >= InUsed);
1658 CurFrame->StreamPointer.OffsetIn.Remaining -= InUsed;
1659 CurFrame->StreamPointer.OffsetIn.Data = (PVOID)((ULONG_PTR)CurFrame->StreamPointer.OffsetIn.Data + InUsed);
1660 }
1661 else
1662 {
1663 if (!CurFrame->StreamPointer.OffsetOut.Remaining)
1664 {
1666 if (!NT_SUCCESS(Status))
1667 {
1669 }
1670 }
1671 else
1672 {
1673 ASSERT(CurFrame->StreamPointer.OffsetOut.Remaining >= OutUsed);
1674 CurFrame->StreamPointer.OffsetOut.Remaining -= OutUsed;
1675 CurFrame->StreamPointer.OffsetOut.Data = (PVOID)((ULONG_PTR)CurFrame->StreamPointer.OffsetOut.Data + OutUsed);
1676 }
1677 }
1678
1679 return STATUS_SUCCESS;
1680}
struct _KSISTREAM_POINTER * PKSISTREAM_POINTER
KSSTREAM_POINTER StreamPointer
Definition: pin.c:27
ULONG Length
Definition: pin.c:26
PKSPIN Pin
Definition: pin.c:23
ULONG Offset
Definition: pin.c:25

Referenced by PinCaptureProcess().

◆ KsStreamPointerAdvanceOffsetsAndUnlock()

KSDDKAPI VOID NTAPI KsStreamPointerAdvanceOffsetsAndUnlock ( IN PKSSTREAM_POINTER  StreamPointer,
IN ULONG  InUsed,
IN ULONG  OutUsed,
IN BOOLEAN  Eject 
)

Definition at line 1480 of file pin.c.

1485{
1486 DPRINT1("KsStreamPointerAdvanceOffsets InUsed %lu OutUsed %lu Eject %lu\n", InUsed, OutUsed, Eject);
1487 DbgBreakPoint();
1489}

Referenced by PinCaptureProcess().

◆ KsStreamPointerCancelTimeout()

KSDDKAPI VOID NTAPI KsStreamPointerCancelTimeout ( IN PKSSTREAM_POINTER  StreamPointer)

Definition at line 1758 of file pin.c.

1760{
1761 PKSISTREAM_POINTER Pointer;
1762
1763 /* get stream pointer */
1764 Pointer = (PKSISTREAM_POINTER)CONTAINING_RECORD(StreamPointer, KSISTREAM_POINTER, StreamPointer);
1765
1766 KeCancelTimer(&Pointer->Timer);
1767
1768}
KTIMER Timer
Definition: pin.c:20
BOOLEAN NTAPI KeCancelTimer(IN OUT PKTIMER Timer)
Definition: timerobj.c:206

◆ KsStreamPointerClone()

KSDDKAPI NTSTATUS NTAPI KsStreamPointerClone ( IN PKSSTREAM_POINTER  StreamPointer,
IN PFNKSSTREAMPOINTER CancelCallback  OPTIONAL,
IN ULONG  ContextSize,
OUT PKSSTREAM_POINTER *  CloneStreamPointer 
)

Definition at line 1545 of file pin.c.

1550{
1551 IKsPinImpl * This;
1552 PKSISTREAM_POINTER CurFrame;
1553 PKSISTREAM_POINTER NewFrame;
1554 ULONG_PTR RefCount;
1556 ULONG Size;
1557
1558 DPRINT("KsStreamPointerClone StreamPointer %p CancelCallback %p ContextSize %p CloneStreamPointer %p\n", StreamPointer, CancelCallback, ContextSize, CloneStreamPointer);
1559
1560 /* get stream pointer */
1561 CurFrame = (PKSISTREAM_POINTER)CONTAINING_RECORD(StreamPointer, KSISTREAM_POINTER, StreamPointer);
1562
1563 /* calculate context size */
1565
1566 /* allocate new stream pointer */
1568
1569 if (!NewFrame)
1571
1572 /* get current irp stack location */
1573 RefCount = (ULONG_PTR)CurFrame->Irp->Tail.Overlay.DriverContext[0];
1574
1575 /* increment reference count */
1576 RefCount++;
1577 CurFrame->Irp->Tail.Overlay.DriverContext[0] = (PVOID)RefCount;
1578
1579 /* copy stream pointer */
1580 RtlMoveMemory(NewFrame, CurFrame, sizeof(KSISTREAM_POINTER));
1581
1582 /* locate pin */
1584
1585 /* prepare stream header in case required */
1586 if (CurFrame->StreamPointer.Offset->Remaining == 0)
1587 {
1589 if (!NT_SUCCESS(Status))
1590 {
1591 FreeItem(NewFrame);
1593 }
1594 }
1595
1596 if (ContextSize)
1597 NewFrame->StreamPointer.Context = (NewFrame + 1);
1598
1599
1600 if (This->Pin.Descriptor->PinDescriptor.DataFlow == KSPIN_DATAFLOW_IN)
1601 NewFrame->StreamPointer.Offset = &NewFrame->StreamPointer.OffsetIn;
1602 else
1603 NewFrame->StreamPointer.Offset = &NewFrame->StreamPointer.OffsetOut;
1604
1605
1606
1607 NewFrame->StreamPointer.Pin = &This->Pin;
1608
1609 ASSERT(NewFrame->StreamPointer.Pin);
1610 ASSERT(NewFrame->StreamPointer.Context);
1611 ASSERT(NewFrame->StreamPointer.Offset);
1612 ASSERT(NewFrame->StreamPointer.StreamHeader);
1613
1614 /* store result */
1615 *CloneStreamPointer = &NewFrame->StreamPointer;
1616
1617 DPRINT("KsStreamPointerClone CloneStreamPointer %p\n", *CloneStreamPointer);
1618
1619 return STATUS_SUCCESS;
1620}
struct _KSISTREAM_POINTER KSISTREAM_POINTER
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T ContextSize
Definition: fltkernel.h:1444

Referenced by PinRenderProcess().

◆ KsStreamPointerDelete()

KSDDKAPI VOID NTAPI KsStreamPointerDelete ( IN PKSSTREAM_POINTER  StreamPointer)

Definition at line 1497 of file pin.c.

1499{
1500 IKsPinImpl * This;
1501 PKSISTREAM_POINTER Cur, Last;
1502 PKSISTREAM_POINTER Pointer = (PKSISTREAM_POINTER)CONTAINING_RECORD(StreamPointer, KSISTREAM_POINTER, StreamPointer);
1503
1504 DPRINT("KsStreamPointerDelete %p\n", Pointer);
1507
1508 /* point to first stream pointer */
1509 Last = NULL;
1510 Cur = This->ClonedStreamPointer;
1511
1512 while(Cur != Pointer && Cur)
1513 {
1514 Last = Cur;
1515 /* iterate to next cloned pointer */
1516 Cur = Cur->Next;
1517 }
1518
1519 if (!Cur)
1520 {
1521 /* you naughty driver */
1522 return;
1523 }
1524
1525 if (!Last)
1526 {
1527 /* remove first cloned pointer */
1528 This->ClonedStreamPointer = Pointer->Next;
1529 }
1530 else
1531 {
1532 Last->Next = Pointer->Next;
1533 }
1534
1535 /* FIXME make sure no timeouts are pending */
1536 FreeItem(Pointer);
1537}
struct _KSISTREAM_POINTER * Next
Definition: pin.c:22

Referenced by UsbAudioRenderComplete().

◆ KsStreamPointerGetIrp()

KSDDKAPI PIRP NTAPI KsStreamPointerGetIrp ( IN PKSSTREAM_POINTER  StreamPointer,
OUT PBOOLEAN FirstFrameInIrp  OPTIONAL,
OUT PBOOLEAN LastFrameInIrp  OPTIONAL 
)

Definition at line 1715 of file pin.c.

1719{
1721 return NULL;
1722}

◆ KsStreamPointerGetMdl()

KSDDKAPI PMDL NTAPI KsStreamPointerGetMdl ( IN PKSSTREAM_POINTER  StreamPointer)

Definition at line 1702 of file pin.c.

1704{
1706 return NULL;
1707}

◆ KsStreamPointerGetNextClone()

KSDDKAPI PKSSTREAM_POINTER NTAPI KsStreamPointerGetNextClone ( IN PKSSTREAM_POINTER  StreamPointer)

Definition at line 1798 of file pin.c.

1800{
1801 PKSISTREAM_POINTER Pointer;
1802
1803 DPRINT("KsStreamPointerGetNextClone\n");
1805 /* get stream pointer */
1806 Pointer = (PKSISTREAM_POINTER)CONTAINING_RECORD(StreamPointer, KSISTREAM_POINTER, StreamPointer);
1807
1808 /* is there a another cloned stream pointer */
1809 if (!Pointer->Next)
1810 return NULL;
1811
1812 /* return next stream pointer */
1813 return &Pointer->Next->StreamPointer;
1814}

◆ KsStreamPointerLock()

KSDDKAPI NTSTATUS NTAPI KsStreamPointerLock ( IN PKSSTREAM_POINTER  StreamPointer)

Definition at line 1450 of file pin.c.

1452{
1454 return STATUS_UNSUCCESSFUL;
1455}

◆ KsStreamPointerScheduleTimeout()

KSDDKAPI VOID NTAPI KsStreamPointerScheduleTimeout ( IN PKSSTREAM_POINTER  StreamPointer,
IN PFNKSSTREAMPOINTER  Callback,
IN ULONGLONG  Interval 
)

Definition at line 1730 of file pin.c.

1734{
1736 PKSISTREAM_POINTER Pointer;
1737
1738 /* get stream pointer */
1739 Pointer = (PKSISTREAM_POINTER)CONTAINING_RECORD(StreamPointer, KSISTREAM_POINTER, StreamPointer);
1740
1741 /* setup timer callback */
1742 Pointer->Callback = Callback;
1743
1744 /* setup expiration */
1745 DueTime.QuadPart = (LONGLONG)Interval;
1746
1747 /* setup the timer */
1748 KeSetTimer(&Pointer->Timer, DueTime, &Pointer->TimerDpc);
1749
1750}
DWORD Interval
Definition: netstat.c:30
KDPC TimerDpc
Definition: pin.c:21
PFNKSSTREAMPOINTER Callback
Definition: pin.c:18
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
Definition: timerobj.c:281
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
_In_ WDFTIMER _In_ LONGLONG DueTime
Definition: wdftimer.h:190

◆ KsStreamPointerSetStatusCode()

KSDDKAPI NTSTATUS NTAPI KsStreamPointerSetStatusCode ( IN PKSSTREAM_POINTER  StreamPointer,
IN NTSTATUS  Status 
)

Definition at line 1436 of file pin.c.

1439{
1441 return STATUS_UNSUCCESSFUL;
1442}

Referenced by UsbAudioRenderComplete().

◆ KsStreamPointerUnlock()

KSDDKAPI VOID NTAPI KsStreamPointerUnlock ( IN PKSSTREAM_POINTER  StreamPointer,
IN BOOLEAN  Eject 
)

Definition at line 1463 of file pin.c.

1466{
1467 PKSISTREAM_POINTER Pointer = (PKSISTREAM_POINTER)CONTAINING_RECORD(StreamPointer, KSISTREAM_POINTER, StreamPointer);
1468
1469 DPRINT1("KsStreamPointerUnlock StreamPointer %pEject %lu\n", StreamPointer, Eject);
1470
1471 Pointer->Irp = NULL;
1472}

Referenced by PinCaptureProcess(), and PinRenderProcess().

Variable Documentation

◆ KSPROPSETID_Clock

const GUID KSPROPSETID_Clock = {0xDF12A4C0L, 0xAC17, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}

◆ KSPROPSETID_Connection

const GUID KSPROPSETID_Connection = {0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}

Definition at line 113 of file pin.c.

Referenced by Pin_fnDeviceIoControl(), and SetMixerInputOutputFormat().

◆ KSPROPSETID_Stream

const GUID KSPROPSETID_Stream = {0x65aaba60L, 0x98ae, 0x11cf, {0xa1, 0x0d, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4}}

Definition at line 114 of file pin.c.

◆ PinDispatchTable

KSDISPATCH_TABLE PinDispatchTable
static
Initial value:
=
{
}
KSDDKAPI NTSTATUS NTAPI KsDispatchInvalidDeviceRequest(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1189
KSDDKAPI BOOLEAN NTAPI KsDispatchFastReadFailure(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: irp.c:1271
KSDDKAPI NTSTATUS NTAPI KsDispatchSetSecurity(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:67
KSDDKAPI NTSTATUS NTAPI KsDispatchQuerySecurity(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:22
KSDDKAPI BOOLEAN NTAPI KsDispatchFastIoDeviceControlFailure(IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, IN PVOID InputBuffer OPTIONAL, IN ULONG InputBufferLength, OUT PVOID OutputBuffer OPTIONAL, IN ULONG OutputBufferLength, IN ULONG IoControlCode, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: irp.c:1251
NTSTATUS NTAPI IKsPin_DispatchDeviceIoControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pin.c:1988
NTSTATUS NTAPI IKsPin_Close(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: pin.c:2111

Definition at line 2268 of file pin.c.

Referenced by KspCreatePin().

◆ PinPropertySet

KSPROPERTY_SET PinPropertySet[]
Initial value:
=
{
{
sizeof(PinConnectionSet) / sizeof(KSPROPERTY_ITEM),
(const KSPROPERTY_ITEM*)&PinConnectionSet,
0,
},
{
sizeof(PinStreamSet) / sizeof(KSPROPERTY_ITEM),
(const KSPROPERTY_ITEM*)&PinStreamSet,
0,
}
}
const GUID KSPROPSETID_Stream
Definition: pin.c:114
const GUID KSPROPSETID_Connection
Definition: pin.c:113

Definition at line 95 of file pin.c.

Referenced by KspCreatePin().

◆ vt_IKsPin

IKsPinVtbl vt_IKsPin
static
Initial value:
=
{
}
VOID NTAPI IKsPin_fnGenerateConnectionEvents(IN IKsPin *iface, IN ULONG EventMask)
Definition: pin.c:673
NTSTATUS NTAPI IKsPin_fnSetTransportConfig(IN IKsPin *iface, IN struct KSPTRANSPORTCONFIG const *TransportConfig, OUT IKsTransport **OutTransportIn, OUT IKsTransport **OutTransportOut)
Definition: pin.c:614
NTSTATUS NTAPI IKsPin_fnConnect(IN IKsPin *iface, IN IKsTransport *TransportIn, OUT IKsTransport **OutTransportIn, OUT IKsTransport **OutTransportOut, IN KSPIN_DATAFLOW DataFlow)
Definition: pin.c:567
NTSTATUS NTAPI IKsPin_fnResetTransportConfig(IN IKsPin *iface, OUT IKsTransport **OutTransportIn, OUT IKsTransport **OutTransportOut)
Definition: pin.c:626
NTSTATUS NTAPI IKsPin_fnAttemptUnbypass(IN IKsPin *iface)
Definition: pin.c:664
VOID NTAPI IKsPin_fnSetResetState(IN IKsPin *iface, IN KSRESET ResetState, OUT IKsTransport **OutTransportOut)
Definition: pin.c:592
NTSTATUS NTAPI IKsPin_fnTransferKsIrp(IN IKsPin *iface, IN PIRP Irp, IN IKsTransport **OutTransport)
Definition: pin.c:545
NTSTATUS NTAPI IKsPin_fnAttemptBypass(IN IKsPin *iface)
Definition: pin.c:655
PKSPROCESSPIN NTAPI IKsPin_fnGetProcessPin(IN IKsPin *iface)
Definition: pin.c:646
PKSPIN NTAPI IKsPin_fnGetStruct(IN IKsPin *iface)
Definition: pin.c:637
VOID NTAPI IKsPin_fnDiscardKsIrp(IN IKsPin *iface, IN PIRP Irp, IN IKsTransport **OutTransport)
Definition: pin.c:556
NTSTATUS NTAPI IKsPin_fnClientSetDeviceState(IN IKsPin *iface, IN KSSTATE StateIn, IN KSSTATE StateOut)
Definition: pin.c:682
NTSTATUS NTAPI IKsPin_fnSetDeviceState(IN IKsPin *iface, IN KSSTATE OldState, IN KSSTATE NewState, IN IKsTransport **OutTransport)
Definition: pin.c:580
NTSTATUS NTAPI IKsPin_fnGetTransportConfig(IN IKsPin *iface, IN struct KSPTRANSPORTCONFIG *TransportConfig, OUT IKsTransport **OutTransportIn, OUT IKsTransport **OutTransportOut)
Definition: pin.c:602

Definition at line 691 of file pin.c.

Referenced by KspCreatePin().

◆ vt_ReferenceClock

IKsReferenceClockVtbl vt_ReferenceClock
static
Initial value:
=
{
}
LONGLONG NTAPI IKsReferenceClock_fnGetTime(IKsReferenceClock *iface)
Definition: pin.c:749
LONGLONG NTAPI IKsReferenceClock_fnGetCorrelatedPhysicalTime(IKsReferenceClock *iface, OUT PLONGLONG SystemTime)
Definition: pin.c:823
LONGLONG NTAPI IKsReferenceClock_fnGetCorrelatedTime(IKsReferenceClock *iface, OUT PLONGLONG SystemTime)
Definition: pin.c:798
ULONG NTAPI IKsReferenceClock_fnAddRef(IKsReferenceClock *iface)
Definition: pin.c:729
NTSTATUS NTAPI IKsReferenceClock_fnGetState(IKsReferenceClock *iface, OUT PKSSTATE State)
Definition: pin.c:881
ULONG NTAPI IKsReferenceClock_fnRelease(IKsReferenceClock *iface)
Definition: pin.c:739
LONGLONG NTAPI IKsReferenceClock_fnGetPhysicalTime(IKsReferenceClock *iface)
Definition: pin.c:773
NTSTATUS NTAPI IKsReferenceClock_fnGetResolution(IKsReferenceClock *iface, OUT PKSRESOLUTION Resolution)
Definition: pin.c:847
NTSTATUS NTAPI IKsReferenceClock_fnQueryInterface(IKsReferenceClock *iface, IN REFIID refiid, OUT PVOID *Output)
Definition: pin.c:717

Definition at line 911 of file pin.c.

Referenced by KspCreatePin().