Using SecureZeroMemory in Delphi

c, c++, delphi, memory, security

Solution

As far as I understand, the only difference between `ZeroMemory` and `SecureZeroMemory` is `SecureZeroMemory` is implemented as an inline function, ensuring it won't be optimised out by the compiler.

I don't think Delphi performs the same level of compiler optimisation, so `ZeroMemory` calls shouldn't be optimised out.

Problem

I understand there is a `SecureZeroMemory` function in C. The function implementation is defined in `<WinnNT.h>` as `RtlSecureZeroMemory` function. QNS: How can `SecureZeroMemory` be used in Delphi? Did Delphi release a library that contains that function? I'm using Delphi 7. `Windows.pas` only has `ZeroMemory` but not `SecureZeroMemory`.

Original source