int21 move a7

György 'Nog' Jeney nog at sdf.lonestar.org
Sat Nov 9 09:58:00 CST 2002


ChangeLog:
 * dlls/winedos/int21.c
 * msdos/int21.c
   - Move some more simple functions of int21 to winedos.
   - Some cleanups.

nog.

-------------- next part --------------
--- msdos/int21.c.a6	2002-11-09 11:33:53.000000000 +0200
+++ msdos/int21.c	2002-11-09 11:38:39.000000000 +0200
@@ -629,56 +629,6 @@
     return 1;
 }
 
-
-static void DeleteFileFCB( CONTEXT86 *context )
-{
-    FIXME("(%p): stub\n", context);
-}
-
-static void RenameFileFCB( CONTEXT86 *context )
-{
-    FIXME("(%p): stub\n", context);
-}
-
-
-
-static void fLock( CONTEXT86 * context )
-{
-
-    switch ( AX_reg(context) & 0xff )
-    {
-        case 0x00: /* LOCK */
-	  TRACE("lock handle %d offset %ld length %ld\n",
-		BX_reg(context),
-		MAKELONG(DX_reg(context),CX_reg(context)),
-		MAKELONG(DI_reg(context),SI_reg(context))) ;
-          if (!LockFile(DosFileHandleToWin32Handle(BX_reg(context)),
-                        MAKELONG(DX_reg(context),CX_reg(context)), 0,
-                        MAKELONG(DI_reg(context),SI_reg(context)), 0)) {
-	    SET_AX( context, GetLastError() );
-	    SET_CFLAG(context);
-	  }
-          break;
-
-	case 0x01: /* UNLOCK */
-	  TRACE("unlock handle %d offset %ld length %ld\n",
-		BX_reg(context),
-		MAKELONG(DX_reg(context),CX_reg(context)),
-		MAKELONG(DI_reg(context),SI_reg(context))) ;
-          if (!UnlockFile(DosFileHandleToWin32Handle(BX_reg(context)),
-                          MAKELONG(DX_reg(context),CX_reg(context)), 0,
-                          MAKELONG(DI_reg(context),SI_reg(context)), 0)) {
-	    SET_AX( context, GetLastError() );
-	    SET_CFLAG(context);
-	  }
-	  return;
-	default:
-	  SET_AX( context, 0x0001 );
-	  SET_CFLAG(context);
-	  return;
-     }
-}
-
 static BOOL
 INT21_networkfunc (CONTEXT86 *context)
 {
@@ -776,21 +726,6 @@
         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) );
