authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-01-13 03:19:39+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-01-14 05:31:14+01:00
log8019694e17b6e6b6d3f9cab91233deea7c39a301
treeeed1466c4299241a1392ef5f26b910ead8f74a5d
parentfb43e91b226a9cde51967455c57989c0371d4b0a

mingw: Add upstream RtlSecureZeroMemory implementation.

Closes #22475.

2 files changed, 18 insertions(+), 0 deletions(-)

lib/libc/mingw/crt/intrincs/RtlSecureZeroMemory.c created+17
......@@ -0,0 +1,17 @@
1#define __CRT__NO_INLINE 1
2#include <windows.h>
3
4PVOID WINAPI RtlSecureZeroMemory(PVOID ptr,SIZE_T cnt)
5{
6 volatile char *vptr = (volatile char *)ptr;
7#ifdef __x86_64
8 __stosb ((PBYTE)((DWORD64)vptr),0,cnt);
9#else
10 while (cnt != 0)
11 {
12 *vptr++ = 0;
13 cnt--;
14 }
15#endif /* __x86_64 */
16 return ptr;
17}
src/mingw.zig+1
......@@ -487,6 +487,7 @@ const mingw32_generic_src = [_][]const u8{
487487 "crt" ++ path.sep_str ++ "cxa_atexit.c",
488488 "crt" ++ path.sep_str ++ "cxa_thread_atexit.c",
489489 "crt" ++ path.sep_str ++ "tls_atexit.c",
490 "crt" ++ path.sep_str ++ "intrincs" ++ path.sep_str ++ "RtlSecureZeroMemory.c",
490491 // mingwex
491492 "cfguard" ++ path.sep_str ++ "mingw_cfguard_support.c",
492493 "complex" ++ path.sep_str ++ "_cabs.c",