diff --git a/sdk/lib/drivers/libusb/libusb.cpp b/sdk/lib/drivers/libusb/libusb.cpp index f5dc0f17f44..632614803d3 100644 --- a/sdk/lib/drivers/libusb/libusb.cpp +++ b/sdk/lib/drivers/libusb/libusb.cpp @@ -18,6 +18,36 @@ // 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 "C" { diff --git a/sdk/lib/drivers/libusb/libusb.h b/sdk/lib/drivers/libusb/libusb.h index f24190183af..004c2f0a25d 100644 --- a/sdk/lib/drivers/libusb/libusb.h +++ b/sdk/lib/drivers/libusb/libusb.h @@ -22,8 +22,17 @@ extern "C" // the following includes are required to get kcom to compile // #include +#define _NEW_DELETE_OPERATORS_ #include +PVOID +__cdecl +operator new( + size_t iSize, + POOL_TYPE poolType, + ULONG tag); + + #include "common_interfaces.h" //