[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-patches
Subject:    winedos/ Int21 return state fixes (4th try)
From:       Sylvain Petreolle <spetreolle () yahoo ! fr>
Date:       2003-08-31 3:13:40
[Download RAW message or body]

Changelog :
INT21_Ioctl_Block: reset CFLAG in first place.
0x2b : trace error if the date is invalid.
0x2d : trace error if the time is invalid.
0x38 : report failure with error code+cflag & reset cflag if ok.
0x39-0x43 : reset cflag if ok.
0x45-47 : reset cflag if ok.
0x4a : report failure under Win16 (unsupported), reset CFLAG in first
place.
0x56 : reset cflag if ok.
0x5b-5c : reset cflag if ok.

=====
Sylvain Petreolle (spetreolle_at_users_dot_sourceforge_dot_net) 
ICQ #170597259

alias upsf='false ; while [ $? -ne 0 ] ; do cvs update -APd ; done 2>&1 |tee cvslog'

"What if tomorrow the War could be over ?" Morpheus, in "Reloaded".

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
["cflag4.diff" (application/octet-stream)]

Index: int21.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/int21.c,v
retrieving revision 1.38
diff -u -r1.38 int21.c
--- int21.c	16 Jun 2003 01:18:01 -0000	1.38
+++ int21.c	31 Aug 2003 03:11:36 -0000
@@ -1960,6 +1960,7 @@
     drivespec[0] += drive;
     drivetype = GetDriveTypeW( drivespec );
 
+    RESET_CFLAG(context);
     if (drivetype == DRIVE_UNKNOWN || drivetype == DRIVE_NO_ROOT_DIR)
     {
         TRACE( "IOCTL - SUBFUNCTION %d - INVALID DRIVE %c:\n", 
@@ -2932,6 +2933,8 @@
             else
             {
                 SET_AL( context, 0xff ); /* invalid date */
+                TRACE( "SetSystemDate(%02d/%02d/%04d): invalid date\n",
+                       day, month, year );
             }
         }
         break;
@@ -2949,10 +2952,19 @@
         break;
 
     case 0x2d: /* SET SYSTEM TIME */
+        if( CH_reg(context) >= 24 || CL_reg(context) >= 60 || DH_reg(context) >= 60 \
|| DL_reg(context) >= 100 ) { +            TRACE("SetSystemTime(%02d:%02d:%02d.%02d): \
wrong time\n", +              CH_reg(context), CL_reg(context),
+              DH_reg(context), DL_reg(context) );
+            SET_AL( context, 0xFF );
+        } 
+        else
+        {
         FIXME("SetSystemTime(%02d:%02d:%02d.%02d): not allowed\n",
               CH_reg(context), CL_reg(context),
               DH_reg(context), DL_reg(context) );
         SET_AL( context, 0 );  /* Let's pretend we succeeded */
+        }
         break;
 
     case 0x2e: /* SET VERIFY FLAG */
@@ -3092,19 +3104,27 @@
             WORD country = AL_reg(context);
             if (country == 0xff)
                 country = BX_reg(context);
-            if (country != INT21_GetSystemCountryCode())
+            if (country != INT21_GetSystemCountryCode()) {
                 FIXME( "Requested info on non-default country %04x\n", country );
+                SET_AX(context, 2);
+                SET_CFLAG(context);
+            }
+        }
+        if(AX_reg(context) != 2 ){
+            INT21_FillCountryInformation( CTX_SEG_OFF_TO_LIN(context, 
+                                                             context->SegDs, 
+                                                             context->Edx) );
+            SET_AX( context, INT21_GetSystemCountryCode() );
+            SET_BX( context, INT21_GetSystemCountryCode() );
+	    RESET_CFLAG(context);
         }
-        INT21_FillCountryInformation( CTX_SEG_OFF_TO_LIN(context, 
-                                                         context->SegDs, 
-                                                         context->Edx) );
-        SET_AX( context, INT21_GetSystemCountryCode() );
-        SET_BX( context, INT21_GetSystemCountryCode() );
         break;
 
     case 0x39: /* "MKDIR" - CREATE SUBDIRECTORY */
         if (!INT21_CreateDirectory( context ))
             bSetDOSExtendedError = TRUE;
+        else
+            RESET_CFLAG(context);
         break;
 
     case 0x3a: /* "RMDIR" - REMOVE DIRECTORY */
@@ -3119,30 +3139,40 @@
 
             if (!RemoveDirectoryW( dirW ))
                 bSetDOSExtendedError = TRUE;
+            else
+                RESET_CFLAG(context);
         }
         break;
 
     case 0x3b: /* "CHDIR" - SET CURRENT DIRECTORY */
         if (!INT21_SetCurrentDirectory( context ))
             bSetDOSExtendedError = TRUE;
+        else
+            RESET_CFLAG(context);
         break;
 
     case 0x3c: /* "CREAT" - CREATE OR TRUNCATE FILE */
         if (!INT21_CreateFile( context, context->Edx, FALSE, 
                                OF_READWRITE | OF_SHARE_COMPAT, 0x12 ))
             bSetDOSExtendedError = TRUE;
+        else
+            RESET_CFLAG(context);
         break;
 
     case 0x3d: /* "OPEN" - OPEN EXISTING FILE */
         if (!INT21_CreateFile( context, context->Edx, FALSE, 
                                AL_reg(context), 0x01 ))
             bSetDOSExtendedError = TRUE;
