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.
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.
Since according to MSDN, SecureZeroMemory() is actually defined as the RtlSecureZeroMemory(), you can declare SecureZeroMemory() as follows:
procedure SecureZeroMemory(_ptr: Pointer; cnt: Longint); external 'kernel32.dll' name 'RtlSecureZeroMemory';
SecureZeroMemory() is merely an alias of RtlSecureZeroMemory().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With