https://www.ired.team/offensive-security/code-injection-process-injection/writing-and-compiling-shellcode-in-c
Run the assembly generation command from the Developer PowerShell, not the normal one. This can easily be done from the Visual Studio's Terminal.
https://www.youtube.com/watch?v=HgEGAaYdABA&ab_channel=JohnHammond
- Video description: https://www.youtube.com/watch?v=b0zxIfJJLAY&ab_channel=Dave%27sGarage
- Code stored here: https://pastebin.com/Pmvr4r1S
- MASM32 is required: https://masm32.com/
MASM32 is a project that adds "header files" to the assembly (I think).
Compile in a Developer command prompt with:
ml /coff HelloAssembly.asm
For some reason, this does not compile correctly with the VS's ml.exe, but it compiles ok with the MASM32's ml.exe.