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
df5116cc
Commit
df5116cc
authored
Feb 25, 2008
by
Günther Brammer
Committed by
Alexandre Julliard
Feb 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Return a nullpointer as lpSurface in Lock() if the rect is invalid.
parent
d6a8b502
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
surface.c
dlls/ddraw/surface.c
+18
-14
dsurface.c
dlls/ddraw/tests/dsurface.c
+4
-0
No files found.
dlls/ddraw/surface.c
View file @
df5116cc
...
...
@@ -577,20 +577,6 @@ IDirectDrawSurfaceImpl_Lock(IDirectDrawSurface7 *iface,
/* This->surface_desc.dwWidth and dwHeight are changeable, thus lock */
EnterCriticalSection
(
&
ddraw_cs
);
if
(
Rect
)
{
if
((
Rect
->
left
<
0
)
||
(
Rect
->
top
<
0
)
||
(
Rect
->
left
>
Rect
->
right
)
||
(
Rect
->
top
>
Rect
->
bottom
)
||
(
Rect
->
right
>
This
->
surface_desc
.
dwWidth
)
||
(
Rect
->
bottom
>
This
->
surface_desc
.
dwHeight
))
{
WARN
(
"Trying to lock an invalid rectangle, returning DDERR_INVALIDPARAMS
\n
"
);
LeaveCriticalSection
(
&
ddraw_cs
);
return
DDERR_INVALIDPARAMS
;
}
}
/* Should I check for the handle to be NULL?
*
...
...
@@ -606,6 +592,24 @@ IDirectDrawSurfaceImpl_Lock(IDirectDrawSurface7 *iface,
return
DDERR_INVALIDPARAMS
;
}
/* Windows zeroes this if the rect is invalid */
DDSD
->
lpSurface
=
0
;
if
(
Rect
)
{
if
((
Rect
->
left
<
0
)
||
(
Rect
->
top
<
0
)
||
(
Rect
->
left
>
Rect
->
right
)
||
(
Rect
->
top
>
Rect
->
bottom
)
||
(
Rect
->
right
>
This
->
surface_desc
.
dwWidth
)
||
(
Rect
->
bottom
>
This
->
surface_desc
.
dwHeight
))
{
WARN
(
"Trying to lock an invalid rectangle, returning DDERR_INVALIDPARAMS
\n
"
);
LeaveCriticalSection
(
&
ddraw_cs
);
return
DDERR_INVALIDPARAMS
;
}
}
hr
=
IWineD3DSurface_LockRect
(
This
->
WineD3DSurface
,
&
LockedRect
,
Rect
,
...
...
dlls/ddraw/tests/dsurface.c
View file @
df5116cc
...
...
@@ -1652,10 +1652,14 @@ static void test_lockrect_invalid(void)
{
RECT
*
rect
=
&
invalid
[
i
];
memset
(
&
locked_desc
,
1
,
sizeof
(
locked_desc
));
locked_desc
.
dwSize
=
sizeof
(
locked_desc
);
hr
=
IDirectDrawSurface_Lock
(
surface
,
rect
,
&
locked_desc
,
DDLOCK_WAIT
,
NULL
);
ok
(
hr
==
DDERR_INVALIDPARAMS
,
"Lock returned 0x%08x for rect [%d, %d]->[%d, %d]"
", expected DDERR_INVALIDPARAMS (0x%08x)
\n
"
,
hr
,
rect
->
left
,
rect
->
top
,
rect
->
right
,
rect
->
bottom
,
DDERR_INVALIDPARAMS
);
ok
(
!
locked_desc
.
lpSurface
,
"IDirectDrawSurface_Lock did not set lpSurface in the surface desc to zero.
\n
"
);
}
hr
=
IDirectDrawSurface_Lock
(
surface
,
NULL
,
&
locked_desc
,
DDLOCK_WAIT
,
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