Hooking - suggested options besides EndScene? menu

User Tag List

Page 3 of 3 FirstFirst 123
Results 31 to 41 of 41
  1. #31
    flo8464's Avatar Active Member
    Reputation
    30
    Join Date
    Apr 2009
    Posts
    434
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also because WoW uses the TLS to store data for use in WoW's mainthread and you can't simply call all functions from your own thread.
    Hey, it compiles! Ship it!

    Hooking - suggested options besides EndScene?
  2. #32
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by flo8464 View Post
    Also because WoW uses the TLS to store data for use in WoW's mainthread and you can't simply call all functions from your own thread.
    In other words, exactly what Main already covered, lol. Thread safety.

    You can easily 'spoof' the TLS values and call engine functions, however that's dangerous because it's not thread-safe. There's a reason that data is in TLS.

  3. #33
    I Hypnotoad I's Avatar Contributor
    Reputation
    147
    Join Date
    Aug 2007
    Posts
    873
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm sorry if I sound off topic here.. I really am but..

    Am I the only one who misread the title to be 'Hookering' ?

    EDIT: Nothing I cant say that has already been said to support this issue. But really bro? People joke on this forum all the time. You don't see them getting in any trouble for it.
    It would've been nice for you to tell me yourself instead of stating something in your own world. (IE: Inside reference "Yes, Go Away") Instead, I had to find out myself..
    Last edited by I Hypnotoad I; 06-01-2010 at 05:36 PM.


    Dragon[Sky] can get into our signatures, AND our pants.



  4. #34
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by I Hypnotoad I View Post
    I'm sorry if I sound off topic here.. I really am but..

    Am I the only one who misread the title to be 'Hookering' ?

    Yes. Go away.

  5. #35
    pred.is.god's Avatar Member
    Reputation
    1
    Join Date
    Jun 2007
    Posts
    86
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by I Hypnotoad I View Post
    I'm sorry if I sound off topic here.. I really am but..

    Am I the only one who misread the title to be 'Hookering' ?

    I didnt misread it, but i lol'd at the title neverless

  6. #36
    Sednogmah's Avatar Contributor
    Reputation
    129
    Join Date
    Oct 2009
    Posts
    158
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Regarding which function to hook:

    WoW calls glClear several times within the rendering of 1 frame, each time with different parameters. It hasn't proven itself as a reliable point to hook, at least not for me personally. glXSwapBuffers however is only called exactly once and WoW's engine is in a consistent state at that point. You might want to try that instead.

    As a bonus, glXSwapBuffers retrieves the GLXDrawable as a parameter which allows you to take screenshots or even stream the whole game over the network with decent FPS.

    How you could hook:

    I'm not very familiar with Mac OS X either but it seems that it has a feature that's very similar to Linux/BSD LD_PRELOAD: DYLD_INSERT_LIBRARIES. -- if it does what I think it does, you should be able to replace library functions like glXSwapBuffers or glClear with your own code, do your dirty work inside & then call the real function.
    Last edited by Sednogmah; 06-10-2010 at 11:08 AM.

  7. #37
    eLaps's Avatar Active Member
    Reputation
    34
    Join Date
    Sep 2007
    Posts
    123
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Sednogmah View Post
    glClear however is only called exactly once and WoW's engine is in a consistent state at that point. You might want to try that instead.
    Anyone got it to work on linux (wine)?
    Last edited by eLaps; 06-10-2010 at 12:56 PM. Reason: quoted link bugged

  8. #38
    audible83's Avatar Member
    Reputation
    4
    Join Date
    Jun 2008
    Posts
    48
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, works perfectly with Wine

  9. #39
    eLaps's Avatar Active Member
    Reputation
    34
    Join Date
    Sep 2007
    Posts
    123
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Uh nervermind I was trying to hook it like glClear :d

  10. #40
    Sednogmah's Avatar Contributor
    Reputation
    129
    Join Date
    Oct 2009
    Posts
    158
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hook-glx.c:
    Code:
    #define _GNU_SOURCE
    #include <dlfcn.h>
    
    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
    
    #include <GL/gl.h>
    #include <GL/glx.h>
    
    void hookfunc();
    
    /* glXSwapBuffers() is very appropriate as an "end scene" hook because
     * WoW calls it exactly once, at the end of each frame.
     *
     * Unfortunately WINE needs to be patched to allow hooking this via
     * LD_PRELOAD.
     *
     * 1) Instead of using the default RTLD loader, WINE retrieves the address
     *    for glXGetProcAddressARB directly from the OpenGL library.
     *    This is done to enable binary compatibility to systems with or without
     *    OpenGL.
     *
     *    Solution: patch WINE to use the default loader
     *
     * 2) WINE gets the pointers to glx functions via glXGetProcAddressARB
     *    
     *    => I'm hooking glXGetProcAddressARB and return my own
     *       pointer to glXSwapBuffers.
     *
     */
    
    typedef __GLXextFuncPtr (*fp_glXGetProcAddressARB) (const GLubyte*);
    typedef __GLXextFuncPtr (*fp_glXSwapBuffers)(Display* dpy, GLXDrawable drawable);
    
    // glXSwapBuffers
    fp_glXSwapBuffers real_glXSwapBuffers;
    
    void my_glXSwapBuffers(Display* dpy, GLXDrawable drawable) {
            real_glXSwapBuffers(dpy, drawable);
            hookfunc();
    }
    
    // glXGetProcAddressARB
    __GLXextFuncPtr glXGetProcAddressARB (const GLubyte* procName)
    {
            __GLXextFuncPtr result;
            printf("* hook-glx.c: glXGetProcAddressARB(\"%s\")\n", procName);
    
            // Fetch pointer of actual glXGetProcAddressARB() function
            static fp_glXGetProcAddressARB lib_getprocaddr = NULL;
            if(!lib_getprocaddr)
            {
                    char* errorstr;
                    lib_getprocaddr = (fp_glXGetProcAddressARB) 
                            dlsym(RTLD_NEXT, "glXGetProcAddressARB");
                    if( (errorstr = dlerror()) != NULL )
                    {
                            fprintf(stderr, "dlsym fail: %s\n", errorstr);
                            exit(1);
                    }
            }
            result = lib_getprocaddr(procName);
    
            // Return our own function pointers
            if( strcmp( (const char*) procName, "glXSwapBuffers" ) == 0 )
            {
                    real_glXSwapBuffers = (fp_glXSwapBuffers) result;
                    return (__GLXextFuncPtr) my_glXSwapBuffers;
            }
            // Return default function pointer
            return lib_getprocaddr(procName);
    }
    WINE patch:
    Code:
    diff -Nru wine-1.1.39.orig/dlls/winex11.drv/opengl.c wine-1.1.39/dlls/winex11.drv/opengl.c
    --- wine-1.1.39.orig/dlls/winex11.drv/opengl.c  2010-02-27 02:21:02.973526893 +0100
    +++ wine-1.1.39/dlls/winex11.drv/opengl.c       2010-02-27 02:27:11.231401387 +0100
    @@ -412,7 +412,7 @@
             return FALSE;
         }
     
    -    pglXGetProcAddressARB = wine_dlsym(opengl_handle, "glXGetProcAddressARB", NULL, 0);
    +    pglXGetProcAddressARB = wine_dlsym(RTLD_DEFAULT, "glXGetProcAddressARB", NULL, 0);
         if (pglXGetProcAddressARB == NULL) {
             ERR("Could not find glXGetProcAddressARB in libGL, disabling OpenGL.\n");
             goto failed;
    Last edited by Sednogmah; 06-10-2010 at 03:33 PM.

  11. #41
    eLaps's Avatar Active Member
    Reputation
    34
    Join Date
    Sep 2007
    Posts
    123
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Sednogmah View Post
    WINE patch:
    Code:
    diff -Nru wine-1.1.39.orig/dlls/winex11.drv/opengl.c  wine-1.1.39/dlls/winex11.drv/opengl.c
    --- wine-1.1.39.orig/dlls/winex11.drv/opengl.c   2010-02-27 02:21:02.973526893 +0100
    +++ wine-1.1.39/dlls/winex11.drv/opengl.c        2010-02-27 02:27:11.231401387 +0100
    @@ -412,7 +412,7 @@
              return FALSE;
         }
     
    -    pglXGetProcAddressARB =  wine_dlsym(opengl_handle, "glXGetProcAddressARB", NULL, 0);
    +     pglXGetProcAddressARB = wine_dlsym(RTLD_DEFAULT, "glXGetProcAddressARB",  NULL, 0);
         if (pglXGetProcAddressARB == NULL) {
              ERR("Could not find glXGetProcAddressARB in libGL, disabling  OpenGL.\n");
             goto failed;
    Credit goes to RoKFenris from this thread I suppose.

Page 3 of 3 FirstFirst 123

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 08:26 AM. 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