Author: janderwald
Date: Sun Dec 13 12:32:44 2009
New Revision: 44559
URL:
http://svn.reactos.org/svn/reactos?rev=44559&view=rev
Log:
[MMIXER]
- Add more error checks
- Fix a bug MMixerGetControlsFromPinByConnectionIndex which pre-early stopped the
enumeration of mixer controls
- Only add guids which can be later be resolved to mixer control
- Check if no a topology connection has no links connected
Modified:
trunk/reactos/lib/drivers/sound/mmixer/controls.c
trunk/reactos/lib/drivers/sound/mmixer/sup.c
Modified: trunk/reactos/lib/drivers/sound/mmixer/controls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/c…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/controls.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/controls.c [iso-8859-1] Sun Dec 13 12:32:44
2009
@@ -96,6 +96,12 @@
else
NodeIndex = CurConnection->ToNode;
+ if (NodeIndex > NodeTypes->Count)
+ {
+ // reached end of pin connection
+ return MM_STATUS_SUCCESS;
+ }
+
/* get target node type of current connection */
NodeType = MMixerGetNodeType(NodeTypes, NodeIndex);
@@ -124,7 +130,7 @@
Status = MMixerGetNodeIndexes(MixerContext, NodeConnections, NodeIndex, TRUE,
TRUE, &NodeConnectionCount, &NodeConnection);
}
- if (Status != MM_STATUS_SUCCESS)
+ if (Status == MM_STATUS_SUCCESS)
{
for(Index = 0; Index < NodeConnectionCount; Index++)
{
@@ -332,6 +338,7 @@
LPWSTR PinName;
GUID NodeType;
ULONG BytesReturned, ControlCount, Index;
+ LPGUID Node;
PULONG Nodes;
if (!bTargetPin)
@@ -414,8 +421,14 @@
{
if (Nodes[Index])
{
- // found a node
- ControlCount++;
+ // get node type
+ Node = MMixerGetNodeType(NodeTypes, Index);
+
+ if (MMixerGetControlTypeFromTopologyNode(Node))
+ {
+ // found a node which can be resolved to a type
+ ControlCount++;
+ }
}
}
@@ -457,14 +470,20 @@
{
if (Nodes[Index])
{
- /* store the node index for retrieving / setting details */
- SrcLine->NodeIds[ControlCount] = Index;
-
- Status = MMixerAddMixerControl(MixerContext, MixerInfo, hDevice,
NodeTypes, Index, SrcLine, &SrcLine->LineControls[ControlCount]);
- if (Status == MM_STATUS_SUCCESS)
+ // get node type
+ Node = MMixerGetNodeType(NodeTypes, Index);
+
+ if (MMixerGetControlTypeFromTopologyNode(Node))
{
- /* increment control count on success */
- ControlCount++;
+ /* store the node index for retrieving / setting details */
+ SrcLine->NodeIds[ControlCount] = Index;
+
+ Status = MMixerAddMixerControl(MixerContext, MixerInfo, hDevice,
NodeTypes, Index, SrcLine, &SrcLine->LineControls[ControlCount]);
+ if (Status == MM_STATUS_SUCCESS)
+ {
+ /* increment control count on success */
+ ControlCount++;
+ }
}
}
}
@@ -902,8 +921,6 @@
return Status;
}
-
-
RtlZeroMemory(Pins, sizeof(ULONG) * PinCount);
// now get the target pins of the ADC / DAC node
Status = MMixerGetTargetPins(MixerContext, NodeTypes, NodeConnections, NodeIndex,
bInputMixer, Pins, PinCount);
Modified: trunk/reactos/lib/drivers/sound/mmixer/sup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/s…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/sup.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/sup.c [iso-8859-1] Sun Dec 13 12:32:44 2009
@@ -251,6 +251,13 @@
Connection++;
}
+ if (!Count)
+ {
+ *NodeReferenceCount = 0;
+ *NodeReference = NULL;
+ return MM_STATUS_SUCCESS;
+ }
+
ASSERT(Count != 0);
/* now allocate node index array */