mirror of
https://github.com/reactos/reactos.git
synced 2024-09-07 11:19:14 +00:00
[SYSAUDIO]
- Perform all allocations / frees in dedicated alloc / free function svn path=/trunk/; revision=47804
This commit is contained in:
parent
135340e065
commit
4da45c3ff1
|
@ -145,7 +145,7 @@ ComputeCompatibleFormat(
|
||||||
ULONG Index;
|
ULONG Index;
|
||||||
|
|
||||||
Length = sizeof(KSP_PIN) + sizeof(KSMULTIPLE_ITEM) + ClientFormat->DataFormat.FormatSize;
|
Length = sizeof(KSP_PIN) + sizeof(KSMULTIPLE_ITEM) + ClientFormat->DataFormat.FormatSize;
|
||||||
PinRequest = ExAllocatePool(NonPagedPool, Length);
|
PinRequest = AllocateItem(NonPagedPool, Length);
|
||||||
if (!PinRequest)
|
if (!PinRequest)
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ ComputeCompatibleFormat(
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ExFreePool(PinRequest);
|
FreeItem(PinRequest);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,10 +181,10 @@ ComputeCompatibleFormat(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
MultipleItem = ExAllocatePool(NonPagedPool, BytesReturned);
|
MultipleItem = AllocateItem(NonPagedPool, BytesReturned);
|
||||||
if (!MultipleItem)
|
if (!MultipleItem)
|
||||||
{
|
{
|
||||||
ExFreePool(PinRequest);
|
FreeItem(PinRequest);
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,8 +192,8 @@ ComputeCompatibleFormat(
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Property Request KSPROPERTY_PIN_DATARANGES failed with %x\n", Status);
|
DPRINT("Property Request KSPROPERTY_PIN_DATARANGES failed with %x\n", Status);
|
||||||
ExFreePool(MultipleItem);
|
FreeItem(MultipleItem);
|
||||||
ExFreePool(PinRequest);
|
FreeItem(PinRequest);
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,8 +253,8 @@ ComputeCompatibleFormat(
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ExFreePool(MultipleItem);
|
FreeItem(MultipleItem);
|
||||||
ExFreePool(PinRequest);
|
FreeItem(PinRequest);
|
||||||
|
|
||||||
if (bFound)
|
if (bFound)
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
|
@ -70,7 +70,7 @@ InsertAudioDevice(
|
||||||
PKSAUDIO_DEVICE_ENTRY DeviceEntry = NULL;
|
PKSAUDIO_DEVICE_ENTRY DeviceEntry = NULL;
|
||||||
|
|
||||||
/* a new device has arrived */
|
/* a new device has arrived */
|
||||||
DeviceEntry = ExAllocatePool(NonPagedPool, sizeof(KSAUDIO_DEVICE_ENTRY));
|
DeviceEntry = AllocateItem(NonPagedPool, sizeof(KSAUDIO_DEVICE_ENTRY));
|
||||||
if (!DeviceEntry)
|
if (!DeviceEntry)
|
||||||
{
|
{
|
||||||
/* no memory */
|
/* no memory */
|
||||||
|
@ -84,7 +84,7 @@ InsertAudioDevice(
|
||||||
DeviceEntry->DeviceName.Length = 0;
|
DeviceEntry->DeviceName.Length = 0;
|
||||||
DeviceEntry->DeviceName.MaximumLength = DeviceName->MaximumLength + 10 * sizeof(WCHAR);
|
DeviceEntry->DeviceName.MaximumLength = DeviceName->MaximumLength + 10 * sizeof(WCHAR);
|
||||||
|
|
||||||
DeviceEntry->DeviceName.Buffer = ExAllocatePool(NonPagedPool, DeviceEntry->DeviceName.MaximumLength);
|
DeviceEntry->DeviceName.Buffer = AllocateItem(NonPagedPool, DeviceEntry->DeviceName.MaximumLength);
|
||||||
|
|
||||||
if (!DeviceEntry->DeviceName.Buffer)
|
if (!DeviceEntry->DeviceName.Buffer)
|
||||||
{
|
{
|
||||||
|
@ -115,9 +115,9 @@ cleanup:
|
||||||
if (DeviceEntry)
|
if (DeviceEntry)
|
||||||
{
|
{
|
||||||
if (DeviceEntry->DeviceName.Buffer)
|
if (DeviceEntry->DeviceName.Buffer)
|
||||||
ExFreePool(DeviceEntry->DeviceName.Buffer);
|
FreeItem(DeviceEntry->DeviceName.Buffer);
|
||||||
|
|
||||||
ExFreePool(DeviceEntry);
|
FreeItem(DeviceEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
|
@ -70,7 +70,7 @@ DispatchCreateSysAudio(
|
||||||
DPRINT("DispatchCreateSysAudio entered\n");
|
DPRINT("DispatchCreateSysAudio entered\n");
|
||||||
|
|
||||||
/* allocate create item */
|
/* allocate create item */
|
||||||
CreateItem = ExAllocatePool(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM));
|
CreateItem = AllocateItem(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM));
|
||||||
if (!CreateItem)
|
if (!CreateItem)
|
||||||
{
|
{
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
|
@ -105,7 +105,7 @@ SysAudioAllocateDeviceHeader(
|
||||||
PKSOBJECT_CREATE_ITEM CreateItem;
|
PKSOBJECT_CREATE_ITEM CreateItem;
|
||||||
|
|
||||||
/* allocate create item */
|
/* allocate create item */
|
||||||
CreateItem = ExAllocatePool(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM));
|
CreateItem = AllocateItem(NonPagedPool, sizeof(KSOBJECT_CREATE_ITEM));
|
||||||
if (!CreateItem)
|
if (!CreateItem)
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,25 @@ const GUID KSCATEGORY_PREFERRED_WAVEOUT_DEVICE = {0xD6C5066EL, 0x72C1, 0x11D2, {
|
||||||
const GUID KSCATEGORY_PREFERRED_WAVEIN_DEVICE = {0xD6C50671L, 0x72C1, 0x11D2, {0x97, 0x55, 0x00, 0x00, 0xF8, 0x00, 0x47, 0x88}};
|
const GUID KSCATEGORY_PREFERRED_WAVEIN_DEVICE = {0xD6C50671L, 0x72C1, 0x11D2, {0x97, 0x55, 0x00, 0x00, 0xF8, 0x00, 0x47, 0x88}};
|
||||||
const GUID KSCATEGORY_PREFERRED_MIDIOUT_DEVICE = {0xD6C50674L, 0x72C1, 0x11D2, {0x97, 0x55, 0x00, 0x00, 0xF8, 0x00, 0x47, 0x88}};
|
const GUID KSCATEGORY_PREFERRED_MIDIOUT_DEVICE = {0xD6C50674L, 0x72C1, 0x11D2, {0x97, 0x55, 0x00, 0x00, 0xF8, 0x00, 0x47, 0x88}};
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
AllocateItem(
|
||||||
|
IN POOL_TYPE PoolType,
|
||||||
|
IN SIZE_T NumberOfBytes)
|
||||||
|
{
|
||||||
|
PVOID Item = ExAllocatePool(PoolType, NumberOfBytes);
|
||||||
|
if (!Item)
|
||||||
|
return Item;
|
||||||
|
|
||||||
|
RtlZeroMemory(Item, NumberOfBytes);
|
||||||
|
return Item;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FreeItem(
|
||||||
|
IN PVOID Item)
|
||||||
|
{
|
||||||
|
ExFreePool(Item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -58,7 +77,7 @@ SysAudio_Shutdown(
|
||||||
RtlFreeUnicodeString(&DeviceEntry->DeviceName);
|
RtlFreeUnicodeString(&DeviceEntry->DeviceName);
|
||||||
|
|
||||||
/* free audio device entry */
|
/* free audio device entry */
|
||||||
ExFreePool(DeviceEntry);
|
FreeItem(DeviceEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
|
|
|
@ -149,7 +149,7 @@ Pin_fnClose(
|
||||||
ZwClose(Context->hMixerPin);
|
ZwClose(Context->hMixerPin);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool(Context);
|
FreeItem(Context);
|
||||||
|
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
|
@ -315,7 +315,7 @@ InstantiatePins(
|
||||||
/* the audio irp pin didnt accept the input format
|
/* the audio irp pin didnt accept the input format
|
||||||
* let's compute a compatible format
|
* let's compute a compatible format
|
||||||
*/
|
*/
|
||||||
MixerPinConnect = ExAllocatePool(NonPagedPool, sizeof(KSPIN_CONNECT) + sizeof(KSDATAFORMAT_WAVEFORMATEX));
|
MixerPinConnect = AllocateItem(NonPagedPool, sizeof(KSPIN_CONNECT) + sizeof(KSDATAFORMAT_WAVEFORMATEX));
|
||||||
if (!MixerPinConnect)
|
if (!MixerPinConnect)
|
||||||
{
|
{
|
||||||
/* not enough memory */
|
/* not enough memory */
|
||||||
|
@ -335,7 +335,7 @@ InstantiatePins(
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("ComputeCompatibleFormat failed with %x\n", Status);
|
DPRINT1("ComputeCompatibleFormat failed with %x\n", Status);
|
||||||
ExFreePool(MixerPinConnect);
|
FreeItem(MixerPinConnect);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ InstantiatePins(
|
||||||
DPRINT1(" InputFormat: SampleRate %u Bits %u Channels %u\n", InputFormat->WaveFormatEx.nSamplesPerSec, InputFormat->WaveFormatEx.wBitsPerSample, InputFormat->WaveFormatEx.nChannels);
|
DPRINT1(" InputFormat: SampleRate %u Bits %u Channels %u\n", InputFormat->WaveFormatEx.nSamplesPerSec, InputFormat->WaveFormatEx.wBitsPerSample, InputFormat->WaveFormatEx.nChannels);
|
||||||
DPRINT1("OutputFormat: SampleRate %u Bits %u Channels %u\n", OutputFormat->WaveFormatEx.nSamplesPerSec, OutputFormat->WaveFormatEx.wBitsPerSample, OutputFormat->WaveFormatEx.nChannels);
|
DPRINT1("OutputFormat: SampleRate %u Bits %u Channels %u\n", OutputFormat->WaveFormatEx.nSamplesPerSec, OutputFormat->WaveFormatEx.wBitsPerSample, OutputFormat->WaveFormatEx.nChannels);
|
||||||
|
|
||||||
ExFreePool(MixerPinConnect);
|
FreeItem(MixerPinConnect);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -378,7 +378,7 @@ InstantiatePins(
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to create Mixer Pin with %x\n", Status);
|
DPRINT1("Failed to create Mixer Pin with %x\n", Status);
|
||||||
ExFreePool(MixerPinConnect);
|
FreeItem(MixerPinConnect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* done */
|
/* done */
|
||||||
|
@ -408,7 +408,7 @@ GetConnectRequest(
|
||||||
ParametersLength = IoStack->FileObject->FileName.MaximumLength - ObjectLength;
|
ParametersLength = IoStack->FileObject->FileName.MaximumLength - ObjectLength;
|
||||||
|
|
||||||
/* allocate buffer */
|
/* allocate buffer */
|
||||||
Buffer = ExAllocatePool(NonPagedPool, ParametersLength);
|
Buffer = AllocateItem(NonPagedPool, ParametersLength);
|
||||||
if (!Buffer)
|
if (!Buffer)
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ DispatchCreateSysAudioPin(
|
||||||
|
|
||||||
|
|
||||||
/* allocate dispatch context */
|
/* allocate dispatch context */
|
||||||
DispatchContext = ExAllocatePool(NonPagedPool, sizeof(DISPATCH_CONTEXT));
|
DispatchContext = AllocateItem(NonPagedPool, sizeof(DISPATCH_CONTEXT));
|
||||||
if (!DispatchContext)
|
if (!DispatchContext)
|
||||||
{
|
{
|
||||||
/* failed */
|
/* failed */
|
||||||
|
@ -488,7 +488,7 @@ DispatchCreateSysAudioPin(
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* failed */
|
/* failed */
|
||||||
ExFreePool(DispatchContext);
|
FreeItem(DispatchContext);
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -500,7 +500,7 @@ DispatchCreateSysAudioPin(
|
||||||
{
|
{
|
||||||
/* failed */
|
/* failed */
|
||||||
KsFreeObjectHeader(DispatchContext->ObjectHeader);
|
KsFreeObjectHeader(DispatchContext->ObjectHeader);
|
||||||
ExFreePool(DispatchContext);
|
FreeItem(DispatchContext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,3 +116,13 @@ ComputeCompatibleFormat(
|
||||||
IN ULONG PinId,
|
IN ULONG PinId,
|
||||||
IN PKSDATAFORMAT_WAVEFORMATEX ClientFormat,
|
IN PKSDATAFORMAT_WAVEFORMATEX ClientFormat,
|
||||||
OUT PKSDATAFORMAT_WAVEFORMATEX MixerFormat);
|
OUT PKSDATAFORMAT_WAVEFORMATEX MixerFormat);
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
AllocateItem(
|
||||||
|
IN POOL_TYPE PoolType,
|
||||||
|
IN SIZE_T NumberOfBytes);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FreeItem(
|
||||||
|
IN PVOID Item);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue