[PATCH] winnt.h: Implement RtlSecureZeroMemory
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Mon Feb 13 02:17:57 CST 2017
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
include/winbase.h | 1 +
include/winnt.h | 13 +++++++++++++
2 files changed, 14 insertions(+)
diff --git a/include/winbase.h b/include/winbase.h
index b07d4df..4ec6f9a 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -2778,6 +2778,7 @@ WINBASEAPI UINT WINAPI _lwrite(HFILE,LPCSTR,UINT);
#define MoveMemory RtlMoveMemory
#define ZeroMemory RtlZeroMemory
#define CopyMemory RtlCopyMemory
+#define SecureZeroMemory RtlSecureZeroMemory
/* Wine internal functions */
diff --git a/include/winnt.h b/include/winnt.h
index 72c399b..2b22138 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -5436,6 +5436,19 @@ typedef enum _CM_ERROR_CONTROL_TYPE
#define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
#define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
+static FORCEINLINE void *RtlSecureZeroMemory(void *buffer, SIZE_T length)
+{
+ volatile char *ptr = (volatile char *)buffer;
+
+ while (length)
+ {
+ *ptr++ = 0;
+ length--;
+ }
+
+ return buffer;
+}
+
#include <guiddef.h>
typedef struct _OBJECT_TYPE_LIST {
--
1.9.1
More information about the wine-patches
mailing list