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
October 2016
----- 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
20 participants
222 discussions
Start a n
N
ew thread
[janderwald] 72973: [USBAUDIO] - implement building topology connections
by janderwald@svn.reactos.org
Author: janderwald Date: Sat Oct 15 17:56:44 2016 New Revision: 72973 URL:
http://svn.reactos.org/svn/reactos?rev=72973&view=rev
Log: [USBAUDIO] - implement building topology connections Modified: trunk/reactos/drivers/usb/usbaudio/filter.c trunk/reactos/drivers/usb/usbaudio/usbaudio.h Modified: trunk/reactos/drivers/usb/usbaudio/filter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/filte…
============================================================================== --- trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] Sat Oct 15 17:56:44 2016 @@ -92,7 +92,8 @@ ULONG CountTopologyComponents( - IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor) + IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, + OUT PULONG OutDescriptorCount) { PUSB_INTERFACE_DESCRIPTOR Descriptor; PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR InterfaceHeaderDescriptor; @@ -101,6 +102,7 @@ PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR FeatureUnitDescriptor; PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR MixerUnitDescriptor; ULONG NodeCount = 0; + ULONG DescriptorCount = 0; UCHAR Value; for (Descriptor = USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor, ConfigurationDescriptor, -1, -1, USB_DEVICE_CLASS_AUDIO, -1, -1); @@ -119,10 +121,12 @@ if (InputTerminalDescriptor->bDescriptorSubtype == 0x02 /* INPUT TERMINAL*/ || InputTerminalDescriptor->bDescriptorSubtype == 0x03 /* OUTPUT_TERMINAL*/) { NodeCount++; + DescriptorCount++; } else if (InputTerminalDescriptor->bDescriptorSubtype == 0x06 /* FEATURE_UNIT*/) { FeatureUnitDescriptor = (PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR)InputTerminalDescriptor; + DescriptorCount++; Value = FeatureUnitDescriptor->bmaControls[0]; if (Value & 0x01) /* MUTE*/ NodeCount++; @@ -146,6 +150,7 @@ else if (InputTerminalDescriptor->bDescriptorSubtype == 0x04 /* MIXER_UNIT */) { MixerUnitDescriptor = (PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR)InputTerminalDescriptor; + DescriptorCount++; NodeCount += MixerUnitDescriptor->bNrInPins + 1; /* KSNODETYPE_SUPERMIX for each source pin and KSNODETYPE_SUM for target */ } else @@ -159,10 +164,27 @@ } } } + *OutDescriptorCount = DescriptorCount; return NodeCount; } - +PNODE_CONTEXT +FindNodeContextWithId( + IN PNODE_CONTEXT NodeContext, + IN ULONG NodeContextCount, + IN UCHAR TerminalId) +{ + ULONG Index; + PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR TerminalDescriptor; + + for (Index = 0; Index < NodeContextCount; Index++) + { + TerminalDescriptor = (PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR)NodeContext[Index].Descriptor; + if (TerminalDescriptor->bTerminalID == TerminalId) + return &NodeContext[Index]; + } + return NULL; +} NTSTATUS BuildUSBAudioFilterTopology( @@ -170,7 +192,7 @@ PKSFILTER_DESCRIPTOR FilterDescriptor) { PDEVICE_EXTENSION DeviceExtension; - ULONG NodeCount, Index; + ULONG NodeCount, Index, DescriptorCount, StreamingTerminalIndex, NonStreamingTerminalDescriptorCount, TotalTerminalDescriptorCount, StreamingTerminalPinOffset, ControlDescriptorCount; UCHAR Value; PUSB_INTERFACE_DESCRIPTOR Descriptor; PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR InterfaceHeaderDescriptor; @@ -178,13 +200,16 @@ PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR InputTerminalDescriptor; PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR FeatureUnitDescriptor; PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR MixerUnitDescriptor; + PUSB_AUDIO_CONTROL_OUTPUT_TERMINAL_DESCRIPTOR OutputTerminalDescriptor; PKSNODE_DESCRIPTOR NodeDescriptors; + PNODE_CONTEXT NodeContext, PreviousNodeContext; + PKSTOPOLOGY_CONNECTION Connections; /* get device extension */ DeviceExtension = Device->Context; /* count topology nodes */ - NodeCount = CountTopologyComponents(DeviceExtension->ConfigurationDescriptor); + NodeCount = CountTopologyComponents(DeviceExtension->ConfigurationDescriptor, &ControlDescriptorCount); /* init node descriptors*/ FilterDescriptor->NodeDescriptors = NodeDescriptors = AllocFunction(NodeCount * sizeof(KSNODE_DESCRIPTOR)); @@ -195,6 +220,15 @@ } FilterDescriptor->NodeDescriptorSize = sizeof(KSNODE_DESCRIPTOR); + NodeContext = AllocFunction(sizeof(NODE_CONTEXT) * ControlDescriptorCount); + if (!NodeContext) + { + /* no memory */ + return STATUS_INSUFFICIENT_RESOURCES; + } + DescriptorCount = 0; + + /* first enumerate all topology nodes */ for (Descriptor = USBD_ParseConfigurationDescriptorEx(DeviceExtension->ConfigurationDescriptor, DeviceExtension->ConfigurationDescriptor, -1, -1, USB_DEVICE_CLASS_AUDIO, -1, -1); Descriptor != NULL; Descriptor = USBD_ParseConfigurationDescriptorEx(DeviceExtension->ConfigurationDescriptor, (PVOID)((ULONG_PTR)Descriptor + Descriptor->bLength), -1, -1, USB_DEVICE_CLASS_AUDIO, -1, -1)) @@ -208,13 +242,20 @@ while (CommonDescriptor) { InputTerminalDescriptor = (PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR)CommonDescriptor; - if (InputTerminalDescriptor->bDescriptorSubtype == 0x02 /* INPUT TERMINAL*/ || InputTerminalDescriptor->bDescriptorSubtype == 0x03 /* OUTPUT_TERMINAL*/) + if (InputTerminalDescriptor->bDescriptorSubtype == 0x02 /* INPUT TERMINAL*/) { if (InputTerminalDescriptor->wTerminalType == USB_AUDIO_STREAMING_TERMINAL_TYPE) { NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_SRC; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_SRC; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Descriptor = CommonDescriptor; + NodeContext[DescriptorCount].NodeCount = 1; + NodeContext[DescriptorCount].Nodes[0] = FilterDescriptor->NodeDescriptorsCount; + DescriptorCount++; + FilterDescriptor->NodeDescriptorsCount++; } else if ((InputTerminalDescriptor->wTerminalType & 0xFF00) == 0x200) @@ -222,6 +263,14 @@ NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_ADC; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_ADC; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Descriptor = CommonDescriptor; + NodeContext[DescriptorCount].NodeCount = 1; + NodeContext[DescriptorCount].Nodes[0] = FilterDescriptor->NodeDescriptorsCount; + DescriptorCount++; + + FilterDescriptor->NodeDescriptorsCount++; } else if ((InputTerminalDescriptor->wTerminalType & 0xFF00) == 0x300) @@ -229,6 +278,13 @@ NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_DAC; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_DAC; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Descriptor = CommonDescriptor; + NodeContext[DescriptorCount].NodeCount = 1; + NodeContext[DescriptorCount].Nodes[0] = FilterDescriptor->NodeDescriptorsCount; + DescriptorCount++; + FilterDescriptor->NodeDescriptorsCount++; } else @@ -243,6 +299,13 @@ NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_SRC; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_SRC; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Descriptor = CommonDescriptor; + NodeContext[DescriptorCount].NodeCount = 1; + NodeContext[DescriptorCount].Nodes[0] = FilterDescriptor->NodeDescriptorsCount; + DescriptorCount++; + FilterDescriptor->NodeDescriptorsCount++; } else if ((InputTerminalDescriptor->wTerminalType & 0xFF00) == 0x300) @@ -250,6 +313,13 @@ NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_DAC; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_DAC; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Descriptor = CommonDescriptor; + NodeContext[DescriptorCount].NodeCount = 1; + NodeContext[DescriptorCount].Nodes[0] = FilterDescriptor->NodeDescriptorsCount; + DescriptorCount++; + FilterDescriptor->NodeDescriptorsCount++; } else @@ -260,13 +330,18 @@ else if (InputTerminalDescriptor->bDescriptorSubtype == 0x06 /* FEATURE_UNIT*/) { - FeatureUnitDescriptor = (PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR)InputTerminalDescriptor; + FeatureUnitDescriptor = (PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR)CommonDescriptor; Value = FeatureUnitDescriptor->bmaControls[0]; if (Value & 0x01) /* MUTE*/ { NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_MUTE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_MUTE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Nodes[NodeContext[DescriptorCount].NodeCount] = FilterDescriptor->NodeDescriptorsCount; + NodeContext[DescriptorCount].NodeCount++; + FilterDescriptor->NodeDescriptorsCount++; } if (Value & 0x02) /* VOLUME */ @@ -274,6 +349,11 @@ NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_VOLUME; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_VOLUME; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Nodes[NodeContext[DescriptorCount].NodeCount] = FilterDescriptor->NodeDescriptorsCount; + NodeContext[DescriptorCount].NodeCount++; + FilterDescriptor->NodeDescriptorsCount++; } @@ -282,6 +362,11 @@ NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_TONE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_TONE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Nodes[NodeContext[DescriptorCount].NodeCount] = FilterDescriptor->NodeDescriptorsCount; + NodeContext[DescriptorCount].NodeCount++; + FilterDescriptor->NodeDescriptorsCount++; } @@ -290,6 +375,11 @@ NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_TONE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_TONE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Nodes[NodeContext[DescriptorCount].NodeCount] = FilterDescriptor->NodeDescriptorsCount; + NodeContext[DescriptorCount].NodeCount++; + FilterDescriptor->NodeDescriptorsCount++; } @@ -298,6 +388,12 @@ NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_TONE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_TONE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Nodes[NodeContext[DescriptorCount].NodeCount] = FilterDescriptor->NodeDescriptorsCount; + NodeContext[DescriptorCount].NodeCount++; + + FilterDescriptor->NodeDescriptorsCount++; } @@ -306,6 +402,11 @@ NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_TONE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_TONE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Nodes[NodeContext[DescriptorCount].NodeCount] = FilterDescriptor->NodeDescriptorsCount; + NodeContext[DescriptorCount].NodeCount++; + FilterDescriptor->NodeDescriptorsCount++; } @@ -314,6 +415,12 @@ NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_TONE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_TONE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Nodes[NodeContext[DescriptorCount].NodeCount] = FilterDescriptor->NodeDescriptorsCount; + NodeContext[DescriptorCount].NodeCount++; + + FilterDescriptor->NodeDescriptorsCount++; } @@ -322,23 +429,43 @@ NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_TONE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_TONE; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); - FilterDescriptor->NodeDescriptorsCount++; - } + + /* insert into node context*/ + NodeContext[DescriptorCount].Nodes[NodeContext[DescriptorCount].NodeCount] = FilterDescriptor->NodeDescriptorsCount; + NodeContext[DescriptorCount].NodeCount++; + + FilterDescriptor->NodeDescriptorsCount++; + } + NodeContext[DescriptorCount].Descriptor = CommonDescriptor; + DescriptorCount++; + } else if (InputTerminalDescriptor->bDescriptorSubtype == 0x04 /* MIXER_UNIT */) { - MixerUnitDescriptor = (PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR)InputTerminalDescriptor; + MixerUnitDescriptor = (PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR)CommonDescriptor; for (Index = 0; Index < MixerUnitDescriptor->bNrInPins; Index++) { NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_SUPERMIX; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_SUPERMIX; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Nodes[NodeContext[DescriptorCount].NodeCount] = FilterDescriptor->NodeDescriptorsCount; + NodeContext[DescriptorCount].NodeCount++; + FilterDescriptor->NodeDescriptorsCount++; } NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_SUM; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_SUM; NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + + /* insert into node context*/ + NodeContext[DescriptorCount].Nodes[NodeContext[DescriptorCount].NodeCount] = FilterDescriptor->NodeDescriptorsCount; + NodeContext[DescriptorCount].NodeCount++; + NodeContext[DescriptorCount].Descriptor = CommonDescriptor; + DescriptorCount++; + FilterDescriptor->NodeDescriptorsCount++; } else @@ -353,6 +480,154 @@ } } + /* FIXME determine connections count*/ + FilterDescriptor->Connections = Connections = AllocFunction(sizeof(KSTOPOLOGY_CONNECTION) * FilterDescriptor->NodeDescriptorsCount * 2); + if (!FilterDescriptor->Connections) + { + /* no memory */ + return STATUS_INSUFFICIENT_RESOURCES; + } + FilterDescriptor->ConnectionsCount = 0; + + /* now build connections array */ + DescriptorCount = 0; + StreamingTerminalIndex = 0; + NodeCount = 0; + + CountTerminalUnits(DeviceExtension->ConfigurationDescriptor, &NonStreamingTerminalDescriptorCount, &TotalTerminalDescriptorCount); + StreamingTerminalPinOffset = TotalTerminalDescriptorCount - NonStreamingTerminalDescriptorCount; + + for (Descriptor = USBD_ParseConfigurationDescriptorEx(DeviceExtension->ConfigurationDescriptor, DeviceExtension->ConfigurationDescriptor, -1, -1, USB_DEVICE_CLASS_AUDIO, -1, -1); + Descriptor != NULL; + Descriptor = USBD_ParseConfigurationDescriptorEx(DeviceExtension->ConfigurationDescriptor, (PVOID)((ULONG_PTR)Descriptor + Descriptor->bLength), -1, -1, USB_DEVICE_CLASS_AUDIO, -1, -1)) + { + if (Descriptor->bInterfaceSubClass == 0x01) /* AUDIO_CONTROL */ + { + InterfaceHeaderDescriptor = (PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR)USBD_ParseDescriptors(DeviceExtension->ConfigurationDescriptor, DeviceExtension->ConfigurationDescriptor->wTotalLength, Descriptor, USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE); + if (InterfaceHeaderDescriptor != NULL) + { + CommonDescriptor = USBD_ParseDescriptors(InterfaceHeaderDescriptor, InterfaceHeaderDescriptor->wTotalLength, (PVOID)((ULONG_PTR)InterfaceHeaderDescriptor + InterfaceHeaderDescriptor->bLength), USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE); + while (CommonDescriptor) + { + InputTerminalDescriptor = (PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR)CommonDescriptor; + if (InputTerminalDescriptor->bDescriptorSubtype == 0x02 /* INPUT TERMINAL*/) + { + if (InputTerminalDescriptor->wTerminalType == USB_AUDIO_STREAMING_TERMINAL_TYPE) + { + Connections[FilterDescriptor->ConnectionsCount].FromNode = KSFILTER_NODE; + Connections[FilterDescriptor->ConnectionsCount].FromNodePin = StreamingTerminalIndex; + Connections[FilterDescriptor->ConnectionsCount].ToNodePin = 1; + Connections[FilterDescriptor->ConnectionsCount].ToNode = NodeContext[DescriptorCount].Nodes[0]; + FilterDescriptor->ConnectionsCount++; + StreamingTerminalIndex++; + + } + else + { + Connections[FilterDescriptor->ConnectionsCount].FromNode = KSFILTER_NODE; + Connections[FilterDescriptor->ConnectionsCount].FromNodePin = StreamingTerminalPinOffset; + Connections[FilterDescriptor->ConnectionsCount].ToNodePin = 1; + Connections[FilterDescriptor->ConnectionsCount].ToNode = NodeContext[DescriptorCount].Nodes[0]; + FilterDescriptor->ConnectionsCount++; + StreamingTerminalPinOffset++; + } + DescriptorCount++; + } + else if (InputTerminalDescriptor->bDescriptorSubtype == 0x03 /* OUTPUT_TERMINAL*/) + { + OutputTerminalDescriptor = (PUSB_AUDIO_CONTROL_OUTPUT_TERMINAL_DESCRIPTOR)CommonDescriptor; + PreviousNodeContext = FindNodeContextWithId(NodeContext, ControlDescriptorCount, OutputTerminalDescriptor->bSourceID); + if (PreviousNodeContext) + { + Connections[FilterDescriptor->ConnectionsCount].FromNode = PreviousNodeContext->Nodes[PreviousNodeContext->NodeCount - 1]; + Connections[FilterDescriptor->ConnectionsCount].FromNodePin = 0; + Connections[FilterDescriptor->ConnectionsCount].ToNodePin = 1; + Connections[FilterDescriptor->ConnectionsCount].ToNode = NodeContext[DescriptorCount].Nodes[0]; + FilterDescriptor->ConnectionsCount++; + } + + if (InputTerminalDescriptor->wTerminalType == USB_AUDIO_STREAMING_TERMINAL_TYPE) + { + Connections[FilterDescriptor->ConnectionsCount].FromNode = NodeContext[DescriptorCount].Nodes[0]; + Connections[FilterDescriptor->ConnectionsCount].FromNodePin = 0; + Connections[FilterDescriptor->ConnectionsCount].ToNodePin = StreamingTerminalIndex; + Connections[FilterDescriptor->ConnectionsCount].ToNode = KSFILTER_NODE; + FilterDescriptor->ConnectionsCount++; + StreamingTerminalIndex++; + } + else + { + Connections[FilterDescriptor->ConnectionsCount].FromNode = NodeContext[DescriptorCount].Nodes[0]; + Connections[FilterDescriptor->ConnectionsCount].FromNodePin = 0; + Connections[FilterDescriptor->ConnectionsCount].ToNodePin = StreamingTerminalPinOffset; + Connections[FilterDescriptor->ConnectionsCount].ToNode = KSFILTER_NODE; + FilterDescriptor->ConnectionsCount++; + + StreamingTerminalPinOffset++; + } + DescriptorCount++; + } + else if (InputTerminalDescriptor->bDescriptorSubtype == 0x06 /* FEATURE_UNIT*/) + { + FeatureUnitDescriptor = (PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR)InputTerminalDescriptor; + PreviousNodeContext = FindNodeContextWithId(NodeContext, ControlDescriptorCount, FeatureUnitDescriptor->bSourceID); + if (PreviousNodeContext) + { + Connections[FilterDescriptor->ConnectionsCount].FromNode = PreviousNodeContext->Nodes[PreviousNodeContext->NodeCount-1]; + Connections[FilterDescriptor->ConnectionsCount].FromNodePin = 0; + Connections[FilterDescriptor->ConnectionsCount].ToNodePin = 1; + Connections[FilterDescriptor->ConnectionsCount].ToNode = NodeContext[DescriptorCount].Nodes[0]; + FilterDescriptor->ConnectionsCount++; + } + for (Index = 1; Index < NodeContext[DescriptorCount].NodeCount; Index++) + { + Connections[FilterDescriptor->ConnectionsCount].FromNode = NodeContext[DescriptorCount].Nodes[Index - 1]; + Connections[FilterDescriptor->ConnectionsCount].FromNodePin = 0; + Connections[FilterDescriptor->ConnectionsCount].ToNodePin = 1; + Connections[FilterDescriptor->ConnectionsCount].ToNode = NodeContext[DescriptorCount].Nodes[Index]; + FilterDescriptor->ConnectionsCount++; + } + + DescriptorCount++; + } + else if (InputTerminalDescriptor->bDescriptorSubtype == 0x04 /* MIXER_UNIT */) + { + MixerUnitDescriptor = (PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR)InputTerminalDescriptor; + for (Index = 0; Index < MixerUnitDescriptor->bNrInPins; Index++) + { + Value = MixerUnitDescriptor->baSourceID[Index]; + PreviousNodeContext = FindNodeContextWithId(NodeContext, ControlDescriptorCount, Value); + if (PreviousNodeContext) + { + Connections[FilterDescriptor->ConnectionsCount].FromNode = PreviousNodeContext->Nodes[PreviousNodeContext->NodeCount - 1]; + Connections[FilterDescriptor->ConnectionsCount].FromNodePin = 0; + Connections[FilterDescriptor->ConnectionsCount].ToNodePin = 1; + Connections[FilterDescriptor->ConnectionsCount].ToNode = NodeContext[DescriptorCount].Nodes[Index]; + FilterDescriptor->ConnectionsCount++; + } + + Connections[FilterDescriptor->ConnectionsCount].FromNode = NodeContext[DescriptorCount].Nodes[Index]; + Connections[FilterDescriptor->ConnectionsCount].FromNodePin = 0; + Connections[FilterDescriptor->ConnectionsCount].ToNodePin = 1 + Index; + Connections[FilterDescriptor->ConnectionsCount].ToNode = NodeContext[DescriptorCount].Nodes[NodeContext[DescriptorCount].NodeCount-1]; + FilterDescriptor->ConnectionsCount++; + } + DescriptorCount++; + } + else + { + UNIMPLEMENTED + } + CommonDescriptor = (PUSB_COMMON_DESCRIPTOR)((ULONG_PTR)CommonDescriptor + CommonDescriptor->bLength); + if ((ULONG_PTR)CommonDescriptor >= ((ULONG_PTR)InterfaceHeaderDescriptor + InterfaceHeaderDescriptor->wTotalLength)) + break; + } + } + } + } + + + return STATUS_SUCCESS; } @@ -400,6 +675,7 @@ VOID +NTAPI CountTerminalUnits( IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, OUT PULONG NonStreamingTerminalDescriptorCount, Modified: trunk/reactos/drivers/usb/usbaudio/usbaudio.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/usbau…
============================================================================== --- trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] Sat Oct 15 17:56:44 2016 @@ -155,11 +155,19 @@ PUCHAR Buffer; /* iso buffer*/ ULONG BufferSize; /* iso buffer size */ PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor; /* interface descriptor */ - WORK_QUEUE_ITEM CaptureWorkItem; /* work item */ - PKSWORKER CaptureWorker; /* capture worker */ - WORK_QUEUE_ITEM StarvationWorkItem; /* work item */ - PKSWORKER StarvationWorker; /* capture worker */ + WORK_QUEUE_ITEM CaptureWorkItem; /* work item */ + PKSWORKER CaptureWorker; /* capture worker */ + WORK_QUEUE_ITEM StarvationWorkItem; /* work item */ + PKSWORKER StarvationWorker; /* capture worker */ }PIN_CONTEXT, *PPIN_CONTEXT; + +typedef struct +{ + PUSB_COMMON_DESCRIPTOR Descriptor; + ULONG NodeCount; + ULONG Nodes[20]; +}NODE_CONTEXT, *PNODE_CONTEXT; + /* filter.c */ @@ -178,6 +186,13 @@ NTAPI FreeFunction( IN PVOID Item); + +VOID +NTAPI +CountTerminalUnits( + IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, + OUT PULONG NonStreamingTerminalDescriptorCount, + OUT PULONG TotalTerminalDescriptorCount); /* usbaudio.c */
8 years, 2 months
1
0
0
0
[bfreisen] 72972: [MSPAINT] - fix an odd quirk that resulted from Paint setting wallpaper and wallpaper style in the wrong order - add the flag SPIF_SENDWININICHANGE Setting wallpapers now works, w...
by bfreisen@svn.reactos.org
Author: bfreisen Date: Sat Oct 15 11:44:15 2016 New Revision: 72972 URL:
http://svn.reactos.org/svn/reactos?rev=72972&view=rev
Log: [MSPAINT] - fix an odd quirk that resulted from Paint setting wallpaper and wallpaper style in the wrong order - add the flag SPIF_SENDWININICHANGE Setting wallpapers now works, whenever the OS natively supports the respective file format for wallpapers. Modified: trunk/reactos/base/applications/mspaint/registry.cpp Modified: trunk/reactos/base/applications/mspaint/registry.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
============================================================================== --- trunk/reactos/base/applications/mspaint/registry.cpp [iso-8859-1] (original) +++ trunk/reactos/base/applications/mspaint/registry.cpp [iso-8859-1] Sat Oct 15 11:44:15 2016 @@ -37,9 +37,6 @@ void RegistrySettings::SetWallpaper(LPCTSTR szFileName, DWORD dwStyle, DWORD dwTile) { - // TODO: find out whether this line still serves a purpose - SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (PVOID) szFileName, SPIF_UPDATEINIFILE); - if ((dwStyle > 2) || (dwTile > 2)) return; @@ -56,6 +53,8 @@ desktop.SetStringValue(_T("WallpaperStyle"), strStyle); desktop.SetStringValue(_T("TileWallpaper"), strTile); } + + SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (PVOID) szFileName, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE); } void RegistrySettings::LoadPresets()
8 years, 2 months
1
0
0
0
[janderwald] 72971: [USBAUDIO] - partly implement BuildUSBAudioFilterTopology
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Oct 14 22:08:28 2016 New Revision: 72971 URL:
http://svn.reactos.org/svn/reactos?rev=72971&view=rev
Log: [USBAUDIO] - partly implement BuildUSBAudioFilterTopology Modified: trunk/reactos/drivers/usb/usbaudio/filter.c trunk/reactos/drivers/usb/usbaudio/guid.c trunk/reactos/drivers/usb/usbaudio/usbaudio.h Modified: trunk/reactos/drivers/usb/usbaudio/filter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/filte…
============================================================================== --- trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] Fri Oct 14 22:08:28 2016 @@ -90,13 +90,270 @@ NULL }; +ULONG +CountTopologyComponents( + IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor) +{ + PUSB_INTERFACE_DESCRIPTOR Descriptor; + PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR InterfaceHeaderDescriptor; + PUSB_COMMON_DESCRIPTOR CommonDescriptor; + PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR InputTerminalDescriptor; + PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR FeatureUnitDescriptor; + PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR MixerUnitDescriptor; + ULONG NodeCount = 0; + UCHAR Value; + + for (Descriptor = USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor, ConfigurationDescriptor, -1, -1, USB_DEVICE_CLASS_AUDIO, -1, -1); + Descriptor != NULL; + Descriptor = USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor, (PVOID)((ULONG_PTR)Descriptor + Descriptor->bLength), -1, -1, USB_DEVICE_CLASS_AUDIO, -1, -1)) + { + if (Descriptor->bInterfaceSubClass == 0x01) /* AUDIO_CONTROL */ + { + InterfaceHeaderDescriptor = (PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR)USBD_ParseDescriptors(ConfigurationDescriptor, ConfigurationDescriptor->wTotalLength, Descriptor, USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE); + if (InterfaceHeaderDescriptor != NULL) + { + CommonDescriptor = USBD_ParseDescriptors(InterfaceHeaderDescriptor, InterfaceHeaderDescriptor->wTotalLength, (PVOID)((ULONG_PTR)InterfaceHeaderDescriptor + InterfaceHeaderDescriptor->bLength), USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE); + while (CommonDescriptor) + { + InputTerminalDescriptor = (PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR)CommonDescriptor; + if (InputTerminalDescriptor->bDescriptorSubtype == 0x02 /* INPUT TERMINAL*/ || InputTerminalDescriptor->bDescriptorSubtype == 0x03 /* OUTPUT_TERMINAL*/) + { + NodeCount++; + } + else if (InputTerminalDescriptor->bDescriptorSubtype == 0x06 /* FEATURE_UNIT*/) + { + FeatureUnitDescriptor = (PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR)InputTerminalDescriptor; + Value = FeatureUnitDescriptor->bmaControls[0]; + if (Value & 0x01) /* MUTE*/ + NodeCount++; + if (Value & 0x02) /* VOLUME */ + NodeCount++; + if (Value & 0x04) /* BASS */ + NodeCount++; + if (Value & 0x08) /* MID */ + NodeCount++; + if (Value & 0x10) /* TREBLE */ + NodeCount++; + if (Value & 0x20) /* GRAPHIC EQUALIZER */ + NodeCount++; + if (Value & 0x40) /* AUTOMATIC GAIN */ + NodeCount++; + if (Value & 0x80) /* DELAY */ + NodeCount++; + + /* FIXME handle logical channels too */ + } + else if (InputTerminalDescriptor->bDescriptorSubtype == 0x04 /* MIXER_UNIT */) + { + MixerUnitDescriptor = (PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR)InputTerminalDescriptor; + NodeCount += MixerUnitDescriptor->bNrInPins + 1; /* KSNODETYPE_SUPERMIX for each source pin and KSNODETYPE_SUM for target */ + } + else + { + UNIMPLEMENTED + } + CommonDescriptor = (PUSB_COMMON_DESCRIPTOR)((ULONG_PTR)CommonDescriptor + CommonDescriptor->bLength); + if ((ULONG_PTR)CommonDescriptor >= ((ULONG_PTR)InterfaceHeaderDescriptor + InterfaceHeaderDescriptor->wTotalLength)) + break; + } + } + } + } + return NodeCount; +} + + NTSTATUS BuildUSBAudioFilterTopology( - PKSDEVICE Device) -{ - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; + PKSDEVICE Device, + PKSFILTER_DESCRIPTOR FilterDescriptor) +{ + PDEVICE_EXTENSION DeviceExtension; + ULONG NodeCount, Index; + UCHAR Value; + PUSB_INTERFACE_DESCRIPTOR Descriptor; + PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR InterfaceHeaderDescriptor; + PUSB_COMMON_DESCRIPTOR CommonDescriptor; + PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR InputTerminalDescriptor; + PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR FeatureUnitDescriptor; + PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR MixerUnitDescriptor; + PKSNODE_DESCRIPTOR NodeDescriptors; + + /* get device extension */ + DeviceExtension = Device->Context; + + /* count topology nodes */ + NodeCount = CountTopologyComponents(DeviceExtension->ConfigurationDescriptor); + + /* init node descriptors*/ + FilterDescriptor->NodeDescriptors = NodeDescriptors = AllocFunction(NodeCount * sizeof(KSNODE_DESCRIPTOR)); + if (FilterDescriptor->NodeDescriptors == NULL) + { + /* no memory */ + return STATUS_INSUFFICIENT_RESOURCES; + } + FilterDescriptor->NodeDescriptorSize = sizeof(KSNODE_DESCRIPTOR); + + for (Descriptor = USBD_ParseConfigurationDescriptorEx(DeviceExtension->ConfigurationDescriptor, DeviceExtension->ConfigurationDescriptor, -1, -1, USB_DEVICE_CLASS_AUDIO, -1, -1); + Descriptor != NULL; + Descriptor = USBD_ParseConfigurationDescriptorEx(DeviceExtension->ConfigurationDescriptor, (PVOID)((ULONG_PTR)Descriptor + Descriptor->bLength), -1, -1, USB_DEVICE_CLASS_AUDIO, -1, -1)) + { + if (Descriptor->bInterfaceSubClass == 0x01) /* AUDIO_CONTROL */ + { + InterfaceHeaderDescriptor = (PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR)USBD_ParseDescriptors(DeviceExtension->ConfigurationDescriptor, DeviceExtension->ConfigurationDescriptor->wTotalLength, Descriptor, USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE); + if (InterfaceHeaderDescriptor != NULL) + { + CommonDescriptor = USBD_ParseDescriptors(InterfaceHeaderDescriptor, InterfaceHeaderDescriptor->wTotalLength, (PVOID)((ULONG_PTR)InterfaceHeaderDescriptor + InterfaceHeaderDescriptor->bLength), USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE); + while (CommonDescriptor) + { + InputTerminalDescriptor = (PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR)CommonDescriptor; + if (InputTerminalDescriptor->bDescriptorSubtype == 0x02 /* INPUT TERMINAL*/ || InputTerminalDescriptor->bDescriptorSubtype == 0x03 /* OUTPUT_TERMINAL*/) + { + if (InputTerminalDescriptor->wTerminalType == USB_AUDIO_STREAMING_TERMINAL_TYPE) + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_SRC; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_SRC; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + else if ((InputTerminalDescriptor->wTerminalType & 0xFF00) == 0x200) + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_ADC; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_ADC; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + else if ((InputTerminalDescriptor->wTerminalType & 0xFF00) == 0x300) + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_DAC; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_DAC; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + else + { + DPRINT1("Unexpected input terminal type %x\n", InputTerminalDescriptor->wTerminalType); + } + } + else if (InputTerminalDescriptor->bDescriptorSubtype == 0x03 /* OUTPUT_TERMINAL*/) + { + if (InputTerminalDescriptor->wTerminalType == USB_AUDIO_STREAMING_TERMINAL_TYPE) + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_SRC; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_SRC; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + else if ((InputTerminalDescriptor->wTerminalType & 0xFF00) == 0x300) + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_DAC; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_DAC; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + else + { + DPRINT1("Unexpected output terminal type %x\n", InputTerminalDescriptor->wTerminalType); + } + } + + else if (InputTerminalDescriptor->bDescriptorSubtype == 0x06 /* FEATURE_UNIT*/) + { + FeatureUnitDescriptor = (PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR)InputTerminalDescriptor; + Value = FeatureUnitDescriptor->bmaControls[0]; + if (Value & 0x01) /* MUTE*/ + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_MUTE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_MUTE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + if (Value & 0x02) /* VOLUME */ + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_VOLUME; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_VOLUME; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + + if (Value & 0x04) /* BASS */ + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_TONE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_TONE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + + if (Value & 0x08) /* MID */ + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_TONE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_TONE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + + if (Value & 0x10) /* TREBLE */ + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_TONE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_TONE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + + if (Value & 0x20) /* GRAPHIC EQUALIZER */ + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_TONE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_TONE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + + if (Value & 0x40) /* AUTOMATIC GAIN */ + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_TONE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_TONE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + + if (Value & 0x80) /* DELAY */ + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_TONE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_TONE; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + } + else if (InputTerminalDescriptor->bDescriptorSubtype == 0x04 /* MIXER_UNIT */) + { + MixerUnitDescriptor = (PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR)InputTerminalDescriptor; + for (Index = 0; Index < MixerUnitDescriptor->bNrInPins; Index++) + { + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_SUPERMIX; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_SUPERMIX; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Type = &KSNODETYPE_SUM; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].Name = &KSNODETYPE_SUM; + NodeDescriptors[FilterDescriptor->NodeDescriptorsCount].AutomationTable = AllocFunction(sizeof(KSAUTOMATION_TABLE)); + FilterDescriptor->NodeDescriptorsCount++; + } + else + { + UNIMPLEMENTED + } + CommonDescriptor = (PUSB_COMMON_DESCRIPTOR)((ULONG_PTR)CommonDescriptor + CommonDescriptor->bLength); + if ((ULONG_PTR)CommonDescriptor >= ((ULONG_PTR)InterfaceHeaderDescriptor + InterfaceHeaderDescriptor->wTotalLength)) + break; + } + } + } + } + + return STATUS_SUCCESS; } NTSTATUS @@ -411,7 +668,7 @@ DeviceExtension = Device->Context; CountTerminalUnits(DeviceExtension->ConfigurationDescriptor, &NonStreamingTerminalDescriptorCount, &TotalTerminalDescriptorCount); - DPRINT1("TotalTerminalDescriptorCount %lu NonStreamingTerminalDescriptorCount %lu", TotalTerminalDescriptorCount, NonStreamingTerminalDescriptorCount); + DPRINT("TotalTerminalDescriptorCount %lu NonStreamingTerminalDescriptorCount %lu\n", TotalTerminalDescriptorCount, NonStreamingTerminalDescriptorCount); /* allocate pins */ Pins = AllocFunction(sizeof(KSPIN_DESCRIPTOR_EX) * TotalTerminalDescriptorCount); @@ -560,7 +817,7 @@ } /* build topology */ - Status = BuildUSBAudioFilterTopology(Device); + Status = BuildUSBAudioFilterTopology(Device, FilterDescriptor); if (!NT_SUCCESS(Status)) { /* failed*/ @@ -570,7 +827,7 @@ /* lets create the filter */ Status = KsCreateFilterFactory(Device->FunctionalDeviceObject, FilterDescriptor, ReferenceString, NULL, KSCREATE_ITEM_FREEONSTOP, NULL, NULL, NULL); - DPRINT1("KsCreateFilterFactory: %x\n", Status); + DPRINT("KsCreateFilterFactory: %x\n", Status); return Status; } Modified: trunk/reactos/drivers/usb/usbaudio/guid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/guid.…
============================================================================== --- trunk/reactos/drivers/usb/usbaudio/guid.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbaudio/guid.c [iso-8859-1] Fri Oct 14 22:08:28 2016 @@ -7,5 +7,12 @@ DEFINE_GUID(KSDATAFORMAT_TYPE_AUDIO, 0x73647561L, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001L, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71); DEFINE_GUID(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX, 0x05589f81L, 0xc356, 0x11ce, 0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a); - +DEFINE_GUID(KSNODETYPE_SRC, 0x9DB7B9E0L, 0xC555, 0x11D0, 0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1); +DEFINE_GUID(KSNODETYPE_ADC, 0x4D837FE0L, 0xC555, 0x11D0, 0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1); +DEFINE_GUID(KSNODETYPE_DAC, 0x507AE360L, 0xC554, 0x11D0, 0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1); +DEFINE_GUID(KSNODETYPE_MUTE, 0x02B223C0L, 0xC557, 0x11D0, 0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1); +DEFINE_GUID(KSNODETYPE_TONE, 0x7607E580L, 0xC557, 0x11D0, 0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1); +DEFINE_GUID(KSNODETYPE_SUM, 0xDA441A60L, 0xC556, 0x11D0, 0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1); +DEFINE_GUID(KSNODETYPE_SUPERMIX, 0xE573ADC0L, 0xC555, 0x11D0, 0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1); +DEFINE_GUID(KSNODETYPE_VOLUME, 0x3A5ACC00L, 0xC557, 0x11D0, 0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1); /* NO CODE HERE, THIS IS JUST REQUIRED FOR THE GUID DEFINITIONS */ Modified: trunk/reactos/drivers/usb/usbaudio/usbaudio.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/usbau…
============================================================================== --- trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] Fri Oct 14 22:08:28 2016 @@ -74,6 +74,34 @@ UCHAR iChannelNames; UCHAR iTerminal; }USB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR, *PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR; + +typedef struct +{ + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bUnitID; + UCHAR bSourceID; + UCHAR bControlSize; + UCHAR bmaControls[1]; + UCHAR iFeature; +}USB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR, *PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR; + +typedef struct +{ + UCHAR bLength; + UCHAR bDescriptorType; + UCHAR bDescriptorSubtype; + UCHAR bUnitID; + UCHAR bNrInPins; + UCHAR baSourceID[1]; + UCHAR bNrChannels; + USHORT wChannelConfig; + UCHAR iChannelNames; + UCHAR bmControls; + UCHAR iMixer; +}USB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR, *PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR; + typedef struct {
8 years, 2 months
1
0
0
0
[janderwald] 72970: [USBAUDIO] - partly implement UsbAudioPinDataIntersect
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Oct 14 13:26:22 2016 New Revision: 72970 URL:
http://svn.reactos.org/svn/reactos?rev=72970&view=rev
Log: [USBAUDIO] - partly implement UsbAudioPinDataIntersect Modified: trunk/reactos/drivers/usb/usbaudio/filter.c trunk/reactos/drivers/usb/usbaudio/pin.c trunk/reactos/drivers/usb/usbaudio/usbaudio.h Modified: trunk/reactos/drivers/usb/usbaudio/filter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/filte…
============================================================================== --- trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] Fri Oct 14 13:26:22 2016 @@ -448,7 +448,10 @@ Pins[Index].PinDescriptor.DataFlow = KSPIN_DATAFLOW_IN; } - + /* data intersect handler */ + Pins[Index].IntersectHandler = UsbAudioPinDataIntersect; + + /* pin flags */ Pins[Index].Flags = KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY | KSFILTER_FLAG_CRITICAL_PROCESSING; /* irp sinks / sources can be instantiated */ Modified: trunk/reactos/drivers/usb/usbaudio/pin.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/pin.c…
============================================================================== --- trunk/reactos/drivers/usb/usbaudio/pin.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbaudio/pin.c [iso-8859-1] Fri Oct 14 13:26:22 2016 @@ -1074,3 +1074,65 @@ return Status; } + + +NTSTATUS +NTAPI +UsbAudioPinDataIntersect( + _In_ PVOID Context, + _In_ PIRP Irp, + _In_ PKSP_PIN Pin, + _In_ PKSDATARANGE DataRange, + _In_ PKSDATARANGE MatchingDataRange, + _In_ ULONG DataBufferSize, + _Out_ PVOID Data, + _Out_ PULONG DataSize) +{ + PKSFILTER Filter; + PKSPIN_DESCRIPTOR_EX PinDescriptor; + PKSDATAFORMAT_WAVEFORMATEX DataFormat; + PKSDATARANGE_AUDIO DataRangeAudio; + + /* get filter from irp*/ + Filter = KsGetFilterFromIrp(Irp); + if (!Filter) + { + /* no match*/ + return STATUS_NO_MATCH; + } + + /* get pin descriptor */ + PinDescriptor = &Filter->Descriptor->PinDescriptors[Pin->PinId]; + + *DataSize = sizeof(KSDATAFORMAT_WAVEFORMATEX); + if (DataBufferSize == 0) + { + /* buffer too small */ + return STATUS_BUFFER_OVERFLOW; + } + + /* sanity checks*/ + ASSERT(PinDescriptor->PinDescriptor.DataRangesCount >= 0); + ASSERT(PinDescriptor->PinDescriptor.DataRanges[0]->FormatSize == sizeof(KSDATARANGE_AUDIO)); + + DataRangeAudio = (PKSDATARANGE_AUDIO)PinDescriptor->PinDescriptor.DataRanges[0]; + + DataFormat = Data; + DataFormat->WaveFormatEx.wFormatTag = WAVE_FORMAT_PCM; + DataFormat->WaveFormatEx.nChannels = DataRangeAudio->MaximumChannels; + DataFormat->WaveFormatEx.nSamplesPerSec = DataRangeAudio->MaximumSampleFrequency; + DataFormat->WaveFormatEx.nAvgBytesPerSec = DataRangeAudio->MaximumSampleFrequency * (DataRangeAudio->MaximumBitsPerSample / 8) * DataRangeAudio->MaximumChannels; + DataFormat->WaveFormatEx.nBlockAlign = (DataRangeAudio->MaximumBitsPerSample / 8) * DataRangeAudio->MaximumChannels; + DataFormat->WaveFormatEx.wBitsPerSample = DataRangeAudio->MaximumBitsPerSample; + DataFormat->WaveFormatEx.cbSize = 0; + + DataFormat->DataFormat.FormatSize = sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX); + DataFormat->DataFormat.Flags = 0; + DataFormat->DataFormat.Reserved = 0; + DataFormat->DataFormat.MajorFormat = KSDATAFORMAT_TYPE_AUDIO; + DataFormat->DataFormat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; + DataFormat->DataFormat.Specifier = KSDATAFORMAT_SPECIFIER_WAVEFORMATEX; + DataFormat->DataFormat.SampleSize = (DataRangeAudio->MaximumBitsPerSample / 8) * DataRangeAudio->MaximumChannels; + + return STATUS_SUCCESS; +} Modified: trunk/reactos/drivers/usb/usbaudio/usbaudio.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/usbau…
============================================================================== --- trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] Fri Oct 14 13:26:22 2016 @@ -255,6 +255,18 @@ NTSTATUS NTAPI +UsbAudioPinDataIntersect( + _In_ PVOID Context, + _In_ PIRP Irp, + _In_ PKSP_PIN Pin, + _In_ PKSDATARANGE DataRange, + _In_ PKSDATARANGE MatchingDataRange, + _In_ ULONG DataBufferSize, + _Out_ PVOID Data, + _Out_ PULONG DataSize); + +NTSTATUS +NTAPI UsbAudioCaptureComplete( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp,
8 years, 2 months
1
0
0
0
[janderwald] 72969: [USBAUDIO] - specify processings flags in filter descriptor - implement processing workers - move code for initializing irp & urb into single function - usbaudio now successfull...
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Oct 14 10:35:19 2016 New Revision: 72969 URL:
http://svn.reactos.org/svn/reactos?rev=72969&view=rev
Log: [USBAUDIO] - specify processings flags in filter descriptor - implement processing workers - move code for initializing irp & urb into single function - usbaudio now successfully captures audio in win2k3. Modified: trunk/reactos/drivers/usb/usbaudio/filter.c trunk/reactos/drivers/usb/usbaudio/pin.c trunk/reactos/drivers/usb/usbaudio/usbaudio.h Modified: trunk/reactos/drivers/usb/usbaudio/filter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/filte…
============================================================================== --- trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] Fri Oct 14 10:35:19 2016 @@ -448,6 +448,9 @@ Pins[Index].PinDescriptor.DataFlow = KSPIN_DATAFLOW_IN; } + + Pins[Index].Flags = KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY | KSFILTER_FLAG_CRITICAL_PROCESSING; + /* irp sinks / sources can be instantiated */ Pins[Index].InstancesPossible = 1; Pins[Index].InstancesNecessary = 1; Modified: trunk/reactos/drivers/usb/usbaudio/pin.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/pin.c…
============================================================================== --- trunk/reactos/drivers/usb/usbaudio/pin.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbaudio/pin.c [iso-8859-1] Fri Oct 14 10:35:19 2016 @@ -8,7 +8,9 @@ */ #include "usbaudio.h" -#include <math.h> + +#define PACKET_COUNT 10 + NTSTATUS GetMaxPacketSizeForInterface( @@ -55,15 +57,11 @@ OUT PURB * OutUrb) { PURB Urb; - ULONG PacketCount; ULONG UrbSize; ULONG Index; - /* calculate packet count */ - PacketCount = BufferLength / MaxPacketSize; - /* calculate urb size*/ - UrbSize = GET_ISO_URB_SIZE(PacketCount); + UrbSize = GET_ISO_URB_SIZE(PACKET_COUNT); /* allocate urb */ Urb = AllocFunction(UrbSize); @@ -80,9 +78,9 @@ Urb->UrbIsochronousTransfer.TransferFlags = USBD_TRANSFER_DIRECTION_IN | USBD_START_ISO_TRANSFER_ASAP; Urb->UrbIsochronousTransfer.TransferBufferLength = BufferLength; Urb->UrbIsochronousTransfer.TransferBuffer = Buffer; - Urb->UrbIsochronousTransfer.NumberOfPackets = PacketCount; - - for (Index = 0; Index < PacketCount; Index++) + Urb->UrbIsochronousTransfer.NumberOfPackets = PACKET_COUNT; + + for (Index = 0; Index < PACKET_COUNT; Index++) { Urb->UrbIsochronousTransfer.IsoPacket[Index].Offset = Index * MaxPacketSize; } @@ -92,7 +90,112 @@ } - +NTSTATUS +UsbAudioSetMuteOff( + IN PKSPIN Pin) +{ + PURB Urb; + PVOID SampleRateBuffer; + PPIN_CONTEXT PinContext; + NTSTATUS Status; + + /* allocate sample rate buffer */ + SampleRateBuffer = AllocFunction(sizeof(ULONG)); + if (!SampleRateBuffer) + { + /* no memory */ + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* allocate urb */ + Urb = AllocFunction(sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST)); + if (!Urb) + { + /* no memory */ + FreeFunction(SampleRateBuffer); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* FIXME: determine controls and format urb */ + UsbBuildVendorRequest(Urb, + URB_FUNCTION_CLASS_INTERFACE, + sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST), + USBD_TRANSFER_DIRECTION_OUT, + 0, + 0x01, + 0x100, + 0x300, + SampleRateBuffer, + NULL, + 1, + NULL); + + /* get pin context */ + PinContext = Pin->Context; + + /* submit urb */ + Status = SubmitUrbSync(PinContext->LowerDevice, Urb); + + DPRINT1("UsbAudioSetMuteOff Pin %p Status %x\n", Pin, Status); + FreeFunction(Urb); + FreeFunction(SampleRateBuffer); + return Status; +} + +NTSTATUS +UsbAudioSetVolume( + IN PKSPIN Pin) +{ + PURB Urb; + PUCHAR SampleRateBuffer; + PPIN_CONTEXT PinContext; + NTSTATUS Status; + + /* allocate sample rate buffer */ + SampleRateBuffer = AllocFunction(sizeof(ULONG)); + if (!SampleRateBuffer) + { + /* no memory */ + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* allocate urb */ + Urb = AllocFunction(sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST)); + if (!Urb) + { + /* no memory */ + FreeFunction(SampleRateBuffer); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* FIXME: determine controls and format urb */ + UsbBuildVendorRequest(Urb, + URB_FUNCTION_CLASS_INTERFACE, + sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST), + USBD_TRANSFER_DIRECTION_OUT, + 0, + 0x01, + 0x200, + 0x300, + SampleRateBuffer, + NULL, + 2, + NULL); + + /* get pin context */ + PinContext = Pin->Context; + + SampleRateBuffer[0] = 0xC2; + SampleRateBuffer[1] = 0xFE; + + /* submit urb */ + Status = SubmitUrbSync(PinContext->LowerDevice, Urb); + + DPRINT1("UsbAudioSetVolume Pin %p Status %x\n", Pin, Status); + FreeFunction(Urb); + FreeFunction(SampleRateBuffer); + return Status; +} NTSTATUS UsbAudioSetFormat( @@ -140,13 +243,13 @@ return STATUS_INSUFFICIENT_RESOURCES; } - /* format urb */ + /* FIXME: determine controls and format urb */ UsbBuildVendorRequest(Urb, URB_FUNCTION_CLASS_ENDPOINT, sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST), USBD_TRANSFER_DIRECTION_OUT, 0, - 0x01, + 0x01, // SET_CUR 0x100, 0x81, //FIXME bEndpointAddress SampleRateBuffer, @@ -244,6 +347,156 @@ return Status; } +VOID +NTAPI +CaptureGateOnWorkItem( + _In_ PVOID Context) +{ + PKSPIN Pin; + PPIN_CONTEXT PinContext; + PKSGATE Gate; + ULONG Count; + + /* get pin */ + Pin = Context; + + /* get pin context */ + PinContext = Pin->Context; + + do + { + /* acquire processing mutex */ + KsPinAcquireProcessingMutex(Pin); + + /* get pin control gate */ + Gate = KsPinGetAndGate(Pin); + + /* turn input on */ + KsGateTurnInputOn(Gate); + + /* schedule processing */ + KsPinAttemptProcessing(Pin, TRUE); + + /* release processing mutex */ + KsPinReleaseProcessingMutex(Pin); + + /* decrement worker count */ + Count = KsDecrementCountedWorker(PinContext->CaptureWorker); + } while (Count); +} + + + +VOID +CaptureInitializeUrbAndIrp( + IN PKSPIN Pin, + IN PIRP Irp) +{ + PIO_STACK_LOCATION IoStack; + PURB Urb; + PUCHAR TransferBuffer; + ULONG Index; + PPIN_CONTEXT PinContext; + + /* get pin context */ + PinContext = Pin->Context; + + /* backup urb and transferbuffer */ + Urb = Irp->Tail.Overlay.DriverContext[0]; + TransferBuffer = Urb->UrbIsochronousTransfer.TransferBuffer; + + /* initialize irp */ + IoInitializeIrp(Irp, IoSizeOfIrp(PinContext->DeviceExtension->LowerDevice->StackSize), PinContext->DeviceExtension->LowerDevice->StackSize); + + Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; + Irp->IoStatus.Information = 0; + Irp->Flags = 0; + Irp->UserBuffer = NULL; + Irp->Tail.Overlay.DriverContext[0] = Urb; + Irp->Tail.Overlay.DriverContext[1] = NULL; + + /* init stack location */ + IoStack = IoGetNextIrpStackLocation(Irp); + IoStack->DeviceObject = PinContext->DeviceExtension->LowerDevice; + IoStack->Parameters.Others.Argument1 = Urb; + IoStack->Parameters.Others.Argument2 = NULL; + IoStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; + IoStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_INTERNAL_USB_SUBMIT_URB; + + IoSetCompletionRoutine(Irp, UsbAudioCaptureComplete, Pin, TRUE, TRUE, TRUE); + + RtlZeroMemory(Urb, GET_ISO_URB_SIZE(PACKET_COUNT)); + + /* init urb */ + Urb->UrbIsochronousTransfer.Hdr.Function = URB_FUNCTION_ISOCH_TRANSFER; + Urb->UrbIsochronousTransfer.Hdr.Length = GET_ISO_URB_SIZE(10); + Urb->UrbIsochronousTransfer.PipeHandle = PinContext->DeviceExtension->InterfaceInfo->Pipes[0].PipeHandle; + Urb->UrbIsochronousTransfer.TransferFlags = USBD_TRANSFER_DIRECTION_IN | USBD_START_ISO_TRANSFER_ASAP; + Urb->UrbIsochronousTransfer.TransferBufferLength = PinContext->DeviceExtension->InterfaceInfo->Pipes[0].MaximumPacketSize * 10; + Urb->UrbIsochronousTransfer.TransferBuffer = TransferBuffer; + Urb->UrbIsochronousTransfer.NumberOfPackets = PACKET_COUNT; + Urb->UrbIsochronousTransfer.StartFrame = 0; + + for (Index = 0; Index < PACKET_COUNT; Index++) + { + Urb->UrbIsochronousTransfer.IsoPacket[Index].Offset = Index * PinContext->DeviceExtension->InterfaceInfo->Pipes[0].MaximumPacketSize; + } +} + + +VOID +NTAPI +CaptureAvoidPipeStarvationWorker( + _In_ PVOID Context) +{ + PKSPIN Pin; + PPIN_CONTEXT PinContext; + KIRQL OldLevel; + PLIST_ENTRY CurEntry; + PIRP Irp; + + /* get pin */ + Pin = Context; + + /* get pin context */ + PinContext = Pin->Context; + + /* acquire spin lock */ + KeAcquireSpinLock(&PinContext->IrpListLock, &OldLevel); + + if (!IsListEmpty(&PinContext->IrpListHead)) + { + /* sanity check */ + ASSERT(!IsListEmpty(&PinContext->IrpListHead)); + + /* remove entry from list */ + CurEntry = RemoveHeadList(&PinContext->IrpListHead); + + /* release lock */ + KeReleaseSpinLock(&PinContext->IrpListLock, OldLevel); + + /* get irp offset */ + Irp = (PIRP)CONTAINING_RECORD(CurEntry, IRP, Tail.Overlay.ListEntry); + + /* reinitialize irp and urb */ + CaptureInitializeUrbAndIrp(Pin, Irp); + + KsDecrementCountedWorker(PinContext->StarvationWorker); + + /* call driver */ + IoCallDriver(PinContext->DeviceExtension->LowerDevice, Irp); + } + else + { + /* release lock */ + KeReleaseSpinLock(&PinContext->IrpListLock, OldLevel); + + KsDecrementCountedWorker(PinContext->StarvationWorker); + } +} + + + NTSTATUS InitCapturePin( IN PKSPIN Pin) @@ -257,6 +510,8 @@ PPIN_CONTEXT PinContext; PIO_STACK_LOCATION IoStack; PKSALLOCATOR_FRAMING_EX Framing; + PKSGATE Gate; + /* set sample rate */ Status = UsbAudioSetFormat(Pin); @@ -271,6 +526,28 @@ /* lets get maximum packet size */ MaximumPacketSize = GetMaxPacketSizeForInterface(PinContext->DeviceExtension->ConfigurationDescriptor, PinContext->InterfaceDescriptor, Pin->DataFlow); + + /* initialize work item for capture worker */ + ExInitializeWorkItem(&PinContext->CaptureWorkItem, CaptureGateOnWorkItem, (PVOID)Pin); + + /* register worker */ + Status = KsRegisterCountedWorker(CriticalWorkQueue, &PinContext->CaptureWorkItem, &PinContext->CaptureWorker); + if (!NT_SUCCESS(Status)) + { + /* failed */ + return Status; + } + + /* initialize work item */ + ExInitializeWorkItem(&PinContext->StarvationWorkItem, CaptureAvoidPipeStarvationWorker, (PVOID)Pin); + + /* register worker */ + Status = KsRegisterCountedWorker(CriticalWorkQueue, &PinContext->StarvationWorkItem, &PinContext->StarvationWorker); + if (!NT_SUCCESS(Status)) + { + /* failed */ + KsUnregisterWorker(PinContext->CaptureWorker); + } /* lets edit framing struct */ Framing = (PKSALLOCATOR_FRAMING_EX)Pin->Descriptor->AllocatorFraming; @@ -281,7 +558,7 @@ MaximumPacketSize; /* calculate buffer size 8 irps * 10 iso packets * max packet size */ - BufferSize = 8 * 10 * MaximumPacketSize; + BufferSize = 8 * PACKET_COUNT * MaximumPacketSize; /* allocate pin capture buffer */ PinContext->BufferSize = BufferSize; @@ -318,20 +595,22 @@ IoStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; IoStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_INTERNAL_USB_SUBMIT_URB; - - DPRINT1("InitCapturePin Irp %p\n", Irp); + IoSetCompletionRoutine(Irp, UsbAudioCaptureComplete, Pin, TRUE, TRUE, TRUE); + /* insert into irp list */ InsertTailList(&PinContext->IrpListHead, &Irp->Tail.Overlay.ListEntry); /* add to object bag*/ - KsAddItemToObjectBag(Pin->Bag, Irp, IoFreeIrp); + KsAddItemToObjectBag(Pin->Bag, Irp, ExFreePool); /* FIXME select correct pipe handle */ Status = UsbAudioAllocCaptureUrbIso(PinContext->DeviceExtension->InterfaceInfo->Pipes[0].PipeHandle, MaximumPacketSize, - &PinContext->Buffer[MaximumPacketSize * 10 * Index], - MaximumPacketSize * 10, + &PinContext->Buffer[MaximumPacketSize * PACKET_COUNT * Index], + MaximumPacketSize * PACKET_COUNT, &Urb); + + DPRINT1("InitCapturePin Irp %p Urb %p\n", Irp, Urb); if (NT_SUCCESS(Status)) { @@ -348,6 +627,13 @@ return Status; } } + + /* get process control gate */ + Gate = KsPinGetAndGate(Pin); + + /* turn input off */ + KsGateTurnInputOff(Gate); + return Status; } @@ -358,6 +644,8 @@ UNIMPLEMENTED return STATUS_NOT_IMPLEMENTED; } + + NTSTATUS @@ -400,13 +688,16 @@ Pin->Context = PinContext; /* lets edit allocator framing struct */ - Status = _KsEdit(Pin->Bag, &Pin->Descriptor, sizeof(KSPIN_DESCRIPTOR_EX), sizeof(KSPIN_DESCRIPTOR_EX), USBAUDIO_TAG); + Status = _KsEdit(Pin->Bag, (PVOID*)&Pin->Descriptor, sizeof(KSPIN_DESCRIPTOR_EX), sizeof(KSPIN_DESCRIPTOR_EX), USBAUDIO_TAG); if (NT_SUCCESS(Status)) { - Status = _KsEdit(Pin->Bag, &Pin->Descriptor->AllocatorFraming, sizeof(KSALLOCATOR_FRAMING_EX), sizeof(KSALLOCATOR_FRAMING_EX), USBAUDIO_TAG); + Status = _KsEdit(Pin->Bag, (PVOID*)&Pin->Descriptor->AllocatorFraming, sizeof(KSALLOCATOR_FRAMING_EX), sizeof(KSALLOCATOR_FRAMING_EX), USBAUDIO_TAG); ASSERT(Status == STATUS_SUCCESS); } + /* FIXME move to build filter topology*/ + UsbAudioSetMuteOff(Pin); + UsbAudioSetVolume(Pin); /* select streaming interface */ Status = USBAudioSelectAudioStreamingInterface(PinContext, PinContext->DeviceExtension, PinContext->DeviceExtension->ConfigurationDescriptor); @@ -451,29 +742,39 @@ PPIN_CONTEXT PinContext; KIRQL OldLevel; PURB Urb; - PIO_STACK_LOCATION IoStack; - /* get pin context */ Pin = Context; PinContext = Pin->Context; - /* get stack location */ - IoStack = IoGetNextIrpStackLocation(Irp); - /* get urb */ Urb = Irp->Tail.Overlay.DriverContext[0]; - //DPRINT("UsbAudioCaptureComplete Irp %p Urb %p\n", Irp, Urb); - /* acquire lock */ KeAcquireSpinLock(&PinContext->IrpListLock, &OldLevel); - /* insert entry into done list */ - InsertTailList(&PinContext->DoneIrpListHead, &Irp->Tail.Overlay.ListEntry); - - /* release lock */ - KeReleaseSpinLock(&PinContext->IrpListLock, OldLevel); + if (!NT_SUCCESS(Urb->UrbIsochronousTransfer.Hdr.Status)) + { + //DPRINT("UsbAudioCaptureComplete Irp %p Urb %p Status %x Packet Status %x\n", Irp, Urb, Urb->UrbIsochronousTransfer.Hdr.Status, Urb->UrbIsochronousTransfer.IsoPacket[0].Status); + + /* insert entry into ready list */ + InsertTailList(&PinContext->IrpListHead, &Irp->Tail.Overlay.ListEntry); + + /* release lock */ + KeReleaseSpinLock(&PinContext->IrpListLock, OldLevel); + + KsIncrementCountedWorker(PinContext->StarvationWorker); + } + else + { + /* insert entry into done list */ + InsertTailList(&PinContext->DoneIrpListHead, &Irp->Tail.Overlay.ListEntry); + + /* release lock */ + KeReleaseSpinLock(&PinContext->IrpListLock, OldLevel); + + KsIncrementCountedWorker(PinContext->CaptureWorker); + } /* done */ return STATUS_MORE_PROCESSING_REQUIRED; @@ -491,13 +792,22 @@ PIO_STACK_LOCATION IoStack; PURB Urb; PUCHAR TransferBuffer, OutBuffer; - ULONG Index, Offset, MaximumPacketSize, Length; + ULONG Offset, Length; NTSTATUS Status; - //PUSHORT SoundBuffer; - + PKSGATE Gate; + + //DPRINT1("PinCaptureProcess\n"); LeadingStreamPointer = KsPinGetLeadingEdgeStreamPointer(Pin, KSSTREAM_POINTER_STATE_LOCKED); if (LeadingStreamPointer == NULL) + { + /* get process control gate */ + Gate = KsPinGetAndGate(Pin); + + /* shutdown processing */ + KsGateTurnInputOff(Gate); + return STATUS_SUCCESS; + } /* get pin context */ PinContext = Pin->Context; @@ -521,61 +831,65 @@ Urb = (PURB)Irp->Tail.Overlay.DriverContext[0]; ASSERT(Urb); - Offset = 0; - for (Index = 0; Index < Urb->UrbIsochronousTransfer.NumberOfPackets; Index++) + Offset = PtrToUlong(Irp->Tail.Overlay.DriverContext[1]); + + /* get transfer buffer */ + TransferBuffer = Urb->UrbIsochronousTransfer.TransferBuffer; + + /* get target buffer */ + OutBuffer = (PUCHAR)LeadingStreamPointer->StreamHeader->Data; + + /* calculate length */ + Length = min(LeadingStreamPointer->OffsetOut.Count - LeadingStreamPointer->StreamHeader->DataUsed, Urb->UrbIsochronousTransfer.TransferBufferLength - Offset); + + /* FIXME copy each packet extra */ + /* copy audio bytes */ + RtlCopyMemory((PUCHAR)&OutBuffer[LeadingStreamPointer->StreamHeader->DataUsed], &TransferBuffer[Offset], Length); + + //DPRINT1("Irp %p Urb %p OutBuffer %p TransferBuffer %p Offset %lu Remaining %lu TransferBufferLength %lu Length %lu\n", Irp, Urb, OutBuffer, TransferBuffer, Offset, LeadingStreamPointer->OffsetOut.Remaining, Urb->UrbIsochronousTransfer.TransferBufferLength, Length); + + /* adjust streampointer */ + LeadingStreamPointer->StreamHeader->DataUsed += Length; + + if (Length == LeadingStreamPointer->OffsetOut.Remaining) { - /* add offset */ - Offset += Urb->UrbIsochronousTransfer.IsoPacket[Index].Offset; - - /* get transfer buffer */ - TransferBuffer = Urb->UrbIsochronousTransfer.TransferBuffer; - - /* get target buffer */ - OutBuffer = (PUCHAR)LeadingStreamPointer->StreamHeader->Data; - - /* calculate length */ - Length = min(LeadingStreamPointer->OffsetOut.Count - LeadingStreamPointer->StreamHeader->DataUsed, Urb->UrbIsochronousTransfer.IsoPacket[Index].Length); - - //DPRINT1("DataUsed %lu Count %lu Remaining %lu Copying %lu Data %p\n", LeadingStreamPointer->StreamHeader->DataUsed, LeadingStreamPointer->OffsetOut.Count, LeadingStreamPointer->OffsetOut.Remaining, Length, LeadingStreamPointer->OffsetOut.Data); - - /* copy buffer */ - RtlCopyMemory((PUCHAR)&OutBuffer[LeadingStreamPointer->StreamHeader->DataUsed], &TransferBuffer[Offset], Length); - - LeadingStreamPointer->StreamHeader->DataUsed += Length; - - if (Length == LeadingStreamPointer->OffsetOut.Remaining) { - KsStreamPointerAdvanceOffsetsAndUnlock(LeadingStreamPointer, 0, Length, TRUE); - - LeadingStreamPointer = KsPinGetLeadingEdgeStreamPointer(Pin, KSSTREAM_POINTER_STATE_LOCKED); - if (LeadingStreamPointer == NULL) - { - /* FIXME handle half processed packets */ - //ASSERT(FALSE); - //DPRINT1("Warning: ignoring %lu packets\n", Urb->UrbIsochronousTransfer.NumberOfPackets - Index); - - /* acquire spin lock */ - KeAcquireSpinLock(&PinContext->IrpListLock, &OldLevel); - - InsertTailList(&PinContext->IrpListHead, &Irp->Tail.Overlay.ListEntry); - - KeReleaseSpinLock(&PinContext->IrpListLock, OldLevel); - return STATUS_SUCCESS; - } + KsStreamPointerAdvanceOffsetsAndUnlock(LeadingStreamPointer, 0, Length, TRUE); + + /* acquire spin lock */ + KeAcquireSpinLock(&PinContext->IrpListLock, &OldLevel); + + /* adjust offset */ + Irp->Tail.Overlay.DriverContext[1] = UlongToPtr(Length); + + /* reinsert into processed list */ + InsertHeadList(&PinContext->DoneIrpListHead, &Irp->Tail.Overlay.ListEntry); + + /* release lock */ + KeReleaseSpinLock(&PinContext->IrpListLock, OldLevel); + + LeadingStreamPointer = KsPinGetLeadingEdgeStreamPointer(Pin, KSSTREAM_POINTER_STATE_LOCKED); + if (LeadingStreamPointer == NULL) + { + /* no more work to be done*/ + return STATUS_PENDING; } else { - Status = KsStreamPointerAdvanceOffsets(LeadingStreamPointer, 0, Length, FALSE); + /* resume work on this irp */ + continue; } } + else + { + Status = KsStreamPointerAdvanceOffsets(LeadingStreamPointer, 0, Length, FALSE); + ASSERT(Length == Urb->UrbIsochronousTransfer.TransferBufferLength - Offset); + } /* acquire spin lock */ KeAcquireSpinLock(&PinContext->IrpListLock, &OldLevel); InsertTailList(&PinContext->IrpListHead, &Irp->Tail.Overlay.ListEntry); - - if (LeadingStreamPointer == NULL) - break; } while (!IsListEmpty(&PinContext->IrpListHead)) @@ -589,44 +903,8 @@ /* get irp offset */ Irp = (PIRP)CONTAINING_RECORD(CurEntry, IRP, Tail.Overlay.ListEntry); - /* backup urb and transferbuffer */ - Urb = Irp->Tail.Overlay.DriverContext[0]; - TransferBuffer = Urb->UrbIsochronousTransfer.TransferBuffer; - - /* initialize irp */ - IoInitializeIrp(Irp, IoSizeOfIrp(PinContext->DeviceExtension->LowerDevice->StackSize), PinContext->DeviceExtension->LowerDevice->StackSize); - - Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; - Irp->IoStatus.Information = 0; - Irp->Flags = 0; - Irp->UserBuffer = NULL; - Irp->Tail.Overlay.DriverContext[0] = Urb; - - /* init stack location */ - IoStack = IoGetNextIrpStackLocation(Irp); - IoStack->DeviceObject = PinContext->DeviceExtension->LowerDevice; - IoStack->Parameters.Others.Argument1 = Urb; - IoStack->Parameters.Others.Argument2 = NULL; - IoStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; - IoStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_INTERNAL_USB_SUBMIT_URB; - - IoSetCompletionRoutine(Irp, UsbAudioCaptureComplete, Pin, TRUE, TRUE, TRUE); - - RtlZeroMemory(Urb, GET_ISO_URB_SIZE(10)); - - /* init urb */ - Urb->UrbIsochronousTransfer.Hdr.Function = URB_FUNCTION_ISOCH_TRANSFER; - Urb->UrbIsochronousTransfer.Hdr.Length = GET_ISO_URB_SIZE(10); - Urb->UrbIsochronousTransfer.PipeHandle = PinContext->DeviceExtension->InterfaceInfo->Pipes[0].PipeHandle; - Urb->UrbIsochronousTransfer.TransferFlags = USBD_TRANSFER_DIRECTION_IN | USBD_START_ISO_TRANSFER_ASAP; - Urb->UrbIsochronousTransfer.TransferBufferLength = PinContext->DeviceExtension->InterfaceInfo->Pipes[0].MaximumPacketSize * 10; - Urb->UrbIsochronousTransfer.TransferBuffer = TransferBuffer; - Urb->UrbIsochronousTransfer.NumberOfPackets = 10; - - for (Index = 0; Index < 10; Index++) - { - Urb->UrbIsochronousTransfer.IsoPacket[Index].Offset = Index * 100; - } + /* reinitialize irp and urb */ + CaptureInitializeUrbAndIrp(Pin, Irp); IoCallDriver(PinContext->DeviceExtension->LowerDevice, Irp); @@ -641,7 +919,13 @@ if (LeadingStreamPointer != NULL) KsStreamPointerUnlock(LeadingStreamPointer, FALSE); - return STATUS_SUCCESS; + /* get process control gate */ + Gate = KsPinGetAndGate(Pin); + + /* shutdown processing */ + KsGateTurnInputOff(Gate); + + return STATUS_PENDING; } @@ -700,9 +984,6 @@ PPIN_CONTEXT PinContext; PLIST_ENTRY CurEntry; PIRP Irp; - PURB Urb; - PIO_STACK_LOCATION IoStack; - NTSTATUS Status; KIRQL OldLevel; /* get pin context */ @@ -719,24 +1000,14 @@ /* get irp offset */ Irp = (PIRP)CONTAINING_RECORD(CurEntry, IRP, Tail.Overlay.ListEntry); - - /* get next stack location */ - IoStack = IoGetNextIrpStackLocation(Irp); - - /* init stack location */ - IoStack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL; - IoStack->Parameters.DeviceIoControl.IoControlCode = IOCTL_INTERNAL_USB_SUBMIT_URB; - - /* backup urb */ - Urb = Irp->Tail.Overlay.DriverContext[0] = IoStack->Parameters.Others.Argument1; - - IoSetCompletionRoutine(Irp, UsbAudioCaptureComplete, Pin, TRUE, TRUE, TRUE); - /* release lock */ KeReleaseSpinLock(&PinContext->IrpListLock, OldLevel); - DPRINT("StartCaptureIsocTransfer Irp %p Urb %p TransferBuffer %p\n", Irp, Urb, Urb->UrbIsochronousTransfer.TransferBuffer); - Status = IoCallDriver(PinContext->DeviceExtension->LowerDevice, Irp); + /* reinitialize irp and urb */ + CaptureInitializeUrbAndIrp(Pin, Irp); + + DPRINT("StartCaptureIsocTransfer Irp %p\n", Irp); + IoCallDriver(PinContext->DeviceExtension->LowerDevice, Irp); /* acquire spin lock */ KeAcquireSpinLock(&PinContext->IrpListLock, &OldLevel); Modified: trunk/reactos/drivers/usb/usbaudio/usbaudio.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/usbau…
============================================================================== --- trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] Fri Oct 14 10:35:19 2016 @@ -127,7 +127,10 @@ PUCHAR Buffer; /* iso buffer*/ ULONG BufferSize; /* iso buffer size */ PUSB_INTERFACE_DESCRIPTOR InterfaceDescriptor; /* interface descriptor */ - + WORK_QUEUE_ITEM CaptureWorkItem; /* work item */ + PKSWORKER CaptureWorker; /* capture worker */ + WORK_QUEUE_ITEM StarvationWorkItem; /* work item */ + PKSWORKER StarvationWorker; /* capture worker */ }PIN_CONTEXT, *PPIN_CONTEXT; /* filter.c */ @@ -252,6 +255,13 @@ NTSTATUS NTAPI +UsbAudioCaptureComplete( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp, + IN PVOID Context); + +NTSTATUS +NTAPI USBAudioPinCreate( _In_ PKSPIN Pin, _In_ PIRP Irp);
8 years, 2 months
1
0
0
0
[akhaldi] 72968: [SHELL32] Add two missing AVIs. By Jared Smudde. CORE-11641
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Oct 13 21:46:39 2016 New Revision: 72968 URL:
http://svn.reactos.org/svn/reactos?rev=72968&view=rev
Log: [SHELL32] Add two missing AVIs. By Jared Smudde. CORE-11641 Added: trunk/reactos/dll/win32/shell32/res/avis/150.avi (with props) trunk/reactos/dll/win32/shell32/res/avis/152.avi (with props) Modified: trunk/reactos/dll/win32/shell32/avi_res.rc trunk/reactos/dll/win32/shell32/shresdef.h Modified: trunk/reactos/dll/win32/shell32/avi_res.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/avi_res.…
============================================================================== --- trunk/reactos/dll/win32/shell32/avi_res.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/avi_res.rc [iso-8859-1] Thu Oct 13 21:46:39 2016 @@ -1,4 +1,6 @@ +IDA_SHELL_AUTOPLAY AVI "res/avis/150.avi" IDA_SHELL_SEARCHING_INDEX AVI "res/avis/151.avi" +IDA_SHELL_COMPUTER_SEARCH AVI "res/avis/152.avi" IDA_SHELL_COPY AVI "res/avis/160+161+167+168.avi" IDA_SHELL_COPY1 AVI "res/avis/160+161+167+168.avi" IDA_SHELL_COPY2 AVI "res/avis/160+161+167+168.avi" Added: trunk/reactos/dll/win32/shell32/res/avis/150.avi URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/res/avis…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/win32/shell32/res/avis/150.avi ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: trunk/reactos/dll/win32/shell32/res/avis/152.avi URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/res/avis…
============================================================================== Binary file - no diff available. Propchange: trunk/reactos/dll/win32/shell32/res/avis/152.avi ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Modified: trunk/reactos/dll/win32/shell32/shresdef.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shresdef…
============================================================================== --- trunk/reactos/dll/win32/shell32/shresdef.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shresdef.h [iso-8859-1] Thu Oct 13 21:46:39 2016 @@ -572,17 +572,19 @@ * AVI resources * * windows shell32 has 14 of them: 150-152 and 160-170 - * FIXME: Add 150, 152 + * FIXME: Add 165, 166 */ +#define IDA_SHELL_AUTOPLAY 150 #define IDA_SHELL_SEARCHING_INDEX 151 +#define IDA_SHELL_COMPUTER_SEARCH 152 #define IDA_SHELL_COPY 160 #define IDA_SHELL_COPY1 161 -#define IDA_SHELL_COPY2 167 -#define IDA_SHELL_COPY3 168 #define IDA_SHELL_RECYCLE 162 #define IDA_SHELL_EMPTY_RECYCLE 163 #define IDA_SHELL_DELETE 164 +#define IDA_SHELL_COPY2 167 +#define IDA_SHELL_COPY3 168 #define IDA_SHELL_DELETE1 169 #define IDA_SHELL_DOWNLOAD 170
8 years, 2 months
1
0
0
0
[akhaldi] 72967: [EVENTVWR][EXPLORER][SHELL32] Russian translation update by Sergey Stopkin. CORE-12153
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Oct 13 21:39:37 2016 New Revision: 72967 URL:
http://svn.reactos.org/svn/reactos?rev=72967&view=rev
Log: [EVENTVWR][EXPLORER][SHELL32] Russian translation update by Sergey Stopkin. CORE-12153 Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/ru-RU.rc trunk/reactos/base/shell/explorer/lang/ru-RU.rc trunk/reactos/dll/win32/shell32/lang/ru-RU.rc Modified: trunk/reactos/base/applications/mscutils/eventvwr/lang/ru-RU.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/lang/ru-RU.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/lang/ru-RU.rc [iso-8859-1] Thu Oct 13 21:39:37 2016 @@ -99,7 +99,7 @@ EDITTEXT IDC_DISPLAYNAME, 67, 7, 178, 12, ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP LTEXT "&ÐÐ¼Ñ Ð¶ÑÑнала:", IDC_STATIC, 7, 25, 60, 8 EDITTEXT IDC_LOGNAME, 67, 23, 178, 12, ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP - LTEXT "Файл &жÑÑана:", IDC_STATIC, 7, 41, 60, 8 + LTEXT "Файл &жÑÑнала:", IDC_STATIC, 7, 41, 60, 8 EDITTEXT IDC_LOGFILE, 67, 39, 178, 12, ES_LEFT | ES_AUTOHSCROLL | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP LTEXT "РазмеÑ:", IDC_STATIC, 7, 57, 60, 8 EDITTEXT IDC_SIZE_LABEL, 67, 57, 178, 12, ES_LEFT | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP | ES_AUTOHSCROLL Modified: trunk/reactos/base/shell/explorer/lang/ru-RU.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/lang/r…
============================================================================== --- trunk/reactos/base/shell/explorer/lang/ru-RU.rc [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/lang/ru-RU.rc [iso-8859-1] Thu Oct 13 21:39:37 2016 @@ -73,17 +73,17 @@ CONTROL "", IDC_TASKBARPROP_TASKBARBITMAP, "Static", SS_BITMAP | SS_SUNKEN, 13, 18, 224, 21 AUTOCHECKBOX "&ÐакÑепиÑÑ Ð¿Ð°Ð½ÐµÐ»Ñ Ð·Ð°Ð´Ð°Ñ", IDC_TASKBARPROP_LOCK, 13, 45, 200, 10 AUTOCHECKBOX "&ÐвÑомаÑиÑеÑки ÑкÑÑваÑÑ Ð¿Ð°Ð½ÐµÐ»Ñ Ð·Ð°Ð´Ð°Ñ", IDC_TASKBARPROP_HIDE, 13, 58, 200, 10 - AUTOCHECKBOX "&ÐовеÑÑ Ð´ÑÑÐ³Ð¸Ñ Ð¾ÐºÐ¾Ð½", IDC_TASKBARPROP_ONTOP, 13, 71, 200, 10 - AUTOCHECKBOX "&ÐÑÑппиÑоваÑÑ ÑÑ Ð¾Ð¶Ð¸Ðµ кнопки", IDC_TASKBARPROP_GROUP, 13, 84, 200, 10 + AUTOCHECKBOX "ÐÑобÑажаÑÑ Ð¿Ð°Ð½ÐµÐ»Ñ Ð·Ð°Ð´Ð°Ñ &повеÑÑ Ð´ÑÑÐ³Ð¸Ñ Ð¾ÐºÐ¾Ð½", IDC_TASKBARPROP_ONTOP, 13, 71, 200, 10 + AUTOCHECKBOX "&ÐÑÑппиÑоваÑÑ ÑÑ Ð¾Ð¶Ð¸Ðµ кнопки панели задаÑ", IDC_TASKBARPROP_GROUP, 13, 84, 200, 10 AUTOCHECKBOX "ÐÑобÑажаÑÑ Ð¿Ð°Ð½ÐµÐ»Ñ &бÑÑÑÑого запÑÑка", IDC_TASKBARPROP_SHOWQL, 13, 97, 200, 10 - GROUPBOX "ÐÐ°Ð½ÐµÐ»Ñ Ñведомлений", IDC_STATIC, 6, 114, 240, 98 + GROUPBOX "ÐблаÑÑÑ Ñведомлений", IDC_STATIC, 6, 114, 240, 98 CONTROL "", IDC_TASKBARPROP_NOTIFICATIONBITMAP, "Static", SS_BITMAP | SS_SUNKEN,13, 126, 223, 28 - AUTOCHECKBOX "&ЧаÑÑ", IDC_TASKBARPROP_CLOCK, 13, 153, 80, 10 - AUTOCHECKBOX "ÐÑобÑажаÑÑ ÑекÑндÑ", IDC_TASKBARPROP_SECONDS, 120, 153, 80, 10, WS_DISABLED + AUTOCHECKBOX "ÐÑобÑажаÑÑ &ÑаÑÑ", IDC_TASKBARPROP_CLOCK, 13, 153, 80, 10 + AUTOCHECKBOX "ÐÑобÑажаÑÑ &ÑекÑндÑ", IDC_TASKBARPROP_SECONDS, 120, 153, 83, 10, WS_DISABLED LTEXT "Ðожно избежаÑÑ Ð·Ð°Ð³ÑÐ¾Ð¼Ð¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¾Ð±Ð»Ð°ÑÑи Ñведомлений, ÑкÑÑÐ²Ð°Ñ Ð·Ð½Ð°Ñки, коÑоÑÑе давно не иÑполÑзовалиÑÑ.", IDC_STATIC, 13, 169, 223, 16 - AUTOCHECKBOX "&СкÑÑваÑÑ Ð½ÐµÐ¸ÑполÑзÑемÑе знаÑки", IDC_TASKBARPROP_HIDEICONS, 13, 191, 125, 10 + AUTOCHECKBOX "СкÑÑваÑÑ &неиÑполÑзÑемÑе знаÑки", IDC_TASKBARPROP_HIDEICONS, 13, 191, 128, 10 PUSHBUTTON "&ÐаÑÑÑоиÑÑ...", IDC_TASKBARPROP_ICONCUST, 188, 191, 50, 14 -END +END IDD_TASKBARPROP_STARTMENU DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU @@ -109,14 +109,14 @@ LTEXT "ÐÑбеÑиÑе ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ð¸ измениÑе его поведение:", IDC_STATIC, 6, 40, 220, 10 CONTROL "", IDC_NOTIFICATION_LIST, "SysListView32", WS_CLIPSIBLINGS | WS_BORDER | 0x00008005, 6, 50, 220, 128 COMBOBOX IDC_NOTIFICATION_BEHAVIOUR, 103, 178, 78, 200, CBS_DROPDOWNLIST | NOT WS_VISIBLE | WS_CLIPSIBLINGS - PUSHBUTTON "&Ðо ÑмолÑаниÑ", IDC_TASKBARPROP_NOTIREST, 164, 188, 62, 14 + PUSHBUTTON "&ÐоÑÑÑановиÑÑ Ð¿Ð¾ ÑмолÑаниÑ", IDC_TASKBARPROP_NOTIREST, 115, 188, 110, 14 DEFPUSHBUTTON "OK", IDOK, 122, 220, 50, 14 PUSHBUTTON "ÐÑмена", IDCANCEL, 176, 220, 50, 14 END IDD_CLASSICSTART_CUSTOMIZE DIALOGEX 0, 0, 232, 240, 0 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_DLGFRAME -CAPTION "ÐаÑÑÑойка клаÑÑиÑеÑког Ð¼ÐµÐ½Ñ ""ÐÑÑк""" +CAPTION "ÐаÑÑÑойка клаÑÑиÑеÑкого Ð¼ÐµÐ½Ñ ""ÐÑÑк""" FONT 8, "MS Shell Dlg" { GROUPBOX "ÐÐµÐ½Ñ ""ÐÑÑк""", IDC_STATIC, 8, 7, 218, 114 @@ -124,11 +124,11 @@ LTEXT "ÐÑ Ð¼Ð¾Ð¶ÐµÑе наÑÑÑоиÑÑ Ð¼ÐµÐ½Ñ ""ÐÑÑк"" пÑÑем Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¸Ð»Ð¸ ÑÐ´Ð°Ð»ÐµÐ½Ð¸Ñ ÑлеменÑов.", IDC_STATIC, 48, 17, 108, 39 PUSHBUTTON "&ÐобавиÑÑ...", IDC_CLASSICSTART_ADD, 162, 18, 53, 14 PUSHBUTTON "&УдалиÑÑ...", IDC_CLASSICSTART_REMOVE, 162, 33, 53, 14 - PUSHBUTTON "Ð&ополниÑелÑно", IDC_CLASSICSTART_ADVANCED, 162, 49, 53, 14 + PUSHBUTTON "&ÐÑÑÑнÑÑ", IDC_CLASSICSTART_ADVANCED, 162, 49, 53, 14 PUSHBUTTON "&СоÑÑиÑоваÑÑ", IDC_CLASSICSTART_SORT, 162, 65, 53, 14 ICON IDI_RECYCLEBIN, IDC_STATIC, 20, 85, 20, 20 LTEXT "ÐÐ»Ñ ÑÐ´Ð°Ð»ÐµÐ½Ð¸Ñ Ð·Ð°Ð¿Ð¸Ñей о Ð½ÐµÐ´Ð°Ð²Ð½Ð¸Ñ Ð´Ð¾ÐºÑменÑÐ°Ñ , пÑогÑÐ°Ð¼Ð¼Ð°Ñ Ð¸ ÑайÑÐ°Ñ Ð½Ð°Ð¶Ð¼Ð¸Ñе ""ÐÑиÑÑиÑÑ"".", IDC_STATIC, 49, 85, 108, 33 - PUSHBUTTON "&ÐÑиÑÑиÑÑ", IDC_CLASSICSTART_CLEAR, 162, 94, 53, 14 + PUSHBUTTON "Ð&ÑиÑÑиÑÑ", IDC_CLASSICSTART_CLEAR, 162, 94, 53, 14 LTEXT "Ðо&полниÑелÑнÑе паÑамеÑÑÑ Ð¼ÐµÐ½Ñ ""ÐÑÑк"":", IDC_STATIC, 8, 129, 150, 8 CONTROL "StartMenuSe&ttings", IDC_CLASSICSTART_SETTINGS, "SysTreeView32", WS_BORDER | 0x00000001, 8, 139, 218, 72, WS_EX_CLIENTEDGE DEFPUSHBUTTON "OK", IDOK, 122, 220, 50, 14 @@ -156,7 +156,7 @@ GROUPBOX "ÐаÑамеÑÑÑ Ð¼ÐµÐ½Ñ ""ÐÑÑк"" ", IDC_STATIC, 7, 7, 238, 42 AUTOCHECKBOX "&ÐÑкÑÑваÑÑ Ð¿Ð¾Ð´Ð¼ÐµÐ½Ñ Ð¿Ñи задеÑжке на Ð½Ð¸Ñ Ð¼ÑÑи", IDC_AUTOOPEN, 14, 21, 224, 10 AUTOCHECKBOX "&ÐодÑвеÑиваÑÑ Ð½ÐµÐ´Ð°Ð²Ð½Ð¾ ÑÑÑановленнÑе пÑогÑаммÑ", IDC_HIGHLIGHT, 14, 35, 224, 10 - LTEXT "ÐлеменÑÑ Ð¼ÐµÐ½Ñ ""ÐÑÑк"":", IDC_STATIC, 7, 53, 238, 8 + LTEXT "&ÐлеменÑÑ Ð¼ÐµÐ½Ñ ""ÐÑÑк"":", IDC_STATIC, 7, 53, 238, 8 CONTROL "StartMenuSe&ttings", IDC_ITEMS, "SysTreeView32", WS_BORDER | 0x00000001, 7, 63, 238, 67, WS_EX_CLIENTEDGE GROUPBOX "Ðедавние докÑменÑÑ ", IDC_STATIC, 7, 133, 238, 56 LTEXT "ÐÑбеÑиÑе ÑÑÑ Ð¾Ð¿ÑÐ¸Ñ Ð´Ð»Ñ Ð¾Ð±ÐµÑпеÑÐµÐ½Ð¸Ñ Ð±ÑÑÑÑого доÑÑÑпа к недавним докÑменÑам. ÐÑиÑÑка ÑÑого ÑпиÑка не ÑдалÑÐµÑ Ð´Ð¾ÐºÑменÑÑ.", IDC_STATIC, 14, 144, 224, 21 @@ -176,10 +176,10 @@ AUTORADIOBUTTON "&ÐаленÑкие знаÑки", IDC_CHOOSESMALL, 177, 25, 51, 10, NOT WS_TABSTOP GROUPBOX "ÐÑогÑÐ°Ð¼Ð¼Ñ ", IDC_STATIC, 7, 49, 238, 70 LTEXT "ÐÐµÐ½Ñ ""ÐÑÑк"" ÑодеÑÐ¶Ð¸Ñ ÑÑлÑки пÑогÑамм, коÑоÑÑе Ð²Ñ ÑаÑÑо иÑполÑзÑеÑе. ÐÑиÑÑка ÑпиÑка не ÑдалÑÐµÑ Ð¿ÑогÑаммÑ.", IDC_STATIC, 14, 63, 224, 20 - LTEXT "&ÐолиÑеÑÑво пÑогÑамм в Ð¼ÐµÐ½Ñ ""ÐÑÑк"":", IDC_STATIC, 14, 86, 112, 8 + LTEXT "Ð&олиÑеÑÑво пÑогÑамм в Ð¼ÐµÐ½Ñ ""ÐÑÑк"":", IDC_STATIC, 14, 86, 112, 8 EDITTEXT IDC_NUMBEROFPROGRAMS, 133, 84, 27, 12, ES_LEFT | ES_RIGHT | ES_NUMBER CONTROL "", IDC_NUMBERUPDOWN, "msctls_updown32", WS_BORDER | 0x000000B6, 160, 84, 11, 12 - PUSHBUTTON "&ÐÑиÑÑиÑÑ ÑпиÑок", IDC_CLEARLIST, 182, 98, 57, 14 + PUSHBUTTON "Ð&ÑиÑÑиÑÑ ÑпиÑок", IDC_CLEARLIST, 182, 98, 57, 14 GROUPBOX "ÐоказÑваÑÑ Ð² Ð¼ÐµÐ½Ñ ""ÐÑÑк"" ", IDC_STATIC, 7, 126, 238, 63 AUTOCHECKBOX "&ÐнÑеÑнеÑ:", IDC_SHOWINTERNET, 14, 140, 42, 10 COMBOBOX IDC_INTERNETDEFAULTAPP, 98, 138, 140, 200, CBS_DROPDOWNLIST | WS_VSCROLL @@ -198,5 +198,5 @@ STRINGTABLE BEGIN - IDS_TASKBAR_STARTMENU_PROP_CAPTION "СвойÑÑва Ð¼ÐµÐ½Ñ ""ÐÑÑк"" и панели задаÑ" -END + IDS_TASKBAR_STARTMENU_PROP_CAPTION "ÐÐµÐ½Ñ ""ÐÑÑк"" и Ð¿Ð°Ð½ÐµÐ»Ñ Ð·Ð°Ð´Ð°Ñ" +END Modified: trunk/reactos/dll/win32/shell32/lang/ru-RU.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/lang/ru-…
============================================================================== --- trunk/reactos/dll/win32/shell32/lang/ru-RU.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/lang/ru-RU.rc [iso-8859-1] Thu Oct 13 21:39:37 2016 @@ -21,7 +21,7 @@ BEGIN POPUP "" BEGIN - POPUP "&ÐÑоÑмоÑÑ", FCIDM_SHVIEW_VIEW + POPUP "&Ðид", FCIDM_SHVIEW_VIEW BEGIN MENUITEM "&ÐолÑÑие знаÑки", FCIDM_SHVIEW_BIGICON MENUITEM "&Ðелкие знаÑки", FCIDM_SHVIEW_SMALLICON
8 years, 2 months
1
0
0
0
[phater] 72966: [MSAFD] Implement WSPGetOverlappedResult. Reviewed by Thomas and Art. Thanks! CORE-12134 #resolve
by phater@svn.reactos.org
Author: phater Date: Thu Oct 13 20:30:42 2016 New Revision: 72966 URL:
http://svn.reactos.org/svn/reactos?rev=72966&view=rev
Log: [MSAFD] Implement WSPGetOverlappedResult. Reviewed by Thomas and Art. Thanks! CORE-12134 #resolve Modified: trunk/reactos/dll/win32/msafd/misc/sndrcv.c trunk/reactos/dll/win32/msafd/misc/stubs.c trunk/reactos/dll/win32/msafd/msafd.h Modified: trunk/reactos/dll/win32/msafd/misc/sndrcv.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/sndrc…
============================================================================== --- trunk/reactos/dll/win32/msafd/misc/sndrcv.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/misc/sndrcv.c [iso-8859-1] Thu Oct 13 20:30:42 2016 @@ -93,6 +93,92 @@ return ERROR_SUCCESS; } + +BOOL +WSPAPI +WSPGetOverlappedResult( + IN SOCKET Handle, + IN LPWSAOVERLAPPED lpOverlapped, + OUT LPDWORD lpdwBytes, + IN BOOL fWait, + OUT LPDWORD lpdwFlags, + OUT LPINT lpErrno) +{ + PIO_STATUS_BLOCK IOSB; + NTSTATUS Status; + PSOCKET_INFORMATION Socket; + + TRACE("Called (%x)\n", Handle); + + /* Get the Socket Structure associate to this Socket*/ + Socket = GetSocketStructure(Handle); + if (!Socket) + { + if(lpErrno) + *lpErrno = WSAENOTSOCK; + return FALSE; + } + if (!lpOverlapped || !lpdwBytes || !lpdwFlags) + { + if (lpErrno) + *lpErrno = WSAEFAULT; + return FALSE; + } + IOSB = (PIO_STATUS_BLOCK)&lpOverlapped->Internal; + if (!IOSB) + { + if (lpErrno) + *lpErrno = WSAEFAULT; + return FALSE; + } + Status = IOSB->Status; + + /* Wait for completition of overlapped */ + if (Status == STATUS_PENDING) + { + /* It's up to the protocol to time out recv. We must wait + * until the protocol decides it's had enough. + */ + if (fWait) + { + WaitForSingleObject(lpOverlapped->hEvent, INFINITE); + Status = IOSB->Status; + } + } + + TRACE("Status %x Information %d\n", Status, IOSB->Information); + + if (Status != STATUS_PENDING) + { + *lpdwFlags = 0; + + *lpdwBytes = IOSB->Information; + + /* Re-enable Async Event */ + SockReenableAsyncSelectEvent(Socket, FD_OOB); + SockReenableAsyncSelectEvent(Socket, FD_WRITE); + SockReenableAsyncSelectEvent(Socket, FD_READ); + } + + return Status == STATUS_SUCCESS; +} + +VOID +NTAPI +AfdAPC(PVOID ApcContext, + PIO_STATUS_BLOCK IoStatusBlock, + ULONG Reserved) +{ + PAFDAPCCONTEXT Context = ApcContext; + + /* Re-enable Async Event */ + SockReenableAsyncSelectEvent(Context->lpSocket, FD_OOB); + SockReenableAsyncSelectEvent(Context->lpSocket, FD_READ); + SockReenableAsyncSelectEvent(Context->lpSocket, FD_WRITE); + + Context->lpCompletionRoutine(IoStatusBlock->Status, IoStatusBlock->Information, Context->lpOverlapped, 0); + HeapFree(GlobalHeap, 0, ApcContext); +} int WSPAPI @@ -111,7 +197,7 @@ AFD_RECV_INFO RecvInfo; NTSTATUS Status; PVOID APCContext; - PVOID APCFunction; + PIO_APC_ROUTINE APCFunction; HANDLE Event = NULL; HANDLE SockEvent; PSOCKET_INFORMATION Socket; @@ -173,6 +259,12 @@ } else { + /* Overlapped request for non overlapped opened socket */ + if ((Socket->SharedData->CreateFlags & SO_SYNCHRONOUS_NONALERT) != 0) + { + TRACE("Opened without flag WSA_FLAG_OVERLAPPED. Do nothing.\n"); + return MsafdReturnWithErrno(0, lpErrno, 0, lpNumberOfBytesRead); + } if (lpCompletionRoutine == NULL) { /* Using Overlapped Structure, but no Completition Routine, so no need for APC */ @@ -183,8 +275,16 @@ else { /* Using Overlapped Structure and a Completition Routine, so use an APC */ - APCFunction = NULL; // should be a private io completition function inside us - APCContext = lpCompletionRoutine; + APCFunction = &AfdAPC; // should be a private io completition function inside us + APCContext = HeapAlloc(GlobalHeap, 0, sizeof(AFDAPCCONTEXT)); + if (!APCContext) + { + ERR("Not enough memory for APC Context\n"); + return MsafdReturnWithErrno(STATUS_INSUFFICIENT_RESOURCES, lpErrno, 0, lpNumberOfBytesRead); + } + ((PAFDAPCCONTEXT)APCContext)->lpCompletionRoutine = lpCompletionRoutine; + ((PAFDAPCCONTEXT)APCContext)->lpOverlapped = lpOverlapped; + ((PAFDAPCCONTEXT)APCContext)->lpSocket = Socket; RecvInfo.AfdFlags |= AFD_SKIP_FIO; } @@ -196,15 +296,15 @@ /* Send IOCTL */ Status = NtDeviceIoControlFile((HANDLE)Handle, - Event, - APCFunction, - APCContext, - IOSB, - IOCTL_AFD_RECV, - &RecvInfo, - sizeof(RecvInfo), - NULL, - 0); + Event, + APCFunction, + APCContext, + IOSB, + IOCTL_AFD_RECV, + &RecvInfo, + sizeof(RecvInfo), + NULL, + 0); /* Wait for completition of not overlapped */ if (Status == STATUS_PENDING && lpOverlapped == NULL) @@ -219,6 +319,12 @@ NtClose( SockEvent ); TRACE("Status %x Information %d\n", Status, IOSB->Information); + + if (Status == STATUS_PENDING) + { + TRACE("Leaving (Pending)\n"); + return MsafdReturnWithErrno(Status, lpErrno, IOSB->Information, lpNumberOfBytesRead); + } /* Return the Flags */ *ReceiveFlags = 0; @@ -244,6 +350,12 @@ else { SockReenableAsyncSelectEvent(Socket, FD_READ); + } + + if (Status == STATUS_SUCCESS && lpOverlapped && lpCompletionRoutine) + { + lpCompletionRoutine(Status, IOSB->Information, lpOverlapped, *ReceiveFlags); + HeapFree(GlobalHeap, 0, (PVOID)APCContext); } return MsafdReturnWithErrno ( Status, lpErrno, IOSB->Information, lpNumberOfBytesRead ); @@ -355,6 +467,12 @@ } else { + /* Overlapped request for non overlapped opened socket */ + if ((Socket->SharedData->CreateFlags & SO_SYNCHRONOUS_NONALERT) != 0) + { + TRACE("Opened without flag WSA_FLAG_OVERLAPPED. Do nothing.\n"); + return MsafdReturnWithErrno(0, lpErrno, 0, lpNumberOfBytesRead); + } if (lpCompletionRoutine == NULL) { /* Using Overlapped Structure, but no Completition Routine, so no need for APC */ @@ -365,8 +483,16 @@ else { /* Using Overlapped Structure and a Completition Routine, so use an APC */ - APCFunction = NULL; // should be a private io completition function inside us - APCContext = lpCompletionRoutine; + APCFunction = &AfdAPC; // should be a private io completition function inside us + APCContext = HeapAlloc(GlobalHeap, 0, sizeof(AFDAPCCONTEXT)); + if (!APCContext) + { + ERR("Not enough memory for APC Context\n"); + return MsafdReturnWithErrno(STATUS_INSUFFICIENT_RESOURCES, lpErrno, 0, lpNumberOfBytesRead); + } + ((PAFDAPCCONTEXT)APCContext)->lpCompletionRoutine = lpCompletionRoutine; + ((PAFDAPCCONTEXT)APCContext)->lpOverlapped = lpOverlapped; + ((PAFDAPCCONTEXT)APCContext)->lpSocket = Socket; RecvInfo.AfdFlags |= AFD_SKIP_FIO; } @@ -397,12 +523,19 @@ NtClose( SockEvent ); + if (Status == STATUS_PENDING) + { + TRACE("Leaving (Pending)\n"); + return MsafdReturnWithErrno(Status, lpErrno, IOSB->Information, lpNumberOfBytesRead); + } + /* Return the Flags */ *ReceiveFlags = 0; switch (Status) { - case STATUS_RECEIVE_EXPEDITED: *ReceiveFlags = MSG_OOB; + case STATUS_RECEIVE_EXPEDITED: + *ReceiveFlags = MSG_OOB; break; case STATUS_RECEIVE_PARTIAL_EXPEDITED: *ReceiveFlags = MSG_PARTIAL | MSG_OOB; @@ -420,6 +553,12 @@ else { SockReenableAsyncSelectEvent(Socket, FD_READ); + } + + if (Status == STATUS_SUCCESS && lpOverlapped && lpCompletionRoutine) + { + lpCompletionRoutine(Status, IOSB->Information, lpOverlapped, *ReceiveFlags); + HeapFree(GlobalHeap, 0, (PVOID)APCContext); } return MsafdReturnWithErrno ( Status, lpErrno, IOSB->Information, lpNumberOfBytesRead ); @@ -494,6 +633,12 @@ } else { + /* Overlapped request for non overlapped opened socket */ + if ((Socket->SharedData->CreateFlags & SO_SYNCHRONOUS_NONALERT) != 0) + { + TRACE("Opened without flag WSA_FLAG_OVERLAPPED. Do nothing.\n"); + return MsafdReturnWithErrno(0, lpErrno, 0, lpNumberOfBytesSent); + } if (lpCompletionRoutine == NULL) { /* Using Overlapped Structure, but no Completition Routine, so no need for APC */ @@ -504,8 +649,16 @@ else { /* Using Overlapped Structure and a Completition Routine, so use an APC */ - APCFunction = NULL; // should be a private io completition function inside us - APCContext = lpCompletionRoutine; + APCFunction = &AfdAPC; // should be a private io completition function inside us + APCContext = HeapAlloc(GlobalHeap, 0, sizeof(AFDAPCCONTEXT)); + if (!APCContext) + { + ERR("Not enough memory for APC Context\n"); + return MsafdReturnWithErrno(STATUS_INSUFFICIENT_RESOURCES, lpErrno, 0, lpNumberOfBytesSent); + } + ((PAFDAPCCONTEXT)APCContext)->lpCompletionRoutine = lpCompletionRoutine; + ((PAFDAPCCONTEXT)APCContext)->lpOverlapped = lpOverlapped; + ((PAFDAPCCONTEXT)APCContext)->lpSocket = Socket; SendInfo.AfdFlags |= AFD_SKIP_FIO; } @@ -546,6 +699,12 @@ SockReenableAsyncSelectEvent(Socket, FD_WRITE); TRACE("Leaving (Success, %d)\n", IOSB->Information); + + if (Status == STATUS_SUCCESS && lpOverlapped && lpCompletionRoutine) + { + lpCompletionRoutine(Status, IOSB->Information, lpOverlapped, 0); + HeapFree(GlobalHeap, 0, (PVOID)APCContext); + } return MsafdReturnWithErrno( Status, lpErrno, IOSB->Information, lpNumberOfBytesSent ); } @@ -666,6 +825,12 @@ } else { + /* Overlapped request for non overlapped opened socket */ + if ((Socket->SharedData->CreateFlags & SO_SYNCHRONOUS_NONALERT) != 0) + { + TRACE("Opened without flag WSA_FLAG_OVERLAPPED. Do nothing.\n"); + return MsafdReturnWithErrno(0, lpErrno, 0, lpNumberOfBytesSent); + } if (lpCompletionRoutine == NULL) { /* Using Overlapped Structure, but no Completition Routine, so no need for APC */ @@ -676,9 +841,16 @@ else { /* Using Overlapped Structure and a Completition Routine, so use an APC */ - /* Should be a private io completition function inside us */ - APCFunction = NULL; - APCContext = lpCompletionRoutine; + APCFunction = &AfdAPC; // should be a private io completition function inside us + APCContext = HeapAlloc(GlobalHeap, 0, sizeof(AFDAPCCONTEXT)); + if (!APCContext) + { + ERR("Not enough memory for APC Context\n"); + return MsafdReturnWithErrno(STATUS_INSUFFICIENT_RESOURCES, lpErrno, 0, lpNumberOfBytesSent); + } + ((PAFDAPCCONTEXT)APCContext)->lpCompletionRoutine = lpCompletionRoutine; + ((PAFDAPCCONTEXT)APCContext)->lpOverlapped = lpOverlapped; + ((PAFDAPCCONTEXT)APCContext)->lpSocket = Socket; SendInfo.AfdFlags |= AFD_SKIP_FIO; } @@ -713,7 +885,19 @@ HeapFree(GlobalHeap, 0, BindAddress); } + if (Status == STATUS_PENDING) + { + TRACE("Leaving (Pending)\n"); + return MsafdReturnWithErrno(Status, lpErrno, IOSB->Information, lpNumberOfBytesSent); + } + SockReenableAsyncSelectEvent(Socket, FD_WRITE); + + if (Status == STATUS_SUCCESS && lpOverlapped && lpCompletionRoutine) + { + lpCompletionRoutine(Status, IOSB->Information, lpOverlapped, 0); + HeapFree(GlobalHeap, 0, (PVOID)APCContext); + } return MsafdReturnWithErrno(Status, lpErrno, IOSB->Information, lpNumberOfBytesSent); } Modified: trunk/reactos/dll/win32/msafd/misc/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/stubs…
============================================================================== --- trunk/reactos/dll/win32/msafd/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/misc/stubs.c [iso-8859-1] Thu Oct 13 20:30:42 2016 @@ -21,22 +21,6 @@ UNIMPLEMENTED; return 0; -} - - -BOOL -WSPAPI -WSPGetOverlappedResult( - IN SOCKET s, - IN LPWSAOVERLAPPED lpOverlapped, - OUT LPDWORD lpcbTransfer, - IN BOOL fWait, - OUT LPDWORD lpdwFlags, - OUT LPINT lpErrno) -{ - UNIMPLEMENTED; - - return FALSE; } Modified: trunk/reactos/dll/win32/msafd/msafd.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/msafd.h?re…
============================================================================== --- trunk/reactos/dll/win32/msafd/msafd.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/msafd.h [iso-8859-1] Thu Oct 13 20:30:42 2016 @@ -27,6 +27,7 @@ #include <wsahelp.h> #include <tdi.h> #include <afd/shared.h> +#include <mswsock.h> #include "include/helpers.h" extern HANDLE GlobalHeap; @@ -127,6 +128,13 @@ AFD_POLL_INFO AsyncSelectInfo; } ASYNC_DATA, *PASYNC_DATA; +typedef struct _AFDAPCCONTEXT +{ + LPWSAOVERLAPPED lpOverlapped; + LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine; + PSOCKET_INFORMATION lpSocket; +} AFDAPCCONTEXT, *PAFDAPCCONTEXT; + SOCKET WSPAPI WSPAccept(
8 years, 2 months
1
0
0
0
[mjansen] 72965: [NETCFGX] RegQueryValueExW accepts a size in bytes, not TCHARS. Also, this local buffer probably shouldnt be used. Uncovered by Victor Martinez Calvo. CORE-9665
by mjansen@svn.reactos.org
Author: mjansen Date: Thu Oct 13 19:57:29 2016 New Revision: 72965 URL:
http://svn.reactos.org/svn/reactos?rev=72965&view=rev
Log: [NETCFGX] RegQueryValueExW accepts a size in bytes, not TCHARS. Also, this local buffer probably shouldnt be used. Uncovered by Victor Martinez Calvo. CORE-9665 Modified: trunk/reactos/dll/win32/netcfgx/tcpipconf_notify.c Modified: trunk/reactos/dll/win32/netcfgx/tcpipconf_notify.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netcfgx/tcpipcon…
============================================================================== --- trunk/reactos/dll/win32/netcfgx/tcpipconf_notify.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netcfgx/tcpipconf_notify.c [iso-8859-1] Thu Oct 13 19:57:29 2016 @@ -2710,8 +2710,8 @@ RegQueryValueExW(hKey, L"RegisterAdapterName", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegisterAdapterName, &dwSize); RegQueryValueExW(hKey, L"RegistrationEnabled", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegistrationEnabled, &dwSize); - dwSize = sizeof(This->pCurrentConfig->pDNS->szDomain) / sizeof(WCHAR); - RegQueryValueExW(hKey, L"Domain", NULL, NULL, (LPBYTE)szBuffer, &dwSize); + dwSize = sizeof(This->pCurrentConfig->pDNS->szDomain); + RegQueryValueExW(hKey, L"Domain", NULL, NULL, (LPBYTE)This->pCurrentConfig->pDNS->szDomain, &dwSize); RegCloseKey(hKey); }
8 years, 2 months
1
0
0
0
[tfaber] 72964: [KMTESTS:IO] - Add a test for the maximum data length for MDLs CORE-12132
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Oct 13 12:28:01 2016 New Revision: 72964 URL:
http://svn.reactos.org/svn/reactos?rev=72964&view=rev
Log: [KMTESTS:IO] - Add a test for the maximum data length for MDLs CORE-12132 Modified: trunk/rostests/kmtests/ntos_io/IoMdl.c Modified: trunk/rostests/kmtests/ntos_io/IoMdl.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_io/IoMdl.c?r…
============================================================================== --- trunk/rostests/kmtests/ntos_io/IoMdl.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_io/IoMdl.c [iso-8859-1] Thu Oct 13 12:28:01 2016 @@ -16,12 +16,13 @@ PIRP Irp; PVOID VirtualAddress; ULONG MdlSize = 2*4096+184; // 2 pages and some random value + ULONG TooLargeMdlSize = (0x10000 - sizeof(MDL)) / sizeof(ULONG_PTR) * PAGE_SIZE; // Try to alloc 2Gb MDL Mdl = IoAllocateMdl(NULL, 2048UL*0x100000, FALSE, FALSE, NULL); ok(Mdl == NULL, - "IoAllocateMdl should fail allocation of 2Gb or more, but got Mdl=0x%X", + "IoAllocateMdl should fail allocation of 2Gb or more, but got Mdl=0x%X\n", (UINT_PTR)Mdl); if (Mdl) @@ -30,22 +31,40 @@ // Now create a valid MDL VirtualAddress = ExAllocatePool(NonPagedPool, MdlSize); Mdl = IoAllocateMdl(VirtualAddress, MdlSize, FALSE, FALSE, NULL); - ok(Mdl != NULL, "Mdl allocation failed"); + ok(Mdl != NULL, "Mdl allocation failed\n"); // Check fields of the allocated struct - ok(Mdl->Next == NULL, "Mdl->Next should be NULL, but is 0x%X", + ok(Mdl->Next == NULL, "Mdl->Next should be NULL, but is 0x%X\n", (UINT_PTR)Mdl->Next); ok(Mdl->ByteCount == MdlSize, - "Mdl->ByteCount should be equal to MdlSize, but is 0x%X", + "Mdl->ByteCount should be equal to MdlSize, but is 0x%X\n", (UINT_PTR)Mdl->ByteCount); // TODO: Check other fields of MDL struct IoFreeMdl(Mdl); + + // Test maximum size for an MDL + Mdl = IoAllocateMdl(NULL, TooLargeMdlSize, FALSE, FALSE, NULL); + ok(Mdl == NULL, "Mdl allocation for %lu bytes succeeded\n", TooLargeMdlSize); + if (Mdl) IoFreeMdl(Mdl); + + Mdl = IoAllocateMdl(NULL, TooLargeMdlSize - PAGE_SIZE + 1, FALSE, FALSE, NULL); + ok(Mdl == NULL, "Mdl allocation for %lu bytes succeeded\n", TooLargeMdlSize - PAGE_SIZE + 1); + if (Mdl) IoFreeMdl(Mdl); + + Mdl = IoAllocateMdl(NULL, TooLargeMdlSize - PAGE_SIZE, FALSE, FALSE, NULL); + ok(Mdl != NULL, "Mdl allocation for %lu bytes failed\n", TooLargeMdlSize - PAGE_SIZE); + if (Mdl) IoFreeMdl(Mdl); + + Mdl = IoAllocateMdl(NULL, TooLargeMdlSize / 2, FALSE, FALSE, NULL); + ok(Mdl != NULL, "Mdl allocation for %lu bytes failed\n", TooLargeMdlSize / 2); + if (Mdl) IoFreeMdl(Mdl); + // Allocate now with pointer to an Irp Irp = IoAllocateIrp(1, FALSE); - ok(Irp != NULL, "IRP allocation failed"); + ok(Irp != NULL, "IRP allocation failed\n"); Mdl = IoAllocateMdl(VirtualAddress, MdlSize, FALSE, FALSE, Irp); - ok(Mdl != NULL, "Mdl allocation failed"); - ok(Irp->MdlAddress == Mdl, "Irp->MdlAddress should be 0x%X, but is 0x%X", + ok(Mdl != NULL, "Mdl allocation failed\n"); + ok(Irp->MdlAddress == Mdl, "Irp->MdlAddress should be 0x%X, but is 0x%X\n", (UINT_PTR)Mdl, (UINT_PTR)Irp->MdlAddress); IoFreeMdl(Mdl);
8 years, 2 months
1
0
0
0
← Newer
1
...
10
11
12
13
14
15
16
...
23
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
Results per page:
10
25
50
100
200