Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
240afab3
Commit
240afab3
authored
Feb 23, 2010
by
Christian Costa
Committed by
Alexandre Julliard
Feb 23, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Allow copy operation to overwrite an existing write protected file + tests.
parent
fc7f1c7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
shlfileop.c
dlls/shell32/shlfileop.c
+7
-1
shlfileop.c
dlls/shell32/tests/shlfileop.c
+20
-0
No files found.
dlls/shell32/shlfileop.c
View file @
240afab3
...
...
@@ -624,9 +624,15 @@ static DWORD SHNotifyMoveFileW(LPCWSTR src, LPCWSTR dest)
static
DWORD
SHNotifyCopyFileW
(
LPCWSTR
src
,
LPCWSTR
dest
,
BOOL
bFailIfExists
)
{
BOOL
ret
;
DWORD
attribs
;
TRACE
(
"(%s %s %s)
\n
"
,
debugstr_w
(
src
),
debugstr_w
(
dest
),
bFailIfExists
?
"failIfExists"
:
""
);
/* Destination file may already exist with read only attribute */
attribs
=
GetFileAttributesW
(
dest
);
if
(
IsAttrib
(
attribs
,
FILE_ATTRIBUTE_READONLY
))
SetFileAttributesW
(
dest
,
attribs
&
~
FILE_ATTRIBUTE_READONLY
);
ret
=
CopyFileW
(
src
,
dest
,
bFailIfExists
);
if
(
ret
)
{
...
...
@@ -1132,7 +1138,7 @@ static BOOL copy_file_to_file(FILE_OPERATION *op, const WCHAR *szFrom, const WCH
if
(
!
SHELL_ConfirmDialogW
(
op
->
req
->
hwnd
,
ASK_OVERWRITE_FILE
,
PathFindFileNameW
(
szTo
),
op
))
return
0
;
}
return
SHNotifyCopyFileW
(
szFrom
,
szTo
,
FALSE
)
==
0
;
}
...
...
dlls/shell32/tests/shlfileop.c
View file @
240afab3
...
...
@@ -965,6 +965,26 @@ static void test_copy(void)
ok
(
retval
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
retval
);
ok
(
file_exists
(
"testdir2
\\
test1.txt"
),
"Expected testdir2
\\
test1 to exist
\n
"
);
/* try to overwrite an existing write protected file */
clean_after_shfo_tests
();
init_shfo_tests
();
tmp_flags
=
shfo
.
fFlags
;
shfo
.
pFrom
=
"test1.txt
\0
"
;
shfo
.
pTo
=
"test2.txt
\0
"
;
/* suppress the error-dialog in win9x here */
shfo
.
fFlags
=
FOF_NOERRORUI
|
FOF_NOCONFIRMATION
|
FOF_SILENT
;
ok
(
SetFileAttributesA
(
shfo
.
pTo
,
FILE_ATTRIBUTE_READONLY
),
"Failure to set file attributes (error %x)
\n
"
,
GetLastError
());
retval
=
CopyFileA
(
shfo
.
pFrom
,
shfo
.
pTo
,
FALSE
);
ok
(
!
retval
&&
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"CopyFileA should have fail with ERROR_ACCESS_DENIED
\n
"
);
retval
=
SHFileOperationA
(
&
shfo
);
/* Does not work on Win95, Win95B, NT4WS and NT4SRV */
ok
(
!
retval
||
broken
(
retval
==
DE_OPCANCELLED
),
"SHFileOperationA failed to copy (error %x)
\n
"
,
retval
);
/* Set back normal attributes to make the file deletion succeed */
ok
(
SetFileAttributesA
(
shfo
.
pTo
,
FILE_ATTRIBUTE_NORMAL
),
"Failure to set file attributes (error %x)
\n
"
,
GetLastError
());
shfo
.
fFlags
=
tmp_flags
;
/* try to copy files to a file */
clean_after_shfo_tests
();
init_shfo_tests
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment