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
bc2b9e3f
Commit
bc2b9e3f
authored
Feb 14, 2006
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Feb 14, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Fix invalid date/time check in MCM_SETRANGE: ignore time and fail on bad date.
parent
8aee2f29
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
25 deletions
+36
-25
monthcal.c
dlls/comctl32/monthcal.c
+16
-24
monthcal.c
dlls/comctl32/tests/monthcal.c
+20
-1
No files found.
dlls/comctl32/monthcal.c
View file @
bc2b9e3f
...
@@ -160,14 +160,10 @@ int MONTHCAL_MonthLength(int month, int year)
...
@@ -160,14 +160,10 @@ int MONTHCAL_MonthLength(int month, int year)
/* make sure that time is valid */
/* make sure that time is valid */
static
int
MONTHCAL_ValidateTime
(
SYSTEMTIME
time
)
static
int
MONTHCAL_ValidateTime
(
SYSTEMTIME
time
)
{
{
if
(
time
.
wMonth
>
12
)
return
FALSE
;
if
(
time
.
wMonth
<
1
||
time
.
wMonth
>
12
)
return
FALSE
;
if
(
time
.
wDayOfWeek
>
6
)
return
FALSE
;
if
(
time
.
wDayOfWeek
>
6
)
return
FALSE
;
if
(
time
.
wDay
>
MONTHCAL_MonthLength
(
time
.
wMonth
,
time
.
wYear
))
if
(
time
.
wDay
>
MONTHCAL_MonthLength
(
time
.
wMonth
,
time
.
wYear
))
return
FALSE
;
return
FALSE
;
if
(
time
.
wHour
>
23
)
return
FALSE
;
if
(
time
.
wMinute
>
59
)
return
FALSE
;
if
(
time
.
wSecond
>
59
)
return
FALSE
;
if
(
time
.
wMilliseconds
>
999
)
return
FALSE
;
return
TRUE
;
return
TRUE
;
}
}
...
@@ -943,29 +939,25 @@ MONTHCAL_GetMaxTodayWidth(MONTHCAL_INFO *infoPtr)
...
@@ -943,29 +939,25 @@ MONTHCAL_GetMaxTodayWidth(MONTHCAL_INFO *infoPtr)
static
LRESULT
static
LRESULT
MONTHCAL_SetRange
(
MONTHCAL_INFO
*
infoPtr
,
WPARAM
wParam
,
LPARAM
lParam
)
MONTHCAL_SetRange
(
MONTHCAL_INFO
*
infoPtr
,
WPARAM
wParam
,
LPARAM
lParam
)
{
{
SYSTEMTIME
*
lprgSysTimeArray
=
(
SYSTEMTIME
*
)
lParam
;
SYSTEMTIME
*
lprgSysTimeArray
=
(
SYSTEMTIME
*
)
lParam
;
int
prev
;
int
prev
;
TRACE
(
"%x %lx
\n
"
,
wParam
,
lParam
);
TRACE
(
"%x %lx
\n
"
,
wParam
,
lParam
);
if
((
wParam
&
GDTR_MIN
&&
!
MONTHCAL_ValidateTime
(
lprgSysTimeArray
[
0
]))
||
(
wParam
&
GDTR_MAX
&&
!
MONTHCAL_ValidateTime
(
lprgSysTimeArray
[
1
])))
return
FALSE
;
if
(
wParam
&
GDTR_MAX
)
{
if
(
wParam
&
GDTR_MIN
)
if
(
MONTHCAL_ValidateTime
(
lprgSysTimeArray
[
1
])){
{
MONTHCAL_CopyTime
(
&
lprgSysTimeArray
[
1
],
&
infoPtr
->
maxDate
);
MONTHCAL_CopyTime
(
&
lprgSysTimeArray
[
0
],
&
infoPtr
->
minDate
);
infoPtr
->
rangeValid
|=
GDTR_MAX
;
infoPtr
->
rangeValid
|=
GDTR_MIN
;
}
else
{
GetSystemTime
(
&
infoPtr
->
todaysDate
);
MONTHCAL_CopyTime
(
&
infoPtr
->
todaysDate
,
&
infoPtr
->
maxDate
);
}
}
}
if
(
wParam
&
GDTR_MAX
)
if
(
wParam
&
GDTR_MIN
)
{
{
if
(
MONTHCAL_ValidateTime
(
lprgSysTimeArray
[
0
]))
{
MONTHCAL_CopyTime
(
&
lprgSysTimeArray
[
1
],
&
infoPtr
->
maxDate
);
MONTHCAL_CopyTime
(
&
lprgSysTimeArray
[
0
],
&
infoPtr
->
minDate
);
infoPtr
->
rangeValid
|=
GDTR_MAX
;
infoPtr
->
rangeValid
|=
GDTR_MIN
;
}
else
{
GetSystemTime
(
&
infoPtr
->
todaysDate
);
MONTHCAL_CopyTime
(
&
infoPtr
->
todaysDate
,
&
infoPtr
->
minDate
);
}
}
}
prev
=
infoPtr
->
monthRange
;
prev
=
infoPtr
->
monthRange
;
infoPtr
->
monthRange
=
infoPtr
->
maxDate
.
wMonth
-
infoPtr
->
minDate
.
wMonth
;
infoPtr
->
monthRange
=
infoPtr
->
maxDate
.
wMonth
-
infoPtr
->
minDate
.
wMonth
;
...
...
dlls/comctl32/tests/monthcal.c
View file @
bc2b9e3f
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
void
test_monthcal
(
void
)
void
test_monthcal
(
void
)
{
{
HWND
hwnd
;
HWND
hwnd
;
SYSTEMTIME
st
[
2
];
SYSTEMTIME
st
[
2
]
,
st1
[
2
]
;
INITCOMMONCONTROLSEX
ic
=
{
sizeof
(
INITCOMMONCONTROLSEX
),
ICC_DATE_CLASSES
};
INITCOMMONCONTROLSEX
ic
=
{
sizeof
(
INITCOMMONCONTROLSEX
),
ICC_DATE_CLASSES
};
InitCommonControlsEx
(
&
ic
);
InitCommonControlsEx
(
&
ic
);
...
@@ -39,6 +39,25 @@ void test_monthcal(void)
...
@@ -39,6 +39,25 @@ void test_monthcal(void)
0
,
300
,
300
,
0
,
0
,
NULL
,
NULL
);
0
,
300
,
300
,
0
,
0
,
NULL
,
NULL
);
ok
(
hwnd
!=
NULL
,
"Failed to create MonthCal
\n
"
);
ok
(
hwnd
!=
NULL
,
"Failed to create MonthCal
\n
"
);
GetSystemTime
(
&
st
[
0
]);
GetSystemTime
(
&
st
[
0
]);
st
[
1
]
=
st
[
0
];
/* Invalid date/time */
st
[
0
].
wYear
=
2000
;
/* Time should not matter */
st
[
1
].
wHour
=
st
[
1
].
wMinute
=
st
[
1
].
wSecond
=
70
;
ok
(
SendMessage
(
hwnd
,
MCM_SETRANGE
,
GDTR_MAX
,
(
LPARAM
)
st
),
"Failed to set MAX limit
\n
"
);
ok
(
SendMessage
(
hwnd
,
MCM_GETRANGE
,
0
,
(
LPARAM
)
st1
)
==
GDTR_MAX
,
"No limits should be set
\n
"
);
ok
(
st1
[
0
].
wYear
!=
2000
,
"Lover limit changed
\n
"
);
st
[
1
].
wMonth
=
0
;
ok
(
!
SendMessage
(
hwnd
,
MCM_SETRANGE
,
GDTR_MIN
|
GDTR_MAX
,
(
LPARAM
)
st
),
"Should have failed to set limits
\n
"
);
ok
(
SendMessage
(
hwnd
,
MCM_GETRANGE
,
0
,
(
LPARAM
)
st1
)
==
GDTR_MAX
,
"No limits should be set
\n
"
);
ok
(
st1
[
0
].
wYear
!=
2000
,
"Lover limit changed
\n
"
);
ok
(
!
SendMessage
(
hwnd
,
MCM_SETRANGE
,
GDTR_MAX
,
(
LPARAM
)
st
),
"Should have failed to set MAX limit
\n
"
);
ok
(
SendMessage
(
hwnd
,
MCM_GETRANGE
,
0
,
(
LPARAM
)
st1
)
==
GDTR_MAX
,
"No limits should be set
\n
"
);
ok
(
st1
[
0
].
wYear
!=
2000
,
"Lover limit changed
\n
"
);
GetSystemTime
(
&
st
[
0
]);
st
[
0
].
wMonth
=
5
;
st
[
0
].
wMonth
=
5
;
st
[
1
]
=
st
[
0
];
st
[
1
]
=
st
[
0
];
...
...
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