Return value of XMS free block routine

Jukka Heinonen jhei at iki.fi
Sun Apr 28 11:22:38 CDT 2002


This patch prevents several DOS installers
from hanging when they check how much
XMS memory is available.

Changelog:
  When freeing XMS memory block, return
  an error if block has not been previously allocated.

Index: dlls/winedos/xms.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/xms.c,v
retrieving revision 1.2
diff -u -r1.2 xms.c
--- dlls/winedos/xms.c  9 Mar 2002 23:44:32 -0000       1.2
+++ dlls/winedos/xms.c  28 Apr 2002 16:12:49 -0000
@@ -84,7 +84,11 @@
        break;
     case 0x0a:   /* Free Extended Memory Block */
        TRACE("free extended memory block %04x\n",DX_reg(context));
-       GlobalFree16(DX_reg(context));
+       if(!DX_reg(context) || GlobalFree16(DX_reg(context))) {
+         AX_reg(context) = 0;    /* failure */
+         BL_reg(context) = 0xa2; /* invalid handle */
+       } else
+         AX_reg(context) = 1;    /* success */
        break;
     case 0x0b:   /* Move Extended Memory Block */
     {

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



More information about the wine-patches mailing list