DOS packing patch (fix)

Andreas Mohr andi at rhlx01.fht-esslingen.de
Mon Dec 24 09:01:17 CST 2001


Hi all,

got rid of that stupid WINE_PACKED stuff.
Instead declared a section for one byte packing in msdos.h.
The risk of errors with WINE_PACKED is way too high IMHO,
as can be witnessed with DOS_DEVICE_HEADER, which resulted in an
offset mismatch in DOS_LISTOFLISTS. Thus both DOS_DEVICE_HEADER and
DOS_LISTOFLISTS were broken.
This offset mismatch in DOS_LISTOFLISTS caused a "Win98 requires a computer
with at least 16 MB of memory" error when trying to "install" Win98 using Wine.
Of course full Win98 installation still doesn't work yet.
(next problem immediately following)

BTW, why does touching msdos.h not force a recompile of dlls/winedos/ etc. ???
(Makefile broken ??)

-- 
Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: include/msdos.h
===================================================================
RCS file: /home/wine/wine/include/msdos.h,v
retrieving revision 1.8
diff -u -r1.8 msdos.h
--- include/msdos.h	13 Oct 2000 17:11:30 -0000	1.8
+++ include/msdos.h	24 Dec 2001 13:01:22 -0000
@@ -3,6 +3,9 @@
 
 #include "winnt.h"
 
+/* WARNING: one byte packed structs from here !! (i.e. not DWORD aligned) */
+#include "pshpack1.h"
+
 struct fcb {
         BYTE drive;
 	char name[8];
@@ -18,17 +21,17 @@
 /* DTA layout for FindFirst/FindNext */
 typedef struct
 {
-    BYTE   drive;                /* 00 drive letter */
-    char   mask[11];             /* 01 search template */
-    BYTE   search_attr;          /* 0c search attributes */
-    WORD   count WINE_PACKED;    /* 0d entry count within directory */
-    WORD   cluster WINE_PACKED;  /* 0f cluster of parent directory */
-    char  *unixPath WINE_PACKED; /* 11 unix path (was: reserved) */
-    BYTE   fileattr;             /* 15 file attributes */
-    WORD   filetime;             /* 16 file time */
-    WORD   filedate;             /* 18 file date */
-    DWORD  filesize WINE_PACKED; /* 1a file size */
-    char   filename[13];         /* 1e file name + extension */
+    BYTE   drive;        /* 00 drive letter */
+    char   mask[11];     /* 01 search template */
+    BYTE   search_attr;  /* 0c search attributes */
+    WORD   count;        /* 0d entry count within directory */
+    WORD   cluster;      /* 0f cluster of parent directory */
+    char  *unixPath;     /* 11 unix path (was: reserved) */
+    BYTE   fileattr;     /* 15 file attributes */
+    WORD   filetime;     /* 16 file time */
+    WORD   filedate;     /* 18 file date */
+    DWORD  filesize;     /* 1a file size */
+    char   filename[13]; /* 1e file name + extension */
 } FINDFILE_DTA;
 
 /* FCB layout for FindFirstFCB/FindNextFCB */
@@ -61,41 +64,45 @@
     char  name[8];
 } DOS_DEVICE_HEADER;
 
