Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 01:17

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

Advertisement



Adresse (mit IDA reversed) in C verwenden

Discussion on Adresse (mit IDA reversed) in C verwenden within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2013
Posts: 276
Received Thanks: 22
Adresse (mit IDA reversed) in C verwenden

Hallo, ich habe folgende ASM Anweisungen:
Code:
 push    0
.text:1007C50F                 push    offset unk_100CD8F5
.text:1007C514                 push    offset aOk      ; "OK"
.text:1007C519                 push    offset aBb9999F1Bbbbbb ; "{BB9999}F1\t{BBBBBB}Display this help di"...
.text:1007C51E                 push    offset aSaMpKeys ; "SA-MP Keys:"
.text:1007C523                 push    0
.text:1007C525                 push    1
.text:1007C527                 call    sub_100806F0
Jetzt würde ich dies gerne in C verwenden.
Allerdings stimmt die Adresse 100806F0 nicht, da sich diese Funktion in einer geladenen Library befindet.

Wie kann ich nun die richtige Adresse berechnen?
So habe ich es versucht:

Code:
#include <windows.h>

void function(char* x1, char* x2, char* x3, char* x4)
{
    DWORD dwBase = (DWORD) GetModuleHandleA("samp.dll");
    DWORD* dwAddress = (DWORD*) (dwBase + 0x806F0);

    __asm
    {
        push 0
            push x1
            push x2
            push x3
            push x4
            push 0
            push 1
            call dwAddress
    }
}

DWORD APIENTRY MainThread(LPVOID lpArgs)
{
    MessageBoxA(0, "Test - 1", "Debug", 0);

    while (true)
    {
        if (GetAsyncKeyState(VK_NUMPAD0) & 1)
        {
            MessageBoxA(0, "Test - 2", "Debug", 0);

            function("", "OK", "Test", "Title");
        }
    }

    return FALSE;
}

BOOL APIENTRY DllMain(HMODULE hDLL, DWORD dwReason, LPVOID lpReserved)
{
    if (dwReason == DLL_PROCESS_ATTACH) CreateThread(NULL, NULL, &MainThread, NULL, NULL, NULL);

    return TRUE;
}
Allerdings crashed so das Programm bei Tastendruck.
Redundanz is offline  
Old 11/11/2013, 13:50   #2
 
Dr. Coxxy's Avatar
 
elite*gold: 0
Join Date: Feb 2011
Posts: 1,206
Received Thanks: 736
sieht so ok aus, gibt aber paar sachen zu beachten:
1. calling convention korrekt - funktion sollte den stack selber aufräumen, also _stdcall?
2. du rufst da aus einem eigenen thread auf, ist die aufgerufene funktion threadsicher?
3. parameter so korrekt, sicher, dass man die funktion so aufrufen kann?

außerdem verbrät dein thread da in der true schleife jede menge prozessorzeit, weil du kein sleep drin hast.
Dr. Coxxy is offline  
Old 11/11/2013, 13:55   #3
 
elite*gold: 0
Join Date: Aug 2013
Posts: 276
Received Thanks: 22
Stimmt die Adressberechnung wie ich sie gemacht habe?
Redundanz is offline  
Old 11/11/2013, 15:38   #4
 
Dr. Coxxy's Avatar
 
elite*gold: 0
Join Date: Feb 2011
Posts: 1,206
Received Thanks: 736
in den standardeinstellungen von IDA - ja
Dr. Coxxy is offline  
Old 11/11/2013, 19:19   #5
 
elite*gold: 0
Join Date: Aug 2013
Posts: 276
Received Thanks: 22
Ah, es ist ein thiscall - danke für die Hilfe.
Redundanz is offline  
Old 11/19/2013, 16:38   #6


 
MrSm!th's Avatar
 
elite*gold: 7110
Join Date: Jun 2009
Posts: 28,904
Received Thanks: 25,394
Warum kein Functionpointer?
MrSm!th is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Küchenphysik mit mipez] Heute: Reversed Walljump
11/15/2012 - S4 League - 8 Replies
Heute gibt's die Basics zum verkorksten Walljump Feature. Reversed Walljumps resultieren aus den dämlichen Berechnung von Rechtecken, ausgehend von Dreiecken. Die Kanten von Blöcken werden daher niemals wirklich aus einer Kante bestehen, sondern immer aus 2. Das gilt für die Vertikale als auch für die Horizontale, den Rest übernimmt die Physik und rasselt uns in die falsche Richtung. Das Phänomen tritt allerdings nur dann auf, wenn etwas mehr als die Hälfte der Walljump-Fläche über eine...
[Reversed] PlayerLog-Function
06/27/2012 - 4Story Hacks, Bots, Cheats & Exploits - 7 Replies
Hey, I've found a nice function: Call at: 5A5120:239 int __cdecl CreatePlayerLog(void *Log) { char **LoginID; // eax@1 _UNKNOWN *UnknownVariable; // eax@1 int *CharID; // eax@3
Premium Nexon dont reversed payment or..
02/27/2012 - Dekaron - 2 Replies
Dear NEXONeans, Lately, we are experiencing a heavy increase of malicious chargeback / reversed payment cases that cause severe harms to the game economy as well as to the financial operation. As unfortunate as it is, we therefore see ourselves forced to implement a new policy against chargeback and/or reversed payment that have been evidentially conducted with fraudulent purposes.
reversed all win??
06/25/2009 - Grand Chase - 12 Replies
I fought a lvl 60 player. and after about seconds he used reversed all win(something like that)which is also liek all win but you lose and he win. hmmm im wondering how he did that ... it was made by coolfire..



All times are GMT +2. The time now is 01:17.


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.