This position-independent code (shellcode) can go one step further and load a malicious DLL into the targeted process's memory from memory rather than from the disk. In this case, the payload PE file gets injected together with a custom PE loader (implemented either as shellcode or as part of this file) into the targeted process, and this loader will be responsible for loading this payload manually.
First, malware allocates memory with the size of the ImageBase and follows the PE loading steps including import table loading and fixing the relocation entries (in the relocation table, check Chapter 2, Basic Static and Dynamic Analysis for x86/x64), as shown in the following screenshot:
This technique looks similar in terms of results to DLL injection, but it doesn't require the malicious DLL to be stored on the hard disk and it doesn't leave usual traces of this DLL inside the Process...