+/* Warning: need to return LOL ptr w/ offset 0 (&ptr_first_DPB) to programs ! */
 typedef struct _DOS_LISTOFLISTS
 {
-    WORD  CX_Int21_5e01;	/* contents of CX from INT 21/AX=5E01h */
-    WORD  LRU_count_FCB_cache;	
-    WORD  LRU_count_FCB_open;
-    DWORD OEM_func_handler WINE_PACKED; /* OEM function of INT 21/AH=F8h */
-    WORD  INT21_offset;/* offset in DOS CS of code to return from INT 21 call */
-    WORD  sharing_retry_count;
-    WORD  sharing_retry_delay;
-    DWORD ptr_disk_buf;		/* ptr to current disk buf */
-    WORD  offs_unread_CON;	/* pointer in DOS data segment of unread CON input */
-    WORD  seg_first_MCB;
-    DWORD ptr_first_DPB;
-    DWORD ptr_first_SysFileTable;
-    DWORD ptr_clock_dev_hdr;
-    DWORD ptr_CON_dev_hdr;
-    WORD  max_byte_per_sec;   /* maximum bytes per sector of any block device */
-    DWORD ptr_disk_buf_info WINE_PACKED;
-    DWORD ptr_array_CDS WINE_PACKED; /* current directory structure */
-    DWORD ptr_sys_FCB WINE_PACKED;
-    WORD  nr_protect_FCB;
-    BYTE  nr_block_dev;
-    BYTE  nr_avail_drive_letters;
-    DOS_DEVICE_HEADER NUL_dev WINE_PACKED;
-    BYTE  nr_drives_JOINed;
-    WORD  ptr_spec_prg_names WINE_PACKED;
-    DWORD ptr_SETVER_prg_list WINE_PACKED;
-    WORD DOS_HIGH_A20_func_offs WINE_PACKED;
-    WORD PSP_last_exec WINE_PACKED; /* if DOS in HMA: PSP of program executed last; if DOS low: 0000h */
-    WORD BUFFERS_val WINE_PACKED;
-    WORD BUFFERS_nr_lookahead WINE_PACKED;
-    BYTE boot_drive WINE_PACKED;
-    BYTE flag_DWORD_moves WINE_PACKED; /* 01h for 386+, 00h otherwise */
-    WORD size_extended_mem WINE_PACKED; /* size of extended mem in KB */
+    WORD  CX_Int21_5e01;	/* -24d contents of CX from INT 21/AX=5E01h */
+    WORD  LRU_count_FCB_cache;	/* -22d */
+    WORD  LRU_count_FCB_open;	/* -20d */
+    DWORD OEM_func_handler;	/* -18d OEM function of INT 21/AH=F8h */
+    WORD  INT21_offset;		/* -14d offset in DOS CS of code to return from INT 21 call */
+    WORD  sharing_retry_count;	/* -12d */
+    WORD  sharing_retry_delay;	/* -10d */
+    DWORD ptr_disk_buf;		/* -8d ptr to current disk buf */
+    WORD  offs_unread_CON;	/* -4d pointer in DOS data segment of unread CON input */
+    WORD  seg_first_MCB;	/* -2d */
+    DWORD ptr_first_DPB;	/* 00 */
+    DWORD ptr_first_SysFileTable; /* 04 */
+    DWORD ptr_clock_dev_hdr;	/* 08 */
+    DWORD ptr_CON_dev_hdr;	/* 0C */
+    WORD  max_byte_per_sec;	/* 10 maximum bytes per sector of any block device */
+    DWORD ptr_disk_buf_info;	/* 12 */
+    DWORD ptr_array_CDS;	/* 16 current directory structure */
+    DWORD ptr_sys_FCB;	 	/* 1A */
+    WORD  nr_protect_FCB;	/* 1E */
+    BYTE  nr_block_dev;		/* 20 */
+    BYTE  nr_avail_drive_letters; /* 21 */
+    DOS_DEVICE_HEADER NUL_dev;	/* 22 */
+    BYTE  nr_drives_JOINed;	/* 34 */
+    WORD  ptr_spec_prg_names;	/* 35 */
+    DWORD ptr_SETVER_prg_list;	/* 37 */
+    WORD DOS_HIGH_A20_func_offs;/* 3B */
+    WORD PSP_last_exec;		/* 3D if DOS in HMA: PSP of program executed last; if DOS low: 0000h */
+    WORD BUFFERS_val;		/* 3F */
+    WORD BUFFERS_nr_lookahead;	/* 41 */
+    BYTE boot_drive;		/* 43 */
+    BYTE flag_DWORD_moves;	/* 44 01h for 386+, 00h otherwise */
+    WORD size_extended_mem;	/* 45 size of extended mem in KB */
 } DOS_LISTOFLISTS;
+
+#include "poppack.h"
+/* end one byte packed structs ! */
 
 #define MAX_DOS_DRIVES	26
 


More information about the wine-patches mailing list