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
12718fe0
Commit
12718fe0
authored
Oct 31, 2017
by
Huw Davies
Committed by
Alexandre Julliard
Oct 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: A presentation cache for DVASPECT_ICON must have format CF_METAFILEPICT.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8d0a53e6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
9 deletions
+36
-9
datacache.c
dlls/ole32/datacache.c
+13
-9
ole2.c
dlls/ole32/tests/ole2.c
+23
-0
No files found.
dlls/ole32/datacache.c
View file @
12718fe0
...
...
@@ -322,19 +322,23 @@ static DataCacheEntry *DataCache_GetEntryForFormatEtc(DataCache *This, const FOR
/* checks that the clipformat and tymed are valid and returns an error if they
* aren't and CACHE_S_NOTSUPPORTED if they are valid, but can't be rendered by
* DataCache_Draw */
static
HRESULT
check_valid_
clipformat_and_tymed
(
CLIPFORMAT
cfFormat
,
DWORD
tymed
)
static
HRESULT
check_valid_
formatetc
(
const
FORMATETC
*
fmt
)
{
if
(
!
cfFormat
||
!
tymed
||
(
cfFormat
==
CF_METAFILEPICT
&&
tymed
==
TYMED_MFPICT
)
||
(
cfFormat
==
CF_BITMAP
&&
tymed
==
TYMED_GDI
)
||
(
cfFormat
==
CF_DIB
&&
tymed
==
TYMED_HGLOBAL
)
||
(
cfFormat
==
CF_ENHMETAFILE
&&
tymed
==
TYMED_ENHMF
))
/* DVASPECT_ICON must be CF_METAFILEPICT */
if
(
fmt
->
dwAspect
==
DVASPECT_ICON
&&
fmt
->
cfFormat
!=
CF_METAFILEPICT
)
return
DV_E_FORMATETC
;
if
(
!
fmt
->
cfFormat
||
!
fmt
->
tymed
||
(
fmt
->
cfFormat
==
CF_METAFILEPICT
&&
fmt
->
tymed
==
TYMED_MFPICT
)
||
(
fmt
->
cfFormat
==
CF_BITMAP
&&
fmt
->
tymed
==
TYMED_GDI
)
||
(
fmt
->
cfFormat
==
CF_DIB
&&
fmt
->
tymed
==
TYMED_HGLOBAL
)
||
(
fmt
->
cfFormat
==
CF_ENHMETAFILE
&&
fmt
->
tymed
==
TYMED_ENHMF
))
return
S_OK
;
else
if
(
tymed
==
TYMED_HGLOBAL
)
else
if
(
fmt
->
tymed
==
TYMED_HGLOBAL
)
return
CACHE_S_FORMATETC_NOTSUPPORTED
;
else
{
WARN
(
"invalid clipformat/tymed combination: %d/%d
\n
"
,
cfFormat
,
tymed
);
WARN
(
"invalid clipformat/tymed combination: %d/%d
\n
"
,
fmt
->
cfFormat
,
fmt
->
tymed
);
return
DV_E_TYMED
;
}
}
...
...
@@ -368,7 +372,7 @@ static HRESULT DataCache_CreateEntry(DataCache *This, const FORMATETC *formatetc
DWORD
id
=
automatic
?
1
:
This
->
last_cache_id
;
DataCacheEntry
*
entry
;
hr
=
check_valid_
clipformat_and_tymed
(
formatetc
->
cfFormat
,
formatetc
->
tymed
);
hr
=
check_valid_
formatetc
(
formatetc
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
hr
==
CACHE_S_FORMATETC_NOTSUPPORTED
)
...
...
dlls/ole32/tests/ole2.c
View file @
12718fe0
...
...
@@ -2309,6 +2309,29 @@ static void test_data_cache_cache(void)
hr
=
IOleCache2_Uncache
(
cache
,
view_caching
[
0
].
dwConnection
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
/* Only able to set cfFormat == CF_METAFILEPICT (or == 0, see above) for DVASPECT_ICON */
fmt
.
dwAspect
=
DVASPECT_ICON
;
fmt
.
cfFormat
=
CF_DIB
;
fmt
.
tymed
=
TYMED_HGLOBAL
;
hr
=
IOleCache2_Cache
(
cache
,
&
fmt
,
0
,
&
conn
);
ok
(
hr
==
DV_E_FORMATETC
,
"got %08x
\n
"
,
hr
);
fmt
.
cfFormat
=
CF_BITMAP
;
fmt
.
tymed
=
TYMED_GDI
;
hr
=
IOleCache2_Cache
(
cache
,
&
fmt
,
0
,
&
conn
);
ok
(
hr
==
DV_E_FORMATETC
,
"got %08x
\n
"
,
hr
);
fmt
.
cfFormat
=
CF_ENHMETAFILE
;
fmt
.
tymed
=
TYMED_ENHMF
;
hr
=
IOleCache2_Cache
(
cache
,
&
fmt
,
0
,
&
conn
);
ok
(
hr
==
DV_E_FORMATETC
,
"got %08x
\n
"
,
hr
);
fmt
.
cfFormat
=
CF_METAFILEPICT
;
fmt
.
tymed
=
TYMED_MFPICT
;
hr
=
IOleCache2_Cache
(
cache
,
&
fmt
,
0
,
&
conn
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
/* uncache everything */
hr
=
IOleCache2_Uncache
(
cache
,
conn
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
IDataObject_Release
(
data
);
IOleCache2_Release
(
cache
);
}
...
...
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