EMO Style ForumPro - Hos Geldiniz
Giriş yap

Şifremi unuttum

Istatistikler
Toplam 202 kayıtlı kullanıcımız var
Son kaydolan kullanıcımız: AnthonyFurey3

Kullanıcılarımız toplam 1186 mesaj attılar bunda 862 konu
Tarıyıcı
 Kapı
 Indeks
 Üye Listesi
 Profil
 SSS
 Arama
Arama
 
 

Sonuç :
 


Rechercher çıkıntı araştırma

RSS akısı


Yahoo! 
MSN 
AOL 
Netvibes 
Bloglines 


Kimler hatta?
Toplam 1 kullanıcı online :: 0 Kayıtlı, 0 Gizli ve 1 Misafir

Yok

[ Bütün listeye bak ]


Sitede bugüne kadar en çok 92 kişi Paz Ağus. 28, 2016 6:58 am tarihinde online oldu.
En son konular
» İnternetten Para Kazandıran Oyun ! Ödeme Alt Limiti Yok ! DEV KONU
Cuma Ağus. 29, 2014 8:33 am tarafından Hello EMO

» goldenchase.net maden yaparak para kazanma
Cuma Ağus. 29, 2014 8:18 am tarafından Hello EMO

» etichal hacker görsel egitim seti
Çarş. Ağus. 06, 2014 4:57 am tarafından Hello EMO

» KO TBL Source C#
Ptsi Ara. 09, 2013 6:36 am tarafından Hello EMO

» x86 Registers
C.tesi Ağus. 24, 2013 5:02 am tarafından Hello EMO

» [Tutorial] Pegando Address, Pointers de WYD
Çarş. Tem. 10, 2013 7:25 am tarafından Hello EMO

» [Tutorial] Pegando Address, Pointers de CS Metodo²
Çarş. Tem. 10, 2013 7:23 am tarafından Hello EMO

» [Tutorial] Aprendendo basico deASM OLLYDBG
Çarş. Tem. 10, 2013 7:22 am tarafından Hello EMO

» Basic C# DLL injector
Ptsi Tem. 08, 2013 7:48 am tarafından Hello EMO

Reklam

Hooking address (GCC)

Önceki başlık Sonraki başlık Aşağa gitmek

Hooking address (GCC)

Mesaj tarafından EMO Bir Perş. Haz. 02, 2011 8:59 am

Hello,



I'm trying to hook a function, I know the address, but the problem is
I'm using GCC now, I used to be using VS and my method does not work
anymore,



Code:
void Hooks::EnableHooks ()

{

*(char*)ulSend = 0xE9;

*(long*)ulSend + 1 = NewSendFun - ulSend - 5; // error line

}





/* New functions for hooked Functions */

void Hooks::NewSendFun()

{

__asm__ (

"mov [ppSendPacket],%espnt"

"pushant"

"call SendPacketCallbacknt"

"popant"

"jmp *%ulSendRet]nt"

);

}



The error line gives this error:

invalid use of member(did you forget the '&'?)



Hope someone can help me.



-----------------------------------------------------------------------------------------------------


Jani wrote:
You
don't have to make the whole class static. Only the member receiving
the callback. This is because the compiler can't just run a method of a
class, which doesn't have an instance. The other way would be to tell
the compiler which instance of the object to use and then call the
member: ((class).*(member))(args). But seeing the case, using a static
member is much more easier.

I'm not sure what you mean by "((class).*(member))(args)", because dot
is used with class instance - objects, not class, you should've used ::
instead. and by member I assumed you meant the function, and then I
don't understand what's the dereference operator for... get the
function's... value? and the call it with the arguments?

I think you meant:

((return_type (call_convention*)(void*))class::member)(&object)

for example:

((int (__cdecl*)(void*, other_params))class::member)(&object, other_param)

because "this" pointer is passed as a paramater.



Unfortunatly, the compiler didn't like me converting a class method to a
pointer (int*, char*, void*, nothing...) even though it worked
perfectly fine with functions that didn't belong to a class, so I had to
write a warper, nothing too complicated, just a few lines of inline
assembly.

Here's an example:

Code:
#include



class Class

{

public:

void* __stdcall GetThisPointer() { return (void*)this; }

};



//This is how the compiler implements the function

//"this" pointer is passed as a paramater

void* GetThisPointer_Implementation(Class* object)

{

return (void*)object;

}



//Proof of Concept

int __declspec(naked) GetThisPointer_PoC(Class* object)

{

__asm

{

PUSH EBP //since we specified __declspec(naked)

MOV EBP, ESP //fix stack

//if GetThisPointer was __cdecl (by default) then

//you should've used "MOV ECX, object" instead of "PUSH object"

PUSH object //Pass "this" pointer as a parameter

LEA EAX, [Class::GetThisPointer]

CALL EAX

POP EBP

RETN 4

}

}



int main()

{

Class Object;



printf("Object (%p) = this (%p)n", &Object, Object.GetThisPointer());

printf("Implementation: %pn", GetThisPointer_Implementation(&Object));

printf("Proof of Concept: %pn", GetThisPointer_PoC(&Object));



return 0;

}
avatar
EMO
EMO Team
EMO Team

Cinsiyet : Erkek
Burçlar : Yay
Yılan
Mesaj Sayısı : 184
Puan : 109193
Rep Puanı : 5
Doğum tarihi : 28/11/89
Kayıt tarihi : 18/05/11
Yaş : 27
Nerden : EMO world
İş/Hobiler : RCE Student / Game Hacking / Learn Beginner C#,C++,Delphi
Lakap : EMO

Kullanıcı profilini gör

Sayfa başına dön Aşağa gitmek

Önceki başlık Sonraki başlık Sayfa başına dön


 
Bu forumun müsaadesi var:
Bu forumdaki mesajlara cevap veremezsiniz