final int21 move (0/11)

György 'Nog' Jeney nog at sdf.lonestar.org
Wed Nov 27 11:19:29 CST 2002


This is hopefully going to go into cvs atleast up to patch no. 9.  I have
created these diffs from jukkas int25/26 move posted yesterday but
everything
should apply cleanly up to but not including no. 9.  This one relies on
the DOSVM_Raw{Read|Write} fucntions.

All of my previous patches regarding this subject should be discarded,
including my dosconf moves.

Nos. 10 and 11 export functions from kernel and Im not sure if these are
acceptable so I wouldnt be supprised if they dont make it.

ChangeLog:
 * dlls/winedos/int21.c
 * dlls/kernel/kernel32.spec
 * msdos/int21.c
   Move functions that behave differently in win16 mode and Real Mode

nog.

-------------- next part --------------
--- ../readwritewine/msdos/int21.c	2002-11-21 09:37:06.000000000 +0200
+++ msdos/int21.c	2002-11-27 15:31:21.000000000 +0200
@@ -1157,37 +1157,6 @@
 
     switch(AH_reg(context))
     {
-    case 0x01: /* READ CHARACTER FROM STANDARD INPUT, WITH ECHO */
-    case 0x02: /* WRITE CHARACTER TO STANDARD OUTPUT */
-    case 0x03: /* READ CHARACTER FROM STDAUX  */
-    case 0x04: /* WRITE CHARACTER TO STDAUX */
-    case 0x05: /* WRITE CHARACTER TO PRINTER */
-    case 0x06: /* DIRECT CONSOLE IN/OUTPUT */
-    case 0x07: /* DIRECT CHARACTER INPUT WITHOUT ECHO */
-    case 0x08: /* CHARACTER INPUT WITHOUT ECHO */
-    case 0x0b: /* GET STDIN STATUS */
-    case 0x0f: /* OPEN FILE USING FCB */
-    case 0x10: /* CLOSE FILE USING FCB */
-    case 0x14: /* SEQUENTIAL READ FROM FCB FILE */
-    case 0x15: /* SEQUENTIAL WRITE TO FCB FILE */
-    case 0x16: /* CREATE OR TRUNCATE FILE USING FCB */
-    case 0x21: /* READ RANDOM RECORD FROM FCB FILE */
-    case 0x22: /* WRITE RANDOM RECORD TO FCB FILE */
-    case 0x23: /* GET FILE SIZE FOR FCB */
-    case 0x24: /* SET RANDOM RECORD NUMBER FOR FCB */
-    case 0x26: /* CREATE NEW PROGRAM SEGMENT PREFIX */
-    case 0x27: /* RANDOM BLOCK READ FROM FCB FILE */
-    case 0x28: /* RANDOM BLOCK WRITE TO FCB FILE */
-    case 0x4d: /* GET RETURN CODE */
-    case 0x50: /* SET CURRENT PROCESS ID (SET PSP ADDRESS) */
-        INT_BARF( context, 0x21 );
-        break;
-
-    case 0x00: /* TERMINATE PROGRAM */
-        TRACE("TERMINATE PROGRAM\n");
-        ExitThread( 0 );
-        break;
-
     case 0x09: /* WRITE STRING TO STANDARD OUTPUT */
         TRACE("WRITE '$'-terminated string from %04lX:%04X to stdout\n",
 	      context->SegDs,DX_reg(context) );
@@ -1294,10 +1263,6 @@
         GetDrivePB(context, DRIVE_GetCurrentDrive());
         break;
 
-    case 0x25: /* SET INTERRUPT VECTOR */
-        FIXME("set interrupt vector - move to winedos...");
-        break;
-
     case 0x29: /* PARSE FILENAME INTO FCB */
         INT21_ParseFileNameIntoFCB(context);
         break;
@@ -1411,16 +1376,6 @@
         SET_BX( context, (int)&heap->InDosFlag - (int)heap );
         break;
 
-    case 0x35: /* GET INTERRUPT VECTOR */
-        TRACE("GET INTERRUPT VECTOR 0x%02x\n",AL_reg(context));
-        {
-            FARPROC16 addr = 0;
-            FIXME("get interrupt vector - move to winedos...\n");            
-            context->SegEs = SELECTOROF(addr);
-            SET_BX( context, OFFSETOF(addr) );
-        }
-        break;
-
     case 0x36: /* GET FREE DISK SPACE */
 	TRACE("GET FREE DISK SPACE FOR DRIVE %s\n",
 	      INT21_DriveName( DL_reg(context)));
@@ -1802,18 +1757,6 @@
 	}
         break;
 
