![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: May 2006
Location: Cambridge, UK
Posts: 56
Rep Power: 3
![]() |
MinGW and SecureZeroMemory
How do I go about calling SecureZeroMemory from a program compiled with MinGW?
It seems the function isn't in the distributed header files, so I declared it myself. Then it fails on linking.
__________________
Don't comment bad code - rewrite it. - The Elements of Programming Style (Kernighan & Plaugher) |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
It's declared in Winbase.h which is a define for RtlSecureZeroMemory in WinNT.h, which is declared like:
#if !defined(MIDL_PASS)
FORCEINLINE
PVOID
RtlSecureZeroMemory(
IN PVOID ptr,
IN SIZE_T cnt
)
{
volatile char *vptr = (volatile char *)ptr;
#if defined(_M_AMD64)
__stosb((PBYTE )((DWORD64)vptr), 0, cnt);
#else
while (cnt) {
*vptr = 0;
vptr++;
cnt--;
}
#endif
return ptr;
}
#endif__stosb is a function to store strings as bytes. VOID
__stosb (
IN PBYTE Destination,
IN BYTE Value,
IN SIZE_T Count
);
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|