romegames 1
romegames
Krutzo 1
Krutzo
shrpnl 1
shrpnl
Best Studio 1
Best Studio
D 1
delimuratt
Aliyldrim 1
Aliyldrim
Mt2Hizmet 1
Mt2Hizmet
noisiv 1
noisiv
Manwe Work 1
Manwe Work
melankolıa18 1
melankolıa18
Agora Metin2 1
Agora Metin2
Cannn6161 1
Cannn6161
Hikaye Ekle
Reklam vermek için turkmmo@gmail.com

Çalışıyor C++ Metin2 py script loader source

LunaUI

Level 5
Uzman
Katılım
8 Şub 2022
Konular
110
Mesajlar
675
Online süresi
2mo 19d
Reaksiyon Skoru
767
Altın Konu
5
Başarım Puanı
175
Yaş
29
MmoLira
16,253
DevLira
0
Ticaret - 0%
0   0   0

ROHAN2 WORLD 1-120 TR TİPİ OFFICIAL YOHARA, BALATHOR VE AMON! 80. GÜNÜNDE! +10.000 ONLİNE! HİLE VE BOT %100 ENGELLİ HEMEN TIKLA!

resim_2025-05-18_235136015.png

[CODE lang="cpp" title="kütüphane"]#define _CRT_SECURE_NO_WARNINGS
#i#includeprocess.h>
#i#includetime.h>
#i#includevector>
#i#includefstream>
#i#includeostream>
#i#includewindows.h>
#i#includeiostream>
#i#includefstream>
#i#includesstream>
#i#includestring>
#i#includestdexcept>
#i#includememory>
#i#includethread>
[/CODE]

[CODE lang="cpp" title="python"]class Exception : public std::runtime_error {
public:
explicit Exception(const std::string& msg) : std::runtime_error(msg) {}
};
class GIL {
public:
using PyGILState_Ensure_t = void* (*)();
using PyGILState_Release_t = void (*)(void*);

GIL(PyGILState_Ensure_t gilEnsure, PyGILState_Release_t gilRelease)
: gilRelease_(gilRelease), state_(gilEnsure())
{
if (!state_) {
throw Exception("Failed");
}
}
~GIL() {
gilRelease_(state_);
}

private:
PyGILState_Release_t gilRelease_;
void* state_;
};