-    case 0x4b: /* "EXEC" - LOAD AND/OR EXECUTE PROGRAM */
-        TRACE("EXEC %s\n", (LPCSTR)CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx ));
-        SET_AX( context, WinExec16( CTX_SEG_OFF_TO_LIN(context,  context->SegDs, context->Edx ),
-                                    SW_NORMAL ));
-        if (AX_reg(context) < 32) SET_CFLAG(context);
-        break;
-
-    case 0x4c: /* "EXIT" - TERMINATE WITH RETURN CODE */
-        TRACE("EXIT with return code %d\n",AL_reg(context));
-        ExitThread( AL_reg(context) );
-        break;
-
     case 0x4e: /* "FINDFIRST" - FIND FIRST MATCHING FILE */
         TRACE("FINDFIRST mask 0x%04x spec %s\n",CX_reg(context),
 	      (LPCSTR)CTX_SEG_OFF_TO_LIN(context,  context->SegDs, context->Edx));
@@ -1830,30 +1773,6 @@
         }
         else SET_AX( context, 0 );  /* OK */
         break;
-    case 0x51: /* GET PSP ADDRESS */
-        TRACE("GET CURRENT PROCESS ID (GET PSP ADDRESS)\n");
-        /* FIXME: should we return the original DOS PSP upon */
-        /*        Windows startup ? */
-        SET_BX( context, GetCurrentPDB16() );
-        break;
-    case 0x62: /* GET PSP ADDRESS */
-        /* FIXME: should we return the original DOS PSP upon */
-        /*        Windows startup ? */
-        SET_BX( context, GetCurrentPDB16() );
-        break;
-
-    case 0x52: /* "SYSVARS" - GET LIST OF LISTS */
-        TRACE("SYSVARS - GET LIST OF LISTS\n");
-#if 0
-        {
-            context->SegEs = LOWORD(DOS_LOLSeg);
-            SET_BX( context, FIELD_OFFSET(DOS_LISTOFLISTS, ptr_first_DPB) );
-        }
-#endif
-        FIXME("LOLSeg broken for now\n");
-        context->SegEs = 0;
-        SET_BX( context, 0 );
-        break;
 
     case 0x54: /* Get Verify Flag */
 	TRACE("Get Verify Flag - Not Supported\n");
--- ../readwritewine/dlls/winedos/int21.c	2002-11-12 14:19:20.000000000 +0200
+++ dlls/winedos/int21.c	2002-11-27 15:31:21.000000000 +0200
@@ -27,6 +27,7 @@
 #include "windef.h"
 #include "winbase.h"
 #include "winternl.h"
+#include "winuser.h" /* SW_NORMAL */
 #include "wine/winbase16.h"
 #include "dosexe.h"
 #include "miscemu.h"
