ole32: make OleSetClipboard affected by previous OleInitialize() calls

Nikolay Sivov bunglehead at gmail.com
Thu Dec 18 14:23:43 CST 2008


Changelog:
    - make OleSetClipboard affected by previous OleInitialize() calls

>From 343bdd2746d2c3af571fc153378873ccdc39647f Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Thu, 18 Dec 2008 23:20:35 +0300
Subject:  Fix return codes for OleSetClipboard

---
 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 "
-- 
1.4.4.4






More information about the wine-patches mailing list