comsvcs/tests: Add tests for implicit MTA creation in RegisterDispenser().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f519dd28fd
commit
62d67bdebe
|
@ -24,6 +24,7 @@
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "ole2.h"
|
#include "ole2.h"
|
||||||
#include "comsvcs.h"
|
#include "comsvcs.h"
|
||||||
|
#include "msxml.h"
|
||||||
|
|
||||||
#include "wine/test.h"
|
#include "wine/test.h"
|
||||||
|
|
||||||
|
@ -141,6 +142,17 @@ static const struct IDispenserDriverVtbl driver_vtbl =
|
||||||
|
|
||||||
static IDispenserDriver DispenserDriver = { &driver_vtbl };
|
static IDispenserDriver DispenserDriver = { &driver_vtbl };
|
||||||
|
|
||||||
|
static DWORD WINAPI com_thread(void *arg)
|
||||||
|
{
|
||||||
|
IUnknown *unk;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
|
||||||
|
if (hr == S_OK) IUnknown_Release(unk);
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
static void create_dispenser(void)
|
static void create_dispenser(void)
|
||||||
{
|
{
|
||||||
static const WCHAR pool0[] = {'S','C','.','P','o','o','l',' ','0',' ','0',0};
|
static const WCHAR pool0[] = {'S','C','.','P','o','o','l',' ','0',' ','0',0};
|
||||||
|
@ -149,7 +161,9 @@ static void create_dispenser(void)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IDispenserManager *dispenser = NULL;
|
IDispenserManager *dispenser = NULL;
|
||||||
IHolder *holder1 = NULL, *holder2 = NULL, *holder3 = NULL;
|
IHolder *holder1 = NULL, *holder2 = NULL, *holder3 = NULL;
|
||||||
|
HANDLE thread;
|
||||||
RESID resid;
|
RESID resid;
|
||||||
|
DWORD ret;
|
||||||
BSTR str;
|
BSTR str;
|
||||||
|
|
||||||
hr = CoCreateInstance( &CLSID_DispenserManager, NULL, CLSCTX_ALL, &IID_IDispenserManager, (void**)&dispenser);
|
hr = CoCreateInstance( &CLSID_DispenserManager, NULL, CLSCTX_ALL, &IID_IDispenserManager, (void**)&dispenser);
|
||||||
|
@ -160,9 +174,23 @@ static void create_dispenser(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thread = CreateThread(NULL, 0, com_thread, NULL, 0, NULL);
|
||||||
|
ok(!WaitForSingleObject(thread, 1000), "wait failed\n");
|
||||||
|
GetExitCodeThread(thread, &ret);
|
||||||
|
ok(ret == CO_E_NOTINITIALIZED, "got unexpected hr %#x\n", ret);
|
||||||
|
|
||||||
hr = IDispenserManager_RegisterDispenser(dispenser, &DispenserDriver, pool0, &holder1);
|
hr = IDispenserManager_RegisterDispenser(dispenser, &DispenserDriver, pool0, &holder1);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
/* The above call creates an MTA thread, but we need to wait for it to
|
||||||
|
* actually initialize. */
|
||||||
|
Sleep(200);
|
||||||
|
thread = CreateThread(NULL, 0, com_thread, NULL, 0, NULL);
|
||||||
|
ok(!WaitForSingleObject(thread, 1000), "wait failed\n");
|
||||||
|
GetExitCodeThread(thread, &ret);
|
||||||
|
todo_wine
|
||||||
|
ok(ret == S_OK, "got unexpected hr %#x\n", ret);
|
||||||
|
|
||||||
hr = IDispenserManager_RegisterDispenser(dispenser, &DispenserDriver, pool0, &holder2);
|
hr = IDispenserManager_RegisterDispenser(dispenser, &DispenserDriver, pool0, &holder2);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
ok(holder1 != holder2, "same holder object returned\n");
|
ok(holder1 != holder2, "same holder object returned\n");
|
||||||
|
|
Loading…
Reference in New Issue