Module: wine Branch: refs/heads/master Commit: 6c529a72737fdf54eac63faaedd36d46e720d06d URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=6c529a72737fdf54eac63faa...
Author: Robert Shearman rob@codeweavers.com Date: Wed Feb 22 16:26:25 2006 +0000
ole: Make the CoCreateInstance test succeed. Move the uninitialized apartment check after zeroing out the return value.
---
dlls/ole32/compobj.c | 12 ++++++------ dlls/ole32/tests/compobj.c | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index a757adb..67c8655 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -1836,12 +1836,6 @@ HRESULT WINAPI CoCreateInstance( TRACE("(rclsid=%s, pUnkOuter=%p, dwClsContext=%08lx, riid=%s, ppv=%p)\n", debugstr_guid(rclsid), pUnkOuter, dwClsContext, debugstr_guid(iid), ppv);
- if (!COM_CurrentApt()) - { - ERR("apartment not initialised\n"); - return CO_E_NOTINITIALIZED; - } - /* * Sanity check */ @@ -1853,6 +1847,12 @@ HRESULT WINAPI CoCreateInstance( */ *ppv = 0;
+ if (!COM_CurrentApt()) + { + ERR("apartment not initialised\n"); + return CO_E_NOTINITIALIZED; + } + /* * The Standard Global Interface Table (GIT) object is a process-wide singleton. * Rather than create a class factory, we can just check for it here diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c index 8882d28..f1f97cf 100644 --- a/dlls/ole32/tests/compobj.c +++ b/dlls/ole32/tests/compobj.c @@ -88,9 +88,7 @@ static void test_CoCreateInstance(void) IUnknown *pUnk = (IUnknown *)0xdeadbeef; HRESULT hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk); ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have return CO_E_NOTINITIALIZED instead of 0x%08lx", hr); - todo_wine { ok(pUnk == NULL, "CoCreateInstance should have changed the passed in pointer to NULL, instead of %p\n", pUnk); - }
OleInitialize(NULL); hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);