winedos / Migrate current drive routines and add date conversions

Jukka Heinonen jhei at iki.fi
Sun May 11 09:36:57 CDT 2003


This patch migrates some int21 stuff to winedos and
adds implementation for long file name date conversion
functions. The patch makes kernel dll export current drive 
routines, but using those routines it should be possible to
migrate many additional int21 subfunctions to winedos.




Changelog:
    Move current drive subfunctions to winedos.
    Add long file name date conversion subfunctions.




Index: dlls/kernel/kernel32.spec
===================================================================
RCS file: /home/wine/wine/dlls/kernel/kernel32.spec,v
retrieving revision 1.100
diff -u -r1.100 kernel32.spec
--- dlls/kernel/kernel32.spec	4 May 2003 02:23:38 -0000	1.100
+++ dlls/kernel/kernel32.spec	11 May 2003 14:28:19 -0000
@@ -1144,7 +1144,9 @@
 @ cdecl DOSMEM_GetBlock(long ptr)
 @ cdecl DOSMEM_Init(long)
 @ cdecl DOSMEM_ResizeBlock(ptr long long)
+@ cdecl DRIVE_GetCurrentDrive()
 @ cdecl DRIVE_OpenDevice(long long)
+@ cdecl DRIVE_SetCurrentDrive(long)
 @ cdecl FILE_Dup2(long long)
 @ stdcall INT_Int21Handler(ptr)
 @ cdecl LOCAL_Alloc(long long long)




Index: msdos/int21.c
===================================================================
RCS file: /home/wine/wine/msdos/int21.c,v
retrieving revision 1.92
diff -u -r1.92 int21.c
--- msdos/int21.c	21 Apr 2003 23:22:53 -0000	1.92
+++ msdos/int21.c	11 May 2003 14:28:28 -0000
@@ -911,12 +911,6 @@
 
     switch(AH_reg(context))
     {
-    case 0x0e: /* SELECT DEFAULT DRIVE */
-	TRACE("SELECT DEFAULT DRIVE %d\n", DL_reg(context));
-        DRIVE_SetCurrentDrive( DL_reg(context) );
-        SET_AL( context, MAX_DOS_DRIVES );
-        break;
-
     case 0x11: /* FIND FIRST MATCHING FILE USING FCB */
 	TRACE("FIND FIRST MATCHING FILE USING FCB %p\n",
 	      CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx));
@@ -929,10 +923,6 @@
 
     case 0x12: /* FIND NEXT MATCHING FILE USING FCB */
         SET_AL( context, INT21_FindNextFCB(context) ? 0x00 : 0xff );
-        break;
-
-    case 0x19: /* GET CURRENT DEFAULT DRIVE */
-        SET_AL( context, DRIVE_GetCurrentDrive() );
         break;
 
     case 0x1b: /* GET ALLOCATION INFORMATION FOR DEFAULT DRIVE */




Index: dlls/winedos/int21.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/int21.c,v
retrieving revision 1.32
diff -u -r1.32 int21.c
--- dlls/winedos/int21.c	11 May 2003 03:30:24 -0000	1.32
+++ dlls/winedos/int21.c	11 May 2003 14:28:38 -0000
@@ -37,6 +37,7 @@
 #include "winuser.h"
 #include "wine/unicode.h"
 #include "wine/debug.h"
+#include "drive.h"
 
 /*
  * FIXME: Delete this reference when all int21 code has been moved to winedos.
@@ -1096,7 +1097,60 @@
     case 0xa0: /* LONG FILENAME - GET VOLUME INFORMATION */
     case 0xa1: /* LONG FILENAME - "FindClose" - TERMINATE DIRECTORY SEARCH */
     case 0xa6: /* LONG FILENAME - GET FILE INFO BY HANDLE */
+        INT_Int21Handler( context );
+        break;
+
     case 0xa7: /* LONG FILENAME - CONVERT TIME */
+        switch (BL_reg(context))
+        {
+        case 0x00: /* FILE TIME TO DOS TIME */
+            {
+                WORD      date, time;
+                FILETIME *filetime = CTX_SEG_OFF_TO_LIN(context,
+                                                        context->SegDs,
+                                                        context->Esi);
+
+                TRACE( "LONG FILENAME - FILE TIME TO DOS TIME\n" );
+
+                FileTimeToDosDateTime( filetime,
+                                       &date,
+                                       &time );
+
+                SET_DX( context, date );
+                SET_CX( context, time );
+
+                /*
+                 * FIXME: BH has number of 10-millisecond units 
+                 * past time in CX.
+                 */
+                SET_BH( context, 0 );
+            }
+            break;
+
+        case 0x01: /* DOS TIME TO FILE TIME */
+            {
+                FILETIME *filetime = CTX_SEG_OFF_TO_LIN(context,
+                                                        context->SegEs,
+                                                        context->Edi);
+
+                TRACE( "LONG FILENAME - DOS TIME TO FILE TIME\n" );
+
+                /*
+                 * FIXME: BH has number of 10-millisecond units 
+                 * past time in CX.
+                 */
+                DosDateTimeToFileTime( DX_reg(context),
+                                       CX_reg(context),
+                                       filetime );
+            }
+            break;
+
+        default:
+            INT_BARF( context, 0x21 );
+            break;
+        }
+        break;
+
     case 0xa8: /* LONG FILENAME - GENERATE SHORT FILENAME */
     case 0xa9: /* LONG FILENAME - SERVER CREATE OR OPEN FILE */
     case 0xaa: /* LONG FILENAME - SUBST */
@@ -1457,7 +1511,9 @@
         break;
 
     case 0x0e: /* SELECT DEFAULT DRIVE */
-        INT_Int21Handler( context );
+        TRACE( "SELECT DEFAULT DRIVE - %c:\n", 'A' + DL_reg(context) );
+        DRIVE_SetCurrentDrive( DL_reg(context) );
+        SET_AL( context, MAX_DOS_DRIVES );
         break;
 
     case 0x0f: /* OPEN FILE USING FCB */
@@ -1483,7 +1539,8 @@
         break;
 
     case 0x19: /* GET CURRENT DEFAULT DRIVE */
-        INT_Int21Handler( context );
+        TRACE( "GET CURRENT DEFAULT DRIVE\n" );
+        SET_AL( context, DRIVE_GetCurrentDrive() );
         break;
 
     case 0x1a: /* SET DISK TRANSFER AREA ADDRESS */






-- 
Jukka Heinonen <http://www.iki.fi/jhei/>



More information about the wine-patches mailing list