|
You last visited: Today at 16:14
Advertisement
[C++]ADD VERIABLE TO YOUR EXE | Like : app.TEST
Discussion on [C++]ADD VERIABLE TO YOUR EXE | Like : app.TEST within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.
08/27/2013, 23:15
|
#1
|
elite*gold: 0
Join Date: Aug 2013
Posts: 28
Received Thanks: 60
|
[C++]ADD VERIABLE TO YOUR EXE | Like : app.TEST
Needs :
Python22 - Libs and Includes
Visual Studio
Knowledge of c++
Hello guys here is source : (its long way , you can easily make it with inline asm)
PHP Code:
// dllmain.cpp : Defines the entry point for the DLL application. #include "stdafx.h" #include <iostream> #include <detours.h> #include <Python.h> #include <fstream> using namespace std;
// Py_InitModule4(char* name, PyMemberDef * methods, char* doc, PyObject* self, int apiver); typedef PyObject*(*tVeriables)(char*, PyMemberDef*, char*, PyObject*, int); tVeriables oVeriables;
PyObject * hVeriables(char* name, PyMemberDef * methods, char* doc, PyObject* self, int apiver) { if (!strcmp(name, "player")) PyModule_AddIntConstant(oVeriables(name, methods, doc, self, apiver), "TEST", 0); return oVeriables(name, methods, doc, self, apiver); }
extern "C" int __declspec(dllexport)Initialize(){ oVeriables = (tVeriables) DetourFunction((PBYTE) Py_InitModule4, (PBYTE) hVeriables); return 0; }
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: CreateThread(NULL, 0, reinterpret_cast<LPTHREAD_START_ROUTINE>(Initialize), NULL, 0, NULL); case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; }
Tutorial :
NOTE : After debug , import dll to your exe using lordpe or any program that you know.(Initialize)
I have added player.TEST as 0.
So you can add whatever you want.
Dont write silly comments.
|
|
|
08/27/2013, 23:27
|
#2
|
elite*gold: 20
Join Date: Jun 2011
Posts: 2,897
Received Thanks: 3,336
|
or simply write in python :
import player
player.TEST = 0
|
|
|
08/27/2013, 23:29
|
#3
|
elite*gold: 0
Join Date: Aug 2013
Posts: 28
Received Thanks: 60
|
i know this comment will show up , yeah i know you can make this by that way but i wanted to make it using c++
|
|
|
08/28/2013, 00:59
|
#4
|
elite*gold: 0
Join Date: May 2013
Posts: 223
Received Thanks: 93
|
First of all: Thanks!
So..
I have a problem -.-
I've debuged the dllmain.cpp without any errors.
I've included my Dll with LordPE.
So my new Attribute is "app.ENABLE_SOUL_SYSTEM".
But after the loadingscreen write my Syserr.txt
PHP Code:
'module' object has no attribute 'ENABLE_SOUL_SYSTEM'
What do i wrong?
Sorry for bad English.
PS: Here is my edited source:
PHP Code:
// dllmain.cpp : Defines the entry point for the DLL application. #include "stdafx.h" #include <iostream> #include <detours.h> #include <Python.h> #include <fstream> using namespace std; #define DetourFunction
// Py_InitModule4(char* name, PyMemberDef * methods, char* doc, PyObject* self, int apiver); typedef PyObject*(*tVeriables)(char*, PyMemberDef*, char*, PyObject*, int); tVeriables oVeriables;
PyObject * hVeriables(char* name, PyMemberDef * methods, char* doc, PyObject* self, int apiver) { if (!strcmp(name, "app")) PyModule_AddIntConstant(oVeriables(name, methods, doc, self, apiver), "ENABLE_SOUL_SYSTEM", 0); return oVeriables(name, methods, doc, self, apiver); }
extern "C" int __declspec(dllexport)Initialize(){ oVeriables = (tVeriables) DetourFunction((PBYTE) Py_InitModule4, (PBYTE) hVeriables); return 0; }
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: CreateThread(NULL, 0, reinterpret_cast<LPTHREAD_START_ROUTINE>(Initialize), NULL, 0, NULL); case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; }
|
|
|
08/28/2013, 01:01
|
#5
|
elite*gold: 0
Join Date: Aug 2013
Posts: 28
Received Thanks: 60
|
hmm i will try myself.
|
|
|
08/28/2013, 01:02
|
#6
|
elite*gold: 0
Join Date: May 2013
Posts: 223
Received Thanks: 93
|
Quote:
Originally Posted by LoveCpp
hmm i will try myself.
|
Ok thanks I have so much ideas with your Source Code.
|
|
|
08/28/2013, 01:08
|
#7
|
elite*gold: 0
Join Date: Aug 2013
Posts: 28
Received Thanks: 60
|
It worked for me :
PHP Code:
// dllmain.cpp : Defines the entry point for the DLL application. #include "stdafx.h" #include <iostream> #include <detours.h> #include <Python.h> #include <fstream> using namespace std;
// Py_InitModule4(char* name, PyMemberDef * methods, char* doc, PyObject* self, int apiver); typedef PyObject*(*tVeriables)(char*, PyMemberDef*, char*, PyObject*, int); tVeriables oVeriables;
PyObject * hVeriables(char* name, PyMemberDef * methods, char* doc, PyObject* self, int apiver) { if (!strcmp(name, "app")) PyModule_AddIntConstant(oVeriables(name, methods, doc, self, apiver), "ENABLE_SOUL_SYSTEM", 0); return oVeriables(name, methods, doc, self, apiver); }
extern "C" int __declspec(dllexport)Initialize(){ oVeriables = (tVeriables) DetourFunction((PBYTE) Py_InitModule4, (PBYTE) hVeriables); return 0; }
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: CreateThread(NULL, 0, reinterpret_cast<LPTHREAD_START_ROUTINE>(Initialize), NULL, 0, NULL); case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; }
|
|
|
08/28/2013, 01:09
|
#8
|
elite*gold: 0
Join Date: May 2013
Posts: 223
Received Thanks: 93
|
Quote:
Originally Posted by LoveCpp
It worked for me :
PHP Code:
// dllmain.cpp : Defines the entry point for the DLL application. #include "stdafx.h" #include <iostream> #include <detours.h> #include <Python.h> #include <fstream> using namespace std;
// Py_InitModule4(char* name, PyMemberDef * methods, char* doc, PyObject* self, int apiver); typedef PyObject*(*tVeriables)(char*, PyMemberDef*, char*, PyObject*, int); tVeriables oVeriables;
PyObject * hVeriables(char* name, PyMemberDef * methods, char* doc, PyObject* self, int apiver) { if (!strcmp(name, "app")) PyModule_AddIntConstant(oVeriables(name, methods, doc, self, apiver), "ENABLE_SOUL_SYSTEM", 0); return oVeriables(name, methods, doc, self, apiver); }
extern "C" int __declspec(dllexport)Initialize(){ oVeriables = (tVeriables) DetourFunction((PBYTE) Py_InitModule4, (PBYTE) hVeriables); return 0; }
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: CreateThread(NULL, 0, reinterpret_cast<LPTHREAD_START_ROUTINE>(Initialize), NULL, 0, NULL); case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; }
|
Hmm
Edit: If i use now your Code it says:
PHP Code:
DetourFunction was not found :O
|
|
|
08/28/2013, 01:18
|
#9
|
elite*gold: 0
Join Date: Aug 2013
Posts: 28
Received Thanks: 60
|
you wrote :
#define DetourFunction
wth
try : #pragma comment(lib, detours.lib)
|
|
|
08/28/2013, 01:22
|
#10
|
elite*gold: 0
Join Date: May 2013
Posts: 223
Received Thanks: 93
|
Quote:
Originally Posted by LoveCpp
you wrote :
#define DetourFunction
wth
try : #pragma comment(lib, detours.lib)
|
Ooops
Not work, i havent the detours.lib, i go search it!
|
|
|
08/28/2013, 01:23
|
#11
|
elite*gold: 0
Join Date: Mar 2013
Posts: 2,449
Received Thanks: 6,448
|
Quote:
Originally Posted by xCPx
or simply write in python :
import player
player.TEST = 0
|
Oder einfach
Denke seine Releases sollen eher zur Orientierung für Anfänger sein.
Es kann nicht jeder alles ohne Übung, so wie du.
Im Gegensatz zu dir müssen manche für Dinge was tun bzw. üben.
|
|
|
08/28/2013, 01:36
|
#12
|
elite*gold: 0
Join Date: May 2013
Posts: 223
Received Thanks: 93
|
@LoveCpp: I've found the lib but also the same error.
|
|
|
08/28/2013, 01:37
|
#13
|
elite*gold: 0
Join Date: Aug 2013
Posts: 28
Received Thanks: 60
|
then find clear detours.
|
|
|
08/28/2013, 01:42
|
#14
|
elite*gold: 0
Join Date: May 2013
Posts: 223
Received Thanks: 93
|
Quote:
Originally Posted by LoveCpp
then find clear detours.
|
Hmm, nothing found -.-
|
|
|
08/28/2013, 01:53
|
#15
|
elite*gold: 0
Join Date: Aug 2013
Posts: 28
Received Thanks: 60
|
there you go :
|
|
|
All times are GMT +2. The time now is 16:14.
|
|