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 know.
<br><br>Erich Hoover<br><a href="mailto:ehoover@mines.edu">ehoover@mines.edu</a><br><br><div><span class="gmail_quote">On 2/26/07, <b class="gmail_sendername">Felix Nawothnig</b> &lt;<a href="mailto:flexo@holycrap.org">flexo@holycrap.org
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Erich Hoover wrote:<br>&gt; Real Name:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Erich Hoover<br>&gt; Description:
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Implements the functions ReplaceFileA and ReplaceFileW in kernel32<br>&gt; (Bug #7544).&nbsp;&nbsp;Also provides conformance test code to ensure proper<br>&gt; functionality.<br>&gt; Changelog:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; kernel32: Implement ReplaceFileA/ReplaceFileW
<br><br>Your patch seems to introduce lots of race cons. It&#39;s possible these<br>exist on Win32 too but can&#39;t we avoid them?<br></blockquote></div><br>