-        {
-            LPSTR data = CTX_SEG_OFF_TO_LIN(context,context->SegDs,context->Edx);
-            LPSTR p = data;
-            /* do NOT use strchr() to calculate the string length,
-            as '\0' is valid string content, too !
-            Maybe we should check for non-'$' strings, but DOS doesn't. */
-            while (*p != '$') p++;
-            _hwrite16( 1, data, (int)p - (int)data);
-            SET_AL( context, '$' ); /* yes, '$' (0x24) gets returned in AL */
-        }
-        break;
-
     case 0x0a: /* BUFFERED INPUT */
       {
 	char *buffer = ((char *)CTX_SEG_OFF_TO_LIN(context,  context->SegDs,
@@ -807,10 +742,6 @@
 	break;
       }
 
-    case 0x5c: /* "FLOCK" - RECORD LOCKING */
-        fLock(context);
-        break;
-
     case 0x0e: /* SELECT DEFAULT DRIVE */
 	TRACE("SELECT DEFAULT DRIVE %d\n", DL_reg(context));
         DRIVE_SetCurrentDrive( DL_reg(context) );
@@ -831,26 +762,6 @@
         SET_AL( context, INT21_FindNextFCB(context) ? 0x00 : 0xff );
         break;
 
-    case 0x13: /* DELETE FILE USING FCB */
-        DeleteFileFCB(context);
-        break;
-
-    case 0x17: /* RENAME FILE USING FCB */
-        RenameFileFCB(context);
-        break;
-
-    case 0x19: /* GET CURRENT DEFAULT DRIVE */
-        SET_AL( context, DRIVE_GetCurrentDrive() );
-        break;
-
-    case 0x1a: /* SET DISK TRANSFER AREA ADDRESS */
-        {
-            TDB *pTask = TASK_GetCurrent();
-            pTask->dta = MAKESEGPTR(context->SegDs,DX_reg(context));
-            TRACE("Set DTA: %08lx\n", pTask->dta);
-        }
-        break;
-
     case 0x25: /* SET INTERRUPT VECTOR */
         INT_SetPMHandler( AL_reg(context), (FARPROC16)MAKESEGPTR( context->SegDs, DX_reg(context)));
         break;
@@ -859,28 +770,6 @@
         INT21_ParseFileNameIntoFCB(context);
         break;
 
-    case 0x2f: /* GET DISK TRANSFER AREA ADDRESS */
-        TRACE("GET DISK TRANSFER AREA ADDRESS\n");
-        {
-            TDB *pTask = TASK_GetCurrent();
-            context->SegEs = SELECTOROF( pTask->dta );
-            SET_BX( context, OFFSETOF( pTask->dta ) );
-        }
-        break;
-
-    case 0x30: /* GET DOS VERSION */
-        TRACE("GET DOS VERSION %s requested\n",
-	      (AL_reg(context) == 0x00)?"OEM number":"version flag");
-        SET_AX( context, (HIWORD(GetVersion16()) >> 8) | (HIWORD(GetVersion16()) << 8) );
-#if 0
-        SET_AH( context, 0x7 );
-        SET_AL( context, 0xA );
-#endif
-
-        SET_BX( context, 0x00FF );     /* 0x123456 is Wine's serial # */
-        SET_CX( context, 0x0000 );
-        break;
-
     case 0x35: /* GET INTERRUPT VECTOR */
         TRACE("GET INTERRUPT VECTOR 0x%02x\n",AL_reg(context));
         {
@@ -912,13 +801,6 @@
 	break;
       }
 
-    case 0x38: /* GET COUNTRY-SPECIFIC INFORMATION */
-	TRACE("GET COUNTRY-SPECIFIC INFORMATION for country 0x%02x\n",
-	      AL_reg(context));
-        SET_AX( context, 0x02 ); /* no country support available */
-        SET_CFLAG(context);
-        break;
-
     case 0x39: /* "MKDIR" - CREATE SUBDIRECTORY */
         TRACE("MKDIR %s\n",
 	      (LPCSTR)CTX_SEG_OFF_TO_LIN(context,  context->SegDs, context->Edx));
@@ -1003,13 +885,6 @@
         }
         break;
 
-    case 0x41: /* "UNLINK" - DELETE FILE */
-        TRACE("UNLINK %s\n",
-	      (LPCSTR)CTX_SEG_OFF_TO_LIN(context,  context->SegDs, context->Edx));
-        bSetDOSExtendedError = (!DeleteFileA( CTX_SEG_OFF_TO_LIN(context,  context->SegDs,
-                                                             context->Edx )));
-        break;
-
     case 0x42: /* "LSEEK" - SET CURRENT FILE POSITION */
         TRACE("LSEEK handle %d offset %ld from %s\n",
 	      BX_reg(context), MAKELONG(DX_reg(context),CX_reg(context)),
@@ -1534,15 +1409,6 @@
         }
         break;
 
-    case 0x70: /* MS-DOS 7 (Windows95) - ??? (country-specific?)*/
-    case 0x72: /* MS-DOS 7 (Windows95) - ??? */
-        TRACE("windows95 function AX %04x\n",
-                    AX_reg(context));
-        WARN("        returning unimplemented\n");
-        SET_CFLAG(context);
-        SET_AL( context, 0 );
-        break;
-
     default:
         INT_BARF( context, 0x21 );
         break;
--- dlls/winedos/int21.c.a6	2002-11-09 11:33:53.000000000 +0200
+++ dlls/winedos/int21.c	2002-11-09 11:44:51.000000000 +0200
@@ -570,6 +570,23 @@
         SET_AL( context, ascii );
         break;
 
+    case 0x09: /* WRITE STRING TO STANDARD OUTPUT */
+        TRACE("WRITE '$'-terminated string from %04lX:%04X to stdout\n",
+              context->SegDs, DX_reg(context) );
+        {
+            LPSTR data = CTX_SEG_OFF_TO_LIN(context, context->SegDs,
+                                            context->Edx);
+            /* do NOT use strchr() to calculate the string length,
+            as '\0' is valid string content, too !
+            Maybe we should check for non-'$' strings, but DOS doesn't. */
+            while(*data != '$') {
+                DOSVM_PutChar(*data);
+                data++;
+            }
+            SET_AL(context, '$'); /* yes, '$' (0x24) gets returned in AL */
+        }
+        break;
+
     case 0x0b: /* GET STDIN STATUS */
         {
             BIOSDATA *data = BIOS_DATA;
@@ -602,10 +619,30 @@
         RESET_CFLAG(context); /* dos 6+ only */
         break;
 
+    case 0x13: /* DELETE FILE USING FCB */
+        FIXME("Delete file using FCB: stub\n");
+        break;
+
+    case 0x17: /* RENAME FILE USING FCB */
+        FIXME("Rename file using FCB: stub\n");;
+        break;
+
     case 0x18: /* NULL FUNCTION FOR CP/M COMPATIBILITY */
         SET_AL( context, 0 );
         break;
 
+    case 0x19: /* GET CURRENT DEFAULT DRIVE */
+        SET_AL(context, GetDosDrive(0));
+        break;
+
+    case 0x1a: /* SET DISK TRANSFER AREA ADDRESS */
+        {
+            TDB *pTask = GlobalLock16(GetCurrentTask());
+            pTask->dta = MAKESEGPTR(context->SegDs, DX_reg(context));
+            TRACE("Set DTA: %08lx\n", pTask->dta);
+        }
+        break;
+
     case 0x1b: /* GET ALLOCATION INFORMATION FOR DEFAULT DRIVE */
         SET_DL( context, 0 );
         if (!INT21_GetDriveAllocInfo(context)) SET_AX( context, 0xffff );
@@ -674,6 +711,26 @@
         /* we cannot change the behaviour anyway, so just ignore it */
         break;
 
+    case 0x2f: /* GET DISK TRANSFER AREA ADDRESS */
+        TRACE("GET DISK TRANSFER AREA ADDRESS\n");
+        context->SegEs = SELECTOROF(GetCurrentDTA(context));
+        SET_BX(context, OFFSETOF(GetCurrentDTA(context)));
+        break;
+
+    case 0x30: /* GET DOS VERSION */
+        TRACE("GET DOS VERSION %s requested\n",
+              (AL_reg(context) == 0x00)?"OEM number":"version flag");
+        SET_AX(context, (HIWORD(GetVersion16()) >> 8) |
+              (HIWORD(GetVersion16()) << 8));
+#if 0
+        SET_AH( context, 0x7 );
+        SET_AL( context, 0xA );
+#endif
+
+        SET_BX(context, 0x00FF); /* 0x123456 is Wine's serial # */
+        SET_CX(context, 0x0000);
+        break;
+
     case 0x31: /* TERMINATE AND STAY RESIDENT */
         FIXME("TERMINATE AND STAY RESIDENT stub\n");
         break;
@@ -775,6 +832,14 @@
           DOS3Call( context );
         break;
 
+    case 0x41: /* "UNLINK" - DELETE FILE */
+        TRACE("UNLINK %s\n",
+             (LPCSTR)CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx));
+        bSetDOSExtendedError = (!DeleteFileA(CTX_SEG_OFF_TO_LIN(context,
+                                                                context->SegDs,
+                                                                context->Edx)));
+        break;
+
     case 0x43: /* FILE ATTRIBUTES */
         switch (AL_reg(context))
         {
@@ -968,6 +1033,35 @@
         INT21_GetExtendedError(context);
         break;
 
+    case 0x5c: /* "FLOCK" - RECORD LOCKING */
+        switch (AL_reg(context)) {
+        case 0x00: /* LOCK */
+            TRACE("lock handle %d offset %ld length %ld\n", BX_reg(context),
+                  MAKELONG(DX_reg(context), CX_reg(context)),
+                  MAKELONG(DI_reg(context), SI_reg(context)));
+
+            bSetDOSExtendedError =
+                 LockFile(DosFileHandleToWin32Handle( BX_reg(context)),
+                          MAKELONG(DX_reg(context), CX_reg(context)), 0,
+                          MAKELONG(DI_reg(context), SI_reg(context)), 0);
+            break;
+
+        case 0x01: /* UNLOCK */
+            TRACE("unlock handle %d offset %ld length %ld\n", BX_reg(context),
+                  MAKELONG(DX_reg(context), CX_reg(context)),
+                  MAKELONG(DI_reg(context), SI_reg(context)));
+
+            bSetDOSExtendedError = 
+               UnlockFile(DosFileHandleToWin32Handle(BX_reg(context)),
+                          MAKELONG(DX_reg(context),CX_reg(context)), 0,
+                          MAKELONG(DI_reg(context),SI_reg(context)), 0);
+
+        default:
+          SET_AX(context, 0x0001);
+          SET_CFLAG(context);
+          return;
+     }
+
     case 0x5d: /* NETWORK */
         FIXME("Function 0x%04x not implemented.\n", AX_reg (context));
         /* Fix the following while you're at it.  */



More information about the wine-patches mailing list