Questions tagged [dll-injection]

DLL injection is a technique used to run code within the address space of another process by forcing it to load a dynamic-link library(DLL).

DLL injection is often used by external programs to influence the behaviour of another program in a way its authors did not anticipate or intend. For example, the injected code could hook system function calls, or read the contents of password text-boxes, which cannot be done the usual way. A program used to inject arbitrary code into arbitrary processes is called a DLL injector.

468 questions
6
votes
2 answers

elegant method to inject a dll to processes BEFORE they start

I am making a 'mod' dll that modifies behaviour of the target process. I succeeded to inject my dll and hook some functions of target. But it requires more work to do when I need to hook some APIs BEFORE main module starts(more clearly, before the…
Laie
  • 540
  • 5
  • 14
5
votes
2 answers

Call a function from C# .exe with unmanaged C++ .dll

So, I have an executable file that was made with C#, I don't have its source code but I have disassembled it with IDA, and it gave me a lot of object oriented assembly. I've made an .exe file that injects a .dll into another .exe, and I've injected…
Toribio
  • 3,963
  • 3
  • 34
  • 48
5
votes
1 answer

How do I strongly name an Unmanaged C++ Dll?

I'm working on a C# application which uses the EasyHook library for DLL Injection. EasyHook requires that any application using it be strongly named. In order to strongly name the application I need to make sure that all the libraries I use are…
Luke Belbina
  • 5,708
  • 12
  • 52
  • 75
5
votes
1 answer

Hook windows explorer copyFile2 function with MinHook not works

I try to hook CopyFile2 function, for that I wrote this dll: #include "..\..\..\minhook-1.3.3\include\MinHook.h" WCHAR msgbuf[1024]; #define DbgPrint(format, ...) wsprintf(msgbuf, format, __VA_ARGS__); \ …
codeDom
  • 1,623
  • 18
  • 54
5
votes
2 answers

Unloading an Injected DLL

I have a DLL I inject into other processes using SetWindowsHookEx. Inside the DLL I increment the module's reference counter by calling GetModuleHandleEx so I can control when the module is unloaded. At this point the module reference count "should…
tdemay
  • 649
  • 8
  • 23
5
votes
1 answer

DLLMain() is not being executed after injection

I have written a dll and injector in C++. The dll code is given below: #include #include #include #include #include #include using namespace std; #pragma comment(lib,…
Faheem
  • 509
  • 2
  • 7
  • 23
5
votes
2 answers

cout and printf Works On Dll Built In Debug Not Release

I've built a DLL that gets injected into a console application usually via SetWindowHookEx. Its important for the DLL to output information to the console which I have been doing with std::cout. The DLL was nearing completion until I tried building…
Slight
  • 1,541
  • 3
  • 19
  • 38
5
votes
1 answer

Getting PEB from remote process in Win 7

Specs: Windows 7 x64, Visual C++ Objective: I'm trying to get the remote PEB from a sample program (calc.exe e.g.). I've found the proc ID and I've opened a handle to the process with all the good rights. I've now moved on to writing a class to…
user850275
  • 311
  • 3
  • 7
  • 17
5
votes
2 answers

How to intercept API method calls in a 64bit process?

Background I'm working on a legacy product that can successfully, via an injection dll, intercept an arbitrary method call that an injectee process is trying to make into an arbitrary dll. In particular, the gdi32.dll library. Unfortunately, it…
Ultratrunks
  • 2,464
  • 5
  • 28
  • 48
5
votes
2 answers

Calling function in injected DLL

I want to call a function in a remote process of an injected DLL that I've made. I have successfully injected my DLL with: CreateRemoteThread(pHandle, NULL, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle("kernel32"), "LoadLibraryA"),…
André
  • 85
  • 1
  • 5
4
votes
3 answers

Simple DLL injection not working using AppInit_DLLs. DllMain() not getting called

I've written the simplest injection dll possible. Here is the code in its entirety: #include "stdafx.h" #include BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID…
Ultratrunks
  • 2,464
  • 5
  • 28
  • 48
4
votes
1 answer

Questions about SetWindowsHookEx() and hooking

Here is a little background information. I'm working on replacing a dll that has been used in a dll injection technique via the AppInit_DLLs registry entry. Its purpose was to be present in every process and set hooks into the GDI32.dll to gather…
Ultratrunks
  • 2,464
  • 5
  • 28
  • 48
4
votes
2 answers

What's the best way to secure dll files

We have a large application build in C++ builder, that at startup looks at a folder and loads all the present dll files. I figured this might not be such a good thing and tried my thoughts by creating a dll that only fired up a web browser and…
inquam
  • 12,664
  • 15
  • 61
  • 101
4
votes
3 answers

How do I get a JavaVM or JNIEnv from an already-running JVM using JNI?

I am working on a project which involves Rust and Java. I need to be able to use the JNI from the Rust side, without the Java side calling invoking it (because it is not my code). So far, I have been able to ensure my DLL is injected (open a small…
4
votes
1 answer

DLL injection using C crash notepad

I created a DLL injector program using C and a DLL. When I am trying to run the program the target process crash (I tried a notepad and cmd). I am compiling the injector as 64 bit and the DLL as well. the program and the DLL compiled with Visual…
fusu
  • 324
  • 2
  • 14
1
2
3
31 32