public Inject(InjectData Data) { //Set inject data InjectedData = Data; //Load library so we can get the offset InjectedDllAddress = LoadLibrary(Data.DllPath); IntPtr A = GetProcAddress(InjectedDllAddress, "TestFunctionCall"); }
public IntPtr InjectDll(InjectData I) { // searching for the address of LoadLibraryA and storing it in a pointer IntPtr loadLibraryAddr = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA"); //Load IntPtr ThreadHandle = CallFunction(loadLibraryAddr, Encoding.Default.GetBytes(I.DllPath)); WaitForSingleObject(ThreadHandle, INFINITE); CloseHandle(ThreadHandle); if (ThreadHandle != (IntPtr)0) { IsDllInjected = true; return(ThreadHandle); } else { return(IntPtr.Zero); } }