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
5defc71d
Commit
5defc71d
authored
Apr 16, 2009
by
Huw Davies
Committed by
Alexandre Julliard
Apr 16, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Use helper function to duplicate global memory.
parent
469d6ea2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
25 deletions
+8
-25
clipboard.c
dlls/ole32/clipboard.c
+8
-25
No files found.
dlls/ole32/clipboard.c
View file @
5defc71d
...
...
@@ -404,7 +404,7 @@ static HRESULT enum_fmtetc_construct(ole_priv_data *data, UINT pos, IEnumFORMATE
*
* Helper method to duplicate an HGLOBAL chunk of memory
*/
static
HRESULT
dup_global_mem
(
HGLOBAL
src
,
HGLOBAL
*
dst
)
static
HRESULT
dup_global_mem
(
HGLOBAL
src
,
DWORD
flags
,
HGLOBAL
*
dst
)
{
void
*
src_ptr
,
*
dst_ptr
;
DWORD
size
;
...
...
@@ -414,7 +414,7 @@ static HRESULT dup_global_mem( HGLOBAL src, HGLOBAL *dst )
size
=
GlobalSize
(
src
);
*
dst
=
GlobalAlloc
(
GMEM_DDESHARE
|
GMEM_MOVEABLE
,
size
);
*
dst
=
GlobalAlloc
(
flags
,
size
);
if
(
!*
dst
)
return
E_OUTOFMEMORY
;
src_ptr
=
GlobalLock
(
src
);
...
...
@@ -685,7 +685,7 @@ static HRESULT get_data_from_global(IDataObject *data, FORMATETC *fmt, HGLOBAL *
hr
=
IDataObject_GetData
(
data
,
&
mem_fmt
,
&
med
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
dup_global_mem
(
med
.
u
.
hGlobal
,
&
h
);
hr
=
dup_global_mem
(
med
.
u
.
hGlobal
,
GMEM_DDESHARE
|
GMEM_MOVEABLE
,
&
h
);
if
(
SUCCEEDED
(
hr
))
*
mem
=
h
;
...
...
@@ -918,9 +918,9 @@ static HRESULT WINAPI OLEClipbrd_IDataObject_GetData(
LPFORMATETC
pformatetcIn
,
STGMEDIUM
*
pmedium
)
{
HANDLE
hData
=
0
;
LPVOID
src
;
HANDLE
h
,
hData
=
0
;
ole_clipbrd
*
This
=
impl_from_IDataObject
(
iface
);
HRESULT
hr
;
TRACE
(
"(%p,%p,%p)
\n
"
,
iface
,
pformatetcIn
,
pmedium
);
...
...
@@ -953,26 +953,8 @@ static HRESULT WINAPI OLEClipbrd_IDataObject_GetData(
*/
if
(
!
OpenClipboard
(
theOleClipboard
->
hWndClipboard
))
return
CLIPBRD_E_CANT_OPEN
;
hData
=
GetClipboardData
(
pformatetcIn
->
cfFormat
);
/* Must make a copy of global handle returned by GetClipboardData; it
* is not valid after we call CloseClipboard
* Application is responsible for freeing the memory (Forte Agent does this)
*/
src
=
GlobalLock
(
hData
);
if
(
src
)
{
LPVOID
dest
;
ULONG
size
;
HANDLE
hDest
;
size
=
GlobalSize
(
hData
);
hDest
=
GlobalAlloc
(
GHND
,
size
);
dest
=
GlobalLock
(
hDest
);
memcpy
(
dest
,
src
,
size
);
GlobalUnlock
(
hDest
);
GlobalUnlock
(
hData
);
hData
=
hDest
;
}
h
=
GetClipboardData
(
pformatetcIn
->
cfFormat
);
hr
=
dup_global_mem
(
h
,
GMEM_MOVEABLE
,
&
hData
);
/*
* Return the clipboard data in the storage medium structure
...
...
@@ -983,6 +965,7 @@ static HRESULT WINAPI OLEClipbrd_IDataObject_GetData(
if
(
!
CloseClipboard
()
)
return
CLIPBRD_E_CANT_CLOSE
;
if
(
FAILED
(
hr
))
return
hr
;
return
(
hData
==
0
)
?
DV_E_FORMATETC
:
S_OK
;
}
...
...
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