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
0012f56a
Commit
0012f56a
authored
Jun 21, 2006
by
Saulius Krasuckas
Committed by
Alexandre Julliard
Jun 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: Add tests for OpenFile.
parent
f1c3191b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
2 deletions
+42
-2
file.c
dlls/kernel/tests/file.c
+42
-2
No files found.
dlls/kernel/tests/file.c
View file @
0012f56a
...
...
@@ -1443,15 +1443,18 @@ static void test_read_write(void)
ok
(
ret
,
"DeleteFileA: error %ld
\n
"
,
GetLastError
());
}
static
void
test_OpenFile
_exists
(
void
)
static
void
test_OpenFile
(
void
)
{
HFILE
hFile
;
OFSTRUCT
ofs
;
BOOL
ret
;
DWORD
retval
;
static
const
char
*
file
=
"
\\
regsvr32.exe"
;
char
buff
[
MAX_PATH
];
UINT
length
;
/* Check for existing file */
length
=
GetSystemDirectoryA
(
buff
,
MAX_PATH
);
if
((
length
+
lstrlen
(
file
)
<
MAX_PATH
))
...
...
@@ -1462,8 +1465,45 @@ static void test_OpenFile_exists(void)
ok
(
hFile
==
TRUE
,
"%s not found : %ld
\n
"
,
buff
,
GetLastError
());
}
/* Check for nonexistent file */
SetLastError
(
0xfaceabee
);
hFile
=
OpenFile
(
".
\\
foo-bar-foo.baz"
,
&
ofs
,
OF_EXIST
);
ok
(
hFile
==
HFILE_ERROR
,
"hFile != HFILE_ERROR : %ld
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"GetLastError() returns %ld
\n
"
,
GetLastError
()
);
/* Create an empty file */
hFile
=
OpenFile
(
filename
,
&
ofs
,
OF_CREATE
);
ok
(
hFile
!=
HFILE_ERROR
,
"OpenFile failed to create nonexistent file
\n
"
);
ret
=
CloseHandle
((
HANDLE
)
hFile
);
ok
(
ret
==
TRUE
,
"CloseHandle() returns %d
\n
"
,
ret
);
retval
=
GetFileAttributesA
(
filename
);
ok
(
retval
!=
INVALID_FILE_ATTRIBUTES
,
"GetFileAttributesA: error %ld
\n
"
,
GetLastError
()
);
/* Check various opening options */
hFile
=
OpenFile
(
filename
,
&
ofs
,
OF_READ
);
ok
(
hFile
!=
HFILE_ERROR
,
"OpenFile failed on read
\n
"
);
ret
=
CloseHandle
((
HANDLE
)
hFile
);
ok
(
ret
==
TRUE
,
"CloseHandle() returns %d
\n
"
,
ret
);
hFile
=
OpenFile
(
filename
,
&
ofs
,
OF_WRITE
);
ok
(
hFile
!=
HFILE_ERROR
,
"OpenFile failed on write
\n
"
);
ret
=
CloseHandle
((
HANDLE
)
hFile
);
ok
(
ret
==
TRUE
,
"CloseHandle() returns %d
\n
"
,
ret
);
hFile
=
OpenFile
(
filename
,
&
ofs
,
OF_READWRITE
);
ok
(
hFile
!=
HFILE_ERROR
,
"OpenFile failed on read/write
\n
"
);
ret
=
CloseHandle
((
HANDLE
)
hFile
);
ok
(
ret
==
TRUE
,
"CloseHandle() returns %d
\n
"
,
ret
);
hFile
=
OpenFile
(
filename
,
&
ofs
,
OF_EXIST
);
ok
(
hFile
==
1
,
"OpenFile failed on finding our created file
\n
"
);
/* Delete the file and make sure it doesn't exist anymore */
hFile
=
OpenFile
(
filename
,
&
ofs
,
OF_DELETE
);
ok
(
hFile
==
1
,
"OpenFile failed on delete (%d)
\n
"
,
hFile
);
retval
=
GetFileAttributesA
(
filename
);
ok
(
retval
==
INVALID_FILE_ATTRIBUTES
,
"GetFileAttributesA succeeded on deleted file
\n
"
);
}
static
void
test_overlapped
(
void
)
...
...
@@ -1552,6 +1592,6 @@ START_TEST(file)
test_GetFileType
();
test_async_file_errors
();
test_read_write
();
test_OpenFile
_exists
();
test_OpenFile
();
test_overlapped
();
}
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