Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // dllmain.cpp : Defines the entry point for the DLL application.
- #include "stdafx.h"
- #define X_POSITION 0x8FDEE8
- #define Y_POSITION 0x8FDEEC
- DWORD dwID;
- HFONT debugFont;
- void DrawInfoInScreen(HDC hdc, int X, int Y)
- {
- char buffer[1024] = "";
- wsprintf(buffer, "X: %d Y: %d", X, Y);
- SelectObject(hdc, debugFont);
- TextOut(hdc, 20, 20, buffer, strlen(buffer));
- }
- // espera que pressione a tecla para acessar as offsets das posiçáes.
- void WaitForStart()
- {
- //while (true)
- //{
- // if (GetAsyncKeyState(VK_F10))
- // {
- DWORD old;
- VirtualProtect((LPVOID)X_POSITION, 4, PAGE_READWRITE, &old);
- VirtualProtect((LPVOID)Y_POSITION, 4, PAGE_READWRITE, &old);
- debugFont = CreateFont(16, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH | FF_DONTCARE, "Tahoma");
- // break; // sai do loop fii
- // }
- // Sleep(100);
- //}
- }
- static HWND windowHandle;
- __declspec(dllexport) DWORD Foo() { return TRUE; }
- DWORD InitProcess()
- {
- WaitForStart();
- while (true)
- {
- windowHandle = FindWindow("DMO", "DMO");
- if (windowHandle != 0)
- {
- if ((*(int*)X_POSITION) != 0 && (*(int*)Y_POSITION) != 0)
- {
- HDC winDC = GetDC(windowHandle);
- DrawInfoInScreen(winDC, *(int*)X_POSITION, *(int*)Y_POSITION);
- ReleaseDC(windowHandle, winDC);
- }
- }
- Sleep(10);
- }
- return TRUE;
- }
- BOOL APIENTRY DllMain( HMODULE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
- {
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)InitProcess, NULL, 0, &dwID);
- break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement