- Add math calls: scalb, fpclass, nextafter, logb, _CI*
[wine/hacks.git] / include / callback.h
blob7813e4015416ef0ed862aa1c9450aead6f9ec67c
1 /*
2 * Callback functions
4 * Copyright 1995 Alexandre Julliard
5 */
7 #ifndef __WINE_CALLBACK_H
8 #define __WINE_CALLBACK_H
10 #include "windef.h"
11 #include "winnt.h"
12 #include "wingdi.h"
13 #include "wine/winuser16.h"
15 extern void SYSDEPS_SwitchToThreadStack( void (*func)(void) ) WINE_NORETURN;
16 extern int SYSDEPS_CallOnLargeStack( int (*func)(void *), void *arg );
18 #define CALL_LARGE_STACK( func, arg ) \
19 SYSDEPS_CallOnLargeStack( (int (*)(void *))(func), (void *)(arg) )
21 typedef void (*RELAY)();
22 extern FARPROC THUNK_Alloc( FARPROC16 func, RELAY relay );
23 extern void THUNK_Free( FARPROC thunk );
24 extern BOOL THUNK_Init(void);
25 extern void THUNK_InitCallout(void);
28 typedef struct
30 BOOL WINAPI (*PeekMessageA)( LPMSG, HWND, UINT, UINT, UINT );
31 BOOL WINAPI (*GetMessageA)( MSG*, HWND, UINT, UINT );
32 LRESULT WINAPI (*SendMessageA)( HWND, UINT, WPARAM, LPARAM );
33 BOOL WINAPI (*PostMessageA)( HWND, UINT, WPARAM, LPARAM );
34 BOOL WINAPI (*TranslateMessage)( const MSG *msg );
35 LONG WINAPI (*DispatchMessageA)( const MSG* msg );
36 BOOL WINAPI (*RedrawWindow)( HWND, const RECT *, HRGN, UINT );
37 WORD WINAPI (*UserSignalProc)( UINT, DWORD, DWORD, HMODULE16 );
38 void WINAPI (*FinalUserInit16)( void );
39 HQUEUE16 WINAPI (*InitThreadInput16)( WORD, WORD );
40 void WINAPI (*UserYield16)( void );
41 WORD WINAPI (*DestroyIcon32)( HGLOBAL16, UINT16 );
42 DWORD WINAPI (*WaitForInputIdle)( HANDLE, DWORD );
43 DWORD WINAPI (*MsgWaitForMultipleObjects)( DWORD, HANDLE *, BOOL, DWORD, DWORD );
44 HWND WINAPI (*WindowFromDC)( HDC );
45 INT WINAPI (*MessageBoxA)( HWND, LPCSTR, LPCSTR, UINT );
46 INT WINAPI (*MessageBoxW)( HWND, LPCWSTR, LPCWSTR, UINT );
47 } CALLOUT_TABLE;
49 extern CALLOUT_TABLE Callout;
51 #include "pshpack1.h"
53 typedef struct tagTHUNK
55 BYTE popl_eax; /* 0x58 popl %eax (return address)*/
56 BYTE pushl_func; /* 0x68 pushl $proc */
57 FARPROC16 proc WINE_PACKED;
58 BYTE pushl_eax; /* 0x50 pushl %eax */
59 BYTE jmp; /* 0xe9 jmp relay (relative jump)*/
60 RELAY relay WINE_PACKED;
61 struct tagTHUNK *next WINE_PACKED;
62 DWORD magic;
63 } THUNK;
65 #include "poppack.h"
67 #define CALLTO16_THUNK_MAGIC 0x54484e4b /* "THNK" */
69 #define DECL_THUNK(aname,aproc,arelay) \
70 THUNK aname; \
71 aname.popl_eax = 0x58; \
72 aname.pushl_func = 0x68; \
73 aname.proc = (FARPROC) (aproc); \
74 aname.pushl_eax = 0x50; \
75 aname.jmp = 0xe9; \
76 aname.relay = (RELAY)((char *)(arelay) - (char *)(&(aname).next)); \
77 aname.next = NULL; \
78 aname.magic = CALLTO16_THUNK_MAGIC;
80 #endif /* __WINE_CALLBACK_H */