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
83d92f41
Commit
83d92f41
authored
Sep 28, 2008
by
Lei Zhang
Committed by
Alexandre Julliard
Sep 30, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Allocate enough space for BITMAPINFO in GdipLoadImageFromStream.
parent
778ea236
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
image.c
dlls/gdiplus/image.c
+12
-6
No files found.
dlls/gdiplus/image.c
View file @
83d92f41
...
...
@@ -974,13 +974,19 @@ GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream* stream, GpImage **image)
IPicture_get_Type
(
pic
,
&
type
);
if
(
type
==
PICTYPE_BITMAP
){
BITMAPINFO
bmi
;
BITMAPINFO
*
p
bmi
;
BITMAPCOREHEADER
*
bmch
;
OLE_HANDLE
hbm
;
HDC
hdc
;
pbmi
=
GdipAlloc
(
sizeof
(
BITMAPINFOHEADER
)
+
256
*
sizeof
(
RGBQUAD
));
if
(
!
pbmi
)
return
OutOfMemory
;
*
image
=
GdipAlloc
(
sizeof
(
GpBitmap
));
if
(
!*
image
)
return
OutOfMemory
;
if
(
!*
image
){
GdipFree
(
pbmi
);
return
OutOfMemory
;
}
(
*
image
)
->
type
=
ImageTypeBitmap
;
(
*
((
GpBitmap
**
)
image
))
->
width
=
ipicture_pixel_width
(
pic
);
...
...
@@ -990,22 +996,22 @@ GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream* stream, GpImage **image)
IPicture_get_Handle
(
pic
,
&
hbm
);
IPicture_get_CurDC
(
pic
,
&
hdc
);
ZeroMemory
(
&
bmi
,
sizeof
(
bmi
));
bmch
=
(
BITMAPCOREHEADER
*
)
(
&
bmi
.
bmiHeader
);
bmch
=
(
BITMAPCOREHEADER
*
)
(
&
pbmi
->
bmiHeader
);
bmch
->
bcSize
=
sizeof
(
BITMAPCOREHEADER
);
if
(
!
hdc
){
HBITMAP
old
;
hdc
=
CreateCompatibleDC
(
0
);
old
=
SelectObject
(
hdc
,
(
HBITMAP
)
hbm
);
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
0
,
NULL
,
&
bmi
,
DIB_RGB_COLORS
);
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
0
,
NULL
,
p
bmi
,
DIB_RGB_COLORS
);
SelectObject
(
hdc
,
old
);
DeleteDC
(
hdc
);
}
else
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
0
,
NULL
,
&
bmi
,
DIB_RGB_COLORS
);
GetDIBits
(
hdc
,
(
HBITMAP
)
hbm
,
0
,
0
,
NULL
,
p
bmi
,
DIB_RGB_COLORS
);
(
*
((
GpBitmap
**
)
image
))
->
format
=
(
bmch
->
bcBitCount
<<
8
)
|
PixelFormatGDI
;
GdipFree
(
pbmi
);
}
else
if
(
type
==
PICTYPE_METAFILE
||
type
==
PICTYPE_ENHMETAFILE
){
/* FIXME: missing initialization code */
...
...
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