3 static char RCSId[] = "$Id: wine.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
4 static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
11 #include "stackframe.h"
19 /**********************************************************************
20 * CallWindowProc (USER.122)
22 LONG
CallWindowProc( WNDPROC func
, HWND hwnd
, WORD message
,
23 WORD wParam
, LONG lParam
)
26 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
28 if (!wndPtr
) return 0;
30 /* check if we have something better than 16 bit relays */
31 if(!ALIAS_UseAliases
|| !(a
=ALIAS_LookupAlias((DWORD
)func
)) ||
32 (!a
->wine
&& !a
->win32
))
33 return CallWndProc( (FARPROC
)func
, wndPtr
->hInstance
,
34 hwnd
, message
, wParam
, lParam
);
36 return ((LONG(*)(WORD
,WORD
,WORD
,LONG
))(a
->wine
))
37 (hwnd
,message
,wParam
,lParam
);
39 fprintf(stderr
,"Where is the Win32 callback?\n");
40 return RELAY32_CallWindowProc(a
->win32
,hwnd
,message
,wParam
,lParam
);
44 /**********************************************************************
47 int Catch( LPCATCHBUF lpbuf
)
49 STACK16FRAME
*pFrame
= CURRENT_STACK16
;
51 dprintf_catch( stddeb
, "Catch: buf=%p ss:sp=%04x:%04x\n",
52 lpbuf
, IF1632_Saved16_ss
, IF1632_Saved16_sp
);
54 /* Note: we don't save the current ss, as the catch buffer is */
55 /* only 9 words long. Hopefully no one will have the silly */
56 /* idea to change the current stack before calling Throw()... */
58 lpbuf
[0] = IF1632_Saved16_sp
;
59 lpbuf
[1] = LOWORD(IF1632_Saved32_esp
);
60 lpbuf
[2] = HIWORD(IF1632_Saved32_esp
);
61 lpbuf
[3] = pFrame
->saved_ss
;
62 lpbuf
[4] = pFrame
->saved_sp
;
63 lpbuf
[5] = pFrame
->ds
;
64 lpbuf
[6] = pFrame
->bp
;
65 lpbuf
[7] = pFrame
->ip
;
66 lpbuf
[8] = pFrame
->cs
;
71 /**********************************************************************
74 int Throw( LPCATCHBUF lpbuf
, int retval
)
78 dprintf_catch( stddeb
, "Throw: buf=%p val=%04x ss:sp=%04x:%04x\n",
79 lpbuf
, retval
, IF1632_Saved16_ss
, IF1632_Saved16_sp
);
81 IF1632_Saved16_sp
= lpbuf
[0] - sizeof(WORD
);
82 IF1632_Saved32_esp
= MAKELONG( lpbuf
[1], lpbuf
[2] );
83 pFrame
= CURRENT_STACK16
;
84 pFrame
->saved_ss
= lpbuf
[3];
85 pFrame
->saved_sp
= lpbuf
[4];
86 pFrame
->ds
= lpbuf
[5];
87 pFrame
->bp
= lpbuf
[6];
88 pFrame
->ip
= lpbuf
[7];
89 pFrame
->cs
= lpbuf
[8];