C ++ Dll Injection

I would really appreciate your help in this.

I am trying to load a Dll into a remote process and make a few changes inside it, a problem that I am facing right now, I do not know how to do it.

So, firstly, here is my piece of code that I have developed so far:
dllmain.cpp

#include <windows.h>
#include <stdio.h>

BOOL APIENTRY DllMain (HINSTANCE hInst     /* Library instance handle. */ ,
                       DWORD reason        /* Reason this function is being called. */ ,
                       LPVOID reserved     /* Not used. */ )
{
switch (reason)
    {
      case DLL_PROCESS_ATTACH:
           MessageBox (0, "From DLL\n", "Process Attach", MB_ICONINFORMATION);
        break;

      case DLL_PROCESS_DETACH:
           MessageBox (0, "From DLL\n", "Process Detach", MB_ICONINFORMATION);
        break;

      case DLL_THREAD_ATTACH:
           MessageBox (0, "From DLL\n", "Thread Attach", MB_ICONINFORMATION);
        break;

      case DLL_THREAD_DETACH:
           MessageBox (0, "From DLL\n", "Thread Detach", MB_ICONINFORMATION);
        break;
    }  

    return TRUE;
}

It simply displays a message box depending on the conditions that it encounters. Now, what I would like my Dll to do, after entering the remote process, I would like it to write a memory cell and change its value.

Data Type: Unsigned Short Int
Storage Location: 0041D090

I hope everything is clear, Thank you for your patience, help is appreciated.

+3
1

DLL, . WriteProcessMemory().

... DLL :

, - . , , , .

+6

Source: https://habr.com/ru/post/1723572/


All Articles