Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4616838
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:02:23+00:00 2026-05-22T02:02:23+00:00

I am trying to learn a few different methods of calling functions by address.

  • 0

I am trying to learn a few different methods of calling functions by address.

bool gl_draw_text(uint x, uint y, uint color, uint alpha, char *fmt);

This function is what I’m calling. The following, is how I’m currently calling it. (And it works fine.)

static void glDrawText(char* text, int x, int y)
{
DWORD func = 0x10057970;

__asm
{
    push text
    push 255
    push 14
    push y
    push x
    call dword ptr [func]
    }
}

The method I want to use is this one.

void Hack()
{
    bool (draw*)(uint, uint, uint, uint, char*);
    draw = 0x10057970;
    (draw)(20, 20, 14, 255, "Text");
}

But, I don’t know how to properly cast the address to the function to make it work\compile. ?

There is also a method that uses a virtual function, I’m curious about how that method works too. (I can also use MS Detours, to hook, then call the function like that, how does that method work behind the scenes, if you know.)

So to be clear, I’m just asking for various methods of accomplishing this task, but listed a few I’m curious about after reading about them, etc,.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:02:24+00:00Added an answer on May 22, 2026 at 2:02 am

    This code compiles (see http://ideone.com/celq1):

    typedef unsigned int uint ;
    int main()
    {
        bool (*draw)(uint, uint, uint, uint, const char*);
        draw = reinterpret_cast<bool (*)(uint, uint, uint, uint, const char*)>(0x10057970);
        draw(20, 20, 14, 255, "Text");
    }
    

    But of course it doesn’t run 🙂
    PS I changed char* to const char* to get rid of a compiler warning. It looks like const char* is what you want here, but it’s not essential to the idea.

    Edited to add: In fact, even this compiles, if you want to impress your friends:

    typedef unsigned int uint ;
    int main()
    {
        reinterpret_cast<bool (*)(uint, uint, uint, uint, const char*)>(0x10057970)
          (20, 20, 14, 255, "Text");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For the past few weeks, I've been trying to learn about just how email
I'm trying really hard to learn vim after using TextMate for the last few
I am trying to learn cocoa and have a few problems with KVC and
I am trying to learn a few things from http://code.google.com/p/iosched/source/checkout . I wanted to
I am trying to learn django framework with few sample applications. Currently, I am
I have been trying to learn Java for the past few days so my
Trying to learn a bit of CSS and I want a horizontal navbar and
In trying to learn how to create objects in ActionScript, I have had no
I'm trying to learn C. As a C# developer, my IDE is Visual Studio.
I am trying to learn the keyboard shortcuts in Visual Studio in order to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.