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
2ca58402
Commit
2ca58402
authored
Mar 07, 2011
by
Juan Lang
Committed by
Alexandre Julliard
Mar 09, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Add some parameter checking to FileTimeToDosDateTime.
parent
c4d628cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
time.c
dlls/kernel32/tests/time.c
+38
-0
time.c
dlls/kernel32/time.c
+10
-1
No files found.
dlls/kernel32/tests/time.c
View file @
2ca58402
...
...
@@ -600,6 +600,43 @@ static void test_TzSpecificLocalTimeToSystemTime(void)
}
}
static
void
test_FileTimeToDosDateTime
(
void
)
{
FILETIME
ft
=
{
0
};
WORD
fatdate
,
fattime
;
BOOL
ret
;
if
(
0
)
{
/* Crashes */
FileTimeToDosDateTime
(
NULL
,
NULL
,
NULL
);
}
/* Parameter checking */
SetLastError
(
0xdeadbeef
);
ret
=
FileTimeToDosDateTime
(
&
ft
,
NULL
,
NULL
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
FileTimeToDosDateTime
(
&
ft
,
&
fatdate
,
NULL
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
FileTimeToDosDateTime
(
&
ft
,
NULL
,
&
fattime
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
FileTimeToDosDateTime
(
&
ft
,
&
fatdate
,
&
fattime
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
}
START_TEST
(
time
)
{
HMODULE
hKernel
=
GetModuleHandle
(
"kernel32"
);
...
...
@@ -612,4 +649,5 @@ START_TEST(time)
test_FileTimeToSystemTime
();
test_FileTimeToLocalFileTime
();
test_TzSpecificLocalTimeToSystemTime
();
test_FileTimeToDosDateTime
();
}
dlls/kernel32/time.c
View file @
2ca58402
...
...
@@ -1000,9 +1000,18 @@ BOOL WINAPI FileTimeToDosDateTime( const FILETIME *ft, LPWORD fatdate,
time_t
unixtime
;
struct
tm
*
tm
;
if
(
!
fatdate
||
!
fattime
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
li
.
u
.
LowPart
=
ft
->
dwLowDateTime
;
li
.
u
.
HighPart
=
ft
->
dwHighDateTime
;
RtlTimeToSecondsSince1970
(
&
li
,
&
t
);
if
(
!
RtlTimeToSecondsSince1970
(
&
li
,
&
t
))
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
unixtime
=
t
;
tm
=
gmtime
(
&
unixtime
);
if
(
fattime
)
...
...
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