@@ -77,11 +78,7 @@
 void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
 {
     BYTE ascii;
-
-    if (DOSVM_IsWin16()) {
-        DOS3Call( context );
-        return;
-    }
+    BOOL bSetDOSExtendedError = FALSE;
 
     RESET_CFLAG(context);  /* Not sure if this is a good idea */
 
@@ -105,7 +102,8 @@
     {
     case 0x00: /* TERMINATE PROGRAM */
         TRACE("TERMINATE PROGRAM\n");
-        MZ_Exit( context, FALSE, 0 );
+        if(DOSVM_IsWin16()) ExitThread(0);
+        else MZ_Exit( context, FALSE, 0 );
         break;
 
     case 0x01: /* READ CHARACTER FROM STANDARD INPUT, WITH ECHO */
@@ -176,16 +174,24 @@
         break;
 
     case 0x25: /* SET INTERRUPT VECTOR */
-        DOSVM_SetRMHandler( AL_reg(context),
-                            (FARPROC16)MAKESEGPTR( context->SegDs, DX_reg(context)));
+        if(DOSVM_IsWin16()) DOSVM_SetPMHandler16(AL_reg(context),
+                                       (FARPROC16)MAKESEGPTR(context->SegDs,
+                                                             DX_reg(context)));
+        else DOSVM_SetRMHandler(AL_reg(context),
+                                (FARPROC16)MAKESEGPTR(context->SegDs,
+                                                      DX_reg(context)));
         break;
 
     case 0x35: /* GET INTERRUPT VECTOR */
-        TRACE("GET INTERRUPT VECTOR 0x%02x\n",AL_reg(context));
         {
-            FARPROC16 addr = DOSVM_GetRMHandler( AL_reg(context) );
+            FARPROC16 addr;
+            if(DOSVM_IsWin16()) addr = DOSVM_GetPMHandler16(AL_reg(context));
+            else addr = DOSVM_GetRMHandler(AL_reg(context));
+
             context->SegEs = SELECTOROF(addr);
-            SET_BX( context, OFFSETOF(addr) );
+            SET_BX(context, OFFSETOF(addr));
+            TRACE("GET INTERRUPT VECTOR 0x%02x -> %04x:%04x\n",
+                  AL_reg(context), HIWORD(addr), LOWORD(addr));
         }
         break;
 
@@ -208,18 +214,26 @@
         break;
 
     case 0x4b: /* "EXEC" - LOAD AND/OR EXECUTE PROGRAM */
-        TRACE("EXEC %s\n", (LPCSTR)CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx ));
-        if (!MZ_Exec( context, CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx),
-                      AL_reg(context), CTX_SEG_OFF_TO_LIN(context, context->SegEs, context->Ebx) ))
-        {
-            SET_AX( context, GetLastError() );
-            SET_CFLAG(context);
-        }
+        TRACE("EXEC %s\n", (LPCSTR)CTX_SEG_OFF_TO_LIN(context, context->SegDs,
+              context->Edx));
+        if(DOSVM_IsWin16()) {
+            SET_AX(context, WinExec16(CTX_SEG_OFF_TO_LIN(context,
+                                                         context->SegDs,
+                                                         context->Edx ),
+                                      SW_NORMAL));
+            if(AX_reg(context) < 32) SET_CFLAG(context);
+        } else
+            if(!MZ_Exec(context, CTX_SEG_OFF_TO_LIN(context, context->SegDs,
+                         context->Edx), AL_reg(context),
+                         CTX_SEG_OFF_TO_LIN(context, context->SegEs,
+                                            context->Ebx)))
+                bSetDOSExtendedError = TRUE;
         break;
 
     case 0x4c: /* "EXIT" - TERMINATE WITH RETURN CODE */
         TRACE("EXIT with return code %d\n",AL_reg(context));
-        MZ_Exit( context, FALSE, AL_reg(context) );
+        if(DOSVM_IsWin16()) ExitThread(AL_reg(context));
+        else MZ_Exit(context, FALSE, AL_reg(context));
         break;
 
     case 0x4d: /* GET RETURN CODE */
@@ -237,14 +251,19 @@
         TRACE("GET CURRENT PROCESS ID (GET PSP ADDRESS)\n");
         /* FIXME: should we return the original DOS PSP upon */
         /*        Windows startup ? */
-        SET_BX( context, DOSVM_psp );
+        if(DOSVM_IsWin16()) SET_BX(context, GetCurrentPDB16());
+        else SET_BX(context, DOSVM_psp);
         break;
 
     case 0x52: /* "SYSVARS" - GET LIST OF LISTS */
         TRACE("SYSVARS - GET LIST OF LISTS\n");
-        {
+        if(DOSVM_IsWin16()) {
+            FIXME("LOLSeg broken for now\n");
+            context->SegEs = 0;
+            SET_BX(context, 0);
+        } else {
             context->SegEs = HIWORD(DOS_LOLSeg);
-            SET_BX( context, FIELD_OFFSET(DOS_LISTOFLISTS, ptr_first_DPB) );
+            SET_BX(context, FIELD_OFFSET(DOS_LISTOFLISTS, ptr_first_DPB));
         }
         break;
 
@@ -252,9 +271,11 @@
         TRACE("GET CURRENT PSP ADDRESS\n");
         /* FIXME: should we return the original DOS PSP upon */
         /*        Windows startup ? */
-        SET_BX( context, DOSVM_psp );
+        if(DOSVM_IsWin16()) SET_BX(context, GetCurrentPDB16());
+        else SET_BX(context, DOSVM_psp);
         break;
 
+
     default:
         DOS3Call( context );
     }
--- ../readwritewine/dlls/kernel/kernel32.spec	2002-11-27 15:30:55.000000000 +0200
+++ dlls/kernel/kernel32.spec	2002-11-27 15:31:21.000000000 +0200
@@ -990,6 +990,7 @@
 @ stdcall FindResource16(long str str) FindResource16
 @ stdcall FreeResource16(long) FreeResource16
 @ stdcall FreeSelector16(long) FreeSelector16
+@ stdcall GetCurrentPDB16() GetCurrentPDB16
 @ stdcall GetCurrentTask() GetCurrentTask
 @ stdcall GetDOSEnvironment16() GetDOSEnvironment16
 @ stdcall GetExePtr(long) GetExePtr



More information about the wine-patches mailing list