Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
a6c3d0d6
Commit
a6c3d0d6
authored
Sep 17, 2010
by
Oldřich Jedlička
Committed by
Alexandre Julliard
Sep 18, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Add checking of SURFACEDESC type/nullness into CreateSurface methods.
parent
b94bc560
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
12 deletions
+54
-12
ddraw.c
dlls/ddraw/ddraw.c
+30
-0
dsurface.c
dlls/ddraw/tests/dsurface.c
+24
-12
No files found.
dlls/ddraw/ddraw.c
View file @
a6c3d0d6
...
...
@@ -3311,6 +3311,12 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface,
TRACE
(
"iface %p, surface_desc %p, surface %p, outer_unknown %p.
\n
"
,
iface
,
surface_desc
,
surface
,
outer_unknown
);
if
(
surface_desc
==
NULL
||
surface_desc
->
dwSize
!=
sizeof
(
DDSURFACEDESC2
))
{
WARN
(
"Application supplied invalid surface descriptor
\n
"
);
return
DDERR_INVALIDPARAMS
;
}
if
(
surface_desc
->
ddsCaps
.
dwCaps
&
(
DDSCAPS_FRONTBUFFER
|
DDSCAPS_BACKBUFFER
))
{
if
(
TRACE_ON
(
ddraw
))
...
...
@@ -3336,6 +3342,12 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface,
TRACE
(
"iface %p, surface_desc %p, surface %p, outer_unknown %p.
\n
"
,
iface
,
surface_desc
,
surface
,
outer_unknown
);
if
(
surface_desc
==
NULL
||
surface_desc
->
dwSize
!=
sizeof
(
DDSURFACEDESC2
))
{
WARN
(
"Application supplied invalid surface descriptor
\n
"
);
return
DDERR_INVALIDPARAMS
;
}
if
(
surface_desc
->
ddsCaps
.
dwCaps
&
(
DDSCAPS_FRONTBUFFER
|
DDSCAPS_BACKBUFFER
))
{
if
(
TRACE_ON
(
ddraw
))
...
...
@@ -3372,6 +3384,12 @@ static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface,
TRACE
(
"iface %p, surface_desc %p, surface %p, outer_unknown %p.
\n
"
,
iface
,
surface_desc
,
surface
,
outer_unknown
);
if
(
surface_desc
==
NULL
||
surface_desc
->
dwSize
!=
sizeof
(
DDSURFACEDESC
))
{
WARN
(
"Application supplied invalid surface descriptor
\n
"
);
return
DDERR_INVALIDPARAMS
;
}
if
(
surface_desc
->
ddsCaps
.
dwCaps
&
(
DDSCAPS_FRONTBUFFER
|
DDSCAPS_BACKBUFFER
))
{
if
(
TRACE_ON
(
ddraw
))
...
...
@@ -3412,6 +3430,12 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface,
TRACE
(
"iface %p, surface_desc %p, surface %p, outer_unknown %p.
\n
"
,
iface
,
surface_desc
,
surface
,
outer_unknown
);
if
(
surface_desc
==
NULL
||
surface_desc
->
dwSize
!=
sizeof
(
DDSURFACEDESC
))
{
WARN
(
"Application supplied invalid surface descriptor
\n
"
);
return
DDERR_INVALIDPARAMS
;
}
if
(
surface_desc
->
ddsCaps
.
dwCaps
&
(
DDSCAPS_FRONTBUFFER
|
DDSCAPS_BACKBUFFER
))
{
if
(
TRACE_ON
(
ddraw
))
...
...
@@ -3451,6 +3475,12 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface,
TRACE
(
"iface %p, surface_desc %p, surface %p, outer_unknown %p.
\n
"
,
iface
,
surface_desc
,
surface
,
outer_unknown
);
if
(
surface_desc
==
NULL
||
surface_desc
->
dwSize
!=
sizeof
(
DDSURFACEDESC
))
{
WARN
(
"Application supplied invalid surface descriptor
\n
"
);
return
DDERR_INVALIDPARAMS
;
}
/* Remove front buffer flag, this causes failure in v7, and its added to normal
* primaries anyway. */
surface_desc
->
ddsCaps
.
dwCaps
&=
~
DDSCAPS_FRONTBUFFER
;
...
...
dlls/ddraw/tests/dsurface.c
View file @
a6c3d0d6
...
...
@@ -3638,16 +3638,19 @@ static void CreateSurfaceBadCapsSizeTest(void)
IDirectDrawSurface_Release
(
surf
);
hr
=
IDirectDraw_CreateSurface
(
lpDD
,
&
ddsd_bad1
,
&
surf
,
NULL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw_CreateSurface
(
lpDD
,
&
ddsd_bad2
,
&
surf
,
NULL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw_CreateSurface
(
lpDD
,
&
ddsd_bad3
,
&
surf
,
NULL
);
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw_CreateSurface
(
lpDD
,
&
ddsd_bad4
,
&
surf
,
NULL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw_CreateSurface
(
lpDD
,
NULL
,
&
surf
,
NULL
);
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw_QueryInterface
(
lpDD
,
&
IID_IDirectDraw2
,
(
void
**
)
&
dd2
);
...
...
@@ -3658,16 +3661,19 @@ static void CreateSurfaceBadCapsSizeTest(void)
IDirectDrawSurface_Release
(
surf
);
hr
=
IDirectDraw2_CreateSurface
(
dd2
,
&
ddsd_bad1
,
&
surf
,
NULL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw2_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw2_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw2_CreateSurface
(
dd2
,
&
ddsd_bad2
,
&
surf
,
NULL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw2_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw2_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw2_CreateSurface
(
dd2
,
&
ddsd_bad3
,
&
surf
,
NULL
);
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw2_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw2_CreateSurface
(
dd2
,
&
ddsd_bad4
,
&
surf
,
NULL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw2_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw2_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw2_CreateSurface
(
dd2
,
NULL
,
&
surf
,
NULL
);
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw2_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
IDirectDraw2_Release
(
dd2
);
...
...
@@ -3680,16 +3686,19 @@ static void CreateSurfaceBadCapsSizeTest(void)
IDirectDrawSurface4_Release
(
surf4
);
hr
=
IDirectDraw4_CreateSurface
(
dd4
,
&
ddsd2_bad1
,
&
surf4
,
NULL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw4_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw4_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw4_CreateSurface
(
dd4
,
&
ddsd2_bad2
,
&
surf4
,
NULL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw4_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw4_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw4_CreateSurface
(
dd4
,
&
ddsd2_bad3
,
&
surf4
,
NULL
);
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw4_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw4_CreateSurface
(
dd4
,
&
ddsd2_bad4
,
&
surf4
,
NULL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw4_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw4_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw4_CreateSurface
(
dd4
,
NULL
,
&
surf4
,
NULL
);
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw4_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
IDirectDraw4_Release
(
dd4
);
...
...
@@ -3702,16 +3711,19 @@ static void CreateSurfaceBadCapsSizeTest(void)
IDirectDrawSurface7_Release
(
surf7
);
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
&
ddsd2_bad1
,
&
surf7
,
NULL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw7_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw7_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
&
ddsd2_bad2
,
&
surf7
,
NULL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw7_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw7_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
&
ddsd2_bad3
,
&
surf7
,
NULL
);
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw7_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
&
ddsd2_bad4
,
&
surf7
,
NULL
);
todo_wine
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw7_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw7_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
NULL
,
&
surf7
,
NULL
);
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"IDirectDraw7_CreateSurface didn't return 0x%08x, but 0x%08x
\n
"
,
DDERR_INVALIDPARAMS
,
hr
);
IDirectDraw7_Release
(
dd7
);
...
...
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