ReactOS  0.4.10-dev-348-gbcec1fd
compobj.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "initguid.h"
#include "objbase.h"
#include "shlguid.h"
#include "urlmon.h"
#include "dde.h"
#include "cguid.h"
#include "ctxtcall.h"
#include "wine/test.h"
Include dependency graph for compobj.c:

Go to the source code of this file.

Classes

struct  Test_CallContext
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define USE_COM_CONTEXT_DEF
 
#define DEFINE_EXPECT(func)   static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
 
#define SET_EXPECT(func)   expect_ ## func = TRUE
 
#define CHECK_EXPECT2(func)
 
#define CHECK_EXPECT(func)
 
#define CHECK_CALLED(func)
 
#define ok_ole_success(hr, func)   ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
 
#define ok_more_than_one_lock()   ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks)
 
#define ok_no_locks()   ok(cLocks == 0, "Number of locks should be 0, but actually is %d\n", cLocks)
 
#define test_apt_type(t, q)   _test_apt_type(t, q, __LINE__)
 
#define cowait_msgs_expect_empty()   _cowait_msgs_expect_empty(__LINE__)
 
#define cowait_msgs_expect_notified(a)   _cowait_msgs_expect_notified(__LINE__,a)
 
#define cowait_msgs_expect_queued(a, b)   _cowait_msgs_expect_queued(__LINE__,a,b)
 

Functions

 DEFINE_EXPECT (CreateStub)
 
