SHARE
TWEET

Untitled

a guest Jul 20th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // dllmain.cpp : Definiert den Einstiegspunkt für die DLL-Anwendung.
  2. #include "pch.h"
  3. #include <string>
  4.  
  5. #define HOOK_ADDRESS
  6.  
  7. std::string text = "Luca ist ein Skripptkiddy";
  8. DWORD dwRenderText = 0x0041A150;
  9. DWORD JumpBack;
  10.  
  11. void SimpleJMP(BYTE* pAddress, DWORD dwJumpTo, DWORD size) {
  12.     DWORD dwOldProtect, dwOldProtect2;
  13.     VirtualProtect(pAddress, size, PAGE_EXECUTE_READWRITE, &dwOldProtect);
  14.     auto dwRelAddr = (DWORD)(dwJumpTo - (DWORD)pAddress) - 5;
  15.     *pAddress = 0xE9;
  16.     *((DWORD*)(pAddress + 0x1)) = dwRelAddr;
  17.     VirtualProtect(pAddress, size, dwOldProtect, &dwOldProtect2);
  18. }
  19.  
  20. void RenderText(const char* text, int x, int y) {
  21.     _asm {
  22.         mov eax, 0xFF
  23.         push - 1
  24.         push - 1
  25.         push 0xFF
  26.         push 0xFF
  27.         push y
  28.         push x
  29.         push text
  30.         call dwRenderText
  31.         add esp, 1Ch
  32.         ret
  33.     }
  34. }
  35.  
  36. __declspec(naked) void Hook() {
  37.     _asm pushad;
  38.     RenderText(text.c_str(), 300, 400);
  39.     _asm
  40.     {
  41.         popad;
  42.         mov eax, 0FFh;
  43.         jmp [JumpBack];
  44.     }
  45. }
  46.  
  47. BOOL APIENTRY DllMain( HMODULE hModule,
  48.                        DWORD  ul_reason_for_call,
  49.                        LPVOID lpReserved
  50.                      )
  51. {
  52.     switch (ul_reason_for_call)
  53.     {
  54.     case DLL_PROCESS_ATTACH:
  55.         JumpBack = 0x0040BA4A + 5;
  56.         SimpleJMP((PBYTE)0x0040BA4A, (DWORD)Hook, 5);
  57.     case DLL_THREAD_ATTACH:
  58.     case DLL_THREAD_DETACH:
  59.     case DLL_PROCESS_DETACH:
  60.         break;
  61.     }
  62.     return TRUE;
  63. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top