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
33be9fc7
Commit
33be9fc7
authored
Dec 14, 2017
by
Huw Davies
Committed by
Alexandre Julliard
Dec 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Correctly save the remaining formats if their data has not been set.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
179daf67
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
36 deletions
+59
-36
datacache.c
dlls/ole32/datacache.c
+21
-27
ole2.c
dlls/ole32/tests/ole2.c
+38
-9
No files found.
dlls/ole32/datacache.c
View file @
33be9fc7
...
...
@@ -829,17 +829,16 @@ static HRESULT save_dib(DataCacheEntry *entry, BOOL contents, IStream *stream)
if
(
hr
==
S_OK
&&
data_size
)
hr
=
IStream_Write
(
stream
,
bmi
,
data_size
,
NULL
);
}
else
else
if
(
data_size
)
{
BITMAPFILEHEADER
bmp_fhdr
;
bmp_fhdr
.
bfType
=
0x4d42
;
bmp_fhdr
.
bfSize
=
data_size
+
sizeof
(
BITMAPFILEHEADER
);
bmp_fhdr
.
bfReserved1
=
bmp_fhdr
.
bfReserved2
=
0
;
if
(
data_size
)
bmp_fhdr
.
bfOffBits
=
bitmap_info_size
(
bmi
,
DIB_RGB_COLORS
)
+
sizeof
(
BITMAPFILEHEADER
);
bmp_fhdr
.
bfOffBits
=
bitmap_info_size
(
bmi
,
DIB_RGB_COLORS
)
+
sizeof
(
BITMAPFILEHEADER
);
hr
=
IStream_Write
(
stream
,
&
bmp_fhdr
,
sizeof
(
BITMAPFILEHEADER
),
NULL
);
if
(
hr
==
S_OK
&&
data_size
)
if
(
hr
==
S_OK
)
hr
=
IStream_Write
(
stream
,
bmi
,
data_size
,
NULL
);
}
...
...
@@ -897,25 +896,22 @@ static HRESULT save_mfpict(DataCacheEntry *entry, BOOL contents, IStream *stream
hr
=
IStream_Write
(
stream
,
data
,
data_size
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
}
else
else
if
(
entry
->
stgmedium
.
tymed
!=
TYMED_NULL
)
{
struct
meta_placeable
meta_place_rec
;
WORD
*
check
;
if
(
entry
->
stgmedium
.
tymed
!=
TYMED_NULL
)
mfpict
=
GlobalLock
(
entry
->
stgmedium
.
u
.
hMetaFilePict
);
if
(
!
mfpict
)
return
DV_E_STGMEDIUM
;
data_size
=
GetMetaFileBitsEx
(
mfpict
->
hMF
,
0
,
NULL
);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
data_size
);
if
(
!
data
)
{
mfpict
=
GlobalLock
(
entry
->
stgmedium
.
u
.
hMetaFilePict
);
if
(
!
mfpict
)
return
DV_E_STGMEDIUM
;
data_size
=
GetMetaFileBitsEx
(
mfpict
->
hMF
,
0
,
NULL
);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
data_size
);
if
(
!
data
)
{
GlobalUnlock
(
entry
->
stgmedium
.
u
.
hMetaFilePict
);
return
E_OUTOFMEMORY
;
}
GetMetaFileBitsEx
(
mfpict
->
hMF
,
data_size
,
data
);
GlobalUnlock
(
entry
->
stgmedium
.
u
.
hMetaFilePict
);
return
E_OUTOFMEMORY
;
}
GetMetaFileBitsEx
(
mfpict
->
hMF
,
data_size
,
data
);
/* units are in 1/8th of a point (1 point is 1/72th of an inch) */
meta_place_rec
.
key
=
0x9ac6cdd7
;
...
...
@@ -927,13 +923,12 @@ static HRESULT save_mfpict(DataCacheEntry *entry, BOOL contents, IStream *stream
meta_place_rec
.
bounding_box
[
3
]
=
0
;
meta_place_rec
.
checksum
=
0
;
meta_place_rec
.
reserved
=
0
;
if
(
mfpict
)
{
/* These values are rounded down so MulDiv won't do the right thing */
meta_place_rec
.
bounding_box
[
2
]
=
(
LONGLONG
)
mfpict
->
xExt
*
meta_place_rec
.
inch
/
2540
;
meta_place_rec
.
bounding_box
[
3
]
=
(
LONGLONG
)
mfpict
->
yExt
*
meta_place_rec
.
inch
/
2540
;
GlobalUnlock
(
entry
->
stgmedium
.
u
.
hMetaFilePict
);
}
/* These values are rounded down so MulDiv won't do the right thing */
meta_place_rec
.
bounding_box
[
2
]
=
(
LONGLONG
)
mfpict
->
xExt
*
meta_place_rec
.
inch
/
2540
;
meta_place_rec
.
bounding_box
[
3
]
=
(
LONGLONG
)
mfpict
->
yExt
*
meta_place_rec
.
inch
/
2540
;
GlobalUnlock
(
entry
->
stgmedium
.
u
.
hMetaFilePict
);
for
(
check
=
(
WORD
*
)
&
meta_place_rec
;
check
!=
(
WORD
*
)
&
meta_place_rec
.
checksum
;
check
++
)
meta_place_rec
.
checksum
^=
*
check
;
hr
=
IStream_Write
(
stream
,
&
meta_place_rec
,
sizeof
(
struct
meta_placeable
),
NULL
);
...
...
@@ -982,7 +977,7 @@ static HRESULT save_emf(DataCacheEntry *entry, BOOL contents, IStream *stream)
hr
=
IStream_Write
(
stream
,
data
,
data_size
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
}
else
else
if
(
entry
->
stgmedium
.
tymed
!=
TYMED_NULL
)
{
data_size
=
GetEnhMetaFileBits
(
entry
->
stgmedium
.
u
.
hEnhMetaFile
,
0
,
NULL
);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DWORD
)
+
sizeof
(
ENHMETAHEADER
)
+
data_size
);
...
...
@@ -991,8 +986,7 @@ static HRESULT save_emf(DataCacheEntry *entry, BOOL contents, IStream *stream)
GetEnhMetaFileBits
(
entry
->
stgmedium
.
u
.
hEnhMetaFile
,
data_size
,
data
+
sizeof
(
DWORD
)
+
sizeof
(
ENHMETAHEADER
));
memcpy
(
data
+
sizeof
(
DWORD
),
data
+
sizeof
(
DWORD
)
+
sizeof
(
ENHMETAHEADER
),
sizeof
(
ENHMETAHEADER
));
data_size
+=
sizeof
(
DWORD
)
+
sizeof
(
ENHMETAHEADER
);
if
(
hr
==
S_OK
&&
data_size
)
hr
=
IStream_Write
(
stream
,
data
,
data_size
,
NULL
);
hr
=
IStream_Write
(
stream
,
data
,
data_size
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
}
...
...
dlls/ole32/tests/ole2.c
View file @
33be9fc7
...
...
@@ -4226,35 +4226,64 @@ static void test_data_cache_save_data(void)
{
{
{
CF_DIB
,
0
,
DVASPECT_CONTENT
,
-
1
,
TYMED_HGLOBAL
},
{
CF_METAFILEPICT
,
0
,
DVASPECT_CONTENT
,
-
1
,
TYMED_MFPICT
},
{
CF_ENHMETAFILE
,
0
,
DVASPECT_CONTENT
,
-
1
,
TYMED_ENHMF
},
},
1
,
1
,
&
CLSID_WineTest
,
3
,
3
,
&
CLSID_WineTest
,
{
&
CLSID_WineTestOld
,
1
,
{
{
"
\2
OlePres000"
,
CF_DIB
,
DVASPECT_CONTENT
,
0
,
NULL
,
0
}
}
&
CLSID_WineTestOld
,
3
,
{
{
"
\2
OlePres000"
,
CF_DIB
,
DVASPECT_CONTENT
,
0
,
NULL
,
0
},
{
"
\2
OlePres001"
,
CF_METAFILEPICT
,
DVASPECT_CONTENT
,
0
,
NULL
,
0
},
{
"
\2
OlePres002"
,
CF_ENHMETAFILE
,
DVASPECT_CONTENT
,
0
,
NULL
,
0
}
}
}
},
/* without setting data */
{
{
{
CF_DIB
,
0
,
DVASPECT_CONTENT
,
-
1
,
TYMED_HGLOBAL
},
{
CF_METAFILEPICT
,
0
,
DVASPECT_CONTENT
,
-
1
,
TYMED_MFPICT
},
{
CF_ENHMETAFILE
,
0
,
DVASPECT_CONTENT
,
-
1
,
TYMED_ENHMF
},
},
3
,
0
,
&
CLSID_WineTest
,
{
&
CLSID_WineTestOld
,
3
,
{
{
"
\2
OlePres000"
,
CF_DIB
,
DVASPECT_CONTENT
,
0
,
NULL
,
0
},
{
"
\2
OlePres001"
,
CF_METAFILEPICT
,
DVASPECT_CONTENT
,
0
,
NULL
,
0
},
{
"
\2
OlePres002"
,
CF_ENHMETAFILE
,
DVASPECT_CONTENT
,
0
,
NULL
,
0
}
}
}
},
/* static picture clsids */
{
{
{
CF_DIB
,
0
,
DVASPECT_CONTENT
,
-
1
,
TYMED_HGLOBAL
},
},
1
,
1
,
&
CLSID_
WineTest
,
1
,
1
,
&
CLSID_
Picture_Dib
,
{
&
CLSID_WineTestOld
,
1
,
{
{
"
\2
OlePres000"
,
CF_METAFILEPICT
,
DVASPECT_CONTENT
,
0
,
NULL
,
0
}
}
&
CLSID_WineTestOld
,
1
,
{
{
"CONTENTS"
,
-
1
,
0
,
0
,
NULL
,
0
}
}
}
},
{
{
{
CF_METAFILEPICT
,
0
,
DVASPECT_CONTENT
,
-
1
,
TYMED_MFPICT
},
},
1
,
1
,
&
CLSID_Picture_Metafile
,
{
&
CLSID_WineTestOld
,
1
,
{
{
"CONTENTS"
,
-
1
,
0
,
0
,
NULL
,
0
}
}
}
},
{
{
{
CF_ENHMETAFILE
,
0
,
DVASPECT_CONTENT
,
-
1
,
TYMED_ENHMF
},
},
1
,
1
,
&
CLSID_
WineTest
,
1
,
1
,
&
CLSID_
Picture_EnhMetafile
,
{
&
CLSID_WineTestOld
,
1
,
{
{
"
\2
OlePres000"
,
CF_ENHMETAFILE
,
DVASPECT_CONTENT
,
0
,
NULL
,
0
}
}
&
CLSID_WineTestOld
,
1
,
{
{
"
CONTENTS"
,
-
1
,
0
,
0
,
NULL
,
0
}
}
}
},
/* static picture clsids without setting any data */
{
{
{
CF_DIB
,
0
,
DVASPECT_CONTENT
,
-
1
,
TYMED_HGLOBAL
},
},
1
,
1
,
&
CLSID_Picture_Dib
,
1
,
0
,
&
CLSID_Picture_Dib
,
{
&
CLSID_WineTestOld
,
1
,
{
{
"CONTENTS"
,
-
1
,
0
,
0
,
NULL
,
0
}
}
}
...
...
@@ -4263,7 +4292,7 @@ static void test_data_cache_save_data(void)
{
{
CF_METAFILEPICT
,
0
,
DVASPECT_CONTENT
,
-
1
,
TYMED_MFPICT
},
},
1
,
1
,
&
CLSID_Picture_Metafile
,
1
,
0
,
&
CLSID_Picture_Metafile
,
{
&
CLSID_WineTestOld
,
1
,
{
{
"CONTENTS"
,
-
1
,
0
,
0
,
NULL
,
0
}
}
}
...
...
@@ -4272,7 +4301,7 @@ static void test_data_cache_save_data(void)
{
{
CF_ENHMETAFILE
,
0
,
DVASPECT_CONTENT
,
-
1
,
TYMED_ENHMF
},
},
1
,
1
,
&
CLSID_Picture_EnhMetafile
,
1
,
0
,
&
CLSID_Picture_EnhMetafile
,
{
&
CLSID_WineTestOld
,
1
,
{
{
"CONTENTS"
,
-
1
,
0
,
0
,
NULL
,
0
}
}
}
...
...
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