ImplZeroMemory1

A raw implemention of ZeroMemory. Depending on your compiler settings, the compiler will automatically optimize this function to memset. This will result in your binary containing an import Update: Code fixed on 2025.02.14. ImplZeroMemory1 would fail on buffers which were not 32bit aligned.

#include <Windows.h>

VOID ImplZeroMemory1(_Inout_ PVOID Destination, _In_ SIZE_T Size)
{
    PBYTE Dest = (PBYTE)Destination;
    while (Size--)
    {
        *Dest++ = 0;
    }
}

INT main(VOID)
{
	WCHAR String1[] = L"I like cats a lot";

	ImplZeroMemory1(String1, sizeof(String1));
    
  return ERROR_SUCCESS;
}

Last updated