From: Martin Str|mberg Message-Id: <200101021551.QAA28277@father.ludd.luth.se> Subject: FAT32's extend flag remove for OS/2 To: djgpp-workers AT delorie DOT com (DJGPP-WORKERS) Date: Tue, 2 Jan 2001 16:51:20 +0100 (MET) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Here's the patch I intend to commit for _not_ setting the extend bit in the call if we are running on OS/2 and a question. Why are we calling _get_dos_version(0) in _creat_n.c and not _get_dos_version(1)? Right, MartinS Index: src/libc/dos/io/_creat.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_creat.c,v retrieving revision 1.4 diff -p -u -r1.4 _creat.c --- _creat.c 2000/06/19 18:00:56 1.4 +++ _creat.c 2001/01/02 15:29:17 @@ -14,6 +14,7 @@ int _creat(const char* filename, int attrib) { __dpmi_regs r; + int dos_major; int rv; unsigned use_lfn = _USE_LFN; @@ -31,17 +32,20 @@ _creat(const char* filename, int attrib) r.x.bx = 0x1002; /* Open r/w with extended size. */ r.x.dx = 0x0012; /* Create, truncate if exists */ r.x.si = __tb_offset; - } else if(7 <= (_get_dos_version(1) >> 8)) { - r.x.ax = 0x6c00; - r.x.bx = 0x1002; /* Open r/w with FAT32 extended size. */ - /* FAT32 extended size flag doesn't help on WINDOZE 4.1 (98). It - seems it has a bug which only lets you create these big files - if LFN is enabled. */ - r.x.dx = 0x0012; /* Create, truncate if exists */ - r.x.si = __tb_offset; } else { - r.h.ah = 0x3c; - r.x.dx = __tb_offset; + dos_major = _get_dos_version(1) >> 8; + if(7 <= dos_major && dos_major < 10) { + r.x.ax = 0x6c00; + r.x.bx = 0x1002; /* Open r/w with FAT32 extended size. */ + /* FAT32 extended size flag doesn't help on WINDOZE 4.1 (98). It + seems it has a bug which only lets you create these big files + if LFN is enabled. */ + r.x.dx = 0x0012; /* Create, truncate if exists */ + r.x.si = __tb_offset; + } else { + r.h.ah = 0x3c; + r.x.dx = __tb_offset; + } } r.x.cx = attrib; r.x.ds = __tb_segment; Index: src/libc/dos/io/_creat_n.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_creat_n.c,v retrieving revision 1.2 diff -p -u -r1.2 _creat_n.c --- _creat_n.c 2000/06/19 18:00:56 1.2 +++ _creat_n.c 2001/01/02 15:29:17 @@ -25,21 +25,32 @@ _creatnew(const char* filename, int attr if (__FSEXT_call_open_handlers(__FSEXT_creat, &rv, &filename)) return rv; + if (_osmajor == 0) + _get_dos_version (0); + _put_path(filename); r.x.bx = - 0x1000 | /* FAT32 extended size. */ - /* FAT32 extended size flag doesn't help on WINDOZE 4.1 (98). It - seems it has a bug which only lets you create these big files - if LFN is enabled. */ 0x2002 | (flags & 0xfff0); /* r/w, no Int 24h, use caller-defined flags */ r.x.dx = 0x0010; /* Create, fail if exists */ r.x.si = __tb_offset; if(use_lfn) + { + if (7 <= _osmajor && _osmajor < 10) + { + r.x.bx |= 0x1000; /* FAT32 extended size. */ + } r.x.ax = 0x716c; + } else { - if (_osmajor == 0) - _get_dos_version (0); + if (7 <= _osmajor && _osmajor < 10) + { + r.x.bx |= 0x1000; /* FAT32 extended size. */ + /* FAT32 extended size flag doesn't help on WINDOZE 4.1 (98). It + seems it has a bug which only lets you create these big files + if LFN is enabled. */ + } + if (_osmajor > 3) r.x.ax = 0x6c00; else Index: src/libc/dos/io/_open.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_open.c,v retrieving revision 1.3 diff -p -u -r1.3 _open.c --- _open.c 2000/06/19 18:00:56 1.3 +++ _open.c 2001/01/02 15:29:17 @@ -15,6 +15,7 @@ int _open(const char* filename, int oflag) { __dpmi_regs r; + int dos_major; int rv; int use_lfn = _USE_LFN; @@ -32,18 +33,21 @@ _open(const char* filename, int oflag) r.x.bx = (oflag & 0xff) | 0x1000; /* 0x1000 is FAT32 extended size. */ r.x.dx = 1; /* Open existing file */ r.x.si = __tb_offset; - } else if(7 <= (_get_dos_version(1) >> 8)) { - r.x.ax = 0x6c00; - r.x.bx = (oflag & 0xff) | 0x1000; /* 0x1000 is FAT32 extended size. */ - /* FAT32 extended size flag doesn't help on WINDOZE 4.1 (98). It - seems it has a bug which only lets you create these big files - if LFN is enabled. */ - r.x.dx = 1; /* Open existing file */ - r.x.si = __tb_offset; } else { - r.h.ah = 0x3d; - r.h.al = oflag; - r.x.dx = __tb_offset; + dos_major = _get_dos_version(1) >> 8; + if(7 <= dos_major && dos_major < 10) { + r.x.ax = 0x6c00; + r.x.bx = (oflag & 0xff) | 0x1000; /* 0x1000 is FAT32 extended size. */ + /* FAT32 extended size flag doesn't help on WINDOZE 4.1 (98). It + seems it has a bug which only lets you create these big files + if LFN is enabled. */ + r.x.dx = 1; /* Open existing file */ + r.x.si = __tb_offset; + } else { + r.h.ah = 0x3d; + r.h.al = oflag; + r.x.dx = __tb_offset; + } } r.x.cx = 0; r.x.ds = __tb_segment;