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
8aa2db47
Commit
8aa2db47
authored
May 19, 2009
by
Huw Davies
Committed by
Alexandre Julliard
May 19, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Use OleCreateFromDataEx to implement OleCreateFromData.
parent
d2837d91
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
103 deletions
+7
-103
ole2impl.c
dlls/ole32/ole2impl.c
+7
-103
No files found.
dlls/ole32/ole2impl.c
View file @
8aa2db47
...
...
@@ -184,112 +184,16 @@ HRESULT WINAPI OleCreateFromDataEx(IDataObject *data, REFIID iid, DWORD flags,
/******************************************************************************
* OleCreateFromData [OLE32.@]
*
* Author : Abey George
* Creates an embedded object from data transfer object retrieved from
* the clipboard or OLE drag and drop.
* Returns : S_OK - Embedded object was created successfully.
* OLE_E_STATIC - OLE can create only a static object
* DV_E_FORMATETC - No acceptable format is available (only error return code)
* TODO : CF_FILENAME, CF_EMBEDEDOBJECT formats. Parameter renderopt is currently ignored.
*/
HRESULT
WINAPI
OleCreateFromData
(
LPDATAOBJECT
pSrcDataObject
,
REFIID
riid
,
DWORD
renderopt
,
LPFORMATETC
pFormatEtc
,
LPOLECLIENTSITE
pClientSite
,
LPSTORAGE
pStg
,
LPVOID
*
ppvObj
)
HRESULT
WINAPI
OleCreateFromData
(
LPDATAOBJECT
data
,
REFIID
iid
,
DWORD
renderopt
,
LPFORMATETC
fmt
,
LPOLECLIENTSITE
client_site
,
LPSTORAGE
stg
,
LPVOID
*
obj
)
{
IEnumFORMATETC
*
pfmt
;
FORMATETC
fmt
;
CHAR
szFmtName
[
MAX_CLIPFORMAT_NAME
];
STGMEDIUM
std
;
HRESULT
hr
;
HRESULT
hr1
;
hr
=
IDataObject_EnumFormatEtc
(
pSrcDataObject
,
DATADIR_GET
,
&
pfmt
);
if
(
hr
==
S_OK
)
{
memset
(
&
std
,
0
,
sizeof
(
STGMEDIUM
));
hr
=
IEnumFORMATETC_Next
(
pfmt
,
1
,
&
fmt
,
NULL
);
while
(
hr
==
S_OK
)
{
GetClipboardFormatNameA
(
fmt
.
cfFormat
,
szFmtName
,
MAX_CLIPFORMAT_NAME
-
1
);
/* first, Check for Embedded Object, Embed Source or Filename */
/* TODO: Currently checks only for Embed Source. */
if
(
!
strcmp
(
szFmtName
,
CF_EMBEDSOURCE
))
{
std
.
tymed
=
TYMED_HGLOBAL
;
if
((
hr1
=
IDataObject_GetData
(
pSrcDataObject
,
&
fmt
,
&
std
))
==
S_OK
)
{
ILockBytes
*
ptrILockBytes
=
0
;
IStorage
*
pStorage
=
0
;
IOleObject
*
pOleObject
=
0
;
IPersistStorage
*
pPersistStorage
=
0
;
CLSID
clsID
;
/* Create ILock bytes */
hr1
=
CreateILockBytesOnHGlobal
(
std
.
u
.
hGlobal
,
FALSE
,
&
ptrILockBytes
);
/* Open storage on the ILock bytes */
if
(
hr1
==
S_OK
)
hr1
=
StgOpenStorageOnILockBytes
(
ptrILockBytes
,
NULL
,
STGM_SHARE_EXCLUSIVE
,
NULL
,
0
,
&
pStorage
);
/* Get Class ID from the opened storage */
if
(
hr1
==
S_OK
)
hr1
=
ReadClassStg
(
pStorage
,
&
clsID
);
/* Create default handler for Persist storage */
if
(
hr1
==
S_OK
)
hr1
=
OleCreateDefaultHandler
(
&
clsID
,
NULL
,
&
IID_IPersistStorage
,
(
LPVOID
*
)
&
pPersistStorage
);
/* Load the storage to Persist storage */
if
(
hr1
==
S_OK
)
hr1
=
IPersistStorage_Load
(
pPersistStorage
,
pStorage
);
/* Query for IOleObject */
if
(
hr1
==
S_OK
)
hr1
=
IPersistStorage_QueryInterface
(
pPersistStorage
,
&
IID_IOleObject
,
(
LPVOID
*
)
&
pOleObject
);
/* Set client site with the IOleObject */
if
(
hr1
==
S_OK
)
hr1
=
IOleObject_SetClientSite
(
pOleObject
,
pClientSite
);
IPersistStorage_Release
(
pPersistStorage
);
/* Query for the requested interface */
if
(
hr1
==
S_OK
)
hr1
=
IPersistStorage_QueryInterface
(
pPersistStorage
,
riid
,
ppvObj
);
IPersistStorage_Release
(
pPersistStorage
);
IStorage_Release
(
pStorage
);
if
(
hr1
==
S_OK
)
return
S_OK
;
}
/* Return error */
return
DV_E_FORMATETC
;
}
hr
=
IEnumFORMATETC_Next
(
pfmt
,
1
,
&
fmt
,
NULL
);
}
}
DWORD
advf
=
ADVF_PRIMEFIRST
;
return
DV_E_FORMATETC
;
return
OleCreateFromDataEx
(
data
,
iid
,
0
,
renderopt
,
fmt
?
1
:
0
,
fmt
?
&
advf
:
NULL
,
fmt
,
NULL
,
NULL
,
client_site
,
stg
,
obj
);
}
...
...
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