diff --git a/reactos/drivers/ksfilter/ks/irp.c b/reactos/drivers/ksfilter/ks/irp.c index 21a6dd8c62b..5a1fb5b2209 100644 --- a/reactos/drivers/ksfilter/ks/irp.c +++ b/reactos/drivers/ksfilter/ks/irp.c @@ -888,6 +888,10 @@ ProbeMdl: goto ProbeMdl; } +#if 0 + // HACK for MS PORTCLS + HeaderSize = Length; +#endif /* probe user mode buffers */ if (Length && ( (!HeaderSize) || (Length % HeaderSize == 0) || ((ProbeFlags & KSPROBE_ALLOWFORMATCHANGE) && (Length == sizeof(KSSTREAM_HEADER))) ) ) { @@ -1940,7 +1944,7 @@ KsSetMajorFunctionHandler( IN ULONG MajorFunction) { DPRINT("KsSetMajorFunctionHandler Function %x\n", MajorFunction); -#if 0 +#if 1 // HACK // for MS PORTCLS // diff --git a/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c b/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c index 4229290a6d0..df9cad510fa 100644 --- a/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c +++ b/reactos/drivers/wdm/audio/legacy/wdmaud/mixer.c @@ -1888,6 +1888,12 @@ WdmAudGetLineInfo( } MixerLineSrc = GetSourceMixerLineByComponentType(&DeviceExtension->MixerInfo[(ULONG_PTR)DeviceInfo->hDevice], DeviceInfo->u.MixLine.dwComponentType); + if (!MixerLineSrc) + { + DPRINT1("Failed to find component type %x\n", DeviceInfo->u.MixLine.dwComponentType); + return SetIrpIoStatus(Irp, STATUS_UNSUCCESSFUL, 0); + } + ASSERT(MixerLineSrc); /* copy cached data */ diff --git a/reactos/drivers/wdm/audio/sysaudio/control.c b/reactos/drivers/wdm/audio/sysaudio/control.c index 190641aa8c9..b096d4d9dcc 100644 --- a/reactos/drivers/wdm/audio/sysaudio/control.c +++ b/reactos/drivers/wdm/audio/sysaudio/control.c @@ -208,7 +208,7 @@ ComputeCompatibleFormat( MultipleItem = (PKSMULTIPLE_ITEM)(PinRequest + 1); MultipleItem->Count = 1; - MultipleItem->Size = sizeof(KSMULTIPLE_ITEM) + ClientFormat->DataFormat.FormatSize; + MultipleItem->Size = ClientFormat->DataFormat.FormatSize; RtlMoveMemory(MultipleItem + 1, ClientFormat, ClientFormat->DataFormat.FormatSize); /* Query the miniport data intersection handler */ @@ -229,7 +229,7 @@ ComputeCompatibleFormat( if (Status != STATUS_MORE_ENTRIES) { - /* Failed to data ranges */ + /* Failed to get data ranges */ return Status; } @@ -276,7 +276,7 @@ ComputeCompatibleFormat( MixerFormat->WaveFormatEx.wBitsPerSample = 16; #else - MixerFormat->WaveFormatEx.nChannels = min(ClientFormat->WaveFormatEx.nSamplesPerSec, AudioRange->MaximumChannels); + MixerFormat->WaveFormatEx.nChannels = min(ClientFormat->WaveFormatEx.nChannels, AudioRange->MaximumChannels); MixerFormat->WaveFormatEx.wBitsPerSample = AudioRange->MaximumBitsPerSample; #endif diff --git a/reactos/drivers/wdm/audio/sysaudio/pin.c b/reactos/drivers/wdm/audio/sysaudio/pin.c index 234f43c4a39..edcd3c307b9 100644 --- a/reactos/drivers/wdm/audio/sysaudio/pin.c +++ b/reactos/drivers/wdm/audio/sysaudio/pin.c @@ -17,7 +17,7 @@ Pin_fnDeviceIoControl( PDISPATCH_CONTEXT Context; NTSTATUS Status; ULONG BytesReturned; - PFILE_OBJECT FileObject; + PFILE_OBJECT FileObject = NULL; PIO_STACK_LOCATION IoStack; DPRINT("Pin_fnDeviceIoControl called DeviceObject %p Irp %p\n", DeviceObject, Irp); @@ -131,7 +131,7 @@ Pin_fnClose( PDISPATCH_CONTEXT Context; PIO_STACK_LOCATION IoStack; - DPRINT("Pin_fnClose called DeviceObject %p Irp %p\n", DeviceObject, Irp); + //DPRINT("Pin_fnClose called DeviceObject %p Irp %p\n", DeviceObject, Irp); /* Get current stack location */ IoStack = IoGetCurrentIrpStackLocation(Irp); @@ -143,7 +143,11 @@ Pin_fnClose( { ZwClose(Context->Handle); } - ZwClose(Context->hMixerPin); + + if (Context->hMixerPin) + { + ZwClose(Context->hMixerPin); + } ExFreePool(Context); @@ -217,7 +221,7 @@ CreateMixerPinAndSetFormat( { NTSTATUS Status; HANDLE PinHandle; - PFILE_OBJECT FileObject; + PFILE_OBJECT FileObject = NULL; Status = KsCreatePin(KMixerHandle, PinConnect, GENERIC_READ | GENERIC_WRITE, &PinHandle); @@ -242,6 +246,7 @@ CreateMixerPinAndSetFormat( { ObDereferenceObject(FileObject); ZwClose(PinHandle); + return Status; } ObDereferenceObject(FileObject); @@ -298,6 +303,13 @@ InstantiatePins( /* Let's try to create the audio irp pin */ Status = KsCreatePin(DeviceEntry->Handle, Connect, GENERIC_READ | GENERIC_WRITE, &RealPinHandle); + if (!NT_SUCCESS(Status)) + { + /* FIXME disable kmixer + */ + return STATUS_UNSUCCESSFUL; + } +#if 0 if (!NT_SUCCESS(Status)) { /* the audio irp pin didnt accept the input format @@ -340,6 +352,7 @@ InstantiatePins( return Status; } } +#endif DeviceEntry->Pins[Connect->PinId].References = 0; @@ -349,6 +362,8 @@ InstantiatePins( DispatchContext->AudioEntry = DeviceEntry; + DPRINT1("RealPinHandle %p\n", RealPinHandle); + /* Do we need to transform the audio stream */ if (OutputFormat != NULL) {