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/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;
}
/***********************************************************************