Hooking - suggested options besides EndScene? menu

Shout-Out

User Tag List

Page 1 of 3 123 LastLast
Results 1 to 15 of 41
  1. #1
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hooking - suggested options besides EndScene?

    So I'm experimenting much more on injection on mac, and have had some pretty decent success, especially with actually changing much of the original mach_override to meet my needs. One piece I have been struggling with is hooking glClear (which I believe is called at the start of every frame via OpenGL). The entire function is a jmp instruction, and for some reason (after 2 hours of work) I've been unable to redirect it. So I wanted to ask - do people hook any other functions which are similar to EndScene in that they are called on a regular/consistent basis?

    Ideally I'm looking for something that would be cross-compatible (i.e. a Direct3D hook won't work for me as I'm doing this on mac)

    Thanks!!
    https://tanaris4.com

    Hooking - suggested options besides EndScene?
  2. #2
    Robske's Avatar Contributor
    Reputation
    305
    Join Date
    May 2007
    Posts
    1,062
    Thanks G/R
    3/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know people who are using BeginScene to execute their logic, any method that's being called on a regular basis (not only during ingame gameplay mind you!) and in context of the mainthread will suffice.

    From the top of my head these could serve as an EndScene replacement: But you'll probably run into trouble with these if you use them in your own code
    - Packet methods
    - Lua Library methods
    - EnumVisibleObjects
    I think it's best to hook them and look at the frequency at which they are called and pick the most optimal one for your project.

    I'm unsure about the Mac side of things, but there shouldn't be any distinct difference between glClear and EndScene when it comes to detouring them afaik.
    Last edited by Robske; 04-06-2010 at 10:25 AM.
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
    "I cried a little earlier when I had to poop" - Sku

  3. #3
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @Robske - there isn't, but the library I'm using "needs" 6+ bytes to over-write, the glClear function is only 5 bytes (I'm sure there is a way around this, but I tried for 2 hours yesterday to get around this and nothing )

    Any idea which lua functions/events are called on a consistent basis?
    https://tanaris4.com

  4. #4
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Tanaris4 View Post
    @Robske - there isn't, but the library I'm using "needs" 6+ bytes to over-write, the glClear function is only 5 bytes (I'm sure there is a way around this, but I tried for 2 hours yesterday to get around this and nothing )

    Any idea which lua functions/events are called on a consistent basis?
    How do the bytes in the function look right now? Also, why don't you just detour the stub it's jumping to?
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  5. #5
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's what I was trying to do, and couldn't get it to work :/ So I came here to ask if there was another function to hook

    If you want to look, here is what I use to actually hook:

    Code:
    	me = mach_override_ptr(	(void*)0xFF03D7,
    							(void*)&_hook_glClear,
    							(void**)&_real_glClear);
    The mach functions: tanaris4 private pastebin - collaborative debugging tool

    The function I'm hooking:
    https://tanaris4.com

  6. #6
    GliderPro's Avatar Member
    Reputation
    -1
    Join Date
    Mar 2009
    Posts
    93
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can't you just replace 0x00018e08 with the address of your hook and jump to 0x00018e08 at the end of your hook?

  7. #7
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    one would think That's what I was trying, and honestly didn't want to invest another 2/3 hours figuring it out if there was a different function I could hook easily

    Edit: Something I should have clarified, I thought I was replacing the jump command correctly, but wow would crash the second I replaced that jump instruction to jump somewhere else (and the corresponding jump was never made). Do i need to "freeze" wow, then replace the jump, then resume to prevent a crash? Or is this not an issue?
    Last edited by Tanaris4; 04-06-2010 at 05:10 PM.
    https://tanaris4.com

  8. #8
    wraithZX's Avatar Active Member
    Reputation
    43
    Join Date
    May 2007
    Posts
    122
    Thanks G/R
    0/1
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you attempting to replace the jump target with an absolute address?
    The E9 opcode is relative to the instruction, so you need to be calculating a new relative offset to your hook, not inserting an absolute address.

  9. #9
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's relative
    https://tanaris4.com

  10. #10
    wraithZX's Avatar Active Member
    Reputation
    43
    Join Date
    May 2007
    Posts
    122
    Thanks G/R
    0/1
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ....you have stepped through it in a debugger, haven't you?

  11. #11
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope, I believe my only choice is GDB (for os x), and unfortunately I'm not at all familiar with it (can only stop/start WoW entirely)

    Should I be using GDB to step through? (would i make a breakpoint at glClear?)
    https://tanaris4.com

  12. #12
    BoogieManTM's Avatar Active Member
    Reputation
    52
    Join Date
    May 2008
    Posts
    193
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can debug with IDA. download the remote debugger, attach, and then connect to the remote debugger with a windows IDA client. works muuuuuch better than trying to use GDB

  13. #13
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perfect, I'll do just that - thanks!
    https://tanaris4.com

  14. #14
    alextrusk's Avatar Member
    Reputation
    1
    Join Date
    Mar 2009
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's what the function looks like on my side (xp sp3, opengl32.dll version 5.1.2600.5512):

    Code:
    .text:5ED03124 ; void __stdcall glClear(GLbitfield mask)
    .text:5ED03124                 public _glClear@4
    .text:5ED03124 _glClear@4      proc near               ; DATA XREF: .text:off_5EDA2CB8o
    .text:5ED03124
    .text:5ED03124 mask            = dword ptr  4
    .text:5ED03124
    .text:5ED03124                 mov     edx, large fs:18h
    .text:5ED0312B                 cmp     _dwTlsIndex, 40h
    .text:5ED03132                 jge     short loc_5ED03144
    .text:5ED03134                 mov     eax, edx
    .text:5ED03136                 add     edx, _dwTlsOffset
    .text:5ED0313C                 mov     edx, [edx]
    .text:5ED0313E                 jmp     dword ptr [edx+32Ch]
    .text:5ED03144 ; ---------------------------------------------------------------------------
    .text:5ED03144
    .text:5ED03144 loc_5ED03144:                           ; CODE XREF: glClear(x)+Ej
    .text:5ED03144                 push    _dwTlsIndex     ; dwTlsIndex
    .text:5ED0314A                 call    ds:__imp__TlsGetValue@4 ; TlsGetValue(x)
    .text:5ED03150                 xchg    eax, edx
    .text:5ED03151                 jmp     dword ptr [edx+32Ch]
    .text:5ED03151 _glClear@4      endp
    I'm not at all versed in MacOS, but it looks like you're trying to detour some sort of import wrapper or w/e.
    You should be targeting the glClear in the actual opengl32 binary instead.
    Last edited by alextrusk; 04-07-2010 at 04:56 PM.

  15. #15
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're hooking the dll? Not the detour to the external lib w/in wow?

    Interesting idea
    https://tanaris4.com

Page 1 of 3 123 LastLast

Similar Threads

  1. [C# DLL] aHook, use ASM through EndScene hook
    By JuJuBoSc in forum WoW Memory Editing
    Replies: 81
    Last Post: 04-22-2024, 02:55 PM
  2. Custom rendering in endscene hook
    By ggg898 in forum WoW Memory Editing
    Replies: 3
    Last Post: 09-11-2009, 09:38 AM
  3. [Test Theory] EndScene hook without Native Code (Kinda)
    By Apoc in forum WoW Memory Editing
    Replies: 7
    Last Post: 09-04-2009, 12:46 PM
  4. EndScene Hook not changing anything
    By lanman92 in forum WoW Memory Editing
    Replies: 32
    Last Post: 06-01-2009, 11:46 PM
  5. How I hooked EndScene
    By Sillyboy72 in forum WoW Memory Editing
    Replies: 3
    Last Post: 01-21-2009, 04:40 AM
All times are GMT -5. The time now is 06:29 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search