winedos: init .com stack

Markus Amsler markus.amsler at oribi.org
Sun Oct 17 17:57:46 CDT 2004


.COM files use ret to terminate the programm. Ret jumps to psp:0, and 
there is int 20 => exit.
This patch makes sure the jump goes to psp:0.

Changelog:
* Initialize .COM stack.
-------------- next part --------------
Index: dlls/winedos/module.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/module.c,v
retrieving revision 1.44
diff -u -r1.44 module.c
--- dlls/winedos/module.c	13 Aug 2004 00:39:16 -0000	1.44
+++ dlls/winedos/module.c	17 Oct 2004 22:52:37 -0000
@@ -315,6 +315,11 @@
     init_ip = mz_header.e_ip;
     init_ss = load_seg+mz_header.e_ss;
     init_sp = mz_header.e_sp;
+    if (old_com){
+      /* .COM files exit with ret. Make sure they jump to psp start (=int 20) */
+      WORD* stack = PTR_REAL_TO_LIN(init_ss, init_sp);
+      *stack = 0;
+    }
 
     TRACE("entry point: %04x:%04x\n",init_cs,init_ip);
   }


More information about the wine-patches mailing list