2 * JBP (Jim Peterson <jspeter@birch.ee.vt.edu>): Lots of stubs needed for
16 int CallTo32_LargeStack( int (*func
)(), int nbargs
, ...)
21 va_start(arglist
,nbargs
);
23 for(i
=0; i
<nbargs
; i
++) a
[i
]=va_arg(arglist
,int);
25 switch(nbargs
) /* Ewww... Icky. But what can I do? */
27 case 5: return func(a
[0],a
[1],a
[2],a
[3],a
[4]);
28 case 6: return func(a
[0],a
[1],a
[2],a
[3],a
[4],a
[5]);
29 case 8: return func(a
[0],a
[1],a
[2],a
[3],a
[4],a
[5],a
[6],a
[7]);
30 case 10: return func(a
[0],a
[1],a
[2],a
[3],a
[4],a
[5],a
[6],
32 case 11: return func(a
[0],a
[1],a
[2],a
[3],a
[4],a
[5],a
[6],
33 a
[7],a
[8],a
[9],a
[10]);
34 case 14: return func(a
[0],a
[1],a
[2],a
[3],a
[4],a
[5],a
[6],
35 a
[7],a
[8],a
[9],a
[10],a
[11],a
[12],a
[13]);
36 case 17: return func(a
[0],a
[1],a
[2],a
[3],a
[4],a
[5],a
[6],
37 a
[7],a
[8],a
[9],a
[10],a
[11],a
[12],a
[13],a
[14],a
[15],a
[16]);
38 default: fprintf(stderr
,"JBP: CallTo32_LargeStack called with unsupported "
39 "number of arguments (%d). Ignored.\n",nbargs
);
44 WORD
CallTo16_word_ ( FARPROC func
, WORD arg
) { return func(arg
); }
46 void GlobalFreeAll(HANDLE owner
)
48 fprintf(stderr
,"JBP: GlobalFreeAll() ignored.\n");
51 SEGPTR
WIN16_GlobalLock(HGLOBAL h
)
57 HLOCAL
LOCAL_Free( WORD ds
, HLOCAL handle
)
59 return LocalFree(handle
);
62 HLOCAL
LOCAL_Alloc( WORD ds
, WORD flags
, WORD size
)
64 return LocalAlloc(flags
,size
);
67 HLOCAL
LOCAL_ReAlloc( WORD ds
, HLOCAL handle
, WORD size
, WORD flags
)
69 return LocalReAlloc(handle
,size
,flags
);
72 NPVOID
LOCAL_Lock( WORD ds
, HLOCAL handle
)
74 return LocalLock(handle
);
77 BOOL
LOCAL_Unlock( WORD ds
, HLOCAL handle
)
79 fprintf(stderr
,"JBP: LOCAL_Unlock() ignored.\n");
83 WORD
LOCAL_Size( WORD ds
, HLOCAL handle
)
85 fprintf(stderr
,"JBP: LOCAL_Size() ignored.\n");
89 void FarSetOwner(HANDLE a
, WORD b
)
91 fprintf(stderr
,"JBP: FarSetOwner() ignored.\n");
94 #define GLOBAL_MAX_ALLOC_SIZE 0x00ff0000 /* Largest allocation is 16M - 64K */
96 HGLOBAL
GLOBAL_Alloc( WORD flags
, DWORD size
, HGLOBAL hOwner
,
97 BOOL isCode
, BOOL is32Bit
, BOOL isReadOnly
)
103 dprintf_global( stddeb
, "GLOBAL_Alloc: %ld flags=%04x\n", size
, flags
);
107 if (size
>= GLOBAL_MAX_ALLOC_SIZE
- 0x1f) return 0;
108 if (size
== 0) size
= 0x20;
109 else size
= (size
+ 0x1f) & ~0x1f;
111 /* Allocate the linear memory */
114 if ((flags
& GMEM_DDESHARE
) && Options
.ipc
)
115 ptr
= DDE_malloc(flags
, size
, &shmdata
);
117 #endif /* CONFIG_IPC */
118 ptr
= malloc( size
);
121 /* Allocate the selector(s) */
123 handle
= GLOBAL_CreateBlock( flags
, ptr
, size
, hOwner
,
124 isCode
, is32Bit
, isReadOnly
, &shmdata
);
131 if (flags
& GMEM_ZEROINIT
) memset( ptr
, 0, size
);
135 HGLOBAL
GLOBAL_CreateBlock( WORD flags
, void *ptr
, DWORD size
,
136 HGLOBAL hOwner
, BOOL isCode
,
137 BOOL is32Bit
, BOOL isReadOnly
,
140 /* fprintf(stderr,"JBP: GLOBAL_CreateBlock() faked.\n");*/
144 BOOL
GLOBAL_FreeBlock( HGLOBAL handle
)
146 /* fprintf(stderr,"JBP: GLOBAL_FreeBlock() ignored.\n");*/
150 HGLOBAL
GlobalHandle(LPCVOID a
)
152 fprintf(stderr
,"JBP: GlobalHandle() ignored.\n");
156 void *RELAY32_GetEntryPoint(char *dll_name
, char *item
, int hint
)
158 /* fprintf(stderr,"JBP: RELAY32_GetEntryPoint() ignored.\n");*/
162 extern LRESULT
AboutDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
163 extern LRESULT
ButtonWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
164 extern LRESULT
CARET_Callback(HWND
,UINT
,WPARAM
,LPARAM
);
165 extern LRESULT
ColorDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
166 extern LRESULT
ComboBoxWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
167 extern LRESULT
ComboLBoxWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
168 extern LRESULT
DesktopWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
169 extern LRESULT
EditWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
170 extern LRESULT
FileOpenDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
171 extern LRESULT
FileSaveDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
172 extern LRESULT
FindTextDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
173 extern LRESULT
ListBoxWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
174 extern LRESULT
MDIClientWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
175 extern LRESULT
PopupMenuWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
176 extern LRESULT
PrintDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
177 extern LRESULT
PrintSetupDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
178 extern LRESULT
ReplaceTextDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
179 extern LRESULT
ScrollBarWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
180 extern LRESULT
StaticWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
181 extern LRESULT
SystemMessageBoxProc(HWND
,UINT
,WPARAM
,LPARAM
);
182 extern LRESULT
TASK_Reschedule(HWND
,UINT
,WPARAM
,LPARAM
);
184 LRESULT
ErrorProc(HWND hWnd
,UINT msg
,WPARAM wParam
,LPARAM lParam
)
186 fprintf(stderr
,"ERROR: ErrorProc() called!\n");
190 /***********************************************************************
191 * GetWndProcEntry16 (not a Windows API function)
193 * Return an entry point from the WINPROCS dll.
195 WNDPROC
GetWndProcEntry16( char *name
)
197 #define MAP_STR_TO_PROC(str,proc) if(!strcmp(name,str))return proc
198 MAP_STR_TO_PROC("AboutDlgProc",AboutDlgProc
);
199 MAP_STR_TO_PROC("ButtonWndProc",ButtonWndProc
);
200 MAP_STR_TO_PROC("CARET_Callback",CARET_Callback
);
201 MAP_STR_TO_PROC("ColorDlgProc",ColorDlgProc
);
202 MAP_STR_TO_PROC("ComboBoxWndProc",ComboBoxWndProc
);
203 MAP_STR_TO_PROC("ComboLBoxWndProc",ComboLBoxWndProc
);
204 MAP_STR_TO_PROC("DefDlgProc",DefDlgProc
);
205 MAP_STR_TO_PROC("DesktopWndProc",DesktopWndProc
);
206 MAP_STR_TO_PROC("EditWndProc",EditWndProc
);
207 MAP_STR_TO_PROC("FileOpenDlgProc",FileOpenDlgProc
);
208 MAP_STR_TO_PROC("FileSaveDlgProc",FileSaveDlgProc
);
209 MAP_STR_TO_PROC("FindTextDlgProc",FindTextDlgProc
);
210 MAP_STR_TO_PROC("ListBoxWndProc",ListBoxWndProc
);
211 MAP_STR_TO_PROC("MDIClientWndProc",MDIClientWndProc
);
212 MAP_STR_TO_PROC("PopupMenuWndProc",PopupMenuWndProc
);
213 MAP_STR_TO_PROC("PrintDlgProc",PrintDlgProc
);
214 MAP_STR_TO_PROC("PrintSetupDlgProc",PrintSetupDlgProc
);
215 MAP_STR_TO_PROC("ReplaceTextDlgProc",ReplaceTextDlgProc
);
216 MAP_STR_TO_PROC("ScrollBarWndProc",ScrollBarWndProc
);
217 MAP_STR_TO_PROC("StaticWndProc",StaticWndProc
);
218 MAP_STR_TO_PROC("SystemMessageBoxProc",SystemMessageBoxProc
);
219 MAP_STR_TO_PROC("TASK_Reschedule",TASK_Reschedule
);