Mail Archives: djgpp-workers/2001/07/19/09:20:06
Martin,
I have just tested the changes on my Win2K box with the app below using the
CVS tarball from the 15th of July 2001 and the patches to _open.c and
_creat.c. The steps I went through to produce the exe was:
1) Delete my old DJGPP 2.04 development build directory structure
(C:\WORK\DJ204), this is only used to build the DJGPP libs and zip files.
2) Rebuild all of the V2 DJGPP ZIP files
3) Unzip the new ZIP files into C:\DJ204 directory. This is where DJGPP is
installed
4) Using RHIDE build the exe
5) Copy the exe to the Win2k box and executed the app on a NTFS and a FAT32
partition and in both cases the app :
a) Finds the DJDIR environemnt variable (therefore _open patch works)
b) Rename the in.txt file to out.txt
c) Create the temp_o.txt and temp_c.txt
Should the TEMP_O.TXT file have the read only attribute set?
Is the sample app okay for the test? If not, what are the changes I need to
do?
C:\temp>main
DJGPP = D:/DJGPP/DJGPP.ENV
DJDIR = d:/djgpp
_osmajor = 5
_osminor = 0
./in.txt -> ./out.txt: Done
19/07/2001 08:24p 7 OUT.TXT
19/07/2001 08:31p 0 TEMP_C.TXT
19/07/2001 08:31p 0 TEMP_O.TXT
A C:\temp\OUT.TXT
A C:\temp\TEMP_C.TXT
A R C:\temp\TEMP_O.TXT
#include <stdlib.h>
#include <dos.h>
#include <fcntl.h>
#include <errno.h>
>> TEST APP SRC
#ifndef TRUE
#define TRUE -1
#define FALSE 0
#endif
int main (int argc , char * argv[] )
{
int q;
char *djgpp = getenv("DJGPP");
char *djdir = getenv("DJDIR");
char file_1[]="./in.txt";
char file_2[]="./out.txt";
printf("DJGPP = %s\n",djgpp);
printf("DJDIR = %s\n",djdir);
printf("_osmajor = %d\n",_osmajor);
printf("_osminor = %d\n",_osminor);
q = open("./temp_o.txt", O_CREAT);
q = _creat("./temp_c.txt", O_CREAT);
printf ("%s -> %s: ", file_1,file_2);
if (_rename (file_1,file_2))
printf ("%s\n", strerror (errno));
else
printf ("Done\n");
return 0;
}
----- Original Message -----
From: "Martin Str|mberg" <ams AT ludd DOT luth DOT se>
To: <djgpp-workers AT delorie DOT com>
Sent: Thursday, July 19, 2001 5:11 AM
Subject: Re: DJDIR Windows 2000 investigation results #1
> Can somebody with W2k try this patch? It supposed to correct the
> opening of files.
>
>
> Right,
>
> MartinS
> Index: src/libc/dos/io/_creat.c
> ===================================================================
> RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_creat.c,v
> retrieving revision 1.5
> diff -p -u -r1.5 _creat.c
> --- src/libc/dos/io/_creat.c 2001/01/30 19:53:25 1.5
> +++ src/libc/dos/io/_creat.c 2001/07/18 19:05:09
> @@ -29,11 +29,14 @@ _creat(const char* filename, int attrib)
>
> if(use_lfn) {
> r.x.ax = 0x716c;
> - r.x.bx = 0x1002; /* Open r/w with extended size. */
> + r.x.bx = 0x0002; /* Open r/w. */
> + if (7 <= _osmajor && _osmajor < 10) {
> + r.x.bx |= 0x1000; /* 0x1000 is FAT32 extended size. */
> + }
> r.x.dx = 0x0012; /* Create, truncate if exists */
> r.x.si = __tb_offset;
> } else {
> - if(7 <= _osmajor && _osmajor < 10) {
> + if (7 <= _osmajor && _osmajor < 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
> Index: src/libc/dos/io/_open.c
> ===================================================================
> RCS file: /cvs/djgpp/djgpp/src/libc/dos/io/_open.c,v
> retrieving revision 1.4
> diff -p -u -r1.4 _open.c
> --- src/libc/dos/io/_open.c 2001/01/30 19:53:25 1.4
> +++ src/libc/dos/io/_open.c 2001/07/18 19:05:09
> @@ -30,11 +30,14 @@ _open(const char* filename, int oflag)
>
> if(use_lfn) {
> r.x.ax = 0x716c;
> - r.x.bx = (oflag & 0xff) | 0x1000; /* 0x1000 is FAT32 extended size.
*/
> + r.x.bx = (oflag & 0xff);
> + if (7 <= _osmajor && _osmajor < 10) {
> + r.x.bx |= 0x1000; /* 0x1000 is FAT32 extended size. */
> + }
> r.x.dx = 1; /* Open existing file */
> r.x.si = __tb_offset;
> } else {
> - if(7 <= _osmajor && _osmajor < 10) {
> + if (7 <= _osmajor && _osmajor < 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
>
- Raw text -