mirror of
https://github.com/reactos/reactos.git
synced 2024-07-02 02:34:53 +00:00
[MMIXER, WDMAUD_KERNEL]
- Implement retrieving device path svn path=/trunk/; revision=45582
This commit is contained in:
parent
97db4c1d16
commit
dd15553124
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue