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 if (UsesLParamPtr(message
))
41 return RELAY32_CallWindowProc(a
->win32
,hwnd
,message
,wParam
,lParam
? PTR_SEG_TO_LIN(lParam
): 0);
43 return RELAY32_CallWindowProc(a
->win32
,hwnd
,message
,wParam
,lParam
);
46 /**********************************************************************
49 int Catch( LPCATCHBUF lpbuf
)
51 STACK16FRAME
*pFrame
= CURRENT_STACK16
;
53 dprintf_catch( stddeb
, "Catch: buf=%p ss:sp=%04x:%04x\n",
54 lpbuf
, IF1632_Saved16_ss
, IF1632_Saved16_sp
);
56 /* Note: we don't save the current ss, as the catch buffer is */
57 /* only 9 words long. Hopefully no one will have the silly */
58 /* idea to change the current stack before calling Throw()... */
60 lpbuf
[0] = IF1632_Saved16_sp
;
61 lpbuf
[1] = LOWORD(IF1632_Saved32_esp
);
62 lpbuf
[2] = HIWORD(IF1632_Saved32_esp
);
63 lpbuf
[3] = pFrame
->saved_ss
;
64 lpbuf
[4] = pFrame
->saved_sp
;
65 lpbuf
[5] = pFrame
->ds
;
66 lpbuf
[6] = pFrame
->bp
;
67 lpbuf
[7] = pFrame
->ip
;
68 lpbuf
[8] = pFrame
->cs
;
73 /**********************************************************************
76 int Throw( LPCATCHBUF lpbuf
, int retval
)
80 dprintf_catch( stddeb
, "Throw: buf=%p val=%04x ss:sp=%04x:%04x\n",
81 lpbuf
, retval
, IF1632_Saved16_ss
, IF1632_Saved16_sp
);
83 IF1632_Saved16_sp
= lpbuf
[0] - sizeof(WORD
);
84 IF1632_Saved32_esp
= MAKELONG( lpbuf
[1], lpbuf
[2] );
85 pFrame
= CURRENT_STACK16
;
86 pFrame
->saved_ss
= lpbuf
[3];
87 pFrame
->saved_sp
= lpbuf
[4];
88 pFrame
->ds
= lpbuf
[5];
89 pFrame
->bp
= lpbuf
[6];
90 pFrame
->ip
= lpbuf
[7];
91 pFrame
->cs
= lpbuf
[8];