kernel32: Implement ReplaceFileA/ReplaceFileW

Erich Hoover ehoover at
Mon Feb 26 14:42:53 CST 2007

I assume you're referring to the file existence check and file delete,
followed by the actual copy and move.  I implemented these checks in this
manner in order to provide error codes consistent with the documentation.  I
am not incredibly familiar with the Wine internals, but it looks to me like
the functions called should handle a simultaneous call from another thread
(without unnecessary code duplication).  For example, if the "replaced" file
goes missing between the check and the CopyFileW call then CopyFileW will
return an error.  If the "replaced" file appears between the DeleteFileW
call and the MoveFileExW call (since the MOVEFILE_REPLACE_EXISTING flag is
not set), then the MoveFileExW call will fail.  The documentation's expected
error codes for ReplaceFile seem to be consistent with these potential
outcomes.  I apologize if there's something I'm missing here, please let me

Erich Hoover
ehoover at

On 2/26/07, Felix Nawothnig <flexo at> wrote:
> Erich Hoover wrote:
> > Real Name:
> >     Erich Hoover
> > Description:
> >     Implements the functions ReplaceFileA and ReplaceFileW in kernel32
> > (Bug #7544).  Also provides conformance test code to ensure proper
> > functionality.
> > Changelog:
> >     kernel32: Implement ReplaceFileA/ReplaceFileW
> Your patch seems to introduce lots of race cons. It's possible these
> exist on Win32 too but can't we avoid them?
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the wine-devel mailing list