pointer to a function

Ask for Help on Using the Language With Memory Hacking Software

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

pointer to a function

Postby mezzo » Tue May 20, 2008 8:31 pm

I'm working on a bot framework that would allow a thread to read out certain
states (health, combat,money, etc) I call this the director_thread.
Based on that state, decide if tasks need to be added to the 'job queue'.

The jobqueue_thread is a different thread that works through a linked list (jobqueue),
each node being a job that is pending. The director_thread is allowed to
add jobs anywhere into the jobqueue, remove jobs, etc. The jobqueue_thread is desinged
to launch jobs when the previous one is done, or override the current one if the
director_thread tells to do so.

Can I put a pointer to a function as a field in a struct and cause it to be
executed when the jobqueue_thread reaches that node ?
- No thanks, I already have a penguin -
User avatar
mezzo
El Mariachi
 
Posts: 739
Joined: Mon Apr 30, 2007 10:27 pm
Location: Antwerp

Postby L. Spiro » Tue May 20, 2008 9:09 pm

Code: Select all
typedef BOOL (CALLBACK * Pf_FuncType)( DWORD dwParm1, LPVOID lpvParm 2 );
struct SUPER {
    Pf_FuncType  pfFunc;
};


SUPER sSuper;
sSuper.pfFunc( 1, (LPVOID)0x00400000 );


All modifications to the pointers should be done inside critical sections.


L. Spiro
Our songs remind you of songs you’ve never heard.
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan


Return to Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron