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
8811628c
Commit
8811628c
authored
May 22, 2004
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
May 22, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for opening an already opened file for writing in a not
compatible sharing mode.
parent
fe0460fd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
file.c
dlls/kernel/tests/file.c
+30
-0
No files found.
dlls/kernel/tests/file.c
View file @
8811628c
...
...
@@ -519,6 +519,8 @@ static void test_CopyFileA(void)
char
temp_path
[
MAX_PATH
];
char
source
[
MAX_PATH
],
dest
[
MAX_PATH
];
static
const
char
prefix
[]
=
"pfx"
;
HANDLE
hfile
;
char
buf
[
10
];
DWORD
ret
;
ret
=
GetTempPathA
(
MAX_PATH
,
temp_path
);
...
...
@@ -528,9 +530,18 @@ static void test_CopyFileA(void)
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
source
);
ok
(
ret
!=
0
,
"GetTempFileNameA error %ld
\n
"
,
GetLastError
());
/* make the source have not zero size */
hfile
=
CreateFileA
(
source
,
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"failed to open source file
\n
"
);
ok
(
WriteFile
(
hfile
,
prefix
,
sizeof
(
prefix
),
&
ret
,
NULL
)
&&
ret
==
sizeof
(
prefix
),
"WriteFile error %ld
\n
"
,
GetLastError
());
ok
(
GetFileSize
(
hfile
,
NULL
)
==
sizeof
(
prefix
),
"source file has wrong size
\n
"
);
CloseHandle
(
hfile
);
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
dest
);
ok
(
ret
!=
0
,
"GetTempFileNameA error %ld
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
CopyFileA
(
source
,
dest
,
TRUE
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_EXISTS
,
"CopyFileA: unexpected error %ld
\n
"
,
GetLastError
());
...
...
@@ -538,6 +549,25 @@ static void test_CopyFileA(void)
ret
=
CopyFileA
(
source
,
dest
,
FALSE
);
ok
(
ret
,
"CopyFileA: error %ld
\n
"
,
GetLastError
());
/* make sure that destination has correct size */
hfile
=
CreateFileA
(
dest
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"failed to open destination file
\n
"
);
ret
=
GetFileSize
(
hfile
,
NULL
);
ok
(
ret
==
sizeof
(
prefix
),
"destination file has wrong size %ld
\n
"
,
ret
);
SetLastError
(
0xdeadbeef
);
ret
=
CopyFileA
(
source
,
dest
,
FALSE
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_SHARING_VIOLATION
,
"CopyFileA: ret = %ld, unexpected error %ld
\n
"
,
ret
,
GetLastError
());
/* make sure that destination still has correct size */
ret
=
GetFileSize
(
hfile
,
NULL
);
ok
(
ret
==
sizeof
(
prefix
),
"destination file has wrong size %ld
\n
"
,
ret
);
ok
(
ReadFile
(
hfile
,
buf
,
sizeof
(
buf
),
&
ret
,
NULL
)
&&
ret
==
sizeof
(
prefix
),
"ReadFile: error %ld
\n
"
,
GetLastError
());
ok
(
!
memcmp
(
prefix
,
buf
,
sizeof
(
prefix
)),
"buffer contents mismatch
\n
"
);
CloseHandle
(
hfile
);
ret
=
DeleteFileA
(
source
);
ok
(
ret
,
"DeleteFileA: error %ld
\n
"
,
GetLastError
());
ret
=
DeleteFileA
(
dest
);
...
...
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