Alexandre Julliard : mountmgr: Make creating a backup optional for shell folders.

Alexandre Julliard julliard at winehq.org
Fri Sep 17 16:03:08 CDT 2021


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Sep 17 16:49:30 2021 +0200

mountmgr: Make creating a backup optional for shell folders.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mountmgr.sys/mountmgr.c | 13 ++++++++-----
 include/ddk/mountmgr.h       |  1 +
 programs/winecfg/drive.c     |  1 +
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c
index 2f669fcc868..cf7c9d636f0 100644
--- a/dlls/mountmgr.sys/mountmgr.c
+++ b/dlls/mountmgr.sys/mountmgr.c
@@ -335,13 +335,16 @@ static NTSTATUS define_shell_folder( const void *in_buff, SIZE_T insize )
         if (status != STATUS_BUFFER_TOO_SMALL) return status;
     }
 
-    if (!(backup = HeapAlloc( GetProcessHeap(), 0, strlen(buffer) + sizeof(".backup" ) )))
+    if (input->create_backup)
     {
-        status = STATUS_NO_MEMORY;
-        goto done;
+        if (!(backup = HeapAlloc( GetProcessHeap(), 0, strlen(buffer) + sizeof(".backup" ) )))
+        {
+            status = STATUS_NO_MEMORY;
+            goto done;
+        }
+        strcpy( backup, buffer );
+        strcat( backup, ".backup" );
     }
-    strcpy( backup, buffer );
-    strcat( backup, ".backup" );
 
     if (!lstat( buffer, &st )) /* move old folder/link out of the way */
     {
diff --git a/include/ddk/mountmgr.h b/include/ddk/mountmgr.h
index 3c82e03ea36..11d4052305c 100644
--- a/include/ddk/mountmgr.h
+++ b/include/ddk/mountmgr.h
@@ -80,6 +80,7 @@ struct mountmgr_unix_drive
 
 struct mountmgr_shell_folder
 {
+    BOOL     create_backup;
     ULONG    folder_offset;
     ULONG    folder_size;
     ULONG    symlink_offset;
diff --git a/programs/winecfg/drive.c b/programs/winecfg/drive.c
index a82fe74dfe2..bee5be3af34 100644
--- a/programs/winecfg/drive.c
+++ b/programs/winecfg/drive.c
@@ -362,6 +362,7 @@ void set_shell_folder( const WCHAR *path, const char *dest )
     if (dest) len += strlen(dest) + 1;
 
     if (!(ioctl = HeapAlloc( GetProcessHeap(), 0, len ))) return;
+    ioctl->create_backup = TRUE;
     ioctl->folder_offset = sizeof(*ioctl);
     ioctl->folder_size = nt_name.Length;
     memcpy( (char *)ioctl + ioctl->folder_offset, nt_name.Buffer, nt_name.Length );




More information about the wine-cvs mailing list