Начинающий
- Статус
- Оффлайн
- Регистрация
- 29 Дек 2024
- Сообщения
- 24
- Реакции
- 0
#include <iostream>
#include <Windows.h>
// Assuming you have functions to:
// 1. Get the base address of the CS2 game module.
// 2. Read memory from the CS2 process.
// 3. Write memory to the CS2 process.
// Placeholder for the address of the RNG function in CS2
DWORD dwRandomSeedFunction = 0x12345678; // THIS IS COMPLETELY MADE UP
// Original RNG function (type definition)
typedef int(__fastcall* RandomSeedFn)(int seed);
RandomSeedFn OriginalRandomSeed = nullptr;
// Hooked RNG function
int __fastcall HookedRandomSeed(int seed) {
// Manipulate the seed here!
// Example: Set the seed to 0 to eliminate randomness
// seed = 0;
// Example: Log the seed
// std::cout << "Original Seed: " << seed << std::endl;
// Call the original RNG function
return OriginalRandomSeed(seed);
}
bool HookRNG() {
// Initialize Detours
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
// Get the address of the RNG function
OriginalRandomSeed = (RandomSeedFn)(GetModuleBaseAddress() + dwRandomSeedFunction); // Assuming you have this function
DetourAttach(&(PVOID&)OriginalRandomSeed, HookedRandomSeed);
LONG error = DetourTransactionCommit();
if (error != NO_ERROR) {
std::cerr << "Detour Transaction Commit Error: " << error << std::endl;
return false;
}
std::cout << "RNG Hooked Successfully!" << std::endl;
return true;
}
bool UnhookRNG() {
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&(PVOID&)OriginalRandomSeed, HookedRandomSeed);
LONG error = DetourTransactionCommit();
if (error != NO_ERROR) {
std::cerr << "Detour Transaction Commit Error: " << error << std::endl;
return false;
}
std::cout << "RNG Unhooked Successfully!" << std::endl;
return true;
}
int main() {
// Initialize
if (HookRNG()) {
// Your cheat code here...
std::cin.get(); // Wait for input before exiting
UnhookRNG();
}
else {
std::cerr << "Failed to Hook RNG!" << std::endl;
}
return 0;
}
#include <Windows.h>
// Assuming you have functions to:
// 1. Get the base address of the CS2 game module.
// 2. Read memory from the CS2 process.
// 3. Write memory to the CS2 process.
// Placeholder for the address of the RNG function in CS2
DWORD dwRandomSeedFunction = 0x12345678; // THIS IS COMPLETELY MADE UP
// Original RNG function (type definition)
typedef int(__fastcall* RandomSeedFn)(int seed);
RandomSeedFn OriginalRandomSeed = nullptr;
// Hooked RNG function
int __fastcall HookedRandomSeed(int seed) {
// Manipulate the seed here!
// Example: Set the seed to 0 to eliminate randomness
// seed = 0;
// Example: Log the seed
// std::cout << "Original Seed: " << seed << std::endl;
// Call the original RNG function
return OriginalRandomSeed(seed);
}
bool HookRNG() {
// Initialize Detours
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
// Get the address of the RNG function
OriginalRandomSeed = (RandomSeedFn)(GetModuleBaseAddress() + dwRandomSeedFunction); // Assuming you have this function
DetourAttach(&(PVOID&)OriginalRandomSeed, HookedRandomSeed);
LONG error = DetourTransactionCommit();
if (error != NO_ERROR) {
std::cerr << "Detour Transaction Commit Error: " << error << std::endl;
return false;
}
std::cout << "RNG Hooked Successfully!" << std::endl;
return true;
}
bool UnhookRNG() {
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&(PVOID&)OriginalRandomSeed, HookedRandomSeed);
LONG error = DetourTransactionCommit();
if (error != NO_ERROR) {
std::cerr << "Detour Transaction Commit Error: " << error << std::endl;
return false;
}
std::cout << "RNG Unhooked Successfully!" << std::endl;
return true;
}
int main() {
// Initialize
if (HookRNG()) {
// Your cheat code here...
std::cin.get(); // Wait for input before exiting
UnhookRNG();
}
else {
std::cerr << "Failed to Hook RNG!" << std::endl;
}
return 0;
}