Software-OK
≡... News | ... Home | ... FAQ | Impressum | Contact | Listed at | Thank you |

  
HOME ► Faq ► FAQ - Windows-CPP-und-C ► ««« »»»

SecureZeroMemory and ZeroMemory: Which is better?


The SecureZeroMemory and ZeroMemory functions in Windows have similar tasks, but they differ in important aspects:




1. The purpose of SecureZeroMemory and ZeroMemory:
2. Optimization:
3. When to use which function?
4. SecureZeroMemory conclusion:




1.) The purpose of SecureZeroMemory and ZeroMemory:



- ZeroMemory:
This function fills a memory block with zeros (setting all bytes to 0 ). It is a wrapper function around RtlZeroMemory and is primarily used to set a memory area to a defined state.

- SecureZeroMemory:
This function performs the same task, also setting all bytes of a memory block to 0 , but it is specifically designed to ensure that the operation is not removed by compiler optimizations. This is particularly important for security-critical information (e.g., passwords or cryptographic keys) that should be deleted from memory after use.

2.) The optimization:



- ZeroMemory:
Because it is used for general-purpose tasks, the compiler might optimize the function under certain circumstances and possibly omit it if it decides that overwriting the memory is unnecessary (e.g., if the data will no longer be used after being set to 0 ).

- SecureZeroMemory:
This function ensures that memory erasure is not affected by optimizations. The memory is actually set to 0 , which is crucial for protecting sensitive data.

3.) When to use which function?



ZeroMemory is sufficient
if the only task is to erase or initialize memory in a non-safety-critical application. SecureZeroMemory

should always be used when sensitive data needs to be removed from memory, such as in security-relevant contexts, to ensure that the memory is reliably erased after use.


4.) SecureZeroMemory Conclusion:




SecureZeroMemory is
the better choice for security-critical applications because it ensures that memory erasure is guaranteed and not removed through optimizations.


FAQ 49: Updated on: 15 April 2026 15:36 Windows
Windows-CPP-und-C

Doesn't the WC_COMBOBOXEX class contain other classes as well?


Yes, thats correct The class WC_COMBOBOXEX also ComboBoxEx in the WinAPI extends the standard ComboBox and integrates various controls such as WC_COMBOBOX
Windows-CPP-und-C

Why is compiling GLSL in the browser slower than C++ apps?


Compiling GLSL OpenGL Shading Language in a WebGL context is generally slower than in a C++ application, even though the compiler on the GPU is actually
Windows-CPP-und-C

How can I query whether my x86 application is currently running on x64?


IsWow64Process abfrage unter x64 MS OS nach ob die exe im WOW64 Modus arbeitet   1. Query whether the x86 application runs under x64 2. Advantages
Windows-CPP-und-C

How can I query whether a path is a folder or directory?


Querying whether a path is a folder or directory is quite simple in C ++  BOOL IsThePathFolderLPCTSTR pfad { ifpfadreturn FALSE; DWORD dwAttr = GetFileAttributespfad;
Windows-CPP-und-C

Trim string in cpp?


With your own trim string in cpp, simply shorten the strings individually ////////////////////////////////////////////////// ////////////////////// // //
Windows-CPP-und-C

Was with error code -1073741701 (0xc000007b)!


The solution is very simple to fix the error code: "was ended with code -1073741701 0xc000007b error message" Mostly there are errors in the * .manifest

»»

  My question is not there in the FAQ
Asked questions on this answer:
Keywords: windows, securezeromemory, zeromemory, which, better, functions, have, similar, tasks, they, differ, important, aspects, purpose, Questions, Answers, Software




  

  + Freeware
  + Order on the PC
  + File management
  + Automation
  + Office Tools
  + PC testing tools
  + Decoration and fun
  + Desktop-Clocks
  + Security

  + SoftwareOK Pages
  + Micro Staff
  + Freeware-1
  + Freeware-2
  + Freeware-3
  + FAQ
  + Downloads

  + Top
  + Desktop-OK
  + The Quad Explorer
  + Don't Sleep
  + Win-Scan-2-PDF
  + Quick-Text-Past
  + RAMagic
  + DesktopDigitalClock
  + Find Same Images
  + Print Folder Tree


  + Freeware
  + MagicMouseTrails
  + CpuFrequenz
  + MultiClipBoardSlots
  + OnlyStopWatch
  + KeepMouseSpeedOK
  + NonCompressibleFiles
  + 4ur-Windows-8-Mouse-Balls
  + 12-Ants
  + Q-Dir
  + PAD-s


Home | Thanks | Contact | Link me | FAQ | Settings | Windows 10 | English-AV | Impressum | Translate | PayPal | PAD-s

 © 2026 by Nenad Hrg softwareok.de • softwareok.com • softwareok.com • softwareok.eu
33.341 msec.


>> ☕ Buy SoftwareOK a Coffee ☕ <<



► What is a clean installation of Windows 12? ◄
► What is the meaning of the "red" files in Explorer Views on Windows? ◄
► How to open the Control Panel (x64/x32)? ◄
► How can i start with a favorite setting for explorer views from Desktop? ◄


This website does not store personal data. However, third-party providers are used to display ads,
which are managed by Google and comply with the IAB Transparency and Consent Framework (IAB-TCF).
The CMP ID is 300 and can be individually customized at the bottom of the page.
more Infos & Privacy Policy

....