ULONG Index;
PWDMAUD_HANDLE Handels;
PWDMAUD_DEVICE_EXTENSION DeviceExtension;
+ NTSTATUS Status;
+ PKEVENT EventObject = NULL;
DPRINT("WdmAudControlOpenMixer\n");
DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
-
if (DeviceInfo->DeviceIndex >= DeviceExtension->MixerInfoCount)
{
/* mixer index doesnt exist */
return SetIrpIoStatus(Irp, STATUS_UNSUCCESSFUL, 0);
}
+ if (DeviceInfo->u.hNotifyEvent)
+ {
+ Status = ObReferenceObjectByHandle(DeviceInfo->u.hNotifyEvent, EVENT_MODIFY_STATE, ExEventObjectType, UserMode, (LPVOID*)&EventObject, NULL);
+
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Invalid notify event passed %p from client %p\n", DeviceInfo->u.hNotifyEvent, ClientInfo);
+ DbgBreakPoint();
+ return SetIrpIoStatus(Irp, STATUS_UNSUCCESSFUL, 0);
+ }
+ }
+
+
for(Index = 0; Index < ClientInfo->NumPins; Index++)
{
if (ClientInfo->hPins[Index].Handle == (HANDLE)DeviceInfo->DeviceIndex && ClientInfo->hPins[Index].Type == MIXER_DEVICE_TYPE)
{
/* re-use pseudo handle */
DeviceInfo->hDevice = (HANDLE)DeviceInfo->DeviceIndex;
- ClientInfo->hPins[Index].hNotifyEvent = DeviceInfo->u.hNotifyEvent;
+ ClientInfo->hPins[Index].NotifyEvent = EventObject;
return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO));
}
}
ClientInfo->hPins = Handels;
ClientInfo->hPins[ClientInfo->NumPins].Handle = (HANDLE)DeviceInfo->DeviceIndex;
ClientInfo->hPins[ClientInfo->NumPins].Type = MIXER_DEVICE_TYPE;
- ClientInfo->hPins[ClientInfo->NumPins].hNotifyEvent = DeviceInfo->u.hNotifyEvent;
+ ClientInfo->hPins[ClientInfo->NumPins].NotifyEvent = EventObject;
ClientInfo->NumPins++;
}
else
if (DeviceInfo->u.MixLine.dwSource >= MixerLineSrc->Line.cConnections)
{
- DPRINT1("dwSource %u Destinations %u\n", DeviceInfo->u.MixLine.dwSource, MixerLineSrc->Line.cConnections);
+ DPRINT1("dwSource %u > Destinations %u\n", DeviceInfo->u.MixLine.dwSource, MixerLineSrc->Line.cConnections);
/* invalid parameter */
return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER, 0);
}
return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO));
}
- DPRINT1("Flags %x\n", DeviceInfo->Flags);
+ DPRINT("Flags %x\n", DeviceInfo->Flags);
UNIMPLEMENTED;
//DbgBreakPoint();
Index = 0;
for(Index = 0; Index < MixerLineSrc->Line.cControls; Index++)
{
- DPRINT1("dwControlType %x\n", MixerLineSrc->LineControls[Index].dwControlType);
+ DPRINT("dwControlType %x\n", MixerLineSrc->LineControls[Index].dwControlType);
if (DeviceInfo->u.MixControls.dwControlType == MixerLineSrc->LineControls[Index].dwControlType)
{
RtlMoveMemory(DeviceInfo->u.MixControls.pamxctrl, &MixerLineSrc->LineControls[Index], sizeof(MIXERCONTROLW));
return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO));
}
}
- DPRINT1("DeviceInfo->u.MixControls.dwControlType %x not found in Line %x cControls %u \n", DeviceInfo->u.MixControls.dwControlType, DeviceInfo->u.MixControls.dwLineID, MixerLineSrc->Line.cControls);
+ DPRINT("DeviceInfo->u.MixControls.dwControlType %x not found in Line %x cControls %u \n", DeviceInfo->u.MixControls.dwControlType, DeviceInfo->u.MixControls.dwLineID, MixerLineSrc->Line.cControls);
return SetIrpIoStatus(Irp, STATUS_UNSUCCESSFUL, sizeof(WDMAUD_DEVICE_INFO));
}
else if (DeviceInfo->Flags == MIXER_GETLINECONTROLSF_ONEBYID)
/* invalid parameter */
return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER, 0);
}
- DPRINT1("MixerId %u ControlId %u\n",(ULONG_PTR)DeviceInfo->hDevice, DeviceInfo->u.MixControls.dwControlID);
+ DPRINT("MixerId %u ControlId %u\n",(ULONG_PTR)DeviceInfo->hDevice, DeviceInfo->u.MixControls.dwControlID);
Status = GetMixerControlById(&DeviceExtension->MixerInfo[(ULONG_PTR)DeviceInfo->hDevice], DeviceInfo->u.MixControls.dwControlID, NULL, &MixerControl, NULL);
if (NT_SUCCESS(Status))
{
*InputValue = Value;
}
- DPRINT1("Status %x bSet %u NodeId %u Value %d PropertyId %u\n", Status, bSet, NodeId, Value, PropertyId);
+ DPRINT("Status %x bSet %u NodeId %u Value %d PropertyId %u\n", Status, bSet, NodeId, Value, PropertyId);
return Status;
}
PWDMAUD_DEVICE_EXTENSION DeviceExtension;
PLIST_ENTRY Entry;
PWDMAUD_CLIENT CurClient;
- PKEVENT EventObject;
PMIXER_EVENT Event;
KIRQL OldIrql;
ULONG Index;
- NTSTATUS Status;
/* get device extension */
DeviceExtension = (PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
/* now iterate through all pins and try to find an matching handle */
for(Index = 0; Index < CurClient->NumPins; Index++)
{
- if (CurClient->hPins[Index].Handle == hMixer && CurClient->hPins[Index].Type == MIXER_DEVICE_TYPE && CurClient->hPins[Index].hNotifyEvent)
+ if (CurClient->hPins[Index].Handle == hMixer && CurClient->hPins[Index].Type == MIXER_DEVICE_TYPE && CurClient->hPins[Index].NotifyEvent)
{
- /* found a matching mixer handle and a valid notify event */
- Status = ObReferenceObjectByHandle(CurClient->hPins[Index].hNotifyEvent, EVENT_MODIFY_STATE, ExEventObjectType, UserMode, (LPVOID*)&EventObject, NULL);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Invalid notify event passed %p from client %p\n", CurClient->hPins[Index].hNotifyEvent, CurClient);
- break;
- }
-
/* allocate event entry */
Event = (PMIXER_EVENT)ExAllocatePool(NonPagedPool, sizeof(MIXER_EVENT));
if (!Event)
{
/* no memory */
- ObDereferenceObject(EventObject);
return STATUS_INSUFFICIENT_RESOURCES;
}
/* insert event entry */
InsertTailList(&CurClient->MixerEventList, &Event->Entry);
+ DPRINT("Notifying %p hMixer %p Value %x NotificationType %u\n", CurClient->hPins[Index].NotifyEvent, hMixer, Value, NotificationType);
+
/* now signal the event */
- KeSetEvent(EventObject, 0, FALSE);
+ KeSetEvent(CurClient->hPins[Index].NotifyEvent, 0, FALSE);
+
- /* dereference event */
- ObDereferenceObject(EventObject);
/* search next client */
break;
return Status;
}
+ULONG
+GetVolumeControlIndex(
+ LPMIXERVOLUME_DATA VolumeData,
+ LONG Value)
+{
+ ULONG Index;
+
+ for(Index = 0; Index < VolumeData->ValuesCount; Index++)
+ {
+ if (VolumeData->Values[Index] > Value)
+ {
+ return VolumeData->InputSteppingDelta * Index;
+ }
+ }
+ return VolumeData->InputSteppingDelta * (VolumeData->ValuesCount-1);
+}
+
+
NTSTATUS
SetGetVolumeControlDetails(
IN PDEVICE_OBJECT DeviceObject,
{
LPMIXERCONTROLDETAILS_UNSIGNED Input;
LONG Value, Index, Channel = 0;
+ ULONG dwValue;
NTSTATUS Status;
LPMIXERVOLUME_DATA VolumeData;
if (!bSet)
{
- for(Index = 0; Index < VolumeData->ValuesCount; Index++)
- {
- if (VolumeData->Values[Index] > Value)
- {
- /* FIXME SEH */
- Input->dwValue = VolumeData->InputSteppingDelta * Index;
- return Status;
- }
- }
- Input->dwValue = VolumeData->InputSteppingDelta * (VolumeData->ValuesCount-1);
+ dwValue = GetVolumeControlIndex(VolumeData, (LONG)Value);
+ /* FIXME SEH */
+ Input->dwValue = dwValue;
}
else
{
if (Event->hMixer == DeviceInfo->hDevice)
{
/* found an event for that particular device */
+ RemoveEntryList(&Event->Entry);
break;
}
Entry = Entry->Flink;
}
-
/* release client context lock */
KeReleaseSpinLock(&DeviceExtension->Lock, OldIrql);