Иди лесом! @ Лесничество

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » Иди лесом! @ Лесничество » Справочная » Скрипты


Скрипты

Сообщений 1 страница 2 из 2

1

По замыслу это прога для обхода защиты PunkBuster.

Свернутый текст

//MAIN.CPP

#include <windows.h>
#include <detours.h>
#include "main.h"

unsigned long PB = 0;

int __stdcall DllMain(void* Module, unsigned long Reason, void* Reserved)
{

  if(Reason == 1 && (PB = (unsigned long)LoadLibrary(".\\pb\\pbcl.dll")))
  {

    InitializeDetour(1);
    InitializeMemory(1);
    return 1;

  }

  return -1;

}

char* __cdecl SSCK_CKRoutine(int arg_0, int arg_4, const void* arg_8, int arg_12)
{

  if(arg_0 != 41)
  {

    InitializeMemory(0);
    InitializeDetour(0);

    char* pReturn = SSCK_CKRoutine_(arg_0, arg_4, arg_8, arg_12);

    InitializeDetour(1);
    InitializeMemory(1);

    return pReturn;

  }

  return SSCK_CKRoutine_(arg_0, arg_4, arg_8, arg_12);

}

int __cdecl SSRoutine(int arg_0, int arg_4, int arg_8, int arg_12, int arg_16)
{

  InitializeMemory(0);

  static int Counter = 0;
  if(Counter < 2)
  {
 
    Counter += 1;
    return 2;

  }
  else
  Counter = 0;

  int r = SSRoutine_(arg_0, arg_4, arg_8, arg_12, arg_16);

  InitializeMemory(1);

  return r;

}

int __cdecl CKRoutine(int arg_0, int arg_4, _MEMORY_BASIC_INFORMATION arg_8)
{

  InitializeMemory(0);
  InitializeDetour(0);

  int r = CKRoutine_(arg_0, arg_4, arg_8);

  InitializeMemory(1);
  InitializeDetour(1);

  return r;

}

void __stdcall InitializeDetour(int arg_0)
{

  if(arg_0 == 0) // disable...
  {
    DetourRemove((unsigned char*)SSCK_CKRoutine_, (unsigned char*)SSCK_CKRoutine);
    DetourRemove((unsigned char*)SSRoutine_, (unsigned char*)SSRoutine);
    DetourRemove((unsigned char*)CKRoutine_, (unsigned char*)CKRoutine);
  }
  else if(arg_0 == 1)
  {
    SSCK_CKRoutine_ = (_SSCK_CKRoutine)DetourFunction((unsigned char*)(PB + 0x43950), (unsigned char*)SSCK_CKRoutine);   
    SSRoutine_      = (_SSRoutine)DetourFunction((unsigned char*)(PB + 0x11670), (unsigned char*)SSRoutine);
    CKRoutine_      = (_CKRoutine)DetourFunction((unsigned char*)(PB + 0x410C0), (unsigned char*)CKRoutine);
  }

}

void __stdcall InitializeMemory(int arg_0)
{

  if(arg_0 == 0) // disable...
  {
    unsigned long Protection;

    VirtualProtect((void*)0x440E2F, 2, PAGE_READWRITE, &Protection);
    memcpy((void*)0x440E2F, (const void*)NameTags, 2);
    VirtualProtect((void*)0x440E2F, 2, Protection, 0);

    VirtualProtect((void*)0x4414C2, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x4414C2, (const void*)HealthTags_A, 6);
    VirtualProtect((void*)0x4414C2, 6, Protection, 0);

    VirtualProtect((void*)0x4414D4, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x4414D4, (const void*)HealthTags_B, 6);
    VirtualProtect((void*)0x4414D4, 6, Protection, 0);

    VirtualProtect((void*)0x4415C1, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x4415C1, (const void*)HealthTags_C, 6);
    VirtualProtect((void*)0x4415C1, 6, Protection, 0);

    VirtualProtect((void*)0x4414D4, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x4414D4, (const void*)HealthTags_D, 6);
    VirtualProtect((void*)0x4414D4, 6, Protection, 0);

    VirtualProtect((void*)0x46B0EF, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x46B0EF, (const void*)Minimap_A, 6);
    VirtualProtect((void*)0x46B0EF, 6, Protection, 0);

    VirtualProtect((void*)0x46B7BF, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x46B7BF, (const void*)Minimap_B, 6);
    VirtualProtect((void*)0x46B7BF, 6, Protection, 0);

    VirtualProtect((void*)0x5523CD, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x5523CD, (const void*)Accurracy, 6);
    VirtualProtect((void*)0x5523CD, 6, Protection, 0);

    VirtualProtect((void*)0x614000, 2, PAGE_READWRITE, &Protection);
    memcpy((void*)0x614000, (const void*)Breathing, 2);
    VirtualProtect((void*)0x614000, 2, Protection, 0);
  }
  else if(arg_0 == 1)
  {
    unsigned long Protection;

    VirtualProtect((void*)0x440E2F, 2, PAGE_READWRITE, &Protection);
    memcpy((void*)0x440E2F, (const void*)Two, 2);
    VirtualProtect((void*)0x440E2F, 2, Protection, 0);

    VirtualProtect((void*)0x4414C2, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x4414C2, (const void*)Six, 6);
    VirtualProtect((void*)0x4414C2, 6, Protection, 0);

    VirtualProtect((void*)0x4414D4, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x4414D4, (const void*)Six, 6);
    VirtualProtect((void*)0x4414D4, 6, Protection, 0);

    VirtualProtect((void*)0x4415C1, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x4415C1, (const void*)Six, 6);
    VirtualProtect((void*)0x4415C1, 6, Protection, 0);

    VirtualProtect((void*)0x4414D4, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x4414D4, (const void*)Six, 6);
    VirtualProtect((void*)0x4414D4, 6, Protection, 0);

    VirtualProtect((void*)0x46B0EF, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x46B0EF, (const void*)Six, 6);
    VirtualProtect((void*)0x46B0EF, 6, Protection, 0);

    VirtualProtect((void*)0x46B7BF, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x46B7BF, (const void*)Six, 6);
    VirtualProtect((void*)0x46B7BF, 6, Protection, 0);

    VirtualProtect((void*)0x5523CD, 6, PAGE_READWRITE, &Protection);
    memcpy((void*)0x5523CD, (const void*)Six, 6);
    VirtualProtect((void*)0x5523CD, 6, Protection, 0);

    VirtualProtect((void*)0x614000, 2, PAGE_READWRITE, &Protection);
    memcpy((void*)0x614000, (const void*)Two, 2);
    VirtualProtect((void*)0x614000, 2, Protection, 0);
  }

}|Code

Отредактировано Лайм (26.03.2011 11:58:03)

2

Лимон - это жесть =)


Вы здесь » Иди лесом! @ Лесничество » Справочная » Скрипты