[MMIXER, WDMAUD_KERNEL]

- Implement retrieving device path

svn path=/trunk/; revision=45582
This commit is contained in:
Johannes Anderwald 2010-02-12 06:18:31 +00:00
parent 97db4c1d16
commit dd15553124
3 changed files with 70 additions and 3 deletions

View file

@ -551,10 +551,12 @@ NTSTATUS
WdmAudGetPnpNameByIndexAndType(
IN ULONG DeviceIndex,
IN SOUND_DEVICE_TYPE DeviceType,
OUT LPWSTR *Device)
OUT LPWSTR *DevicePath)
{
UNIMPLEMENTED
return STATUS_NOT_IMPLEMENTED;
if (MMixerGetWaveDevicePath(&MixerContext, DeviceType == WAVE_IN_DEVICE_TYPE, DeviceIndex, DevicePath) == MM_STATUS_SUCCESS)
return STATUS_SUCCESS;
else
return STATUS_UNSUCCESSFUL;
}
NTSTATUS

View file

@ -191,4 +191,11 @@ MMixerSetWaveStatus(
IN HANDLE PinHandle,
IN KSSTATE State);
MIXER_STATUS
MMixerGetWaveDevicePath(
IN PMIXER_CONTEXT MixerContext,
IN ULONG bWaveIn,
IN ULONG DeviceId,
OUT LPWSTR * DevicePath);
#endif

View file

@ -611,3 +611,61 @@ MMixerSetWaveStatus(
return MixerContext->Control(PinHandle, IOCTL_KS_PROPERTY, &Property, sizeof(KSPROPERTY), &State, sizeof(KSSTATE), &Length);
}
MIXER_STATUS
MMixerGetWaveDevicePath(
IN PMIXER_CONTEXT MixerContext,
IN ULONG bWaveIn,
IN ULONG DeviceId,
OUT LPWSTR * DevicePath)
{
PMIXER_LIST MixerList;
LPMIXER_DATA MixerData;
LPWAVE_INFO WaveInfo;
ULONG Length;
MIXER_STATUS Status;
// verify mixer context
Status = MMixerVerifyContext(MixerContext);
if (Status != MM_STATUS_SUCCESS)
{
// invalid context passed
return Status;
}
// grab mixer list
MixerList = (PMIXER_LIST)MixerContext->MixerContext;
/* find destination wave */
Status = MMixerGetWaveInfoByIndexAndType(MixerList, DeviceId, bWaveIn, &WaveInfo);
if (Status != MM_STATUS_SUCCESS)
{
/* failed to find wave info */
return MM_STATUS_INVALID_PARAMETER;
}
/* get associated device id */
MixerData = MMixerGetDataByDeviceId(MixerList, WaveInfo->DeviceId);
if (!MixerData)
return MM_STATUS_INVALID_PARAMETER;
/* calculate length */
Length = wcslen(MixerData->DeviceName)+1;
/* allocate destination buffer */
*DevicePath = MixerContext->Alloc(Length * sizeof(WCHAR));
if (!*DevicePath)
{
/* no memory */
return MM_STATUS_NO_MEMORY;
}
/* copy device path */
MixerContext->Copy(*DevicePath, MixerData->DeviceName, Length * sizeof(WCHAR));
/* done */
return MM_STATUS_SUCCESS;
}