Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
70189853
Commit
70189853
authored
Aug 09, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add some tests for setting file times.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6e3d68b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
file.c
dlls/kernel32/tests/file.c
+56
-0
No files found.
dlls/kernel32/tests/file.c
View file @
70189853
...
@@ -5065,6 +5065,17 @@ todo_wine
...
@@ -5065,6 +5065,17 @@ todo_wine
ok
(
ret
,
"Failed to get basic info, error %d.
\n
"
,
GetLastError
());
ok
(
ret
,
"Failed to get basic info, error %d.
\n
"
,
GetLastError
());
ok
(
atime
.
QuadPart
+
1
==
basicinfo
.
LastAccessTime
.
QuadPart
,
"Unexpected access time.
\n
"
);
ok
(
atime
.
QuadPart
+
1
==
basicinfo
.
LastAccessTime
.
QuadPart
,
"Unexpected access time.
\n
"
);
memset
(
&
basicinfo
,
0
,
sizeof
(
basicinfo
));
basicinfo
.
LastAccessTime
.
QuadPart
=
-
1
;
ret
=
pSetFileInformationByHandle
(
file
,
FileBasicInfo
,
&
basicinfo
,
sizeof
(
basicinfo
));
todo_wine
ok
(
ret
,
"Failed to set basic info, error %d.
\n
"
,
GetLastError
());
memset
(
&
basicinfo
,
0
,
sizeof
(
basicinfo
));
ret
=
pGetFileInformationByHandleEx
(
file
,
FileBasicInfo
,
&
basicinfo
,
sizeof
(
basicinfo
));
ok
(
ret
,
"Failed to get basic info, error %d.
\n
"
,
GetLastError
());
ok
(
atime
.
QuadPart
+
1
==
basicinfo
.
LastAccessTime
.
QuadPart
,
"Unexpected access time.
\n
"
);
dispinfo
.
DeleteFile
=
TRUE
;
dispinfo
.
DeleteFile
=
TRUE
;
ret
=
pSetFileInformationByHandle
(
file
,
FileDispositionInfo
,
&
dispinfo
,
sizeof
(
dispinfo
));
ret
=
pSetFileInformationByHandle
(
file
,
FileDispositionInfo
,
&
dispinfo
,
sizeof
(
dispinfo
));
ok
(
ret
,
"setting FileDispositionInfo failed, error %d
\n
"
,
GetLastError
());
ok
(
ret
,
"setting FileDispositionInfo failed, error %d
\n
"
,
GetLastError
());
...
@@ -5357,6 +5368,50 @@ static void test_find_file_stream(void)
...
@@ -5357,6 +5368,50 @@ static void test_find_file_stream(void)
ok
(
error
==
ERROR_HANDLE_EOF
,
"Expected ERROR_HANDLE_EOF, got %d
\n
"
,
error
);
ok
(
error
==
ERROR_HANDLE_EOF
,
"Expected ERROR_HANDLE_EOF, got %d
\n
"
,
error
);
}
}
static
void
test_SetFileTime
(
void
)
{
static
const
WCHAR
prefix
[]
=
{
'p'
,
'f'
,
'x'
,
0
};
WCHAR
path
[
MAX_PATH
],
temp_path
[
MAX_PATH
];
FILETIME
ft1
,
ft2
;
DWORD
ret
,
len
;
HANDLE
hfile
;
ret
=
GetTempPathW
(
MAX_PATH
,
temp_path
);
ok
(
ret
!=
0
,
"GetTempPathW error %d
\n
"
,
GetLastError
());
ok
(
ret
<
MAX_PATH
,
"temp path should fit into MAX_PATH
\n
"
);
ret
=
GetTempFileNameW
(
temp_path
,
prefix
,
0
,
path
);
ok
(
ret
!=
0
,
"GetTempFileNameW error %d
\n
"
,
GetLastError
());
hfile
=
CreateFileW
(
path
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_DELETE_ON_CLOSE
,
0
);
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"failed to open source file
\n
"
);
ret
=
WriteFile
(
hfile
,
prefix
,
sizeof
(
prefix
),
&
len
,
NULL
);
ok
(
ret
&&
len
==
sizeof
(
prefix
),
"WriteFile error %d
\n
"
,
GetLastError
());
ok
(
GetFileSize
(
hfile
,
NULL
)
==
sizeof
(
prefix
),
"source file has wrong size
\n
"
);
ret
=
GetFileTime
(
hfile
,
NULL
,
NULL
,
&
ft1
);
ok
(
ret
,
"GetFileTime error %d
\n
"
,
GetLastError
());
ft2
=
ft1
;
ft2
.
dwLowDateTime
-=
600000000
;
/* 60 second */
ret
=
SetFileTime
(
hfile
,
NULL
,
NULL
,
&
ft2
);
ok
(
ret
,
"SetFileTime error %d
\n
"
,
GetLastError
());
memset
(
&
ft2
,
0
,
sizeof
(
ft2
));
ret
=
GetFileTime
(
hfile
,
NULL
,
NULL
,
&
ft2
);
/* get the actual time back */
ok
(
ret
,
"GetFileTime error %d
\n
"
,
GetLastError
());
ok
(
memcmp
(
&
ft1
,
&
ft2
,
sizeof
(
ft1
)),
"Unexpected write time.
\n
"
);
memset
(
&
ft1
,
0xff
,
sizeof
(
ft1
));
ret
=
SetFileTime
(
hfile
,
NULL
,
NULL
,
&
ft1
);
todo_wine
ok
(
ret
,
"SetFileTime error %d
\n
"
,
GetLastError
());
memset
(
&
ft1
,
0
,
sizeof
(
ft1
));
ret
=
GetFileTime
(
hfile
,
NULL
,
NULL
,
&
ft1
);
/* get the actual time back */
ok
(
ret
,
"GetFileTime error %d
\n
"
,
GetLastError
());
ok
(
!
memcmp
(
&
ft1
,
&
ft2
,
sizeof
(
ft1
)),
"Unexpected write time.
\n
"
);
CloseHandle
(
hfile
);
}
START_TEST
(
file
)
START_TEST
(
file
)
{
{
char
temp_path
[
MAX_PATH
];
char
temp_path
[
MAX_PATH
];
...
@@ -5429,4 +5484,5 @@ START_TEST(file)
...
@@ -5429,4 +5484,5 @@ START_TEST(file)
test_overlapped_read
();
test_overlapped_read
();
test_file_readonly_access
();
test_file_readonly_access
();
test_find_file_stream
();
test_find_file_stream
();
test_SetFileTime
();
}
}
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