Corrupted file problem Wine20040613,20040505 with Xilinx XST 6.2i

Oli1417 at gmx.net Oli1417 at gmx.net
Tue Jun 15 04:03:57 CDT 2004


Hi,

I've a strange problem with Xilinx XST (ISE) 6.2i, a 
Software for FPGA developement. A sort of silicon compiler
for Xilinx Fpgas chips.

System is: Suse 9.1, Linux cassix 2.6.4-52-default #1 Wed Apr 7 
02:08:30 UTC 2004 i686 i686 i386 GNU/Linux

The XST program while running  usually does a lot of file processing 
and creates libraries-files etc and so on.

One of those files is a simple ascii file called "hdllib.ref". It 
usually looks like more or less like this, size around some k-bytes.

[...]
AR hex2led hex2led_arch F:/Test/watchvhd_u/hex2led.vhd sub00/vhpl09
EN hex2led NULL F:/Test/watchvhd_u/hex2led.vhd sub00/vhpl08
AR smallcntr inside F:/Test/watchvhd_u/smallcntr.vhd sub00/vhpl01
[...]

When I'm running the XST program with wine, this file gets corrupted 
by leading zero-bytes in the beginning of the file:

[0x00 0x00 0x00 0x00 ... all bytes are zero until some time the 
text starts.]
AR hex2led hex2led_arch F:/Test/watchvhd_u/hex2led.vhd sub00/vhpl09
EN hex2led NULL F:/Test/watchvhd_u/hex2led.vhd sub00/vhpl08
AR smallcntr inside F:/Test/watchvhd_u/smallcntr.vhd sub00/vhpl01
[...]

I debugged a bit and found out, that this file is 'rewritten' several
times during the program run (see debugging output below).

The problem seems to be, that each time is written new, the new data
is appended to the end of the file, instead of being put in the 
beginning !? For some reason the previous data in the file is put to 0x00.

The problem does not occure under Win XP.

While debugging I grepped through the wine source, to track down
what's happening -  I don't know the wine internals at all (now more
then before) - and changed following file:

wine20040613/wine/server/file.c
[...]
static struct object *create_file( const char *nameptr, size_t len, unsigned int access,
                                   unsigned int sharing, int create, unsigned int options,
                                   unsigned int attrs )
[...]
    switch(create)
    {
    case FILE_CREATE:       flags = O_CREAT | O_EXCL; break;
    case FILE_OVERWRITE_IF: /* FIXME: the difference is whether we trash existing attr or not */
    case FILE_SUPERSEDE:    flags = O_CREAT | O_TRUNC; break;
    case FILE_OPEN:         flags = 0; break;

    case FILE_OPEN_IF:      flags = O_CREAT | O_TRUNC; break; 
				            ^^^^^^^^^ CHANGED here
					    
    case FILE_OVERWRITE:    flags = O_TRUNC; break;
    default:                set_error( STATUS_INVALID_PARAMETER ); goto error;
    }


=>> Now it works ;) !?!?  

Well - I know that in fact I don't know really what I did (that's life)
 ... perhaps I did break something else now.

But it might give a hint for the Wine Pros here, for a possible 
improvement. IT'S A GREAT PROJECT BTW!!!
 
Fell free to ask for more info, in case.

Cheerio,

Oliver



[ ... lots of debug output ...]
trace:file:CreateFileW L"xst/work/hdllib.ref" GENERIC_WRITE FILE_SHARE_READ FILE_SHARE_WRITE OPEN
_ALWAYS attributes 0x80
trace:ntdll:NtCreateFile handle=0x40d30b70 access=40000000 name=L"\\??\\F:\\Test\\watchvhd_u\\xst
\\work\\hdllib.ref" objattr=00000042 root=(nil) sec=(nil) io=0x40d30b74 alloc_size=(nil)
attr=00000080 sharing=00000003 disp=3 options=00000050 ea=(nil).0x00000000
[ ... lots of debug output ...]
trace:file:CreateFileW L"xst/work/hdllib.ref" GENERIC_READ GENERIC_WRITE FILE_SHARE_READ FILE_SHA
RE_WRITE FILE_SHARE_DELETE OPEN_EXISTING attributes 0x4000000
trace:ntdll:NtCreateFile handle=0x40d30bdc access=c0000000 name=L"\\??\\F:\\Test\\watchvhd_u\\xst
\\work\\hdllib.ref" objattr=00000040 root=(nil) sec=(nil) io=0x40d30be0 alloc_size=(nil)
attr=00000000 sharing=00000007 disp=1 options=00001050 ea=(nil).0x00000000
trace:file:wine_nt_to_unix_file_name L"\\??\\F:\\Test\\watchvhd_u\\xst\\work\\hdllib.ref" -> "/ho
me/oliver/.wine/dosdevices/f:/Test/watchvhd_u/xst/work/hdllib.ref"
trace:file:CreateFileW returning 0x440
[ ... lots of debug output ...]
trace:file:CreateFileW L"xst/work/hdllib.ref" GENERIC_READ FILE_SHARE_READ FILE_SHARE_WRITE OPEN_
EXISTING attributes 0x80
trace:ntdll:NtCreateFile handle=0x40d30920 access=80000000 name=L"\\??\\F:\\Test\\watchvhd_u\\xst
\\work\\hdllib.ref" objattr=00000042 root=(nil) sec=(nil) io=0x40d30924 alloc_size=(nil)
attr=00000080 sharing=00000003 disp=1 options=00000050 ea=(nil).0x00000000
warn:file:wine_nt_to_unix_file_name L"hdllib.ref" not found in /home/oliver/.wine/dosdevices/f:/T
est/watchvhd_u/xst/work
[ ... lots of debug output ...]
trace:file:CreateFileW L"xst/work/hdllib.ref" GENERIC_WRITE FILE_SHARE_READ FILE_SHARE_WRITE OPEN
_ALWAYS attributes 0x80
trace:ntdll:NtCreateFile handle=0x40d21f7c access=40000000 name=L"\\??\\F:\\Test\\watchvhd_u\\xst
\\work\\hdllib.ref" objattr=00000042 root=(nil) sec=(nil) io=0x40d21f80 alloc_size=(nil)
attr=00000080 sharing=00000003 disp=3 options=00000050 ea=(nil).0x00000000
[ ... lots of debug output ...]
trace:file:CreateFileW L"xst/work/hdllib.ref" GENERIC_READ GENERIC_WRITE FILE_SHARE_READ FILE_SHA
RE_WRITE FILE_SHARE_DELETE OPEN_EXISTING attributes 0x4000000
trace:ntdll:NtCreateFile handle=0x40d21fe8 access=c0000000 name=L"\\??\\F:\\Test\\watchvhd_u\\xst
\\work\\hdllib.ref" objattr=00000040 root=(nil) sec=(nil) io=0x40d21fec alloc_size=(nil)
attr=00000000 sharing=00000007 disp=1 options=00001050 ea=(nil).0x00000000
trace:file:wine_nt_to_unix_file_name L"\\??\\F:\\Test\\watchvhd_u\\xst\\work\\hdllib.ref" -> "/ho
me/oliver/.wine/dosdevices/f:/Test/watchvhd_u/xst/work/hdllib.ref"
trace:file:CreateFileW returning 0x444
[... and so on ...]







More information about the wine-users mailing list