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
78718a41
Commit
78718a41
authored
Dec 20, 2007
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Dec 20, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Add a test for an invalid DEVMODE passed to ChangeDisplaySettings, make it pass under Wine.
parent
c3fe9ec2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
2 deletions
+40
-2
sysparams.c
dlls/user32/sysparams.c
+5
-0
monitor.c
dlls/user32/tests/monitor.c
+31
-2
settings.c
dlls/winex11.drv/settings.c
+4
-0
No files found.
dlls/user32/sysparams.c
View file @
78718a41
...
@@ -2999,10 +2999,15 @@ LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND h
...
@@ -2999,10 +2999,15 @@ LONG WINAPI ChangeDisplaySettingsExA( LPCSTR devname, LPDEVMODEA devmode, HWND h
DEVMODEW
*
devmodeW
;
DEVMODEW
*
devmodeW
;
devmodeW
=
GdiConvertToDevmodeW
(
devmode
);
devmodeW
=
GdiConvertToDevmodeW
(
devmode
);
if
(
devmodeW
)
{
ret
=
ChangeDisplaySettingsExW
(
nameW
.
Buffer
,
devmodeW
,
hwnd
,
flags
,
lparam
);
ret
=
ChangeDisplaySettingsExW
(
nameW
.
Buffer
,
devmodeW
,
hwnd
,
flags
,
lparam
);
HeapFree
(
GetProcessHeap
(),
0
,
devmodeW
);
HeapFree
(
GetProcessHeap
(),
0
,
devmodeW
);
}
}
else
else
ret
=
DISP_CHANGE_SUCCESSFUL
;
}
else
{
{
ret
=
ChangeDisplaySettingsExW
(
nameW
.
Buffer
,
NULL
,
hwnd
,
flags
,
lparam
);
ret
=
ChangeDisplaySettingsExW
(
nameW
.
Buffer
,
NULL
,
hwnd
,
flags
,
lparam
);
}
}
...
...
dlls/user32/tests/monitor.c
View file @
78718a41
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
static
HMODULE
hdll
;
static
HMODULE
hdll
;
static
LONG
(
WINAPI
*
pChangeDisplaySettingsExA
)(
LPCSTR
,
LPDEVMODEA
,
HWND
,
DWORD
,
LPVOID
);
static
LONG
(
WINAPI
*
pChangeDisplaySettingsExA
)(
LPCSTR
,
LPDEVMODEA
,
HWND
,
DWORD
,
LPVOID
);
static
LONG
(
WINAPI
*
pChangeDisplaySettingsExW
)(
LPCWSTR
,
LPDEVMODEW
,
HWND
,
DWORD
,
LPVOID
);
static
BOOL
(
WINAPI
*
pEnumDisplayDevicesA
)(
LPCSTR
,
DWORD
,
LPDISPLAY_DEVICEA
,
DWORD
);
static
BOOL
(
WINAPI
*
pEnumDisplayDevicesA
)(
LPCSTR
,
DWORD
,
LPDISPLAY_DEVICEA
,
DWORD
);
static
BOOL
(
WINAPI
*
pEnumDisplayMonitors
)(
HDC
,
LPRECT
,
MONITORENUMPROC
,
LPARAM
);
static
BOOL
(
WINAPI
*
pEnumDisplayMonitors
)(
HDC
,
LPRECT
,
MONITORENUMPROC
,
LPARAM
);
static
BOOL
(
WINAPI
*
pGetMonitorInfoA
)(
HMONITOR
,
LPMONITORINFO
);
static
BOOL
(
WINAPI
*
pGetMonitorInfoA
)(
HMONITOR
,
LPMONITORINFO
);
...
@@ -41,6 +42,7 @@ static void init_function_pointers(void)
...
@@ -41,6 +42,7 @@ static void init_function_pointers(void)
trace("GetProcAddress(%s) failed\n", #func);
trace("GetProcAddress(%s) failed\n", #func);
GET_PROC
(
ChangeDisplaySettingsExA
)
GET_PROC
(
ChangeDisplaySettingsExA
)
GET_PROC
(
ChangeDisplaySettingsExW
)
GET_PROC
(
EnumDisplayDevicesA
)
GET_PROC
(
EnumDisplayDevicesA
)
GET_PROC
(
EnumDisplayMonitors
)
GET_PROC
(
EnumDisplayMonitors
)
GET_PROC
(
GetMonitorInfoA
)
GET_PROC
(
GetMonitorInfoA
)
...
@@ -113,7 +115,7 @@ struct vid_mode
...
@@ -113,7 +115,7 @@ struct vid_mode
LONG
success
;
LONG
success
;
};
};
static
struct
vid_mode
vid_modes_test
[]
=
{
static
const
struct
vid_mode
vid_modes_test
[]
=
{
{
640
,
480
,
0
,
0
,
DM_PELSWIDTH
|
DM_PELSHEIGHT
|
DM_BITSPERPEL
|
DM_DISPLAYFREQUENCY
,
1
},
{
640
,
480
,
0
,
0
,
DM_PELSWIDTH
|
DM_PELSHEIGHT
|
DM_BITSPERPEL
|
DM_DISPLAYFREQUENCY
,
1
},
{
640
,
480
,
0
,
0
,
DM_PELSWIDTH
|
DM_PELSHEIGHT
|
DM_DISPLAYFREQUENCY
,
1
},
{
640
,
480
,
0
,
0
,
DM_PELSWIDTH
|
DM_PELSHEIGHT
|
DM_DISPLAYFREQUENCY
,
1
},
{
640
,
480
,
0
,
0
,
DM_PELSWIDTH
|
DM_PELSHEIGHT
|
DM_BITSPERPEL
,
1
},
{
640
,
480
,
0
,
0
,
DM_PELSWIDTH
|
DM_PELSHEIGHT
|
DM_BITSPERPEL
,
1
},
...
@@ -135,7 +137,9 @@ static struct vid_mode vid_modes_test[] = {
...
@@ -135,7 +137,9 @@ static struct vid_mode vid_modes_test[] = {
static
void
test_ChangeDisplaySettingsEx
(
void
)
static
void
test_ChangeDisplaySettingsEx
(
void
)
{
{
DEVMODE
dm
;
DEVMODEA
dm
;
DEVMODEW
dmW
;
DWORD
width
;
LONG
res
;
LONG
res
;
int
i
;
int
i
;
...
@@ -145,6 +149,31 @@ static void test_ChangeDisplaySettingsEx(void)
...
@@ -145,6 +149,31 @@ static void test_ChangeDisplaySettingsEx(void)
return
;
return
;
}
}
SetLastError
(
0xdeadbeef
);
res
=
EnumDisplaySettings
(
NULL
,
ENUM_CURRENT_SETTINGS
,
&
dm
);
ok
(
res
,
"EnumDisplaySettings error %u
\n
"
,
GetLastError
());
width
=
dm
.
dmPelsWidth
;
/* the following 2 tests show that dm.dmSize being 0 is invalid, but
* ChangeDisplaySettingsExA still reports success.
*/
memset
(
&
dm
,
0
,
sizeof
(
dm
));
dm
.
dmFields
=
DM_PELSWIDTH
|
DM_PELSHEIGHT
;
dm
.
dmPelsWidth
=
width
;
res
=
pChangeDisplaySettingsExA
(
NULL
,
&
dm
,
NULL
,
CDS_TEST
,
NULL
);
ok
(
res
==
DISP_CHANGE_SUCCESSFUL
,
"ChangeDisplaySettingsExA returned %d, expected DISP_CHANGE_SUCCESSFUL
\n
"
,
res
);
memset
(
&
dmW
,
0
,
sizeof
(
dmW
));
dmW
.
dmFields
=
DM_PELSWIDTH
|
DM_PELSHEIGHT
;
dmW
.
dmPelsWidth
=
width
;
SetLastError
(
0xdeadbeef
);
res
=
pChangeDisplaySettingsExW
(
NULL
,
&
dmW
,
NULL
,
CDS_TEST
,
NULL
);
if
(
GetLastError
()
!=
ERROR_CALL_NOT_IMPLEMENTED
)
ok
(
res
==
DISP_CHANGE_FAILED
,
"ChangeDisplaySettingsExW returned %d, expected DISP_CHANGE_FAILED
\n
"
,
res
);
memset
(
&
dm
,
0
,
sizeof
(
dm
));
memset
(
&
dm
,
0
,
sizeof
(
dm
));
dm
.
dmSize
=
sizeof
(
dm
);
dm
.
dmSize
=
sizeof
(
dm
);
...
...
dlls/winex11.drv/settings.c
View file @
78718a41
...
@@ -358,6 +358,10 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
...
@@ -358,6 +358,10 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
TRACE
(
"flags=%s
\n
"
,
_CDS_flags
(
flags
));
TRACE
(
"flags=%s
\n
"
,
_CDS_flags
(
flags
));
if
(
devmode
)
if
(
devmode
)
{
{
/* this is the minimal dmSize that XP accepts */
if
(
devmode
->
dmSize
<
FIELD_OFFSET
(
DEVMODEW
,
dmFields
))
return
DISP_CHANGE_FAILED
;
TRACE
(
"DM_fields=%s
\n
"
,
_DM_fields
(
devmode
->
dmFields
));
TRACE
(
"DM_fields=%s
\n
"
,
_DM_fields
(
devmode
->
dmFields
));
TRACE
(
"width=%d height=%d bpp=%d freq=%d (%s)
\n
"
,
TRACE
(
"width=%d height=%d bpp=%d freq=%d (%s)
\n
"
,
devmode
->
dmPelsWidth
,
devmode
->
dmPelsHeight
,
devmode
->
dmPelsWidth
,
devmode
->
dmPelsHeight
,
...
...
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