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
ca6b2998
Commit
ca6b2998
authored
Feb 01, 2017
by
Henri Verbeet
Committed by
Alexandre Julliard
Feb 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Validate the primary surface dimensions in ddraw_surface7_Restore().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0885e3f5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
24 deletions
+44
-24
surface.c
dlls/ddraw/surface.c
+20
-0
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+6
-6
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+6
-6
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+6
-6
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+6
-6
No files found.
dlls/ddraw/surface.c
View file @
ca6b2998
...
...
@@ -3622,6 +3622,26 @@ static HRESULT WINAPI ddraw_surface7_Restore(IDirectDrawSurface7 *iface)
TRACE
(
"iface %p.
\n
"
,
iface
);
if
(
surface
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
{
struct
wined3d_swapchain
*
swapchain
=
surface
->
ddraw
->
wined3d_swapchain
;
struct
wined3d_display_mode
mode
;
HRESULT
hr
;
if
(
FAILED
(
hr
=
wined3d_swapchain_get_display_mode
(
swapchain
,
&
mode
,
NULL
)))
{
WARN
(
"Failed to get display mode, hr %#x.
\n
"
,
hr
);
return
hr
;
}
if
(
mode
.
width
!=
surface
->
surface_desc
.
dwWidth
||
mode
.
height
!=
surface
->
surface_desc
.
dwHeight
)
{
WARN
(
"Display mode %ux%u doesn't match surface dimensions %ux%u.
\n
"
,
mode
.
width
,
mode
.
height
,
surface
->
surface_desc
.
dwWidth
,
surface
->
surface_desc
.
dwHeight
);
return
DDERR_WRONGMODE
;
}
}
ddraw_update_lost_surfaces
(
surface
->
ddraw
);
surface
->
is_lost
=
FALSE
;
...
...
dlls/ddraw/tests/ddraw1.c
View file @
ca6b2998
...
...
@@ -2724,7 +2724,7 @@ static void test_coop_level_mode_set(void)
screen_size
.
cy
=
0
;
hr
=
IDirectDrawSurface_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
set_display_mode
(
ddraw
,
param
.
ddraw_width
,
param
.
ddraw_height
);
if
(
hr
==
DDERR_NOEXCLUSIVEMODE
/* NT4 testbot */
)
{
...
...
@@ -2735,9 +2735,9 @@ static void test_coop_level_mode_set(void)
}
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_IsLost
(
primary
);
todo_wine
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
expect_messages
->
message
,
"Expected message %#x, but didn't receive it.
\n
"
,
expect_messages
->
message
);
expect_messages
=
NULL
;
...
...
@@ -2894,13 +2894,13 @@ static void test_coop_level_mode_set(void)
screen_size
.
cy
=
0
;
hr
=
IDirectDrawSurface_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
set_display_mode
(
ddraw
,
param
.
ddraw_width
,
param
.
ddraw_height
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_IsLost
(
primary
);
todo_wine
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
expect_messages
->
message
,
"Expected message %#x, but didn't receive it.
\n
"
,
expect_messages
->
message
);
expect_messages
=
NULL
;
...
...
dlls/ddraw/tests/ddraw2.c
View file @
ca6b2998
...
...
@@ -2891,7 +2891,7 @@ static void test_coop_level_mode_set(void)
screen_size
.
cy
=
0
;
hr
=
IDirectDrawSurface_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
set_display_mode
(
ddraw
,
param
.
ddraw_width
,
param
.
ddraw_height
);
if
(
hr
==
DDERR_NOEXCLUSIVEMODE
/* NT4 testbot */
)
{
...
...
@@ -2902,9 +2902,9 @@ static void test_coop_level_mode_set(void)
}
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_IsLost
(
primary
);
todo_wine
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
expect_messages
->
message
,
"Expected message %#x, but didn't receive it.
\n
"
,
expect_messages
->
message
);
expect_messages
=
NULL
;
...
...
@@ -3061,13 +3061,13 @@ static void test_coop_level_mode_set(void)
screen_size
.
cy
=
0
;
hr
=
IDirectDrawSurface_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
set_display_mode
(
ddraw
,
param
.
ddraw_width
,
param
.
ddraw_height
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_IsLost
(
primary
);
todo_wine
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
expect_messages
->
message
,
"Expected message %#x, but didn't receive it.
\n
"
,
expect_messages
->
message
);
expect_messages
=
NULL
;
...
...
dlls/ddraw/tests/ddraw4.c
View file @
ca6b2998
...
...
@@ -3034,13 +3034,13 @@ static void test_coop_level_mode_set(void)
screen_size
.
cy
=
0
;
hr
=
IDirectDrawSurface4_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
set_display_mode
(
ddraw
,
param
.
ddraw_width
,
param
.
ddraw_height
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_IsLost
(
primary
);
todo_wine
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
expect_messages
->
message
,
"Expected message %#x, but didn't receive it.
\n
"
,
expect_messages
->
message
);
expect_messages
=
NULL
;
...
...
@@ -3197,13 +3197,13 @@ static void test_coop_level_mode_set(void)
screen_size
.
cy
=
0
;
hr
=
IDirectDrawSurface4_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
set_display_mode
(
ddraw
,
param
.
ddraw_width
,
param
.
ddraw_height
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_IsLost
(
primary
);
todo_wine
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
expect_messages
->
message
,
"Expected message %#x, but didn't receive it.
\n
"
,
expect_messages
->
message
);
expect_messages
=
NULL
;
...
...
dlls/ddraw/tests/ddraw7.c
View file @
ca6b2998
...
...
@@ -2760,13 +2760,13 @@ static void test_coop_level_mode_set(void)
screen_size
.
cy
=
0
;
hr
=
IDirectDrawSurface7_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
set_display_mode
(
ddraw
,
param
.
ddraw_width
,
param
.
ddraw_height
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_IsLost
(
primary
);
todo_wine
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
expect_messages
->
message
,
"Expected message %#x, but didn't receive it.
\n
"
,
expect_messages
->
message
);
expect_messages
=
NULL
;
...
...
@@ -2923,13 +2923,13 @@ static void test_coop_level_mode_set(void)
screen_size
.
cy
=
0
;
hr
=
IDirectDrawSurface7_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
set_display_mode
(
ddraw
,
param
.
ddraw_width
,
param
.
ddraw_height
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_Restore
(
primary
);
todo_wine
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_IsLost
(
primary
);
todo_wine
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
expect_messages
->
message
,
"Expected message %#x, but didn't receive it.
\n
"
,
expect_messages
->
message
);
expect_messages
=
NULL
;
...
...
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