Giriş yap
En iyi yollayıcılar
Hello EMO | ||||
EMO | ||||
eMoStyLe | ||||
BesimBICER | ||||
GameKinG | ||||
Crysis | ||||
~>!.DεvιLρяιεsт.!<~ | ||||
MeTaL | ||||
TrueCrime | ||||
djhayal3t |
Istatistikler
Toplam 203 kayıtlı kullanıcımız varSon kaydolan kullanıcımız: crayzboy76
Kullanıcılarımız toplam 1186 mesaj attılar bunda 862 konu
Arama
Sosyal yer imi
Sosyal bookmarking sitesinde Emo, Emo nedir, Emo resimleri, Emo Kıyafetleri, Emo Sözleri, Emo Oyunları, EmoTurkey, Emo Nickler, Emo Avatarları, Punk, Punk Resimleri, Punk Avatarları, Rock, Rock Resimleri, Rock Avatarları, Msn Nickleri, Msn Avatarları, Müzik adresi saklayın ve paylaşın
Sosyal bookmarking sitesinde EMO Style ForumPro - Hos Geldiniz adresi saklayın ve paylaşın
Kimler hatta?
Toplam 3 kullanıcı online :: 0 Kayıtlı, 0 Gizli ve 3 Misafir :: 1 Arama motorlarıYok
Sitede bugüne kadar en çok 217 kişi C.tesi Tem. 29, 2017 1:46 am tarihinde online oldu.
En son konular
Reklam
Hooking address (GCC)
1 sayfadaki 1 sayfası
Hooking address (GCC)
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,
The error line gives this error:
invalid use of member(did you forget the '&'?)
Hope someone can help me.
-----------------------------------------------------------------------------------------------------
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:
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; } |
EMO- EMO Team
- Cinsiyet :
Burçlar :
Mesaj Sayısı : 184
Puan : 247443
Rep Puanı : 5
Doğum tarihi : 28/11/89
Kayıt tarihi : 18/05/11
Yaş : 34
Nerden : EMO world
İş/Hobiler : RCE Student / Game Hacking / Learn Beginner C#,C++,Delphi
Lakap : EMO
Similar topics
» D3d hooking
» API Hooking by IAT Patching
» [Tut(C++)] Hooking Functions
» [C/C++] Hooking Tutorial
» [Tutorial][SourceCode] SEH/thread hooking
» API Hooking by IAT Patching
» [Tut(C++)] Hooking Functions
» [C/C++] Hooking Tutorial
» [Tutorial][SourceCode] SEH/thread hooking
1 sayfadaki 1 sayfası
Bu forumun müsaadesi var:
Bu forumdaki mesajlara cevap veremezsiniz
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