Take advantage of the new registers saved in the STACK16FRAME to turn
some 'register' functions into normal functions.
Removed the few remaining 'return' functions to simplify relay
handling.
diff --git a/if1632/dummy.c b/if1632/dummy.c
index 8af0fb2..0c2d93f 100644
--- a/if1632/dummy.c
+++ b/if1632/dummy.c
@@ -53,3 +53,4 @@
long WINAPI stub_USER_920(void) { FIXME("stub\n"); return 0; }
long WINAPI stub_USER_922(void) { FIXME("stub\n"); return 0; }
long WINAPI stub_USER_923(void) { FIXME("stub\n"); return 0; }
+long WINAPI KERNEL_nop(void) { return 0; }
diff --git a/if1632/kernel.spec b/if1632/kernel.spec
index 1c8de60..d77d7e7 100644
--- a/if1632/kernel.spec
+++ b/if1632/kernel.spec
@@ -9,7 +9,7 @@
2 pascal16 ExitKernel() ExitKernel16
3 pascal GetVersion() GetVersion16
4 pascal16 LocalInit(word word word) LocalInit16
-5 register LocalAlloc(word word) WIN16_LocalAlloc
+5 pascal16 LocalAlloc(word word) LocalAlloc16
6 pascal16 LocalReAlloc(word word word) LocalReAlloc16
7 pascal16 LocalFree(word) LocalFree16
8 pascal LocalLock(word) LocalLock16
@@ -43,8 +43,8 @@
36 pascal GetCurrentTask() WIN16_GetCurrentTask
37 pascal GetCurrentPDB() GetCurrentPDB16
38 pascal SetTaskSignalProc(word segptr) THUNK_SetTaskSignalProc
-41 return EnableDos 0 0
-42 return DisableDos 0 0
+41 pascal16 EnableDos() KERNEL_nop
+42 pascal16 DisableDos() KERNEL_nop
45 pascal16 LoadModule(str ptr) LoadModule16
46 pascal16 FreeModule(word) FreeModule16
47 pascal GetModuleHandle(segstr) WIN16_GetModuleHandle
@@ -99,9 +99,9 @@
95 pascal16 LoadLibrary(str) LoadLibrary16
96 pascal16 FreeLibrary(word) FreeLibrary16
97 pascal16 GetTempFileName(word str word ptr) GetTempFileName16
-98 return GetLastDiskChange 0 0
+98 pascal16 GetLastDiskChange() KERNEL_nop
99 stub GetLPErrMode
-100 return ValidateCodeSegments 0 0
+100 pascal16 ValidateCodeSegments() KERNEL_nop
101 stub NoHookDosCall
102 register DOS3Call() DOS3Call
103 register NetBIOSCall() NetBIOSCall16
@@ -119,14 +119,14 @@
115 pascal16 OutputDebugString(str) OutputDebugString16
116 stub InitLib
117 pascal16 OldYield() OldYield16
-118 register GetTaskQueueDS() GetTaskQueueDS16
-119 register GetTaskQueueES() GetTaskQueueES16
+118 pascal16 GetTaskQueueDS() GetTaskQueueDS16
+119 pascal16 GetTaskQueueES() GetTaskQueueES16
120 stub UndefDynLink
121 pascal16 LocalShrink(word word) LocalShrink16
122 pascal16 IsTaskLocked() IsTaskLocked16
-123 return KbdRst 0 0
-124 return EnableKernel 0 0
-125 return DisableKernel 0 0
+123 pascal16 KbdRst() KERNEL_nop
+124 pascal16 EnableKernel() KERNEL_nop
+125 pascal16 DisableKernel() KERNEL_nop
126 stub MemoryFreed
127 pascal16 GetPrivateProfileInt(str str s_word str) GetPrivateProfileInt16
128 pascal16 GetPrivateProfileString(str str str ptr word str)
@@ -136,7 +136,7 @@
130 pascal FileCDR(ptr) FileCDR16
131 pascal GetDOSEnvironment() GetDOSEnvironment16
132 pascal GetWinFlags() GetWinFlags16
-133 register GetExePtr(word) WIN16_GetExePtr
+133 pascal16 GetExePtr(word) GetExePtr
134 pascal16 GetWindowsDirectory(ptr word) GetWindowsDirectory16
135 pascal16 GetSystemDirectory(ptr word) GetSystemDirectory16
136 pascal16 GetDriveType(word) GetDriveType16
@@ -158,16 +158,16 @@
152 pascal16 GetNumTasks() GetNumTasks16
154 pascal16 GlobalNotify(segptr) GlobalNotify16
155 pascal16 GetTaskDS() GetTaskDS16
-156 return LimitEMSPages 4 0
-157 return GetCurPID 4 0
-158 return IsWinOldApTask 2 0
+156 pascal LimitEMSPages(long) LimitEMSPages16
+157 pascal GetCurPID(long) GetCurPID16
+158 pascal16 IsWinOldApTask(word) IsWinOldApTask16
159 pascal GlobalHandleNoRIP(word) GlobalHandleNoRIP16
160 stub EMSCopy
161 pascal16 LocalCountFree() LocalCountFree16
162 pascal16 LocalHeapSize() LocalHeapSize16
163 pascal16 GlobalLRUOldest(word) GlobalLRUOldest16
164 pascal16 GlobalLRUNewest(word) GlobalLRUNewest16
-165 return A20Proc 2 0
+165 pascal16 A20Proc(word) A20Proc16
166 pascal16 WinExec(str word) WinExec16
167 pascal16 GetExpWinVer(word) GetExpWinVer16
168 pascal16 DirectResAlloc(word word word) DirectResAlloc16
@@ -202,7 +202,7 @@
197 pascal16 GlobalFix(word) GlobalFix16
198 pascal16 GlobalUnfix(word) GlobalUnfix16
199 pascal16 SetHandleCount(word) SetHandleCount16
-200 return ValidateFreeSpaces 0 0
+200 pascal16 ValidateFreeSpaces() KERNEL_nop
201 stub ReplaceInst
202 stub RegisterPtrace
203 register DebugBreak() DebugBreak16
@@ -243,7 +243,7 @@
234 stub RegSaveKey
235 stub InvalidateNlsCache
236 stub GetProductName
-237 return K237 0 0
+237 pascal16 K237() KERNEL_nop
# 262-274 are WinNT extensions; those are not present in Win95
@@ -264,10 +264,10 @@
318 stub FatalExitHook
319 stub FlushCachedFileHandle
320 pascal16 IsTask(word) IsTask16
-323 return IsRomModule 2 0
+323 pascal16 IsRomModule(word) IsRomModule16
324 pascal16 LogError(word ptr) LogError16
325 pascal16 LogParamError(word ptr ptr) LogParamError16
-326 return IsRomFile 2 0
+326 pascal16 IsRomFile(word) IsRomFile16
327 register K327() HandleParamError
328 pascal16 _DebugOutput() _DebugOutput
329 pascal16 K329(str word) DebugFillBuffer
@@ -289,7 +289,7 @@
348 pascal16 hmemcpy(ptr ptr long) hmemcpy16
349 pascal _hread(word segptr long) WIN16_hread
350 pascal _hwrite(word ptr long) _hwrite16
-351 return BUNNY_351 0 0
+351 pascal16 BUNNY_351() KERNEL_nop
352 pascal lstrcatn(segstr str word) lstrcatn16
353 pascal lstrcpyn(segptr str word) lstrcpyn16
354 pascal GetAppCompatFlags(word) GetAppCompatFlags16
@@ -305,7 +305,7 @@
358 pascal MapLS(long) MapLS
359 pascal UnMapLS(segptr) UnMapLS
360 pascal16 OpenFileEx(str ptr word) OpenFile16
-361 return PIGLET_361 0 0
+361 pascal16 PIGLET_361() KERNEL_nop
362 stub ThunkTerminateProcess
365 register GlobalChangeLockCount(word word) GlobalChangeLockCount16
@@ -351,7 +351,7 @@
444 pascal16 Local32Info(ptr word) Local32Info16
445 pascal16 Local32First(ptr word) Local32First16
446 pascal16 Local32Next(ptr) Local32Next16
-447 return KERNEL_447 0 0
+447 pascal16 KERNEL_447() KERNEL_nop
448 stub KERNEL_448
449 pascal GetpWin16Lock() GetpWin16Lock16
450 pascal VWin32_EventWait(long) VWin32_EventWait
@@ -379,7 +379,7 @@
472 register MapHInstLS() WIN16_MapHInstLS
473 register MapHInstSL() WIN16_MapHInstSL
474 pascal CloseW32Handle(long) CloseHandle
-475 register GetTEBSelectorFS() GetTEBSelectorFS16
+475 pascal16 GetTEBSelectorFS() GetTEBSelectorFS16
476 pascal ConvertToGlobalHandle(long) ConvertToGlobalHandle
477 stub WOAFullScreen
478 stub WOATerminateProcess
@@ -471,7 +471,7 @@
600 stub AllocCodeAlias
601 stub FreeCodeAlias
-602 register GetDummyModuleHandleDS() GetDummyModuleHandleDS16
+602 pascal16 GetDummyModuleHandleDS() GetDummyModuleHandleDS16
603 stub KERNEL_603 # OutputDebugString (?)
604 register CBClientGlueSL() CBClientGlueSL
605 pascal AllocSLThunkletCallback(long long) AllocSLThunkletCallback16
@@ -480,7 +480,7 @@
608 pascal AllocSLThunkletSysthunk(long segptr long) AllocSLThunkletSysthunk16
609 pascal FindLSThunkletCallback(segptr long) FindLSThunkletCallback
610 pascal FindSLThunkletCallback(long long) FindSLThunkletCallback
-611 return FreeThunklet 8 0
+611 pascal16 FreeThunklet() FreeThunklet16
612 pascal16 IsSLThunklet(ptr) IsSLThunklet16
613 stub HugeMapLS
614 stub HugeUnMapLS
diff --git a/if1632/keyboard.spec b/if1632/keyboard.spec
index 0f9116f..82240ff 100644
--- a/if1632/keyboard.spec
+++ b/if1632/keyboard.spec
@@ -7,7 +7,7 @@
4 pascal16 ToAscii(word word ptr ptr word) ToAscii16
5 pascal16 AnsiToOem(str ptr) AnsiToOem16
6 pascal16 OemToAnsi(str ptr) OemToAnsi16
-7 return SetSpeed 2 65535
+7 pascal16 SetSpeed(word) SetSpeed16
100 pascal ScreenSwitchEnable(word) ScreenSwitchEnable16
#126 pascal GetTableSeg
#127 pascal NewTable
diff --git a/if1632/system.spec b/if1632/system.spec
index 5090302..7b38e99 100644
--- a/if1632/system.spec
+++ b/if1632/system.spec
@@ -7,7 +7,7 @@
4 pascal16 EnableSystemTimers() EnableSystemTimers16
5 pascal16 DisableSystemTimers() DisableSystemTimers16
6 pascal GetSystemMSecCount() GetTickCount
-7 return Get80x87SaveSize 0 94
-8 stub Save80x87State
-9 stub Restore80x87State
-#20 stub A20_Proc
+7 pascal16 Get80x87SaveSize() Get80x87SaveSize16
+8 pascal16 Save80x87State(ptr) Save80x87State16
+9 pascal16 Restore80x87State(ptr) Restore80x87State16
+20 pascal16 A20_Proc(word) A20Proc16
diff --git a/if1632/thunk.c b/if1632/thunk.c
index 2fcbd88..9fb0b13 100644
--- a/if1632/thunk.c
+++ b/if1632/thunk.c
@@ -1437,6 +1437,14 @@
/***********************************************************************
+ * FreeThunklet16 (KERNEL.611)
+ */
+BOOL16 WINAPI FreeThunklet16( DWORD unused1, DWORD unused2 )
+{
+ return FALSE;
+}
+
+/***********************************************************************
* Callback Client API
*/
diff --git a/if1632/toolhelp.spec b/if1632/toolhelp.spec
index e82ea40..6a204c0 100644
--- a/if1632/toolhelp.spec
+++ b/if1632/toolhelp.spec
@@ -26,8 +26,8 @@
72 pascal16 MemManInfo(ptr) MemManInfo16
73 pascal16 NotifyRegister(word segptr word) NotifyRegister16
74 pascal16 NotifyUnregister(word) NotifyUnregister16
-75 return INTERRUPTREGISTER 6 1
-76 return INTERRUPTUNREGISTER 2 1
+75 pascal16 InterruptRegister(word segptr) InterruptRegister16
+76 pascal16 InterruptUnRegister(word) InterruptUnRegister16
77 stub TERMINATEAPP
78 pascal MemoryRead(word long ptr long) MemoryRead16
79 pascal MemoryWrite(word long ptr long) MemoryWrite16
diff --git a/if1632/user.spec b/if1632/user.spec
index 36dac48..4618e27 100644
--- a/if1632/user.spec
+++ b/if1632/user.spec
@@ -48,7 +48,7 @@
44 pascal16 OpenIcon(word) OpenIcon16
45 pascal16 BringWindowToTop(word) BringWindowToTop16
46 pascal16 GetParent(word) GetParent16
-47 register IsWindow(word) WIN16_IsWindow16
+47 pascal16 IsWindow(word) IsWindow16
48 pascal16 IsChild(word word) IsChild16
49 pascal16 IsWindowVisible(word) IsWindowVisible16
50 pascal16 FindWindow(segstr str) FindWindow16
@@ -233,7 +233,7 @@
228 pascal16 GetNextDlgTabItem(word word word) GetNextDlgTabItem16
229 pascal16 GetTopWindow(word) GetTopWindow16
230 pascal16 GetNextWindow(word word) GetNextWindow16
-231 return GetSystemDebugState 0 0 #FIXME
+231 pascal16 GetSystemDebugState() GetSystemDebugState16
232 pascal16 SetWindowPos(word word word word word word word) SetWindowPos16
233 pascal16 SetParent(word word) SetParent16
234 pascal16 UnhookWindowsHook(s_word segptr) THUNK_UnhookWindowsHook16
diff --git a/if1632/w32sys.spec b/if1632/w32sys.spec
index e9bee3e..b4d6996 100644
--- a/if1632/w32sys.spec
+++ b/if1632/w32sys.spec
@@ -5,7 +5,7 @@
2 pascal16 IsPeFormat(str word) IsPeFormat16
3 stub EXECPE
4 stub GETPEEXEINFO
-5 return GETW32SYSVERSION 0 0x100
+5 pascal GetW32SysVersion() GetW32SysVersion16
6 stub LOADPERESOURCE
7 pascal16 GetPEResourceTable(word) GetPEResourceTable16
8 stub EXECPEEX
diff --git a/include/builtin16.h b/include/builtin16.h
index f905bea..3e99efb 100644
--- a/include/builtin16.h
+++ b/include/builtin16.h
@@ -15,35 +15,13 @@
{
WORD pushw_bp; /* pushw %bp */
BYTE pushl; /* pushl $target */
- DWORD target;
+ void (*target)();
BYTE lcall; /* lcall __FLATCS__:relay */
- DWORD relay;
+ void (*relay)();
WORD flatcs;
-} STD_ENTRYPOINT16;
-
-typedef struct
-{
- WORD movw_ax; /* movw $<ax>, %ax */
- WORD ax;
- WORD movw_dx; /* movw $<dx>, %dx */
- WORD dx;
- WORD lret; /* lret $<args> */
- WORD args;
- WORD nopnop; /* nop; nop */
-} RET_ENTRYPOINT16;
-
-typedef union
-{
- STD_ENTRYPOINT16 std;
- RET_ENTRYPOINT16 ret;
} ENTRYPOINT16;
-#define EP_STD( target, relay ) \
- { std: { 0x5566, 0x68, (DWORD)(target), 0x9a, (DWORD)(relay), __FLATCS__ } }
-
-#define EP_RET( retval, nargs ) \
- { ret: { 0xb866, LOWORD(retval), 0xba66, HIWORD(retval), \
- (nargs)? 0xca66 : 0xcb66, (nargs)? (nargs) : 0x9090, 0x9090 } }
+#define EP(target,relay) { 0x5566, 0x68, (target), 0x9a, (relay), __FLATCS__ }
#include "poppack.h"
diff --git a/loader/ne/module.c b/loader/ne/module.c
index dfc2e4d..49bea39 100644
--- a/loader/ne/module.c
+++ b/loader/ne/module.c
@@ -1614,6 +1614,22 @@
/***************************************************************************
+ * IsRomModule16 (KERNEL.323)
+ */
+BOOL16 WINAPI IsRomModule16( HMODULE16 unused )
+{
+ return FALSE;
+}
+
+/***************************************************************************
+ * IsRomFile16 (KERNEL.326)
+ */
+BOOL16 WINAPI IsRomFile16( HFILE16 unused )
+{
+ return FALSE;
+}
+
+/***************************************************************************
* MapHModuleLS (KERNEL32.520)
*/
HMODULE16 WINAPI MapHModuleLS(HMODULE hmod) {
diff --git a/loader/task.c b/loader/task.c
index 4f43711..ba37d61 100644
--- a/loader/task.c
+++ b/loader/task.c
@@ -1235,20 +1235,20 @@
/***********************************************************************
- * GetTaskQueueDS (KERNEL.118)
+ * GetTaskQueueDS16 (KERNEL.118)
*/
-void WINAPI GetTaskQueueDS16( CONTEXT86 *context )
+void WINAPI GetTaskQueueDS16(void)
{
- DS_reg(context) = GlobalHandleToSel16( GetTaskQueue16(0) );
+ CURRENT_STACK16->ds = GlobalHandleToSel16( GetTaskQueue16(0) );
}
/***********************************************************************
- * GetTaskQueueES (KERNEL.119)
+ * GetTaskQueueES16 (KERNEL.119)
*/
-void WINAPI GetTaskQueueES16( CONTEXT86 *context )
+void WINAPI GetTaskQueueES16(void)
{
- ES_reg(context) = GlobalHandleToSel16( GetTaskQueue16(0) );
+ CURRENT_STACK16->es = GlobalHandleToSel16( GetTaskQueue16(0) );
}
@@ -1283,6 +1283,15 @@
/***********************************************************************
+ * GetCurPID16 (KERNEL.157)
+ */
+DWORD WINAPI GetCurPID16( DWORD unused )
+{
+ return 0;
+}
+
+
+/***********************************************************************
* GetInstanceData (KERNEL.54)
*/
INT16 WINAPI GetInstanceData16( HINSTANCE16 instance, WORD buffer, INT16 len )
@@ -1357,18 +1366,16 @@
/***********************************************************************
* GetDummyModuleHandleDS (KERNEL.602)
*/
-VOID WINAPI GetDummyModuleHandleDS16( CONTEXT86 *context )
+WORD WINAPI GetDummyModuleHandleDS16(void)
{
TDB *pTask;
WORD selector;
- AX_reg( context ) = 0;
- if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return;
- if (!(pTask->flags & TDBF_WIN32)) return;
-
+ if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return 0;
+ if (!(pTask->flags & TDBF_WIN32)) return 0;
selector = GlobalHandleToSel16( pTask->hModule );
- DS_reg( context ) = selector;
- AX_reg( context ) = selector;
+ CURRENT_DS = selector;
+ return selector;
}
/***********************************************************************
@@ -1385,6 +1392,15 @@
/***********************************************************************
+ * IsWinOldApTask16 (KERNEL.158)
+ */
+BOOL16 WINAPI IsWinOldApTask16( HTASK16 hTask )
+{
+ /* should return bit 0 of byte 0x48 in PSP */
+ return FALSE;
+}
+
+/***********************************************************************
* SetTaskSignalProc (KERNEL.38)
*
* Real 16-bit interface is provided by the THUNK_SetTaskSignalProc.
@@ -1445,7 +1461,7 @@
/***********************************************************************
* GetExePtr (KERNEL.133)
*/
-static HMODULE16 GetExePtrHelper( HANDLE16 handle, HTASK16 *hTask )
+static inline HMODULE16 GetExePtrHelper( HANDLE16 handle, HTASK16 *hTask )
{
char *ptr;
HANDLE16 owner;
@@ -1492,21 +1508,15 @@
HMODULE16 WINAPI GetExePtr( HANDLE16 handle )
{
- HTASK16 dummy;
- return GetExePtrHelper( handle, &dummy );
-}
-
-void WINAPI WIN16_GetExePtr( CONTEXT86 *context )
-{
- WORD *stack = PTR_SEG_OFF_TO_LIN(SS_reg(context), SP_reg(context));
- HANDLE16 handle = (HANDLE16)stack[2];
+ STACK16FRAME *frame;
HTASK16 hTask = 0;
- HMODULE16 hModule;
-
- hModule = GetExePtrHelper( handle, &hTask );
-
- AX_reg(context) = CX_reg(context) = hModule;
- if (hTask) ES_reg(context) = hTask;
+ HMODULE16 hModule = GetExePtrHelper( handle, &hTask );
+ if ((frame = CURRENT_STACK16) != NULL)
+ {
+ frame->ecx = hModule;
+ if (hTask) frame->es = hTask;
+ }
+ return hModule;
}
/***********************************************************************
diff --git a/memory/global.c b/memory/global.c
index edaabe0..764d226 100644
--- a/memory/global.c
+++ b/memory/global.c
@@ -1481,3 +1481,20 @@
return 0;
return GlobalFree16(HIWORD(vpmem));
}
+
+
+/***********************************************************************
+ * A20Proc16 (KERNEL.165)
+ */
+void WINAPI A20Proc16( WORD unused )
+{
+ /* this is also a NOP in Windows */
+}
+
+/***********************************************************************
+ * LimitEMSPages16 (KERNEL.156)
+ */
+DWORD WINAPI LimitEMSPages16( DWORD unused )
+{
+ return 0;
+}
diff --git a/memory/local.c b/memory/local.c
index 607e7b6..f894e6e 100644
--- a/memory/local.c
+++ b/memory/local.c
@@ -328,7 +328,8 @@
LOCALHEAPINFO *pHeapInfo;
LOCALARENA *pArena, *pFirstArena, *pLastArena;
NE_MODULE *pModule;
-
+ BOOL16 ret = FALSE;
+
/* The initial layout of the heap is: */
/* - first arena (FIXED) */
/* - heap info structure (FIXED) */
@@ -390,7 +391,7 @@
/* Make sure there's enough space. */
- if (freeArena + sizeof(LOCALARENA) >= lastArena) return FALSE;
+ if (freeArena + sizeof(LOCALARENA) >= lastArena) goto done;
/* Initialise the first arena */
@@ -442,7 +443,11 @@
((INSTANCEDATA *)ptr)->heap = heapInfoArena + ARENA_HEADER_SIZE;
LOCAL_PrintHeap( selector );
- return TRUE;
+ ret = TRUE;
+
+ done:
+ CURRENT_STACK16->ecx = ret; /* must be returned in cx too */
+ return ret;
}
/***********************************************************************
@@ -1532,20 +1537,9 @@
*/
HLOCAL16 WINAPI LocalAlloc16( UINT16 flags, WORD size )
{
- return LOCAL_Alloc( CURRENT_DS, flags, size );
-}
-
-
-/***********************************************************************
- * WIN16_LocalAlloc
- */
-void WINAPI WIN16_LocalAlloc( CONTEXT86 *context )
-{
- WORD *stack = PTR_SEG_OFF_TO_LIN(SS_reg(context), SP_reg(context));
- UINT16 flags = (UINT16)stack[3];
- WORD size = (WORD)stack[2];
- TRACE_(local)("WIN16LocalAlloc: %04x %d \n", flags, size);
- AX_reg(context) = CX_reg(context) = LOCAL_Alloc( DS_reg(context), flags, size );
+ HLOCAL16 ret = LOCAL_Alloc( CURRENT_DS, flags, size );
+ CURRENT_STACK16->ecx = ret; /* must be returned in cx too */
+ return ret;
}
diff --git a/misc/system.c b/misc/system.c
index 2cab5cd..d737e8e 100644
--- a/misc/system.c
+++ b/misc/system.c
@@ -152,3 +152,35 @@
if ( SYS_Service != INVALID_HANDLE_VALUE )
SERVICE_Disable( SYS_Service );
}
+
+
+/***********************************************************************
+ * Get80x87SaveSize16 (SYSTEM.7)
+ */
+WORD Get80x87SaveSize16(void)
+{
+ return 94;
+}
+
+
+/***********************************************************************
+ * Save80x87State16 (SYSTEM.8)
+ */
+void Save80x87State16( char *ptr )
+{
+#ifdef __i386__
+ __asm__(".byte 0x66; fsave %0; fwait" : "=m" (ptr) );
+#endif
+}
+
+
+/***********************************************************************
+ * Restore80x87State16 (SYSTEM.9)
+ */
+void Restore80x87State16( const char *ptr )
+{
+#ifdef __i386__
+ __asm__(".byte 0x66; frstor %0" : : "m" (ptr) );
+#endif
+}
+
diff --git a/misc/toolhelp.c b/misc/toolhelp.c
index d9a88b8..c480224 100644
--- a/misc/toolhelp.c
+++ b/misc/toolhelp.c
@@ -97,6 +97,16 @@
return TRUE;
}
+BOOL16 WINAPI InterruptRegister16( HTASK16 task, FARPROC callback )
+{
+ return TRUE;
+}
+
+BOOL16 WINAPI InterruptUnRegister16( HTASK16 task )
+{
+ return TRUE;
+}
+
/***********************************************************************
* ToolHelpHook (KERNEL.341)
* see "Undocumented Windows"
diff --git a/misc/w32sys.c b/misc/w32sys.c
index 43e6386..b887456 100644
--- a/misc/w32sys.c
+++ b/misc/w32sys.c
@@ -25,6 +25,14 @@
}
/***********************************************************************
+ * GetW32SysVersion16 (W32SYS.5)
+ */
+void WINAPI GetW32SysVersion16(void)
+{
+ return 0x100;
+}
+
+/***********************************************************************
* GetPEResourceTable (W32SYS.7)
* retrieves the resourcetable from the passed filedescriptor
* RETURNS
diff --git a/tools/build-spec.txt b/tools/build-spec.txt
index 415fcaa..f7b5065 100644
--- a/tools/build-spec.txt
+++ b/tools/build-spec.txt
@@ -13,8 +13,6 @@
ORDINAL equate EXPORTNAME DATA
-ORDINAL return EXPORTNAME ARGLENGTH RETVALUE
-
ORDINAL extern EXPORTNAME SYMBOLNAME
ORDINAL forward EXPORTNAME SYMBOLNAME
@@ -122,16 +120,6 @@
variable. "EXPORTNAME" will be the name available for dynamic linking.
"DATA" can be a decimal number or a hex number preceeded by "0x".
-Return ordinals:
-================
-
- This type defines a function entry point whose handler should do
-nothing but return a value.
- "ORDINAL" is replaced by the ordinal number corresponding to the
-variable. ARGLENGTH is the number of bytes that need to be removed
-from the stack before returning to the caller. RETVALUE is the
-return value which will be passed back to the caller.
-
Extern ordinals:
================
diff --git a/tools/build.c b/tools/build.c
index add3b18..0845a56 100644
--- a/tools/build.c
+++ b/tools/build.c
@@ -49,7 +49,6 @@
TYPE_PASCAL_16, /* pascal function with 16-bit return (Win16) */
TYPE_PASCAL, /* pascal function with 32-bit return (Win16) */
TYPE_ABS, /* absolute value (Win16) */
- TYPE_RETURN, /* simple return value function (Win16) */
TYPE_REGISTER, /* register function */
TYPE_STUB, /* unimplemented stub */
TYPE_STDCALL, /* stdcall function (Win32) */
@@ -69,7 +68,6 @@
"pascal16", /* TYPE_PASCAL_16 */
"pascal", /* TYPE_PASCAL */
"equate", /* TYPE_ABS */
- "return", /* TYPE_RETURN */
"register", /* TYPE_REGISTER */
"stub", /* TYPE_STUB */
"stdcall", /* TYPE_STDCALL */
@@ -502,45 +500,6 @@
/*******************************************************************
- * ParseReturn
- *
- * Parse a 'return' definition.
- */
-static int ParseReturn( ORDDEF *odp )
-{
- char *token;
- char *endptr;
-
- token = GetToken();
- odp->u.ret.arg_size = strtol(token, &endptr, 0);
- if (endptr == NULL || *endptr != '\0')
- {
- fprintf(stderr, "%s:%d: Expected number value, got '%s'\n",
- SpecName, Line, token);
- return -1;
- }
-
- token = GetToken();
- odp->u.ret.ret_value = strtol(token, &endptr, 0);
- if (endptr == NULL || *endptr != '\0')
- {
- fprintf(stderr, "%s:%d: Expected number value, got '%s'\n",
- SpecName, Line, token);
- return -1;
- }
-
- if (SpecType == SPEC_WIN32)
- {
- fprintf( stderr, "%s:%d: 'return' not supported for Win32\n",
- SpecName, Line );
- return -1;
- }
-
- return 0;
-}
-
-
-/*******************************************************************
* ParseStub
*
* Parse a 'stub' definition.
@@ -684,8 +643,6 @@
return ParseExportFunction( odp );
case TYPE_ABS:
return ParseEquate( odp );
- case TYPE_RETURN:
- return ParseReturn( odp );
case TYPE_STUB:
return ParseStub( odp );
case TYPE_VARARGS:
@@ -983,7 +940,6 @@
case TYPE_PASCAL:
case TYPE_PASCAL_16:
case TYPE_REGISTER:
- case TYPE_RETURN:
case TYPE_STUB:
selector = 1; /* Code selector */
break;
@@ -1410,22 +1366,13 @@
data_offset += StoreVariableCode( data + data_offset, 4, odp);
break;
- case TYPE_RETURN:
- fprintf( outfile, " /* %s.%d */ ", DLLName, i );
- fprintf( outfile, "EP_RET( %d, %d ),\n",
- odp->u.ret.ret_value, odp->u.ret.arg_size );
-
- odp->offset = code_offset;
- code_offset += sizeof(ENTRYPOINT16);
- break;
-
case TYPE_REGISTER:
case TYPE_CDECL:
case TYPE_PASCAL:
case TYPE_PASCAL_16:
case TYPE_STUB:
fprintf( outfile, " /* %s.%d */ ", DLLName, i );
- fprintf( outfile, "EP_STD( %s, %s_CallFrom16_%s_%s_%s ),\n",
+ fprintf( outfile, "EP( %s, %s_CallFrom16_%s_%s_%s ),\n",
odp->u.func.link_name,
DLLName,
(odp->type == TYPE_CDECL) ? "c" : "p",
diff --git a/win32/kernel32.c b/win32/kernel32.c
index 68adedd..cdd8b97 100644
--- a/win32/kernel32.c
+++ b/win32/kernel32.c
@@ -1018,9 +1018,9 @@
* GetTEBSelectorFS (KERNEL.475)
* Set the 16-bit %fs to the 32-bit %fs (current TEB selector)
*/
-VOID WINAPI GetTEBSelectorFS16( CONTEXT86 *context )
+void WINAPI GetTEBSelectorFS16(void)
{
- GET_FS( FS_reg(context) );
+ GET_FS( CURRENT_STACK16->fs );
}
/**********************************************************************
diff --git a/windows/keyboard.c b/windows/keyboard.c
index 52c249f..9b6a3c6 100644
--- a/windows/keyboard.c
+++ b/windows/keyboard.c
@@ -101,6 +101,15 @@
}
/**********************************************************************
+ * SetSpeed16 (KEYBOARD.7)
+ */
+WORD WINAPI SetSpeed16(WORD unused)
+{
+ FIXME_(keyboard)("(%04x): stub\n",unused);
+ return 0xffff;
+}
+
+/**********************************************************************
* ScreenSwitchEnable (KEYBOARD.100)
*/
VOID WINAPI ScreenSwitchEnable16(WORD unused)
diff --git a/windows/user.c b/windows/user.c
index 024c5a1..d2565bd 100644
--- a/windows/user.c
+++ b/windows/user.c
@@ -433,6 +433,14 @@
}
/***********************************************************************
+ * GetSystemDebugState16 (USER.231)
+ */
+WORD WINAPI GetSystemDebugState16(void)
+{
+ return 0; /* FIXME */
+}
+
+/***********************************************************************
* RegisterLogonProcess (USER32.434)
*/
DWORD WINAPI RegisterLogonProcess(HANDLE hprocess,BOOL x) {
diff --git a/windows/win.c b/windows/win.c
index 788bf8f..2b2edf8 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -26,12 +26,13 @@
#include "task.h"
#include "thread.h"
#include "process.h"
-#include "debugtools.h"
#include "winerror.h"
#include "mdi.h"
#include "local.h"
#include "desktop.h"
#include "syslevel.h"
+#include "stackframe.h"
+#include "debugtools.h"
DECLARE_DEBUG_CHANNEL(msg)
DECLARE_DEBUG_CHANNEL(win)
@@ -2283,18 +2284,10 @@
*/
BOOL16 WINAPI IsWindow16( HWND16 hwnd )
{
+ CURRENT_STACK16->es = USER_HeapSel;
return IsWindow( hwnd );
}
-void WINAPI WIN16_IsWindow16( CONTEXT86 *context )
-{
- WORD *stack = PTR_SEG_OFF_TO_LIN(SS_reg(context), SP_reg(context));
- HWND16 hwnd = (HWND16)stack[2];
-
- AX_reg(context) = IsWindow( hwnd );
- ES_reg(context) = USER_HeapSel;
-}
-
/*******************************************************************
* IsWindow32 (USER32.348)