Module: wine Branch: master Commit: 949a48498c5f383e4e5b8d255e214a5f3026532e URL: https://source.winehq.org/git/wine.git/?a=commit;h=949a48498c5f383e4e5b8d255...
Author: Paul Gofman pgofman@codeweavers.com Date: Mon Jul 26 11:28:12 2021 +0100
ole32: Move OLEClipbrd_Initialize() before get_ole_clipbrd().
Signed-off-by: Paul Gofman pgofman@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ole32/clipboard.c | 146 ++++++++++++++++++++++++------------------------- 1 file changed, 73 insertions(+), 73 deletions(-)
diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c index d15bf23217a..a1e68c64845 100644 --- a/dlls/ole32/clipboard.c +++ b/dlls/ole32/clipboard.c @@ -183,18 +183,6 @@ static CRITICAL_SECTION_DEBUG latest_snapshot_cs_debug = }; static CRITICAL_SECTION latest_snapshot_cs = { &latest_snapshot_cs_debug, -1, 0, 0, 0, 0 };
-static inline HRESULT get_ole_clipbrd(ole_clipbrd **clipbrd) -{ - struct oletls *info = COM_CurrentInfo(); - *clipbrd = NULL; - - if(!info->ole_inits) - return CO_E_NOTINITIALIZED; - *clipbrd = theOleClipboard; - - return S_OK; -} - /* * Name of our registered OLE clipboard window class */ @@ -214,6 +202,79 @@ UINT ole_private_data_clipboard_format = 0;
static UINT wine_marshal_clipboard_format;
+/********************************************************* + * register_clipboard_formats + */ +static void register_clipboard_formats(void) +{ + ownerlink_clipboard_format = RegisterClipboardFormatW(L"OwnerLink"); + filename_clipboard_format = RegisterClipboardFormatW(L"FileName"); + filenameW_clipboard_format = RegisterClipboardFormatW(L"FileNameW"); + dataobject_clipboard_format = RegisterClipboardFormatW(L"DataObject"); + embedded_object_clipboard_format = RegisterClipboardFormatW(L"Embedded Object"); + embed_source_clipboard_format = RegisterClipboardFormatW(L"Embed Source"); + custom_link_source_clipboard_format = RegisterClipboardFormatW(L"Custom Link Source"); + link_source_clipboard_format = RegisterClipboardFormatW(L"Link Source"); + object_descriptor_clipboard_format = RegisterClipboardFormatW(L"Object Descriptor"); + link_source_descriptor_clipboard_format = RegisterClipboardFormatW(L"Link Source Descriptor"); + ole_private_data_clipboard_format = RegisterClipboardFormatW(L"Ole Private Data"); + + wine_marshal_clipboard_format = RegisterClipboardFormatW(L"Wine Marshalled DataObject"); +} + +/*********************************************************************** + * OLEClipbrd_Initialize() + * Initializes the OLE clipboard. + */ +void OLEClipbrd_Initialize(void) +{ + register_clipboard_formats(); + + if ( !theOleClipboard ) + { + ole_clipbrd* clipbrd; + HGLOBAL h; + + TRACE("()\n"); + + clipbrd = HeapAlloc( GetProcessHeap(), 0, sizeof(*clipbrd) ); + if (!clipbrd) return; + + clipbrd->latest_snapshot = NULL; + clipbrd->window = NULL; + clipbrd->src_data = NULL; + clipbrd->cached_enum = NULL; + + h = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, 0); + if(!h) + { + HeapFree(GetProcessHeap(), 0, clipbrd); + return; + } + + if(FAILED(CreateStreamOnHGlobal(h, TRUE, &clipbrd->marshal_data))) + { + GlobalFree(h); + HeapFree(GetProcessHeap(), 0, clipbrd); + return; + } + + theOleClipboard = clipbrd; + } +} + +static inline HRESULT get_ole_clipbrd(ole_clipbrd **clipbrd) +{ + struct oletls *info = COM_CurrentInfo(); + *clipbrd = NULL; + + if(!info->ole_inits) + return CO_E_NOTINITIALIZED; + *clipbrd = theOleClipboard; + + return S_OK; +} + static inline const char *dump_fmtetc(FORMATETC *fmt) { if (!fmt) return "(null)"; @@ -1739,67 +1800,6 @@ static snapshot *snapshot_construct(DWORD seq_no) return This; }
-/********************************************************* - * register_clipboard_formats - */ -static void register_clipboard_formats(void) -{ - ownerlink_clipboard_format = RegisterClipboardFormatW(L"OwnerLink"); - filename_clipboard_format = RegisterClipboardFormatW(L"FileName"); - filenameW_clipboard_format = RegisterClipboardFormatW(L"FileNameW"); - dataobject_clipboard_format = RegisterClipboardFormatW(L"DataObject"); - embedded_object_clipboard_format = RegisterClipboardFormatW(L"Embedded Object"); - embed_source_clipboard_format = RegisterClipboardFormatW(L"Embed Source"); - custom_link_source_clipboard_format = RegisterClipboardFormatW(L"Custom Link Source"); - link_source_clipboard_format = RegisterClipboardFormatW(L"Link Source"); - object_descriptor_clipboard_format = RegisterClipboardFormatW(L"Object Descriptor"); - link_source_descriptor_clipboard_format = RegisterClipboardFormatW(L"Link Source Descriptor"); - ole_private_data_clipboard_format = RegisterClipboardFormatW(L"Ole Private Data"); - - wine_marshal_clipboard_format = RegisterClipboardFormatW(L"Wine Marshalled DataObject"); -} - -/*********************************************************************** - * OLEClipbrd_Initialize() - * Initializes the OLE clipboard. - */ -void OLEClipbrd_Initialize(void) -{ - register_clipboard_formats(); - - if ( !theOleClipboard ) - { - ole_clipbrd* clipbrd; - HGLOBAL h; - - TRACE("()\n"); - - clipbrd = HeapAlloc( GetProcessHeap(), 0, sizeof(*clipbrd) ); - if (!clipbrd) return; - - clipbrd->latest_snapshot = NULL; - clipbrd->window = NULL; - clipbrd->src_data = NULL; - clipbrd->cached_enum = NULL; - - h = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, 0); - if(!h) - { - HeapFree(GetProcessHeap(), 0, clipbrd); - return; - } - - if(FAILED(CreateStreamOnHGlobal(h, TRUE, &clipbrd->marshal_data))) - { - GlobalFree(h); - HeapFree(GetProcessHeap(), 0, clipbrd); - return; - } - - theOleClipboard = clipbrd; - } -} - /********************************************************************* * set_clipboard_formats *