DLL injectors simply load modules into the target program using the
LoadLibrary function. You cannot just use LoadLibrary any way you want, you would have to get the procedure address of LoadLibrary using
GetProcAddress and then create a remote thread starting at the location of the LoadLibrary procedure.
Now, the LoadLibrary function does take a parameter, in this case, the path to the DLL you're injecting. You can't just create string and use that as the parameter because the LoadLibrary function isn't being called in your program, it's being called in the target process in which has no access to any of your programs variables. You have to write the path somewhere in the processes memory using
WriteProcessMemory. You can use
VirtualAllocEx to allocate memory in which you can write your path to.
I didn't put the steps in order and I didn't include every single function but if you actualy want to
learn something I suggest you read up on this. I could have just gave you some code but then again, I wouldn't want you leeching, I'd rather you have to learn it.
This was off the top of my head so if anyone sees any mistakes or if i'm missing something...just say it.