mountmgr: Make creating a backup optional for shell folders.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-09-17 16:49:30 +02:00
parent cd37863832
commit fefb5da4ba
3 changed files with 10 additions and 5 deletions

View File

@ -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 */
{

View File

@ -80,6 +80,7 @@ struct mountmgr_unix_drive
struct mountmgr_shell_folder
{
BOOL create_backup;
ULONG folder_offset;
ULONG folder_size;
ULONG symlink_offset;

View File

@ -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 );