ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
February 2009
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
29 participants
559 discussions
Start a n
N
ew thread
[janderwald] 39671: - Implement KSPROPERTY_CONNECTION_STATE & KSPROPERTY_CONNECTION_FORMAT for property set KSPROPSETID_Connection - Queue a work item when Irql is above dispatch level - Open the input / output stream when initializing the pin
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Feb 18 17:27:10 2009 New Revision: 39671 URL:
http://svn.reactos.org/svn/reactos?rev=39671&view=rev
Log: - Implement KSPROPERTY_CONNECTION_STATE & KSPROPERTY_CONNECTION_FORMAT for property set KSPROPSETID_Connection - Queue a work item when Irql is above dispatch level - Open the input / output stream when initializing the pin Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c trunk/reactos/drivers/wdm/audio/backpln/portcls/port_midi.c trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c [iso-8859-1] Wed Feb 18 17:27:10 2009 @@ -86,13 +86,13 @@ ISubdevice * ISubDevice; NTSTATUS Status; IPortPinWaveCyclic * Pin; - SUBDEVICE_DESCRIPTOR * Descriptor; PKSPIN_CONNECT ConnectDetails; - IPortFilterWaveCyclicImpl * This = (IPortFilterWaveCyclicImpl *)iface; ASSERT(This->Port); + + DPRINT("IPortFilterWaveCyclic_fnNewIrpTarget entered\n"); Status = This->Port->lpVtbl->QueryInterface(This->Port, &IID_ISubdevice, (PVOID*)&ISubDevice); if (!NT_SUCCESS(Status)) Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c [iso-8859-1] Wed Feb 18 17:27:10 2009 @@ -60,6 +60,7 @@ const GUID KSPROPSETID_Topology = {0x720D4AC0L, 0x7533, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}; const GUID KSPROPSETID_Pin = {0x8C134960L, 0x51AD, 0x11CF, {0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00}}; +const GUID KSPROPSETID_Connection = {0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}; /// /// undocumented guids Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1] Wed Feb 18 17:27:10 2009 @@ -9,6 +9,12 @@ IPortWaveCyclic * Port; IPortFilterWaveCyclic * Filter; KSPIN_DESCRIPTOR * KsPinDescriptor; + PMINIPORTWAVECYCLIC Miniport; + PSERVICEGROUP ServiceGroup; + PDMACHANNEL DmaChannel; + PMINIPORTWAVECYCLICSTREAM Stream; + KSSTATE State; + PKSDATAFORMAT Format; }IPortPinWaveCyclicImpl; @@ -165,6 +171,139 @@ return STATUS_UNSUCCESSFUL; } +NTSTATUS +NTAPI +IPortPinWaveCyclic_HandleKsProperty( + IN IPortPinWaveCyclic * iface, + IN PIRP Irp) +{ + PKSPROPERTY Property; + NTSTATUS Status; + UNICODE_STRING GuidString; + PIO_STACK_LOCATION IoStack; + IPortPinWaveCyclicImpl * This = (IPortPinWaveCyclicImpl*)iface; + + IoStack = IoGetCurrentIrpStackLocation(Irp); + + DPRINT1("IPortPinWave_HandleKsProperty entered\n"); + + if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KSPROPERTY)) + { + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + return STATUS_INVALID_PARAMETER; + } + + Property = (PKSPROPERTY)IoStack->Parameters.DeviceIoControl.Type3InputBuffer; + + if (IsEqualGUIDAligned(&Property->Set, &KSPROPSETID_Connection)) + { + if (Property->Id == KSPROPERTY_CONNECTION_STATE) + { + PKSSTATE State = (PKSSTATE)Irp->UserBuffer; + + if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KSSTATE)) + { + Irp->IoStatus.Information = sizeof(KSSTATE); + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + return STATUS_BUFFER_TOO_SMALL; + } + + if (Property->Id & KSPROPERTY_TYPE_SET) + { + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + if (This->Stream) + { + Status = This->Stream->lpVtbl->SetState(This->Stream, *State); + + DPRINT1("Setting state %x\n", Status); + if (NT_SUCCESS(Status)) + { + This->State = *State; + Irp->IoStatus.Information = sizeof(KSSTATE); + Irp->IoStatus.Status = Status; + return Status; + } + Irp->IoStatus.Status = Status; + } + return Irp->IoStatus.Status; + } + else if (Property->Id & KSPROPERTY_TYPE_GET) + { + *State = This->State; + Irp->IoStatus.Information = sizeof(KSSTATE); + Irp->IoStatus.Status = STATUS_SUCCESS; + return STATUS_SUCCESS; + } + } + else if (Property->Id == KSPROPERTY_CONNECTION_DATAFORMAT) + { + PKSDATAFORMAT DataFormat = (PKSDATAFORMAT)Irp->UserBuffer; + if (Property->Id & KSPROPERTY_TYPE_SET) + { + PKSDATAFORMAT NewDataFormat = AllocateItem(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS); + if (!NewDataFormat) + { + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_NO_MEMORY; + return STATUS_NO_MEMORY; + } + RtlMoveMemory(NewDataFormat, DataFormat, DataFormat->FormatSize); + + if (This->Stream) + { + Status = This->Stream->lpVtbl->SetFormat(This->Stream, DataFormat); + if (NT_SUCCESS(Status)) + { + if (This->Format) + ExFreePoolWithTag(This->Format, TAG_PORTCLASS); + This->Format = NewDataFormat; + Irp->IoStatus.Information = DataFormat->FormatSize; + Irp->IoStatus.Status = STATUS_SUCCESS; + return STATUS_SUCCESS; + } + } + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + return STATUS_UNSUCCESSFUL; + } + else if (Property->Id & KSPROPERTY_TYPE_GET) + { + PKSDATAFORMAT DataFormat = (PKSDATAFORMAT)Irp->UserBuffer; + if (!This->Format) + { + DPRINT1("No format\n"); + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; + return STATUS_UNSUCCESSFUL; + } + if (This->Format->FormatSize > IoStack->Parameters.DeviceIoControl.OutputBufferLength) + { + Irp->IoStatus.Information = This->Format->FormatSize; + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + return STATUS_BUFFER_TOO_SMALL; + } + + RtlMoveMemory(DataFormat, This->Format, This->Format->FormatSize); + Irp->IoStatus.Information = DataFormat->FormatSize; + Irp->IoStatus.Status = STATUS_SUCCESS; + return STATUS_SUCCESS; + } + } + } + RtlStringFromGUID(&Property->Set, &GuidString); + + DPRINT1("Unhandeled property Set %S Id %u Flags %x\n", GuidString.Buffer, Property->Id, Property->Flags); + DbgBreakPoint(); + RtlFreeUnicodeString(&GuidString); + + Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; + Irp->IoStatus.Information = 0; + return STATUS_NOT_IMPLEMENTED; +} + + /* * @unimplemented */ @@ -181,11 +320,10 @@ IoStack = IoGetCurrentIrpStackLocation(Irp); - DPRINT1("IPortPinWaveCyclic_fnDeviceIoControl\n"); + DPRINT1("IPortPinWaveCyclic_fnDeviceIoControl %x %x\n",IoStack->Parameters.DeviceIoControl.IoControlCode, IOCTL_KS_PROPERTY); if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY) { - /// FIXME - /// handle property event + return IPortPinWaveCyclic_HandleKsProperty(iface, Irp); } else if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_ENABLE_EVENT) { @@ -365,6 +503,8 @@ IN KSPIN_CONNECT * ConnectDetails, IN KSPIN_DESCRIPTOR * KsPinDescriptor) { + NTSTATUS Status; + PKSDATAFORMAT DataFormat; IPortPinWaveCyclicImpl * This = (IPortPinWaveCyclicImpl*)iface; Port->lpVtbl->AddRef(Port); @@ -373,6 +513,42 @@ This->Port = Port; This->Filter = Filter; This->KsPinDescriptor = KsPinDescriptor; + This->Miniport = GetWaveCyclicMiniport(Port); + + DataFormat = (PKSDATAFORMAT)(ConnectDetails + 1); + + DPRINT("IPortPinWaveCyclic_fnInit entered\n"); + + This->Format = ExAllocatePoolWithTag(NonPagedPool, DataFormat->FormatSize, TAG_PORTCLASS); + if (!This->Format) + return STATUS_INSUFFICIENT_RESOURCES; + + RtlMoveMemory(This->Format, DataFormat, DataFormat->FormatSize); + + Status = This->Miniport->lpVtbl->NewStream(This->Miniport, + &This->Stream, + NULL, + NonPagedPool, + FALSE, //FIXME + ConnectDetails->PinId, + This->Format, + &This->DmaChannel, + &This->ServiceGroup); + + DPRINT("IPortPinWaveCyclic_fnInit Status %x\n", Status); + + if (!NT_SUCCESS(Status)) + return Status; + + Status = This->ServiceGroup->lpVtbl->AddMember(This->ServiceGroup, + (PSERVICESINK)&This->lpVtblServiceSink); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to add pin to service group\n"); + return Status; + } + + This->State = KSSTATE_STOP; return STATUS_SUCCESS; } Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_midi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_midi.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_midi.c [iso-8859-1] Wed Feb 18 17:27:10 2009 @@ -172,7 +172,6 @@ /* increment reference on miniport adapter */ Miniport->lpVtbl->AddRef(Miniport); - DbgBreakPoint(); Status = Miniport->lpVtbl->Init(Miniport, UnknownAdapter, ResourceList, iface, &ServiceGroup); if (!NT_SUCCESS(Status)) { @@ -181,8 +180,6 @@ Miniport->lpVtbl->Release(Miniport); return Status; } - - DPRINT1("IMiniportMidi sucessfully init\n"); /* get the miniport device descriptor */ Status = Miniport->lpVtbl->GetDescription(Miniport, &This->pDescriptor); Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c [iso-8859-1] Wed Feb 18 17:27:10 2009 @@ -17,6 +17,12 @@ PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor; }IPortTopologyImpl; +typedef struct +{ + PIRP Irp; + IIrpTarget *Filter; + +}PIN_WORKER_CONTEXT, *PPIN_WORKER_CONTEXT; static GUID InterfaceGuids[2] = { @@ -432,6 +438,43 @@ ISubDevice_fnPinCount }; +VOID +NTAPI +CreatePinWorkerRoutine( + IN PDEVICE_OBJECT DeviceObject, + IN PVOID Context) +{ + NTSTATUS Status; + IIrpTarget *Pin; + PPIN_WORKER_CONTEXT WorkerContext = (PPIN_WORKER_CONTEXT)Context; + + DPRINT("CreatePinWorkerRoutine called\n"); + + Status = WorkerContext->Filter->lpVtbl->NewIrpTarget(WorkerContext->Filter, + &Pin, + NULL, + NULL, + NonPagedPool, + DeviceObject, + WorkerContext->Irp, + NULL); + + DPRINT("CreatePinWorkerRoutine Status %x\n", Status); + + if (NT_SUCCESS(Status)) + { + /* create the dispatch object */ + Status = NewDispatchObject(WorkerContext->Irp, Pin); + DPRINT("Pin %p\n", Pin); + } + + DPRINT1("CreatePinWorkerRoutine completing irp\n"); + WorkerContext->Irp->IoStatus.Status = Status; + WorkerContext->Irp->IoStatus.Information = 0; + IoCompleteRequest(WorkerContext->Irp, IO_SOUND_INCREMENT); +} + + NTSTATUS NTAPI PcCreateItemDispatch( @@ -521,7 +564,6 @@ Status = NewDispatchObject(Irp, Filter); DPRINT1("Filter %p\n", Filter); - DbgBreakPoint(); } else { @@ -534,6 +576,34 @@ if (!wcsncmp(KS_NAME_PIN, Buffer, wcslen(KS_NAME_PIN))) { /* try to create new pin */ + + if (KeGetCurrentIrql() >= APC_LEVEL) + { + PPIN_WORKER_CONTEXT Context = AllocateItem(NonPagedPool, sizeof(PIN_WORKER_CONTEXT), TAG_PORTCLASS); + if (!Context) + { + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + return STATUS_INSUFFICIENT_RESOURCES; + } + Context->Filter = Filter; + Context->Irp = Irp; + + PIO_WORKITEM WorkItem = IoAllocateWorkItem(DeviceObject); + if (!WorkItem) + { + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; + return STATUS_INSUFFICIENT_RESOURCES; + } + + IoQueueWorkItem(WorkItem, CreatePinWorkerRoutine, DelayedWorkQueue, (PVOID)Context); + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = STATUS_PENDING; + IoMarkIrpPending(Irp); + return STATUS_PENDING; + } + Create.CreateItemsCount = 1; Create.CreateItemsList = (PKSOBJECT_CREATE_ITEM)(IoStack->FileObject->FileName.Buffer + (wcslen(KS_NAME_PIN) + 1)); @@ -553,7 +623,8 @@ } } } - + Irp->IoStatus.Information = 0; + Irp->IoStatus.Status = Status; return Status; } Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1] Wed Feb 18 17:27:10 2009 @@ -709,6 +709,14 @@ }; +///-------------------------------------------------------------- +PMINIPORTWAVECYCLIC +GetWaveCyclicMiniport( + IN IPortWaveCyclic* iface) +{ + IPortWaveCyclicImpl * This = (IPortWaveCyclicImpl *)iface; + return This->pMiniport; +} //--------------------------------------------------------------- // IPortWaveCyclic constructor Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] Wed Feb 18 17:27:10 2009 @@ -94,7 +94,15 @@ IN PIRP Irp, IN IIrpTarget * Target); -PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag); +PMINIPORTWAVECYCLIC +GetWaveCyclicMiniport( + IN IPortWaveCyclic* iface); + +PVOID +AllocateItem( + IN POOL_TYPE PoolType, + IN SIZE_T NumberOfBytes, + IN ULONG Tag); VOID FreeItem(
15 years, 10 months
1
0
0
0
[dreimer] 39670: Split off the version displaying and add it to a new command. This speeds up the startup of RosBE. Credits for this Idea go to Colin Finck.
by dreimer@svn.reactos.org
Author: dreimer Date: Wed Feb 18 15:34:48 2009 New Revision: 39670 URL:
http://svn.reactos.org/svn/reactos?rev=39670&view=rev
Log: Split off the version displaying and add it to a new command. This speeds up the startup of RosBE. Credits for this Idea go to Colin Finck. Added: trunk/tools/RosBE/RosBE-Windows/Powershell/version.ps1 (with props) trunk/tools/RosBE/RosBE-Windows/Root/version.cmd (with props) Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1 trunk/tools/RosBE/RosBE-Windows/Powershell/charch.ps1 trunk/tools/RosBE/RosBE-Windows/Powershell/chdefgcc.ps1 trunk/tools/RosBE/RosBE-Windows/Powershell/rosbe-gcc-env.ps1 trunk/tools/RosBE/RosBE-Windows/Root/RosBE.cmd trunk/tools/RosBE/RosBE-Windows/Root/RosBE.mac trunk/tools/RosBE/RosBE-Windows/Root/charch.cmd trunk/tools/RosBE/RosBE-Windows/Root/chdefgcc.cmd trunk/tools/RosBE/RosBE-Windows/Root/rosbe-gcc-env.cmd trunk/tools/RosBE/RosBE-Windows/RosBE.nsi Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1 URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershe…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1 [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Powershell/RosBE.ps1 [iso-8859-1] Wed Feb 18 15:34:48 2009 @@ -58,8 +58,6 @@ "* *" "*******************************************************************************" "" - "" - (get-WmiObject Win32_OperatingSystem).caption # # Set the correct path for the build tools and set the MinGW make. # @@ -113,6 +111,8 @@ if (Test-Path "$_ROSBE_BASEDIR\update.ps1") { set-alias UPDATE "$_ROSBE_BASEDIR\update.ps1" -scope Global } + + set-alias VERSION "$_ROSBE_BASEDIR\version.ps1" -scope Global if (Test-Path "$_ROSBE_BASEDIR\options.ps1") { set-alias OPTIONS "$_ROSBE_BASEDIR\options.ps1" -scope Global Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/charch.ps1 URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershe…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Powershell/charch.ps1 [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Powershell/charch.ps1 [iso-8859-1] Wed Feb 18 15:34:48 2009 @@ -18,6 +18,7 @@ # function SYSPARAM { IEX "& '$_ROSBE_BASEDIR\rosbe-gcc-env.ps1'" + version } if ($args.count -eq 0) { # Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/chdefgcc.ps1 URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershe…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Powershell/chdefgcc.ps1 [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Powershell/chdefgcc.ps1 [iso-8859-1] Wed Feb 18 15:34:48 2009 @@ -20,6 +20,7 @@ function EOA { IEX "&'$_ROSBE_BASEDIR\rosbe-gcc-env.cmd' chdefgcc" settitle + version } # Modified: trunk/tools/RosBE/RosBE-Windows/Powershell/rosbe-gcc-env.ps1 URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershe…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Powershell/rosbe-gcc-env.ps1 [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Powershell/rosbe-gcc-env.ps1 [iso-8859-1] Wed Feb 18 15:34:48 2009 @@ -111,43 +111,3 @@ $ENV:TARGET_CFLAGS = $null $ENV:TARGET_CPPFLAGS = $null } -# -# Display the current version of GCC, NASM, ld and make. -# - -(select-string -path .\gcctvers.tmp "gcc version") -replace ".*: (.+?)\b",'$1' -"gcc target - $_ROSBE_GCCTARGET" -remove-item gcctvers.tmp - -if ($ENV:ROS_ARCH -ne $null) { - & "$_ROSBE_TARGET_MINGWPATH\bin\$ENV:ROS_PREFIX-ld" -v -} else { - & ld -v -} -if (Test-Path "$_ROSBE_HOST_MINGWPATH\bin\nasm.exe") { - & nasm -v -} else { - if (Test-Path "$_ROSBE_HOST_MINGWPATH\bin\yasm.exe") { - & yasm --version | select-string "yasm 0" - } else { - if ($_ROSBE_MODE -eq "RosBE") { - "ERROR: NASM or YASM is required to build ReactOS, none was found in the current MinGW/GCC." - } - } -} -if (Test-Path "$_ROSBE_HOST_MINGWPATH\bin\bison.exe") { - & bison '--version' | select-string "GNU Bison" -} else { - if ($_ROSBE_MODE -eq "RosBE") { - "WARNING: Bison will soon be required to build ReactOS, none was found in the current MinGW/GCC." - } -} -if (Test-Path "$_ROSBE_HOST_MINGWPATH\bin\flex.exe") { - $fver = (& flex '--version') -replace ".*version ((\d|\.)+).*",'$1' - "flex $fver" -} else { - if ($_ROSBE_MODE -eq "RosBE") { - "WARNING: Flex will soon be required to build ReactOS, none was found in the current MinGW/GCC." - } -} -& mingw32-make -v | & find "GNU Make" Added: trunk/tools/RosBE/RosBE-Windows/Powershell/version.ps1 URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Powershe…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Powershell/version.ps1 (added) +++ trunk/tools/RosBE/RosBE-Windows/Powershell/version.ps1 [iso-8859-1] Wed Feb 18 15:34:48 2009 @@ -1,0 +1,46 @@ +# +# PROJECT: RosBE - ReactOS Build Environment for Windows +# LICENSE: GNU General Public License v2. (see LICENSE.txt) +# FILE: Root/version.ps1 +# PURPOSE: Display the current version of GCC, NASM, ld and make. +# COPYRIGHT: Copyright 2009 Daniel Reimer <reimer.daniel(a)freenet.de> +# + +(get-WmiObject Win32_OperatingSystem).caption + +(select-string -path .\gcctvers.tmp "gcc version") -replace ".*: (.+?)\b",'$1' +"gcc target - $_ROSBE_GCCTARGET" +remove-item gcctvers.tmp + +if ($ENV:ROS_ARCH -ne $null) { + & "$_ROSBE_TARGET_MINGWPATH\bin\$ENV:ROS_PREFIX-ld" -v +} else { + & ld -v +} +if (Test-Path "$_ROSBE_HOST_MINGWPATH\bin\nasm.exe") { + & nasm -v +} else { + if (Test-Path "$_ROSBE_HOST_MINGWPATH\bin\yasm.exe") { + & yasm --version | select-string "yasm 0" + } else { + if ($_ROSBE_MODE -eq "RosBE") { + "ERROR: NASM or YASM is required to build ReactOS, none was found in the current MinGW/GCC." + } + } +} +if (Test-Path "$_ROSBE_HOST_MINGWPATH\bin\bison.exe") { + & bison '--version' | select-string "GNU Bison" +} else { + if ($_ROSBE_MODE -eq "RosBE") { + "WARNING: Bison will soon be required to build ReactOS, none was found in the current MinGW/GCC." + } +} +if (Test-Path "$_ROSBE_HOST_MINGWPATH\bin\flex.exe") { + $fver = (& flex '--version') -replace ".*version ((\d|\.)+).*",'$1' + "flex $fver" +} else { + if ($_ROSBE_MODE -eq "RosBE") { + "WARNING: Flex will soon be required to build ReactOS, none was found in the current MinGW/GCC." + } +} +& mingw32-make -v | & find "GNU Make" Propchange: trunk/tools/RosBE/RosBE-Windows/Powershell/version.ps1 ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/tools/RosBE/RosBE-Windows/Root/RosBE.cmd URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Root/Ros…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Root/RosBE.cmd [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Root/RosBE.cmd [iso-8859-1] Wed Feb 18 15:34:48 2009 @@ -123,8 +123,6 @@ echo * * echo ******************************************************************************* echo. -echo. -ver :: :: Set the correct path for the build tools and set the MinGW make. Modified: trunk/tools/RosBE/RosBE-Windows/Root/RosBE.mac URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Root/Ros…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Root/RosBE.mac [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Root/RosBE.mac [iso-8859-1] Wed Feb 18 15:34:48 2009 @@ -15,3 +15,4 @@ SVN = "%_ROSBE_BASEDIR%\Tools\svn.exe" $* UPDATE = "%_ROSBE_BASEDIR%\update.cmd" $* OPTIONS = "%_ROSBE_BASEDIR%\options.cmd" $* +VERSION = "%_ROSBE_BASEDIR%\version.cmd" $* Modified: trunk/tools/RosBE/RosBE-Windows/Root/charch.cmd URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Root/cha…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Root/charch.cmd [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Root/charch.cmd [iso-8859-1] Wed Feb 18 15:34:48 2009 @@ -37,6 +37,7 @@ :EOA call "%_ROSBE_BASEDIR%\rosbe-gcc-env.cmd" +"%_ROSBE_BASEDIR%\version.cmd" goto :EOC :: Modified: trunk/tools/RosBE/RosBE-Windows/Root/chdefgcc.cmd URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Root/chd…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Root/chdefgcc.cmd [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Root/chdefgcc.cmd [iso-8859-1] Wed Feb 18 15:34:48 2009 @@ -57,6 +57,7 @@ :EOA call "%_ROSBE_BASEDIR%\rosbe-gcc-env.cmd" chdefgcc +"%_ROSBE_BASEDIR%\version.cmd" goto :EOC :INTERACTIVE Modified: trunk/tools/RosBE/RosBE-Windows/Root/rosbe-gcc-env.cmd URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Root/ros…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Root/rosbe-gcc-env.cmd [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/Root/rosbe-gcc-env.cmd [iso-8859-1] Wed Feb 18 15:34:48 2009 @@ -124,50 +124,3 @@ set TARGET_CFLAGS= set TARGET_CPPFLAGS= ) -:: -:: Display the current version of GCC, NASM, ld and make. -:: -if not "%ROS_ARCH%" == "" ( - "%_ROSBE_TARGET_MINGWPATH%\bin\%ROS_PREFIX%-gcc" -v 2>&1 | find "gcc version" - if "%ROS_PREFIX%" == "" ( - echo gcc target^: %_ROSBE_GCCTARGET% - ) else ( - echo gcc target^: %ROS_PREFIX:~0,-11% - ) - "%_ROSBE_TARGET_MINGWPATH%\bin\%ROS_PREFIX%-ld" -v -) else ( - gcc -v 2>&1 | find "gcc version" - if "%ROS_PREFIX%" == "" ( - echo gcc target^: %_ROSBE_GCCTARGET% - ) else ( - echo gcc target^: %ROS_PREFIX:~0,-11% - ) - ld -v -) - -if exist "%_ROSBE_HOST_MINGWPATH%\bin\nasm.exe" ( - nasm -v -) else ( - if exist "%_ROSBE_HOST_MINGWPATH%\bin\yasm.exe" ( - yasm --version | find "yasm 0" - ) else ( - if "%_ROSBE_MODE%" == "RosBE" ( - echo ERROR: NASM or YASM is required to build ReactOS, none was found in the current MinGW/GCC. - ) - ) -) -if exist "%_ROSBE_HOST_MINGWPATH%\bin\bison.exe" ( - bison --version | find "GNU Bison" -) else ( - if "%_ROSBE_MODE%" == "RosBE" ( - echo WARNING: Bison will soon be required to build ReactOS, none was found in the current MinGW/GCC. - ) -) -if exist "%_ROSBE_HOST_MINGWPATH%\bin\flex.exe" ( - flex --version -) else ( - if "%_ROSBE_MODE%" == "RosBE" ( - echo WARNING: Flex will soon be required to build ReactOS, none was found in the current MinGW/GCC. - ) -) -mingw32-make -v | find "GNU Make" Added: trunk/tools/RosBE/RosBE-Windows/Root/version.cmd URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Root/ver…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/Root/version.cmd (added) +++ trunk/tools/RosBE/RosBE-Windows/Root/version.cmd [iso-8859-1] Wed Feb 18 15:34:48 2009 @@ -1,0 +1,60 @@ +:: +:: PROJECT: RosBE - ReactOS Build Environment for Windows +:: LICENSE: GNU General Public License v2. (see LICENSE.txt) +:: FILE: Root/version.cmd +:: PURPOSE: Display the current version of GCC, NASM, ld and make. +:: COPYRIGHT: Copyright 2009 Daniel Reimer <reimer.daniel(a)freenet.de> +:: +:: +@echo off +if not defined _ROSBE_DEBUG set _ROSBE_DEBUG=0 +if %_ROSBE_DEBUG% == 1 ( + @echo on +) + +ver + +if not "%ROS_ARCH%" == "" ( + "%_ROSBE_TARGET_MINGWPATH%\bin\%ROS_PREFIX%-gcc" -v 2>&1 | find "gcc version" + if "%ROS_PREFIX%" == "" ( + echo gcc target^: %_ROSBE_GCCTARGET% + ) else ( + echo gcc target^: %ROS_PREFIX:~0,-11% + ) + "%_ROSBE_TARGET_MINGWPATH%\bin\%ROS_PREFIX%-ld" -v +) else ( + gcc -v 2>&1 | find "gcc version" + if "%ROS_PREFIX%" == "" ( + echo gcc target^: %_ROSBE_GCCTARGET% + ) else ( + echo gcc target^: %ROS_PREFIX:~0,-11% + ) + ld -v +) + +if exist "%_ROSBE_HOST_MINGWPATH%\bin\nasm.exe" ( + nasm -v +) else ( + if exist "%_ROSBE_HOST_MINGWPATH%\bin\yasm.exe" ( + yasm --version | find "yasm 0" + ) else ( + if "%_ROSBE_MODE%" == "RosBE" ( + echo ERROR: NASM or YASM is required to build ReactOS, none was found in the current MinGW/GCC. + ) + ) +) +if exist "%_ROSBE_HOST_MINGWPATH%\bin\bison.exe" ( + bison --version | find "GNU Bison" +) else ( + if "%_ROSBE_MODE%" == "RosBE" ( + echo WARNING: Bison will soon be required to build ReactOS, none was found in the current MinGW/GCC. + ) +) +if exist "%_ROSBE_HOST_MINGWPATH%\bin\flex.exe" ( + flex --version +) else ( + if "%_ROSBE_MODE%" == "RosBE" ( + echo WARNING: Flex will soon be required to build ReactOS, none was found in the current MinGW/GCC. + ) +) +mingw32-make -v | find "GNU Make" Propchange: trunk/tools/RosBE/RosBE-Windows/Root/version.cmd ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/tools/RosBE/RosBE-Windows/RosBE.nsi URL:
http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/RosBE.ns…
============================================================================== --- trunk/tools/RosBE/RosBE-Windows/RosBE.nsi [iso-8859-1] (original) +++ trunk/tools/RosBE/RosBE-Windows/RosBE.nsi [iso-8859-1] Wed Feb 18 15:34:48 2009 @@ -124,6 +124,7 @@ File /r Root\RosBE.cmd File /r Root\rosbe-gcc-env.cmd File /r Root\TimeDate.cmd + File /r Root\version.cmd SetOutPath "$INSTDIR\Tools" SetOverwrite try File /r Components\Tools\buildtime.exe @@ -252,6 +253,7 @@ File /r Components\Powershell\scut.ps1 File /r Components\Powershell\sSVN.ps1 File /r Components\Powershell\update.ps1 + File /r Components\Powershell\version.ps1 SectionEnd Section "Update Script" SEC11 @@ -354,20 +356,26 @@ Delete /REBOOTOK "$INSTDIR\Clean.cmd" Delete /REBOOTOK "$INSTDIR\Clean.ps1" Delete /REBOOTOK "$INSTDIR\Config.cmd" + Delete /REBOOTOK "$INSTDIR\Config.sp1" Delete /REBOOTOK "$INSTDIR\Help.cmd" Delete /REBOOTOK "$INSTDIR\Help.ps1" Delete /REBOOTOK "$INSTDIR\MinGW.cmd" Delete /REBOOTOK "$INSTDIR\MinGW.ps1" Delete /REBOOTOK "$INSTDIR\options.cmd" + Delete /REBOOTOK "$INSTDIR\options.ps1" Delete /REBOOTOK "$INSTDIR\reladdr2line.cmd" + Delete /REBOOTOK "$INSTDIR\reladdr2line.ps1" Delete /REBOOTOK "$INSTDIR\RosBE.cmd" Delete /REBOOTOK "$INSTDIR\RosBE.ps1" Delete /REBOOTOK "$INSTDIR\rosbe-gcc-env.cmd" Delete /REBOOTOK "$INSTDIR\rosbe-gcc-env.ps1" Delete /REBOOTOK "$INSTDIR\scut.cmd" + Delete /REBOOTOK "$INSTDIR\scut.ps1" Delete /REBOOTOK "$INSTDIR\sSVN.cmd" + Delete /REBOOTOK "$INSTDIR\sSVN.ps1" Delete /REBOOTOK "$INSTDIR\TimeDate.cmd" Delete /REBOOTOK "$INSTDIR\update.cmd" + Delete /REBOOTOK "$INSTDIR\update.ps1" Delete /REBOOTOK "$INSTDIR\README.pdf" Delete /REBOOTOK "$INSTDIR\rosbe.ico" Delete /REBOOTOK "$INSTDIR\mingw.ico" @@ -378,6 +386,8 @@ Delete /REBOOTOK "$INSTDIR\LICENSE.txt" Delete /REBOOTOK "$INSTDIR\srclist.txt" Delete /REBOOTOK "$INSTDIR\config.rbuild" + Delete /REBOOTOK "$INSTDIR\version.cmd" + Delete /REBOOTOK "$INSTDIR\version.ps1" Delete /REBOOTOK "$INSTDIR\Uninstall-${PRODUCT_VERSION}.exe" ;; Whoever dares to change this back into: RMDir /r /REBOOTOK "$INSTDIR" will be KILLED!!! RMDir /REBOOTOK "$INSTDIR"
15 years, 10 months
1
0
0
0
[silverblade] 39669: Rewrite DoWaveStreaming (makes CommitWaveHeaderToKernelDevice redundant). Tested with Media Player and NT's Sound Blaster 16 kernel-mode driver on Windows NT4. Audio buffers play correctly and don't suffer from the stuttering problem that my previous revision of this code did.
by silverblade@svn.reactos.org
Author: silverblade Date: Wed Feb 18 15:26:28 2009 New Revision: 39669 URL:
http://svn.reactos.org/svn/reactos?rev=39669&view=rev
Log: Rewrite DoWaveStreaming (makes CommitWaveHeaderToKernelDevice redundant). Tested with Media Player and NT's Sound Blaster 16 kernel-mode driver on Windows NT4. Audio buffers play correctly and don't suffer from the stuttering problem that my previous revision of this code did. Modified: trunk/reactos/include/reactos/libs/sound/mmebuddy.h trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c Modified: trunk/reactos/include/reactos/libs/sound/mmebuddy.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/sound…
============================================================================== --- trunk/reactos/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] Wed Feb 18 15:26:28 2009 @@ -595,7 +595,7 @@ wave/streaming.c */ -MMRESULT +VOID DoWaveStreaming( IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance); Modified: trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmebuddy…
============================================================================== --- trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c [iso-8859-1] Wed Feb 18 15:26:28 2009 @@ -21,7 +21,7 @@ */ #define SOUND_KERNEL_BUFFER_COUNT 10 -#define SOUND_KERNEL_BUFFER_SIZE 200000 +#define SOUND_KERNEL_BUFFER_SIZE 16384 /* @@ -29,13 +29,15 @@ Check if there is streaming to be done, and if so, do it. */ -MMRESULT +VOID DoWaveStreaming( IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) { MMRESULT Result; PSOUND_DEVICE SoundDevice; PMMFUNCTION_TABLE FunctionTable; + PWAVEHDR Header; + PWAVEHDR_EXTENSION HeaderExtension; Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); SND_ASSERT( MMSUCCESS(Result) ); @@ -45,6 +47,91 @@ SND_ASSERT( FunctionTable ); SND_ASSERT( FunctionTable->CommitWaveBuffer ); + /* No point in doing anything if no resources available to use */ + if ( SoundDeviceInstance->OutstandingBuffers >= SOUND_KERNEL_BUFFER_COUNT ) + { + SND_TRACE(L"DoWaveStreaming: No available buffers to stream with - doing nothing\n"); + return; + } + + /* Is there any work to do? */ + Header = SoundDeviceInstance->HeadWaveHeader; + + if ( ! Header ) + { + SND_TRACE(L"DoWaveStreaming: No work to do - doing nothing\n"); + return; + } + + while ( ( SoundDeviceInstance->OutstandingBuffers < SOUND_KERNEL_BUFFER_COUNT ) && + ( Header ) ) + { + HeaderExtension = (PWAVEHDR_EXTENSION) Header->reserved; + SND_ASSERT( HeaderExtension ); + + /* Can never be *above* the length */ + SND_ASSERT( HeaderExtension->BytesCommitted <= Header->dwBufferLength ); + + if ( HeaderExtension->BytesCommitted == Header->dwBufferLength ) + { + Header = Header->lpNext; + } + else + { + PSOUND_OVERLAPPED Overlap; + LPVOID OffsetPtr; + DWORD BytesRemaining, BytesToCommit; + BOOL OK; + + /* Where within the header buffer to stream from */ + OffsetPtr = Header->lpData + HeaderExtension->BytesCommitted; + + /* How much of this header has not been committed */ + BytesRemaining = Header->dwBufferLength - HeaderExtension->BytesCommitted; + + /* We can commit anything up to the buffer size limit */ + BytesToCommit = BytesRemaining > SOUND_KERNEL_BUFFER_SIZE ? + SOUND_KERNEL_BUFFER_SIZE : + BytesRemaining; + + /* Should always have something to commit by this point */ + SND_ASSERT( BytesToCommit > 0 ); + + /* We need a new overlapped info structure for each buffer */ + Overlap = AllocateStruct(SOUND_OVERLAPPED); + + if ( Overlap ) + { + ZeroMemory(Overlap, sizeof(SOUND_OVERLAPPED)); + Overlap->SoundDeviceInstance = SoundDeviceInstance; + Overlap->Header = Header; + + /* Adjust the commit-related counters */ + HeaderExtension->BytesCommitted += BytesToCommit; + ++ SoundDeviceInstance->OutstandingBuffers; + + OK = MMSUCCESS(FunctionTable->CommitWaveBuffer(SoundDeviceInstance, + OffsetPtr, + BytesToCommit, + Overlap, + CompleteIO)); + + if ( ! OK ) + { + /* Clean-up and try again on the next iteration (is this OK?) */ + SND_WARN(L"FAILED\n"); + + FreeMemory(Overlap); + HeaderExtension->BytesCommitted -= BytesToCommit; + -- SoundDeviceInstance->OutstandingBuffers; + } + } + } + } + + +#if 0 + // HACK SND_TRACE(L"Calling buffer submit routine\n"); @@ -68,6 +155,7 @@ } return Result; +#endif }
15 years, 10 months
1
0
0
0
[janderwald] 39668: - Fix implementation of KsAddObjectCreateItemToDeviceHeader - Hackplement KsAllocateObjectCreateItem - Fix implementation of KsAllocateObjectHeader and store the result either in the passed irp or device header - Implement Reading / Writing / DeviceIoControl / Flush / QuerySecurity / SetSecurity operation using the object file header - Implement KsSynchronousIoControlDevice function
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Feb 18 14:05:33 2009 New Revision: 39668 URL:
http://svn.reactos.org/svn/reactos?rev=39668&view=rev
Log: - Fix implementation of KsAddObjectCreateItemToDeviceHeader - Hackplement KsAllocateObjectCreateItem - Fix implementation of KsAllocateObjectHeader and store the result either in the passed irp or device header - Implement Reading / Writing / DeviceIoControl / Flush / QuerySecurity / SetSecurity operation using the object file header - Implement KsSynchronousIoControlDevice function Modified: trunk/reactos/drivers/ksfilter/ks/irp.c trunk/reactos/drivers/ksfilter/ks/kstypes.h trunk/reactos/drivers/ksfilter/ks/misc.c trunk/reactos/drivers/ksfilter/ks/priv.h trunk/reactos/drivers/ksfilter/ks/topology.c Modified: trunk/reactos/drivers/ksfilter/ks/irp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/irp.c?…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] Wed Feb 18 14:05:33 2009 @@ -61,98 +61,118 @@ IN PSECURITY_DESCRIPTOR SecurityDescriptor) { PKSIDEVICE_HEADER Header; - PKSOBJECT_CREATE_ITEM ItemList; - PKSIOBJECT_HEADER ObjectList; + ULONG FreeIndex, Index; Header = (PKSIDEVICE_HEADER)DevHeader; + DPRINT1("KsAddObjectCreateItemToDeviceHeader entered\n"); + + /* check if a device header has been provided */ if (!DevHeader) return STATUS_INVALID_PARAMETER_1; + /* check if a create item has been provided */ if (!Create) return STATUS_INVALID_PARAMETER_2; + /* check if a object class has been provided */ if (!ObjectClass) return STATUS_INVALID_PARAMETER_4; - if (Header->FreeIndex >= Header->MaxItems && Header->ItemsListProvided) - return STATUS_ALLOTTED_SPACE_EXCEEDED; - - if (Header->FreeIndex >= Header->MaxItems) - { - ItemList = ExAllocatePoolWithTag(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM) * (Header->MaxItems + 1), TAG('H','D','S','K')); - if (!ItemList) + FreeIndex = (ULONG)-1; + /* now scan the list and check for a free item */ + for(Index = 0; Index < Header->MaxItems; Index++) + { + if (!Header->ItemList[Index].bCreated) + { + if (FreeIndex == (ULONG)-1) + FreeIndex = Index; + + continue; + } + else if (!wcsicmp(ObjectClass, Header->ItemList[Index].CreateItem.ObjectClass.Buffer)) + { + /* the same object class already exists */ + return STATUS_OBJECT_NAME_COLLISION; + } + } + /* found a free index */ + if (FreeIndex == (ULONG)-1) + { + /* allocate a new device entry */ + PDEVICE_ITEM Item = ExAllocatePoolWithTag(NonPagedPool, sizeof(DEVICE_ITEM) * (Header->MaxItems + 1), TAG_DEVICE_HEADER); + if (!Item) return STATUS_INSUFFICIENT_RESOURCES; - ObjectList = ExAllocatePoolWithTag(PagedPool, sizeof(KSIOBJECT_HEADER) * (Header->MaxItems + 1), TAG('H','D','S','K')); - if (!ObjectList) - { - ExFreePoolWithTag(ItemList, TAG('H','D','S','K')); - return STATUS_INSUFFICIENT_RESOURCES; - } - - RtlMoveMemory(ItemList, Header->ItemsList, Header->MaxItems * sizeof(KSOBJECT_CREATE_ITEM)); - ExFreePoolWithTag(Header->ItemsList, TAG('H','D','S','K')); - - RtlMoveMemory(ObjectList, Header->ObjectList, Header->MaxItems * sizeof(KSIOBJECT_HEADER)); - ExFreePoolWithTag(Header->ObjectList, TAG('H','D','S','K')); - + RtlMoveMemory(Item, Header->ItemList, Header->MaxItems * sizeof(DEVICE_ITEM)); + ExFreePoolWithTag(Header->ItemList, TAG_DEVICE_HEADER); + + Header->ItemList = Item; + FreeIndex = Header->MaxItems; Header->MaxItems++; - Header->ItemsList = ItemList; - } - - if (Header->FreeIndex < Header->MaxItems) - { - Header->ItemsList[Header->FreeIndex].Context = Context; - Header->ItemsList[Header->FreeIndex].Create = Create; - Header->ItemsList[Header->FreeIndex].Flags = 0; - RtlInitUnicodeString(&Header->ItemsList[Header->FreeIndex].ObjectClass, ObjectClass); - Header->ItemsList[Header->FreeIndex].SecurityDescriptor = SecurityDescriptor; - - Header->FreeIndex++; - return STATUS_SUCCESS; - } - - return STATUS_ALLOTTED_SPACE_EXCEEDED; + } + + /* store the new item */ + Header->ItemList[FreeIndex].bCreated = TRUE; + Header->ItemList[FreeIndex].CreateItem.Create = Create; + Header->ItemList[FreeIndex].CreateItem.Context = Context; + RtlInitUnicodeString(&Header->ItemList[FreeIndex].CreateItem.ObjectClass, ObjectClass); + Header->ItemList[FreeIndex].CreateItem.SecurityDescriptor = SecurityDescriptor; + Header->ItemList[FreeIndex].CreateItem.Flags = 0; + return STATUS_SUCCESS; } /* @implemented */ -KSDDKAPI NTSTATUS NTAPI +KSDDKAPI +NTSTATUS +NTAPI KsAllocateDeviceHeader( OUT KSDEVICE_HEADER* OutHeader, IN ULONG ItemsCount, IN PKSOBJECT_CREATE_ITEM ItemsList OPTIONAL) { + ULONG Index = 0; PKSIDEVICE_HEADER Header; if (!OutHeader) return STATUS_INVALID_PARAMETER; - Header = ExAllocatePoolWithTag(PagedPool, sizeof(KSIDEVICE_HEADER), TAG('H','D','S','K')); - + /* allocate a device header */ + Header = ExAllocatePoolWithTag(PagedPool, sizeof(KSIDEVICE_HEADER), TAG_DEVICE_HEADER); + + /* check for success */ if (!Header) return STATUS_INSUFFICIENT_RESOURCES; + /* clear all memory */ RtlZeroMemory(Header, sizeof(KSIDEVICE_HEADER)); - if (ItemsCount) - { - Header->ObjectList = ExAllocatePoolWithTag(PagedPool, sizeof(KSIOBJECT_HEADER) * ItemsCount, TAG('H','D','S','K')); - if (!Header->ObjectList) + /* initialize spin lock */ + KeInitializeSpinLock(&Header->ItemListLock); + + /* are there any create items provided */ + if (ItemsCount && ItemsList) + { + /* allocate space for device item list */ + Header->ItemList = ExAllocatePoolWithTag(NonPagedPool, sizeof(DEVICE_ITEM) * ItemsCount, TAG_DEVICE_HEADER); + if (!Header->ItemList) { - ExFreePoolWithTag(Header, TAG('H','D','S','K')); + ExFreePoolWithTag(Header, TAG_DEVICE_HEADER); return STATUS_INSUFFICIENT_RESOURCES; } - RtlZeroMemory(Header->ObjectList, sizeof(KSIOBJECT_HEADER) * ItemsCount); - } - - Header->MaxItems = ItemsCount; - Header->FreeIndex = 0; - Header->ItemsList = ItemsList; - Header->ItemsListProvided = (ItemsList != NULL) ? TRUE : FALSE; - + RtlZeroMemory(Header->ItemList, sizeof(DEVICE_ITEM) * ItemsCount); + + for(Index = 0; Index < ItemsCount; Index++) + { + /* copy provided create items */ + RtlMoveMemory(&Header->ItemList[Index], &ItemsList[Index], sizeof(KSOBJECT_CREATE_ITEM)); + } + Header->MaxItems = ItemsCount; + } + + /* store result */ *OutHeader = Header; return STATUS_SUCCESS; @@ -185,25 +205,31 @@ //FIXME //handle ItemFreeCallback // - - UNIMPLEMENTED - return STATUS_UNSUCCESSFUL; -} - - -/* - @unimplemented -*/ -KSDDKAPI VOID NTAPI + if (AllocateEntry && ItemFreeCallback) + DPRINT1("Ignoring ItemFreeCallback\n"); + + return KsAddObjectCreateItemToDeviceHeader(DevHeader, CreateItem->Create, CreateItem->Context, CreateItem->ObjectClass.Buffer, CreateItem->SecurityDescriptor); +} + + +/* + @implemented +*/ +KSDDKAPI +VOID +NTAPI KsFreeDeviceHeader( - IN KSDEVICE_HEADER Header) -{ - if (!Header) + IN KSDEVICE_HEADER DevHeader) +{ + PKSIDEVICE_HEADER Header; + + Header = (PKSIDEVICE_HEADER)DevHeader; + + if (!DevHeader) return; - /* TODO: Free content first */ - - ExFreePoolWithTag(Header, TAG('H','D','S','K')); + ExFreePoolWithTag(Header->ItemList, TAG_DEVICE_HEADER); + ExFreePoolWithTag(Header, TAG_DEVICE_HEADER); } /* @@ -239,8 +265,11 @@ IN PIRP Irp, IN KSDISPATCH_TABLE* Table) { + PIO_STACK_LOCATION IoStack; + PDEVICE_EXTENSION DeviceExtension; PKSIDEVICE_HEADER DeviceHeader; - ULONG Index; + PKSIOBJECT_HEADER ObjectHeader; + WCHAR ObjectClass[50]; if (!Header) return STATUS_INVALID_PARAMETER_1; @@ -248,14 +277,75 @@ if (!Irp) return STATUS_INVALID_PARAMETER_4; - DeviceHeader = (PKSIDEVICE_HEADER)Irp->Tail.Overlay.DriverContext[3]; - Index = (ULONG)Irp->Tail.Overlay.DriverContext[2]; - - RtlCopyMemory(&DeviceHeader->ObjectList[Index].DispatchTable, Table, sizeof(KSDISPATCH_TABLE)); - DeviceHeader->ObjectList[Index].CreateItem = ItemsList; - DeviceHeader->ObjectList[Index].Initialized = TRUE; - - *Header = &DeviceHeader->ObjectList[Index]; + if (!Table) + return STATUS_INVALID_PARAMETER_5; + + /* get current stack location */ + IoStack = IoGetCurrentIrpStackLocation(Irp); + /* get device extension */ + DeviceExtension = (PDEVICE_EXTENSION)IoStack->DeviceObject->DeviceExtension; + /* get device header */ + DeviceHeader = DeviceExtension->DeviceHeader; + + ObjectClass[0] = L'\0'; + /* check for an file object */ + if (IoStack->FileObject != NULL) + { + /* validate the file name */ + if (IoStack->FileObject->FileName.Length >= 38) + { + RtlMoveMemory(ObjectClass, IoStack->FileObject->FileName.Buffer, 38 * sizeof(WCHAR)); + ObjectClass[38] = L'\0'; + DPRINT1("ObjectClass %S\n", ObjectClass); + } + } + /* allocate the object header */ + ObjectHeader = ExAllocatePoolWithTag(NonPagedPool, sizeof(KSIOBJECT_HEADER), TAG_DEVICE_HEADER); + if (!ObjectHeader) + return STATUS_INSUFFICIENT_RESOURCES; + + /* initialize object header */ + RtlZeroMemory(ObjectHeader, sizeof(KSIOBJECT_HEADER)); + + /* do we have a name */ + if (ObjectClass[0]) + { + ObjectHeader->ObjectClass = ExAllocatePoolWithTag(NonPagedPool, 40 * sizeof(WCHAR), TAG_DEVICE_HEADER); + if (ObjectHeader->ObjectClass) + { + wcscpy(ObjectHeader->ObjectClass, ObjectClass); + } + } + + /* copy dispatch table */ + RtlCopyMemory(&ObjectHeader->DispatchTable, Table, sizeof(KSDISPATCH_TABLE)); + /* store create items */ + if (ItemsCount && ItemsList) + { + ObjectHeader->ItemCount = ItemsCount; + ObjectHeader->CreateItem = ItemsList; + } + + /* was the request for a pin/clock/node */ + if (IoStack->FileObject) + { + /* store the object in the file object */ + ASSERT(IoStack->FileObject->FsContext == NULL); + IoStack->FileObject->FsContext = ObjectHeader; + } + else + { + /* the object header is for device */ + ASSERT(DeviceHeader->DeviceIndex < DeviceHeader->MaxItems); + DeviceHeader->ItemList[DeviceHeader->DeviceIndex].ObjectHeader = ObjectHeader; + } + + /* store result */ + *Header = ObjectHeader; + + + DPRINT1("KsAllocateObjectHeader ObjectClass %S FileObject %p, ObjectHeader %p\n", ObjectClass, IoStack->FileObject, ObjectHeader); + return STATUS_SUCCESS; } @@ -263,15 +353,14 @@ /* @unimplemented */ -KSDDKAPI VOID NTAPI +KSDDKAPI +VOID +NTAPI KsFreeObjectHeader( IN PVOID Header) { - ExFreePoolWithTag(Header, TAG('H','O','S','K')); - - /* TODO */ - - UNIMPLEMENTED; + + } /* @@ -568,33 +657,34 @@ PDEVICE_EXTENSION DeviceExtension; PKSIDEVICE_HEADER DeviceHeader; ULONG Index; - NTSTATUS Status; - + NTSTATUS Status = STATUS_SUCCESS; + KIRQL OldLevel; + + DPRINT1("KS / CREATE\n"); + /* get current stack location */ IoStack = IoGetCurrentIrpStackLocation(Irp); - + /* get device extension */ DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension; + /* get device header */ DeviceHeader = DeviceExtension->DeviceHeader; - DPRINT1("KS / Create\n"); - - /* first call all create handlers */ - for(Index = 0; Index < DeviceHeader->FreeIndex; Index++) - { - KSCREATE_ITEM_IRP_STORAGE(Irp) = &DeviceHeader->ItemsList[Index]; - - Irp->Tail.Overlay.DriverContext[3] = (PVOID)DeviceHeader; - Irp->Tail.Overlay.DriverContext[2] = (PVOID)Index; - - DeviceHeader->ObjectList[Index].Initialized = FALSE; - Status = DeviceHeader->ItemsList[Index].Create(DeviceObject, Irp); - if (!NT_SUCCESS(Status)) + /* acquire list lock */ + KeAcquireSpinLock(&DeviceHeader->ItemListLock, &OldLevel); + /* loop all device items */ + for(Index = 0; Index < DeviceHeader->MaxItems; Index++) + { + if (DeviceHeader->ItemList[Index].bCreated && DeviceHeader->ItemList[Index].ObjectHeader == NULL) { - DeviceHeader->ObjectList[Index].Initialized = FALSE; + DeviceHeader->DeviceIndex = Index; + /* set object create item */ + KSCREATE_ITEM_IRP_STORAGE(Irp) = &DeviceHeader->ItemList[Index].CreateItem; + Status = DeviceHeader->ItemList[Index].CreateItem.Create(DeviceObject, Irp); } } - - return STATUS_SUCCESS; + /* release lock */ + KeReleaseSpinLock(&DeviceHeader->ItemListLock, OldLevel); + return Status; } static NTAPI @@ -604,148 +694,193 @@ IN PIRP Irp) { PIO_STACK_LOCATION IoStack; - PDEVICE_EXTENSION DeviceExtension; - PKSIDEVICE_HEADER DeviceHeader; - ULONG Index; - NTSTATUS Status; + PKSIOBJECT_HEADER ObjectHeader; + + /* get current stack location */ + IoStack = IoGetCurrentIrpStackLocation(Irp); DPRINT1("KS / CLOSE\n"); + if (IoStack->FileObject && IoStack->FileObject->FsContext) + { + ObjectHeader = (PKSIOBJECT_HEADER) IoStack->FileObject->FsContext; + + KSCREATE_ITEM_IRP_STORAGE(Irp) = ObjectHeader->CreateItem; + return ObjectHeader->DispatchTable.Close(DeviceObject, Irp); + } + else + { + DPRINT1("Expected Object Header\n"); + return STATUS_SUCCESS; + } +} + +static NTAPI +NTSTATUS +KsDeviceControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_STACK_LOCATION IoStack; + PKSIOBJECT_HEADER ObjectHeader; + + /* get current stack location */ IoStack = IoGetCurrentIrpStackLocation(Irp); - DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension; - DeviceHeader = DeviceExtension->DeviceHeader; - - for(Index = 0; Index < DeviceHeader->FreeIndex; Index++) - { - if (DeviceHeader->ObjectList[Index].Initialized) - { - Status = DeviceHeader->ObjectList->DispatchTable.Close(DeviceObject, Irp); - DeviceHeader->ObjectList[Index].Initialized = FALSE; - } - } - - return STATUS_SUCCESS; + DPRINT1("KS / DeviceControl\n"); + if (IoStack->FileObject && IoStack->FileObject->FsContext) + { + ObjectHeader = (PKSIOBJECT_HEADER) IoStack->FileObject->FsContext; + + KSCREATE_ITEM_IRP_STORAGE(Irp) = ObjectHeader->CreateItem; + return ObjectHeader->DispatchTable.DeviceIoControl(DeviceObject, Irp); + } + else + { + DPRINT1("Expected Object Header\n"); + KeBugCheckEx(0, 0, 0, 0, 0); + return STATUS_SUCCESS; + } } static NTAPI NTSTATUS -KsDeviceControl( +KsRead( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { PIO_STACK_LOCATION IoStack; - PDEVICE_EXTENSION DeviceExtension; - PKSIDEVICE_HEADER DeviceHeader; - ULONG Index; - NTSTATUS Status; - + PKSIOBJECT_HEADER ObjectHeader; + + /* get current stack location */ IoStack = IoGetCurrentIrpStackLocation(Irp); - DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension; - DeviceHeader = DeviceExtension->DeviceHeader; - - DPRINT1("KS / DeviceControl NumDevices %x\n", DeviceHeader->FreeIndex); - - for(Index = 0; Index < DeviceHeader->FreeIndex; Index++) - { - if (DeviceHeader->ObjectList[Index].Initialized) - { - DPRINT1("Calling DeviceIoControl\n"); - Status = DeviceHeader->ObjectList->DispatchTable.DeviceIoControl(DeviceObject, Irp); - } - } - - return STATUS_SUCCESS; + DPRINT1("KS / Read\n"); + if (IoStack->FileObject && IoStack->FileObject->FsContext) + { + ObjectHeader = (PKSIOBJECT_HEADER) IoStack->FileObject->FsContext; + + KSCREATE_ITEM_IRP_STORAGE(Irp) = ObjectHeader->CreateItem; + return ObjectHeader->DispatchTable.Read(DeviceObject, Irp); + } + else + { + DPRINT1("Expected Object Header\n"); + KeBugCheckEx(0, 0, 0, 0, 0); + return STATUS_SUCCESS; + } } static NTAPI NTSTATUS -KsRead( +KsWrite( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { PIO_STACK_LOCATION IoStack; - PDEVICE_EXTENSION DeviceExtension; - PKSIDEVICE_HEADER DeviceHeader; - ULONG Index; - NTSTATUS Status; - + PKSIOBJECT_HEADER ObjectHeader; + + /* get current stack location */ IoStack = IoGetCurrentIrpStackLocation(Irp); - DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension; - DeviceHeader = DeviceExtension->DeviceHeader; - - DPRINT1("KS / Read\n"); - - for(Index = 0; Index < DeviceHeader->FreeIndex; Index++) - { - if (DeviceHeader->ObjectList[Index].Initialized) - { - Status = DeviceHeader->ObjectList->DispatchTable.Read(DeviceObject, Irp); - } - } - - return STATUS_SUCCESS; + DPRINT1("KS / Write\n"); + if (IoStack->FileObject && IoStack->FileObject->FsContext) + { + ObjectHeader = (PKSIOBJECT_HEADER) IoStack->FileObject->FsContext; + + KSCREATE_ITEM_IRP_STORAGE(Irp) = ObjectHeader->CreateItem; + return ObjectHeader->DispatchTable.Write(DeviceObject, Irp); + } + else + { + DPRINT1("Expected Object Header\n"); + KeBugCheckEx(0, 0, 0, 0, 0); + return STATUS_SUCCESS; + } } static NTAPI NTSTATUS -KsWrite( +KsFlushBuffers( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { PIO_STACK_LOCATION IoStack; - PDEVICE_EXTENSION DeviceExtension; - PKSIDEVICE_HEADER DeviceHeader; - ULONG Index; - NTSTATUS Status; - + PKSIOBJECT_HEADER ObjectHeader; + + /* get current stack location */ IoStack = IoGetCurrentIrpStackLocation(Irp); - DeviceExtension = (PDEVICE_EXTENSION)DeviceObject->DeviceExtension; - DeviceHeader = DeviceExtension->DeviceHeader; - - DPRINT1("KS / Write\n"); - - for(Index = 0; Index < DeviceHeader->FreeIndex; Index++) - { - if (DeviceHeader->ObjectList[Index].Initialized) - { - Status = DeviceHeader->ObjectList->DispatchTable.Write(DeviceObject, Irp); - } - } - return STATUS_SUCCESS; + DPRINT1("KS / FlushBuffers\n"); + if (IoStack->FileObject && IoStack->FileObject->FsContext) + { + ObjectHeader = (PKSIOBJECT_HEADER) IoStack->FileObject->FsContext; + + KSCREATE_ITEM_IRP_STORAGE(Irp) = ObjectHeader->CreateItem; + return ObjectHeader->DispatchTable.Flush(DeviceObject, Irp); + } + else + { + DPRINT1("Expected Object Header\n"); + KeBugCheckEx(0, 0, 0, 0, 0); + return STATUS_SUCCESS; + } } static NTAPI NTSTATUS -KsFlushBuffers( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp) -{ - DPRINT1("KS / FlushBuffers\n"); - return STATUS_UNSUCCESSFUL; +KsQuerySecurity( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) +{ + PIO_STACK_LOCATION IoStack; + PKSIOBJECT_HEADER ObjectHeader; + + /* get current stack location */ + IoStack = IoGetCurrentIrpStackLocation(Irp); + + DPRINT1("KS / QuerySecurity\n"); + if (IoStack->FileObject && IoStack->FileObject->FsContext) + { + ObjectHeader = (PKSIOBJECT_HEADER) IoStack->FileObject->FsContext; + + KSCREATE_ITEM_IRP_STORAGE(Irp) = ObjectHeader->CreateItem; + return ObjectHeader->DispatchTable.QuerySecurity(DeviceObject, Irp); + } + else + { + DPRINT1("Expected Object Header\n"); + KeBugCheckEx(0, 0, 0, 0, 0); + return STATUS_SUCCESS; + } } static NTAPI NTSTATUS -KsQuerySecurity( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp) -{ - DPRINT1("KS / QuerySecurity\n"); - return STATUS_UNSUCCESSFUL; -} - -static NTAPI -NTSTATUS KsSetSecurity( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { + PIO_STACK_LOCATION IoStack; + PKSIOBJECT_HEADER ObjectHeader; + + /* get current stack location */ + IoStack = IoGetCurrentIrpStackLocation(Irp); + DPRINT1("KS / SetSecurity\n"); - return STATUS_UNSUCCESSFUL; + if (IoStack->FileObject && IoStack->FileObject->FsContext) + { + ObjectHeader = (PKSIOBJECT_HEADER) IoStack->FileObject->FsContext; + + KSCREATE_ITEM_IRP_STORAGE(Irp) = ObjectHeader->CreateItem; + return ObjectHeader->DispatchTable.SetSecurity(DeviceObject, Irp); + } + else + { + DPRINT1("Expected Object Header\n"); + KeBugCheckEx(0, 0, 0, 0, 0); + return STATUS_SUCCESS; + } } /* Modified: trunk/reactos/drivers/ksfilter/ks/kstypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/kstype…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/kstypes.h [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/kstypes.h [iso-8859-1] Wed Feb 18 14:05:33 2009 @@ -1,25 +1,34 @@ #ifndef KSTYPES_H__ #define KSTYPES_H__ + +struct KSIDEVICE_HEADER; typedef struct { KSDISPATCH_TABLE DispatchTable; - LIST_ENTRY ListEntry; - ACCESS_MASK AccessMask; + LPWSTR ObjectClass; + ULONG ItemCount; PKSOBJECT_CREATE_ITEM CreateItem; - BOOL Initialized; }KSIOBJECT_HEADER, *PKSIOBJECT_HEADER; typedef struct { - ULONG MaxItems; - ULONG FreeIndex; - PKSOBJECT_CREATE_ITEM ItemsList; - PKSIOBJECT_HEADER ObjectList; - UCHAR ItemsListProvided; - PDEVICE_OBJECT LowerDeviceObject; + BOOL bCreated; + PKSIOBJECT_HEADER ObjectHeader; + KSOBJECT_CREATE_ITEM CreateItem; +}DEVICE_ITEM, *PDEVICE_ITEM; + +typedef struct +{ + USHORT MaxItems; + DEVICE_ITEM *ItemList; + + ULONG DeviceIndex; + KSPIN_LOCK ItemListLock; + + PDEVICE_OBJECT NextDeviceObject; ERESOURCE SecurityLock; }KSIDEVICE_HEADER, *PKSIDEVICE_HEADER; Modified: trunk/reactos/drivers/ksfilter/ks/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/misc.c…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/misc.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/misc.c [iso-8859-1] Wed Feb 18 14:05:33 2009 @@ -228,9 +228,11 @@ } /* - @unimplemented -*/ -KSDDKAPI NTSTATUS NTAPI + @implemented +*/ +KSDDKAPI +NTSTATUS +NTAPI KsSynchronousIoControlDevice( IN PFILE_OBJECT FileObject, IN KPROCESSOR_MODE RequestorMode, @@ -238,11 +240,43 @@ IN PVOID InBuffer, IN ULONG InSize, OUT PVOID OutBuffer, - IN ULONG OUtSize, + IN ULONG OutSize, OUT PULONG BytesReturned) { - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; + PDEVICE_OBJECT DeviceObject; + KEVENT Event; + PIRP Irp; + IO_STATUS_BLOCK IoStatusBlock; + PIO_STACK_LOCATION IoStack; + NTSTATUS Status; + + /* check for valid file object */ + if (!FileObject) + return STATUS_INVALID_PARAMETER; + + /* get device object to send the request to */ + DeviceObject = IoGetRelatedDeviceObject(FileObject); + if (!DeviceObject) + return STATUS_UNSUCCESSFUL; + + /* initialize the event */ + KeInitializeEvent(&Event, NotificationEvent, FALSE); + + /* create the irp */ + Irp = IoBuildDeviceIoControlRequest(IoControl, DeviceObject, InBuffer, InSize, OutBuffer, OutSize, FALSE, &Event, &IoStatusBlock); + + /* HACK */ + IoStack = IoGetNextIrpStackLocation(Irp); + IoStack->FileObject = FileObject; + + Status = IoCallDriver(DeviceObject, Irp); + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&Event, Executive, RequestorMode, FALSE, NULL); + } + + *BytesReturned = IoStatusBlock.Information; + return IoStatusBlock.Status; } Modified: trunk/reactos/drivers/ksfilter/ks/priv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/priv.h…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/priv.h [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/priv.h [iso-8859-1] Wed Feb 18 14:05:33 2009 @@ -1,10 +1,11 @@ #ifndef PRIV_H__ #define PRIV_H__ +#include <ntifs.h> #include <ntddk.h> #include <debug.h> +#include <portcls.h> #include <ks.h> -#include <portcls.h> #include <kcom.h> #include "ksfunc.h" @@ -12,7 +13,7 @@ #include "ksiface.h" - +#define TAG_DEVICE_HEADER TAG('H','D','S','K') Modified: trunk/reactos/drivers/ksfilter/ks/topology.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/topolo…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/topology.c [iso-8859-1] Wed Feb 18 14:05:33 2009 @@ -52,7 +52,8 @@ NULL, IO_NO_PARAMETER_CHECKING | IO_FORCE_ACCESS_CHECK); - ExFreePool(Name.Buffer); + // HACK HACK HACK HACK + //ExFreePool(Name.Buffer); return Status; }
15 years, 10 months
1
0
0
0
[silverblade] 39667: Removed hooks for prepare/unprepare/stream of WAVEHDR. These are handled internally by MME-Buddy. Instead, it simply provides a hook to do the actual streaming, complete with an OVERLAPPED structure and I/O completion routine. Also started imlpementation of wdmaud.drv to begin interaction with code janderwald is working on.
by silverblade@svn.reactos.org
Author: silverblade Date: Wed Feb 18 13:10:02 2009 New Revision: 39667 URL:
http://svn.reactos.org/svn/reactos?rev=39667&view=rev
Log: Removed hooks for prepare/unprepare/stream of WAVEHDR. These are handled internally by MME-Buddy. Instead, it simply provides a hook to do the actual streaming, complete with an OVERLAPPED structure and I/O completion routine. Also started imlpementation of wdmaud.drv to begin interaction with code janderwald is working on. Added: trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c (with props) Modified: trunk/reactos/dll/win32/sndblst/sndblst.c trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c trunk/reactos/dll/win32/wdmaud.drv/wdmaud.rbuild trunk/reactos/include/reactos/libs/sound/mmebuddy.h trunk/reactos/lib/drivers/sound/mmebuddy/deviceinstance.c trunk/reactos/lib/drivers/sound/mmebuddy/mmebuddy.rbuild trunk/reactos/lib/drivers/sound/mmebuddy/wave/header.c trunk/reactos/lib/drivers/sound/mmebuddy/wave/wodMessage.c trunk/reactos/lib/drivers/sound/mment4/control.c Modified: trunk/reactos/dll/win32/sndblst/sndblst.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/sndblst/sndblst.…
============================================================================== --- trunk/reactos/dll/win32/sndblst/sndblst.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/sndblst/sndblst.c [iso-8859-1] Wed Feb 18 13:10:02 2009 @@ -98,9 +98,8 @@ FuncTable.SetWaveFormat = SetNt4WaveDeviceFormat; FuncTable.Open = OpenNt4SoundDevice; FuncTable.Close = CloseNt4SoundDevice; - FuncTable.PrepareWaveHeader = NULL; - FuncTable.UnprepareWaveHeader = NULL; - FuncTable.SubmitWaveHeader = NULL; + FuncTable.CommitWaveBuffer = WriteFileEx_Committer; + //FuncTable.SubmitWaveHeaderToDevice = SubmitWaveHeaderToDevice; SetSoundDeviceFunctionTable(SoundDevice, &FuncTable); Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/wdmau…
============================================================================== --- trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] Wed Feb 18 13:10:02 2009 @@ -1,243 +1,145 @@ /* + * PROJECT: ReactOS Sound System + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/wdmaud.drv/wdmaud.c * - * PROJECT: ReactOS WDM Audio driver mapper - * FILE: dll/win32/wdmaud.drv/wdmaud.c - * PURPOSE: wdmaud.drv - * PROGRAMMER: Dmitry Chapyshev (dmitry(a)reactos.org) + * PURPOSE: WDM Audio Driver (User-mode part) + * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) * - * UPDATE HISTORY: - * 25/05/2008 Created + * NOTES: Looking for wodMessage & co? You won't find them here. Try + * the MME Buddy library, which is where these routines are + * actually implemented. + * */ -#include <stdarg.h> +#include <windows.h> +#include <ntddsnd.h> +#include <sndtypes.h> +#include <mmddk.h> +#include <mmebuddy.h> -#include <windows.h> -#include <mmsystem.h> -#include <mmddk.h> -#include <mmreg.h> -#include <debug.h> +#define KERNEL_DEVICE_NAME L"\\\\Device\\wdmaud" -DWORD APIENTRY -mxdMessage(UINT uDevice, - UINT uMsg, - DWORD dwUser, - DWORD dwParam1, - DWORD dwParam2) +HANDLE KernelHandle = INVALID_HANDLE_VALUE; + +APIENTRY LONG +DriverProc( + DWORD DriverId, + HANDLE DriverHandle, + UINT Message, + LONG Parameter1, + LONG Parameter2) { - DPRINT1("mxdMessage(%04X, %04X, %08X, %08X, %08X);\n", uDevice, uMsg, dwUser, dwParam1, dwParam2); + MMRESULT Result; - switch (uMsg) + switch ( Message ) { - case MXDM_INIT: - break; + case DRV_LOAD : + { + SND_TRACE(L"DRV_LOAD\n"); - case MXDM_GETNUMDEVS: - break; + Result = InitEntrypointMutexes(); - case MXDM_GETDEVCAPS: - break; + if ( ! MMSUCCESS(Result) ) + return 0L; - case MXDM_OPEN: - break; + KernelHandle = CreateFile(KERNEL_DEVICE_NAME, + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_WRITE, // ok? + NULL, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, + NULL); - case MXDM_CLOSE: - break; + if ( KernelHandle == INVALID_HANDLE_VALUE ) + { + SND_ERR(L"Failed to open %s", KERNEL_DEVICE_NAME); + CleanupEntrypointMutexes(); - case MXDM_GETLINEINFO: - break; + UnlistAllSoundDevices(); - case MXDM_GETLINECONTROLS: - break; + return 0L; + } - case MXDM_GETCONTROLDETAILS: - break; + SND_TRACE(L"Initialisation complete\n"); - case MXDM_SETCONTROLDETAILS: - break; + return 1L; + } + + case DRV_FREE : + { + SND_TRACE(L"DRV_FREE\n"); + + if ( KernelHandle != INVALID_HANDLE_VALUE ) + { + CloseHandle(KernelHandle); + KernelHandle = INVALID_HANDLE_VALUE; + } + + /* TODO: Clean up the path names! */ + UnlistAllSoundDevices(); + + CleanupEntrypointMutexes(); + + SND_TRACE(L"Unfreed memory blocks: %d\n", + GetMemoryAllocationCount()); + + return 1L; + } + + case DRV_ENABLE : + case DRV_DISABLE : + { + SND_TRACE(L"DRV_ENABLE / DRV_DISABLE\n"); + return 1L; + } + + case DRV_OPEN : + case DRV_CLOSE : + { + SND_TRACE(L"DRV_OPEN / DRV_CLOSE\n"); + return 1L; + } + + case DRV_QUERYCONFIGURE : + { + SND_TRACE(L"DRV_QUERYCONFIGURE"); + return 0L; + } + case DRV_CONFIGURE : + return DRVCNF_OK; + + default : + SND_TRACE(L"Unhandled message %d\n", Message); + return DefDriverProc(DriverId, + DriverHandle, + Message, + Parameter1, + Parameter2); } - - return MMSYSERR_NOTSUPPORTED; } -DWORD APIENTRY -auxMessage(UINT uDevice, - UINT uMsg, - DWORD dwUser, - DWORD dwParam1, - DWORD dwParam2) + +BOOL WINAPI DllMain( + HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved) { - DPRINT1("auxMessage(%04X, %04X, %08X, %08X, %08X);\n", uDevice, uMsg, dwUser, dwParam1, dwParam2); - - switch (uMsg) + switch ( fdwReason ) { - case AUXDM_GETDEVCAPS: - - break; - - case AUXDM_GETNUMDEVS: - - break; - - case AUXDM_GETVOLUME: - - break; - - case AUXDM_SETVOLUME: - - break; - - default: - return MMSYSERR_NOTSUPPORTED; - } - - return MMSYSERR_NOTSUPPORTED; -} - -DWORD APIENTRY -wodMessage(UINT uDevice, - UINT uMsg, - DWORD dwUser, - DWORD dwParam1, - DWORD dwParam2) -{ - DPRINT1("wodMessage(%04X, %04X, %08X, %08X, %08X);\n", uDevice, uMsg, dwUser, dwParam1, dwParam2); - - switch (uMsg) - { - case WODM_GETNUMDEVS: - break; - - case WODM_GETDEVCAPS: - break; - - case WODM_OPEN: - break; - - case WODM_CLOSE: - break; - - case WODM_WRITE: - break; - - case WODM_PAUSE: - break; - - case WODM_RESTART: - break; - - case WODM_RESET: - break; - - case WODM_BREAKLOOP: - break; - - case WODM_GETPOS: - break; - - case WODM_SETPITCH: - break; - - case WODM_SETVOLUME: - break; - - case WODM_SETPLAYBACKRATE: - break; - - case WODM_GETPITCH: - break; - - case WODM_GETVOLUME: - break; - - case WODM_GETPLAYBACKRATE: - break; - - default: - return MMSYSERR_NOTSUPPORTED; - } - - return MMSYSERR_NOTSUPPORTED; -} - -DWORD APIENTRY -widMessage(UINT uDevice, - UINT uMsg, - DWORD dwUser, - DWORD dwParam1, - DWORD dwParam2) -{ - DPRINT1("widMessage(%04X, %04X, %08X, %08X, %08X);\n", uDevice, uMsg, dwUser, dwParam1, dwParam2); - - switch (uMsg) - { - case WIDM_GETNUMDEVS: - break; - - case WIDM_GETDEVCAPS: - break; - - case WIDM_OPEN: - break; - - case WIDM_CLOSE: - break; - - case WIDM_ADDBUFFER: - break; - - case WIDM_STOP: - break; - - case WIDM_START: - break; - - case WIDM_RESET: - break; - - case WIDM_GETPOS: - break; - - default: - return MMSYSERR_NOTSUPPORTED; - } - - return MMSYSERR_NOTSUPPORTED; -} - -DWORD APIENTRY -modMessage(UINT uDevice, - UINT uMsg, - DWORD dwUser, - DWORD dwParam1, - DWORD dwParam2) -{ - DPRINT1("modMessage(%04X, %04X, %08X, %08X, %08X);\n", uDevice, uMsg, dwUser, dwParam1, dwParam2); - - return MMSYSERR_NOTSUPPORTED; -} - -LRESULT APIENTRY -DriverProc(DWORD dwDriverID, - HDRVR hDriver, - UINT uiMessage, - LPARAM lParam1, - LPARAM lParam2) -{ - return DefDriverProc(dwDriverID, hDriver, uiMessage, lParam1, lParam2); -} - -BOOL WINAPI -DllMain(IN HINSTANCE hinstDLL, - IN DWORD dwReason, - IN LPVOID lpvReserved) -{ - switch (dwReason) - { - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(hinstDLL); + case DLL_PROCESS_ATTACH : + SND_TRACE(L"WDMAUD.DRV - Process attached\n"); + break; + case DLL_PROCESS_DETACH : + SND_TRACE(L"WDMAUD.DRV - Process detached\n"); + break; + case DLL_THREAD_ATTACH : + SND_TRACE(L"WDMAUD.DRV - Thread attached\n"); + break; + case DLL_THREAD_DETACH : + SND_TRACE(L"WDMAUD.DRV - Thread detached\n"); break; } return TRUE; } - Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/wdmau…
============================================================================== --- trunk/reactos/dll/win32/wdmaud.drv/wdmaud.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wdmaud.drv/wdmaud.rbuild [iso-8859-1] Wed Feb 18 13:10:02 2009 @@ -1,12 +1,14 @@ -<module name="wdmaud.drv" type="win32dll" baseaddress="${BASEADDRESS_WDMAUD}" installbase="system32" installname="wdmaud.drv"> +<module name="wdmaud.drv" type="win32dll" baseaddress="${BASEADDRESS_WDMAUD}" installbase="system32" installname="wdmaud.drv" unicode="yes"> <importlibrary definition="wdmaud.spec" /> <include base="wdmaud.drv">.</include> - <define name="_DISABLE_TIDENTS" /> - <library>advapi32</library> + <include base="ReactOS">include/reactos/libs/sound</include> + <define name="DEBUG_NT4" /><!-- Use custom debug routines --> + <library>mmebuddy</library> + <library>ntdll</library> <library>kernel32</library> - <library>winmm</library> <library>user32</library> <library>winmm</library> + <library>advapi32</library> <file>wdmaud.c</file> <file>wdmaud.rc</file> </module> Modified: trunk/reactos/include/reactos/libs/sound/mmebuddy.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/sound…
============================================================================== --- trunk/reactos/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/libs/sound/mmebuddy.h [iso-8859-1] Wed Feb 18 13:10:02 2009 @@ -32,7 +32,7 @@ MessageBox(0, dbg_popup_msg, dbg_popup_title, MB_OK | MB_TASKMODAL); \ } -#ifdef DEBUG_NT4 +#ifndef NDEBUG #define SND_ERR(...) \ { \ WCHAR dbg_popup_msg[1024]; \ @@ -62,11 +62,24 @@ } \ } + #define DUMP_WAVEHDR_QUEUE(sound_device_instance) \ + { \ + PWAVEHDR CurrDumpHdr = sound_device_instance->HeadWaveHeader; \ + SND_TRACE(L"-- Current wave header list --\n"); \ + while ( CurrDumpHdr ) \ + { \ + SND_TRACE(L"%x | %d bytes | flags: %x\n", CurrDumpHdr->lpData, \ + CurrDumpHdr->dwBufferLength, \ + CurrDumpHdr->dwFlags); \ + CurrDumpHdr = CurrDumpHdr->lpNext; \ + } \ + } + #else - #define SND_ERR(...) while ( 0 ) do {} - #define SND_WARN(...) while ( 0 ) do {} - #define SND_TRACE(...) while ( 0 ) do {} - #define SND_ASSERT(condition) while ( 0 ) do {} + #define SND_ERR(...) do {} while ( 0 ) + #define SND_WARN(...) do {} while ( 0 ) + #define SND_TRACE(...) do {} while ( 0 ) + #define SND_ASSERT(condition) do {} while ( 0 ) #endif /* @@ -157,6 +170,28 @@ struct _SOUND_DEVICE; struct _SOUND_DEVICE_INSTANCE; + +/* + By extending the OVERLAPPED structure, it becomes possible to provide the + I/O completion routines with additional information. +*/ + +typedef struct _SOUND_OVERLAPPED +{ + OVERLAPPED Standard; + struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance; + PWAVEHDR Header; +} SOUND_OVERLAPPED, *PSOUND_OVERLAPPED; + +typedef MMRESULT (*WAVE_COMMIT_FUNC)( + IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance, + IN PVOID OffsetPtr, + IN DWORD Bytes, + IN PSOUND_OVERLAPPED Overlap, + IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine); + + + typedef MMRESULT (*MMWAVEQUERYFORMATSUPPORT_FUNC)( IN struct _SOUND_DEVICE* Device, IN PWAVEFORMATEX WaveFormat, @@ -178,6 +213,11 @@ typedef MMRESULT (*MMWAVEHEADER_FUNC)( IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance, IN PWAVEHDR WaveHeader); + +typedef MMRESULT (*MMBUFFER_FUNC)( + IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance, + IN PVOID Buffer, + IN DWORD Length); typedef struct _MMFUNCTION_TABLE { @@ -196,10 +236,18 @@ MMWAVEQUERYFORMATSUPPORT_FUNC QueryWaveFormatSupport; MMWAVESETFORMAT_FUNC SetWaveFormat; - MMWAVEHEADER_FUNC PrepareWaveHeader; - MMWAVEHEADER_FUNC UnprepareWaveHeader; - MMWAVEHEADER_FUNC SubmitWaveHeader; + WAVE_COMMIT_FUNC CommitWaveBuffer; + + // Redundant + //MMWAVEHEADER_FUNC PrepareWaveHeader; + //MMWAVEHEADER_FUNC UnprepareWaveHeader; + //MMWAVEHEADER_FUNC WriteWaveHeader; + + //MMWAVEHEADER_FUNC SubmitWaveHeaderToDevice; + //MMBUFFER_FUNC CompleteBuffer; } MMFUNCTION_TABLE, *PMMFUNCTION_TABLE; + + typedef MMRESULT (*SOUND_THREAD_REQUEST_HANDLER)( IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance, @@ -252,7 +300,31 @@ DWORD ClientCallback; DWORD ClientCallbackInstanceData; } WinMM; + + /* DO NOT TOUCH THESE OUTSIDE OF THE SOUND THREAD */ + + union + { + PWAVEHDR HeadWaveHeader; + }; + + union + { + PWAVEHDR TailWaveHeader; + }; + + PWAVEHDR WaveLoopStart; + PWAVEHDR CurrentWaveHeader; + DWORD OutstandingBuffers; } SOUND_DEVICE_INSTANCE, *PSOUND_DEVICE_INSTANCE; + +/* This lives in WAVEHDR.reserved */ +typedef struct _WAVEHDR_EXTENSION +{ + DWORD BytesCommitted; + DWORD BytesCompleted; +} WAVEHDR_EXTENSION, *PWAVEHDR_EXTENSION; + /* reentrancy.c @@ -308,8 +380,8 @@ #define MmeUnprepareWaveHeader(private_handle, header) \ UnprepareWaveHeader((PSOUND_DEVICE_INSTANCE)private_handle, (PWAVEHDR)header) -#define MmeEnqueueWaveHeader(private_handle, header) \ - EnqueueWaveHeader((PSOUND_DEVICE_INSTANCE)private_handle, (PWAVEHDR)header) +#define MmeWriteWaveHeader(private_handle, header) \ + WriteWaveHeader((PSOUND_DEVICE_INSTANCE)private_handle, (PWAVEHDR)header) /* @@ -494,6 +566,16 @@ */ MMRESULT +EnqueueWaveHeader( + PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PVOID Parameter); + +VOID +CompleteWaveHeader( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PWAVEHDR Header); + +MMRESULT PrepareWaveHeader( IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PWAVEHDR Header); @@ -504,9 +586,38 @@ IN PWAVEHDR Header); MMRESULT -EnqueueWaveHeader( +WriteWaveHeader( IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PWAVEHDR Header); + + +/* + wave/streaming.c +*/ + +MMRESULT +DoWaveStreaming( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance); + +VOID CALLBACK +CompleteIO( + IN DWORD dwErrorCode, + IN DWORD dwNumberOfBytesTransferred, + IN LPOVERLAPPED lpOverlapped); + +MMRESULT +CommitWaveHeaderToKernelDevice( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PWAVEHDR Header, + IN WAVE_COMMIT_FUNC CommitFunction); + +MMRESULT +WriteFileEx_Committer( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PVOID OffsetPtr, + IN DWORD Length, + IN PSOUND_OVERLAPPED Overlap, + IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine); /* Modified: trunk/reactos/lib/drivers/sound/mmebuddy/deviceinstance.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmebuddy…
============================================================================== --- trunk/reactos/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1] Wed Feb 18 13:10:02 2009 @@ -186,6 +186,14 @@ (*SoundDeviceInstance)->WinMM.ClientCallbackInstanceData = 0; (*SoundDeviceInstance)->WinMM.Flags = 0; + /* Initialise the members of the struct used by the sound thread */ + (*SoundDeviceInstance)->HeadWaveHeader = NULL; + (*SoundDeviceInstance)->TailWaveHeader = NULL; + + (*SoundDeviceInstance)->CurrentWaveHeader = NULL; + (*SoundDeviceInstance)->OutstandingBuffers = 0; + // TODO: Loop + /* Create the streaming thread (TODO - is this for wave only?) */ Result = CreateSoundThread(&(*SoundDeviceInstance)->Thread); if ( ! MMSUCCESS(Result) ) Modified: trunk/reactos/lib/drivers/sound/mmebuddy/mmebuddy.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmebuddy…
============================================================================== --- trunk/reactos/lib/drivers/sound/mmebuddy/mmebuddy.rbuild [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/sound/mmebuddy/mmebuddy.rbuild [iso-8859-1] Wed Feb 18 13:10:02 2009 @@ -16,7 +16,8 @@ <file>widMessage.c</file> <file>wodMessage.c</file> <file>format.c</file> - <file>header.c</file> + <file>header.c</file> + <file>streaming.c</file> </directory> <directory name="midi"> <file>midMessage.c</file> Modified: trunk/reactos/lib/drivers/sound/mmebuddy/wave/header.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmebuddy…
============================================================================== --- trunk/reactos/lib/drivers/sound/mmebuddy/wave/header.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/sound/mmebuddy/wave/header.c [iso-8859-1] Wed Feb 18 13:10:02 2009 @@ -1,9 +1,9 @@ /* * PROJECT: ReactOS Sound System "MME Buddy" Library * LICENSE: GPL - See COPYING in the top level directory - * FILE: lib/drivers/sound/mmebuddy/header.c + * FILE: lib/drivers/sound/mmebuddy/wave/header.c * - * PURPOSE: Wave header preparation routines + * PURPOSE: Wave header preparation and submission routines * * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) */ @@ -13,6 +13,7 @@ #include <mmddk.h> #include <ntddsnd.h> #include <mmebuddy.h> +#include <sndtypes.h> /* @@ -60,6 +61,25 @@ /* + SanitizeWaveHeader + Clean up a header / reinitialize +*/ + +VOID +SanitizeWaveHeader( + PWAVEHDR Header) +{ + PWAVEHDR_EXTENSION Extension = (PWAVEHDR_EXTENSION) Header->reserved; + SND_ASSERT( Extension ); + + Header->dwBytesRecorded = 0; + + Extension->BytesCommitted = 0; + Extension->BytesCompleted = 0; +} + + +/* The following routines are basically handlers for: - WODM_PREPARE - WODM_UNPREPARE @@ -78,6 +98,7 @@ MMRESULT Result; PSOUND_DEVICE SoundDevice; PMMFUNCTION_TABLE FunctionTable; + PWAVEHDR_EXTENSION Extension; VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); VALIDATE_MMSYS_PARAMETER( Header ); @@ -92,12 +113,18 @@ if ( ! MMSUCCESS(Result) ) return TranslateInternalMmResult(Result); - if ( ! FunctionTable->PrepareWaveHeader ) - return MMSYSERR_NOTSUPPORTED; - - return WaveHeaderOperation(FunctionTable->PrepareWaveHeader, - SoundDeviceInstance, - Header); + Extension = AllocateStruct(WAVEHDR_EXTENSION); + if ( ! Extension ) + return MMSYSERR_NOMEM; + + Header->reserved = (DWORD_PTR) Extension; + Extension->BytesCommitted = 0; + Extension->BytesCompleted = 0; + + /* Configure the flags */ + Header->dwFlags |= WHDR_PREPARED; + + return MMSYSERR_NOERROR; } MMRESULT @@ -108,6 +135,7 @@ MMRESULT Result; PSOUND_DEVICE SoundDevice; PMMFUNCTION_TABLE FunctionTable; + PWAVEHDR_EXTENSION Extension; VALIDATE_MMSYS_PARAMETER( IsValidSoundDeviceInstance(SoundDeviceInstance) ); VALIDATE_MMSYS_PARAMETER( Header ); @@ -122,16 +150,18 @@ if ( ! MMSUCCESS(Result) ) return TranslateInternalMmResult(Result); - if ( ! FunctionTable->UnprepareWaveHeader ) - return MMSYSERR_NOTSUPPORTED; - - return WaveHeaderOperation(FunctionTable->UnprepareWaveHeader, - SoundDeviceInstance, - Header); -} - -MMRESULT -EnqueueWaveHeader( + SND_ASSERT( Header->reserved ); + Extension = (PWAVEHDR_EXTENSION) Header->reserved; + FreeMemory(Extension); + + /* Configure the flags */ + Header->dwFlags &= ~WHDR_PREPARED; + + return MMSYSERR_NOERROR; +} + +MMRESULT +WriteWaveHeader( IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PWAVEHDR Header) { @@ -152,7 +182,7 @@ if ( ! MMSUCCESS(Result) ) return TranslateInternalMmResult(Result); - if ( ! FunctionTable->SubmitWaveHeader ) + if ( ! FunctionTable->CommitWaveBuffer ) return MMSYSERR_NOTSUPPORTED; /* @@ -164,20 +194,160 @@ VALIDATE_MMSYS_PARAMETER( Header->dwFlags & WHDR_PREPARED ); VALIDATE_MMSYS_PARAMETER( ! (Header->dwFlags & WHDR_INQUEUE) ); + SanitizeWaveHeader(Header); + /* Clear the "done" flag for the buffer */ Header->dwFlags &= ~WHDR_DONE; - Result = WaveHeaderOperation(FunctionTable->SubmitWaveHeader, - SoundDeviceInstance, - Header); - - if ( ! MMSUCCESS(Result) ) - { - return Result; - } - - /* Set the "in queue" flag if everything was OK */ - Header->dwFlags |= WHDR_INQUEUE; + Result = CallSoundThread(SoundDeviceInstance, + EnqueueWaveHeader, + Header); + + return Result; +} + + +/* + EnqueueWaveHeader + Put the header in the record/playback queue. This is performed within + the context of the sound thread, it must NEVER be called from another + thread. + + CompleteWaveHeader + Set the header information to indicate that it has finished playing, + and return it to the client application. This again must be called + within the context of the sound thread. +*/ + +MMRESULT +EnqueueWaveHeader( + PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PVOID Parameter) +{ + VALIDATE_MMSYS_PARAMETER( SoundDeviceInstance ); + VALIDATE_MMSYS_PARAMETER( Parameter ); + + PWAVEHDR WaveHeader = (PWAVEHDR) Parameter; + + /* Initialise */ + WaveHeader->lpNext = NULL; + + /* Set the "in queue" flag */ + WaveHeader->dwFlags |= WHDR_INQUEUE; + + if ( ! SoundDeviceInstance->TailWaveHeader ) + { + /* This is the first header in the queue */ + SND_TRACE(L"Enqueued first wave header\n"); + SoundDeviceInstance->HeadWaveHeader = WaveHeader; + SoundDeviceInstance->TailWaveHeader = WaveHeader; + + DoWaveStreaming(SoundDeviceInstance); + } + else + { + /* There are already queued headers - make this one the tail */ + SND_TRACE(L"Enqueued next wave header\n"); + SoundDeviceInstance->TailWaveHeader->lpNext = WaveHeader; + SoundDeviceInstance->TailWaveHeader = WaveHeader; + + DoWaveStreaming(SoundDeviceInstance); + } + + DUMP_WAVEHDR_QUEUE(SoundDeviceInstance); return MMSYSERR_NOERROR; } + +VOID +CompleteWaveHeader( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PWAVEHDR Header) +{ + PWAVEHDR PrevHdr = NULL, CurrHdr = NULL; + PWAVEHDR_EXTENSION Extension; + PSOUND_DEVICE SoundDevice; + MMDEVICE_TYPE DeviceType; + MMRESULT Result; + + SND_TRACE(L"BUFFER COMPLETE :)\n"); + + // TODO: Set header flags? + // TODO: Call client + // TODO: Streaming + + //DoWaveStreaming(SoundDeviceInstance); + + Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); + SND_ASSERT( MMSUCCESS(Result) ); + Result = GetSoundDeviceType(SoundDevice, &DeviceType); + SND_ASSERT( MMSUCCESS(Result) ); + + Extension = (PWAVEHDR_EXTENSION)Header->reserved; + SND_ASSERT( Extension ); + + /* Remove the header from the queue, like so */ + if ( SoundDeviceInstance->HeadWaveHeader == Header ) + { + SoundDeviceInstance->HeadWaveHeader = Header->lpNext; + + SND_TRACE(L"Dropping head node\n"); + + /* If nothing after the head, then there is no tail */ + if ( Header->lpNext == NULL ) + { + SND_TRACE(L"Dropping tail node\n"); + SoundDeviceInstance->TailWaveHeader = NULL; + } + } + else + { + PrevHdr = NULL; + CurrHdr = SoundDeviceInstance->HeadWaveHeader; + + SND_TRACE(L"Relinking nodes\n"); + + while ( CurrHdr != Header ) + { + PrevHdr = CurrHdr; + CurrHdr = CurrHdr->lpNext; + SND_ASSERT( CurrHdr ); + } + + SND_ASSERT( PrevHdr ); + + PrevHdr->lpNext = CurrHdr->lpNext; + + /* If this is the tail node, update the tail */ + if ( Header->lpNext == NULL ) + { + SND_TRACE(L"Updating tail node\n"); + SoundDeviceInstance->TailWaveHeader = PrevHdr; + } + } + + /* Make sure we're not using this as the current buffer any more, either! */ + if ( SoundDeviceInstance->CurrentWaveHeader == Header ) + { + SoundDeviceInstance->CurrentWaveHeader = Header->lpNext; + } + + DUMP_WAVEHDR_QUEUE(SoundDeviceInstance); + + SND_TRACE(L"Returning buffer to client...\n"); + + /* Update the header */ + Header->dwFlags &= ~WHDR_INQUEUE; + Header->dwFlags |= WHDR_DONE; + + if ( DeviceType == WAVE_IN_DEVICE_TYPE ) + { + // FIXME: We won't be called on incomplete buffer! + Header->dwBytesRecorded = Extension->BytesCompleted; + } + + /* Safe to do this without thread protection, as we're done with the header */ + NotifyMmeClient(SoundDeviceInstance, + DeviceType == WAVE_OUT_DEVICE_TYPE ? WOM_DONE : WIM_DATA, + (DWORD) Header); +} Added: trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmebuddy…
============================================================================== --- trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c (added) +++ trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c [iso-8859-1] Wed Feb 18 13:10:02 2009 @@ -1,0 +1,229 @@ +/* + * PROJECT: ReactOS Sound System "MME Buddy" Library + * LICENSE: GPL - See COPYING in the top level directory + * FILE: lib/drivers/sound/mmebuddy/wave/streaming.c + * + * PURPOSE: Wave streaming + * + * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) +*/ + +#include <windows.h> +#include <mmsystem.h> +#include <mmddk.h> +#include <ntddsnd.h> +#include <mmebuddy.h> +#include <sndtypes.h> + + +/* + Restrain ourselves from flooding the kernel device! +*/ + +#define SOUND_KERNEL_BUFFER_COUNT 10 +#define SOUND_KERNEL_BUFFER_SIZE 200000 + + +/* + DoWaveStreaming + Check if there is streaming to be done, and if so, do it. +*/ + +MMRESULT +DoWaveStreaming( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance) +{ + MMRESULT Result; + PSOUND_DEVICE SoundDevice; + PMMFUNCTION_TABLE FunctionTable; + + Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); + SND_ASSERT( MMSUCCESS(Result) ); + + Result = GetSoundDeviceFunctionTable(SoundDevice, &FunctionTable); + SND_ASSERT( MMSUCCESS(Result) ); + SND_ASSERT( FunctionTable ); + SND_ASSERT( FunctionTable->CommitWaveBuffer ); + + // HACK + SND_TRACE(L"Calling buffer submit routine\n"); + + if ( ! SoundDeviceInstance->CurrentWaveHeader ) + { + /* Start from the beginning (always a good idea) */ + SoundDeviceInstance->CurrentWaveHeader = SoundDeviceInstance->HeadWaveHeader; + } + + if ( SoundDeviceInstance->CurrentWaveHeader ) + { + /* Stream or continue streaming this header */ + + Result = CommitWaveHeaderToKernelDevice(SoundDeviceInstance, + SoundDeviceInstance->CurrentWaveHeader, + FunctionTable->CommitWaveBuffer); + } + else + { + SND_TRACE(L"NOTHING TO DO - REC/PLAY STOPPED\n"); + } + + return Result; +} + + +/* + CompleteIO + An APC called as a result of a call to CommitWaveHeaderToKernelDevice. + This will count up the number of bytes which have been dealt with, + and when the entire wave header has been dealt with, will call + CompleteWaveHeader to have the wave header returned to the client. + + CommitWaveHeaderToKernelDevice + Sends portions of the buffer described by the wave header to a kernel + device. This must only be called from within the context of the sound + thread. The caller supplies either their own commit routine, or uses + WriteFileEx_Committer. The committer is called with portions of the + buffer specified in the wave header. + + WriteFileEx_Committer + Commit buffers using the WriteFileEx API. +*/ + +VOID CALLBACK +CompleteIO( + IN DWORD dwErrorCode, + IN DWORD dwNumberOfBytesTransferred, + IN LPOVERLAPPED lpOverlapped) +{ + PSOUND_DEVICE_INSTANCE SoundDeviceInstance; + PSOUND_OVERLAPPED SoundOverlapped = (PSOUND_OVERLAPPED) lpOverlapped; + PWAVEHDR WaveHdr; + PWAVEHDR_EXTENSION HdrExtension; + + WaveHdr = (PWAVEHDR) SoundOverlapped->Header; + SND_ASSERT( WaveHdr ); + + HdrExtension = (PWAVEHDR_EXTENSION) WaveHdr->reserved; + SND_ASSERT( HdrExtension ); + + SoundDeviceInstance = SoundOverlapped->SoundDeviceInstance; + + HdrExtension->BytesCompleted += dwNumberOfBytesTransferred; + SND_TRACE(L"%d/%d bytes of wavehdr completed\n", HdrExtension->BytesCompleted, WaveHdr->dwBufferLength); + + /* We have an available buffer now */ + -- SoundDeviceInstance->OutstandingBuffers; + + if ( HdrExtension->BytesCompleted == WaveHdr->dwBufferLength ) + { + CompleteWaveHeader(SoundDeviceInstance, WaveHdr); + } + + DoWaveStreaming(SoundDeviceInstance); + + //CompleteWavePortion(SoundDeviceInstance, dwNumberOfBytesTransferred); + + FreeMemory(lpOverlapped); +} + +MMRESULT +CommitWaveHeaderToKernelDevice( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PWAVEHDR Header, + IN WAVE_COMMIT_FUNC CommitFunction) +{ + PSOUND_OVERLAPPED Overlap; + DWORD BytesToWrite, BytesRemaining; + PWAVEHDR_EXTENSION HdrExtension; + LPVOID Offset; + + VALIDATE_MMSYS_PARAMETER( SoundDeviceInstance ); + VALIDATE_MMSYS_PARAMETER( Header ); + VALIDATE_MMSYS_PARAMETER( CommitFunction ); + + HdrExtension = (PWAVEHDR_EXTENSION) Header->reserved; + VALIDATE_MMSYS_PARAMETER( HdrExtension ); + + /* Loop whilst there is data and sufficient available buffers */ + while ( ( SoundDeviceInstance->OutstandingBuffers < SOUND_KERNEL_BUFFER_COUNT ) && + ( HdrExtension->BytesCommitted < Header->dwBufferLength ) ) + { + /* Is this the start of a loop? */ + SoundDeviceInstance->WaveLoopStart = Header; + + /* Where to start pulling the data from within the buffer */ + Offset = Header->lpData + HdrExtension->BytesCommitted; + + /* How much of this header is not committed? */ + BytesRemaining = Header->dwBufferLength - HdrExtension->BytesCommitted; + + /* We can write anything up to the buffer size limit */ + BytesToWrite = BytesRemaining > SOUND_KERNEL_BUFFER_SIZE ? + SOUND_KERNEL_BUFFER_SIZE : + BytesRemaining; + + /* If there's nothing left in the current header, move to the next */ + if ( BytesToWrite == 0 ) + { + Header = Header->lpNext; + HdrExtension = (PWAVEHDR_EXTENSION) Header->reserved; + SND_ASSERT( HdrExtension ); + SND_ASSERT( HdrExtension->BytesCommitted == 0 ); + SND_ASSERT( HdrExtension->BytesCompleted == 0 ); + continue; + } + + HdrExtension->BytesCommitted += BytesToWrite; + + /* We're using up a buffer so update this */ + ++ SoundDeviceInstance->OutstandingBuffers; + + SND_TRACE(L"COMMIT: Offset 0x%x amount %d remain %d totalcommit %d", + Offset, BytesToWrite, BytesRemaining, HdrExtension->BytesCommitted); + + /* We need a new overlapped info structure for each buffer */ + Overlap = AllocateStruct(SOUND_OVERLAPPED); + + if ( Overlap ) + { + ZeroMemory(Overlap, sizeof(SOUND_OVERLAPPED)); + Overlap->SoundDeviceInstance = SoundDeviceInstance; + Overlap->Header = Header; + + + if ( ! MMSUCCESS(CommitFunction(SoundDeviceInstance, Offset, BytesToWrite, Overlap, CompleteIO)) ) + { + /* Just pretend it played if we fail... Show must go on, etc. etc. */ + SND_WARN(L"FAILED\n"); + HdrExtension->BytesCompleted += BytesToWrite; + } + } + } + + return MMSYSERR_NOERROR; +} + +MMRESULT +WriteFileEx_Committer( + IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, + IN PVOID OffsetPtr, + IN DWORD Length, + IN PSOUND_OVERLAPPED Overlap, + IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine) +{ + HANDLE Handle; + + VALIDATE_MMSYS_PARAMETER( SoundDeviceInstance ); + VALIDATE_MMSYS_PARAMETER( OffsetPtr ); + VALIDATE_MMSYS_PARAMETER( Overlap ); + VALIDATE_MMSYS_PARAMETER( CompletionRoutine ); + + GetSoundDeviceInstanceHandle(SoundDeviceInstance, &Handle); + + if ( ! WriteFileEx(Handle, OffsetPtr, Length, (LPOVERLAPPED)Overlap, CompletionRoutine) ) + { + // TODO + } + + return MMSYSERR_NOERROR; +} Propchange: trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/lib/drivers/sound/mmebuddy/wave/wodMessage.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmebuddy…
============================================================================== --- trunk/reactos/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/sound/mmebuddy/wave/wodMessage.c [iso-8859-1] Wed Feb 18 13:10:02 2009 @@ -94,7 +94,7 @@ case WODM_WRITE : { - Result = MmeEnqueueWaveHeader(PrivateHandle, Parameter1); + Result = MmeWriteWaveHeader(PrivateHandle, Parameter1); break; } Modified: trunk/reactos/lib/drivers/sound/mment4/control.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mment4/c…
============================================================================== --- trunk/reactos/lib/drivers/sound/mment4/control.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/sound/mment4/control.c [iso-8859-1] Wed Feb 18 13:10:02 2009 @@ -8,6 +8,8 @@ * PROGRAMMERS: Andrew Greenwood (silverblade(a)reactos.org) */ +#define NDEBUG + #include <windows.h> #include <mmsystem.h> #include <mmddk.h>
15 years, 10 months
1
0
0
0
[janderwald] 39666: - fix build
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Feb 18 12:01:28 2009 New Revision: 39666 URL:
http://svn.reactos.org/svn/reactos?rev=39666&view=rev
Log: - fix build Added: trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c (with props) Added: trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c (added) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c [iso-8859-1] Wed Feb 18 12:01:28 2009 @@ -1,0 +1,54 @@ +#include "private.h" + +NTSTATUS +NTAPI +PinPropertyHandler( + IN PIRP Irp, + IN PKSIDENTIFIER Request, + IN OUT PVOID Data) +{ + NTSTATUS Status = STATUS_UNSUCCESSFUL; + + switch(Request->Id) + { + case KSPROPERTY_PIN_CTYPES: + case KSPROPERTY_PIN_DATAFLOW: + case KSPROPERTY_PIN_DATARANGES: + case KSPROPERTY_PIN_INTERFACES: + case KSPROPERTY_PIN_MEDIUMS: + case KSPROPERTY_PIN_COMMUNICATION: + case KSPROPERTY_PIN_CATEGORY: + case KSPROPERTY_PIN_NAME: + // KsPinPropertyHandler + break; + case KSPROPERTY_PIN_DATAINTERSECTION: + case KSPROPERTY_PIN_CINSTANCES: + case KSPROPERTY_PIN_GLOBALCINSTANCES: + case KSPROPERTY_PIN_NECESSARYINSTANCES: + case KSPROPERTY_PIN_PHYSICALCONNECTION: + case KSPROPERTY_PIN_CONSTRAINEDDATARANGES: + DPRINT1("Unhandled %x\n", Request->Id); + Status = STATUS_SUCCESS; + break; + default: + Status = STATUS_NOT_FOUND; + } + + + return Status; +} + + +NTSTATUS +NTAPI +TopologyPropertyHandler( + IN PIRP Irp, + IN PKSIDENTIFIER Request, + IN OUT PVOID Data) +{ + return KsTopologyPropertyHandler(Irp, + Request, + Data, + NULL /* FIXME */); +} + Propchange: trunk/reactos/drivers/wdm/audio/backpln/portcls/propertyhandler.c ------------------------------------------------------------------------------ svn:eol-style = native
15 years, 10 months
1
0
0
0
[janderwald] 39665: - Set DEVICE_DESCRIPTION to version1 - Fix interface definition of ISubDevice - Add missing Init function for IPortFilterWaveCyclic and call it from IPortWaveCyclic - Add GUIDs for property set of Pin and Topology - Remove DISPATCH_TABLE from IPortTopology - Rewrite PcCreateItemDispatch to support pin creation requests - Add Property handler to IPortWaveCyclic (not yet used) - Make IPortFilterWaveCyclic singleton - Implement Adding property handlers to SUBDEVICE_DESCRIPTOR
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Feb 18 12:00:08 2009 New Revision: 39665 URL:
http://svn.reactos.org/svn/reactos?rev=39665&view=rev
Log: - Set DEVICE_DESCRIPTION to version1 - Fix interface definition of ISubDevice - Add missing Init function for IPortFilterWaveCyclic and call it from IPortWaveCyclic - Add GUIDs for property set of Pin and Topology - Remove DISPATCH_TABLE from IPortTopology - Rewrite PcCreateItemDispatch to support pin creation requests - Add Property handler to IPortWaveCyclic (not yet used) - Make IPortFilterWaveCyclic singleton - Implement Adding property handlers to SUBDEVICE_DESCRIPTOR Added: trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.c (with props) Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/api.c trunk/reactos/drivers/wdm/audio/backpln/portcls/drm_port.c trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c trunk/reactos/drivers/wdm/audio/backpln/portcls/port_midi.c trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c trunk/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c trunk/reactos/drivers/wdm/audio/backpln/portcls/resource.c trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.c Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/api.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/api.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/api.c [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -95,6 +95,7 @@ RtlZeroMemory(DeviceDescription, sizeof(DEVICE_DESCRIPTION)); DeviceDescription->Master = TRUE; + DeviceDescription->Version = DEVICE_DESCRIPTION_VERSION1; DeviceDescription->ScatterGather= ScatterGather; DeviceDescription->Dma32BitAddresses = Dma32BitAddresses; DeviceDescription->IgnoreCount = IgnoreCount; @@ -124,6 +125,7 @@ RtlZeroMemory(DeviceDescription, sizeof(DEVICE_DESCRIPTION)); + DeviceDescription->Version = DEVICE_DESCRIPTION_VERSION1; DeviceDescription->DemandMode = DemandMode; DeviceDescription->AutoInitialize = AutoInitialize; DeviceDescription->DmaSpeed = DmaSpeed; @@ -132,3 +134,4 @@ return STATUS_SUCCESS; } + Added: trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.c (added) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.c [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -1,0 +1,258 @@ +#include "private.h" + +NTSTATUS +NTAPI +Dispatch_fnDeviceIoControl( + PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION IoStack; + IIrpTarget * IrpTarget; + PKSOBJECT_CREATE_ITEM CreateItem; + + DPRINT1("Dispatch_fnDeviceIoControl called DeviceObject %p Irp %p\n", DeviceObject); + + /* access the create item */ + CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp); + + IoStack = IoGetCurrentIrpStackLocation(Irp); + ASSERT(IoStack->FileObject); + + IrpTarget = (IIrpTarget*)CreateItem->Context; + + return IrpTarget->lpVtbl->DeviceIoControl(IrpTarget, DeviceObject, Irp); +} + +NTSTATUS +NTAPI +Dispatch_fnRead( + PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION IoStack; + IIrpTarget * IrpTarget; + PKSOBJECT_CREATE_ITEM CreateItem; + + DPRINT1("Dispatch_fnRead called DeviceObject %p Irp %p\n", DeviceObject); + + /* access the create item */ + CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp); + + IoStack = IoGetCurrentIrpStackLocation(Irp); + ASSERT(IoStack->FileObject); + + IrpTarget = (IIrpTarget*)CreateItem->Context; + + return IrpTarget->lpVtbl->Read(IrpTarget, DeviceObject, Irp); +} + +NTSTATUS +NTAPI +Dispatch_fnWrite( + PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION IoStack; + IIrpTarget * IrpTarget; + PKSOBJECT_CREATE_ITEM CreateItem; + + DPRINT1("Dispatch_fnWrite called DeviceObject %p Irp %p\n", DeviceObject); + + /* access the create item */ + CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp); + + IoStack = IoGetCurrentIrpStackLocation(Irp); + ASSERT(IoStack->FileObject); + + IrpTarget = (IIrpTarget*)CreateItem->Context; + + return IrpTarget->lpVtbl->Write(IrpTarget, DeviceObject, Irp); +} + +NTSTATUS +NTAPI +Dispatch_fnFlush( + PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION IoStack; + IIrpTarget * IrpTarget; + PKSOBJECT_CREATE_ITEM CreateItem; + + DPRINT1("Dispatch_fnFlush called DeviceObject %p Irp %p\n", DeviceObject); + + /* access the create item */ + CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp); + + IoStack = IoGetCurrentIrpStackLocation(Irp); + ASSERT(IoStack->FileObject); + + IrpTarget = (IIrpTarget*)CreateItem->Context; + + return IrpTarget->lpVtbl->Flush(IrpTarget, DeviceObject, Irp); +} + +NTSTATUS +NTAPI +Dispatch_fnClose( + PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION IoStack; + IIrpTarget * IrpTarget; + PKSOBJECT_CREATE_ITEM CreateItem; + + DPRINT1("Dispatch_fnClose called DeviceObject %p Irp %p\n", DeviceObject); + + /* access the create item */ + CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp); + ASSERT(CreateItem != NULL); + + IoStack = IoGetCurrentIrpStackLocation(Irp); + ASSERT(IoStack != NULL); + ASSERT(IoStack->FileObject != NULL); + + IrpTarget = (IIrpTarget*)CreateItem->Context; + + DPRINT1("IrpTarget %p\n", IrpTarget); + + return IrpTarget->lpVtbl->Close(IrpTarget, DeviceObject, Irp); +} + +NTSTATUS +NTAPI +Dispatch_fnQuerySecurity( + PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION IoStack; + IIrpTarget * IrpTarget; + PKSOBJECT_CREATE_ITEM CreateItem; + + DPRINT1("Dispatch_fnQuerySecurity called DeviceObject %p Irp %p\n", DeviceObject); + + /* access the create item */ + CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp); + + IoStack = IoGetCurrentIrpStackLocation(Irp); + ASSERT(IoStack->FileObject); + + IrpTarget = (IIrpTarget*)CreateItem->Context; + + return IrpTarget->lpVtbl->QuerySecurity(IrpTarget, DeviceObject, Irp); +} + +NTSTATUS +NTAPI +Dispatch_fnSetSecurity( + PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + PIO_STACK_LOCATION IoStack; + IIrpTarget * IrpTarget; + PKSOBJECT_CREATE_ITEM CreateItem; + + DPRINT1("Dispatch_fnSetSecurity called DeviceObject %p Irp %p\n", DeviceObject); + + /* access the create item */ + CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp); + + IoStack = IoGetCurrentIrpStackLocation(Irp); + ASSERT(IoStack->FileObject); + + IrpTarget = (IIrpTarget*)CreateItem->Context; + + return IrpTarget->lpVtbl->SetSecurity(IrpTarget, DeviceObject, Irp); +} + +BOOLEAN +NTAPI +Dispatch_fnFastDeviceIoControl( + PFILE_OBJECT FileObject, + BOOLEAN Wait, + PVOID InputBuffer, + ULONG InputBufferLength, + PVOID OutputBuffer, + ULONG OutputBufferLength, + ULONG IoControlCode, + PIO_STATUS_BLOCK IoStatus, + PDEVICE_OBJECT DeviceObject) +{ + DPRINT1("Dispatch_fnFastDeviceIoControl called DeviceObject %p Irp %p\n", DeviceObject); + + + return FALSE; +} + + +BOOLEAN +NTAPI +Dispatch_fnFastRead( + PFILE_OBJECT FileObject, + PLARGE_INTEGER FileOffset, + ULONG Length, + BOOLEAN Wait, + ULONG LockKey, + PVOID Buffer, + PIO_STATUS_BLOCK IoStatus, + PDEVICE_OBJECT DeviceObject) +{ + DPRINT1("Dispatch_fnFastRead called DeviceObject %p Irp %p\n", DeviceObject); + + return FALSE; + +} + +BOOLEAN +NTAPI +Dispatch_fnFastWrite( + PFILE_OBJECT FileObject, + PLARGE_INTEGER FileOffset, + ULONG Length, + BOOLEAN Wait, + ULONG LockKey, + PVOID Buffer, + PIO_STATUS_BLOCK IoStatus, + PDEVICE_OBJECT DeviceObject) +{ + DPRINT1("Dispatch_fnFastWrite called DeviceObject %p Irp %p\n", DeviceObject); + + return FALSE; +} + +static KSDISPATCH_TABLE DispatchTable = +{ + Dispatch_fnDeviceIoControl, + Dispatch_fnRead, + Dispatch_fnWrite, + Dispatch_fnFlush, + Dispatch_fnClose, + Dispatch_fnQuerySecurity, + Dispatch_fnSetSecurity, + Dispatch_fnFastDeviceIoControl, + Dispatch_fnFastRead, + Dispatch_fnFastWrite, +}; + + +NTSTATUS +NTAPI +NewDispatchObject( + IN PIRP Irp, + IN IIrpTarget * Target) +{ + NTSTATUS Status; + KSOBJECT_HEADER ObjectHeader; + PKSOBJECT_CREATE_ITEM CreateItem; + + CreateItem = AllocateItem(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM), TAG_PORTCLASS); + if (!CreateItem) + return STATUS_INSUFFICIENT_RESOURCES; + + CreateItem->Context = (PVOID)Target; + + Status = KsAllocateObjectHeader(&ObjectHeader, 1, CreateItem, Irp, &DispatchTable); + DPRINT1("KsAllocateObjectHeader result %x\n", Status); + return Status; +} + Propchange: trunk/reactos/drivers/wdm/audio/backpln/portcls/dispatcher.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/drm_port.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/drm_port.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/drm_port.c [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -1,7 +1,4 @@ #include "private.h" - - - typedef struct { @@ -46,6 +43,7 @@ IN REFIID refiid, OUT PVOID* Output) { + WCHAR Buffer[100]; IDrmPort2Impl * This = (IDrmPort2Impl*)iface; if (IsEqualGUIDAligned(refiid, &IID_IDrmPort) || @@ -57,7 +55,9 @@ return STATUS_SUCCESS; } - DPRINT("IDrmPort2_QueryInterface: This %p unknown iid\n", This, This->ref); + StringFromCLSID(refiid, Buffer); + DPRINT1("IDrmPort2_QueryInterface no interface!!! iface %S\n", Buffer); + KeBugCheckEx(0, 0, 0, 0, 0); return STATUS_UNSUCCESSFUL; } Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/filter_wavecyclic.c [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -79,7 +79,7 @@ IN WCHAR * Name, IN PUNKNOWN Unknown, IN POOL_TYPE PoolType, - IN PDEVICE_OBJECT * DeviceObject, + IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN KSOBJECT_CREATE *CreateObject) { @@ -281,6 +281,26 @@ OUT PIO_STATUS_BLOCK StatusBlock, IN PDEVICE_OBJECT DeviceObject) { + return STATUS_SUCCESS; +} + +/* + * @implemented + */ +static +NTSTATUS +NTAPI +IPortFilterWaveCyclic_fnInit( + IN IPortFilterWaveCyclic* iface, + IN IPortWaveCyclic* Port) +{ + IPortFilterWaveCyclicImpl * This = (IPortFilterWaveCyclicImpl*)iface; + + This->Port = Port; + + /* increment reference count */ + iface->lpVtbl->AddRef(iface); + return STATUS_SUCCESS; } @@ -299,13 +319,13 @@ IPortFilterWaveCyclic_fnSetSecurity, IPortFilterWaveCyclic_fnFastDeviceIoControl, IPortFilterWaveCyclic_fnFastRead, - IPortFilterWaveCyclic_fnFastWrite + IPortFilterWaveCyclic_fnFastWrite, + IPortFilterWaveCyclic_fnInit }; - -NTSTATUS NewPortFilterWaveCyclic( - OUT IPortFilterWaveCyclic ** OutFilter, - IN IPortWaveCyclic* iface) +NTSTATUS +NewPortFilterWaveCyclic( + OUT IPortFilterWaveCyclic ** OutFilter) { IPortFilterWaveCyclicImpl * This; @@ -316,10 +336,6 @@ /* initialize IPortFilterWaveCyclic */ This->ref = 1; This->lpVtbl = &vt_IPortFilterWaveCyclic; - This->Port = iface; - - /* increment reference count */ - iface->lpVtbl->AddRef(iface); /* return result */ *OutFilter = (IPortFilterWaveCyclic*)&This->lpVtbl; Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/guids.c [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -43,6 +43,9 @@ const GUID IID_IUnknown = {0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x46}}; const GUID IID_IPortEvents = {0xA80F29C4L, 0x5498, 0x11D2, {0x95, 0xD9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}}; +const GUID KSNAME_PIN = {0x146F1A80, 0x4791, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}; + + //FIXME // const GUID KS_CATEGORY_AUDIO = {0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}}; @@ -52,9 +55,11 @@ const GUID KSDATAFORMAT_TYPE_AUDIO = {0x73647561L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; -const GUID KSDATAFORMAT_SUBTYPE_PCM = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; +const GUID KSDATAFORMAT_SUBTYPE_PCM = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID KSDATAFORMAT_SPECIFIER_WAVEFORMATEX = {0x05589f81L, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}}; +const GUID KSPROPSETID_Topology = {0x720D4AC0L, 0x7533, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}; +const GUID KSPROPSETID_Pin = {0x8C134960L, 0x51AD, 0x11CF, {0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00}}; /// /// undocumented guids Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.h [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -17,7 +17,7 @@ IN WCHAR * Name, \ IN PUNKNOWN Unknown, \ IN POOL_TYPE PoolType, \ - IN PDEVICE_OBJECT * DeviceObject, \ + IN PDEVICE_OBJECT DeviceObject, \ IN PIRP Irp, \ IN KSOBJECT_CREATE *CreateObject) PURE; \ \ @@ -106,9 +106,17 @@ typedef struct { + ULONG MaxKsPropertySetCount; + ULONG FreeKsPropertySetOffset; + PKSPROPERTY_SET Properties; +}KSPROPERTY_SET_LIST; + +typedef struct +{ ULONG InterfaceCount; GUID *Interfaces; KSPIN_FACTORY Factory; + KSPROPERTY_SET_LIST FilterPropertySet; }SUBDEVICE_DESCRIPTOR, *PSUBDEVICE_DESCRIPTOR; #undef INTERFACE @@ -128,7 +136,7 @@ IN WCHAR * Name, IN PUNKNOWN Unknown, IN POOL_TYPE PoolType, - IN PDEVICE_OBJECT * DeviceObject, + IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN KSOBJECT_CREATE *CreateObject) PURE; Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -157,11 +157,11 @@ IN WCHAR * Name, IN PUNKNOWN Unknown, IN POOL_TYPE PoolType, - IN PDEVICE_OBJECT * DeviceObject, + IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN KSOBJECT_CREATE *CreateObject) { - + DPRINT1("IPortPinWaveCyclic_fnNewIrpTarget\n"); return STATUS_UNSUCCESSFUL; } @@ -181,6 +181,7 @@ IoStack = IoGetCurrentIrpStackLocation(Irp); + DPRINT1("IPortPinWaveCyclic_fnDeviceIoControl\n"); if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_PROPERTY) { /// FIXME Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_midi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_midi.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_midi.c [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -330,7 +330,7 @@ IN WCHAR * Name, IN PUNKNOWN Unknown, IN POOL_TYPE PoolType, - IN PDEVICE_OBJECT * DeviceObject, + IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN KSOBJECT_CREATE *CreateObject) { Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.c [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -316,7 +316,7 @@ IN WCHAR * Name, IN PUNKNOWN Unknown, IN POOL_TYPE PoolType, - IN PDEVICE_OBJECT * DeviceObject, + IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN KSOBJECT_CREATE *CreateObject) { @@ -432,152 +432,6 @@ ISubDevice_fnPinCount }; - -NTSTATUS -NTAPI -ITopology_fnDeviceIoControl( - PDEVICE_OBJECT DeviceObject, - PIRP Irp) -{ - DPRINT1("ITopology_fnDeviceIoControl called\n"); - - return STATUS_SUCCESS; -} - -NTSTATUS -NTAPI -ITopology_fnRead( - PDEVICE_OBJECT DeviceObject, - PIRP Irp) -{ - DPRINT1("ITopology_fnRead called\n"); - - return STATUS_SUCCESS; -} - -NTSTATUS -NTAPI -ITopology_fnWrite( - PDEVICE_OBJECT DeviceObject, - PIRP Irp) -{ - DPRINT1("ITopology_fnWrite called\n"); - - return STATUS_SUCCESS; -} - -NTSTATUS -NTAPI -ITopology_fnFlush( - PDEVICE_OBJECT DeviceObject, - PIRP Irp) -{ - DPRINT1("ITopology_fnFlush called\n"); - - return STATUS_SUCCESS; -} - -NTSTATUS -NTAPI -ITopology_fnClose( - PDEVICE_OBJECT DeviceObject, - PIRP Irp) -{ - DPRINT1("ITopology_fnClose called\n"); - - return STATUS_SUCCESS; -} - -NTSTATUS -NTAPI -ITopology_fnQuerySecurity( - PDEVICE_OBJECT DeviceObject, - PIRP Irp) -{ - DPRINT1("ITopology_fnQuerySecurity called\n"); - - return STATUS_SUCCESS; -} - -NTSTATUS -NTAPI -ITopology_fnSetSecurity( - PDEVICE_OBJECT DeviceObject, - PIRP Irp) -{ - DPRINT1("ITopology_fnSetSecurity called\n"); - - return STATUS_SUCCESS; -} - -BOOLEAN -NTAPI -ITopology_fnFastDeviceIoControl( - PFILE_OBJECT FileObject, - BOOLEAN Wait, - PVOID InputBuffer, - ULONG InputBufferLength, - PVOID OutputBuffer, - ULONG OutputBufferLength, - ULONG IoControlCode, - PIO_STATUS_BLOCK IoStatus, - PDEVICE_OBJECT DeviceObject) -{ - DPRINT1("ITopology_fnFastDeviceIoControl called\n"); - - return TRUE; -} - - -BOOLEAN -NTAPI -ITopology_fnFastRead( - PFILE_OBJECT FileObject, - PLARGE_INTEGER FileOffset, - ULONG Length, - BOOLEAN Wait, - ULONG LockKey, - PVOID Buffer, - PIO_STATUS_BLOCK IoStatus, - PDEVICE_OBJECT DeviceObject) -{ - DPRINT1("ITopology_fnFastRead called\n"); - - return TRUE; - -} - -BOOLEAN -NTAPI -ITopology_fnFastWrite( - PFILE_OBJECT FileObject, - PLARGE_INTEGER FileOffset, - ULONG Length, - BOOLEAN Wait, - ULONG LockKey, - PVOID Buffer, - PIO_STATUS_BLOCK IoStatus, - PDEVICE_OBJECT DeviceObject) -{ - DPRINT1("ITopology_fnFastWrite called\n"); - - return TRUE; -} - -static KSDISPATCH_TABLE DispatchTable = -{ - ITopology_fnDeviceIoControl, - ITopology_fnRead, - ITopology_fnWrite, - ITopology_fnFlush, - ITopology_fnClose, - ITopology_fnQuerySecurity, - ITopology_fnSetSecurity, - ITopology_fnFastDeviceIoControl, - ITopology_fnFastRead, - ITopology_fnFastWrite, -}; - NTSTATUS NTAPI PcCreateItemDispatch( @@ -585,21 +439,21 @@ IN PIRP Irp) { NTSTATUS Status = STATUS_SUCCESS; - + PIO_STACK_LOCATION IoStack; ISubdevice * SubDevice; PPCLASS_DEVICE_EXTENSION DeviceExt; SUBDEVICE_ENTRY * Entry; + IIrpTarget *Filter, *Pin; PKSOBJECT_CREATE_ITEM CreateItem; - DPRINT1("PcCreateItemDispatch called\n"); + DPRINT1("PcCreateItemDispatch called DeviceObject %p\n", DeviceObject); /* access the create item */ CreateItem = KSCREATE_ITEM_IRP_STORAGE(Irp); if (!CreateItem) { DPRINT1("PcCreateItemDispatch no CreateItem\n"); - Status = STATUS_UNSUCCESSFUL; - goto cleanup; + return STATUS_UNSUCCESSFUL; } SubDevice = (ISubdevice*)CreateItem->Context; @@ -608,20 +462,17 @@ if (!SubDevice || !DeviceExt) { DPRINT1("PcCreateItemDispatch SubDevice %p DeviceExt %p\n", SubDevice, DeviceExt); - - Status = STATUS_UNSUCCESSFUL; - goto cleanup; + return STATUS_UNSUCCESSFUL; } Entry = AllocateItem(NonPagedPool, sizeof(SUBDEVICE_ENTRY), TAG_PORTCLASS); if (!Entry) { DPRINT1("PcCreateItemDispatch no memory\n"); - - Status = STATUS_INSUFFICIENT_RESOURCES; - goto cleanup; - } -#if 0 + return STATUS_INSUFFICIENT_RESOURCES; + } + +#if KS_IMPLEMENTED Status = KsReferenceSoftwareBusObject(DeviceExt->KsDeviceHeader); if (!NT_SUCCESS(Status) && Status != STATUS_NOT_IMPLEMENTED) { @@ -632,24 +483,77 @@ } #endif - Status = KsAllocateObjectHeader(&Entry->ObjectHeader, 0, NULL, Irp, &DispatchTable); + + /* get current io stack location */ + IoStack = IoGetCurrentIrpStackLocation(Irp); + /* sanity check */ + ASSERT(IoStack->FileObject != NULL); + + if (IoStack->FileObject->FsContext != NULL) + { + /* nothing to do */ + DPRINT1("FsContext already exists\n"); + return STATUS_SUCCESS; + } + + + /* get filter object + * is implemented as a singleton + */ + Status = SubDevice->lpVtbl->NewIrpTarget(SubDevice, + &Filter, + NULL, + NULL, + NonPagedPool, + DeviceObject, + Irp, + NULL); if (!NT_SUCCESS(Status)) { - DPRINT1("KsAllocateObjectHeader failed with %x\n", Status); - //KsDereferenceSoftwareBusObject(DeviceExt->KsDeviceHeader); - FreeItem(Entry, TAG_PORTCLASS); + DPRINT1("Failed to get filter object\n"); return Status; } - InsertTailList(&DeviceExt->SubDeviceList, &Entry->Entry); - - -cleanup: - // Irp->IoStatus.Status = Status; - // Irp->IoStatus.Information = 0; - // IoCompleteRequest(Irp, IO_NO_INCREMENT); - - DPRINT1("PcCreateItemDispatch Status %x\n", Status); + /* is just the filter requested */ + if (IoStack->FileObject->FileName.Buffer == NULL) + { + /* create the dispatch object */ + Status = NewDispatchObject(Irp, Filter); + + DPRINT1("Filter %p\n", Filter); + DbgBreakPoint(); + } + else + { + KSOBJECT_CREATE Create; + LPWSTR Buffer = IoStack->FileObject->FileName.Buffer; + + static LPWSTR KS_NAME_PIN = L"{146F1A80-4791-11D0-A5D6-28DB04C10000}"; + + /* is the request for a new pin */ + if (!wcsncmp(KS_NAME_PIN, Buffer, wcslen(KS_NAME_PIN))) + { + /* try to create new pin */ + Create.CreateItemsCount = 1; + Create.CreateItemsList = (PKSOBJECT_CREATE_ITEM)(IoStack->FileObject->FileName.Buffer + (wcslen(KS_NAME_PIN) + 1)); + + Status = Filter->lpVtbl->NewIrpTarget(Filter, + &Pin, + KS_NAME_PIN, + NULL, + NonPagedPool, + DeviceObject, + Irp, + &Create); + if (NT_SUCCESS(Status)) + { + /* create the dispatch object */ + Status = NewDispatchObject(Irp, Pin); + DPRINT1("Pin %p\n", Pin); + } + } + } + return Status; } Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.c [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -19,7 +19,10 @@ PPOWERNOTIFY pPowerNotify; PPCFILTER_DESCRIPTOR pDescriptor; PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor; + IPortFilterWaveCyclic * Filter; }IPortWaveCyclicImpl; + +GUID KSPROPERTY_SETID_Topology = {0x720D4AC0L, 0x7533, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}; static GUID InterfaceGuids[3] = { @@ -36,6 +39,32 @@ 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} } }; + +DEFINE_KSPROPERTY_TOPOLOGYSET(PortFilterWaveCyclicTopologySet, TopologyPropertyHandler); +DEFINE_KSPROPERTY_PINSETCONSTRAINED(PortFilterWaveCyclicPinSet, PinPropertyHandler, PinPropertyHandler, PinPropertyHandler); + +KSPROPERTY_SET WaveCyclicPropertySet[] = +{ + { + &KSPROPSETID_Topology, + sizeof(PortFilterWaveCyclicTopologySet) / sizeof(KSPROPERTY_ITEM), + (const KSPROPERTY_ITEM*)&PortFilterWaveCyclicTopologySet, + 0, + NULL + }, + { + &KSPROPSETID_Pin, + sizeof(PortFilterWaveCyclicPinSet) / sizeof(KSPROPERTY_ITEM), + (const KSPROPERTY_ITEM*)&PortFilterWaveCyclicPinSet, + 0, + NULL + } +}; + +//KSEVENTSETID_LoopedStreaming, Type = KSEVENT_LOOPEDSTREAMING_POSITION +//KSEVENTSETID_Connection, Type = KSEVENT_CONNECTION_ENDOFSTREAM, + + #if 0 static const KSIDENTIFIER Identifiers[] = @@ -319,11 +348,11 @@ /* create the subdevice descriptor */ Status = PcCreateSubdeviceDescriptor(&This->SubDeviceDescriptor, 3, - InterfaceGuids, + InterfaceGuids, 0, NULL, - 0, - NULL, + 2, + WaveCyclicPropertySet, 0, 0, 0, @@ -536,7 +565,7 @@ IN WCHAR * Name, IN PUNKNOWN Unknown, IN POOL_TYPE PoolType, - IN PDEVICE_OBJECT * DeviceObject, + IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN KSOBJECT_CREATE *CreateObject) { @@ -546,13 +575,28 @@ DPRINT1("ISubDevice_NewIrpTarget this %p\n", This); - Status = NewPortFilterWaveCyclic(&Filter, (IPortWaveCyclic*)This); - if (NT_SUCCESS(Status)) - { - *OutTarget = (IIrpTarget*)Filter; - } - - return STATUS_UNSUCCESSFUL; + if (This->Filter) + { + *OutTarget = (IIrpTarget*)This->Filter; + return STATUS_SUCCESS; + } + + + Status = NewPortFilterWaveCyclic(&Filter); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + Status = Filter->lpVtbl->Init(Filter, (IPortWaveCyclic*)This); + if (!NT_SUCCESS(Status)) + { + Filter->lpVtbl->Release(Filter); + return Status; + } + + *OutTarget = (IIrpTarget*)Filter; + return Status; } static Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.c [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -613,7 +613,7 @@ IN WCHAR * Name, IN PUNKNOWN Unknown, IN POOL_TYPE PoolType, - IN PDEVICE_OBJECT * DeviceObject, + IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN KSOBJECT_CREATE *CreateObject) { Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -12,6 +12,7 @@ <library>libcntpr</library> <file>api.c</file> <file>connection.c</file> + <file>dispatcher.c</file> <file>dll.c</file> <file>dma_slave.c</file> <file>drm_port.c</file> @@ -35,6 +36,7 @@ <file>port_topology.c</file> <file>port_wavepci.c</file> <file>port_wavecyclic.c</file> + <file>propertyhandler.c</file> <file>miniport.c</file> <file>miniport_dmus.c</file> <file>miniport_fmsynth.c</file> Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -83,11 +83,16 @@ OUT PPORTCLSVERSION * OutVersion); NTSTATUS NewPortFilterWaveCyclic( - OUT IPortFilterWaveCyclic ** OutFilter, - IN IPortWaveCyclic* iface); + OUT IPortFilterWaveCyclic ** OutFilter); NTSTATUS NewPortPinWaveCyclic( OUT IPortPinWaveCyclic ** OutPin); + +NTSTATUS +NTAPI +NewDispatchObject( + IN PIRP Irp, + IN IIrpTarget * Target); PVOID AllocateItem(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag); @@ -118,6 +123,19 @@ ULONG ToPin; }PHYSICAL_CONNECTION; +NTSTATUS +NTAPI +TopologyPropertyHandler( + IN PIRP Irp, + IN PKSIDENTIFIER Request, + IN OUT PVOID Data); + +NTSTATUS +NTAPI +PinPropertyHandler( + IN PIRP Irp, + IN PKSIDENTIFIER Request, + IN OUT PVOID Data); typedef struct { Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -64,6 +64,7 @@ } DPRINT("IRegistryKey_QueryInterface: This %p unknown iid\n", This, This->ref); +KeBugCheckEx(0,0,0,0,0); return STATUS_UNSUCCESSFUL; } @@ -138,8 +139,11 @@ return STATUS_INSUFFICIENT_RESOURCES; } + if (OuterUnknown) + OuterUnknown->lpVtbl->AddRef(OuterUnknown); + NewThis->hKey = hKey; - NewThis->ref = 1; + NewThis->ref = 2; NewThis->lpVtbl = &vt_IRegistryKey; *RegistrySubKey = (PREGISTRYKEY)&NewThis->lpVtbl; @@ -222,7 +226,7 @@ }; /* - * @unimplemented + * @implemented */ NTSTATUS NTAPI PcNewRegistryKey( @@ -301,9 +305,12 @@ return STATUS_INSUFFICIENT_RESOURCES; } + if (OuterUnknown) + OuterUnknown->lpVtbl->AddRef(OuterUnknown); + This->hKey = hHandle; This->lpVtbl = &vt_IRegistryKey; - This->ref = 1; + This->ref = 2; *OutRegistryKey = (PREGISTRYKEY)&This->lpVtbl; DPRINT1("PcNewRegistryKey result %p\n", *OutRegistryKey); Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/resource.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/resource.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/resource.c [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -37,13 +37,27 @@ IN REFIID refiid, OUT PVOID* Output) { - IResourceListImpl * This = (IResourceListImpl*)iface; - if (IsEqualGUIDAligned(refiid, &IID_IResourceList)) + WCHAR Buffer[100]; + + IResourceListImpl * This = (IResourceListImpl*)iface; + if (IsEqualGUIDAligned(refiid, &IID_IResourceList) || + IsEqualGUIDAligned(refiid, &IID_IUnknown)) { *Output = &This->lpVtbl; InterlockedIncrement(&This->ref); return STATUS_SUCCESS; } +#if 0 + else if (IsEqualGUIDAligned(refiid, &IID_IDrmPort) || + IsEqualGUIDAligned(refiid, &IID_IDrmPort2)) + { + return NewIDrmPort((PDRMPORT2*)Output); + } +#endif + StringFromCLSID(refiid, Buffer); + DPRINT1("IResourceList_fnQueryInterface no interface!!! iface %S\n", Buffer); + KeBugCheckEx(0, 0, 0, 0, 0); + return STATUS_UNSUCCESSFUL; } Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/undoc.c [iso-8859-1] Wed Feb 18 12:00:08 2009 @@ -79,6 +79,41 @@ return STATUS_NOT_IMPLEMENTED; } +NTSTATUS +AddToPropertyTable( + IN OUT SUBDEVICE_DESCRIPTOR * Descriptor, + IN KSPROPERTY_SET * FilterProperty) +{ + if (Descriptor->FilterPropertySet.FreeKsPropertySetOffset >= Descriptor->FilterPropertySet.MaxKsPropertySetCount) + { + DPRINT1("FIXME\n"); + return STATUS_UNSUCCESSFUL; + } + + RtlMoveMemory(&Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset], + FilterProperty, + sizeof(KSPROPERTY_SET)); + + if (FilterProperty->PropertiesCount) + { + Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset].PropertyItem = AllocateItem(NonPagedPool, + sizeof(KSPROPERTY_ITEM) * FilterProperty->PropertiesCount, + TAG_PORTCLASS); + + if (!Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset].PropertyItem) + { + Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset].PropertiesCount = 0; + return STATUS_INSUFFICIENT_RESOURCES; + } + RtlMoveMemory((PVOID)Descriptor->FilterPropertySet.Properties[Descriptor->FilterPropertySet.FreeKsPropertySetOffset].PropertyItem, + FilterProperty->PropertyItem, + sizeof(KSPROPERTY_ITEM) * FilterProperty->PropertiesCount); + } + + Descriptor->FilterPropertySet.FreeKsPropertySetOffset++; + + return STATUS_SUCCESS; +} /* * @unimplemented @@ -117,13 +152,28 @@ RtlCopyMemory(Descriptor->Interfaces, InterfaceGuids, sizeof(GUID) * InterfaceCount); Descriptor->InterfaceCount = InterfaceCount; + if (FilterPropertiesCount) + { + + /// FIXME + /// handle driver properties + Descriptor->FilterPropertySet.Properties = AllocateItem(NonPagedPool, sizeof(KSPROPERTY_SET) * FilterPropertiesCount, TAG_PORTCLASS); + if (! Descriptor->FilterPropertySet.Properties) + goto cleanup; + + Descriptor->FilterPropertySet.MaxKsPropertySetCount = FilterPropertiesCount; + for(Index = 0; Index < FilterPropertiesCount; Index++) + { + Status = AddToPropertyTable(Descriptor, &FilterProperties[Index]); + if (!NT_SUCCESS(Status)) + goto cleanup; + } + } + if (FilterDescription->PinCount) { - /// FIXME - /// handle extra size - ASSERT(FilterDescription->PinSize == sizeof(KSPIN_DESCRIPTOR)); - Descriptor->Factory.KsPinDescriptor = AllocateItem(NonPagedPool, sizeof(KSPIN_DESCRIPTOR) * FilterDescription->PinCount, TAG_PORTCLASS); + Descriptor->Factory.KsPinDescriptor = AllocateItem(NonPagedPool, FilterDescription->PinSize * FilterDescription->PinCount, TAG_PORTCLASS); if (!Descriptor->Factory.KsPinDescriptor) goto cleanup; @@ -132,7 +182,7 @@ /* copy pin factories */ for(Index = 0; Index < FilterDescription->PinCount; Index++) - RtlMoveMemory(&Descriptor->Factory.KsPinDescriptor[Index], &FilterDescription->Pins[Index].KsPinDescriptor, sizeof(KSPIN_DESCRIPTOR)); + RtlMoveMemory(&Descriptor->Factory.KsPinDescriptor[Index], &FilterDescription->Pins[Index].KsPinDescriptor, FilterDescription->PinSize); } *OutSubdeviceDescriptor = Descriptor;
15 years, 10 months
1
0
0
0
[janderwald] 39664: - Fix KSOBJECT_CREATE struct - Add KSNAME_Pin
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Feb 18 11:59:30 2009 New Revision: 39664 URL:
http://svn.reactos.org/svn/reactos?rev=39664&view=rev
Log: - Fix KSOBJECT_CREATE struct - Add KSNAME_Pin Modified: trunk/reactos/include/psdk/ks.h Modified: trunk/reactos/include/psdk/ks.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ks.h?rev=3966…
============================================================================== --- trunk/reactos/include/psdk/ks.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ks.h [iso-8859-1] Wed Feb 18 11:59:30 2009 @@ -436,6 +436,12 @@ 0x8C134960L, 0x51AD, 0x11CF, 0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00 DEFINE_GUIDSTRUCT("8C134960-51AD-11CF-878A-94F801C10000", KSPROPSETID_Pin); #define KSPROPSETID_Pin DEFINE_GUIDNAMED(KSPROPSETID_Pin) + +#define STATIC_KSNAME_Pin\ + 0x146F1A80L, 0x4791, 0x11D0, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 +DEFINE_GUIDSTRUCT("146F1A80-4791-11D0-A5D6-28DB04C10000", KSNAME_Pin); +#define KSNAME_Pin DEFINE_GUIDNAMED(KSNAME_Pin) + typedef enum { @@ -1416,11 +1422,6 @@ /* =============================================================== Objects ??? SORT ME! */ - -typedef struct -{ -} KSOBJECT_CREATE, *PKSOBJECT_CREATE; - #if defined(_NTDDK_) typedef struct { @@ -1431,6 +1432,11 @@ ULONG Flags; } KSOBJECT_CREATE_ITEM, *PKSOBJECT_CREATE_ITEM; +typedef struct +{ + ULONG CreateItemsCount; + PKSOBJECT_CREATE_ITEM CreateItemsList; +} KSOBJECT_CREATE, *PKSOBJECT_CREATE; typedef VOID (*PFNKSITEMFREECALLBACK)( IN PKSOBJECT_CREATE_ITEM CreateItem);
15 years, 10 months
1
0
0
0
[fireball] 39663: - Fix for Bug 703. - ReactOS can now be installed on systems with as little as 24MB. Memory usage after boot is down by 20-30MB. Application installations will use/require/leak less memory. - Patch by Alex Ionescu. See issue #703 for more details.
by fireball@svn.reactos.org
Author: fireball Date: Wed Feb 18 10:56:42 2009 New Revision: 39663 URL:
http://svn.reactos.org/svn/reactos?rev=39663&view=rev
Log: - Fix for Bug 703. - ReactOS can now be installed on systems with as little as 24MB. Memory usage after boot is down by 20-30MB. Application installations will use/require/leak less memory. - Patch by Alex Ionescu. See issue #703 for more details. Modified: trunk/reactos/ntoskrnl/cc/view.c trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c trunk/reactos/ntoskrnl/mm/balance.c Modified: trunk/reactos/ntoskrnl/cc/view.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/view.c?rev=396…
============================================================================== --- trunk/reactos/ntoskrnl/cc/view.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/cc/view.c [iso-8859-1] Wed Feb 18 10:56:42 2009 @@ -70,11 +70,6 @@ static NPAGED_LOOKASIDE_LIST BcbLookasideList; static NPAGED_LOOKASIDE_LIST CacheSegLookasideList; -static ULONG CcTimeStamp; -static KEVENT LazyCloseThreadEvent; -static HANDLE LazyCloseThreadHandle; -static CLIENT_ID LazyCloseThreadId; -static volatile BOOLEAN LazyCloseThreadShouldTerminate; #if defined(__GNUC__) /* void * alloca(size_t size); */ @@ -308,85 +303,97 @@ * actually freed is returned. */ { - PLIST_ENTRY current_entry; - PCACHE_SEGMENT current, last = NULL; - ULONG PagesPerSegment; - ULONG PagesFreed; - KIRQL oldIrql; - LIST_ENTRY FreeList; - - DPRINT("CcRosTrimCache(Target %d)\n", Target); - - *NrFreed = 0; - - InitializeListHead(&FreeList); - - KeAcquireGuardedMutex(&ViewLock); - current_entry = CacheSegmentLRUListHead.Flink; - while (current_entry != &CacheSegmentLRUListHead && Target > 0) - { - current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, - CacheSegmentLRUListEntry); - current_entry = current_entry->Flink; - - KeAcquireSpinLock(¤t->Bcb->BcbLock, &oldIrql); - if (current->ReferenceCount == 0) - { - RemoveEntryList(¤t->BcbSegmentListEntry); - KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql); - RemoveEntryList(¤t->CacheSegmentListEntry); - RemoveEntryList(¤t->CacheSegmentLRUListEntry); - InsertHeadList(&FreeList, ¤t->BcbSegmentListEntry); - PagesPerSegment = current->Bcb->CacheSegmentSize / PAGE_SIZE; - PagesFreed = min(PagesPerSegment, Target); - Target -= PagesFreed; - (*NrFreed) += PagesFreed; - } - else - { - if (last != current && current->MappedCount > 0 && !current->Dirty && !current->PageOut) - { - ULONG i; - NTSTATUS Status; - - CcRosCacheSegmentIncRefCount(current); - last = current; - current->PageOut = TRUE; - KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql); - KeReleaseGuardedMutex(&ViewLock); - for (i = 0; i < current->Bcb->CacheSegmentSize / PAGE_SIZE; i++) - { - PFN_TYPE Page; - Page = (PFN_TYPE)(MmGetPhysicalAddress((char*)current->BaseAddress + i * PAGE_SIZE).QuadPart >> PAGE_SHIFT); - Status = MmPageOutPhysicalAddress(Page); - if (!NT_SUCCESS(Status)) - { - break; - } - } - KeAcquireGuardedMutex(&ViewLock); - KeAcquireSpinLock(¤t->Bcb->BcbLock, &oldIrql); - CcRosCacheSegmentDecRefCount(current); - current->PageOut = FALSE; - KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql); - current_entry = ¤t->CacheSegmentLRUListEntry; - continue; - } - KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql); - } - } - KeReleaseGuardedMutex(&ViewLock); - - while (!IsListEmpty(&FreeList)) - { - current_entry = RemoveHeadList(&FreeList); - current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, - BcbSegmentListEntry); - CcRosInternalFreeCacheSegment(current); - } - - DPRINT("CcRosTrimCache() finished\n"); - return(STATUS_SUCCESS); + PLIST_ENTRY current_entry; + PCACHE_SEGMENT current; + ULONG PagesPerSegment; + ULONG PagesFreed; + KIRQL oldIrql; + LIST_ENTRY FreeList; + + DPRINT("CcRosTrimCache(Target %d)\n", Target); + + *NrFreed = 0; + + InitializeListHead(&FreeList); + + KeAcquireGuardedMutex(&ViewLock); + current_entry = CacheSegmentLRUListHead.Flink; + while (current_entry != &CacheSegmentLRUListHead && Target > 0) + { + NTSTATUS Status; + + Status = STATUS_SUCCESS; + current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, + CacheSegmentLRUListEntry); + current_entry = current_entry->Flink; + + KeAcquireSpinLock(¤t->Bcb->BcbLock, &oldIrql); + + if (current->MappedCount > 0 && !current->Dirty && !current->PageOut) + { + ULONG i; + + CcRosCacheSegmentIncRefCount(current); + current->PageOut = TRUE; + KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql); + KeReleaseGuardedMutex(&ViewLock); + for (i = 0; i < current->Bcb->CacheSegmentSize / PAGE_SIZE; i++) + { + PFN_TYPE Page; + Page = (PFN_TYPE)(MmGetPhysicalAddress((char*)current->BaseAddress + i * PAGE_SIZE).QuadPart >> PAGE_SHIFT); + Status = MmPageOutPhysicalAddress(Page); + } + KeAcquireGuardedMutex(&ViewLock); + KeAcquireSpinLock(¤t->Bcb->BcbLock, &oldIrql); + CcRosCacheSegmentDecRefCount(current); + } + + if (current->ReferenceCount == 0) + { + PagesPerSegment = current->Bcb->CacheSegmentSize / PAGE_SIZE; + // PagesFreed = PagesPerSegment; + PagesFreed = min(PagesPerSegment, Target); + Target -= PagesFreed; + (*NrFreed) += PagesFreed; + } + + KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql); + } + + current_entry = CacheSegmentLRUListHead.Flink; + while (current_entry != &CacheSegmentLRUListHead) + { + current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, + CacheSegmentLRUListEntry); + current->PageOut = FALSE; + current_entry = current_entry->Flink; + + KeAcquireSpinLock(¤t->Bcb->BcbLock, &oldIrql); + if (current->ReferenceCount == 0) + { + RemoveEntryList(¤t->BcbSegmentListEntry); + KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql); + RemoveEntryList(¤t->CacheSegmentListEntry); + RemoveEntryList(¤t->CacheSegmentLRUListEntry); + InsertHeadList(&FreeList, ¤t->BcbSegmentListEntry); + } + else + { + KeReleaseSpinLock(¤t->Bcb->BcbLock, oldIrql); + } + } + + KeReleaseGuardedMutex(&ViewLock); + + while (!IsListEmpty(&FreeList)) + { + current_entry = RemoveHeadList(&FreeList); + current = CONTAINING_RECORD(current_entry, CACHE_SEGMENT, + BcbSegmentListEntry); + CcRosInternalFreeCacheSegment(current); + } + + return(STATUS_SUCCESS); } NTSTATUS @@ -1151,15 +1158,7 @@ if (Bcb->RefCount == 0) { MmFreeSectionSegments(Bcb->FileObject); - if (Bcb->RemoveOnClose) - { CcRosDeleteFileCache(FileObject, Bcb); - } - else - { - Bcb->TimeStamp = CcTimeStamp; - InsertHeadList(&ClosedListHead, &Bcb->BcbRemoveListEntry); - } } } KeReleaseGuardedMutex(&ViewLock); @@ -1188,15 +1187,7 @@ if (Bcb->RefCount == 0) { MmFreeSectionSegments(Bcb->FileObject); - if (Bcb->RemoveOnClose) - { CcRosDeleteFileCache(FileObject, Bcb); - } - else - { - Bcb->TimeStamp = CcTimeStamp; - InsertHeadList(&ClosedListHead, &Bcb->BcbRemoveListEntry); - } } } } @@ -1315,60 +1306,6 @@ return NULL; } -VOID NTAPI -CmLazyCloseThreadMain(PVOID Ignored) -{ - LARGE_INTEGER Timeout; - PLIST_ENTRY current_entry; - PBCB current; - ULONG RemoveTimeStamp; - NTSTATUS Status; - - KeQuerySystemTime (&Timeout); - - while (1) - { - Timeout.QuadPart += (LONGLONG)100000000; // 10sec - Status = KeWaitForSingleObject(&LazyCloseThreadEvent, - 0, - KernelMode, - FALSE, - &Timeout); - - DPRINT("LazyCloseThreadMain %d\n", CcTimeStamp); - - if (!NT_SUCCESS(Status)) - { - DbgPrint("LazyCloseThread: Wait failed\n"); - KeBugCheck(CACHE_MANAGER); - break; - } - if (LazyCloseThreadShouldTerminate) - { - DbgPrint("LazyCloseThread: Terminating\n"); - break; - } - - KeAcquireGuardedMutex(&ViewLock); - CcTimeStamp++; - if (CcTimeStamp >= 30) - { - RemoveTimeStamp = CcTimeStamp - 30; /* 5min = 10sec * 30 */ - while (!IsListEmpty(&ClosedListHead)) - { - current_entry = ClosedListHead.Blink; - current = CONTAINING_RECORD(current_entry, BCB, BcbRemoveListEntry); - if (current->TimeStamp >= RemoveTimeStamp) - { - break; - } - CcRosDeleteFileCache(current->FileObject, current); - } - } - KeReleaseGuardedMutex(&ViewLock); - } -} - VOID INIT_FUNCTION NTAPI @@ -1379,8 +1316,6 @@ PVOID Buffer; PHYSICAL_ADDRESS BoundaryAddressMultiple; #endif - NTSTATUS Status; - KPRIORITY Priority; DPRINT("CcInitView()\n"); #ifdef CACHE_BITMAP @@ -1443,25 +1378,6 @@ CcInitCacheZeroPage(); - CcTimeStamp = 0; - LazyCloseThreadShouldTerminate = FALSE; - KeInitializeEvent (&LazyCloseThreadEvent, SynchronizationEvent, FALSE); - Status = PsCreateSystemThread(&LazyCloseThreadHandle, - THREAD_ALL_ACCESS, - NULL, - NULL, - &LazyCloseThreadId, - (PKSTART_ROUTINE)CmLazyCloseThreadMain, - NULL); - if (NT_SUCCESS(Status)) - { - Priority = LOW_REALTIME_PRIORITY; - NtSetInformationThread(LazyCloseThreadHandle, - ThreadPriority, - &Priority, - sizeof(Priority)); - } - } /* EOF */ Modified: trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb_symbols.…
============================================================================== --- trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c [iso-8859-1] Wed Feb 18 10:56:42 2009 @@ -684,7 +684,7 @@ ULONG BootPhase) { PCHAR p1, p2; - SHORT Found; + SHORT Found = FALSE; CHAR YesNo; LIST_ENTRY *ModuleEntry; PLDR_DATA_TABLE_ENTRY DataTableEntry; @@ -707,12 +707,6 @@ InitializeListHead(&SymbolFileListHead); KeInitializeSpinLock(&SymbolFileListLock); - -#ifdef DBG - LoadSymbols = TRUE; -#else - LoadSymbols = FALSE; -#endif /* Check the command line for /LOADSYMBOLS, /NOLOADSYMBOLS, * /LOADSYMBOLS={YES|NO}, /NOLOADSYMBOLS={YES|NO} */ Modified: trunk/reactos/ntoskrnl/mm/balance.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/balance.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] Wed Feb 18 10:56:42 2009 @@ -68,7 +68,18 @@ /* Set up targets. */ MiMinimumAvailablePages = 64; - MiMemoryConsumers[MC_CACHE].PagesTarget = NrAvailablePages / 2; + if ((NrAvailablePages + NrSystemPages) >= 8192) + { + MiMemoryConsumers[MC_CACHE].PagesTarget = NrAvailablePages / 4 * 3; + } + else if ((NrAvailablePages + NrSystemPages) >= 4096) + { + MiMemoryConsumers[MC_CACHE].PagesTarget = NrAvailablePages / 3 * 2; + } + else + { + MiMemoryConsumers[MC_CACHE].PagesTarget = NrAvailablePages / 8; + } MiMemoryConsumers[MC_USER].PagesTarget = NrAvailablePages - MiMinimumAvailablePages; MiMemoryConsumers[MC_PPOOL].PagesTarget = NrAvailablePages / 2;
15 years, 10 months
1
0
0
0
[fireball] 39662: - Display memory usage in the installer as Kernel Cache and Kernel Pool, instead of Paged and Nonpaged Pool, which doesn't reveal the source of the memory leak. - Remove 40% memory delay hack. - Patch by Alex Ionescu.
by fireball@svn.reactos.org
Author: fireball Date: Wed Feb 18 10:35:14 2009 New Revision: 39662 URL:
http://svn.reactos.org/svn/reactos?rev=39662&view=rev
Log: - Display memory usage in the installer as Kernel Cache and Kernel Pool, instead of Paged and Nonpaged Pool, which doesn't reveal the source of the memory leak. - Remove 40% memory delay hack. - Patch by Alex Ionescu. Modified: trunk/reactos/base/setup/usetup/interface/usetup.c Modified: trunk/reactos/base/setup/usetup/interface/usetup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
============================================================================== --- trunk/reactos/base/setup/usetup/interface/usetup.c [iso-8859-1] (original) +++ trunk/reactos/base/setup/usetup/interface/usetup.c [iso-8859-1] Wed Feb 18 10:35:14 2009 @@ -3053,18 +3053,9 @@ } /* Set current values */ - ProgressSetStep(CopyContext->MemoryBars[0], PerfInfo.PagedPoolPages); - ProgressSetStep(CopyContext->MemoryBars[1], PerfInfo.NonPagedPoolPages); + ProgressSetStep(CopyContext->MemoryBars[0], PerfInfo.PagedPoolPages + PerfInfo.NonPagedPoolPages); + ProgressSetStep(CopyContext->MemoryBars[1], PerfInfo.ResidentSystemCachePage); ProgressSetStep(CopyContext->MemoryBars[2], PerfInfo.AvailablePages); - - /* Check if memory dropped below 40%! */ - if (CopyContext->MemoryBars[2]->Percent <= 40) - { - /* Wait a while until Mm does its thing */ - LARGE_INTEGER Interval; - Interval.QuadPart = -1 * 15 * 1000 * 100; - NtDelayExecution(FALSE, &Interval); - } } static UINT CALLBACK @@ -3138,7 +3129,7 @@ 13, 44, FALSE, - "Paged Memory"); + "Kernel Pool"); /* Create the non paged pool progress bar */ CopyContext.MemoryBars[1] = CreateProgressBar((xScreen / 2)- (mem_bar_width / 2), @@ -3148,7 +3139,7 @@ (xScreen / 2)- (mem_bar_width / 2), 44, FALSE, - "Nonpaged Memory"); + "Kernel Cache"); /* Create the global memory progress bar */ CopyContext.MemoryBars[2] = CreateProgressBar(xScreen - 13 - mem_bar_width,
15 years, 10 months
1
0
0
0
← Newer
1
...
13
14
15
16
17
18
19
...
56
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Results per page:
10
25
50
100
200