2 * JBP (Jim Peterson <jspeter@birch.ee.vt.edu>): Lots of stubs needed for
17 int CallTo32_LargeStack( int (*func)(), int nbargs, ...)
22 va_start(arglist,nbargs);
24 for(i=0; i<nbargs; i++) a[i]=va_arg(arglist,int);
26 switch(nbargs) /* Ewww... Icky. But what can I do? */
28 case 5: return func(a[0],a[1],a[2],a[3],a[4]);
29 case 6: return func(a[0],a[1],a[2],a[3],a[4],a[5]);
30 case 8: return func(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]);
31 case 10: return func(a[0],a[1],a[2],a[3],a[4],a[5],a[6],
33 case 11: return func(a[0],a[1],a[2],a[3],a[4],a[5],a[6],
34 a[7],a[8],a[9],a[10]);
35 case 14: return func(a[0],a[1],a[2],a[3],a[4],a[5],a[6],
36 a[7],a[8],a[9],a[10],a[11],a[12],a[13]);
37 case 17: return func(a[0],a[1],a[2],a[3],a[4],a[5],a[6],
38 a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15],a[16]);
39 default: fprintf(stderr,"JBP: CallTo32_LargeStack called with unsupported "
40 "number of arguments (%d). Ignored.\n",nbargs);
45 WORD CallTo16_word_ ( FARPROC func, WORD arg ) { return func(arg); }
47 void GlobalFreeAll(HANDLE owner)
49 WINELIB_UNIMP("GlobalFreeAll()");
52 SEGPTR WIN16_GlobalLock(HGLOBAL h)
54 HLOCAL LOCAL_Free(WORD ds, HLOCAL handle)
55 { return LocalFree(handle); }
56 HLOCAL LOCAL_Alloc(WORD ds, WORD flags, WORD size)
57 { return LocalAlloc(flags,size); }
58 HLOCAL LOCAL_ReAlloc(WORD ds, HLOCAL handle, WORD size, WORD flags)
59 { return LocalReAlloc(handle,size,flags); }
60 NPVOID LOCAL_Lock( WORD ds, HLOCAL handle )
61 { return LocalLock(handle); }
62 BOOL LOCAL_Unlock( WORD ds, HLOCAL handle )
63 { return LocalUnlock(handle); }
64 WORD LOCAL_Size( WORD ds, HLOCAL handle )
65 { return LocalSize(handle); }
67 void FarSetOwner(HANDLE a, HANDLE b)
69 WINELIB_UNIMP("FarSetOwner()");
72 #define GLOBAL_MAX_ALLOC_SIZE 0x00ff0000 /* Largest allocation is 16M - 64K */
74 HGLOBAL GLOBAL_Alloc( WORD flags, DWORD size, HGLOBAL hOwner,
75 BOOL isCode, BOOL is32Bit, BOOL isReadOnly )
81 dprintf_global( stddeb, "GLOBAL_Alloc: %ld flags=%04x\n", size, flags );
85 if (size >= GLOBAL_MAX_ALLOC_SIZE - 0x1f) return 0;
86 if (size == 0) size = 0x20;
87 else size = (size + 0x1f) & ~0x1f;
89 /* Allocate the linear memory */
92 if ((flags & GMEM_DDESHARE) && Options.ipc)
93 ptr = DDE_malloc(flags, size, &shmdata);
95 #endif /* CONFIG_IPC */
99 /* Allocate the selector(s) */
101 handle = GLOBAL_CreateBlock( flags, ptr, size, hOwner,
102 isCode, is32Bit, isReadOnly, &shmdata);
109 if (flags & GMEM_ZEROINIT) memset( ptr, 0, size );
113 HGLOBAL GLOBAL_CreateBlock( WORD flags, const void *ptr, DWORD size,
114 HGLOBAL hOwner, BOOL isCode,
115 BOOL is32Bit, BOOL isReadOnly,
121 BOOL GLOBAL_FreeBlock( HGLOBAL handle )
126 HGLOBAL GlobalHandle(LPCVOID a)
128 fprintf(stderr,"JBP: GlobalHandle() ignored.\n");
132 WIN32_builtin *RELAY32_GetBuiltinDLL(char *name)
137 void *RELAY32_GetEntryPoint(WIN32_builtin *dll, char *item, int hint)
142 extern LRESULT ACTIVATEAPP_callback(HWND,UINT,WPARAM,LPARAM);
143 extern LRESULT AboutDlgProc(HWND,UINT,WPARAM,LPARAM);
144 extern LRESULT ButtonWndProc(HWND,UINT,WPARAM,LPARAM);
145 extern LRESULT CARET_Callback(HWND,UINT,WPARAM,LPARAM);
146 extern LRESULT ColorDlgProc(HWND,UINT,WPARAM,LPARAM);
147 extern LRESULT ComboBoxWndProc(HWND,UINT,WPARAM,LPARAM);
148 extern LRESULT ComboLBoxWndProc(HWND,UINT,WPARAM,LPARAM);
149 extern LRESULT DesktopWndProc(HWND,UINT,WPARAM,LPARAM);
150 extern LRESULT EditWndProc(HWND,UINT,WPARAM,LPARAM);
151 extern LRESULT FileOpenDlgProc(HWND,UINT,WPARAM,LPARAM);
152 extern LRESULT FileSaveDlgProc(HWND,UINT,WPARAM,LPARAM);
153 extern LRESULT FindTextDlgProc(HWND,UINT,WPARAM,LPARAM);
154 extern LRESULT ListBoxWndProc(HWND,UINT,WPARAM,LPARAM);
155 extern LRESULT MDIClientWndProc(HWND,UINT,WPARAM,LPARAM);
156 extern LRESULT PopupMenuWndProc(HWND,UINT,WPARAM,LPARAM);
157 extern LRESULT PrintDlgProc(HWND,UINT,WPARAM,LPARAM);
158 extern LRESULT PrintSetupDlgProc(HWND,UINT,WPARAM,LPARAM);
159 extern LRESULT ReplaceTextDlgProc(HWND,UINT,WPARAM,LPARAM);
160 extern LRESULT ScrollBarWndProc(HWND,UINT,WPARAM,LPARAM);
161 extern LRESULT StaticWndProc(HWND,UINT,WPARAM,LPARAM);
162 extern LRESULT SystemMessageBoxProc(HWND,UINT,WPARAM,LPARAM);
163 extern LRESULT TASK_Reschedule(HWND,UINT,WPARAM,LPARAM);
165 LRESULT ErrorProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
167 fprintf(stderr,"ERROR: ErrorProc() called!\n");
171 /***********************************************************************
172 * GetWndProcEntry16 (not a Windows API function)
174 * Return an entry point from the WINPROCS dll.
176 WNDPROC GetWndProcEntry16( char *name )
178 #define MAP_STR_TO_PROC(str,proc) if(!strcmp(name,str))return proc
179 MAP_STR_TO_PROC("ActivateAppProc",ACTIVATEAPP_callback);
180 MAP_STR_TO_PROC("AboutDlgProc",AboutDlgProc);
181 MAP_STR_TO_PROC("ButtonWndProc",ButtonWndProc);
182 MAP_STR_TO_PROC("CARET_Callback",CARET_Callback);
183 MAP_STR_TO_PROC("ColorDlgProc",ColorDlgProc);
184 MAP_STR_TO_PROC("ComboBoxWndProc",ComboBoxWndProc);
185 MAP_STR_TO_PROC("ComboLBoxWndProc",ComboLBoxWndProc);
186 MAP_STR_TO_PROC("DefDlgProc",DefDlgProc);
187 MAP_STR_TO_PROC("DesktopWndProc",DesktopWndProc);
188 MAP_STR_TO_PROC("EditWndProc",EditWndProc);
189 MAP_STR_TO_PROC("FileOpenDlgProc",FileOpenDlgProc);
190 MAP_STR_TO_PROC("FileSaveDlgProc",FileSaveDlgProc);
191 MAP_STR_TO_PROC("FindTextDlgProc",FindTextDlgProc);
192 MAP_STR_TO_PROC("ListBoxWndProc",ListBoxWndProc);
193 MAP_STR_TO_PROC("MDIClientWndProc",MDIClientWndProc);
194 MAP_STR_TO_PROC("PopupMenuWndProc",PopupMenuWndProc);
195 MAP_STR_TO_PROC("PrintDlgProc",PrintDlgProc);
196 MAP_STR_TO_PROC("PrintSetupDlgProc",PrintSetupDlgProc);
197 MAP_STR_TO_PROC("ReplaceTextDlgProc",ReplaceTextDlgProc);
198 MAP_STR_TO_PROC("ScrollBarWndProc",ScrollBarWndProc);
199 MAP_STR_TO_PROC("StaticWndProc",StaticWndProc);
200 MAP_STR_TO_PROC("SystemMessageBoxProc",SystemMessageBoxProc);
201 MAP_STR_TO_PROC("TASK_Reschedule",TASK_Reschedule);
202 fprintf(stderr,"warning: No mapping for %s(), add one in library/miscstubs.c\n",name);