RtlMoveMemory(DeviceInfo->u.Interface.DeviceInterfaceString, Device, Length);
}
- ExFreePool(Device);
+ FreeItem(Device);
return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO));
}
else if (DeviceInfo->DeviceType == MIXER_DEVICE_TYPE)
while(*SymbolicLinkList)
{
Length = wcslen(SymbolicLinkList) + 1;
- Entry = (SYSAUDIO_ENTRY*)ExAllocatePool(NonPagedPool, sizeof(SYSAUDIO_ENTRY) + Length * sizeof(WCHAR));
+ Entry = (SYSAUDIO_ENTRY*)AllocateItem(NonPagedPool, sizeof(SYSAUDIO_ENTRY) + Length * sizeof(WCHAR));
if (!Entry)
{
return STATUS_INSUFFICIENT_RESOURCES;
if (NT_SUCCESS(Status))
{
WdmAudOpenSysAudioDeviceInterfaces(DeviceExtension, SymbolicLinkList);
- ExFreePool(SymbolicLinkList);
+ FreeItem(SymbolicLinkList);
}
else
{
Length = wcslen(DeviceName.Buffer) + 1;
- Entry = (SYSAUDIO_ENTRY*)ExAllocatePool(NonPagedPool, sizeof(SYSAUDIO_ENTRY) + Length * sizeof(WCHAR));
+ Entry = (SYSAUDIO_ENTRY*)AllocateItem(NonPagedPool, sizeof(SYSAUDIO_ENTRY) + Length * sizeof(WCHAR));
if (!Entry)
{
return STATUS_INSUFFICIENT_RESOURCES;
ASSERT(!IsListEmpty(&DeviceExtension->SysAudioDeviceList));
/* allocate client context struct */
- Client = ExAllocatePool(NonPagedPool, sizeof(WDMAUD_CLIENT));
+ Client = AllocateItem(NonPagedPool, sizeof(WDMAUD_CLIENT));
/* check for allocation failure */
if (!Client)
/* free pin array */
if (pClient->hPins)
- ExFreePool(pClient->hPins);
+ FreeItem(pClient->hPins);
/* free client context struct */
- ExFreePool(pClient);
+ FreeItem(pClient);
/* clear old client pointer */
IoStack->FileObject->FsContext = NULL;
return MM_STATUS_UNSUCCESSFUL;
/* allocate a buffer for key data */
- PartialInformation = ExAllocatePool(NonPagedPool, Length);
+ PartialInformation = AllocateItem(NonPagedPool, Length);
if (!PartialInformation)
return MM_STATUS_NO_MEMORY;
/* check for success */
if (!NT_SUCCESS(Status))
{
- ExFreePool(PartialInformation);
+ FreeItem(PartialInformation);
return MM_STATUS_UNSUCCESSFUL;
}
*ResultLength = PartialInformation->DataLength;
}
- *ResultBuffer = ExAllocatePool(NonPagedPool, PartialInformation->DataLength);
+ *ResultBuffer = AllocateItem(NonPagedPool, PartialInformation->DataLength);
if (!*ResultBuffer)
{
/* not enough memory */
- ExFreePool(PartialInformation);
+ FreeItem(PartialInformation);
return MM_STATUS_NO_MEMORY;
}
RtlMoveMemory(*ResultBuffer, PartialInformation->Data, PartialInformation->DataLength);
/* free key info */
- ExFreePool(PartialInformation);
+ FreeItem(PartialInformation);
return MM_STATUS_SUCCESS;
}
PVOID Alloc(ULONG NumBytes)
{
- PVOID Mem = ExAllocatePool(NonPagedPool, NumBytes);
- if (!Mem)
- return Mem;
-
- RtlZeroMemory(Mem, NumBytes);
- return Mem;
+ return AllocateItem(NonPagedPool, NumBytes);
}
MIXER_STATUS
VOID
Free(PVOID Block)
{
- ExFreePool(Block);
+ FreeItem(Block);
}
VOID
{
/* failed to open key */
DPRINT("IoOpenDeviceInterfaceRegistryKey failed with %lx\n", Status);
- ExFreePool(*DeviceName);
+ FreeItem(*DeviceName);
return MM_STATUS_UNSUCCESSFUL;
}
#endif
AllocEventData(
IN ULONG ExtraSize)
{
- PKSEVENTDATA Data = (PKSEVENTDATA)ExAllocatePool(NonPagedPool, sizeof(KSEVENTDATA) + ExtraSize);
+ PKSEVENTDATA Data = (PKSEVENTDATA)AllocateItem(NonPagedPool, sizeof(KSEVENTDATA) + ExtraSize);
if (!Data)
return NULL;
- Data->EventObject.Event = ExAllocatePool(NonPagedPool, sizeof(KEVENT));
+ Data->EventObject.Event = AllocateItem(NonPagedPool, sizeof(KEVENT));
if (!Data->EventHandle.Event)
{
- ExFreePool(Data);
+ FreeItem(Data);
return NULL;
}
{
PKSEVENTDATA Data = (PKSEVENTDATA)EventData;
- ExFreePool(Data->EventHandle.Event);
- ExFreePool(Data);
+ FreeItem(Data->EventHandle.Event);
+ FreeItem(Data);
}
NTSTATUS
}
- Handles = ExAllocatePool(NonPagedPool, sizeof(WDMAUD_HANDLE) * (ClientInfo->NumPins+1));
+ Handles = AllocateItem(NonPagedPool, sizeof(WDMAUD_HANDLE) * (ClientInfo->NumPins+1));
if (Handles)
{
if (ClientInfo->NumPins)
{
RtlMoveMemory(Handles, ClientInfo->hPins, sizeof(WDMAUD_HANDLE) * ClientInfo->NumPins);
- ExFreePool(ClientInfo->hPins);
+ FreeItem(ClientInfo->hPins);
}
ClientInfo->hPins = Handles;
*/
#include "wdmaud.h"
+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);
+}
+
+
+
ULONG
GetSysAudioDeviceCount(
IN PDEVICE_OBJECT DeviceObject)
return STATUS_SUCCESS;
}
- Handles = ExAllocatePool(NonPagedPool, sizeof(WDMAUD_HANDLE) * (ClientInfo->NumPins+1));
+ Handles = AllocateItem(NonPagedPool, sizeof(WDMAUD_HANDLE) * (ClientInfo->NumPins+1));
if (!Handles)
return STATUS_INSUFFICIENT_RESOURCES;
if (ClientInfo->NumPins)
{
RtlMoveMemory(Handles, ClientInfo->hPins, sizeof(WDMAUD_HANDLE) * ClientInfo->NumPins);
- ExFreePool(ClientInfo->hPins);
+ FreeItem(ClientInfo->hPins);
}
ClientInfo->hPins = Handles;
return NULL;
/* allocate a buffer for key data */
- PartialInformation = ExAllocatePool(NonPagedPool, Length);
+ PartialInformation = AllocateItem(NonPagedPool, Length);
if (!PartialInformation)
return NULL;
/* check for success */
if (!NT_SUCCESS(Status))
{
- ExFreePool(PartialInformation);
+ FreeItem(PartialInformation);
return NULL;
}
if (PartialInformation->Type != REG_SZ)
{
/* invalid key type */
- ExFreePool(PartialInformation);
+ FreeItem(PartialInformation);
return NULL;
}
if (_wcsnicmp((LPWSTR)PartialInformation->Data, &PnpName[4], Length))
{
- ExFreePool(PartialInformation);
+ FreeItem(PartialInformation);
return STATUS_NO_MATCH;
}
/* free buffer */
- ExFreePool(PartialInformation);
+ FreeItem(PartialInformation);
/* read DriverDescName value */
PartialInformation = ReadKeyValue(hSubKey, &DriverDescName);
ProductName[ProductNameSize-1] = L'\0';
/* free buffer */
- ExFreePool(PartialInformation);
+ FreeItem(PartialInformation);
return STATUS_SUCCESS;
}
}
/* allocate key information struct */
- KeyInformation = ExAllocatePool(NonPagedPool, Length);
+ KeyInformation = AllocateItem(NonPagedPool, Length);
if (!KeyInformation)
{
/* no memory */
if (!NT_SUCCESS(Status))
{
DPRINT1("ZwQueryKey failed with %x\n", Status);
- ExFreePool(KeyInformation);
+ FreeItem(KeyInformation);
ZwClose(hKey);
return Status;
}
}
/* free buffer */
- ExFreePool(KeyInformation);
+ FreeItem(KeyInformation);
/* close key */
ZwClose(hKey);
return STATUS_UNSUCCESSFUL;
/* allocate buffer for the device */
- *Device = ExAllocatePool(NonPagedPool, BytesReturned);
+ *Device = AllocateItem(NonPagedPool, BytesReturned);
if (!Device)
return STATUS_INSUFFICIENT_RESOURCES;
if (!NT_SUCCESS(Status))
{
/* failed */
- ExFreePool(*Device);
+ FreeItem(*Device);
return Status;
}
ULONG
GetSysAudioDeviceCount(
IN PDEVICE_OBJECT DeviceObject);
+
+
+PVOID
+AllocateItem(
+ IN POOL_TYPE PoolType,
+ IN SIZE_T NumberOfBytes);
+
+VOID
+FreeItem(
+ IN PVOID Item);
+