There are several techniques, which are commonly used: DLL injection, process replacement (a.k.a process hollowing), hook injection and APC injection.
Most of them use same Windows API functions: OpenProcess, VirtualAllocEx, WriteProcessMemory, for detailed information about those functions, use MSDN.
Open target process.
Write code into the remote process.
Execute the remote code.
Create target process and suspend it.
Unmap from memory.
Write headers and sections into the remote process.
Resume remote thread.
Write code into remote threads.
“Execute” threads using QueueUserAPC.
DownloadWindows x64 binary – x64 bit DEMODependencies:vc_redist.x64 – Microsoft Visual C++ RedistributableDEMO