So I'm doing stuff like this (in C++):
//Pointer to a standard windows processing function
typedef LRESULT (CALLBACK* MsgFuncPtr)(HWND, UINT, WPARAM, LPARAM);
MsgFuncPtr def_on_message;
LRESULT CALLBACK eng_on_message(HWND win, UINT msg, WPARAM p1, LPARAM p2);
int APIENTRY WinMain([...])
{
ENGINE_VARS* ev = engine_open();
[...]
//I want to do something like this
def_on_message = (MsgFuncPtr)v(on_message);
v(on_message) = (EVENT)eng_on_message;
}
As you can see I'm trying to simply store a pointer (in C++) to the default on_message function (defined in the environment variables) inside a variable called def_on_message.
The problem is, ev->on_message is of the type EVENT* (which is just a pointer to a byte array).
How do I store the default ev->on_message so that I can call it from some other function later?
(by the way when I run the above code I get an access violation when eng_on_message is run probably because I'm storying def_on_message wrong).