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
b5603287
Commit
b5603287
authored
Feb 10, 2020
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Feb 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Fix ChangeDisplaySettingsExW() minimum size check.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7d94e9d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
12 deletions
+8
-12
sysparams.c
dlls/user32/sysparams.c
+6
-10
monitor.c
dlls/user32/tests/monitor.c
+2
-2
No files found.
dlls/user32/sysparams.c
View file @
b5603287
...
...
@@ -3285,18 +3285,14 @@ LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND
{
trace_devmode
(
devmode
);
/* This is the minimal dmSize that XP accepts */
if
(
devmode
->
dmSize
<
FIELD_OFFSET
(
DEVMODEW
,
dmFields
))
return
DISP_CHANGE_FAILED
;
if
(
devmode
->
dmSize
<
FIELD_OFFSET
(
DEVMODEW
,
dmICMMethod
))
return
DISP_CHANGE_BADMODE
;
if
(
devmode
->
dmSize
>=
FIELD_OFFSET
(
DEVMODEW
,
dmFields
)
+
sizeof
(
devmode
->
dmFields
))
{
if
(((
devmode
->
dmFields
&
DM_BITSPERPEL
)
&&
devmode
->
dmBitsPerPel
)
||
((
devmode
->
dmFields
&
DM_PELSWIDTH
)
&&
devmode
->
dmPelsWidth
)
||
((
devmode
->
dmFields
&
DM_PELSHEIGHT
)
&&
devmode
->
dmPelsHeight
)
||
((
devmode
->
dmFields
&
DM_DISPLAYFREQUENCY
)
&&
devmode
->
dmDisplayFrequency
))
if
(((
devmode
->
dmFields
&
DM_BITSPERPEL
)
&&
devmode
->
dmBitsPerPel
)
||
((
devmode
->
dmFields
&
DM_PELSWIDTH
)
&&
devmode
->
dmPelsWidth
)
||
((
devmode
->
dmFields
&
DM_PELSHEIGHT
)
&&
devmode
->
dmPelsHeight
)
||
((
devmode
->
dmFields
&
DM_DISPLAYFREQUENCY
)
&&
devmode
->
dmDisplayFrequency
))
def_mode
=
FALSE
;
}
}
if
(
def_mode
)
...
...
dlls/user32/tests/monitor.c
View file @
b5603287
...
...
@@ -401,11 +401,11 @@ static void test_ChangeDisplaySettingsEx(void)
dmW
.
dmSize
=
FIELD_OFFSET
(
DEVMODEW
,
dmICMMethod
)
-
1
;
res
=
ChangeDisplaySettingsW
(
&
dmW
,
CDS_TEST
);
todo_wine
ok
(
res
==
DISP_CHANGE_BADMODE
,
"ChangeDisplaySettingsW returned %d, expect DISP_CHANGE_BADMODE
\n
"
,
res
);
ok
(
res
==
DISP_CHANGE_BADMODE
,
"ChangeDisplaySettingsW returned %d, expect DISP_CHANGE_BADMODE
\n
"
,
res
);
dmW
.
dmSize
=
FIELD_OFFSET
(
DEVMODEW
,
dmICMMethod
)
-
1
;
res
=
ChangeDisplaySettingsExW
(
NULL
,
&
dmW
,
NULL
,
CDS_TEST
,
NULL
);
todo_wine
ok
(
res
==
DISP_CHANGE_BADMODE
,
"ChangeDisplaySettingsExW returned %d, expect DISP_CHANGE_BADMODE
\n
"
,
res
);
ok
(
res
==
DISP_CHANGE_BADMODE
,
"ChangeDisplaySettingsExW returned %d, expect DISP_CHANGE_BADMODE
\n
"
,
res
);
dmW
.
dmSize
=
FIELD_OFFSET
(
DEVMODEW
,
dmICMMethod
);
res
=
ChangeDisplaySettingsW
(
&
dmW
,
CDS_TEST
);
...
...
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