fixed Get DOS Version in order to run command.com of win98

Jiuming Luo jiuming_luo at yahoo.com
Wed Dec 11 02:36:20 CST 2002


The Attached file wine-20021125_diff is the same as
the following:

diff -Naur wine-20021125.old/loader/module.c
wine-20021125.new/loader/module.c
--- wine-20021125.old/loader/module.c	2002-11-21
03:45:02.000000000 +0000
+++ wine-20021125.new/loader/module.c	2002-12-11
16:06:34.000000000 +0000
@@ -1047,6 +1047,17 @@
         /* 16-bit task - get current NE module name
*/
         NE_MODULE *pModule = NE_GetPtr(
GetCurrentTask() );
         if (pModule)
GetLongPathNameA(NE_MODULE_NAME(pModule), lpFileName,
size);
+	else {
+		/* This is a work-around for DOS programs. The run
gets here
+		   because DOS int21/AH=30h calls GetVersion16(),
and
+		   GetVersion16() in misc/version.c calls
VERSION_Init() which
+		   calls GetModuleFileNameW(), thus gets to this
function. 
+		   To run win98 DOS-programs such as command.com
and sys.com, 
+		   remember to set "Windows" = "win98" in section
[Version] in 
+		   $HOME/.wine/config */
+		extern inline char *get_main_exe_name(void);
+		lstrcpynA( lpFileName, get_main_exe_name(), size);
+	}
     }
     else
     {
diff -Naur wine-20021125.old/miscemu/main.c
wine-20021125.new/miscemu/main.c
--- wine-20021125.old/miscemu/main.c	2002-10-01
18:07:37.000000000 +0000
+++ wine-20021125.new/miscemu/main.c	2002-12-11
16:06:14.000000000 +0000
@@ -29,6 +29,8 @@
 #include "wine/debug.h"
 
 static char main_exe_name[MAX_PATH];
+/* get_main_exe_name() only used by
GetModuleFileNameA() in loader/module.c */
+inline char *get_main_exe_name(void){return
main_exe_name;}
 static HANDLE main_exe_file;
 
 static BOOL (WINAPI
*pGetMessageA)(LPMSG,HWND,UINT,UINT);
diff -Naur wine-20021125.old/msdos/int21.c
wine-20021125.new/msdos/int21.c
--- wine-20021125.old/msdos/int21.c	2002-11-21
00:02:10.000000000 +0000
+++ wine-20021125.new/msdos/int21.c	2002-12-11
16:05:58.000000000 +0000
@@ -1336,12 +1336,26 @@
         TRACE("GET DOS VERSION %s requested\n",
 	      (AL_reg(context) == 0x00)?"OEM
number":"version flag");
         SET_AX( context, (HIWORD(GetVersion16()) >>
8) | (HIWORD(GetVersion16()) << 8) );
+	/*	on return:
+	 AL = major version number (2-5)
+	 AH = minor version number (in hundredths decimal)
+	 BH = FF indicates MS-DOS, only if OEM vendor
chooses to identify
+	 BH = 00 indicates PC-DOS
+
+	 BL:CX = 24 bit OEM serial number if BH is FF
+
+	 * for an example DOS version 2.1 returns AL=2 and
AH=10
+	 * DOS versions prior to DOS 2.0 return zero in AH
and AL
+	 * DOS version 4.0 and 4.1 usually return the same
value of 4.00
+	 * the OEM serial number is a rarity, though some
older OEM DOS versions implemented this feature
+	 * the OS/2 compatibility box returns 10.10 for OS/2
1.1, 10.20 for OS/2 1.2, etc...
+	 */
 #if 0
-        SET_AH( context, 0x7 );
-        SET_AL( context, 0xA );
+        SET_AH( context, 0xA );
+        SET_AL( context, 0x7 );
 #endif
 
-        SET_BX( context, 0x00FF );     /* 0x123456 is
Wine's serial # */
+        SET_BX( context, 0xFF00 );     /* 0x123456 is
Wine's serial # */
         SET_CX( context, 0x0000 );
         break;
 


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com



More information about the wine-patches mailing list