First let's start with the definitions:
WinBase.h ==> #define FillMemory RtlFillMemory
WinNT.h ==> #define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
Note that RtlFillMemory and memset have their two numeric parameters in reverse order.
So in my source file I started typing: "FillMemory("
The VA tooltip appears showing the definition of RtlFillMemory but note that the highlighted parameter is that of memset NOT of RtlFillMemory.
Of course that's a bit hard to spot when all you care about is to write some code, so I didn't notice at that time.
As soon as I typed my pointer variable and entered the comma then the "Fill" parameter of memset got highlighted, so I naturally entered the fill value... Then another comma and the "Length" parameter got highlighted... so I entered the length. Everything compiled normally and I started to debug the code.
As you can realize the catastrophic results widely depend on the values entered and where the target memory is... In my case the buffer was on the stack, so I got some nasty debug warnings when I returned from the function which made me start looking as to what could be going wrong in such a simple function.
Warm Regards,
Dimitris Staikos