Corrupted file problem Wine20040613,20040505 with Xilinx XST 6.2i

Rein Klazes rklazes at
Tue Jun 15 05:21:30 CDT 2004

On Tue, 15 Jun 2004 11:03:57 +0200, you wrote:

> [...]
>     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.

Indeed, I do not think this is correct, see below.

> [ ... lots of debug output ...]
> trace:file:CreateFileW L"xst/work/hdllib.ref" GENERIC_WRITE FILE_SHARE_READ FILE_SHARE_WRITE OPEN
> _ALWAYS attributes 0x80

Your program specifies OPEN_ALWAYS as one of the flags for CreateFile. I
am quite sure that does not truncate an existing file.

You should look for other possibilities in the log. Perhaps:

- it calls SetEndOfFile() or similar function to truncate the file;
- It set the file pointer to the beginning and writes from there;
- it deletes the file before opening it (so it will be created anew).

and something goes wrong there.

I do not know what debug message flags you used,
WINEDEBUG=+relay,+file,+ntdll should be enough.

Do use the latest wine, this is an area where lots of changes where made

If you want us to look at the log, open a bug report in
and create an attachment from your (bzip2'ed) log.

Rein Klazes
rklazes at

More information about the wine-users mailing list