reactos/drivers/wdm/audio/backpln/portcls/miniport.cpp
Timo Kreuzer 99fa38809f [STDUNK][PORTCLS][CMIDriver] Fix issue with operator new/delete
Fix for MSVC warning "C2323: 'operator new': non-member operator new or delete functions may not be declared static or in a namespace other than the global namespace."

See https://docs.microsoft.com/en-us/cpp/porting/visual-cpp-what-s-new-2003-through-2015?view=vs-2019 section "Overloaded operator new and operator delete"
2019-06-24 21:17:00 +02:00

80 lines
1.6 KiB
C++

/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Kernel Streaming
* FILE: drivers/wdm/audio/backpln/portcls/miniport.cpp
* PURPOSE: Miniport construction api
* PROGRAMMER: Andrew Greenwood
*/
#include "private.hpp"
#ifndef YDEBUG
#define NDEBUG
#endif
#include <debug.h>
PVOID
__cdecl
operator new(
size_t Size,
POOL_TYPE PoolType,
ULONG Tag)
{
return ExAllocatePoolWithTag(PoolType, Size, Tag);
}
void
__cdecl
operator delete(
PVOID ptr)
{
ExFreePool(ptr);
}
void
__cdecl
operator delete(
PVOID ptr, UINT_PTR)
{
ExFreePool(ptr);
}
NTSTATUS
NTAPI
PcNewMiniport(
OUT PMINIPORT* OutMiniport,
IN REFCLSID ClassId)
{
NTSTATUS Status = STATUS_INVALID_PARAMETER;
DPRINT("PcNewMiniport entered\n");
PC_ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);
if (!OutMiniport)
{
DPRINT("PcNewMiniport was supplied a NULL OutPort parameter\n");
return STATUS_INVALID_PARAMETER;
}
if (IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverDMusUART) ||
IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverUart) ||
IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverDMusUARTCapture))
{
Status = NewMiniportDMusUART(OutMiniport, ClassId);
}
else if (IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverFmSynth) ||
IsEqualGUIDAligned(ClassId, CLSID_MiniportDriverFmSynthWithVol))
{
Status = NewMiniportFmSynth(OutMiniport, ClassId);
}
else
{
Status = STATUS_INVALID_PARAMETER;
}
DPRINT("PcNewMiniport Status %x\n", Status);
return Status;
}