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 WINELIB_UNIMP("GlobalFreeAll()");
51 SEGPTR
WIN16_GlobalLock(HGLOBAL h
)
53 HLOCAL
LOCAL_Free(WORD ds
, HLOCAL handle
)
54 { return LocalFree(handle
); }
55 HLOCAL
LOCAL_Alloc(WORD ds
, WORD flags
, WORD size
)
56 { return LocalAlloc(flags
,size
); }
57 HLOCAL
LOCAL_ReAlloc(WORD ds
, HLOCAL handle
, WORD size
, WORD flags
)
58 { return LocalReAlloc(handle
,size
,flags
); }
59 NPVOID
LOCAL_Lock( WORD ds
, HLOCAL handle
)
60 { return LocalLock(handle
); }
61 BOOL
LOCAL_Unlock( WORD ds
, HLOCAL handle
)
62 { return LocalUnlock(handle
); }
63 WORD
LOCAL_Size( WORD ds
, HLOCAL handle
)
64 { return LocalSize(handle
); }
66 void FarSetOwner(HANDLE a
, WORD b
)
68 WINELIB_UNIMP("FarSetOwner()");
71 #define GLOBAL_MAX_ALLOC_SIZE 0x00ff0000 /* Largest allocation is 16M - 64K */
73 HGLOBAL
GLOBAL_Alloc( WORD flags
, DWORD size
, HGLOBAL hOwner
,
74 BOOL isCode
, BOOL is32Bit
, BOOL isReadOnly
)
80 dprintf_global( stddeb
, "GLOBAL_Alloc: %ld flags=%04x\n", size
, flags
);
84 if (size
>= GLOBAL_MAX_ALLOC_SIZE
- 0x1f) return 0;
85 if (size
== 0) size
= 0x20;
86 else size
= (size
+ 0x1f) & ~0x1f;
88 /* Allocate the linear memory */
91 if ((flags
& GMEM_DDESHARE
) && Options
.ipc
)
92 ptr
= DDE_malloc(flags
, size
, &shmdata
);
94 #endif /* CONFIG_IPC */
98 /* Allocate the selector(s) */
100 handle
= GLOBAL_CreateBlock( flags
, ptr
, size
, hOwner
,
101 isCode
, is32Bit
, isReadOnly
, &shmdata
);
108 if (flags
& GMEM_ZEROINIT
) memset( ptr
, 0, size
);
112 HGLOBAL
GLOBAL_CreateBlock( WORD flags
, const void *ptr
, DWORD size
,
113 HGLOBAL hOwner
, BOOL isCode
,
114 BOOL is32Bit
, BOOL isReadOnly
,
120 BOOL
GLOBAL_FreeBlock( HGLOBAL handle
)
125 HGLOBAL
GlobalHandle(LPCVOID a
)
127 fprintf(stderr
,"JBP: GlobalHandle() ignored.\n");
131 void *RELAY32_GetEntryPoint(char *dll_name
, char *item
, int hint
)
136 extern LRESULT
ACTIVATEAPP_callback(HWND
,UINT
,WPARAM
,LPARAM
);
137 extern LRESULT
AboutDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
138 extern LRESULT
ButtonWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
139 extern LRESULT
CARET_Callback(HWND
,UINT
,WPARAM
,LPARAM
);
140 extern LRESULT
ColorDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
141 extern LRESULT
ComboBoxWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
142 extern LRESULT
ComboLBoxWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
143 extern LRESULT
DesktopWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
144 extern LRESULT
EditWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
145 extern LRESULT
FileOpenDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
146 extern LRESULT
FileSaveDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
147 extern LRESULT
FindTextDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
148 extern LRESULT
ListBoxWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
149 extern LRESULT
MDIClientWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
150 extern LRESULT
PopupMenuWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
151 extern LRESULT
PrintDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
152 extern LRESULT
PrintSetupDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
153 extern LRESULT
ReplaceTextDlgProc(HWND
,UINT
,WPARAM
,LPARAM
);
154 extern LRESULT
ScrollBarWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
155 extern LRESULT
StaticWndProc(HWND
,UINT
,WPARAM
,LPARAM
);
156 extern LRESULT
SystemMessageBoxProc(HWND
,UINT
,WPARAM
,LPARAM
);
157 extern LRESULT
TASK_Reschedule(HWND
,UINT
,WPARAM
,LPARAM
);
159 LRESULT
ErrorProc(HWND hWnd
,UINT msg
,WPARAM wParam
,LPARAM lParam
)
161 fprintf(stderr
,"ERROR: ErrorProc() called!\n");
165 /***********************************************************************
166 * GetWndProcEntry16 (not a Windows API function)
168 * Return an entry point from the WINPROCS dll.
170 WNDPROC
GetWndProcEntry16( char *name
)
172 #define MAP_STR_TO_PROC(str,proc) if(!strcmp(name,str))return proc
173 MAP_STR_TO_PROC("ActivateAppProc",ACTIVATEAPP_callback
);
174 MAP_STR_TO_PROC("AboutDlgProc",AboutDlgProc
);
175 MAP_STR_TO_PROC("ButtonWndProc",ButtonWndProc
);
176 MAP_STR_TO_PROC("CARET_Callback",CARET_Callback
);
177 MAP_STR_TO_PROC("ColorDlgProc",ColorDlgProc
);
178 MAP_STR_TO_PROC("ComboBoxWndProc",ComboBoxWndProc
);
179 MAP_STR_TO_PROC("ComboLBoxWndProc",ComboLBoxWndProc
);
180 MAP_STR_TO_PROC("DefDlgProc",DefDlgProc
);
181 MAP_STR_TO_PROC("DesktopWndProc",DesktopWndProc
);
182 MAP_STR_TO_PROC("EditWndProc",EditWndProc
);
183 MAP_STR_TO_PROC("FileOpenDlgProc",FileOpenDlgProc
);
184 MAP_STR_TO_PROC("FileSaveDlgProc",FileSaveDlgProc
);
185 MAP_STR_TO_PROC("FindTextDlgProc",FindTextDlgProc
);
186 MAP_STR_TO_PROC("ListBoxWndProc",ListBoxWndProc
);
187 MAP_STR_TO_PROC("MDIClientWndProc",MDIClientWndProc
);
188 MAP_STR_TO_PROC("PopupMenuWndProc",PopupMenuWndProc
);
189 MAP_STR_TO_PROC("PrintDlgProc",PrintDlgProc
);
190 MAP_STR_TO_PROC("PrintSetupDlgProc",PrintSetupDlgProc
);
191 MAP_STR_TO_PROC("ReplaceTextDlgProc",ReplaceTextDlgProc
);
192 MAP_STR_TO_PROC("ScrollBarWndProc",ScrollBarWndProc
);
193 MAP_STR_TO_PROC("StaticWndProc",StaticWndProc
);
194 MAP_STR_TO_PROC("SystemMessageBoxProc",SystemMessageBoxProc
);
195 MAP_STR_TO_PROC("TASK_Reschedule",TASK_Reschedule
);
196 fprintf(stderr
,"warning: No mapping for %s(), add one in library/miscstubs.c\n",name
);