Показать сообщение отдельно

  #4  
Старый 16.11.2018, 17:04
checkdasound
Постоянный
Регистрация: 12.01.2018
Сообщений: 963
С нами: 4387250

Репутация: 133


По умолчанию

Цитата:
Сообщение от checkdasound  

Почему при инжекте dll в уже запущенную игру, все работает, а при переименовании в asi, после запуска игры сразу краш.

Цитата:
Сообщение от Спойлер  


Код:





Код:
#include 
#include 
#include "main.h"

bool pStatus = false;

unsigned int CurrentCharPointer = *(unsigned int*)0xB6F5F0;

void __cdecl func(void *pArg)
{
   *reinterpret_cast(0x004B35A0) = 0x560CEC83;
   *reinterpret_cast(0x004B35A4) = 0xF18B;
   while (true)
   {
       Sleep(50);
       if (GetAsyncKeyState(0x47))
       {
           pStatus = !pStatus;
           if (pStatus == true)
           {
               AddMessageJumpQ("~g~[ON]", 500, NULL, false); // 500 - ms
           }
           else
           {
               AddMessageJumpQ("~r~[OFF]", 500, NULL, false); // 500 - ms
           }
       }
       if (pStatus == true)
       {
           *reinterpret_cast(0x96916D) = 1; // bullet
           *reinterpret_cast(0xB7CEE6) = 1; // fire
           *(unsigned char*)(CurrentCharPointer + 66) = 0xCC; // all
       } else
           {
               *reinterpret_cast(0x96916D) = 0; // bullet
               *reinterpret_cast(0xB7CEE6) = 0; // fire
               *(unsigned char*)(CurrentCharPointer + 66) = 0; // all
           }
   }
}

BOOL WINAPI DllMain(_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ PVOID lpvReserved)
{
   if (fdwReason == DLL_PROCESS_ATTACH)
   {
       _beginthread(func, NULL, nullptr);
   }
   return TRUE;
}


Цитата:
Сообщение от Спойлер  


Код:





Код:
#define FUNC_CMessages__AddMessageJumpQ 0x69F1E0

void AddMessageJumpQ(PCHAR text, UINT time, USHORT flag, bool bPreviousBrief) // Функция показа сообщения на экране.
{
   ((void(__cdecl *)(PCHAR, UINT, USHORT, bool))FUNC_CMessages__AddMessageJumpQ)(text, time, flag, bPreviousBrief);
}


Вроде поставил VirtualProtect, но все равно при переименовании в .asi при входе в игру крашит.

Цитата:
Сообщение от Спойлер  


Код:





Код:
#include 
#include 
#include "main.h"

bool pStatus = false;

unsigned int CurrentCharPointer = *(unsigned int*)0xB6F5F0;

void __cdecl func(void *pArg)
{

   DWORD oldProtect;

   VirtualProtect((void*)(0x004B35A0), 4, PAGE_EXECUTE_READWRITE, &oldProtect);
   *reinterpret_cast(0x004B35A0) = 0x560CEC83;
   VirtualProtect((void*)(0x004B35A0), 4, oldProtect, &oldProtect);

   VirtualProtect((void*)(0x004B35A4), 2, PAGE_EXECUTE_READWRITE, &oldProtect);
   *reinterpret_cast(0x004B35A4) = 0xF18B;
   VirtualProtect((void*)(0x004B35A4), 2, oldProtect, &oldProtect);

   while (true)
   {
       Sleep(50);
       if (GetAsyncKeyState(0x47))
       {
           pStatus = !pStatus;
           if (pStatus == true)
           {
               AddMessageJumpQ("~g~[ON]", 500, NULL, false); // 500 - ms
           }
           else
           {
               AddMessageJumpQ("~r~[OFF]", 500, NULL, false); // 500 - ms
           }
       }
       if (pStatus == true)
       {
           VirtualProtect((void*)(0x96916D), 1, PAGE_EXECUTE_READWRITE, &oldProtect);
           *reinterpret_cast(0x96916D) = 1; // bullet
           VirtualProtect((void*)(0x96916D), 1, oldProtect, &oldProtect);

           VirtualProtect((void*)(0xB7CEE6), 1, PAGE_EXECUTE_READWRITE, &oldProtect);
           *reinterpret_cast(0xB7CEE6) = 1; // fire
           VirtualProtect((void*)(0xB7CEE6), 1, oldProtect, &oldProtect);

           VirtualProtect((void*)(CurrentCharPointer + 66), 1, PAGE_EXECUTE_READWRITE, &oldProtect);
           *(unsigned char*)(CurrentCharPointer + 66) = 0xCC; // all
           VirtualProtect((void*)(CurrentCharPointer + 66), 1, oldProtect, &oldProtect);
       } else
           {
           VirtualProtect((void*)(0x96916D), 1, PAGE_EXECUTE_READWRITE, &oldProtect);
               *reinterpret_cast(0x96916D) = 0; // bullet
               VirtualProtect((void*)(0x96916D), 1, oldProtect, &oldProtect);

               VirtualProtect((void*)(0xB7CEE6), 1, PAGE_EXECUTE_READWRITE, &oldProtect);
               *reinterpret_cast(0xB7CEE6) = 0; // fire
               VirtualProtect((void*)(0xB7CEE6), 1, oldProtect, &oldProtect);

               VirtualProtect((void*)(CurrentCharPointer + 66), 1, PAGE_EXECUTE_READWRITE, &oldProtect);
               *(unsigned char*)(CurrentCharPointer + 66) = 0; // all
               VirtualProtect((void*)(CurrentCharPointer + 66), 1, oldProtect, &oldProtect);
           }
   }
}

BOOL WINAPI DllMain(_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ PVOID lpvReserved)
{
   if (fdwReason == DLL_PROCESS_ATTACH)
   {
       _beginthread(func, NULL, nullptr);
   }
   return TRUE;
}


 
Ответить с цитированием