We had quite a lively discussion a while ago about methods of making meterpreter payloads capable of bypassing AV. I've been researching further and saw a nice write up of a technique that uses a DLL to write shellcode directly into an executable in memory. When the executable's shellcode has been updated, it runs the shellcode. This is the link to the article and accompanying code. Has anyone else seen this?

I've managed to compile dummyApp.exe file and it's payloadLib.dll but the DLL fails miserably when trying to execute VirtualProtectEx. The line of code that throws up an error is: