Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2
You last visited: Today at 05:51

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

Advertisement



[Python/dll] It should work !

Discussion on [Python/dll] It should work ! within the Metin2 forum part of the Popular Games category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2009
Posts: 55
Received Thanks: 7
[Python/dll] It should work !

Hello.

I try to use python in my DLL i'm newbie :<

Code:
#include "windows.h"
#define MS_NO_COREDLL
#include <Python.h>
#include <detours.h>

#include "stdafx.h"
#include <string>
#include <sstream>
#include <iostream>
#include <fcntl.h>
#pragma comment(lib, "detours.lib")
using namespace std;

void pickupitem(){
	PyObject* args = PyTuple_New(0);
	PyObject* ret = PyObject_Call(PyObject_GetAttrString(PyImport_ImportModule("player"), "PickCloseItem"), args, NULL);
	double result = PyFloat_AsDouble(ret);
	Py_DECREF(ret);
	Py_XDECREF(args);
	//return result;
}
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		pickupitem();
		break;
	case DLL_THREAD_ATTACH:
		break;
	case DLL_THREAD_DETACH:
		break;
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
I attach this to process (and it compile successfull but it dont pickup item in game)

Btw. what is the best dll + python injector ? I remember that i saw python + dll injector in one program (DE for metin)

// 2 my metin2 client is still running as administrator privillages.

I dont know how to remove it ( i dont set it in file proporties )
dramcio is offline  
Old 01/25/2014, 13:05   #2
 
[uLow]Beni's Avatar
 
elite*gold: 0
Join Date: May 2011
Posts: 1,781
Received Thanks: 618
i think player.PickCloseItem don't have any return (None).

and its impossible to compile because a void function (must not return) returns double.
[uLow]Beni is offline  
Old 01/25/2014, 14:10   #3
 
elite*gold: 0
Join Date: May 2009
Posts: 55
Received Thanks: 7
ohh i edit this in forum there i fix the code in 1st post. Sorry.

Btw. i try to inject this dll into P SERVER ..


I think it is fault of my VISUAL STUDIO.

Bcoz when i inject it by Winject (program to inject dll into process )

i have got injection failed.

But when i remove python func and change that when the dll is attach show message box - it works.

IF i make that :

Quote:
case DLL_PROCESS_ATTACH:
MessageBoxA(NULL, (LPCSTR) "WORK!", (LPCSTR) "YES !", NULL);
pickupitem();
break;
I saw 2x WORK! but python dont work and this injector still show error.

It is possible to debug this dll ?
And know whats wrong ? ;x
dramcio is offline  
Old 01/25/2014, 14:13   #4
 
Sanchez_x's Avatar
 
elite*gold: 0
Join Date: Jul 2013
Posts: 33
Received Thanks: 106
You can easily remove the administrator privileges with Resource Hacker. Here are the steps:

1. Download Resource Hacker from this site:
2. Open the binary in Resource Hacker and in the Folder tree go here: 24 > 1 > 1033
3. Replace this line:
Code:
<requestedExecutionLevel  level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>
with this:
Code:
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
4. Go to File and click Save as, now Resource Hacker will save your binary without administrator privileges.
Sanchez_x is offline  
Thanks
1 User
Old 01/25/2014, 14:28   #5
 
Mi4uric3's Avatar
 
elite*gold: 405
Join Date: Dec 2007
Posts: 6,615
Received Thanks: 6,356
I don't get the point of using Python in c++ for Metin2.
Those Python-"Exports" are just c++ functions exported by metin2client.bin so the Python-scripts can use it.
Why don't you call them directly?
You are trying to:
c++ -> Python -> Python -> C++ -> Result

But you could simply do:
c++ -> c++ -> Result
Mi4uric3 is offline  
Thanks
1 User
Old 01/25/2014, 14:47   #6
 
elite*gold: 0
Join Date: May 2009
Posts: 55
Received Thanks: 7
ok i understand that python run c++ function.

But i dont understand why it dont work ?

IF i make that :

Quote:
case DLL_PROCESS_ATTACH:
MessageBoxA(NULL, (LPCSTR) "WORK!", (LPCSTR) "YES !", NULL);
pickupitem();
break;
I saw 2x WORK! but python dont work and this injector still show error.

It is possible to debug this dll ?
And know whats wrong ? ;x
dramcio is offline  
Old 01/25/2014, 14:52   #7
 
Mi4uric3's Avatar
 
elite*gold: 405
Join Date: Dec 2007
Posts: 6,615
Received Thanks: 6,356
Maybe you need to link to the python lib?
Mi4uric3 is offline  
Old 01/25/2014, 14:57   #8
 
elite*gold: 0
Join Date: May 2009
Posts: 55
Received Thanks: 7
IN: project > proporties > linker > additional libary directories > C:\Python27\libs

Whats more?
dramcio is offline  
Old 01/26/2014, 16:46   #9
 
elite*gold: 0
Join Date: May 2009
Posts: 55
Received Thanks: 7
Halo. You can use python in dll , but why me cant ?:x

I paste python27.dll into metin2.

2. It is possible to debug this dll?

Py_initalize() - crash Metin2 ;0
dramcio is offline  
Old 01/31/2014, 00:11   #10
 
elite*gold: 0
Join Date: May 2009
Posts: 55
Received Thanks: 7
Refresh, any one dont know how to solve problem?
dramcio is offline  
Old 02/01/2014, 09:32   #11
 
KaMeR1337's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,415
Received Thanks: 5,444
are you trying it on python27? (GameForge), try it on python22 (pservers) and see if works. i had crashing problem on python27 too
KaMeR1337 is offline  
Reply


Similar Threads Similar Threads
[Python-Modul]EXP-Donator (kompatibel mit Python Loader)
11/23/2013 - Metin2 Hacks, Bots, Cheats, Exploits & Macros - 27 Replies
Moin, da man mich danach gefragt hat und ich sowieso mal ein Beispiel für die Benutzung meines Python Loaders veröffentlichen wollte, habe ich die Gelegenheit genutzt und euch eben einen EXP-Spendebot geschrieben. Man kann ihn einfach mit dem oben verlinkten Python Module Loader laden und ihn mit F5 aktivieren/deaktivieren. Sobald ihr mehr als 99 Erfahrungspunkte habt (man kann nur in 100er Schritten spenden), werden alle Erfahrungspunkte an eure Gilde gespendet. Wer Lust hat und...
[Python]Python Loader vs import
07/29/2013 - Metin2 Private Server - 2 Replies
when i tried to inject my bot with this pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "eigenartig/mainboard.py") syserr shows me: 0728 16:55:05139 :: CEffectManager::RegisterEffect - LoadScript(d:/ymir work/effect/hit/percent_damage1.mse) Error 0728 16:55:05139 :: CInstanceBase::RegisterEffect(eEftType=264, c_szEftAttachBone=, c_szEftName=d:/ymir work/effect/hit/percent_damage1.mse, isCache=1) - Error 0728 16:55:05139 :: CEffectManager::RegisterEffect...
Help to make a python file works with python loader
03/03/2013 - Metin2 - 2 Replies
Hey epvp! I want make a very. Little hack works on pythonn loader can anybody help me please?
Metin2 - Python - Wie Python Hacks verschlüsseln und Server überprüfen (GF/PServe)
09/23/2012 - Metin2 - 2 Replies
Ich wollte fragen, wie man Python Hacks am besten Verschlüsselt ? und wie man feststellen kann ob man auf einem GF / Pserver spielt. ?
Python + Eric Python IDE installieren ?!
07/05/2011 - General Coding - 0 Replies
hat sich erledigt.



All times are GMT +2. The time now is 05:51.


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.