4 * Copyright 1995 Alexandre Julliard
7 #ifndef __WINE_CALLBACK_H
8 #define __WINE_CALLBACK_H
13 #include "wine/winuser16.h"
15 extern void SYSDEPS_SwitchToThreadStack( void (*func)(void) ) WINE_NORETURN;
17 typedef void (*RELAY)();
18 extern FARPROC THUNK_Alloc( FARPROC16 func, RELAY relay );
19 extern void THUNK_Free( FARPROC thunk );
20 extern BOOL THUNK_Init(void);
21 extern void THUNK_InitCallout(void);
26 WORD WINAPI (*UserSignalProc)( UINT, DWORD, DWORD, HMODULE16 );
27 WORD WINAPI (*DestroyIcon32)( HGLOBAL16, UINT16 );
30 extern CALLOUT_TABLE Callout;
34 struct _DOSTASK* WINAPI (*Current)( void );
35 struct _DOSTASK* WINAPI (*LoadDPMI)( void );
36 void WINAPI (*LoadDosExe)( LPCSTR filename, HANDLE hFile );
37 BOOL WINAPI (*Exec)( CONTEXT86 *context, LPCSTR filename, BYTE func, LPVOID paramblk );
38 void WINAPI (*Exit)( CONTEXT86 *context, BOOL cs_psp, WORD retval );
39 int WINAPI (*Enter)( CONTEXT86 *context );
40 void WINAPI (*RunInThread)( PAPCFUNC proc, ULONG_PTR arg );
41 void WINAPI (*Wait)( int read_pipe, HANDLE hObject );
42 void WINAPI (*QueueEvent)( int irq, int priority, void (*relay)(CONTEXT86*,void*), void *data );
43 void WINAPI (*OutPIC)( WORD port, BYTE val );
44 void WINAPI (*SetTimer)( unsigned ticks );
45 unsigned WINAPI (*GetTimer)( void );
46 BYTE WINAPI (*KbdReadScan)( BYTE *ascii );
49 extern DOSVM_TABLE Dosvm;
54 typedef struct tagTHUNK
56 BYTE popl_eax; /* 0x58 popl %eax (return address)*/
57 BYTE pushl_func; /* 0x68 pushl $proc */
58 FARPROC16 proc WINE_PACKED;
59 BYTE pushl_eax; /* 0x50 pushl %eax */
60 BYTE jmp; /* 0xe9 jmp relay (relative jump)*/
61 RELAY relay WINE_PACKED;
62 struct tagTHUNK *next WINE_PACKED;
68 #define CALLTO16_THUNK_MAGIC 0x54484e4b /* "THNK" */
70 #define DECL_THUNK(aname,aproc,arelay) \
72 aname.popl_eax = 0x58; \
73 aname.pushl_func = 0x68; \
74 aname.proc = (FARPROC16) (aproc); \
75 aname.pushl_eax = 0x50; \
77 aname.relay = (RELAY)((char *)(arelay) - (char *)(&(aname).next)); \
79 aname.magic = CALLTO16_THUNK_MAGIC;
81 #endif /* __WINE_CALLBACK_H */