mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 12:03:29 +00:00
[LIBUSB] Add additional operator new/delete
This is required, since newer versions of MSVC demand that non-member operator new/delete are in the global namespace and neither static nor inline. See https://msdn.microsoft.com/en-us/library/mt723604.aspx ("Overloaded operator new and operator delete")
This commit is contained in:
parent
03830f67a7
commit
a262e8da2d
2 changed files with 39 additions and 0 deletions
|
@ -18,6 +18,36 @@
|
||||||
//
|
//
|
||||||
DRIVER_ADD_DEVICE USBLIB_AddDevice;
|
DRIVER_ADD_DEVICE USBLIB_AddDevice;
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
__cdecl
|
||||||
|
operator new(
|
||||||
|
size_t iSize,
|
||||||
|
POOL_TYPE poolType,
|
||||||
|
ULONG tag)
|
||||||
|
{
|
||||||
|
PVOID result = ExAllocatePoolWithTag(poolType, iSize, tag);
|
||||||
|
if (result) {
|
||||||
|
RtlZeroMemory(result, iSize);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
__cdecl
|
||||||
|
operator delete(
|
||||||
|
PVOID pVoid)
|
||||||
|
{
|
||||||
|
if (pVoid) ExFreePool(pVoid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
__cdecl
|
||||||
|
operator delete(
|
||||||
|
PVOID pVoid, UINT_PTR)
|
||||||
|
{
|
||||||
|
if (pVoid) ExFreePool(pVoid);
|
||||||
|
}
|
||||||
|
|
||||||
extern
|
extern
|
||||||
"C"
|
"C"
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,8 +22,17 @@ extern "C"
|
||||||
// the following includes are required to get kcom to compile
|
// the following includes are required to get kcom to compile
|
||||||
//
|
//
|
||||||
#include <portcls.h>
|
#include <portcls.h>
|
||||||
|
#define _NEW_DELETE_OPERATORS_
|
||||||
#include <kcom.h>
|
#include <kcom.h>
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
__cdecl
|
||||||
|
operator new(
|
||||||
|
size_t iSize,
|
||||||
|
POOL_TYPE poolType,
|
||||||
|
ULONG tag);
|
||||||
|
|
||||||
|
|
||||||
#include "common_interfaces.h"
|
#include "common_interfaces.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue