Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
c5d2f5ef
Commit
c5d2f5ef
authored
Feb 12, 2001
by
Marcus Meissner
Committed by
Alexandre Julliard
Feb 12, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle differently sized structs by using their dwSize parameters.
parent
45edb2fc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
17 deletions
+22
-17
main.c
dlls/ddraw/ddraw/main.c
+6
-3
thunks.c
dlls/ddraw/ddraw/thunks.c
+1
-5
user.c
dlls/ddraw/ddraw/user.c
+2
-2
ddraw_private.h
dlls/ddraw/ddraw_private.h
+6
-3
main.c
dlls/ddraw/dsurface/main.c
+7
-4
No files found.
dlls/ddraw/ddraw/main.c
View file @
c5d2f5ef
...
...
@@ -283,7 +283,8 @@ create_texture(IDirectDrawImpl* This, const DDSURFACEDESC2 *pDDSD,
if
((
pDDSD
->
dwFlags
&
(
DDSD_HEIGHT
|
DDSD_WIDTH
))
!=
(
DDSD_HEIGHT
|
DDSD_WIDTH
))
return
DDERR_INVALIDPARAMS
;
ddsd
=
*
pDDSD
;
ddsd
.
dwSize
=
sizeof
(
ddsd
);
DD_STRUCT_COPY_BYSIZE
((
&
ddsd
),
pDDSD
);
if
(
!
(
ddsd
.
dwFlags
&
DDSD_PIXELFORMAT
))
{
...
...
@@ -365,7 +366,8 @@ create_primary(IDirectDrawImpl* This, LPDDSURFACEDESC2 pDDSD,
if
(
pDDSD
->
dwFlags
&
(
DDSD_HEIGHT
|
DDSD_WIDTH
|
DDSD_PIXELFORMAT
))
return
DDERR_INVALIDPARAMS
;
ddsd
=
*
pDDSD
;
ddsd
.
dwSize
=
sizeof
(
ddsd
);
DD_STRUCT_COPY_BYSIZE
((
&
ddsd
),
pDDSD
);
ddsd
.
dwFlags
|=
DDSD_HEIGHT
|
DDSD_WIDTH
|
DDSD_PITCH
|
DDSD_PIXELFORMAT
;
ddsd
.
dwHeight
=
This
->
height
;
ddsd
.
dwWidth
=
This
->
width
;
...
...
@@ -438,7 +440,8 @@ create_offscreen(IDirectDrawImpl* This, LPDDSURFACEDESC2 pDDSD,
if
((
pDDSD
->
dwFlags
&
(
DDSD_HEIGHT
|
DDSD_WIDTH
))
!=
(
DDSD_HEIGHT
|
DDSD_WIDTH
))
return
DDERR_INVALIDPARAMS
;
ddsd
=
*
pDDSD
;
ddsd
.
dwSize
=
sizeof
(
ddsd
);
DD_STRUCT_COPY_BYSIZE
((
&
ddsd
),
pDDSD
);
if
(
!
(
ddsd
.
dwFlags
&
DDSD_PIXELFORMAT
))
{
...
...
dlls/ddraw/ddraw/thunks.c
View file @
c5d2f5ef
...
...
@@ -213,8 +213,6 @@ IDirectDraw2Impl_CreateSurface(LPDIRECTDRAW2 This, LPDDSURFACEDESC pSDesc,
LPDIRECTDRAWSURFACE7
pSurface7
;
HRESULT
hr
;
/* the LPDDSURFACEDESC -> LPDDSURFACEDESC2 conversion should be ok,
* since the data layout is the same */
hr
=
IDirectDraw7_CreateSurface
(
COM_INTERFACE_CAST
(
IDirectDrawImpl
,
IDirectDraw2
,
IDirectDraw7
,
...
...
@@ -235,13 +233,11 @@ IDirectDraw4Impl_CreateSurface(LPDIRECTDRAW4 This, LPDDSURFACEDESC2 pSDesc,
LPDIRECTDRAWSURFACE4
*
ppSurface
,
IUnknown
*
pUnkOuter
)
{
/* the LPDDSURFACEDESC -> LPDDSURFACEDESC2 conversion should be ok,
* since the data layout is the same */
return
IDirectDraw7_CreateSurface
(
COM_INTERFACE_CAST
(
IDirectDrawImpl
,
IDirectDraw4
,
IDirectDraw7
,
This
),
(
LPDDSURFACEDESC2
)
pSDesc
,
pSDesc
,
(
LPDIRECTDRAWSURFACE7
*
)
ppSurface
,
pUnkOuter
);
}
...
...
dlls/ddraw/ddraw/user.c
View file @
c5d2f5ef
...
...
@@ -445,10 +445,10 @@ User_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
}
if
(
pDriverCaps
!=
NULL
)
memcpy
(
pDriverCaps
,
&
caps
,
pDriverCaps
->
dwSize
);
DD_STRUCT_COPY_BYSIZE
(
pDriverCaps
,
&
caps
);
if
(
pHELCaps
!=
NULL
)
memcpy
(
pHELCaps
,
&
caps
,
pHELCaps
->
dwSize
);
DD_STRUCT_COPY_BYSIZE
(
pHELCaps
,
&
caps
);
return
DD_OK
;
}
...
...
dlls/ddraw/ddraw_private.h
View file @
c5d2f5ef
...
...
@@ -21,9 +21,12 @@
#define DD_STRUCT_COPY_BYSIZE(to,from) \
do { \
DWORD __size = to->dwSize; \
memcpy(to,from,__size); \
to->dwSize = __size;
/*restore size*/
\
DWORD __size = (to)->dwSize; \
DWORD __copysize = __size; \
if ((from)->dwSize < __size) \
__copysize = (from)->dwSize; \
memcpy(to,from,__copysize); \
(to)->dwSize = __size;
/*restore size*/
\
} while (0)
/*****************************************************************************
...
...
dlls/ddraw/dsurface/main.c
View file @
c5d2f5ef
...
...
@@ -25,8 +25,10 @@ Main_DirectDrawSurface_Construct(IDirectDrawSurfaceImpl *This,
IDirectDrawImpl
*
pDD
,
const
DDSURFACEDESC2
*
pDDSD
)
{
if
(
pDDSD
!=
&
This
->
surface_desc
)
This
->
surface_desc
=
*
pDDSD
;
if
(
pDDSD
!=
&
This
->
surface_desc
)
{
This
->
surface_desc
.
dwSize
=
sizeof
(
This
->
surface_desc
);
DD_STRUCT_COPY_BYSIZE
(
&
(
This
->
surface_desc
),
pDDSD
);
}
This
->
uniqueness_value
=
1
;
/* unchecked */
This
->
ref
=
1
;
...
...
@@ -680,7 +682,7 @@ Main_DirectDrawSurface_GetPixelFormat(LPDIRECTDRAWSURFACE7 iface,
ICOM_THIS
(
IDirectDrawSurfaceImpl
,
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pDDPixelFormat
);
*
pDDPixelFormat
=
This
->
surface_desc
.
u4
.
ddpfPixelFormat
;
DD_STRUCT_COPY_BYSIZE
(
pDDPixelFormat
,
&
This
->
surface_desc
.
u4
.
ddpfPixelFormat
)
;
return
DD_OK
;
}
...
...
@@ -793,7 +795,8 @@ Main_DirectDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect,
This
,
prect
,
pDDSD
,
flags
,(
DWORD
)
h
);
/* First, copy the Surface description */
memcpy
(
pDDSD
,
&
(
This
->
surface_desc
),
pDDSD
->
dwSize
);
DD_STRUCT_COPY_BYSIZE
(
pDDSD
,
&
(
This
->
surface_desc
));
TRACE
(
"locked surface: height=%ld, width=%ld, pitch=%ld
\n
"
,
pDDSD
->
dwHeight
,
pDDSD
->
dwWidth
,
pDDSD
->
u1
.
lPitch
);
...
...
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