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
ef4b6b87
Commit
ef4b6b87
authored
Mar 23, 2009
by
Huw Davies
Committed by
Alexandre Julliard
Mar 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Store the ole clipboard window's HWND in the DataObject clipboard format.
parent
e77ab142
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
24 deletions
+59
-24
clipboard.c
dlls/ole32/clipboard.c
+24
-24
clipboard.c
dlls/ole32/tests/clipboard.c
+35
-0
No files found.
dlls/ole32/clipboard.c
View file @
ef4b6b87
...
...
@@ -1271,6 +1271,26 @@ static HWND OLEClipbrd_CreateWindow(void)
return
hwnd
;
}
static
HRESULT
set_dataobject_format
(
HWND
hwnd
)
{
HGLOBAL
h
=
GlobalAlloc
(
GMEM_DDESHARE
|
GMEM_MOVEABLE
,
sizeof
(
hwnd
));
HWND
*
data
;
if
(
!
h
)
return
E_OUTOFMEMORY
;
data
=
GlobalLock
(
h
);
*
data
=
hwnd
;
GlobalUnlock
(
h
);
if
(
!
SetClipboardData
(
dataobject_clipboard_format
,
h
))
{
GlobalFree
(
h
);
return
CLIPBRD_E_CANT_SET
;
}
return
S_OK
;
}
/*---------------------------------------------------------------------*
* Win32 OLE clipboard API
*---------------------------------------------------------------------*/
...
...
@@ -1296,10 +1316,6 @@ HRESULT WINAPI OleSetClipboard(IDataObject* pDataObj)
FORMATETC
rgelt
;
BOOL
bClipboardOpen
=
FALSE
;
struct
oletls
*
info
=
COM_CurrentInfo
();
/*
HGLOBAL hDataObject = 0;
OLEClipbrd **ppDataObject;
*/
TRACE
(
"(%p)
\n
"
,
pDataObj
);
...
...
@@ -1391,27 +1407,9 @@ HRESULT WINAPI OleSetClipboard(IDataObject* pDataObj)
/*
* Windows additionally creates a new "DataObject" clipboard format
* and stores in on the clipboard. We could possibly store a pointer
* to our internal IDataObject interface on the clipboard. I'm not
* sure what the use of this is though.
* Enable the code below for this functionality.
* and stores the clipboard window's HWND in it
*/
/*
theOleClipboard->cfDataObj = RegisterClipboardFormatA("DataObject");
hDataObject = GlobalAlloc( GMEM_DDESHARE|GMEM_MOVEABLE|GMEM_ZEROINIT,
sizeof(OLEClipbrd *));
if (hDataObject==0)
HANDLE_ERROR( E_OUTOFMEMORY );
ppDataObject = GlobalLock(hDataObject);
*ppDataObject = theOleClipboard;
GlobalUnlock(hDataObject);
if ( !SetClipboardData( theOleClipboard->cfDataObj, hDataObject ) )
HANDLE_ERROR( CLIPBRD_E_CANT_SET );
*/
hr
=
S_OK
;
hr
=
set_dataobject_format
(
theOleClipboard
->
hWndClipboard
);
CLEANUP:
...
...
@@ -1541,6 +1539,8 @@ HRESULT WINAPI OleFlushClipboard(void)
IEnumFORMATETC_Release
(
penumFormatetc
);
hr
=
set_dataobject_format
(
NULL
);
/*
* Release the source data object we are holding on to
*/
...
...
dlls/ole32/tests/clipboard.c
View file @
ef4b6b87
...
...
@@ -423,6 +423,36 @@ static void test_get_clipboard(void)
IDataObject_Release
(
data_obj
);
}
static
void
test_cf_dataobject
(
BOOL
dataobject_active
)
{
UINT
cf
=
0
;
UINT
cf_dataobject
=
RegisterClipboardFormatA
(
"DataObject"
);
BOOL
found_dataobject
=
FALSE
;
OpenClipboard
(
NULL
);
do
{
cf
=
EnumClipboardFormats
(
cf
);
if
(
cf
==
cf_dataobject
)
{
HGLOBAL
h
=
GetClipboardData
(
cf
);
HWND
*
ptr
=
GlobalLock
(
h
);
DWORD
size
=
GlobalSize
(
h
);
HWND
clip_owner
=
GetClipboardOwner
();
found_dataobject
=
TRUE
;
ok
(
size
>=
sizeof
(
*
ptr
),
"size %d
\n
"
,
size
);
if
(
dataobject_active
)
ok
(
*
ptr
==
clip_owner
,
"hwnd %p clip_owner %p
\n
"
,
*
ptr
,
clip_owner
);
else
/* ole clipboard flushed */
ok
(
*
ptr
==
NULL
,
"hwnd %p
\n
"
,
*
ptr
);
GlobalUnlock
(
h
);
}
}
while
(
cf
);
CloseClipboard
();
ok
(
found_dataobject
,
"didn't find cf_dataobject
\n
"
);
}
static
void
test_set_clipboard
(
void
)
{
HRESULT
hr
;
...
...
@@ -453,6 +483,9 @@ static void test_set_clipboard(void)
hr
=
OleSetClipboard
(
data1
);
ok
(
hr
==
S_OK
,
"failed to set clipboard to data1, hr = 0x%08x
\n
"
,
hr
);
test_cf_dataobject
(
TRUE
);
hr
=
OleIsCurrentClipboard
(
data1
);
ok
(
hr
==
S_OK
,
"expected current clipboard to be data1, hr = 0x%08x
\n
"
,
hr
);
hr
=
OleIsCurrentClipboard
(
data2
);
...
...
@@ -480,6 +513,8 @@ static void test_set_clipboard(void)
hr
=
OleIsCurrentClipboard
(
NULL
);
ok
(
hr
==
S_FALSE
,
"expect S_FALSE, hr = 0x%08x
\n
"
,
hr
);
test_cf_dataobject
(
FALSE
);
ok
(
OleSetClipboard
(
NULL
)
==
S_OK
,
"failed to clear clipboard, hr = 0x%08x
\n
"
,
hr
);
ref
=
IDataObject_Release
(
data1
);
...
...
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