mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:19:49 +00:00
kernel32: Make CopyFile(Ex)() succeed even if the source file is delete-locked.
This commit is contained in:
parent
e21c805fbe
commit
5a3ff7ccc1
2 changed files with 4 additions and 3 deletions
|
@ -957,7 +957,8 @@ BOOL WINAPI CopyFileExW(LPCWSTR source, LPCWSTR dest,
|
|||
|
||||
TRACE("%s -> %s, %x\n", debugstr_w(source), debugstr_w(dest), flags);
|
||||
|
||||
if ((h1 = CreateFileW(source, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
if ((h1 = CreateFileW(source, GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
NULL, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
WARN("Unable to open source %s\n", debugstr_w(source));
|
||||
|
|
|
@ -652,11 +652,11 @@ static void test_CopyFileA(void)
|
|||
"copying from an r+w opened and r shared file failed (ret=%d, err=%d)\n", retok, GetLastError());
|
||||
CloseHandle(hfile);
|
||||
|
||||
/* copying from a delete-locked source is unreliable */
|
||||
/* copying from a delete-locked source mostly succeeds */
|
||||
hfile = CreateFileA(source, DELETE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
|
||||
ok(hfile != INVALID_HANDLE_VALUE, "failed to open source file, error %d\n", GetLastError());
|
||||
retok = CopyFileA(source, dest, FALSE);
|
||||
ok((!retok && GetLastError() == ERROR_SHARING_VIOLATION) || broken(retok) /* 98, Vista, 2k8, 7 */,
|
||||
ok(retok || broken(!retok && GetLastError() == ERROR_SHARING_VIOLATION) /* NT, 2000, XP */,
|
||||
"copying from a delete-locked file failed (ret=%d, err=%d)\n", retok, GetLastError());
|
||||
CloseHandle(hfile);
|
||||
|
||||
|
|
Loading…
Reference in a new issue