ImplZeroMemory2

This implemention of ZeroMemory will not be optimized by the compiler. It was ensure no imports are present in your binary

#include <Windows.h>

VOID ImplZeroMemory2(_Inout_ PVOID Destination, _In_ SIZE_T Size)
{
	PCHAR Pointer = (PCHAR)Destination;
	PCHAR End = Pointer + Size;

	for (;;)
	{
		if (Pointer >= End) break; *Pointer++ = 0;
		if (Pointer >= End) break; *Pointer++ = 0;
		if (Pointer >= End) break; *Pointer++ = 0;
		if (Pointer >= End) break; *Pointer++ = 0;
	}
}

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

	ImplZeroMemory2(String1, sizeof(String1));

  return ERROR_SUCCESS;
}

Last updated