NO

Author Topic: RtlZeroMemory() and friends  (Read 3817 times)

fuerst

  • Guest
RtlZeroMemory() and friends
« on: November 27, 2014, 08:56:47 PM »
PC8.00.19 RC#6
In winnt.h the Rtl-Routines are "realized" as macros (why?),
but the resulttypes are not the same as described at MSDN.
Results in warnings at warninglevel  2

Example: ZeroMemory

ZeroMemory --> RtlZeroMemory --> memset()

...warning #2216: The return value from 'memset' is never used.

Suggestions in bold
#define RtlEqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length))==0 ? TRUE : FALSE)
#define RtlMoveMemory(Destination,Source,Length) (void)memmove((Destination),(Source),(Length))
#define RtlCopyMemory(Destination,Source,Length) (void)memcpy((Destination),(Source),(Length))
#define RtlFillMemory(Destination,Length,Fill) (void)memset((Destination),(Fill),(Length))
#define RtlZeroMemory(Destination,Length) (void)memset((Destination),0,(Length))