+        else
+            RESET_CFLAG(context);
         break;
 
     case 0x3e: /* "CLOSE" - CLOSE FILE */
         TRACE( "CLOSE handle %d\n", BX_reg(context) );
         if (_lclose16( BX_reg(context) ) == HFILE_ERROR16)
             bSetDOSExtendedError = TRUE;
+        else
+            RESET_CFLAG(context);
         break;
 
     case 0x3f: /* "READ" - READ FROM FILE OR DEVICE */
@@ -3172,6 +3202,7 @@
              *        does not work as it is supposed to work.
              */
 
+            RESET_CFLAG(context); /* set if error */
             if (!DOSVM_IsWin16() && BX_reg(context) == 0)
             {
                 result = INT21_BufferedInput( context, buffer, count );
@@ -3199,6 +3230,7 @@
                 for(i=0; i<CX_reg(context); i++)
                     DOSVM_PutChar(ptr[i]);
                 SET_AX(context, CX_reg(context));
+                RESET_CFLAG(context);
             }
             else
             {
@@ -3206,8 +3238,10 @@
                 LONG result = _hwrite( handle, ptr, CX_reg(context) );
                 if (result == HFILE_ERROR)
                     bSetDOSExtendedError = TRUE;
-                else
+                else {
                     SET_AX( context, (WORD)result );
+                    RESET_CFLAG(context);
+                }
             }
         }
         break;
@@ -3224,6 +3258,8 @@
 
             if (!DeleteFileW( fileW ))
                 bSetDOSExtendedError = TRUE;
+            else
+                RESET_CFLAG(context);
         }
         break;
 
@@ -3245,6 +3281,7 @@
             {
                 SET_AX( context, LOWORD(status) );
                 SET_DX( context, HIWORD(status) );
+                RESET_CFLAG(context);
             }
         }
         break;
@@ -3252,6 +3289,8 @@
     case 0x43: /* FILE ATTRIBUTES */
         if (!INT21_FileAttributes( context, AL_reg(context), FALSE ))
             bSetDOSExtendedError = TRUE;
+        else
+            RESET_CFLAG(context);
         break;
 
     case 0x44: /* IOCTL */
@@ -3273,8 +3312,10 @@
 
             if (handle16 == HFILE_ERROR)
                 bSetDOSExtendedError = TRUE;
-            else
+            else {
                 SET_AX( context, handle16 );
+                RESET_CFLAG(context);
+            }
         }
         break;
 
@@ -3283,11 +3324,15 @@
                BX_reg(context), CX_reg(context) );
         if (FILE_Dup2( BX_reg(context), CX_reg(context) ) == HFILE_ERROR16)
             bSetDOSExtendedError = TRUE;
+        else
+            RESET_CFLAG(context);
         break;
 
     case 0x47: /* "CWD" - GET CURRENT DIRECTORY */
         if (!INT21_GetCurrentDirectory( context, FALSE ))
             bSetDOSExtendedError = TRUE;
+        else
+            RESET_CFLAG(context);
         break;
 
     case 0x48: /* ALLOCATE MEMORY */
@@ -3304,8 +3349,10 @@
             else
                 DOSMEM_GetBlock( bytes, &selector );
                
-            if (selector)
+            if (selector) {
                 SET_AX( context, selector );
+                RESET_CFLAG(context);
+            }
             else
             {
                 SET_CFLAG(context);
@@ -3349,12 +3396,14 @@
             if (!ISV86(context) && DOSVM_IsWin16())
             {
                 FIXME( "Resize memory block - unsupported under Win16\n" );
+                SET_CFLAG(context);
             }
             else
             {
                 LPVOID address = (void*)((DWORD)context->SegEs << 4);
                 UINT blocksize = DOSMEM_ResizeBlock( address, newsize, FALSE );
 
+                RESET_CFLAG(context);
                 if (blocksize == (UINT)-1)
                 {
                     SET_CFLAG( context );
@@ -3377,6 +3426,7 @@
 
             TRACE( "EXEC %s\n", program );
 
+            RESET_CFLAG(context);
             if (DOSVM_IsWin16())
             {
                 HINSTANCE16 instance = WinExec16( program, SW_NORMAL );
@@ -3445,11 +3495,15 @@
     case 0x56: /* "RENAME" - RENAME FILE */
         if (!INT21_RenameFile( context ))
             bSetDOSExtendedError = TRUE;
+        else
+            RESET_CFLAG(context);
         break;
 
     case 0x57: /* FILE DATE AND TIME */
         if (!INT21_FileDateTime( context ))
             bSetDOSExtendedError = TRUE;
+        else
+            RESET_CFLAG(context);
         break;
 
     case 0x58: /* GET OR SET MEMORY ALLOCATION STRATEGY */
@@ -3492,6 +3546,8 @@
         if (!INT21_CreateFile( context, context->Edx, FALSE,
                                OF_READWRITE | OF_SHARE_COMPAT, 0x10 ))
             bSetDOSExtendedError = TRUE;
+        else
+            RESET_CFLAG(context);
         break;
 
     case 0x5c: /* "FLOCK" - RECORD LOCKING */
@@ -3500,6 +3556,7 @@
             DWORD  length = MAKELONG(DI_reg(context), SI_reg(context));
             HANDLE handle = DosFileHandleToWin32Handle(BX_reg(context));
 
+            RESET_CFLAG(context);
             switch (AL_reg(context))
             {
             case 0x00: /* LOCK */



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic