Commit fbc276ef5 for imagemagick.org

commit fbc276ef5d157551f7842f766d82e45b6bff1300
Author: Dirk Lemstra <dirk@lemstra.org>
Date:   Sun Oct 4 17:11:08 2026 +0200

    Replace _wrename with MoveFileExW so an existing file will be overwritten.

diff --git a/MagickCore/nt-base.c b/MagickCore/nt-base.c
index 43c6cbd26..479dd28f2 100644
--- a/MagickCore/nt-base.c
+++ b/MagickCore/nt-base.c
@@ -2371,7 +2371,7 @@ MagickExport int NTRemoveWide(const char *path)
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  NTRenameWide() renames a file.
+%  NTRenameWide() renames a file, replacing an existing destination file.
 %
 %  The format of the NTRenameWide method is:
 %
@@ -2402,7 +2402,8 @@ MagickExport int NTRenameWide(const char* source, const char* destination)
       source_wide=(wchar_t *) RelinquishMagickMemory(source_wide);
       return(-1);
     }
-  status=_wrename(source_wide,destination_wide);
+  status=MoveFileExW(source_wide,destination_wide,MOVEFILE_REPLACE_EXISTING) ?
+    0 : -1;
   destination_wide=(wchar_t *) RelinquishMagickMemory(destination_wide);
   source_wide=(wchar_t *) RelinquishMagickMemory(source_wide);
   return(status);