Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2 > Metin2 Private Server > Metin2 PServer Guides & Strategies
You last visited: Today at 16:14

  • Please register to post and access all features, it's quick, easy and FREE!

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.

Reply
 
Old   #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(charnamePyMemberDef methodschardocPyObjectselfint apiver)
{
    if (!
strcmp(name"player"))
        
PyModule_AddIntConstant(oVeriables(namemethodsdocselfapiver), "TEST"0);
    return 
oVeriables(namemethodsdocselfapiver);
}

extern "C" int __declspec(dllexport)Initialize(){
    
oVeriables = (tVeriablesDetourFunction((PBYTEPy_InitModule4, (PBYTEhVeriables);
    return 
0;
}

BOOL APIENTRY DllMainHMODULE hModule,
                       
DWORD  ul_reason_for_call,
                       
LPVOID lpReserved
                     
)
{
    switch (
ul_reason_for_call)
    {
    case 
DLL_PROCESS_ATTACH:
        
CreateThread(NULL0reinterpret_cast<LPTHREAD_START_ROUTINE>(Initialize), NULL0NULL);
    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.
LoveCpp is offline  
Thanks
5 Users
Old 08/27/2013, 23:27   #2
 
xCPx's Avatar
 
elite*gold: 20
Join Date: Jun 2011
Posts: 2,897
Received Thanks: 3,336
or simply write in python :
import player
player.TEST = 0
xCPx is offline  
Thanks
3 Users
Old 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++
LoveCpp is offline  
Thanks
1 User
Old 08/28/2013, 00:59   #4
 
.Captor's Avatar
 
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:
.Captor is offline  
Old 08/28/2013, 01:01   #5
 
elite*gold: 0
Join Date: Aug 2013
Posts: 28
Received Thanks: 60
hmm i will try myself.
LoveCpp is offline  
Old 08/28/2013, 01:02   #6
 
.Captor's Avatar
 
elite*gold: 0
Join Date: May 2013
Posts: 223
Received Thanks: 93
Quote:
Originally Posted by LoveCpp View Post
hmm i will try myself.
Ok thanks I have so much ideas with your Source Code.
.Captor is offline  
Old 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(charnamePyMemberDef methodschardocPyObjectselfint apiver)
{
    if (!
strcmp(name"app"))
        
PyModule_AddIntConstant(oVeriables(namemethodsdocselfapiver), "ENABLE_SOUL_SYSTEM"0);
    return 
oVeriables(namemethodsdocselfapiver);
}

extern "C" int __declspec(dllexport)Initialize(){
    
oVeriables = (tVeriablesDetourFunction((PBYTEPy_InitModule4, (PBYTEhVeriables);
    return 
0;
}

BOOL APIENTRY DllMainHMODULE hModule,
                       
DWORD  ul_reason_for_call,
                       
LPVOID lpReserved
                     
)
{
    switch (
ul_reason_for_call)
    {
    case 
DLL_PROCESS_ATTACH:
        
CreateThread(NULL0reinterpret_cast<LPTHREAD_START_ROUTINE>(Initialize), NULL0NULL);
    case 
DLL_THREAD_ATTACH:
    case 
DLL_THREAD_DETACH:
    case 
DLL_PROCESS_DETACH:
        break;
    }
    return 
TRUE;

LoveCpp is offline  
Old 08/28/2013, 01:09   #8
 
.Captor's Avatar
 
elite*gold: 0
Join Date: May 2013
Posts: 223
Received Thanks: 93
Quote:
Originally Posted by LoveCpp View Post
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(charnamePyMemberDef methodschardocPyObjectselfint apiver)
{
    if (!
strcmp(name"app"))
        
PyModule_AddIntConstant(oVeriables(namemethodsdocselfapiver), "ENABLE_SOUL_SYSTEM"0);
    return 
oVeriables(namemethodsdocselfapiver);
}

extern "C" int __declspec(dllexport)Initialize(){
    
oVeriables = (tVeriablesDetourFunction((PBYTEPy_InitModule4, (PBYTEhVeriables);
    return 
0;
}

BOOL APIENTRY DllMainHMODULE hModule,
                       
DWORD  ul_reason_for_call,
                       
LPVOID lpReserved
                     
)
{
    switch (
ul_reason_for_call)
    {
    case 
DLL_PROCESS_ATTACH:
        
CreateThread(NULL0reinterpret_cast<LPTHREAD_START_ROUTINE>(Initialize), NULL0NULL);
    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 :
.Captor is offline  
Old 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)
LoveCpp is offline  
Old 08/28/2013, 01:22   #10
 
.Captor's Avatar
 
elite*gold: 0
Join Date: May 2013
Posts: 223
Received Thanks: 93
Quote:
Originally Posted by LoveCpp View Post
you wrote :
#define DetourFunction
wth

try : #pragma comment(lib, detours.lib)
Ooops

Not work, i havent the detours.lib, i go search it!
.Captor is offline  
Old 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 View Post
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.
Lord iRemix is offline  
Thanks
3 Users
Old 08/28/2013, 01:36   #12
 
.Captor's Avatar
 
elite*gold: 0
Join Date: May 2013
Posts: 223
Received Thanks: 93
@LoveCpp: I've found the lib but also the same error.
.Captor is offline  
Old 08/28/2013, 01:37   #13
 
elite*gold: 0
Join Date: Aug 2013
Posts: 28
Received Thanks: 60
then find clear detours.
LoveCpp is offline  
Old 08/28/2013, 01:42   #14
 
.Captor's Avatar
 
elite*gold: 0
Join Date: May 2013
Posts: 223
Received Thanks: 93
Quote:
Originally Posted by LoveCpp View Post
then find clear detours.
Hmm, nothing found -.-
.Captor is offline  
Old 08/28/2013, 01:53   #15
 
elite*gold: 0
Join Date: Aug 2013
Posts: 28
Received Thanks: 60
there you go :
LoveCpp is offline  
Reply


Similar Threads Similar Threads
KingClem Amazing D3D! [Fast All | Spread | 2h Test Time! fking big!] [3h Test Chams]
01/28/2015 - WarRock Hacks, Bots, Cheats & Exploits - 71 Replies
OUTDATED Screenshot: http://h4.abload.de/img/kingclembigd3downagetihrg k.png Screenshot II: http://kingclem.co.de/images/homo.png Viruscan: VirusTotal - Free Online Virus, Malware and URL Scanner



All times are GMT +2. The time now is 16:14.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.