Bug in MoveFileEx

Gerhard W. Gruber sparhawk at gmx.at
Fri Feb 1 04:58:51 CST 2002

David Elliott wrote:

> Okay, so wine supplies the MoveFileEx function (like NT) for all
> versions.  If you had read the archives you'd know that the chances of
> hell freezing over are greater than the chances of version specific
> behavior being added to Wine.

Is this a principle decision for wine or is this just resignation that
it would be almost impossible to promise such a thing? I think this may
be also a philosophical question but I think that wine tries to emulate
windows. This means to me that we should emulate windows where we know
how it is to be done. Of course there will be a great many places where
this is not the case, but this should be considered a bug IMO. I didn't
read the archives, because it's quite some text to read, so if you could
be a more specific if this has already been decided on, then I would
appreciate a pointer.

> If MoveFileEx actually works and puts the info in the registry the NT way,
> then the only problem you'd have is if an application happened to actually
> check the windows version and use that to decide if it should call
> MoveFileEx or write to WININIT.INI directly.

On the other hand, if we know that MoveFileEx exhibits a certain
behaviour then we should do it as it is implemented in the real thing,
because you can never know what else may depend on it. I think it is
much harder to trakc such a bug down, when it is "fixed" wrongly but
everyone thinks it is good enough. Especially since we have to implement
both ways anyway, it doesn't hurt and will improve compatibillity, which
I think should be the goal of wine. If it's just enough to satsify one
application then my first approach works as good as any other, even if
it is ugly. But I don't want to get my specific app running just to try
a few months later another app and it has to start all over again.
Analyze the problem and realize that it is the same thing that would
have been fixed if it were done properly the first time. Especially
since we know that the behaviour should be different.

> I suspect that most applications are going to behave like you suggest.
> That is that they will call MoveFileEx and if it succeeds then they will
> assume the file is going to get replaced (which see below for how Wine
> will do that).  If MoveFileEx fails then they will add an entry to
> wininit.ini.  That's not a problem because Wine's call should always
> succeed.

In that particular case, but MoveFileEx has more features and I don't
think that you can say for sure that there is not quite a number of
applications that will crash or destroy something because it doesn't
work as it should.

> Now, for the latter case where the app checks the windows version.  Well,
> if it happens to write directly to WININT.INI instead of calling
> MoveFileEx, then no big deal.  We will have code that reads both
> WININIT.INI and the NT-style registry entries.


> Considering that on Windows 9x/ME the WININIT.EXE program takes care of
> this, might I suggest that we create a winelib application (placed in the
> programs/ directory of the sourcetree) that reads in the registry entries
> and the WININIT.INI flle and process the entries and deletes them.  Such a
> program I think would be aptly named simply "wininit".

The sources, that Andreas provided are more or less that.

> Now the trick is to somehow actually get the user to run the wininit
> winelib program when needed.  Personally I feel that this is secondary.
> It could simply be accomplished by a wrapper shell script.  The important
> thing is to get the functionality described above implemented, and

That's what I try to do. :)

More information about the wine-devel mailing list