static HRESULT (WINAPI *pCoInitializeEx)(LPVOID lpReserved
 
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY
 
static BOOL (WINAPI *pActivateActCtx)(HANDLE
 
static ULONG_PTR *static HANDLE (WINAPI *pCreateActCtxW)(PCACTCTXW)
 
static void (WINAPI *pReleaseActCtx)(HANDLE)
 
 DEFINE_GUID (CLSID_InProcFreeMarshaler, 0x0000033a, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (CLSID_testclsid, 0xacd014c7, 0x9535, 0x4fac, 0x8b, 0x53, 0xa4, 0x8c, 0xa7, 0xf4, 0xd7, 0x26)
 
 DEFINE_GUID (CLSID_GlobalOptions, 0x0000034b, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (IID_IWineTest, 0x5201163f, 0x8164, 0x4fd0, 0xa1, 0xa2, 0x5d, 0x5a, 0x36, 0x54, 0xd3, 0xbd)
 
 DEFINE_GUID (CLSID_WineOOPTest, 0x5201163f, 0x8164, 0x4fd0, 0xa1, 0xa2, 0x5d, 0x5a, 0x36, 0x54, 0xd3, 0xbd)
 
static void LockModule (void)
 
static void UnlockModule (void)
 
static HRESULT WINAPI Test_IClassFactory_QueryInterface (LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
 
static ULONG WINAPI Test_IClassFactory_AddRef (LPCLASSFACTORY iface)
 
static ULONG WINAPI Test_IClassFactory_Release (LPCLASSFACTORY iface)
 
static HRESULT WINAPI Test_IClassFactory_CreateInstance (LPCLASSFACTORY iface, IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObj)
 
static HRESULT WINAPI Test_IClassFactory_LockServer (LPCLASSFACTORY iface, BOOL fLock)
 
static BOOL create_manifest_file (const char *filename, const char *manifest)
 
static HANDLE activate_context (const char *manifest, ULONG_PTR *cookie)
 
 DEFINE_GUID (CLSID_Testclass, 0x12345678, 0x1234, 0x1234, 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0)
 
static void test_ProgIDFromCLSID (void)
 
static void test_CLSIDFromProgID (void)
 
static void test_CLSIDFromString (void)
 
static void test_IIDFromString (void)
 
static void test_StringFromGUID2 (void)
 
static void _test_apt_type (APTTYPE expected_type, APTTYPEQUALIFIER expected_qualifier, int line)
 
static void test_CoCreateInstance (void)
 
static void test_CoGetClassObject (void)
 
static void test_CoCreateInstanceEx (void)
 
static ATOM register_dummy_class (void)
 
static void test_ole_menu (void)
 
static HRESULT WINAPI MessageFilter_QueryInterface (IMessageFilter *iface, REFIID riid, void **ppvObj)
 
static ULONG WINAPI MessageFilter_AddRef (IMessageFilter *iface)
 
static ULONG WINAPI MessageFilter_Release (IMessageFilter *iface)
 
static DWORD WINAPI MessageFilter_HandleInComingCall (IMessageFilter *iface, DWORD dwCallType, HTASK threadIDCaller, DWORD dwTickCount, LPINTERFACEINFO lpInterfaceInfo)
 
static DWORD WINAPI MessageFilter_RetryRejectedCall (IMessageFilter *iface, HTASK threadIDCallee, DWORD dwTickCount, DWORD dwRejectType)
 
static DWORD WINAPI MessageFilter_MessagePending (IMessageFilter *iface, HTASK threadIDCallee, DWORD dwTickCount, DWORD dwPendingType)
 
static void test_CoRegisterMessageFilter (void)
 
static HRESULT WINAPI EnumOLEVERB_QueryInterface (IEnumOLEVERB *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI EnumOLEVERB_AddRef (IEnumOLEVERB *iface)
 
static ULONG WINAPI EnumOLEVERB_Release (IEnumOLEVERB *iface)
 
static HRESULT WINAPI EnumOLEVERB_Next (IEnumOLEVERB *iface, ULONG celt, OLEVERB *rgelt, ULONG *fetched)
 
static HRESULT WINAPI EnumOLEVERB_Skip (IEnumOLEVERB *iface, ULONG celt)
 
static HRESULT WINAPI EnumOLEVERB_Reset (IEnumOLEVERB *iface)
 
static HRESULT WINAPI EnumOLEVERB_Clone (IEnumOLEVERB *iface, IEnumOLEVERB **ppenum)
 
static HRESULT WINAPI Test_IUnknown_QueryInterface (IUnknown *iface, REFIID riid, LPVOID *ppvObj)
 
static ULONG WINAPI Test_IUnknown_AddRef (IUnknown *iface)
 
static ULONG WINAPI Test_IUnknown_Release (IUnknown *iface)
 
static HRESULT WINAPI PSFactoryBuffer_QueryInterface (IPSFactoryBuffer *This, REFIID riid, void **ppvObject)
 
static ULONG WINAPI PSFactoryBuffer_AddRef (IPSFactoryBuffer *This)
 
static ULONG WINAPI PSFactoryBuffer_Release (IPSFactoryBuffer *This)
 
static HRESULT WINAPI PSFactoryBuffer_CreateProxy (IPSFactoryBuffer *This, IUnknown *pUnkOuter, REFIID riid, IRpcProxyBuffer **ppProxy, void **ppv)
 
static HRESULT WINAPI PSFactoryBuffer_CreateStub (IPSFactoryBuffer *This, REFIID riid, IUnknown *pUnkServer, IRpcStubBuffer **ppStub)
 
static DWORD CALLBACK register_ps_clsid_thread (void *context)
 
static void test_CoRegisterPSClsid (void)
 
static void test_CoGetPSClsid (void)
 
static void test_CoUnmarshalInterface (void)
 
static void test_CoGetInterfaceAndReleaseStream (void)
 
static void test_CoMarshalInterface (void)
 
static void test_CoMarshalInterThreadInterfaceInStream (void)
 
static void test_CoRegisterClassObject (void)
 
static HRESULT get_class_object (CLSCTX clsctx)
 
static DWORD CALLBACK get_class_object_thread (LPVOID pv)
 
static DWORD CALLBACK get_class_object_proxy_thread (LPVOID pv)
 
static DWORD CALLBACK register_class_object_thread (LPVOID pv)
 
static DWORD CALLBACK revoke_class_object_thread (LPVOID pv)
 
static void test_registered_object_thread_affinity (void)
 
static DWORD CALLBACK free_libraries_thread (LPVOID p)
 
static BOOL is_module_loaded (const char *module)
 
static void test_CoFreeUnusedLibraries (void)
 
static void test_CoGetObjectContext (void)
 
static Test_CallContextimpl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI Test_CallContext_QueryInterface (IUnknown *iface, REFIID riid, LPVOID *ppvObj)
 
static ULONG WINAPI Test_CallContext_AddRef (IUnknown *iface)
 
static ULONG WINAPI Test_CallContext_Release (IUnknown *iface)
 
static void test_CoGetCallContext (void)
 
static void test_CoGetContextToken (void)
 
static void test_TreatAsClass (void)
 
static void test_CoInitializeEx (void)
 
static void test_OleInitialize_InitCounting (void)
 
static void test_OleRegGetMiscStatus (void)
 
static void test_OleRegGetUserType (void)
 
static void test_CoCreateGuid (void)
 
static void CALLBACK apc_test_proc (ULONG_PTR param)
 
static DWORD CALLBACK release_semaphore_thread (LPVOID arg)
 
static DWORD CALLBACK send_message_thread (LPVOID arg)
 
static DWORD CALLBACK send_and_post_user_message_thread (void *arg)
 
static DWORD CALLBACK post_message_thread (LPVOID arg)
 
static void cowait_msgs_reset (void)
 
static void _cowait_msgs_expect_empty (unsigned line)
 
static void _cowait_msgs_expect_notified (unsigned line, UINT expected_msg)
 
static void _cowait_msgs_expect_queued (unsigned line, HWND hwnd, UINT expected_msg)
 
static void flush_messages (void)
 
static LRESULT CALLBACK cowait_window_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static DWORD CALLBACK cowait_unmarshal_thread (void *arg)
 
static DWORD CALLBACK test_CoWaitForMultipleHandles_thread (LPVOID arg)
 
static void test_CoWaitForMultipleHandles (void)
 
static void test_CoGetMalloc (void)
 
static void test_CoGetApartmentType (void)
 
static HRESULT WINAPI testspy_QI (IMallocSpy *iface, REFIID riid, void **obj)
 
static ULONG WINAPI testspy_AddRef (IMallocSpy *iface)
 
static ULONG WINAPI testspy_Release (IMallocSpy *iface)
 
static SIZE_T WINAPI testspy_PreAlloc (IMallocSpy *iface, SIZE_T cb)
 
static void *WINAPI testspy_PostAlloc (IMallocSpy *iface, void *ptr)
 
static void *WINAPI testspy_PreFree (IMallocSpy *iface, void *ptr, BOOL spyed)
 
static void WINAPI testspy_PostFree (IMallocSpy *iface, BOOL spyed)
 
static SIZE_T WINAPI testspy_PreRealloc (IMallocSpy *iface, void *ptr, SIZE_T cb, void **newptr, BOOL spyed)
 
static void *WINAPI testspy_PostRealloc (IMallocSpy *iface, void *ptr, BOOL spyed)
 
static void *WINAPI testspy_PreGetSize (IMallocSpy *iface, void *ptr, BOOL spyed)
 
static SIZE_T WINAPI testspy_PostGetSize (IMallocSpy *iface, SIZE_T actual, BOOL spyed)
 
static void *WINAPI testspy_PreDidAlloc (IMallocSpy *iface, void *ptr, BOOL spyed)
 
static int WINAPI testspy_PostDidAlloc (IMallocSpy *iface, void *ptr, BOOL spyed, int actual)
 
static void WINAPI testspy_PreHeapMinimize (IMallocSpy *iface)
 
static void WINAPI testspy_PostHeapMinimize (IMallocSpy *iface)
 
static void test_IMallocSpy (void)
 
static void test_CoGetCurrentLogicalThreadId (void)
 
static HRESULT WINAPI testinitialize_QI (IInitializeSpy *iface, REFIID riid, void **obj)
 
static ULONG WINAPI testinitialize_AddRef (IInitializeSpy *iface)
 
static ULONG WINAPI testinitialize_Release (IInitializeSpy *iface)
 
static HRESULT WINAPI testinitialize_PreInitialize (IInitializeSpy *iface, DWORD coinit, DWORD aptrefs)
 
static HRESULT WINAPI testinitialize_PostInitialize (IInitializeSpy *iface, HRESULT hr, DWORD coinit, DWORD aptrefs)
 
static HRESULT WINAPI testinitialize_PreUninitialize (IInitializeSpy *iface, DWORD aptrefs)
 
static HRESULT WINAPI testinitialize_PostUninitialize (IInitializeSpy *iface, DWORD aptrefs)
 
static void test_IInitializeSpy (void)
 
static HRESULT WINAPI testinstance_QI (IPersistFile *iface, REFIID riid, void **obj)
 
static ULONG WINAPI testinstance_AddRef (IPersistFile *iface)
 
static ULONG WINAPI testinstance_Release (IPersistFile *iface)
 
static HRESULT WINAPI testinstance_GetClassID (IPersistFile *iface, CLSID *clsid)
 
static HRESULT WINAPI testinstance_IsDirty (IPersistFile *iface)
 
static HRESULT WINAPI testinstance_Load (IPersistFile *iface, LPCOLESTR filename, DWORD mode)
 
static HRESULT WINAPI testinstance_Save (IPersistFile *iface, LPCOLESTR filename, BOOL remember)
 
static HRESULT WINAPI testinstance_SaveCompleted (IPersistFile *iface, LPCOLESTR filename)
 
static HRESULT WINAPI testinstance_GetCurFile (IPersistFile *iface, LPOLESTR *filename)
 
static HRESULT WINAPI getinstance_cf_QI (IClassFactory *iface, REFIID riid, void **obj)
 
static ULONG WINAPI getinstance_cf_AddRef (IClassFactory *iface)
 
static ULONG WINAPI getinstance_cf_Release (IClassFactory *iface)
 
static HRESULT WINAPI getinstance_cf_CreateInstance (IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
 
static HRESULT WINAPI getinstance_cf_LockServer (IClassFactory *iface, BOOL lock)
 
static void test_CoGetInstanceFromFile (void)
 
static void test_GlobalOptions (void)
 
static void init_funcs (void)
 
static DWORD CALLBACK implicit_mta_proc (void *param)
 
static void test_implicit_mta (void)
 
 START_TEST (compobj)
 

Variables

static DWORD dwCoInit
 
static LPVOIDppv
 
static IUnknown ** ppOldObject
 
static LPCLSID pClsidNew
 
static APTTYPEQUALIFIERqualifier
 
static LPCSTR
 
static REGSAM
 
static DWORD
 
static HKEY override
 
static ULONG_PTR
 
static LPBOOL
 
static const CLSID CLSID_non_existent = { 0x12345678, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
 
static const CLSID CLSID_StdFont = { 0x0be35203, 0x8f91, 0x11ce, { 0x9d, 0xe3, 0x00, 0xaa, 0x00, 0x4b, 0xb8, 0x51 } }
 
static const GUID IID_Testiface = { 0x22222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
 
static const GUID IID_Testiface2 = { 0x32222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
 
static const GUID IID_Testiface3 = { 0x42222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
 
static const GUID IID_Testiface4 = { 0x52222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
 
static const GUID IID_Testiface5 = { 0x62222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
 
static const GUID IID_Testiface6 = { 0x72222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
 
static const GUID IID_TestPS = { 0x66666666, 0x8888, 0x7777, { 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 } }
 
static const WCHAR stdfont [] = {'S','t','d','F','o','n','t',0}
 
static const WCHAR wszNonExistent [] = {'N','o','n','E','x','i','s','t','e','n','t',0}
 
static const WCHAR wszCLSID_StdFont []
 
static const WCHAR progidW [] = {'P','r','o','g','I','d','.','P','r','o','g','I','d',0}
 
static const WCHAR cf_brokenW []
 
static LONG cLocks
 
static IID create_instance_iid
 
static const IClassFactoryVtbl TestClassFactory_Vtbl
 
static IClassFactory Test_ClassFactory = { &TestClassFactory_Vtbl }
 
static WCHAR manifest_path [MAX_PATH]
 
static const char actctx_manifest []
 
static const IMessageFilterVtbl MessageFilter_Vtbl
 
static IMessageFilter MessageFilter = { &MessageFilter_Vtbl }
 
static IUnknown Test_Unknown = { &TestUnknown_Vtbl }
 
static const IEnumOLEVERBVtbl EnumOLEVERBVtbl
 
static IEnumOLEVERB EnumOLEVERB = { &EnumOLEVERBVtbl }
 
static const IUnknownVtbl TestUnknown_Vtbl
 
static IPSFactoryBufferps_factory_buffer
 
static IPSFactoryBufferVtbl PSFactoryBufferVtbl
 
static IPSFactoryBuffer PSFactoryBuffer = { &PSFactoryBufferVtbl }
 
static const CLSID CLSID_WineTestPSFactoryBuffer
 
static const IUnknownVtbl TestCallContext_Vtbl
 
static const char cls_name [] = "cowait_test_class"
 
static UINT cowait_msgs [100]
 
static UINT cowait_msgs_first
 
static UINT cowait_msgs_last
 
static const IMallocSpyVtbl testspyvtbl
 
static IMallocSpy testspy = { &testspyvtbl }
 
static const IInitializeSpyVtbl testinitializevtbl
 
static IInitializeSpy testinitialize = { &testinitializevtbl }
 
static HRESULT g_persistfile_qi_ret
 
static HRESULT g_persistfile_load_ret
 
static const IPersistFileVtbl testpersistfilevtbl
 
static IPersistFile testpersistfile = { &testpersistfilevtbl }
 
static const IClassFactoryVtbl getinstance_cf_vtbl
 
static IClassFactory getinstance_cf = { &getinstance_cf_vtbl }
 

Macro Definition Documentation

#define CHECK_CALLED (   func)
Value:
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
#define expect_(expected, got, precision)
Definition: font.c:29
#define FALSE
Definition: types.h:117
#define ok(value,...)
Definition: CComObject.cpp:34

Definition at line 65 of file compobj.c.

Referenced by test_CoRegisterPSClsid().

#define CHECK_EXPECT (   func)
Value:
do { \
}while(0)
#define CHECK_EXPECT2(func)
Definition: compobj.c:53
#define expect_(expected, got, precision)
Definition: font.c:29
#define FALSE
Definition: types.h:117

Definition at line 59 of file compobj.c.

Referenced by PSFactoryBuffer_CreateStub().

#define CHECK_EXPECT2 (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
#define TRUE
Definition: types.h:120
#define expect_(expected, got, precision)
Definition: font.c:29
#define ok(value,...)
Definition: CComObject.cpp:34

Definition at line 53 of file compobj.c.

#define COBJMACROS

Definition at line 21 of file compobj.c.

#define CONST_VTABLE

Definition at line 22 of file compobj.c.

#define cowait_msgs_expect_empty ( )    _cowait_msgs_expect_empty(__LINE__)

Definition at line 2487 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

#define cowait_msgs_expect_notified (   a)    _cowait_msgs_expect_notified(__LINE__,a)

Definition at line 2497 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

#define cowait_msgs_expect_queued (   a,
  b 
)    _cowait_msgs_expect_queued(__LINE__,a,b)

Definition at line 2510 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

#define DEFINE_EXPECT (   func)    static BOOL expect_ ## func = FALSE, called_ ## func = FALSE

Definition at line 47 of file compobj.c.

#define ok_more_than_one_lock ( )    ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks)

Definition at line 91 of file compobj.c.

Referenced by test_CoMarshalInterThreadInterfaceInStream().

#define ok_no_locks ( )    ok(cLocks == 0, "Number of locks should be 0, but actually is %d\n", cLocks)

Definition at line 92 of file compobj.c.

Referenced by test_CoMarshalInterThreadInterfaceInStream().

#define SET_EXPECT (   func)    expect_ ## func = TRUE

Definition at line 50 of file compobj.c.

Referenced by test_CoRegisterPSClsid().

#define test_apt_type (   t,
  q 
)    _test_apt_type(t, q, __LINE__)
#define USE_COM_CONTEXT_DEF

Definition at line 29 of file compobj.c.

Function Documentation

static void _cowait_msgs_expect_empty ( unsigned  line)
static

Definition at line 2488 of file compobj.c.

2489 {
2491  ok_(__FILE__,line)(0, "unexpected message %u\n", cowait_msgs[cowait_msgs_first]);
2493  }
2495 }
Definition: parser.c:48
static UINT cowait_msgs[100]
Definition: compobj.c:2480
static UINT cowait_msgs_first
Definition: compobj.c:2480
static UINT cowait_msgs_last
Definition: compobj.c:2480
static void cowait_msgs_reset(void)
Definition: compobj.c:2482
#define ok_(x1, x2)
Definition: CString.cpp:56
static void _cowait_msgs_expect_notified ( unsigned  line,
UINT  expected_msg 
)
static

Definition at line 2498 of file compobj.c.

2499 {
2501  ok_(__FILE__,line)(0, "expected message %u, received none\n", expected_msg);
2502  }else {
2503  ok_(__FILE__,line)(cowait_msgs[cowait_msgs_first] == expected_msg,
2504  "expected message %u, received %u \n",
2505  expected_msg, cowait_msgs[cowait_msgs_first]);
2507  }
2508 }
Definition: parser.c:48
static UINT cowait_msgs[100]
Definition: compobj.c:2480
static UINT cowait_msgs_first
Definition: compobj.c:2480
static UINT cowait_msgs_last
Definition: compobj.c:2480
#define ok_(x1, x2)
Definition: CString.cpp:56
static void _cowait_msgs_expect_queued ( unsigned  line,
HWND  hwnd,
UINT  expected_msg 
)
static

Definition at line 2511 of file compobj.c.

2512 {
2513  MSG msg;
2514  BOOL success;
2515 
2516  success = PeekMessageA(&msg, hwnd, expected_msg, expected_msg, PM_REMOVE);
2517  ok_(__FILE__,line)(success, "PeekMessageA failed: %u\n", GetLastError());
2518  if(success)
2519  ok_(__FILE__,line)(msg.message == expected_msg, "unexpected message %u, expected %u\n",
2520  msg.message, expected_msg);
2521 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
Definition: parser.c:48
unsigned int BOOL
Definition: ntddk_ex.h:94
#define success(from, fromstr, to, tostr)
#define msg(x)
Definition: auth_time.c:54
#define PM_REMOVE
Definition: winuser.h:1177
#define ok_(x1, x2)
Definition: CString.cpp:56
static void _test_apt_type ( APTTYPE  expected_type,
APTTYPEQUALIFIER  expected_qualifier,
int  line 
)
static

Definition at line 612 of file compobj.c.

613 {
615  APTTYPE type = ~0u;
616  HRESULT hr;
617 
618  if (!pCoGetApartmentType)
619  return;
620 
621  hr = pCoGetApartmentType(&type, &qualifier);
622  ok_(__FILE__, line)(hr == S_OK || hr == CO_E_NOTINITIALIZED, "Unexpected return code: 0x%08x\n", hr);
623  ok_(__FILE__, line)(type == expected_type, "Wrong apartment type %d, expected %d\n", type, expected_type);
624  ok_(__FILE__, line)(qualifier == expected_qualifier, "Wrong apartment qualifier %d, expected %d\n", qualifier,
625  expected_qualifier);
626 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble * u
Definition: glfuncs.h:88
#define CO_E_NOTINITIALIZED
enum _APTTYPEQUALIFIER APTTYPEQUALIFIER
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:80
Definition: parser.c:48
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define ok_(x1, x2)
Definition: CString.cpp:56
static HANDLE activate_context ( const char manifest,
ULONG_PTR cookie 
)
static

Definition at line 220 of file compobj.c.

Referenced by test_CLSIDFromProgID(), test_CoGetClassObject(), test_CoGetPSClsid(), test_CoRegisterClassObject(), test_OleRegGetMiscStatus(), test_OleRegGetUserType(), and test_ProgIDFromCLSID().

221 {
223  ACTCTXW actctx;
224  HANDLE handle;
225  BOOL ret;
226 
227  if (!pCreateActCtxW) return NULL;
228 
229  create_manifest_file("file.manifest", manifest);
230 
231  MultiByteToWideChar( CP_ACP, 0, "file.manifest", -1, path, MAX_PATH );
232  memset(&actctx, 0, sizeof(ACTCTXW));
233  actctx.cbSize = sizeof(ACTCTXW);
234  actctx.lpSource = path;
235 
236  handle = pCreateActCtxW(&actctx);
237  ok(handle != INVALID_HANDLE_VALUE || broken(handle == INVALID_HANDLE_VALUE) /* some old XP/2k3 versions */,
238  "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
239  if (handle == INVALID_HANDLE_VALUE)
240  {
241  win_skip("activation context generation failed, some tests will be skipped\n");
242  handle = NULL;
243  }
244 
245  ok(actctx.cbSize == sizeof(ACTCTXW), "actctx.cbSize=%d\n", actctx.cbSize);
246  ok(actctx.dwFlags == 0, "actctx.dwFlags=%d\n", actctx.dwFlags);
247  ok(actctx.lpSource == path, "actctx.lpSource=%p\n", actctx.lpSource);
248  ok(actctx.wProcessorArchitecture == 0, "actctx.wProcessorArchitecture=%d\n", actctx.wProcessorArchitecture);
249  ok(actctx.wLangId == 0, "actctx.wLangId=%d\n", actctx.wLangId);
250  ok(actctx.lpAssemblyDirectory == NULL, "actctx.lpAssemblyDirectory=%p\n", actctx.lpAssemblyDirectory);
251  ok(actctx.lpResourceName == NULL, "actctx.lpResourceName=%p\n", actctx.lpResourceName);
252  ok(actctx.lpApplicationName == NULL, "actctx.lpApplicationName=%p\n", actctx.lpApplicationName);
253  ok(actctx.hModule == NULL, "actctx.hModule=%p\n", actctx.hModule);
254 
255  DeleteFileA("file.manifest");
256 
257  if (handle)
258  {
259  ret = pActivateActCtx(handle, cookie);
260  ok(ret, "ActivateActCtx failed: %u\n", GetLastError());
261  }
262 
263  return handle;
264 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLsizei const GLchar ** path
Definition: glext.h:7234
#define CP_ACP
Definition: compat.h:99
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define actctx
Definition: kernel32.h:8
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MAX_PATH
Definition: compat.h:26
int ret
#define broken(x)
Definition: _sntprintf.h:21
DWORD *typedef HANDLE
Definition: winlogon.h:52
Definition: services.c:325
#define MultiByteToWideChar
Definition: compat.h:100
static const CHAR manifest[]
Definition: v6util.h:39
static BOOL create_manifest_file(const char *filename, const char *manifest)
Definition: compobj.c:198
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141
static void CALLBACK apc_test_proc ( ULONG_PTR  param)
static

Definition at line 2440 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

2441 {
2442  /* nothing */
2443 }
static BOOL ( WINAPI pActivateActCtx)
static
static void cowait_msgs_reset ( void  )
static

Definition at line 2482 of file compobj.c.

Referenced by _cowait_msgs_expect_empty(), and test_CoWaitForMultipleHandles().

2483 {
2485 }
static UINT cowait_msgs_first
Definition: compobj.c:2480
static UINT cowait_msgs_last
Definition: compobj.c:2480
static DWORD CALLBACK cowait_unmarshal_thread ( void arg)
static

Definition at line 2538 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles_thread().

2539 {
2540  IStream *stream = arg;
2541  IEnumOLEVERB *enum_verb;
2543  IUnknown *unk;
2544  HRESULT hr;
2545 
2546  CoInitialize(NULL);
2547 
2548  zero.QuadPart = 0;
2549  hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
2550  ok(hr == S_OK, "Seek failed: %08x\n", hr);
2551 
2552  hr = CoUnmarshalInterface(stream, &IID_IUnknown, (void**)&unk);
2553  ok(hr == S_OK, "CoUnmarshalInterface failed: %08x\n", hr);
2554 
2555  hr = IUnknown_QueryInterface(unk, &IID_IEnumOLEVERB, (void**)&enum_verb);
2556  ok(hr == S_OK, "QueryInterface failed: %08x\n", hr);
2557 
2558  IEnumOLEVERB_Release(enum_verb);
2559  IUnknown_Release(unk);
2560 
2561  CoUninitialize();
2562  return 0;
2563 }
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1838
const GUID IID_IUnknown
const GUID IID_IEnumOLEVERB
void * arg
Definition: msvc.h:12
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
static double zero
Definition: j0_y0.c:96
Definition: parse.h:22
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1900
LONGLONG QuadPart
Definition: typedefs.h:112
static LRESULT CALLBACK cowait_window_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 2529 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

2530 {
2531  if(cowait_msgs_last < sizeof(cowait_msgs)/sizeof(*cowait_msgs))
2533  if(msg == WM_DDE_FIRST)
2534  return 6;
2535  return DefWindowProcA(hwnd, msg, wparam, lparam);
2536 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static UINT cowait_msgs[100]
Definition: compobj.c:2480
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
static UINT cowait_msgs_last
Definition: compobj.c:2480
#define WM_DDE_FIRST
Definition: dde.h:47
#define msg(x)
Definition: auth_time.c:54
UINT msg
Definition: msvc.h:92
UINT WPARAM wparam
Definition: msvc.h:92
static BOOL create_manifest_file ( const char filename,
const char manifest 
)
static

Definition at line 198 of file compobj.c.

Referenced by activate_context().

199 {
200  int manifest_len;
201  DWORD size;
202  HANDLE file;
204 
205  MultiByteToWideChar( CP_ACP, 0, filename, -1, path, MAX_PATH );
206  GetFullPathNameW(path, sizeof(manifest_path)/sizeof(WCHAR), manifest_path, NULL);
207 
208  manifest_len = strlen(manifest);
209  file = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
211  ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
212  if(file == INVALID_HANDLE_VALUE)
213  return FALSE;
214  WriteFile(file, manifest, manifest_len, &size, NULL);
215  CloseHandle(file);
216 
217  return TRUE;
218 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1105
static WCHAR manifest_path[MAX_PATH]
Definition: compobj.c:196
const char * filename
Definition: ioapi.h:135
DWORD DWORD
Definition: winlogon.h:75
#define FALSE
Definition: types.h:117
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:26
const char file[]
Definition: icontest.c:11
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define CREATE_ALWAYS
Definition: disk.h:72
DWORD *typedef HANDLE
Definition: winlogon.h:52
Definition: services.c:325
#define MultiByteToWideChar
Definition: compat.h:100
#define CreateFileW
Definition: compat.h:400
static const CHAR manifest[]
Definition: v6util.h:39
DEFINE_EXPECT ( CreateStub  )
DEFINE_GUID ( CLSID_InProcFreeMarshaler  ,
0x0000033a  ,
0x0000  ,
0x0000  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)
DEFINE_GUID ( CLSID_testclsid  ,
0xacd014c7  ,
0x9535  ,
0x4fac  ,
0x8b  ,
0x53  ,
0xa4  ,
0x8c  ,
0xa7  ,
0xf4  ,
0xd7  ,
0x26   
)
DEFINE_GUID ( CLSID_GlobalOptions  ,
0x0000034b  ,
0x0000  ,
0x0000  ,
0xc0  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x00  ,
0x46   
)
DEFINE_GUID ( IID_IWineTest  ,
0x5201163f  ,
0x8164  ,
0x4fd0  ,
0xa1  ,
0xa2  ,
0x5d  ,
0x5a  ,
0x36  ,
0x54  ,
0xd3  ,
0xbd   
)
DEFINE_GUID ( CLSID_WineOOPTest  ,
0x5201163f  ,
0x8164  ,
0x4fd0  ,
0xa1  ,
0xa2  ,
0x5d  ,
0x5a  ,
0x36  ,
0x54  ,
0xd3  ,
0xbd   
)
DEFINE_GUID ( CLSID_Testclass  ,
0x12345678  ,
0x1234  ,
0x1234  ,
0x12  ,
0x34  ,
0x56  ,
0x78  ,
0x9a  ,
0xbc  ,
0xde  ,
0xf0   
)
static ULONG WINAPI EnumOLEVERB_AddRef ( IEnumOLEVERB iface)
static

Definition at line 910 of file compobj.c.

911 {
912  return 2;
913 }
static HRESULT WINAPI EnumOLEVERB_Clone ( IEnumOLEVERB iface,
IEnumOLEVERB **  ppenum 
)
static

Definition at line 938 of file compobj.c.

939 {
940  ok(0, "unexpected call\n");
941  return E_NOTIMPL;
942 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI EnumOLEVERB_Next ( IEnumOLEVERB iface,
ULONG  celt,
OLEVERB *  rgelt,
ULONG fetched 
)
static

Definition at line 920 of file compobj.c.

921 {
922  ok(0, "unexpected call\n");
923  return E_NOTIMPL;
924 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI EnumOLEVERB_QueryInterface ( IEnumOLEVERB iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 905 of file compobj.c.

906 {
907  return IUnknown_QueryInterface(&Test_Unknown, riid, ppv);
908 }
REFIID riid
Definition: precomp.h:44
static IUnknown Test_Unknown
Definition: compobj.c:903
static ULONG WINAPI EnumOLEVERB_Release ( IEnumOLEVERB iface)
static

Definition at line 915 of file compobj.c.

916 {
917  return 1;
918 }
static HRESULT WINAPI EnumOLEVERB_Reset ( IEnumOLEVERB iface)
static

Definition at line 932 of file compobj.c.

933 {
934  ok(0, "unexpected call\n");
935  return E_NOTIMPL;
936 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI EnumOLEVERB_Skip ( IEnumOLEVERB iface,
ULONG  celt 
)
static

Definition at line 926 of file compobj.c.

927 {
928  ok(0, "unexpected call\n");
929  return E_NOTIMPL;
930 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static void flush_messages ( void  )
static

Definition at line 2523 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

2524 {
2525  MSG msg;
2526  while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ));
2527 }
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define msg(x)
Definition: auth_time.c:54
#define PM_REMOVE
Definition: winuser.h:1177
static DWORD CALLBACK free_libraries_thread ( LPVOID  p)
static

Definition at line 1726 of file compobj.c.

Referenced by test_CoFreeUnusedLibraries().

1727 {
1729  return 0;
1730 }
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void)
Definition: compobj.c:3613
static HRESULT get_class_object ( CLSCTX  clsctx)
static

Definition at line 1556 of file compobj.c.

Referenced by get_class_object_thread(), and test_registered_object_thread_affinity().

1557 {
1558  HRESULT hr;
1559  IClassFactory *pcf;
1560 
1562  (void **)&pcf);
1563 
1564  if (SUCCEEDED(hr))
1565  IClassFactory_Release(pcf);
1566 
1567  return hr;
1568 }
const GUID IID_IClassFactory
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3015
const CHARFORMATW * pcf
Definition: msvc.h:84
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:99
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static DWORD CALLBACK get_class_object_proxy_thread ( LPVOID  pv)
static

Definition at line 1584 of file compobj.c.

Referenced by test_registered_object_thread_affinity().

1585 {
1586  CLSCTX clsctx = (CLSCTX)(DWORD_PTR)pv;
1587  HRESULT hr;
1588  IClassFactory *pcf;
1589  IMultiQI *pMQI;
1590 
1591  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1592 
1594  (void **)&pcf);
1595 
1596  if (SUCCEEDED(hr))
1597  {
1598  hr = IClassFactory_QueryInterface(pcf, &IID_IMultiQI, (void **)&pMQI);
1599  if (SUCCEEDED(hr))
1600  IMultiQI_Release(pMQI);
1601  IClassFactory_Release(pcf);
1602  }
1603 
1604  CoUninitialize();
1605 
1606  return hr;
1607 }
const GUID IID_IClassFactory
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3015
const CHARFORMATW * pcf
Definition: msvc.h:84
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:99
DWORD void * pv
Definition: msvc.h:87
uint32_t DWORD_PTR
Definition: typedefs.h:63
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static DWORD CALLBACK get_class_object_thread ( LPVOID  pv)
static

Definition at line 1570 of file compobj.c.

Referenced by test_registered_object_thread_affinity().

1571 {
1572  CLSCTX clsctx = (CLSCTX)(DWORD_PTR)pv;
1573  HRESULT hr;
1574 
1575  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1576 
1577  hr = get_class_object(clsctx);
1578 
1579  CoUninitialize();
1580 
1581  return hr;
1582 }
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
DWORD void * pv
Definition: msvc.h:87
uint32_t DWORD_PTR
Definition: typedefs.h:63
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
static HRESULT get_class_object(CLSCTX clsctx)
Definition: compobj.c:1556
static ULONG WINAPI getinstance_cf_AddRef ( IClassFactory iface)
static

Definition at line 3521 of file compobj.c.

3522 {
3523  return 2;
3524 }
static HRESULT WINAPI getinstance_cf_CreateInstance ( IClassFactory iface,
IUnknown outer,
REFIID  riid,
void **  obj 
)
static

Definition at line 3531 of file compobj.c.

3533 {
3534  if (IsEqualIID(riid, &IID_IUnknown)) {
3535  *obj = &testpersistfile;
3536  return S_OK;
3537  }
3538 
3539  ok(0, "unexpected call, riid %s\n", wine_dbgstr_guid(riid));
3540  *obj = NULL;
3541  return E_NOTIMPL;
3542 }
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
const char * wine_dbgstr_guid(const GUID *guid)
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
static IPersistFile testpersistfile
Definition: compobj.c:3507
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
static HRESULT WINAPI getinstance_cf_LockServer ( IClassFactory iface,
BOOL  lock 
)
static

Definition at line 3544 of file compobj.c.

3545 {
3546  ok(0, "unexpected call\n");
3547  return E_NOTIMPL;
3548 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI getinstance_cf_QI ( IClassFactory iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 3509 of file compobj.c.

3510 {
3512  *obj = iface;
3513  IClassFactory_AddRef(iface);
3514  return S_OK;
3515  }
3516 
3517  *obj = NULL;
3518  return E_NOINTERFACE;
3519 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
const GUID IID_IClassFactory
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
static ULONG WINAPI getinstance_cf_Release ( IClassFactory iface)
static

Definition at line 3526 of file compobj.c.

3527 {
3528  return 1;
3529 }
static ULONG_PTR* static HANDLE ( WINAPI pCreateActCtxW)
static
static HRESULT ( WINAPI pCoInitializeEx)
static
static Test_CallContext* impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 1879 of file compobj.c.

Referenced by Test_CallContext_AddRef(), and Test_CallContext_Release().

1880 {
1881  return CONTAINING_RECORD(iface, Test_CallContext, IUnknown_iface);
1882 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
static DWORD CALLBACK implicit_mta_proc ( void param)
static

Definition at line 3724 of file compobj.c.

Referenced by test_implicit_mta().

3725 {
3726  IComThreadingInfo *threading_info;
3727  ULONG_PTR token;
3728  IUnknown *unk;
3729  DWORD cookie;
3730  CLSID clsid;
3731  HRESULT hr;
3732 
3734 
3735  hr = CoCreateInstance(&CLSID_InternetZoneManager, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
3736  ok_ole_success(hr, "CoCreateInstance");
3737  IUnknown_Release(unk);
3738 
3739  hr = CoGetClassObject(&CLSID_InternetZoneManager, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&unk);
3740  ok_ole_success(hr, "CoGetClassObject");
3741  IUnknown_Release(unk);
3742 
3743  hr = CoGetObjectContext(&IID_IComThreadingInfo, (void **)&threading_info);
3744  ok_ole_success(hr, "CoGetObjectContext");
3745  IComThreadingInfo_Release(threading_info);
3746 
3747  hr = CoGetContextToken(&token);
3748  ok_ole_success(hr, "CoGetContextToken");
3749 
3751  ok_ole_success(hr, "CoRegisterPSClsid");
3752 
3753  hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
3754  ok_ole_success(hr, "CoGetPSClsid");
3755 
3757  CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
3758  ok_ole_success(hr, "CoRegisterClassObject");
3759 
3760  hr = CoRevokeClassObject(cookie);
3761  ok_ole_success(hr, "CoRevokeClassObject");
3762 
3764  ok(hr == CO_E_NOT_SUPPORTED, "got %#x\n", hr);
3765 
3767  ok_ole_success(hr, "CoLockObjectExternal");
3768 
3770  ok_ole_success(hr, "CoDisconnectObject");
3771 
3772  return 0;
3773 }
#define TRUE
Definition: types.h:120
static IClassFactory Test_ClassFactory
Definition: compobj.c:194
const GUID IID_IUnknown
HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv)
Definition: compobj.c:5008
HRESULT WINAPI CoDisconnectObject(LPUNKNOWN lpUnk, DWORD reserved)
Definition: compobj.c:2061
#define test_apt_type(t, q)
Definition: compobj.c:611
HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid)
Definition: compobj.c:2690
static IUnknown Test_Unknown
Definition: compobj.c:903
#define ok_ole_success(hr, func)
Definition: compobj.c:90
DWORD DWORD
Definition: winlogon.h:75
HRESULT WINAPI CoGetContextToken(ULONG_PTR *token)
Definition: compobj.c:5026
const GUID IID_IClassFactory
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
#define CO_E_NOT_SUPPORTED
Definition: winerror.h:2397
HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
Definition: compobj.c:2602
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1089
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3015
#define ok(value,...)
Definition: CComObject.cpp:34
int token
Definition: lex.c:71
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases)
Definition: compobj.c:3655
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:99
REFCLSID clsid
Definition: msctf.c:84
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3237
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2809
static const IID IID_IWineTest
Definition: marshal.c:80
HRESULT WINAPI CoRegisterMessageFilter(LPMESSAGEFILTER lpMessageFilter, LPMESSAGEFILTER *lplpMessageFilter)
Definition: compobj.c:3958
static const CLSID CLSID_WineTestPSFactoryBuffer
Definition: compobj.c:1060
static void init_funcs ( void  )
static

Definition at line 3701 of file compobj.c.

Referenced by START_TEST().

3702 {
3703  HMODULE hOle32 = GetModuleHandleA("ole32");
3704  HMODULE hAdvapi32 = GetModuleHandleA("advapi32");
3705  HMODULE hkernel32 = GetModuleHandleA("kernel32");
3706 
3707  pCoGetObjectContext = (void*)GetProcAddress(hOle32, "CoGetObjectContext");
3708  pCoSwitchCallContext = (void*)GetProcAddress(hOle32, "CoSwitchCallContext");
3709  pCoGetTreatAsClass = (void*)GetProcAddress(hOle32,"CoGetTreatAsClass");
3710  pCoTreatAsClass = (void*)GetProcAddress(hOle32,"CoTreatAsClass");
3711  pCoGetContextToken = (void*)GetProcAddress(hOle32, "CoGetContextToken");
3712  pCoGetApartmentType = (void*)GetProcAddress(hOle32, "CoGetApartmentType");
3713  pRegDeleteKeyExA = (void*)GetProcAddress(hAdvapi32, "RegDeleteKeyExA");
3714  pRegOverridePredefKey = (void*)GetProcAddress(hAdvapi32, "RegOverridePredefKey");
3715  pCoInitializeEx = (void*)GetProcAddress(hOle32, "CoInitializeEx");
3716 
3717  pActivateActCtx = (void*)GetProcAddress(hkernel32, "ActivateActCtx");
3718  pCreateActCtxW = (void*)GetProcAddress(hkernel32, "CreateActCtxW");
3719  pDeactivateActCtx = (void*)GetProcAddress(hkernel32, "DeactivateActCtx");
3720  pIsWow64Process = (void*)GetProcAddress(hkernel32, "IsWow64Process");
3721  pReleaseActCtx = (void*)GetProcAddress(hkernel32, "ReleaseActCtx");
3722 }
static HINSTANCE hkernel32
Definition: process.c:66
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:818
HANDLE HMODULE
Definition: typedefs.h:75
#define GetProcAddress(x, y)
Definition: compat.h:410
static BOOL is_module_loaded ( const char module)
inlinestatic

Definition at line 1732 of file compobj.c.

Referenced by test_CoFreeUnusedLibraries().

1733 {
1734  return GetModuleHandleA(module) != 0;
1735 }
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:818
static void LockModule ( void  )
static

Definition at line 124 of file compobj.c.

Referenced by Test_IClassFactory_AddRef().

125 {
127 }
static LONG cLocks
Definition: compobj.c:122
#define InterlockedIncrement
Definition: armddk.h:53
static LONG ( WINAPI pRegDeleteKeyExA)
static
static ULONG WINAPI MessageFilter_AddRef ( IMessageFilter iface)
static

Definition at line 809 of file compobj.c.

810 {
811  return 2; /* non-heap object */
812 }
static DWORD WINAPI MessageFilter_HandleInComingCall ( IMessageFilter iface,
DWORD  dwCallType,
HTASK  threadIDCaller,
DWORD  dwTickCount,
LPINTERFACEINFO  lpInterfaceInfo 
)
static

Definition at line 819 of file compobj.c.

825 {
826  trace("HandleInComingCall\n");
827  return SERVERCALL_ISHANDLED;
828 }
#define trace(...)
Definition: kmt_test.h:217
static DWORD WINAPI MessageFilter_MessagePending ( IMessageFilter iface,
HTASK  threadIDCallee,
DWORD  dwTickCount,
DWORD  dwPendingType 
)
static

Definition at line 840 of file compobj.c.

845 {
846  trace("MessagePending\n");
847  todo_wine ok(0, "unexpected call\n");
848  return PENDINGMSG_WAITNOPROCESS;
849 }
#define trace(...)
Definition: kmt_test.h:217
#define ok(value,...)
Definition: CComObject.cpp:34
#define todo_wine
Definition: test.h:154
static HRESULT WINAPI MessageFilter_QueryInterface ( IMessageFilter iface,
REFIID  riid,
void **  ppvObj 
)
static

Definition at line 794 of file compobj.c.

795 {
796  if (ppvObj == NULL) return E_POINTER;
797 
798  if (IsEqualGUID(riid, &IID_IUnknown) ||
800  {
801  *ppvObj = iface;
802  IMessageFilter_AddRef(iface);
803  return S_OK;
804  }
805 
806  return E_NOINTERFACE;
807 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
const GUID IID_IClassFactory
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4024
#define E_POINTER
Definition: winerror.h:2365
static ULONG WINAPI MessageFilter_Release ( IMessageFilter iface)
static

Definition at line 814 of file compobj.c.

815 {
816  return 1; /* non-heap object */
817 }
static DWORD WINAPI MessageFilter_RetryRejectedCall ( IMessageFilter iface,
HTASK  threadIDCallee,
DWORD  dwTickCount,
DWORD  dwRejectType 
)
static

Definition at line 830 of file compobj.c.

835 {
836  trace("RetryRejectedCall\n");
837  return 0;
838 }
#define trace(...)
Definition: kmt_test.h:217
static DWORD CALLBACK post_message_thread ( LPVOID  arg)
static

Definition at line 2470 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

2471 {
2472  HWND hWnd = arg;
2473  Sleep(50);
2474  PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
2475  return 0;
2476 }
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hWnd
Definition: settings.c:17
HANDLE HWND
Definition: compat.h:13
void * arg
Definition: msvc.h:12
#define WM_DDE_FIRST
Definition: dde.h:47
static ULONG WINAPI PSFactoryBuffer_AddRef ( IPSFactoryBuffer This)
static

Definition at line 1012 of file compobj.c.

1014 {
1015  return 2;
1016 }
static HRESULT WINAPI PSFactoryBuffer_CreateProxy ( IPSFactoryBuffer This,
IUnknown pUnkOuter,
REFIID  riid,
IRpcProxyBuffer **  ppProxy,
void **  ppv 
)
static

Definition at line 1024 of file compobj.c.

1030 {
1031  return E_NOTIMPL;
1032 }
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI PSFactoryBuffer_CreateStub ( IPSFactoryBuffer This,
REFIID  riid,
IUnknown pUnkServer,
IRpcStubBuffer **  ppStub 
)
static

Definition at line 1034 of file compobj.c.

1039 {
1040  CHECK_EXPECT(CreateStub);
1041 
1042  ok(pUnkServer == (IUnknown*)&Test_Unknown, "unexpected pUnkServer %p\n", pUnkServer);
1043  if(!ps_factory_buffer)
1044  return E_NOTIMPL;
1045 
1046  return IPSFactoryBuffer_CreateStub(ps_factory_buffer, &IID_IEnumOLEVERB, pUnkServer, ppStub);
1047 }
const GUID IID_IEnumOLEVERB
static IUnknown Test_Unknown
Definition: compobj.c:903
#define ok(value,...)
Definition: CComObject.cpp:34
static IPSFactoryBuffer * ps_factory_buffer
Definition: compobj.c:995
#define E_NOTIMPL
Definition: ddrawi.h:99
#define CHECK_EXPECT(func)
Definition: compobj.c:59
static HRESULT WINAPI PSFactoryBuffer_QueryInterface ( IPSFactoryBuffer This,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 997 of file compobj.c.

1001 {
1002  if (IsEqualIID(riid, &IID_IUnknown) ||
1003  IsEqualIID(riid, &IID_IPSFactoryBuffer))
1004  {
1005  *ppvObject = This;
1006  IPSFactoryBuffer_AddRef(This);
1007  return S_OK;
1008  }
1009  return E_NOINTERFACE;
1010 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
static ULONG WINAPI PSFactoryBuffer_Release ( IPSFactoryBuffer This)
static

Definition at line 1018 of file compobj.c.

1020 {
1021  return 1;
1022 }
static DWORD CALLBACK register_class_object_thread ( LPVOID  pv)
static

Definition at line 1609 of file compobj.c.

Referenced by test_registered_object_thread_affinity().

1610 {
1611  HRESULT hr;
1612  DWORD cookie;
1613 
1614  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1615 
1617  CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1618 
1619  CoUninitialize();
1620 
1621  return hr;
1622 }
static IClassFactory Test_ClassFactory
Definition: compobj.c:194
DWORD DWORD
Definition: winlogon.h:75
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:99
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2809
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
static ATOM register_dummy_class ( void  )
static

Definition at line 762 of file compobj.c.

Referenced by test_ole_menu().

763 {
764  WNDCLASSA wc =
765  {
766  0,
768  0,
769  0,
771  NULL,
772  LoadCursorA(NULL, (LPSTR)IDC_ARROW),
773  (HBRUSH)(COLOR_BTNFACE+1),
774  NULL,
775  "WineOleTestClass",
776  };
777 
778  return RegisterClassA(&wc);
779 }
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:416
#define COLOR_BTNFACE
Definition: winuser.h:913
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:818
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
#define IDC_ARROW
Definition: winuser.h:682
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
static DWORD CALLBACK register_ps_clsid_thread ( void context)
static

Definition at line 1068 of file compobj.c.

Referenced by test_CoRegisterPSClsid().

1069 {
1070  HRESULT hr;
1071  CLSID clsid = {0};
1072 
1073  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1074 
1075  hr = CoGetPSClsid(&IID_IWineTest, &clsid);
1076  ok_ole_success(hr, "CoGetPSClsid");
1077  ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1079 
1080  /* test registering a PSClsid in an apartment which is then destroyed */
1081  hr = CoRegisterPSClsid(&IID_TestPS, &clsid);
1082  ok_ole_success(hr, "CoRegisterPSClsid");
1083 
1084  CoUninitialize();
1085 
1086  return hr;
1087 }
const char * wine_dbgstr_guid(const GUID *guid)
HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid)
Definition: compobj.c:2690
#define ok_ole_success(hr, func)
Definition: compobj.c:90
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
Definition: compobj.c:2602
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:84
static const GUID IID_TestPS
Definition: compobj.c:102
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
static const IID IID_IWineTest
Definition: marshal.c:80
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4024
static const CLSID CLSID_WineTestPSFactoryBuffer
Definition: compobj.c:1060
static DWORD CALLBACK release_semaphore_thread ( LPVOID  arg)
static

Definition at line 2445 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

2446 {
2447  HANDLE handle = arg;
2448  if (WaitForSingleObject(handle, 200) == WAIT_TIMEOUT)
2449  ReleaseSemaphore(handle, 1, NULL);
2450  return 0;
2451 }
void * arg
Definition: msvc.h:12
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:416
#define WAIT_TIMEOUT
Definition: dderror.h:14
DWORD *typedef HANDLE
Definition: winlogon.h:52
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:488
static DWORD CALLBACK revoke_class_object_thread ( LPVOID  pv)
static

Definition at line 1624 of file compobj.c.

Referenced by test_registered_object_thread_affinity().

1625 {
1626  DWORD cookie = (DWORD_PTR)pv;
1627  HRESULT hr;
1628 
1629  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1630 
1631  hr = CoRevokeClassObject(cookie);
1632 
1633  CoUninitialize();
1634 
1635  return hr;
1636 }
DWORD DWORD
Definition: winlogon.h:75
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1089
LONG HRESULT
Definition: typedefs.h:77
#define DWORD_PTR
Definition: generated.c:24
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
static DWORD CALLBACK send_and_post_user_message_thread ( void arg)
static

Definition at line 2461 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

2462 {
2463  HWND hwnd = arg;
2464  Sleep(30);
2465  SendMessageA(hwnd, WM_USER, 0, 0);
2466  PostMessageA(hwnd, WM_USER, 0, 0);
2467  return 0;
2468 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HANDLE HWND
Definition: compat.h:13
void * arg
Definition: msvc.h:12
#define WM_USER
Definition: winuser.h:1851
static DWORD CALLBACK send_message_thread ( LPVOID  arg)
static

Definition at line 2453 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

2454 {
2455  HWND hWnd = arg;
2456  Sleep(50);
2457  SendMessageA(hWnd, WM_DDE_FIRST, 0, 0);
2458  return 0;
2459 }
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hWnd
Definition: settings.c:17
HANDLE HWND
Definition: compat.h:13
void * arg
Definition: msvc.h:12
#define WM_DDE_FIRST
Definition: dde.h:47
START_TEST ( compobj  )

Definition at line 3789 of file compobj.c.

3790 {
3791  init_funcs();
3792 
3793  if (!pCoInitializeEx)
3794  {
3795  trace("You need DCOM95 installed to run this test\n");
3796  return;
3797  }
3798 
3799  if (!pCreateActCtxW)
3800  win_skip("Activation contexts are not supported, some tests will be skipped.\n");
3801 
3808  test_ole_menu();
3830  test_CoGetMalloc();
3833  test_IMallocSpy();
3839 }
#define trace(...)
Definition: kmt_test.h:217
static void test_IInitializeSpy(void)
Definition: compobj.c:3354
static void test_CoInitializeEx(void)
Definition: compobj.c:2142
static void test_CoCreateInstanceEx(void)
Definition: compobj.c:738
static void test_CLSIDFromProgID(void)
Definition: compobj.c:378
static void test_implicit_mta(void)
Definition: compobj.c:3777
static void test_CoCreateInstance(void)
Definition: compobj.c:628
static void test_CoUnmarshalInterface(void)
Definition: compobj.c:1335
static void test_CoRegisterPSClsid(void)
Definition: compobj.c:1089
static void test_CoWaitForMultipleHandles(void)
Definition: compobj.c:2654
static void test_ProgIDFromCLSID(void)
Definition: compobj.c:325
static void init_funcs(void)
Definition: compobj.c:3701
static void test_CoGetClassObject(void)
Definition: compobj.c:669
static void test_StringFromGUID2(void)
Definition: compobj.c:583
static void test_CoRegisterMessageFilter(void)
Definition: compobj.c:863
static void test_OleRegGetUserType(void)
Definition: compobj.c:2275
static void test_IMallocSpy(void)
Definition: compobj.c:3244
static void test_CoGetCurrentLogicalThreadId(void)
Definition: compobj.c:3280
static void test_CoGetPSClsid(void)
Definition: compobj.c:1192
static void test_ole_menu(void)
Definition: compobj.c:781
static void test_CoRegisterClassObject(void)
Definition: compobj.c:1447
static void test_CoCreateGuid(void)
Definition: compobj.c:2432
static void test_CoGetInstanceFromFile(void)
Definition: compobj.c:3560
static void test_CoGetMalloc(void)
Definition: compobj.c:3039
static void test_CoFreeUnusedLibraries(void)
Definition: compobj.c:1737
static void test_OleRegGetMiscStatus(void)
Definition: compobj.c:2231
static void test_CoGetApartmentType(void)
Definition: compobj.c:3079
static void test_CoGetObjectContext(void)
Definition: compobj.c:1780
static void test_CoGetContextToken(void)
Definition: compobj.c:1981
static void test_CoGetInterfaceAndReleaseStream(void)
Definition: compobj.c:1364
static void test_GlobalOptions(void)
Definition: compobj.c:3675
static void test_CLSIDFromString(void)
Definition: compobj.c:445
static void test_CoMarshalInterThreadInterfaceInStream(void)
Definition: compobj.c:1413
static void test_CoGetCallContext(void)
Definition: compobj.c:1924
static void test_IIDFromString(void)
Definition: compobj.c:521
static void test_TreatAsClass(void)
Definition: compobj.c:2053
static void test_OleInitialize_InitCounting(void)
Definition: compobj.c:2164
#define win_skip
Definition: test.h:141
static void test_registered_object_thread_affinity(void)
Definition: compobj.c:1638
static void test_CoMarshalInterface(void)
Definition: compobj.c:1378
static ULONG WINAPI Test_CallContext_AddRef ( IUnknown iface)
static

Definition at line 1902 of file compobj.c.

1903 {
1904  Test_CallContext *This = impl_from_IUnknown(iface);
1905  return InterlockedIncrement(&This->refs);
1906 }
static Test_CallContext * impl_from_IUnknown(IUnknown *iface)
Definition: compobj.c:1879
#define InterlockedIncrement
Definition: armddk.h:53
static HRESULT WINAPI Test_CallContext_QueryInterface ( IUnknown iface,
REFIID  riid,
LPVOID ppvObj 
)
static

Definition at line 1884 of file compobj.c.

1888 {
1889  if (ppvObj == NULL) return E_POINTER;
1890 
1891  if (IsEqualGUID(riid, &IID_IUnknown))
1892  {
1893  *ppvObj = iface;
1894  IUnknown_AddRef(iface);
1895  return S_OK;
1896  }
1897 
1898  *ppvObj = NULL;
1899  return E_NOINTERFACE;
1900 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4024
#define E_POINTER
Definition: winerror.h:2365
static ULONG WINAPI Test_CallContext_Release ( IUnknown iface)
static

Definition at line 1908 of file compobj.c.

1909 {
1910  Test_CallContext *This = impl_from_IUnknown(iface);
1911  ULONG refs = InterlockedDecrement(&This->refs);
1912  if (!refs)
1913  HeapFree(GetProcessHeap(), 0, This);
1914  return refs;
1915 }
static Test_CallContext * impl_from_IUnknown(IUnknown *iface)
Definition: compobj.c:1879
#define GetProcessHeap()
Definition: compat.h:395
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394
static void test_CLSIDFromProgID ( void  )
static

Definition at line 378 of file compobj.c.

Referenced by START_TEST().

379 {
380  ULONG_PTR cookie = 0;
381  HANDLE handle;
382  CLSID clsid;
383  HRESULT hr = CLSIDFromProgID(stdfont, &clsid);
384  ok(hr == S_OK, "CLSIDFromProgID failed with error 0x%08x\n", hr);
385  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
386 
387  hr = CLSIDFromString(stdfont, &clsid);
388  ok_ole_success(hr, "CLSIDFromString");
389  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
390 
391  /* test some failure cases */
392 
394  ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08x\n", hr);
395 
396  hr = CLSIDFromProgID(NULL, &clsid);
397  ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08x\n", hr);
398 
399  memset(&clsid, 0xcc, sizeof(clsid));
400  hr = CLSIDFromProgID(wszNonExistent, &clsid);
401  ok(hr == CO_E_CLASSSTRING, "CLSIDFromProgID on nonexistent ProgID should have returned CO_E_CLASSSTRING instead of 0x%08x\n", hr);
402  ok(IsEqualCLSID(&clsid, &CLSID_NULL), "CLSIDFromProgID should have set clsid to all-zeros on failure\n");
403 
404  /* fails without proper context */
405  memset(&clsid, 0xcc, sizeof(clsid));
406  hr = CLSIDFromProgID(progidW, &clsid);
407  ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
408  ok(IsEqualCLSID(&clsid, &CLSID_NULL), "wrong clsid\n");
409 
410  if ((handle = activate_context(actctx_manifest, &cookie)))
411  {
412  GUID clsid1;
413 
414  memset(&clsid, 0xcc, sizeof(clsid));
415  hr = CLSIDFromProgID(wszNonExistent, &clsid);
416  ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
417  ok(IsEqualCLSID(&clsid, &CLSID_NULL), "should have zero CLSID on failure\n");
418 
419  /* CLSIDFromString() doesn't check activation context */
420  hr = CLSIDFromString(progidW, &clsid);
421  ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
422 
423  clsid = CLSID_NULL;
424  hr = CLSIDFromProgID(progidW, &clsid);
425  ok(hr == S_OK, "got 0x%08x\n", hr);
426  /* it returns generated CLSID here */
427  ok(!IsEqualCLSID(&clsid, &CLSID_non_existent) && !IsEqualCLSID(&clsid, &CLSID_NULL),
428  "got wrong clsid %s\n", wine_dbgstr_guid(&clsid));
429 
430  /* duplicate progid present in context - returns generated guid here too */
431  clsid = CLSID_NULL;
432  hr = CLSIDFromProgID(stdfont, &clsid);
433  ok(hr == S_OK, "got 0x%08x\n", hr);
434  clsid1 = CLSID_StdFont;
435  /* that's where it differs from StdFont */
436  clsid1.Data4[7] = 0x52;
437  ok(!IsEqualCLSID(&clsid, &CLSID_StdFont) && !IsEqualCLSID(&clsid, &CLSID_NULL) && !IsEqualCLSID(&clsid, &clsid1),
438  "got %s\n", wine_dbgstr_guid(&clsid));
439 
440  pDeactivateActCtx(0, cookie);
441  pReleaseActCtx(handle);
442  }
443 }
static const CLSID CLSID_StdFont
Definition: compobj.c:95
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
const char * wine_dbgstr_guid(const GUID *guid)
static const WCHAR wszNonExistent[]
Definition: compobj.c:109
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2514
#define ok_ole_success(hr, func)
Definition: compobj.c:90
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR stdfont[]
Definition: compobj.c:108
#define ok(value,...)
Definition: CComObject.cpp:34
#define CLSID_NULL
Definition: guiddef.h:94
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_non_existent
Definition: compobj.c:94
REFCLSID clsid
Definition: msctf.c:84
static const char actctx_manifest[]
Definition: compobj.c:266
static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
Definition: compobj.c:220
#define S_OK
Definition: intsafe.h:59
DWORD *typedef HANDLE
Definition: winlogon.h:52
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2250
#define CO_E_CLASSSTRING
Definition: winerror.h:2806
#define memset(x, y, z)
Definition: compat.h:39
static const WCHAR progidW[]
Definition: compobj.c:115
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:91
static void test_CLSIDFromString ( void  )
static

Definition at line 445 of file compobj.c.

Referenced by START_TEST().

446 {
447  CLSID clsid;
448  WCHAR wszCLSID_Broken[50];
449  UINT i;
450 
452  ok_ole_success(hr, "CLSIDFromString");
453  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
454 
455  memset(&clsid, 0xab, sizeof(clsid));
456  hr = CLSIDFromString(NULL, &clsid);
457  ok(hr == S_OK, "got 0x%08x\n", hr);
458  ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n");
459 
460  /* string is longer, but starts with a valid CLSID */
461  memset(&clsid, 0, sizeof(clsid));
462  hr = CLSIDFromString(cf_brokenW, &clsid);
463  ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
464  ok(IsEqualCLSID(&clsid, &IID_IClassFactory), "got %s\n", wine_dbgstr_guid(&clsid));
465 
466  lstrcpyW(wszCLSID_Broken, wszCLSID_StdFont);
467  for(i = lstrlenW(wszCLSID_StdFont); i < 49; i++)
468  wszCLSID_Broken[i] = 'A';
469  wszCLSID_Broken[i] = '\0';
470 
471  memset(&clsid, 0, sizeof(CLSID));
472  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
473  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
474  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
475 
476  wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = 'A';
477  memset(&clsid, 0, sizeof(CLSID));
478  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
479  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
480  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
481 
482  wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)] = '\0';
483  memset(&clsid, 0, sizeof(CLSID));
484  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
485  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
486  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
487 
488  wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = '\0';
489  memset(&clsid, 0, sizeof(CLSID));
490  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
491  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
492  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
493 
494  memset(&clsid, 0xcc, sizeof(CLSID));
495  hr = CLSIDFromString(wszCLSID_Broken+1, &clsid);
496  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
497  ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n");
498 
499  wszCLSID_Broken[9] = '*';
500  memset(&clsid, 0xcc, sizeof(CLSID));
501  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
502  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
503  ok(clsid.Data1 == CLSID_StdFont.Data1, "Got %08x\n", clsid.Data1);
504  ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
505 
506  wszCLSID_Broken[3] = '*';
507  memset(&clsid, 0xcc, sizeof(CLSID));
508  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
509  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
510  ok(clsid.Data1 == 0xb, "Got %08x\n", clsid.Data1);
511  ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
512 
513  wszCLSID_Broken[3] = '\0';
514  memset(&clsid, 0xcc, sizeof(CLSID));
515  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
516  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
517  ok(clsid.Data1 == 0xb, "Got %08x\n", clsid.Data1);
518  ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
519 }
static const CLSID CLSID_StdFont
Definition: compobj.c:95
__wchar_t WCHAR
Definition: xmlstorage.h:180
const char * wine_dbgstr_guid(const GUID *guid)
#define lstrlenW
Definition: compat.h:407
#define ok_ole_success(hr, func)
Definition: compobj.c:90
const GUID IID_IClassFactory
GLenum GLclampf GLint i
Definition: glfuncs.h:14
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
static const WCHAR wszCLSID_StdFont[]
Definition: compobj.c:110
#define CLSID_NULL
Definition: guiddef.h:94
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:84
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
unsigned int UINT
Definition: ndis.h:50
static const WCHAR cf_brokenW[]
Definition: compobj.c:116
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2250
#define CO_E_CLASSSTRING
Definition: winerror.h:2806
#define memset(x, y, z)
Definition: compat.h:39
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:91
static void test_CoCreateGuid ( void  )
static

Definition at line 2432 of file compobj.c.

Referenced by START_TEST().

2433 {
2434  HRESULT hr;
2435 
2436  hr = CoCreateGuid(NULL);
2437  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
2438 }
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2118
static void test_CoCreateInstance ( void  )
static

Definition at line 628 of file compobj.c.

Referenced by START_TEST().

629 {
630  HRESULT hr;
631  IUnknown *pUnk;
632  REFCLSID rclsid = &CLSID_InternetZoneManager;
633 
634  pUnk = (IUnknown *)0xdeadbeef;
635  hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
636  ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
637  ok(pUnk == NULL, "CoCreateInstance should have changed the passed in pointer to NULL, instead of %p\n", pUnk);
638 
640 
641  /* test errors returned for non-registered clsids */
642  hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
643  ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
644  hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&pUnk);
645  ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc handler should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
646  hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_LOCAL_SERVER, &IID_IUnknown, (void **)&pUnk);
647  ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered local server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
648  hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_REMOTE_SERVER, &IID_IUnknown, (void **)&pUnk);
649  ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered remote server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
650 
651  hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
652  if(hr == REGDB_E_CLASSNOTREG)
653  {
654  skip("IE not installed so can't test CoCreateInstance\n");
655  OleUninitialize();
656  return;
657  }
658 
659  ok_ole_success(hr, "CoCreateInstance");
660  if(pUnk) IUnknown_Release(pUnk);
661  OleUninitialize();
662 
663  hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
664  ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
665 
666  test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
667 }
const GUID IID_IUnknown
#define REFCLSID
Definition: guiddef.h:112
#define test_apt_type(t, q)
Definition: compobj.c:611
#define ok_ole_success(hr, func)
Definition: compobj.c:90
#define CO_E_NOTINITIALIZED
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_non_existent
Definition: compobj.c:94
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3237
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
#define skip(...)
Definition: CString.cpp:57
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
static void test_CoCreateInstanceEx ( void  )
static

Definition at line 738 of file compobj.c.

Referenced by START_TEST().

739 {
740  MULTI_QI qi_res = { &IID_IMoniker };
741  DWORD cookie;
742  HRESULT hr;
743 
745 
747  CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie);
748  ok_ole_success(hr, "CoRegisterClassObject");
749 
751  hr = CoCreateInstanceEx(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER, NULL, 1, &qi_res);
752  ok(hr == E_NOINTERFACE, "CoCreateInstanceEx failed: %08x\n", hr);
753  ok(IsEqualGUID(&create_instance_iid, qi_res.pIID), "Unexpected CreateInstance iid %s\n",
755 
756  hr = CoRevokeClassObject(cookie);
757  ok_ole_success(hr, "CoRevokeClassObject");
758 
759  CoUninitialize();
760 }
static IClassFactory Test_ClassFactory
Definition: compobj.c:194
#define E_NOINTERFACE
Definition: winerror.h:2364
const char * wine_dbgstr_guid(const GUID *guid)
static IID create_instance_iid
Definition: compobj.c:165
#define ok_ole_success(hr, func)
Definition: compobj.c:90
DWORD DWORD
Definition: winlogon.h:75
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1089
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, COSERVERINFO *pServerInfo, ULONG cmq, MULTI_QI *pResults)
Definition: compobj.c:3299
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:99
#define IID_NULL
Definition: guiddef.h:93
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2809
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4024
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1900
static void test_CoFreeUnusedLibraries ( void  )
static

Definition at line 1737 of file compobj.c.

Referenced by START_TEST().

1738 {
1739  HRESULT hr;
1740  IUnknown *pUnk;
1741  DWORD tid;
1742  HANDLE thread;
1743 
1744  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1745 
1746  ok(!is_module_loaded("urlmon.dll"), "urlmon.dll shouldn't be loaded\n");
1747 
1748  hr = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pUnk);
1749  if (hr == REGDB_E_CLASSNOTREG)
1750  {
1751  skip("IE not installed so can't run CoFreeUnusedLibraries test\n");
1752  CoUninitialize();
1753  return;
1754  }
1755  ok_ole_success(hr, "CoCreateInstance");
1756 
1757  ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1758 
1759  ok(pUnk != NULL ||
1760  broken(pUnk == NULL), /* win9x */
1761  "Expected a valid pointer\n");
1762  if (pUnk)
1763  IUnknown_Release(pUnk);
1764 
1765  ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1766 
1767  thread = CreateThread(NULL, 0, free_libraries_thread, NULL, 0, &tid);
1768  ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1769  CloseHandle(thread);
1770 
1771  ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1772 
1774 
1775  ok(!is_module_loaded("urlmon.dll"), "urlmon.dll shouldn't be loaded\n");
1776 
1777  CoUninitialize();
1778 }
#define CloseHandle
Definition: compat.h:398
static BOOL is_module_loaded(const char *module)
Definition: compobj.c:1732
#define ok_ole_success(hr, func)
Definition: compobj.c:90
DWORD DWORD
Definition: winlogon.h:75
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void)
Definition: compobj.c:3613
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:135
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
static DWORD CALLBACK free_libraries_thread(LPVOID p)
Definition: compobj.c:1726
static HANDLE thread
Definition: service.c:33
#define broken(x)
Definition: _sntprintf.h:21
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3237
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
#define skip(...)
Definition: CString.cpp:57
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
static TfClientId tid
static void test_CoGetApartmentType ( void  )
static

Definition at line 3079 of file compobj.c.

Referenced by START_TEST().

3080 {
3082  APTTYPE type;
3083  HRESULT hr;
3084 
3085  if (!pCoGetApartmentType)
3086  {
3087  win_skip("CoGetApartmentType not present\n");
3088  return;
3089  }
3090 
3091  hr = pCoGetApartmentType(NULL, NULL);
3092  ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
3093 
3094  type = 0xdeadbeef;
3095  hr = pCoGetApartmentType(&type, NULL);
3096  ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
3097  ok(type == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", type);
3098 
3099  qualifier = 0xdeadbeef;
3100  hr = pCoGetApartmentType(NULL, &qualifier);
3101  ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
3102  ok(qualifier == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", qualifier);
3103 
3104  type = 0xdeadbeef;
3105  qualifier = 0xdeadbeef;
3106  hr = pCoGetApartmentType(&type, &qualifier);
3107  ok(hr == CO_E_NOTINITIALIZED, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
3108  ok(type == APTTYPE_CURRENT, "Expected APTTYPE_CURRENT, got %u\n", type);
3109  ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3110 
3111  type = 0xdeadbeef;
3112  qualifier = 0xdeadbeef;
3113  hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
3114  ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08x\n", hr);
3115  hr = pCoGetApartmentType(&type, &qualifier);
3116  ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08x\n", hr);
3117  ok(type == APTTYPE_MAINSTA, "Expected APTTYPE_MAINSTA, got %u\n", type);
3118  ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3119  CoUninitialize();
3120 
3121  type = 0xdeadbeef;
3122  qualifier = 0xdeadbeef;
3123  hr = pCoInitializeEx(NULL, COINIT_MULTITHREADED);
3124  ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08x\n", hr);
3125  hr = pCoGetApartmentType(&type, &qualifier);
3126  ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08x\n", hr);
3127  ok(type == APTTYPE_MTA, "Expected APTTYPE_MTA, got %u\n", type);
3128  ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3129  CoUninitialize();
3130 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define CO_E_NOTINITIALIZED
enum _APTTYPEQUALIFIER APTTYPEQUALIFIER
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:80
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
#define win_skip
Definition: test.h:141
static void test_CoGetCallContext ( void  )
static

Definition at line 1924 of file compobj.c.

Referenced by START_TEST().

1925 {
1926  HRESULT hr;
1927  ULONG refs;
1928  IUnknown *pUnk;
1930 
1931  if (!pCoSwitchCallContext)
1932  {
1933  skip("CoSwitchCallContext not present\n");
1934  return;
1935  }
1936 
1937  CoInitialize(NULL);
1938 
1939  test_object = HeapAlloc(GetProcessHeap(), 0, sizeof(Test_CallContext));
1940  test_object->IUnknown_iface.lpVtbl = &TestCallContext_Vtbl;
1941  test_object->refs = 1;
1942 
1943  hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
1944  ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08x\n", hr);
1945 
1946  pUnk = (IUnknown*)0xdeadbeef;
1947  hr = pCoSwitchCallContext(&test_object->IUnknown_iface, &pUnk);
1948  ok_ole_success(hr, "CoSwitchCallContext");
1949  ok(pUnk == NULL, "expected NULL, got %p\n", pUnk);
1950  refs = IUnknown_AddRef(&test_object->IUnknown_iface);
1951  ok(refs == 2, "Expected refcount 2, got %d\n", refs);
1952  IUnknown_Release(&test_object->IUnknown_iface);
1953 
1954  pUnk = (IUnknown*)0xdeadbeef;
1955  hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
1956  ok_ole_success(hr, "CoGetCallContext");
1957  ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n",
1958  &test_object->IUnknown_iface, pUnk);
1959  refs = IUnknown_AddRef(&test_object->IUnknown_iface);
1960  ok(refs == 3, "Expected refcount 3, got %d\n", refs);
1961  IUnknown_Release(&test_object->IUnknown_iface);
1962  IUnknown_Release(pUnk);
1963 
1964  pUnk = (IUnknown*)0xdeadbeef;
1965  hr = pCoSwitchCallContext(NULL, &pUnk);
1966  ok_ole_success(hr, "CoSwitchCallContext");
1967  ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n",
1968  &test_object->IUnknown_iface, pUnk);
1969  refs = IUnknown_AddRef(&test_object->IUnknown_iface);
1970  ok(refs == 2, "Expected refcount 2, got %d\n", refs);
1971  IUnknown_Release(&test_object->IUnknown_iface);
1972 
1973  hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
1974  ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08x\n", hr);
1975 
1976  IUnknown_Release(&test_object->IUnknown_iface);
1977 
1978  CoUninitialize();
1979 }
const GUID IID_IUnknown
#define ok_ole_success(hr, func)
Definition: compobj.c:90
smooth NULL
Definition: ftsmooth.c:416
#define RPC_E_CALL_COMPLETE
Definition: winerror.h:2499
#define ok(value,...)
Definition: CComObject.cpp:34
IUnknown IUnknown_iface
Definition: compobj.c:1875
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI CoGetCallContext(REFIID riid, void **ppv)
Definition: compobj.c:4291
static void test_object(void)
Definition: d3drm.c:1511
static const IUnknownVtbl TestCallContext_Vtbl
Definition: compobj.c:1917
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
#define skip(...)
Definition: CString.cpp:57
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1900
unsigned int ULONG
Definition: retypes.h:1
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
static void test_CoGetClassObject ( void  )
static

Definition at line 669 of file compobj.c.

Referenced by START_TEST().

670 {
671  HRESULT hr;
672  HANDLE handle;
673  ULONG_PTR cookie;
674  IUnknown *pUnk;
675  REFCLSID rclsid = &CLSID_InternetZoneManager;
676  HKEY hkey;
677  LONG res;
678 
679  hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
680  ok(hr == CO_E_NOTINITIALIZED, "CoGetClassObject should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
681  ok(pUnk == NULL, "CoGetClassObject should have changed the passed in pointer to NULL, instead of %p\n", pUnk);
682 
683  hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, NULL);
684  ok(hr == E_INVALIDARG ||
685  broken(hr == CO_E_NOTINITIALIZED), /* win9x */
686  "CoGetClassObject should have returned E_INVALIDARG instead of 0x%08x\n", hr);
687 
688  test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
689 
690  if (!pRegOverridePredefKey)
691  {
692  win_skip("RegOverridePredefKey not available\n");
693  return;
694  }
695 
696  pCoInitializeEx(NULL, COINIT_MULTITHREADED);
697 
698  hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
699  if (hr == S_OK)
700  {
701  IUnknown_Release(pUnk);
702 
703  res = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0,
704  KEY_ALL_ACCESS, NULL, &hkey, NULL);
705  ok(!res, "RegCreateKeyEx returned %d\n", res);
706 
707  res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
708  ok(!res, "RegOverridePredefKey returned %d\n", res);
709 
710  hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
711  ok(hr == S_OK, "CoGetClassObject should have returned S_OK instead of 0x%08x\n", hr);
712 
713  res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
714  ok(!res, "RegOverridePredefKey returned %d\n", res);
715 
716  if (hr == S_OK) IUnknown_Release(pUnk);
717  RegCloseKey(hkey);
718  }
719 
720  hr = CoGetClassObject(&CLSID_InProcFreeMarshaler, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
721  ok(hr == S_OK, "got 0x%08x\n", hr);
722  IUnknown_Release(pUnk);
723 
724  /* context redefines FreeMarshaler CLSID */
725  if ((handle = activate_context(actctx_manifest, &cookie)))
726  {
727  hr = CoGetClassObject(&CLSID_InProcFreeMarshaler, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
728  ok(hr == S_OK, "got 0x%08x\n", hr);
729  IUnknown_Release(pUnk);
730 
731  pDeactivateActCtx(0, cookie);
732  pReleaseActCtx(handle);
733  }
734 
735  CoUninitialize();
736 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
const GUID IID_IUnknown
#define REFCLSID
Definition: guiddef.h:112
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define test_apt_type(t, q)
Definition: compobj.c:611
const CLSID CLSID_InProcFreeMarshaler
#define CO_E_NOTINITIALIZED
uint32_t ULONG_PTR
Definition: typedefs.h:63
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3015
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
HANDLE HKEY
Definition: registry.h:24
static const char actctx_manifest[]
Definition: compobj.c:266
#define broken(x)
Definition: _sntprintf.h:21
static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
Definition: compobj.c:220
#define S_OK
Definition: intsafe.h:59
DWORD *typedef HANDLE
Definition: winlogon.h:52
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
GLuint res
Definition: glext.h:9613
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1032
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
#define win_skip
Definition: test.h:141
static void test_CoGetContextToken ( void  )
static

Definition at line 1981 of file compobj.c.

Referenced by START_TEST().

1982 {
1983  HRESULT hr;
1984  ULONG refs;
1985  ULONG_PTR token, token2;
1986  IObjContext *ctx;
1987 
1988  if (!pCoGetContextToken)
1989  {
1990  win_skip("CoGetContextToken not present\n");
1991  return;
1992  }
1993 
1994  token = 0xdeadbeef;
1995  hr = pCoGetContextToken(&token);
1996  ok(hr == CO_E_NOTINITIALIZED, "Expected CO_E_NOTINITIALIZED, got 0x%08x\n", hr);
1997  ok(token == 0xdeadbeef, "Expected 0, got 0x%lx\n", token);
1998 
1999  test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
2000 
2001  CoInitialize(NULL);
2002 
2004 
2005  hr = pCoGetContextToken(NULL);
2006  ok(hr == E_POINTER, "Expected E_POINTER, got 0x%08x\n", hr);
2007 
2008  token = 0;
2009  hr = pCoGetContextToken(&token);
2010  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2011  ok(token, "Expected token != 0\n");
2012 
2013  token2 = 0;
2014  hr = pCoGetContextToken(&token2);
2015  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2016  ok(token2 == token, "got different token\n");
2017 
2018  refs = IUnknown_AddRef((IUnknown *)token);
2019  ok(refs == 1, "Expected 1, got %u\n", refs);
2020 
2021  hr = pCoGetObjectContext(&IID_IObjContext, (void **)&ctx);
2022  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2023  ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
2024 
2025  refs = IObjContext_AddRef(ctx);
2026  ok(refs == 3, "Expected 3, got %u\n", refs);
2027 
2028  refs = IObjContext_Release(ctx);
2029  ok(refs == 2, "Expected 2, got %u\n", refs);
2030 
2031  refs = IUnknown_Release((IUnknown *)token);
2032  ok(refs == 1, "Expected 1, got %u\n", refs);
2033 
2034  /* CoGetContextToken does not add a reference */
2035  token = 0;
2036  hr = pCoGetContextToken(&token);
2037  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2038  ok(token, "Expected token != 0\n");
2039  ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
2040 
2041  refs = IObjContext_AddRef(ctx);
2042  ok(refs == 2, "Expected 1, got %u\n", refs);
2043 
2044  refs = IObjContext_Release(ctx);
2045  ok(refs == 1, "Expected 0, got %u\n", refs);
2046 
2047  refs = IObjContext_Release(ctx);
2048  ok(refs == 0, "Expected 0, got %u\n", refs);
2049 
2050  CoUninitialize();
2051 }
#define test_apt_type(t, q)
Definition: compobj.c:611
#define CO_E_NOTINITIALIZED
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
int token
Definition: lex.c:71
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1900
unsigned int ULONG
Definition: retypes.h:1
#define E_POINTER
Definition: winerror.h:2365
#define win_skip
Definition: test.h:141
static void test_CoGetCurrentLogicalThreadId ( void  )
static

Definition at line 3280 of file compobj.c.

Referenced by START_TEST().

3281 {
3282  HRESULT hr;
3283  GUID id;
3284 
3286  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3287 
3288  id = GUID_NULL;
3289  hr = CoGetCurrentLogicalThreadId(&id);
3290  ok(hr == S_OK, "got 0x%08x\n", hr);
3291  ok(!IsEqualGUID(&id, &GUID_NULL), "got null id\n");
3292 }
HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *id)
Definition: compobj.c:3924
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
#define GUID_NULL
Definition: ks.h:106
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4024
GLenum GLuint id
Definition: glext.h:5579
static void test_CoGetInstanceFromFile ( void  )
static

Definition at line 3560 of file compobj.c.

Referenced by START_TEST().

3561 {
3562  static const WCHAR filenameW[] = {'d','u','m','m','y','p','a','t','h',0};
3563  CLSID *clsid = (CLSID*)&CLSID_testclsid;
3564  MULTI_QI mqi[2];
3565  DWORD cookie;
3566  HRESULT hr;
3567 
3568  hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
3569  ok(hr == S_OK, "got 0x%08x\n", hr);
3570 
3571  /* CLSID is not specified, file does not exist */
3572  mqi[0].pIID = &IID_IUnknown;
3573  mqi[0].pItf = NULL;
3574  mqi[0].hr = E_NOTIMPL;
3575  hr = CoGetInstanceFromFile(NULL, NULL, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3576 todo_wine
3577  ok(hr == MK_E_CANTOPENFILE, "got 0x%08x\n", hr);
3578  ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3579  ok(mqi[0].hr == E_NOINTERFACE, "got 0x%08x\n", mqi[0].hr);
3580 
3581  /* class is not available */
3582  mqi[0].pIID = &IID_IUnknown;
3583  mqi[0].pItf = NULL;
3584  mqi[0].hr = E_NOTIMPL;
3585  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3586  ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08x\n", hr);
3587  ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3588  ok(mqi[0].hr == REGDB_E_CLASSNOTREG, "got 0x%08x\n", mqi[0].hr);
3589 
3590  hr = CoRegisterClassObject(clsid, (IUnknown*)&getinstance_cf, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE,
3591  &cookie);
3592  ok(hr == S_OK, "got 0x%08x\n", hr);
3593 
3594  mqi[0].pIID = &IID_IUnknown;
3595  mqi[0].pItf = (void*)0xdeadbeef;
3596  mqi[0].hr = S_OK;
3597  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3598 todo_wine {
3599  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3600  ok(mqi[0].pItf == (void*)0xdeadbeef, "got %p\n", mqi[0].pItf);
3601 }
3602  ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
3603 
3604  mqi[0].pIID = &IID_IUnknown;
3605  mqi[0].pItf = (void*)0xdeadbeef;
3606  mqi[0].hr = E_NOTIMPL;
3607  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3608 todo_wine {
3609  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3610  ok(mqi[0].pItf == (void*)0xdeadbeef, "got %p\n", mqi[0].pItf);
3611  ok(mqi[0].hr == E_NOTIMPL, "got 0x%08x\n", mqi[0].hr);
3612 }
3613  mqi[0].pIID = &IID_IUnknown;
3614  mqi[0].pItf = NULL;
3615  mqi[0].hr = E_NOTIMPL;
3616  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3617  ok(hr == S_OK, "got 0x%08x\n", hr);
3618  ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3619  ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
3620 
3621  mqi[0].pIID = &IID_IUnknown;
3622  mqi[0].pItf = NULL;
3623  mqi[0].hr = S_OK;
3624  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3625  ok(hr == S_OK, "got 0x%08x\n", hr);
3626  ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3627  ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
3628 
3629  mqi[0].pIID = &IID_IUnknown;
3630  mqi[0].pItf = NULL;
3631  mqi[0].hr = S_OK;
3633  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3634  ok(hr == S_OK, "got 0x%08x\n", hr);
3635  ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3636  ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
3638 
3639  mqi[0].pIID = &IID_IUnknown;
3640  mqi[0].pItf = NULL;
3641  mqi[0].hr = S_OK;
3642  mqi[1].pIID = &IID_IUnknown;
3643  mqi[1].pItf = NULL;
3644  mqi[1].hr = S_OK;
3645  g_persistfile_qi_ret = 0x8000efef;
3646  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 2, mqi);
3647  ok(hr == 0x8000efef, "got 0x%08x\n", hr);
3648  ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3649  ok(mqi[0].hr == 0x8000efef, "got 0x%08x\n", mqi[0].hr);
3650  ok(mqi[1].pItf == NULL, "got %p\n", mqi[1].pItf);
3651  ok(mqi[1].hr == 0x8000efef, "got 0x%08x\n", mqi[1].hr);
3653 
3654  mqi[0].pIID = &IID_IUnknown;
3655  mqi[0].pItf = NULL;
3656  mqi[0].hr = S_OK;
3657  mqi[1].pIID = &IID_IUnknown;
3658  mqi[1].pItf = NULL;
3659  mqi[1].hr = S_OK;
3660  g_persistfile_load_ret = 0x8000fefe;
3661  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 2, mqi);
3662  ok(hr == 0x8000fefe, "got 0x%08x\n", hr);
3663  ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3664  ok(mqi[0].hr == 0x8000fefe, "got 0x%08x\n", mqi[0].hr);
3665  ok(mqi[1].pItf == NULL, "got %p\n", mqi[1].pItf);
3666  ok(mqi[1].hr == 0x8000fefe, "got 0x%08x\n", mqi[1].hr);
3668 
3669  hr = CoRevokeClassObject(cookie);
3670  ok(hr == S_OK, "got 0x%08x\n", hr);
3671 
3672  CoUninitialize();
3673 }
WCHAR OLECHAR
Definition: compat.h:1926
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
__wchar_t WCHAR
Definition: xmlstorage.h:180
static IClassFactory getinstance_cf
Definition: compobj.c:3558
static HRESULT g_persistfile_load_ret
Definition: compobj.c:3427
DWORD DWORD
Definition: winlogon.h:75
static const WCHAR filenameW[]
Definition: amstream.c:41
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1089
#define ok(value,...)
Definition: CComObject.cpp:34
#define STGM_READ
Definition: objbase.h:916
#define MK_E_CANTOPENFILE
Definition: winerror.h:2791
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:84
#define todo_wine
Definition: test.h:154
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2809
#define S_OK
Definition: intsafe.h:59
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
#define E_NOTIMPL
Definition: ddrawi.h:99
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetInstanceFromFile(COSERVERINFO *server_info, CLSID *rclsid, IUnknown *outer, DWORD cls_context, DWORD grfmode, OLECHAR *filename, DWORD count, MULTI_QI *results)
Definition: compobj.c:3380
static HRESULT g_persistfile_qi_ret
Definition: compobj.c:3426
static void test_CoGetInterfaceAndReleaseStream ( void  )
static

Definition at line 1364 of file compobj.c.

Referenced by START_TEST().

1365 {
1366  HRESULT hr;
1367  IUnknown *pUnk;
1368 
1369  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1370 
1371  hr = CoGetInterfaceAndReleaseStream(NULL, &IID_IUnknown, (void**)&pUnk);
1372  ok(hr == E_INVALIDARG, "hr %08x\n", hr);
1373 
1374  CoUninitialize();
1375 }
const GUID IID_IUnknown
HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1989
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
static void test_CoGetMalloc ( void  )
static

Definition at line 3039 of file compobj.c.

Referenced by START_TEST().

3040 {
3041  IMalloc *imalloc;
3042  HRESULT hr;
3043 
3044  if (0) /* crashes on native */
3045  hr = CoGetMalloc(0, NULL);
3046 
3047  imalloc = (void*)0xdeadbeef;
3048  hr = CoGetMalloc(0, &imalloc);
3049  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3050  ok(imalloc == NULL, "got %p\n", imalloc);
3051 
3052  imalloc = (void*)0xdeadbeef;
3053  hr = CoGetMalloc(MEMCTX_SHARED, &imalloc);
3054  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3055  ok(imalloc == NULL, "got %p\n", imalloc);
3056 
3057  imalloc = (void*)0xdeadbeef;
3058  hr = CoGetMalloc(MEMCTX_MACSYSTEM, &imalloc);
3059  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3060  ok(imalloc == NULL, "got %p\n", imalloc);
3061 
3062  imalloc = (void*)0xdeadbeef;
3063  hr = CoGetMalloc(MEMCTX_UNKNOWN, &imalloc);
3064  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3065  ok(imalloc == NULL, "got %p\n", imalloc);
3066 
3067  imalloc = (void*)0xdeadbeef;
3068  hr = CoGetMalloc(MEMCTX_SAME, &imalloc);
3069  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3070  ok(imalloc == NULL, "got %p\n", imalloc);
3071 
3072  imalloc = NULL;
3073  hr = CoGetMalloc(MEMCTX_TASK, &imalloc);
3074  ok(hr == S_OK, "got 0x%08x\n", hr);
3075  ok(imalloc != NULL, "got %p\n", imalloc);
3076  IMalloc_Release(imalloc);
3077 }
HRESULT WINAPI CoGetMalloc(DWORD context, IMalloc **imalloc)
Definition: ifs.c:383
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
static void test_CoGetObjectContext ( void  )
static

Definition at line 1780 of file compobj.c.

Referenced by START_TEST().

1781 {
1782  HRESULT hr;
1783  ULONG refs;
1784  IComThreadingInfo *pComThreadingInfo, *threadinginfo2;
1785  IContextCallback *pContextCallback;
1786  IObjContext *pObjContext;
1787  APTTYPE apttype;
1788  THDTYPE thdtype;
1789  GUID id, id2;
1790 
1791  if (!pCoGetObjectContext)
1792  {
1793  win_skip("CoGetObjectContext not present\n");
1794  return;
1795  }
1796 
1797  hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1798  ok(hr == CO_E_NOTINITIALIZED, "CoGetObjectContext should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
1799  ok(pComThreadingInfo == NULL, "pComThreadingInfo should have been set to NULL\n");
1800 
1801  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1802 
1804 
1805  hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1806  ok_ole_success(hr, "CoGetObjectContext");
1807 
1808  threadinginfo2 = NULL;
1809  hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&threadinginfo2);
1810  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
1811  ok(pComThreadingInfo == threadinginfo2, "got different instance\n");
1812  IComThreadingInfo_Release(threadinginfo2);
1813 
1814  hr = IComThreadingInfo_GetCurrentLogicalThreadId(pComThreadingInfo, NULL);
1815  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
1816 
1817  id = id2 = GUID_NULL;
1818  hr = IComThreadingInfo_GetCurrentLogicalThreadId(pComThreadingInfo, &id);
1819  ok(hr == S_OK, "got 0x%08x\n", hr);
1820 
1821  hr = CoGetCurrentLogicalThreadId(&id2);
1822  ok(IsEqualGUID(&id, &id2), "got %s, expected %s\n", wine_dbgstr_guid(&id), wine_dbgstr_guid(&id2));
1823 
1824  hr = IComThreadingInfo_GetCurrentApartmentType(pComThreadingInfo, &apttype);
1825  ok_ole_success(hr, "IComThreadingInfo_GetCurrentApartmentType");
1826  ok(apttype == APTTYPE_MAINSTA, "apartment type should be APTTYPE_MAINSTA instead of %d\n", apttype);
1827 
1828  hr = IComThreadingInfo_GetCurrentThreadType(pComThreadingInfo, &thdtype);
1829  ok_ole_success(hr, "IComThreadingInfo_GetCurrentThreadType");
1830  ok(thdtype == THDTYPE_PROCESSMESSAGES, "thread type should be THDTYPE_PROCESSMESSAGES instead of %d\n", thdtype);
1831 
1832  refs = IComThreadingInfo_Release(pComThreadingInfo);
1833  ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %d refs\n", refs);
1834 
1835  hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
1836  ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
1837 
1838  refs = IContextCallback_Release(pContextCallback);
1839  ok(refs == 0, "pContextCallback should have 0 refs instead of %d refs\n", refs);
1840 
1841  CoUninitialize();
1842 
1843  pCoInitializeEx(NULL, COINIT_MULTITHREADED);
1844 
1845  hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1846  ok_ole_success(hr, "CoGetObjectContext");
1847 
1848  hr = IComThreadingInfo_GetCurrentApartmentType(pComThreadingInfo, &apttype);
1849  ok_ole_success(hr, "IComThreadingInfo_GetCurrentApartmentType");
1850  ok(apttype == APTTYPE_MTA, "apartment type should be APTTYPE_MTA instead of %d\n", apttype);
1851 
1852  hr = IComThreadingInfo_GetCurrentThreadType(pComThreadingInfo, &thdtype);
1853  ok_ole_success(hr, "IComThreadingInfo_GetCurrentThreadType");
1854  ok(thdtype == THDTYPE_BLOCKMESSAGES, "thread type should be THDTYPE_BLOCKMESSAGES instead of %d\n", thdtype);
1855 
1856  refs = IComThreadingInfo_Release(pComThreadingInfo);
1857  ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %d refs\n", refs);
1858 
1859  hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
1860  ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
1861 
1862  refs = IContextCallback_Release(pContextCallback);
1863  ok(refs == 0, "pContextCallback should have 0 refs instead of %d refs\n", refs);
1864 
1865  hr = pCoGetObjectContext(&IID_IObjContext, (void **)&pObjContext);
1866  ok_ole_success(hr, "CoGetObjectContext");
1867 
1868  refs = IObjContext_Release(pObjContext);
1869  ok(refs == 0, "pObjContext should have 0 refs instead of %d refs\n", refs);
1870 
1871  CoUninitialize();
1872 }
#define test_apt_type(t, q)
Definition: compobj.c:611
const char * wine_dbgstr_guid(const GUID *guid)
#define ok_ole_success(hr, func)
Definition: compobj.c:90
#define CO_E_NOTINITIALIZED
HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *id)
Definition: compobj.c:3924
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
enum _THDTYPE THDTYPE
#define GUID_NULL
Definition: ks.h:106
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4024
unsigned int ULONG
Definition: retypes.h:1
GLenum GLuint id
Definition: glext.h:5579
#define win_skip
Definition: test.h:141
static void test_CoGetPSClsid ( void  )
static

Definition at line 1192 of file compobj.c.

Referenced by START_TEST().

1193 {
1194  ULONG_PTR cookie;
1195  HANDLE handle;
1196  HRESULT hr;
1197  CLSID clsid;
1198  HKEY hkey;
1199  LONG res;
1200  const BOOL is_win64 = (sizeof(void*) != sizeof(int));
1201  BOOL is_wow64 = FALSE;
1202 
1203  hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
1204  ok(hr == CO_E_NOTINITIALIZED,
1205  "CoGetPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n",
1206  hr);
1207 
1208  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1209 
1210  hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
1211  ok_ole_success(hr, "CoGetPSClsid");
1212 
1213  hr = CoGetPSClsid(&IID_IWineTest, &clsid);
1214  ok(hr == REGDB_E_IIDNOTREG,
1215  "CoGetPSClsid for random IID returned 0x%08x instead of REGDB_E_IIDNOTREG\n",
1216  hr);
1217 
1219  ok(hr == E_INVALIDARG,
1220  "CoGetPSClsid for null clsid returned 0x%08x instead of E_INVALIDARG\n",
1221  hr);
1222 
1223  if (!pRegOverridePredefKey)
1224  {
1225  win_skip("RegOverridePredefKey not available\n");
1226  CoUninitialize();
1227  return;
1228  }
1229  hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
1230  ok_ole_success(hr, "CoGetPSClsid");
1231 
1232  res = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0,
1233  KEY_ALL_ACCESS, NULL, &hkey, NULL);
1234  ok(!res, "RegCreateKeyEx returned %d\n", res);
1235 
1236  res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
1237  ok(!res, "RegOverridePredefKey returned %d\n", res);
1238 
1239  hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
1240  ok_ole_success(hr, "CoGetPSClsid");
1241 
1242  res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
1243  ok(!res, "RegOverridePredefKey returned %d\n", res);
1244 
1245  RegCloseKey(hkey);
1246 
1247  /* not registered CLSID */
1248  hr = CoGetPSClsid(&IID_Testiface, &clsid);
1249  ok(hr == REGDB_E_IIDNOTREG, "got 0x%08x\n", hr);
1250 
1251  if ((handle = activate_context(actctx_manifest, &cookie)))
1252  {
1253  memset(&clsid, 0, sizeof(clsid));
1254  hr = CoGetPSClsid(&IID_Testiface, &clsid);
1255  ok(hr == S_OK, "got 0x%08x\n", hr);
1256  ok(IsEqualGUID(&clsid, &IID_Testiface), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1257 
1258  memset(&clsid, 0, sizeof(clsid));
1259  hr = CoGetPSClsid(&IID_Testiface2, &clsid);
1260  ok(hr == S_OK, "got 0x%08x\n", hr);
1261  ok(IsEqualGUID(&clsid, &IID_Testiface2), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1262 
1263  memset(&clsid, 0, sizeof(clsid));
1264  hr = CoGetPSClsid(&IID_Testiface3, &clsid);
1265  ok(hr == S_OK, "got 0x%08x\n", hr);
1266  ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1267 
1268  memset(&clsid, 0xaa, sizeof(clsid));
1269  hr = CoGetPSClsid(&IID_Testiface4, &clsid);
1270  ok(hr == S_OK, "got 0x%08x\n", hr);
1271  ok(IsEqualGUID(&clsid, &GUID_NULL), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1272 
1273  /* register same interface and try to get CLSID back */
1275  ok(hr == S_OK, "got 0x%08x\n", hr);
1276  memset(&clsid, 0, sizeof(clsid));
1277  hr = CoGetPSClsid(&IID_Testiface, &clsid);
1278  ok(hr == S_OK, "got 0x%08x\n", hr);
1279  ok(IsEqualGUID(&clsid, &IID_Testiface4), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1280 
1281  pDeactivateActCtx(0, cookie);
1282  pReleaseActCtx(handle);
1283  }
1284 
1285  if (pRegDeleteKeyExA &&
1286  (is_win64 ||
1287  (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64)))
1288  {
1289  static GUID IID_DeadBeef = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}};
1290  static const char clsidDeadBeef[] = "{deadbeef-dead-beef-dead-beefdeadbeef}";
1291  static const char clsidA[] = "{66666666-8888-7777-6666-555555555555}";
1292  HKEY hkey_iface, hkey_psclsid;
1293  REGSAM opposite = is_win64 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY;
1294 
1295  hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
1296  ok(hr == REGDB_E_IIDNOTREG, "got 0x%08x\n", hr);
1297 
1298  res = RegCreateKeyExA(HKEY_CLASSES_ROOT, "Interface",
1299  0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_iface, NULL);
1300  ok(!res, "RegCreateKeyEx returned %d\n", res);
1301  res = RegCreateKeyExA(hkey_iface, clsidDeadBeef,
1302  0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey, NULL);
1303  if (res == ERROR_ACCESS_DENIED)
1304  {
1305  win_skip("Failed to create a key, skipping some of CoGetPSClsid() tests\n");
1306  goto cleanup;
1307  }
1308 
1309  ok(!res, "RegCreateKeyEx returned %d\n", res);
1310  res = RegCreateKeyExA(hkey, "ProxyStubClsid32",
1311  0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_psclsid, NULL);
1312  ok(!res, "RegCreateKeyEx returned %d\n", res);
1313  res = RegSetValueExA(hkey_psclsid, NULL, 0, REG_SZ, (const BYTE *)clsidA, strlen(clsidA)+1);
1314  ok(!res, "RegSetValueEx returned %d\n", res);
1315  RegCloseKey(hkey_psclsid);
1316 
1317  hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
1318  ok_ole_success(hr, "CoGetPSClsid");
1319  ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1320 
1321  res = pRegDeleteKeyExA(hkey, "ProxyStubClsid32", opposite, 0);
1322  ok(!res, "RegDeleteKeyEx returned %d\n", res);
1323  RegCloseKey(hkey);
1324  res = pRegDeleteKeyExA(hkey_iface, clsidDeadBeef, opposite, 0);
1325  ok(!res, "RegDeleteKeyEx returned %d\n", res);
1326 
1327  cleanup:
1328  RegCloseKey(hkey_iface);
1329  }
1330 
1331  CoUninitialize();
1332 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define REGDB_E_IIDNOTREG
Definition: winerror.h:2697
const char * wine_dbgstr_guid(const GUID *guid)
HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid)
Definition: compobj.c:2690
#define ok_ole_success(hr, func)
Definition: compobj.c:90
#define CO_E_NOTINITIALIZED
const GUID IID_IClassFactory
uint32_t ULONG_PTR
Definition: typedefs.h:63
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
long LONG
Definition: pedump.c:60
#define E_INVALIDARG
Definition: ddrawi.h:101
static const BOOL is_win64
Definition: shellpath.c:54
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
Definition: compobj.c:2602
#define ok(value,...)
Definition: CComObject.cpp:34
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG HRESULT
Definition: typedefs.h:77
HANDLE HKEY
Definition: registry.h:24
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1195
static BOOL is_wow64
Definition: loader.c:55
REFCLSID clsid
Definition: msctf.c:84
static const char actctx_manifest[]
Definition: compobj.c:266
static const GUID IID_Testiface3
Definition: compobj.c:98
#define GUID_NULL
Definition: ks.h:106
unsigned char BYTE
Definition: ntddk_ex.h:96
static const GUID IID_Testiface2
Definition: compobj.c:97
static const GUID IID_TestPS
Definition: compobj.c:102
static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
Definition: compobj.c:220
#define S_OK
Definition: intsafe.h:59
DWORD *typedef HANDLE
Definition: winlogon.h:52
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
ACCESS_MASK REGSAM
Definition: winreg.h:69
static const IID IID_IWineTest
Definition: marshal.c:80
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4024
GLuint res
Definition: glext.h:9613
char * cleanup(char *str)
Definition: wpickclick.c:99
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4831
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1032
static const GUID IID_Testiface4
Definition: compobj.c:99
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141
static const GUID IID_Testiface
Definition: compobj.c:96
#define REG_SZ
Definition: layer.c:22
static void test_CoInitializeEx ( void  )
static

Definition at line 2142 of file compobj.c.

Referenced by START_TEST().

2143 {
2144  HRESULT hr;
2145 
2146  hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
2147  ok(hr == S_OK, "CoInitializeEx failed with error 0x%08x\n", hr);
2148 
2149  /* Calling OleInitialize for the first time should yield S_OK even with
2150  * apartment already initialized by previous CoInitialize(Ex) calls. */
2151  hr = OleInitialize(NULL);
2152  ok(hr == S_OK, "OleInitialize failed with error 0x%08x\n", hr);
2153 
2154  /* Subsequent calls to OleInitialize should return S_FALSE */
2155  hr = OleInitialize(NULL);
2156  ok(hr == S_FALSE, "Expected S_FALSE, hr = 0x%08x\n", hr);
2157 
2158  /* Cleanup */
2159  CoUninitialize();
2160  OleUninitialize();
2161  OleUninitialize();
2162 }
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
static void test_CoMarshalInterface ( void  )
static

Definition at line 1378 of file compobj.c.

Referenced by START_TEST().

1379 {
1380  IStream *pStream;
1381  HRESULT hr;
1382  static const LARGE_INTEGER llZero;
1383 
1384  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1385 
1386  hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
1387  ok_ole_success(hr, "CreateStreamOnHGlobal");
1388 
1389  hr = CoMarshalInterface(pStream, &IID_IUnknown, NULL, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1390  ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1391 
1392  hr = CoMarshalInterface(NULL, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1393  ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1394 
1395  hr = CoMarshalInterface(pStream, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1396  ok_ole_success(hr, "CoMarshalInterface");
1397 
1398  /* stream not rewound */
1399  hr = CoReleaseMarshalData(pStream);
1400  ok(hr == STG_E_READFAULT, "CoReleaseMarshalData should have returned STG_E_READFAULT instead of 0x%08x\n", hr);
1401 
1402  hr = IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
1403  ok_ole_success(hr, "IStream_Seek");
1404 
1405  hr = CoReleaseMarshalData(pStream);
1406  ok_ole_success(hr, "CoReleaseMarshalData");
1407 
1408  IStream_Release(pStream);
1409 
1410  CoUninitialize();
1411 }
HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
Definition: marshal.c:1907
#define TRUE
Definition: types.h:120
static IClassFactory Test_ClassFactory
Definition: compobj.c:194
const GUID IID_IUnknown
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
#define ok_ole_success(hr, func)
Definition: compobj.c:90
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static const LARGE_INTEGER llZero
Definition: moniker.c:1113
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
#define STG_E_READFAULT
Definition: winerror.h:2576
HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:1724
static void test_CoMarshalInterThreadInterfaceInStream ( void  )
static

Definition at line 1413 of file compobj.c.

Referenced by START_TEST().

1414 {
1415  IStream *pStream;
1416  HRESULT hr;
1417  IClassFactory *pProxy;
1418 
1419  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1420 
1421  cLocks = 0;
1422 
1424  ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1425 
1427  ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1428 
1429  ok_no_locks();
1430 
1432  ok_ole_success(hr, "CoMarshalInterThreadInterfaceInStream");
1433 
1435 
1436  hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
1437  ok_ole_success(hr, "CoUnmarshalInterface");
1438 
1439  IClassFactory_Release(pProxy);
1440  IStream_Release(pStream);
1441 
1442  ok_no_locks();
1443 
1444  CoUninitialize();
1445 }
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1838
static IClassFactory Test_ClassFactory
Definition: compobj.c:194
const GUID IID_IUnknown
static LONG cLocks
Definition: compobj.c:122
#define ok_ole_success(hr, func)
Definition: compobj.c:90
const GUID IID_IClassFactory
#define ok_more_than_one_lock()
Definition: compobj.c:91
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM *ppStm)
Definition: marshal.c:1945
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
#define ok_no_locks()
Definition: compobj.c:92
static void test_CoRegisterClassObject ( void  )
static

Definition at line 1447 of file compobj.c.

Referenced by START_TEST().

1448 {
1449  ULONG_PTR ctxcookie;
1450  HANDLE handle;
1451  DWORD cookie;
1452  HRESULT hr;
1453  IClassFactory *pcf;
1454 
1455  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1456 
1457  /* CLSCTX_INPROC_SERVER */
1459  CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1460  ok_ole_success(hr, "CoRegisterClassObject");
1461  hr = CoRevokeClassObject(cookie);
1462  ok_ole_success(hr, "CoRevokeClassObject");
1463 
1465  CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie);
1466  ok_ole_success(hr, "CoRegisterClassObject");
1467  hr = CoRevokeClassObject(cookie);
1468  ok_ole_success(hr, "CoRevokeClassObject");
1469 
1471  CLSCTX_INPROC_SERVER, REGCLS_MULTI_SEPARATE, &cookie);
1472  ok_ole_success(hr, "CoRegisterClassObject");
1473  hr = CoRevokeClassObject(cookie);
1474  ok_ole_success(hr, "CoRevokeClassObject");
1475 
1476  /* CLSCTX_LOCAL_SERVER */
1478  CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1479  ok_ole_success(hr, "CoRegisterClassObject");
1480  hr = CoRevokeClassObject(cookie);
1481  ok_ole_success(hr, "CoRevokeClassObject");
1482 
1484  CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &cookie);
1485  ok_ole_success(hr, "CoRegisterClassObject");
1486  hr = CoRevokeClassObject(cookie);
1487  ok_ole_success(hr, "CoRevokeClassObject");
1488 
1490  CLSCTX_LOCAL_SERVER, REGCLS_MULTI_SEPARATE, &cookie);
1491  ok_ole_success(hr, "CoRegisterClassObject");
1492  hr = CoRevokeClassObject(cookie);
1493  ok_ole_success(hr, "CoRevokeClassObject");
1494 
1495  /* CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER */
1497  CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1498  ok_ole_success(hr, "CoRegisterClassObject");
1499  hr = CoRevokeClassObject(cookie);
1500  ok_ole_success(hr, "CoRevokeClassObject");
1501 
1502  /* test whether an object that doesn't support IClassFactory can be
1503  * registered for CLSCTX_LOCAL_SERVER */
1505  CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1506  ok_ole_success(hr, "CoRegisterClassObject");
1507  hr = CoRevokeClassObject(cookie);
1508  ok_ole_success(hr, "CoRevokeClassObject");
1509 
1510  /* test whether registered class becomes invalid when apartment is destroyed */
1512  CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1513  ok_ole_success(hr, "CoRegisterClassObject");
1514 
1515  CoUninitialize();
1516  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1517 
1518  hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL,
1519  &IID_IClassFactory, (void **)&pcf);
1520  ok(hr == REGDB_E_CLASSNOTREG, "object registered in an apartment shouldn't accessible after it is destroyed\n");
1521 
1522  /* crashes with at least win9x DCOM! */
1523  if (0)
1524  CoRevokeClassObject(cookie);
1525 
1526  /* test that object is accessible */
1527  hr = CoRegisterClassObject(&CLSID_WineOOPTest, (IUnknown *)&Test_ClassFactory, CLSCTX_INPROC_SERVER,
1528  REGCLS_MULTIPLEUSE, &cookie);
1529  ok(hr == S_OK, "got 0x%08x\n", hr);
1530 
1531  hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1532  ok(hr == S_OK, "got 0x%08x\n", hr);
1533  IClassFactory_Release(pcf);
1534 
1535  /* context now contains CLSID_WineOOPTest, test if registered one could still be used */
1536  if ((handle = activate_context(actctx_manifest, &ctxcookie)))
1537  {
1538  hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1539 todo_wine
1540  ok(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND), "got 0x%08x\n", hr);
1541 
1542  pDeactivateActCtx(0, ctxcookie);
1543  pReleaseActCtx(handle);
1544  }
1545 
1546  hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1547  ok(hr == S_OK, "got 0x%08x\n", hr);
1548  IClassFactory_Release(pcf);
1549 
1550  hr = CoRevokeClassObject(cookie);
1551  ok(hr == S_OK, "got 0x%08x\n", hr);
1552 
1553  CoUninitialize();
1554 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
static IClassFactory Test_ClassFactory
Definition: compobj.c:194
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
static IUnknown Test_Unknown
Definition: compobj.c:903
#define ok_ole_success(hr, func)
Definition: compobj.c:90
DWORD DWORD
Definition: winlogon.h:75
const GUID IID_IClassFactory
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1089
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3015
#define ok(value,...)
Definition: CComObject.cpp:34
const CHARFORMATW * pcf
Definition: msvc.h:84
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:99
#define todo_wine
Definition: test.h:154
static const char actctx_manifest[]
Definition: compobj.c:266
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2809
static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
Definition: compobj.c:220
#define S_OK
Definition: intsafe.h:59
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
#define ERROR_MOD_NOT_FOUND
Definition: compat.h:94
static void test_CoRegisterMessageFilter ( void  )
static

Definition at line 863 of file compobj.c.

Referenced by START_TEST().

864 {
865  HRESULT hr;
866  IMessageFilter *prev_filter;
867 
868  hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
869  ok(hr == CO_E_NOT_SUPPORTED,
870  "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08x\n",
871  hr);
872 
873  pCoInitializeEx(NULL, COINIT_MULTITHREADED);
874  prev_filter = (IMessageFilter *)0xdeadbeef;
875  hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
876  ok(hr == CO_E_NOT_SUPPORTED,
877  "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08x\n",
878  hr);
879  ok(prev_filter == (IMessageFilter *)0xdeadbeef,
880  "prev_filter should have been set to %p\n", prev_filter);
881  CoUninitialize();
882 
883  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
884 
886  ok_ole_success(hr, "CoRegisterMessageFilter");
887 
888  prev_filter = (IMessageFilter *)0xdeadbeef;
889  hr = CoRegisterMessageFilter(NULL, &prev_filter);
890  ok_ole_success(hr, "CoRegisterMessageFilter");
891  ok(prev_filter == NULL, "prev_filter should have been set to NULL instead of %p\n", prev_filter);
892 
893  hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
894  ok_ole_success(hr, "CoRegisterMessageFilter");
895  ok(prev_filter == NULL, "prev_filter should have been set to NULL instead of %p\n", prev_filter);
896 
898  ok_ole_success(hr, "CoRegisterMessageFilter");
899 
900  CoUninitialize();
901 }
#define ok_ole_success(hr, func)
Definition: compobj.c:90
smooth NULL
Definition: ftsmooth.c:416
#define CO_E_NOT_SUPPORTED
Definition: winerror.h:2397
#define ok(value,...)
Definition: CComObject.cpp:34
static IMessageFilter MessageFilter
Definition: compobj.c:861
LONG HRESULT
Definition: typedefs.h:77
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
HRESULT WINAPI CoRegisterMessageFilter(LPMESSAGEFILTER lpMessageFilter, LPMESSAGEFILTER *lplpMessageFilter)
Definition: compobj.c:3958
static void test_CoRegisterPSClsid ( void  )
static

Definition at line 1089 of file compobj.c.

Referenced by START_TEST().

1090 {
1091  HRESULT hr;
1092  DWORD dwRegistrationKey;
1093  IStream *stream;
1094  CLSID clsid;
1095  HANDLE thread;
1096  DWORD tid;
1097 
1099  ok(hr == CO_E_NOTINITIALIZED, "CoRegisterPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
1100 
1101  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1102 
1104  CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &dwRegistrationKey);
1105  ok_ole_success(hr, "CoRegisterClassObject");
1106 
1108  ok_ole_success(hr, "CoRegisterPSClsid");
1109 
1110  hr = CoGetPSClsid(&IID_IWineTest, &clsid);
1111  ok_ole_success(hr, "CoGetPSClsid");
1112  ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1114 
1115  thread = CreateThread(NULL, 0, register_ps_clsid_thread, NULL, 0, &tid);
1116  ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
1117  ok(!WaitForSingleObject(thread, 10000), "wait timed out\n");
1118  CloseHandle(thread);
1119 
1120  hr = CoGetPSClsid(&IID_TestPS, &clsid);
1121  ok_ole_success(hr, "CoGetPSClsid");
1122  ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1124 
1125  hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
1126  ok_ole_success(hr, "CreateStreamOnHGlobal");
1127 
1128  SET_EXPECT(CreateStub);
1129  hr = CoMarshalInterface(stream, &IID_IWineTest, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1130  ok(hr == E_NOTIMPL, "CoMarshalInterface should have returned E_NOTIMPL instead of 0x%08x\n", hr);
1131  CHECK_CALLED(CreateStub);
1132 
1133  hr = CoGetPSClsid(&IID_IEnumOLEVERB, &clsid);
1134  ok_ole_success(hr, "CoGetPSClsid");
1135 
1136  hr = CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IPSFactoryBuffer, (void **)&ps_factory_buffer);
1137  ok_ole_success(hr, "CoGetClassObject");
1138 
1140  ok_ole_success(hr, "CoRegisterPSClsid");
1141 
1142  SET_EXPECT(CreateStub);
1143  hr = CoMarshalInterface(stream, &IID_IEnumOLEVERB, (IUnknown*)&EnumOLEVERB, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1144  ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08x\n", hr);
1145  CHECK_CALLED(CreateStub);
1146 
1147  hr = CoMarshalInterface(stream, &IID_IEnumOLEVERB, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1148  ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08x\n", hr);
1149 
1150  IStream_Release(stream);
1151  IPSFactoryBuffer_Release(ps_factory_buffer);
1153 
1154  hr = CoRevokeClassObject(dwRegistrationKey);
1155  ok_ole_success(hr, "CoRevokeClassObject");
1156 
1157  CoUninitialize();
1158 
1159  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1160 
1161  hr = CoGetPSClsid(&IID_IWineTest, &clsid);
1162  ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08x\n", hr);
1163 
1164  hr = CoGetPSClsid(&IID_TestPS, &clsid);
1165  ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08x\n", hr);
1166 
1167  CoUninitialize();
1168 
1169  pCoInitializeEx(NULL, COINIT_M