diff --git a/if1632/dummy.c b/if1632/dummy.c index 8af0fb222b9..0c2d93f63d6 100644 --- a/if1632/dummy.c +++ b/if1632/dummy.c @@ -53,3 +53,4 @@ long WINAPI stub_USER_919(void) { FIXME("stub\n"); return 0; } 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 1c8de60573a..d77d7e702d2 100644 --- a/if1632/kernel.spec +++ b/if1632/kernel.spec @@ -9,7 +9,7 @@ file krnl386.exe 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 @@ file krnl386.exe 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 @@ file krnl386.exe 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 @@ file krnl386.exe 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 @@ file krnl386.exe 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 @@ file krnl386.exe 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 @@ file krnl386.exe 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 @@ file krnl386.exe 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 @@ file krnl386.exe 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 @@ file krnl386.exe 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 @@ file krnl386.exe 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 @@ file krnl386.exe 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 @@ file krnl386.exe 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 @@ file krnl386.exe 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 @@ file krnl386.exe 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 0f9116f42bc..82240ff2f5f 100644 --- a/if1632/keyboard.spec +++ b/if1632/keyboard.spec @@ -7,7 +7,7 @@ type win16 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 5090302eb79..7b38e99fedf 100644 --- a/if1632/system.spec +++ b/if1632/system.spec @@ -7,7 +7,7 @@ type win16 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 2fcbd8866f4..9fb0b13dc6e 100644 --- a/if1632/thunk.c +++ b/if1632/thunk.c @@ -1436,6 +1436,14 @@ SEGPTR WINAPI FindSLThunkletCallback( FARPROC target, DWORD relay ) } +/*********************************************************************** + * 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 e82ea400145..6a204c059f3 100644 --- a/if1632/toolhelp.spec +++ b/if1632/toolhelp.spec @@ -26,8 +26,8 @@ type win16 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 36dac48198d..4618e27dd61 100644 --- a/if1632/user.spec +++ b/if1632/user.spec @@ -48,7 +48,7 @@ file user.exe 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 @@ file user.exe 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 e9bee3e367e..b4d6996e309 100644 --- a/if1632/w32sys.spec +++ b/if1632/w32sys.spec @@ -5,7 +5,7 @@ type win16 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 f905beae021..3e99efb56a3 100644 --- a/include/builtin16.h +++ b/include/builtin16.h @@ -15,35 +15,13 @@ typedef struct { 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 */ - WORD ax; - WORD movw_dx; /* movw $, %dx */ - WORD dx; - WORD lret; /* lret $ */ - 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 dfc2e4dc1c6..49bea39973b 100644 --- a/loader/ne/module.c +++ b/loader/ne/module.c @@ -1613,6 +1613,22 @@ BOOL16 WINAPI ModuleFindHandle16( MODULEENTRY *lpme, HMODULE16 hModule ) } +/*************************************************************************** + * IsRomModule16 (KERNEL.323) + */ +BOOL16 WINAPI IsRomModule16( HMODULE16 unused ) +{ + return FALSE; +} + +/*************************************************************************** + * IsRomFile16 (KERNEL.326) + */ +BOOL16 WINAPI IsRomFile16( HFILE16 unused ) +{ + return FALSE; +} + /*************************************************************************** * MapHModuleLS (KERNEL32.520) */ diff --git a/loader/task.c b/loader/task.c index 4f43711ddeb..ba37d615571 100644 --- a/loader/task.c +++ b/loader/task.c @@ -1235,20 +1235,20 @@ void WINAPI SwitchStackBack16( CONTEXT86 *context ) /*********************************************************************** - * 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) ); } @@ -1282,6 +1282,15 @@ DWORD WINAPI GetCurrentPDB16(void) } +/*********************************************************************** + * GetCurPID16 (KERNEL.157) + */ +DWORD WINAPI GetCurPID16( DWORD unused ) +{ + return 0; +} + + /*********************************************************************** * GetInstanceData (KERNEL.54) */ @@ -1357,18 +1366,16 @@ HINSTANCE16 WINAPI GetTaskDS16(void) /*********************************************************************** * 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; } /*********************************************************************** @@ -1384,6 +1391,15 @@ BOOL16 WINAPI IsTask16( HTASK16 hTask ) } +/*********************************************************************** + * IsWinOldApTask16 (KERNEL.158) + */ +BOOL16 WINAPI IsWinOldApTask16( HTASK16 hTask ) +{ + /* should return bit 0 of byte 0x48 in PSP */ + return FALSE; +} + /*********************************************************************** * SetTaskSignalProc (KERNEL.38) * @@ -1445,7 +1461,7 @@ VOID WINAPI GlobalNotify16( FARPROC16 proc ) /*********************************************************************** * 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 @@ static HMODULE16 GetExePtrHelper( HANDLE16 handle, HTASK16 *hTask ) 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 edaabe041a4..764d22641be 100644 --- a/memory/global.c +++ b/memory/global.c @@ -1481,3 +1481,20 @@ WORD WINAPI WOWGlobalUnlockFree16(DWORD vpmem) { 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 607e7b63923..f894e6e0b74 100644 --- a/memory/local.c +++ b/memory/local.c @@ -328,7 +328,8 @@ BOOL16 WINAPI LocalInit16( HANDLE16 selector, WORD start, WORD end ) 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 @@ BOOL16 WINAPI LocalInit16( HANDLE16 selector, WORD start, WORD end ) /* 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 @@ BOOL16 WINAPI LocalInit16( HANDLE16 selector, WORD start, WORD end ) ((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 LOCAL_Handle( HANDLE16 ds, WORD addr ) */ 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 2cab5cd564e..d737e8e6f50 100644 --- a/misc/system.c +++ b/misc/system.c @@ -152,3 +152,35 @@ void WINAPI DisableSystemTimers16(void) 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 d9a88b81e70..c480224d476 100644 --- a/misc/toolhelp.c +++ b/misc/toolhelp.c @@ -97,6 +97,16 @@ BOOL16 WINAPI StackTraceNext16(STACKTRACEENTRY *ste) 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 43e63863ed9..b887456a633 100644 --- a/misc/w32sys.c +++ b/misc/w32sys.c @@ -24,6 +24,14 @@ WORD WINAPI GetWin32sInfo16( return 0; } +/*********************************************************************** + * GetW32SysVersion16 (W32SYS.5) + */ +void WINAPI GetW32SysVersion16(void) +{ + return 0x100; +} + /*********************************************************************** * GetPEResourceTable (W32SYS.7) * retrieves the resourcetable from the passed filedescriptor diff --git a/tools/build-spec.txt b/tools/build-spec.txt index 415fcaa0216..f7b5065baf4 100644 --- a/tools/build-spec.txt +++ b/tools/build-spec.txt @@ -13,8 +13,6 @@ ORDINAL stub EXPORTNAME ORDINAL equate EXPORTNAME DATA -ORDINAL return EXPORTNAME ARGLENGTH RETVALUE - ORDINAL extern EXPORTNAME SYMBOLNAME ORDINAL forward EXPORTNAME SYMBOLNAME @@ -122,16 +120,6 @@ Equate ordinals: 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 add3b18563c..0845a56a56b 100644 --- a/tools/build.c +++ b/tools/build.c @@ -49,7 +49,6 @@ typedef enum 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 @@ static const char * const TypeNames[TYPE_NBTYPES] = "pascal16", /* TYPE_PASCAL_16 */ "pascal", /* TYPE_PASCAL */ "equate", /* TYPE_ABS */ - "return", /* TYPE_RETURN */ "register", /* TYPE_REGISTER */ "stub", /* TYPE_STUB */ "stdcall", /* TYPE_STDCALL */ @@ -501,45 +499,6 @@ static int ParseEquate( ORDDEF *odp ) } -/******************************************************************* - * 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 * @@ -684,8 +643,6 @@ static int ParseOrdinal(int ordinal) 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 @@ static int BuildModule16( FILE *outfile, int max_code_offset, 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 @@ static int BuildSpec16File( char * specfile, FILE *outfile ) 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 68adedd5db9..cdd8b97ce18 100644 --- a/win32/kernel32.c +++ b/win32/kernel32.c @@ -1018,9 +1018,9 @@ FreeSLCallback( * 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 52c249fefe7..9b6a3c6b97d 100644 --- a/windows/keyboard.c +++ b/windows/keyboard.c @@ -100,6 +100,15 @@ void KEYBOARD_SendEvent( BYTE bVk, BYTE bScan, DWORD dwFlags, WIN_RestoreWndsLock(iWndsLocks); } +/********************************************************************** + * SetSpeed16 (KEYBOARD.7) + */ +WORD WINAPI SetSpeed16(WORD unused) +{ + FIXME_(keyboard)("(%04x): stub\n",unused); + return 0xffff; +} + /********************************************************************** * ScreenSwitchEnable (KEYBOARD.100) */ diff --git a/windows/user.c b/windows/user.c index 024c5a1e587..d2565bda14c 100644 --- a/windows/user.c +++ b/windows/user.c @@ -432,6 +432,14 @@ DWORD WINAPI UserSeeUserDo16(WORD wReqType, WORD wParam1, WORD wParam2, WORD wPa } } +/*********************************************************************** + * GetSystemDebugState16 (USER.231) + */ +WORD WINAPI GetSystemDebugState16(void) +{ + return 0; /* FIXME */ +} + /*********************************************************************** * RegisterLogonProcess (USER32.434) */ diff --git a/windows/win.c b/windows/win.c index 788bf8f903b..2b2edf8585f 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 @@ INT WINAPI GetWindowTextLengthW( HWND hwnd ) */ 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)