I'd like to point out as an FYI, that you should not use ZeroMemory() in cases where you are trying to deallocate a buffer which is never read before it goes out of scope.
Take a look at this sample code:
cpp
WCHAR szPassword[MAX_PATH];
// Retrieve the password
if (GetPasswordFromUser(szPassword, MAX_PATH))
UsePassword(szPassword);
// Clear the password from memory
ZeroMemory(szPassword, sizeof(szPassword));
In this case the compiler could optimize the call because the szPassword buffer is not read from before it goes out of scope. The password would remain on the application stack where it could be captured in a crash dump or probed by a malicious application.
In such situations, the SecureZeroMemory() function is recommended. Use it the same way as ZeroMemory(), it accepts the same parameters.