1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

ASM ItemXY hook help

Discussion in 'Programming' started by DarkSpace, Aug 30, 2010.

  1. DarkSpace

    DarkSpace Well-Known Member Coder

    i found few scraps of code for ItemHook, put all the parts together as logically as i could. and still dont get item x / y pos
    so if anyone knows a solution let me know

    this is what i got so far

    Code (Text):
    1.  
    2.  
    3. DWORD itemAddy1 = 0x004F6506; //FF 15 ?? ?? ?? 00 85 C0 8B 45 ?? 74 ?? FF 70 ?? 8B
    4. DWORD itemAddy2 = 0x004F6328; //FF 15 ?? ?? ?? 00 85 C0 74 ?? 8B 45 ?? 39 58
    5. DWORD ItemX;
    6. DWORD ItemY;
    7.  
    8. __declspec(naked) void __stdcall itemHook()
    9. {
    10.     __asm
    11.     {
    12.         cmp [esp], 0x004F6134 //85 c0 75 ?? 83 4d ?? ?? 39 45 ?? 74 ?? 50
    13.         jne PtInRect
    14.         push eax
    15.             mov eax,[esp+ 0x0C]
    16.             mov [ItemX],eax
    17.             mov eax,[esp+ 0x10]
    18.             mov [ItemY],eax
    19.         pop eax
    20.         jmp PtInRect
    21.     }
    22. }
    23.  
    24. void enableItemHook(bool state)
    25. {
    26.     if(state)
    27.     {
    28.         *(DWORD*)(itemAddy1 + 1) = call(itemAddy1, itemHook);
    29.         *(DWORD*)(itemAddy2 + 1) = call(itemAddy2, itemHook);
    30.     }
    31.     else
    32.     {
    33.         *(DWORD*)(itemAddy1 + 1) = call(itemAddy1, PtInRect);
    34.         *(DWORD*)(itemAddy2 + 1) = call(itemAddy2, PtInRect);
    35.     }
    36. }
    37.  
    Thank you ^^
     
  2. [D.R.T]

    [D.R.T] (҂ `з´ ).︻╦̵̵̿╤── Coder Donor

    Code (Text):
    1.  
    2. DWORD ItemESPCmp = 0x004F6134;
    3.  
    4. void __declspec(naked) ItemHook()
    5. {
    6.     __asm
    7.     {
    8.         cmp dword ptr [esp],ItemESPCmp
    9.         jne NormalAPICall
    10.         push eax
    11.         mov eax,[esp+0x0C]
    12.         mov [itemX],eax
    13.         mov eax,[esp+0x10]
    14.         mov [itemY],eax
    15.         pop eax
    16.  
    17.         NormalAPICall:
    18.         jmp PtInRect
    19.    }
    20. }
    21.  
     
  3. DarkSpace

    DarkSpace Well-Known Member Coder

    cmp dword ptr[esp], itemESPCmp returns an error

    error C2415: improper operand type

    thanks for the reply though
     
  4. [D.R.T]

    [D.R.T] (҂ `з´ ).︻╦̵̵̿╤── Coder Donor

    sorry, you can define it or put it right there

    Code (Text):
    1.  
    2. #define ItemESPCmp  0x004F6134
    3.  
    4. void __declspec(naked) ItemHook()
    5. {
    6.     __asm
    7.     {
    8.         cmp dword ptr [esp],ItemESPCmp
    9.  
    or
    Code (Text):
    1.  
    2. void __declspec(naked) ItemHook()
    3. {
    4.     __asm
    5.     {
    6.         cmp dword ptr [esp],0x004F6134
    7.  
     
  5. DarkSpace

    DarkSpace Well-Known Member Coder

    ok. that part is fixed. thanks
    it doesnt return an error anymore

    but itemX and Y still dont work.

    both values are 0
     
  6. [D.R.T]

    [D.R.T] (҂ `з´ ).︻╦̵̵̿╤── Coder Donor

    because you have two addresses?

    your address is wrong

    in my kami :
    Code (Text):
    1.  
    2. #define ItemHookAddy    0x00ADE6F4
    3.  
    4. *(unsigned long*) ItemHookAddy = (unsigned long)ItemHook;
     
  7. DarkSpace

    DarkSpace Well-Known Member Coder

    i got those aobs from pastebin somewhere =D

    using your addy my game crashes as soon as i activate the hook.

    this is how i wrote it.

    Code (Text):
    1.  
    2. #define ItemHookAddy    0x00ADE6F4
    3.  
    4. void enableItemHook()
    5. {
    6.  *(unsigned long*) ItemHookAddy = (unsigned long)ItemHook;
    7. }
    8.  
    there is no need to change 1st byte of itemHookAddy to 0xe9 or e8? //jmp or call?
     
  8. [D.R.T]

    [D.R.T] (҂ `з´ ).︻╦̵̵̿╤── Coder Donor

    no need, check this
    Code (Text):
    1.  
    2. 00d87b7c://Get Item XY needed for fixing packet FF ? ? ? ? ? 85 C0 75 ? 83 45 ? ? FF 45 ? 81 7D FC
    3. dd GetItemXY
    4.  
    try this
    Code (Text):
    1.  
    2. void GUI::GUILoad(System::Object^  sender, System::EventArgs^  e){
    3.     *(unsigned long*) ItemHookAddy = (unsigned long)ItemHookAsm;
    4. }
    5.  
    I also got an error, to create an enable function
    still can not get to know why
     
  9. DarkSpace

    DarkSpace Well-Known Member Coder

    weird. no matter how i hook it. just crashes the game.

    could it be that the

    #define ItemESPCmp 0x004F6134

    is wrong? or is that the same one you are using? i got that addy from the aob also from GK
     
  10. [D.R.T]

    [D.R.T] (҂ `з´ ).︻╦̵̵̿╤── Coder Donor

    Code (Text):
    1.  
    2. //ItemHook
    3. #define ItemHookAddy    0x00ADE6F4
    4. #define ItemESPCmp  0x004F6134
    5.  
    6. int ItemX, ItemY;
    7. void __declspec(naked) ItemHookAsm()
    8. {
    9.     __asm
    10.     {
    11.         cmp dword ptr [esp],ItemESPCmp
    12.         jne NormalAPICall
    13.         push eax
    14.         mov eax,[esp+0x0C]
    15.         mov [ItemX],eax
    16.         mov eax,[esp+0x10]
    17.         mov [ItemY],eax
    18.         pop eax
    19.  
    20.         NormalAPICall:
    21.         jmp PtInRect
    22.    }
    23. }
    24.  
    25. void GUI::OnGUILoad(System::Object^  sender, System::EventArgs^  e){
    26.     *(unsigned long*) ItemHookAddy = (unsigned long)ItemHookAsm;
    27. }
    28.  
     
  11. DarkSpace

    DarkSpace Well-Known Member Coder

    ok i still dont know where the crashing came from.
    i got the crashing fixed. but still ItemX and ItemY are 0, 0

    this is really frustrating
     
  12. [D.R.T]

    [D.R.T] (҂ `з´ ).︻╦̵̵̿╤── Coder Donor

    on my form does not show the coordinates, but it works
     
  13. Danny1994

    Danny1994 Likes to contribute Coder

    You need to press the Loot key to view the x y of a item.
     
  14. DarkSpace

    DarkSpace Well-Known Member Coder

    wow it was that simple? i was using it with a kami. was just stuck in the air -_- never pressed a loot key =p

    problem salved.

    thanks D.R.T and Danny!
     
  15. Danny1994

    Danny1994 Likes to contribute Coder

    LoL at u :3
    I actually thought i will get flamed for that post...
     
  16. fag

    fag Banned Banned

    FF 15 represents a "call dword ptr" opcode. Instead of modifying some function pointer and comparing [esp] (return address), it's faster to just modify the call.
     

Share This Page