I've been trying to make a way to switch the Dll directory of a program I don't own, from an "injector" program which is suppose to switch the Dll loading directory to load the modified or tapped Dlls.
Here's the function:
void AddDirectory(HANDLE Handle, const char* DllPath)
{
void *Function, *String;
Function = (void*)(SetDllDirectoryA);
String = (void*)VirtualAllocEx(Handle, NULL, strlen(DllPath), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
CreateRemoteThread(Handle, NULL, NULL, (LPTHREAD_START_ROUTINE)Function, (void*)String, NULL, NULL);
}
I can't seen to figure out why this won't work?