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
5b9f91c1
Commit
5b9f91c1
authored
Jul 16, 2014
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jul 16, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Add validation to SetPriority / GetPriority.
parent
fd17c932
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
38 deletions
+34
-38
surface.c
dlls/ddraw/surface.c
+34
-38
No files found.
dlls/ddraw/surface.c
View file @
5b9f91c1
...
...
@@ -2229,63 +2229,59 @@ static HRESULT WINAPI ddraw_surface1_GetCaps(IDirectDrawSurface *iface, DDSCAPS
return
hr
;
}
/*****************************************************************************
* IDirectDrawSurface7::SetPriority
*
* Sets a texture priority for managed textures.
*
* Params:
* Priority: The new priority
*
* Returns:
* DD_OK on success
* For more details, see IWineD3DSurface::SetPriority
*
*****************************************************************************/
static
HRESULT
WINAPI
ddraw_surface7_SetPriority
(
IDirectDrawSurface7
*
iface
,
DWORD
Priority
)
static
HRESULT
WINAPI
ddraw_surface7_SetPriority
(
IDirectDrawSurface7
*
iface
,
DWORD
priority
)
{
struct
ddraw_surface
*
surface
=
impl_from_IDirectDrawSurface7
(
iface
);
DWORD
managed
=
DDSCAPS2_TEXTUREMANAGE
|
DDSCAPS2_D3DTEXTUREMANAGE
;
HRESULT
hr
;
TRACE
(
"iface %p, priority %u.
\n
"
,
iface
,
P
riority
);
TRACE
(
"iface %p, priority %u.
\n
"
,
iface
,
p
riority
);
wined3d_mutex_lock
();
hr
=
wined3d_surface_set_priority
(
surface
->
wined3d_surface
,
Priority
);
/* No need to check for offscreen plain surfaces or mipmap sublevels. SetPriority
* calls on such surfaces segfault on Windows. */
if
(
!
(
surface
->
surface_desc
.
ddsCaps
.
dwCaps2
&
managed
))
{
WARN
(
"Called on non-managed texture returning DDERR_INVALIDPARAMS.
\n
"
);
hr
=
DDERR_INVALIDPARAMS
;
}
else
{
wined3d_surface_set_priority
(
surface
->
wined3d_surface
,
priority
);
hr
=
DD_OK
;
}
wined3d_mutex_unlock
();
return
hr
;
}
/*****************************************************************************
* IDirectDrawSurface7::GetPriority
*
* Returns the surface's priority
*
* Params:
* Priority: Address of a variable to write the priority to
*
* Returns:
* D3D_OK on success
* DDERR_INVALIDPARAMS if Priority == NULL
* For more details, see IWineD3DSurface::GetPriority
*
*****************************************************************************/
static
HRESULT
WINAPI
ddraw_surface7_GetPriority
(
IDirectDrawSurface7
*
iface
,
DWORD
*
Priority
)
static
HRESULT
WINAPI
ddraw_surface7_GetPriority
(
IDirectDrawSurface7
*
iface
,
DWORD
*
priority
)
{
struct
ddraw_surface
*
surface
=
impl_from_IDirectDrawSurface7
(
iface
);
DWORD
managed
=
DDSCAPS2_TEXTUREMANAGE
|
DDSCAPS2_D3DTEXTUREMANAGE
;
HRESULT
hr
;
TRACE
(
"iface %p, priority %p.
\n
"
,
iface
,
P
riority
);
TRACE
(
"iface %p, priority %p.
\n
"
,
iface
,
p
riority
);
if
(
!
Priority
)
wined3d_mutex_lock
();
if
(
surface
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_OFFSCREENPLAIN
)
{
return
DDERR_INVALIDPARAMS
;
WARN
(
"Called on offscreenplain surface, returning DDERR_INVALIDOBJECT.
\n
"
);
hr
=
DDERR_INVALIDOBJECT
;
}
else
if
(
!
(
surface
->
surface_desc
.
ddsCaps
.
dwCaps2
&
managed
)
||
!
surface
->
wined3d_texture
)
{
WARN
(
"Called on non-managed texture or mipmap sublevel, returning DDERR_INVALIDPARAMS.
\n
"
);
hr
=
DDERR_INVALIDPARAMS
;
}
else
{
*
priority
=
wined3d_surface_get_priority
(
surface
->
wined3d_surface
);
hr
=
DD_OK
;
}
wined3d_mutex_lock
();
*
Priority
=
wined3d_surface_get_priority
(
surface
->
wined3d_surface
);
wined3d_mutex_unlock
();
return
DD_OK
;
return
hr
;
}
/*****************************************************************************
...
...
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