DLL Injection

What is the best way to inject a DLL in C++? I have tested many source codes of injectors but none of them worked and now i want to make my own. It will be just a simple command line injector.

So, what method should i use?
Please list some methods if you know many and maybe a little example of how to use them or a link to some documentation. Thanks in advance.
The two most common methods are "SetWindowsHook()" and remote thread execution via "LoadLibrary()", "GetProcAddress()", "VirtualAllocEx()", "WriteProcessMemory()" and "CreateRemoteThread()" combo. There are very few variations to these methods so I'm wondering why or why you think your code isn't working. Have tried enumerating the DLL's loaded in the target process with "tasklist -m" or Process Explorer from Sysinternals?

- SetWindowsHookEx(): http://msdn.microsoft.com/en-us/library/windows/desktop/ms644990(v=vs.85).aspx


- LoadLibrary(): http://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx

- GetProcAddress(): http://msdn.microsoft.com/en-us/library/windows/desktop/ms683212(v=vs.85).aspx

- VirtualAllocEx(): http://msdn.microsoft.com/en-us/library/windows/desktop/aa366890(v=vs.85).aspx

- WriteProcessMemory(): http://msdn.microsoft.com/en-us/library/windows/desktop/ms681674(v=vs.85).aspx

- CreateRemoteThread(): http://msdn.microsoft.com/en-us/library/windows/desktop/ms682437(v=vs.85).aspx
Thank you for the useful links! They are exactly what i was looking for!
Thanks! :D
Topic archived. No new replies allowed.