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
a599d645
Commit
a599d645
authored
Jul 21, 2020
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Jul 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Check invalid device names in ChangeDisplaySettingsExW().
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
dcf8bd76
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
sysparams.c
dlls/user32/sysparams.c
+15
-1
monitor.c
dlls/user32/tests/monitor.c
+3
-3
No files found.
dlls/user32/sysparams.c
View file @
a599d645
...
...
@@ -3307,7 +3307,8 @@ static BOOL is_detached_mode(const DEVMODEW *mode)
LONG
WINAPI
ChangeDisplaySettingsExW
(
LPCWSTR
devname
,
LPDEVMODEW
devmode
,
HWND
hwnd
,
DWORD
flags
,
LPVOID
lparam
)
{
WCHAR
primary_adapter
[
CCHDEVICENAME
];
WCHAR
primary_adapter
[
CCHDEVICENAME
],
*
end
;
long
int
display_idx
;
BOOL
def_mode
=
TRUE
;
DEVMODEW
dm
;
LONG
ret
;
...
...
@@ -3331,6 +3332,19 @@ LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND
devname
=
primary_adapter
;
}
if
(
strncmpiW
(
devname
,
ADAPTER_PREFIX
,
ARRAY_SIZE
(
ADAPTER_PREFIX
)))
{
ERR
(
"Invalid device name %s.
\n
"
,
wine_dbgstr_w
(
devname
));
return
DISP_CHANGE_BADPARAM
;
}
display_idx
=
strtolW
(
devname
+
ARRAY_SIZE
(
ADAPTER_PREFIX
),
&
end
,
10
);
if
(
*
end
||
display_idx
<
1
)
{
ERR
(
"Invalid device name %s.
\n
"
,
wine_dbgstr_w
(
devname
));
return
DISP_CHANGE_BADPARAM
;
}
if
(
devmode
)
{
trace_devmode
(
devmode
);
...
...
dlls/user32/tests/monitor.c
View file @
a599d645
...
...
@@ -369,13 +369,13 @@ static void test_ChangeDisplaySettingsEx(void)
ok
(
res
,
"EnumDisplaySettingsA failed, error %#x
\n
"
,
GetLastError
());
res
=
ChangeDisplaySettingsExA
(
"invalid"
,
&
dm
,
NULL
,
CDS_TEST
,
NULL
);
todo_wine
ok
(
res
==
DISP_CHANGE_BADPARAM
,
"ChangeDisplaySettingsA returned unexpected %d
\n
"
,
res
);
ok
(
res
==
DISP_CHANGE_BADPARAM
,
"ChangeDisplaySettingsA returned unexpected %d
\n
"
,
res
);
res
=
ChangeDisplaySettingsExA
(
"
\\\\
.
\\
DISPLAY0"
,
&
dm
,
NULL
,
CDS_TEST
,
NULL
);
todo_wine
ok
(
res
==
DISP_CHANGE_BADPARAM
,
"ChangeDisplaySettingsA returned unexpected %d
\n
"
,
res
);
ok
(
res
==
DISP_CHANGE_BADPARAM
,
"ChangeDisplaySettingsA returned unexpected %d
\n
"
,
res
);
res
=
ChangeDisplaySettingsExA
(
"
\\\\
.
\\
DISPLAY1
\\
Monitor0"
,
&
dm
,
NULL
,
CDS_TEST
,
NULL
);
todo_wine
ok
(
res
==
DISP_CHANGE_BADPARAM
,
"ChangeDisplaySettingsA returned unexpected %d
\n
"
,
res
);
ok
(
res
==
DISP_CHANGE_BADPARAM
,
"ChangeDisplaySettingsA returned unexpected %d
\n
"
,
res
);
/* Test dmDriverExtra */
memset
(
&
dm
,
0
,
sizeof
(
dm
));
...
...
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