Zebediah Figura : kernel32: Create the backup in the same directory.

Alexandre Julliard julliard at winehq.org
Mon Apr 6 15:53:19 CDT 2020


Module: wine
Branch: master
Commit: adfb042819472a23f4d07f7aeea194e463855806
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=adfb042819472a23f4d07f7aeea194e463855806

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Fri Apr  3 10:58:07 2020 -0500

kernel32: Create the backup in the same directory.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/file.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
index 3b2d82cc37..9bd5e0ec7b 100644
--- a/dlls/kernel32/file.c
+++ b/dlls/kernel32/file.c
@@ -43,6 +43,7 @@
 #include "ddk/ntddk.h"
 #include "kernel_private.h"
 #include "fileapi.h"
+#include "shlwapi.h"
 
 #include "wine/exception.h"
 #include "wine/unicode.h"
@@ -502,8 +503,9 @@ BOOL WINAPI ReplaceFileW(LPCWSTR lpReplacedFileName, LPCWSTR lpReplacementFileNa
         static const WCHAR prefixW[] = {'r','f',0};
         WCHAR temp_path[MAX_PATH], temp_file[MAX_PATH];
 
-        if (!GetTempPathW( ARRAY_SIZE(temp_path), temp_path )
-                || !GetTempFileNameW( temp_path, prefixW, 0, temp_file )
+        lstrcpynW( temp_path, lpReplacedFileName, ARRAY_SIZE( temp_path ) );
+        PathRemoveFileSpecW( temp_path );
+        if (!GetTempFileNameW( temp_path, prefixW, 0, temp_file )
                 || !MoveFileExW( lpReplacedFileName, temp_file, MOVEFILE_REPLACE_EXISTING ))
             return FALSE;
 




More information about the wine-cvs mailing list