B
B
Best-404-Error2019-01-11 03:36:17
C++ / C#
Best-404-Error, 2019-01-11 03:36:17

Substituting ASM instructions in another C++ application?

Hello! Having in my hands the address of residence ( 0x006EDDC8 ) of the instruction and its "bytes" ( D8 AE 84000000 must be replaced with D8 86 84000000 ) I want to change it a little using C ++ code.
How to do it and is it possible?
It is necessary here from this:
5c37e41563dcf626783054.png
Change to this:
5c37e426494c1972538547.png
With the help of DLL (asi) in C ++.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Best-404-Error, 2019-01-11
@Best-404-Error

#include <Windows.h>

inline void ChangeByte(DWORD _Adress, byte _NewByte) {
  DWORD old_protect;
  VirtualProtect((void*)_Adress, 1, PAGE_EXECUTE_READWRITE, &old_protect);
  *(byte*)_Adress = _NewByte;
}

DWORD WINAPI MainTheard(LPVOID lpReserved)
{
  ChangeByte(0x006EDDC9, 0x86);
  return 0;
}

BOOL APIENTRY DllMain(HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
  switch (ul_reason_for_call) {
  case DLL_PROCESS_ATTACH:
    CreateThread(0, 0, MainTheard, 0, 0, 0);
    break;
  }
  return 1;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question