Nikolay Sivov : ole32: Make OleSetClipboard affected by previous OleInitialize() calls.

Alexandre Julliard julliard at winehq.org
Fri Dec 19 11:19:16 CST 2008


Module: wine
Branch: master
Commit: 0eeb042067fde019d02674858cef2241ed8231b8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0eeb042067fde019d02674858cef2241ed8231b8

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Thu Dec 18 23:20:35 2008 +0300

ole32: Make OleSetClipboard affected by previous OleInitialize() calls.

---

 dlls/ole32/clipboard.c       |    9 +++++++++
 dlls/ole32/tests/clipboard.c |    2 --
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c
index 5320988..762afc7 100644
--- a/dlls/ole32/clipboard.c
+++ b/dlls/ole32/clipboard.c
@@ -78,6 +78,8 @@
 
 #include "storage32.h"
 
+#include "compobj_private.h"
+
 #define HANDLE_ERROR(err) { hr = err; TRACE("(HRESULT=%x)\n", (HRESULT)err); goto CLEANUP; }
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
@@ -313,6 +315,7 @@ HRESULT WINAPI OleSetClipboard(IDataObject* pDataObj)
   IEnumFORMATETC* penumFormatetc = NULL;
   FORMATETC rgelt;
   BOOL bClipboardOpen = FALSE;
+  struct oletls *info = COM_CurrentInfo();
 /*
   HGLOBAL hDataObject = 0;
   OLEClipbrd **ppDataObject;
@@ -320,6 +323,12 @@ HRESULT WINAPI OleSetClipboard(IDataObject* pDataObj)
 
   TRACE("(%p)\n", pDataObj);
 
+  if(!info)
+    WARN("Could not allocate tls\n");
+  else
+    if(!info->ole_inits)
+      return CO_E_NOTINITIALIZED;
+
   /*
    * Make sure we have a clipboard object
    */
diff --git a/dlls/ole32/tests/clipboard.c b/dlls/ole32/tests/clipboard.c
index e714064..7e3809e 100644
--- a/dlls/ole32/tests/clipboard.c
+++ b/dlls/ole32/tests/clipboard.c
@@ -439,12 +439,10 @@ static void test_set_clipboard(void)
         return;
 
     hr = OleSetClipboard(data1);
-    todo_wine
     ok(hr == CO_E_NOTINITIALIZED, "OleSetClipboard should have failed with CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
 
     CoInitialize(NULL);
     hr = OleSetClipboard(data1);
-    todo_wine
     ok(hr == CO_E_NOTINITIALIZED ||
        hr == CLIPBRD_E_CANT_SET, /* win9x */
        "OleSetClipboard should have failed with "




More information about the wine-cvs mailing list