class python27{
public:
explicit python27(HMODULE pythonModule) {
loader(pythonModule);
PyEval_InitThreads();
}
void RunSimpleString(const std::string& code) {
GIL gilGuard(PyGILState_Ensure, PyGILState_Release);
int result = PyRun_SimpleStringFlags(code.c_str(), nullptr);
if (result != 0) {
throw Exception("PyRun_SimpleStringFlags");
}
}

void* call(const char* moduleName, const char* funcName) {
GIL gilGuard(PyGILState_Ensure, PyGILState_Release);

void* pModule = PyImport_ImportModule(moduleName);
if (!pModule) {
throw Exception("failed: " + std::string(moduleName));
}

void* pFunc = PyObject_GetAttrString(pModule, funcName);
if (!pFunc) {
throw Exception("failed: " + std::string(funcName));
}

void* pResult = PyObject_CallObject(pFunc, nullptr);
if (!pResult) {
throw Exception("failed: " + std::string(funcName));
}

return pResult;
}

long IntReturn(const char* moduleName, const char* funcName) {
GIL gilGuard(PyGILState_Ensure, PyGILState_Release);

void* pModule = PyImport_ImportModule(moduleName);
if (!pModule) {
throw Exception("failed: " + std::string(moduleName));
}

void* pResult = PyObject_CallMethod(pModule, funcName, nullptr);
if (!pResult) {
throw Exception("failed: " + std::string(funcName));
}

long result = PyLong_AsLong(pResult);
return result;
}
private:
int (*PyRun_SimpleStringFlags)(const char*, void*) = nullptr;
void* (*PyGILState_Ensure)() = nullptr;
void (*PyGILState_Release)(void*) = nullptr;
void (*PyEval_InitThreads)() = nullptr;

void* (*PyImport_ImportModule)(const char*) = nullptr;
void* (*PyObject_CallMethod)(void*, const char*, const char*, ...) = nullptr;
void* (*PyObject_GetAttrString)(void*, const char*) = nullptr;
void* (*PyObject_CallObject)(void*, void*) = nullptr;
long (*PyLong_AsLong)(void*) = nullptr;

void loader(HMODULE pythonModule) {
PyRun_SimpleStringFlags = reinterpret_cast<decltype(PyRun_SimpleStringFlags)>(GetProcAddress(pythonModule, "PyRun_SimpleStringFlags"));
PyGILState_Ensure = reinterpret_cast<decltype(PyGILState_Ensure)>(GetProcAddress(pythonModule, "PyGILState_Ensure"));
PyGILState_Release = reinterpret_cast<decltype(PyGILState_Release)>(GetProcAddress(pythonModule, "PyGILState_Release"));
PyEval_InitThreads = reinterpret_cast<decltype(PyEval_InitThreads)>(GetProcAddress(pythonModule, "PyEval_InitThreads"));

PyImport_ImportModule = reinterpret_cast<decltype(PyImport_ImportModule)>(GetProcAddress(pythonModule, "PyImport_ImportModule"));
PyObject_CallMethod = reinterpret_cast<decltype(PyObject_CallMethod)>(GetProcAddress(pythonModule, "PyObject_CallMethod"));
PyObject_GetAttrString = reinterpret_cast<decltype(PyObject_GetAttrString)>(GetProcAddress(pythonModule, "PyObject_GetAttrString"));
PyObject_CallObject = reinterpret_cast<decltype(PyObject_CallObject)>(GetProcAddress(pythonModule, "PyObject_CallObject"));
PyLong_AsLong = reinterpret_cast<decltype(PyLong_AsLong)>(GetProcAddress(pythonModule, "PyLong_AsLong"));

if (!PyRun_SimpleStringFlags || !PyGILState_Ensure || !PyGILState_Release || !PyEval_InitThreads ||
!PyImport_ImportModule || !PyObject_CallMethod || !PyObject_GetAttrString || !PyObject_CallObject || !PyLong_AsLong) {
throw Exception("Failed");
}
}
};
bool pyscript_load(const std::string& filename, python27& python) {
std::ifstream file(filename);
if (!file.is_open()) {
return false;
}
std::stringstream buffer;
buffer << file.rdbuf();
std::string code = buffer.str();
try {
python.RunSimpleString(code);
}
catch (const Exception& e) {
return false;
}

return true;
}[/CODE]

[CODE lang="cpp" title="loader"]static char dosya_yolu[512] = "hector.py";
DWORD WINAPI python_script(LPVOID param) {
HMODULE pythonModule = (HMODULE)param;

try {
python27 python(pythonModule);

if (dosya_yolu[0] != '\0') {
if (!pyscript_load(dosya_yolu, python)) {
}
}
else {
}
}
catch (const Exception& e) {
}

return 0;
}

extern "C" BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
DisableThreadLibraryCalls(hModule);

char modulePath[MAX_PATH];
if (GetModuleFileNameA(NULL, modulePath, MAX_PATH)) {
std::string path(modulePath);
size_t pos = path.find_last_of("\\/");
if (pos != std::string::npos) {
path = path.substr(0, pos);
path += "\\python27.dll";

HMODULE python = LoadLibraryA(path.c_str());
if (!python) {
return FALSE;
}
CreateThread(NULL, 0, python_script, python, 0, NULL);
}
}
}
return TRUE;
}
extern "C" __declspec(dllexport) int Nethan2(int code, WPARAM wParam, LPARAM lParam) {
return CallNextHookEx(NULL, code, wParam, lParam);
}[/CODE]
visual studio indiriyorsunuz
yeni proje > dll ekliyorsunuz dllmain.cpp tüm kodları copy paste yapıyorsunuz ve çalısıyor bu kadar
 
Teşekkür
 
TEŞEKKÜRLER
 
Metin2 Gf de Çalışırımı
 
GF çalışırmı ?
 

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst