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
312cb811
Commit
312cb811
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 format in ddraw_surface7_Restore().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ca6b2998
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
3 deletions
+69
-3
surface.c
dlls/ddraw/surface.c
+17
-3
ddraw1.c
dlls/ddraw/tests/ddraw1.c
+13
-0
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+13
-0
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+13
-0
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+13
-0
No files found.
dlls/ddraw/surface.c
View file @
312cb811
...
@@ -3625,6 +3625,7 @@ static HRESULT WINAPI ddraw_surface7_Restore(IDirectDrawSurface7 *iface)
...
@@ -3625,6 +3625,7 @@ static HRESULT WINAPI ddraw_surface7_Restore(IDirectDrawSurface7 *iface)
if
(
surface
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
if
(
surface
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
{
{
struct
wined3d_swapchain
*
swapchain
=
surface
->
ddraw
->
wined3d_swapchain
;
struct
wined3d_swapchain
*
swapchain
=
surface
->
ddraw
->
wined3d_swapchain
;
struct
wined3d_sub_resource_desc
wined3d_desc
;
struct
wined3d_display_mode
mode
;
struct
wined3d_display_mode
mode
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -3634,10 +3635,23 @@ static HRESULT WINAPI ddraw_surface7_Restore(IDirectDrawSurface7 *iface)
...
@@ -3634,10 +3635,23 @@ static HRESULT WINAPI ddraw_surface7_Restore(IDirectDrawSurface7 *iface)
return
hr
;
return
hr
;
}
}
if
(
mode
.
width
!=
surface
->
surface_desc
.
dwWidth
||
mode
.
height
!=
surface
->
surface_desc
.
dwHeight
)
if
(
FAILED
(
hr
=
wined3d_texture_get_sub_resource_desc
(
surface
->
wined3d_texture
,
0
,
&
wined3d_desc
))
)
{
{
WARN
(
"Display mode %ux%u doesn't match surface dimensions %ux%u.
\n
"
,
WARN
(
"Failed to get resource desc, hr %#x.
\n
"
,
hr
);
mode
.
width
,
mode
.
height
,
surface
->
surface_desc
.
dwWidth
,
surface
->
surface_desc
.
dwHeight
);
return
hr
;
}
if
(
mode
.
width
!=
wined3d_desc
.
width
||
mode
.
height
!=
wined3d_desc
.
height
)
{
WARN
(
"Display mode dimensions %ux%u don't match surface dimensions %ux%u.
\n
"
,
mode
.
width
,
mode
.
height
,
wined3d_desc
.
width
,
wined3d_desc
.
height
);
return
DDERR_WRONGMODE
;
}
if
(
mode
.
format_id
!=
wined3d_desc
.
format
)
{
WARN
(
"Display mode format %#x doesn't match surface format %#x.
\n
"
,
mode
.
format_id
,
wined3d_desc
.
format
);
return
DDERR_WRONGMODE
;
return
DDERR_WRONGMODE
;
}
}
}
}
...
...
dlls/ddraw/tests/ddraw1.c
View file @
312cb811
...
@@ -4626,6 +4626,19 @@ static void test_primary_palette(void)
...
@@ -4626,6 +4626,19 @@ static void test_primary_palette(void)
hr
=
IDirectDrawSurface_GetPalette
(
primary
,
&
tmp
);
hr
=
IDirectDrawSurface_GetPalette
(
primary
,
&
tmp
);
ok
(
hr
==
DDERR_NOPALETTEATTACHED
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_NOPALETTEATTACHED
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_IsLost
(
primary
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
set_display_mode
(
ddraw
,
640
,
480
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_Restore
(
primary
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
done:
done:
refcount
=
IDirectDrawSurface_Release
(
backbuffer
);
refcount
=
IDirectDrawSurface_Release
(
backbuffer
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
...
...
dlls/ddraw/tests/ddraw2.c
View file @
312cb811
...
@@ -5673,6 +5673,19 @@ static void test_primary_palette(void)
...
@@ -5673,6 +5673,19 @@ static void test_primary_palette(void)
hr
=
IDirectDrawSurface_GetPalette
(
primary
,
&
tmp
);
hr
=
IDirectDrawSurface_GetPalette
(
primary
,
&
tmp
);
ok
(
hr
==
DDERR_NOPALETTEATTACHED
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_NOPALETTEATTACHED
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_IsLost
(
primary
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
set_display_mode
(
ddraw
,
640
,
480
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_Restore
(
primary
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
done:
done:
refcount
=
IDirectDrawSurface_Release
(
backbuffer
);
refcount
=
IDirectDrawSurface_Release
(
backbuffer
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
...
...
dlls/ddraw/tests/ddraw4.c
View file @
312cb811
...
@@ -6944,6 +6944,19 @@ static void test_primary_palette(void)
...
@@ -6944,6 +6944,19 @@ static void test_primary_palette(void)
hr
=
IDirectDrawSurface4_GetPalette
(
primary
,
&
tmp
);
hr
=
IDirectDrawSurface4_GetPalette
(
primary
,
&
tmp
);
ok
(
hr
==
DDERR_NOPALETTEATTACHED
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_NOPALETTEATTACHED
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_IsLost
(
primary
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
set_display_mode
(
ddraw
,
640
,
480
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_Restore
(
primary
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface4_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
done:
done:
refcount
=
IDirectDrawSurface4_Release
(
backbuffer
);
refcount
=
IDirectDrawSurface4_Release
(
backbuffer
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
...
...
dlls/ddraw/tests/ddraw7.c
View file @
312cb811
...
@@ -6867,6 +6867,19 @@ static void test_primary_palette(void)
...
@@ -6867,6 +6867,19 @@ static void test_primary_palette(void)
hr
=
IDirectDrawSurface7_GetPalette
(
primary
,
&
tmp
);
hr
=
IDirectDrawSurface7_GetPalette
(
primary
,
&
tmp
);
ok
(
hr
==
DDERR_NOPALETTEATTACHED
,
"Got unexpected hr %#x.
\n
"
,
hr
);
ok
(
hr
==
DDERR_NOPALETTEATTACHED
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_IsLost
(
primary
);
ok
(
hr
==
DD_OK
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
set_display_mode
(
ddraw
,
640
,
480
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set display mode, hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_Restore
(
primary
);
ok
(
hr
==
DDERR_WRONGMODE
,
"Got unexpected hr %#x.
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_IsLost
(
primary
);
ok
(
hr
==
DDERR_SURFACELOST
,
"Got unexpected hr %#x.
\n
"
,
hr
);
done:
done:
refcount
=
IDirectDrawSurface7_Release
(
backbuffer
);
refcount
=
IDirectDrawSurface7_Release
(
backbuffer
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
ok
(
refcount
==
1
,
"Got unexpected refcount %u.
\n
"
,
refcount
);
...
...
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