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

Go to the source code of this file.

Classes

struct  comclassredirect_data
 
struct  Test_CallContext
 
struct  oletlsdata
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define USE_COM_CONTEXT_DEF
 
#define DEFINE_EXPECT(func)    static BOOL expect_ ## func = FALSE; static unsigned int called_ ## func = 0
 
#define SET_EXPECT(func)    expect_ ## func = TRUE
 
#define CHECK_EXPECT2(func)
 
#define CHECK_EXPECT(func)
 
#define CHECK_CALLED(func, n)
 
#define ok_ole_success(hr, func)   ok(hr == S_OK, func " failed with error %#08lx\n", hr)
 
#define ok_more_than_one_lock()   ok(cLocks > 0, "Number of locks should be > 0, but actually is %ld\n", cLocks)
 
#define ok_no_locks()   ok(cLocks == 0, "Number of locks should be 0, but actually is %ld\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)
 

Enumerations

enum  oletlsflags { OLETLS_UUIDINITIALIZED = 0x2 , OLETLS_DISABLE_OLE1DDE = 0x40 , OLETLS_APARTMENTTHREADED = 0x80 , OLETLS_MULTITHREADED = 0x100 }
 

Functions

 DEFINE_EXPECT (CreateStub)
 
 DEFINE_EXPECT (PreInitialize)
 
 DEFINE_EXPECT (PostInitialize)
 
 DEFINE_EXPECT (PreUninitialize)
 
 DEFINE_EXPECT (PostUninitialize)
 
static HRESULT (WINAPI *pCoGetObjectContext)(REFIID riid
 
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY
 
static BOOL (WINAPI *pIsWow64Process)(HANDLE
 
 DEFINE_GUID (CLSID_testclsid, 0xacd014c7, 0x9535, 0x4fac, 0x8b, 0x53, 0xa4, 0x8c, 0xa7, 0xf4, 0xd7, 0x26)
 
 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 void extract_resource (const char *name, const char *type, const char *path)
 
static HANDLE activate_context (const char *manifest, ULONG_PTR *cookie)
 
static void deactivate_context (HANDLE handle, 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 DWORD WINAPI test_init_spies_proc (void *arg)
 
static void test_IInitializeSpy (BOOL mt)
 
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)
 
static DWORD WINAPI co_get_current_process_thread (void *param)
 
static void test_CoGetCurrentProcess (void)
 
static void test_mta_usage (void)
 
static void test_CoCreateInstanceFromApp (void)
 
static void test_call_cancellation (void)
 
static DWORD get_oletlsflags (void)
 
static DWORD CALLBACK oletlsdata_test_thread (void *arg)
 
static void test_oletlsdata (void)
 
 START_TEST (compobj)
 

Variables

static LPVOIDppv
 
static IUnknown ** ppOldObject
 
static APTTYPEQUALIFIERqualifier
 
static LPCSTR
 
static REGSAM
 
static DWORD
 
static HKEY override
 
static IUnknownouter
 
static IUnknown DWORD clscontext
 
static IUnknown DWORD voidreserved
 
static IUnknown DWORD void DWORD count
 
static IUnknown DWORD void DWORD MULTI_QI * results
 
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_Testiface7 = { 0x82222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
 
static const GUID IID_Testiface8 = { 0x92222222, 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 char testlib [MAX_PATH]
 
static const char actctx_manifest []
 
static const char actctx_manifest2 []
 
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 DWORD expected_coinit_flags
 
static ULARGE_INTEGER init_cookies [3]
 
static BOOL revoke_spies_on_uninit
 
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

◆ CHECK_CALLED

#define CHECK_CALLED (   func,
  n 
)
Value:
do { \
ok(called_ ## func == n, "expected " #func " called %u times, got %u\n", n, called_ ## func); \
expect_ ## func = FALSE; \
called_ ## func = 0; \
}while(0)
#define FALSE
Definition: types.h:117
GLenum func
Definition: glext.h:6028
GLdouble n
Definition: glext.h:7729
#define expect_(expected, got, precision)
Definition: font.c:29

Definition at line 60 of file compobj.c.

◆ CHECK_EXPECT

#define CHECK_EXPECT (   func)
Value:
do { \
CHECK_EXPECT2(func); \
expect_ ## func = FALSE; \
}while(0)

Definition at line 54 of file compobj.c.

◆ CHECK_EXPECT2

#define CHECK_EXPECT2 (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func++; \
}while(0)

Definition at line 48 of file compobj.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file compobj.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 22 of file compobj.c.

◆ cowait_msgs_expect_empty

#define cowait_msgs_expect_empty ( )    _cowait_msgs_expect_empty(__LINE__)

Definition at line 2623 of file compobj.c.

◆ cowait_msgs_expect_notified

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

Definition at line 2633 of file compobj.c.

◆ cowait_msgs_expect_queued

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

Definition at line 2646 of file compobj.c.

◆ DEFINE_EXPECT

#define DEFINE_EXPECT (   func)     static BOOL expect_ ## func = FALSE; static unsigned int called_ ## func = 0

Definition at line 42 of file compobj.c.

◆ ok_more_than_one_lock

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

Definition at line 88 of file compobj.c.

◆ ok_no_locks

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

Definition at line 89 of file compobj.c.

◆ ok_ole_success

#define ok_ole_success (   hr,
  func 
)    ok(hr == S_OK, func " failed with error %#08lx\n", hr)

Definition at line 87 of file compobj.c.

◆ SET_EXPECT

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

Definition at line 45 of file compobj.c.

◆ test_apt_type

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

Definition at line 663 of file compobj.c.

◆ USE_COM_CONTEXT_DEF

#define USE_COM_CONTEXT_DEF

Definition at line 29 of file compobj.c.

Enumeration Type Documentation

◆ oletlsflags

Enumerator
OLETLS_UUIDINITIALIZED 
OLETLS_DISABLE_OLE1DDE 
OLETLS_APARTMENTTHREADED 
OLETLS_MULTITHREADED 

Definition at line 4281 of file compobj.c.

4282{
4286 OLETLS_MULTITHREADED = 0x100,
4287};
@ OLETLS_DISABLE_OLE1DDE
Definition: compobj.c:4284
@ OLETLS_APARTMENTTHREADED
Definition: compobj.c:4285
@ OLETLS_MULTITHREADED
Definition: compobj.c:4286
@ OLETLS_UUIDINITIALIZED
Definition: compobj.c:4283

Function Documentation

◆ _cowait_msgs_expect_empty()

static void _cowait_msgs_expect_empty ( unsigned  line)
static

Definition at line 2624 of file compobj.c.

2625{
2627 ok_(__FILE__,line)(0, "unexpected message %u\n", cowait_msgs[cowait_msgs_first]);
2629 }
2631}
#define ok_(x1, x2)
Definition: atltest.h:61
static void cowait_msgs_reset(void)
Definition: compobj.c:2618
static UINT cowait_msgs[100]
Definition: compobj.c:2616
static UINT cowait_msgs_first
Definition: compobj.c:2616
static UINT cowait_msgs_last
Definition: compobj.c:2616
Definition: parser.c:49

◆ _cowait_msgs_expect_notified()

static void _cowait_msgs_expect_notified ( unsigned  line,
UINT  expected_msg 
)
static

Definition at line 2634 of file compobj.c.

2635{
2637 ok_(__FILE__,line)(0, "expected message %u, received none\n", expected_msg);
2638 }else {
2639 ok_(__FILE__,line)(cowait_msgs[cowait_msgs_first] == expected_msg,
2640 "expected message %u, received %u \n",
2641 expected_msg, cowait_msgs[cowait_msgs_first]);
2643 }
2644}

◆ _cowait_msgs_expect_queued()

static void _cowait_msgs_expect_queued ( unsigned  line,
HWND  hwnd,
UINT  expected_msg 
)
static

Definition at line 2647 of file compobj.c.

2648{
2649 MSG msg;
2650 BOOL success;
2651
2652 success = PeekMessageA(&msg, hwnd, expected_msg, expected_msg, PM_REMOVE);
2653 ok_(__FILE__,line)(success, "PeekMessageA failed: %lu\n", GetLastError());
2654 if(success)
2655 ok_(__FILE__,line)(msg.message == expected_msg, "unexpected message %u, expected %u\n",
2656 msg.message, expected_msg);
2657}
#define msg(x)
Definition: auth_time.c:54
unsigned int BOOL
Definition: ntddk_ex.h:94
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define success(from, fromstr, to, tostr)
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define PM_REMOVE
Definition: winuser.h:1207
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)

◆ _test_apt_type()

static void _test_apt_type ( APTTYPE  expected_type,
APTTYPEQUALIFIER  expected_qualifier,
int  line 
)
static

Definition at line 664 of file compobj.c.

665{
667 APTTYPE type = ~0u;
668 HRESULT hr;
669
670 if (!pCoGetApartmentType)
671 return;
672
673 hr = pCoGetApartmentType(&type, &qualifier);
674 ok_(__FILE__, line)(hr == S_OK || (type == APTTYPE_CURRENT && hr == CO_E_NOTINITIALIZED),
675 "Unexpected hr %#lx.\n", hr);
676 ok_(__FILE__, line)(type == expected_type, "Wrong apartment type %d, expected %d\n", type, expected_type);
677 ok_(__FILE__, line)(qualifier == expected_qualifier, "Wrong apartment qualifier %d, expected %d\n", qualifier,
678 expected_qualifier);
679}
#define CO_E_NOTINITIALIZED
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define S_OK
Definition: intsafe.h:52
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:77
enum _APTTYPEQUALIFIER APTTYPEQUALIFIER
HRESULT hr
Definition: shlfolder.c:183

◆ activate_context()

static HANDLE activate_context ( const char manifest,
ULONG_PTR cookie 
)
static

Definition at line 237 of file compobj.c.

238{
240 ACTCTXW actctx;
242 BOOL ret;
243
244 create_manifest_file("file.manifest", manifest);
245
246 MultiByteToWideChar( CP_ACP, 0, "file.manifest", -1, path, MAX_PATH );
247 memset(&actctx, 0, sizeof(ACTCTXW));
248 actctx.cbSize = sizeof(ACTCTXW);
249 actctx.lpSource = path;
250
252 ok(handle != INVALID_HANDLE_VALUE || broken(handle == INVALID_HANDLE_VALUE) /* some old XP/2k3 versions */,
253 "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
255 {
256 win_skip("activation context generation failed, some tests will be skipped. Error %ld\n", GetLastError());
257 handle = NULL;
258 }
259
260 ok(actctx.cbSize == sizeof(ACTCTXW), "actctx.cbSize=%ld\n", actctx.cbSize);
261 ok(actctx.dwFlags == 0, "actctx.dwFlags=%ld\n", actctx.dwFlags);
262 ok(actctx.lpSource == path, "actctx.lpSource=%p\n", actctx.lpSource);
263 ok(actctx.wProcessorArchitecture == 0, "actctx.wProcessorArchitecture=%d\n", actctx.wProcessorArchitecture);
264 ok(actctx.wLangId == 0, "actctx.wLangId=%d\n", actctx.wLangId);
265 ok(actctx.lpAssemblyDirectory == NULL, "actctx.lpAssemblyDirectory=%p\n", actctx.lpAssemblyDirectory);
266 ok(actctx.lpResourceName == NULL, "actctx.lpResourceName=%p\n", actctx.lpResourceName);
267 ok(actctx.lpApplicationName == NULL, "actctx.lpApplicationName=%p\n", actctx.lpApplicationName);
268 ok(actctx.hModule == NULL, "actctx.hModule=%p\n", actctx.hModule);
269
270 DeleteFileA("file.manifest");
271
272 if (handle)
273 {
275 ok(ret, "ActivateActCtx failed: %lu\n", GetLastError());
276 }
277
278 return handle;
279}
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define MultiByteToWideChar
Definition: compat.h:110
BOOL WINAPI ActivateActCtx(IN HANDLE hActCtx, OUT PULONG_PTR ulCookie)
Definition: actctx.c:237
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
HANDLE WINAPI CreateActCtxW(PCACTCTXW pActCtx)
Definition: actctx.c:102
return ret
Definition: mutex.c:146
#define actctx
Definition: kernel32.h:8
#define win_skip
Definition: minitest.h:67
static BOOL create_manifest_file(const char *filename, const char *manifest)
Definition: compobj.c:195
#define memset(x, y, z)
Definition: compat.h:39
Definition: cookie.c:34
static const CHAR manifest[]
Definition: v6util.h:41
__wchar_t WCHAR
Definition: xmlstorage.h:180

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

◆ apc_test_proc()

static void CALLBACK apc_test_proc ( ULONG_PTR  param)
static

Definition at line 2578 of file compobj.c.

2579{
2580 /* nothing */
2581}

Referenced by test_CoWaitForMultipleHandles().

◆ BOOL()

static BOOL ( WINAPI pIsWow64Process)
static

◆ co_get_current_process_thread()

static DWORD WINAPI co_get_current_process_thread ( void param)
static

Definition at line 4042 of file compobj.c.

4043{
4044 DWORD *id = param;
4045
4046 *id = CoGetCurrentProcess();
4047 return 0;
4048}
DWORD WINAPI CoGetCurrentProcess(void)
Definition: combase.c:2739
unsigned long DWORD
Definition: ntddk_ex.h:95
GLfloat param
Definition: glext.h:5796

Referenced by test_CoGetCurrentProcess().

◆ cowait_msgs_reset()

static void cowait_msgs_reset ( void  )
static

Definition at line 2618 of file compobj.c.

2619{
2621}

Referenced by _cowait_msgs_expect_empty(), and test_CoWaitForMultipleHandles().

◆ cowait_unmarshal_thread()

static DWORD CALLBACK cowait_unmarshal_thread ( void arg)
static

Definition at line 2674 of file compobj.c.

2675{
2676 IStream *stream = arg;
2677 IEnumOLEVERB *enum_verb;
2679 IUnknown *unk;
2680 HRESULT hr;
2681
2683
2684 zero.QuadPart = 0;
2685 hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
2686 ok(hr == S_OK, "Seek failed: %08lx\n", hr);
2687
2688 hr = CoUnmarshalInterface(stream, &IID_IUnknown, (void**)&unk);
2689 ok(hr == S_OK, "CoUnmarshalInterface failed: %08lx\n", hr);
2690
2691 hr = IUnknown_QueryInterface(unk, &IID_IEnumOLEVERB, (void**)&enum_verb);
2692 ok(hr == S_OK, "QueryInterface failed: %08lx\n", hr);
2693
2694 IEnumOLEVERB_Release(enum_verb);
2695 IUnknown_Release(unk);
2696
2698 return 0;
2699}
const GUID IID_IUnknown
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI CoUnmarshalInterface(IStream *stream, REFIID riid, void **ppv)
Definition: marshal.c:793
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
const GUID IID_IEnumOLEVERB
int zero
Definition: sehframes.cpp:29
Definition: parse.h:23
void * arg
Definition: msvc.h:10

Referenced by test_CoWaitForMultipleHandles_thread().

◆ cowait_window_proc()

static LRESULT CALLBACK cowait_window_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 2665 of file compobj.c.

2666{
2669 if(msg == WM_DDE_FIRST)
2670 return 6;
2671 return DefWindowProcA(hwnd, msg, wparam, lparam);
2672}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define ARRAY_SIZE(A)
Definition: main.h:20
#define WM_DDE_FIRST
Definition: dde.h:47
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_CoWaitForMultipleHandles().

◆ create_manifest_file()

static BOOL create_manifest_file ( const char filename,
const char manifest 
)
static

Definition at line 195 of file compobj.c.

196{
197 int manifest_len;
198 DWORD size;
199 HANDLE file;
201
204
205 manifest_len = strlen(manifest);
208 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
210 return FALSE;
211 WriteFile(file, manifest, manifest_len, &size, NULL);
213
214 return TRUE;
215}
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:739
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
GLsizeiptr size
Definition: glext.h:5919
const char * filename
Definition: ioapi.h:137
#define CREATE_ALWAYS
Definition: disk.h:72
static WCHAR manifest_path[MAX_PATH]
Definition: compobj.c:193
#define GENERIC_WRITE
Definition: nt_native.h:90
Definition: fci.c:127

Referenced by activate_context().

◆ deactivate_context()

static void deactivate_context ( HANDLE  handle,
ULONG_PTR  cookie 
)
static

Definition at line 281 of file compobj.c.

282{
283 BOOL ret;
284
286 ok(ret, "Failed to deactivate context, error %ld.\n", GetLastError());
288}
VOID WINAPI ReleaseActCtx(IN HANDLE hActCtx)
Definition: actctx.c:208
BOOL WINAPI DeactivateActCtx(IN DWORD dwFlags, IN ULONG_PTR ulCookie)
Definition: actctx.c:268

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

◆ DEFINE_EXPECT() [1/5]

DEFINE_EXPECT ( CreateStub  )

◆ DEFINE_EXPECT() [2/5]

DEFINE_EXPECT ( PostInitialize  )

◆ DEFINE_EXPECT() [3/5]

DEFINE_EXPECT ( PostUninitialize  )

◆ DEFINE_EXPECT() [4/5]

DEFINE_EXPECT ( PreInitialize  )

◆ DEFINE_EXPECT() [5/5]

DEFINE_EXPECT ( PreUninitialize  )

◆ DEFINE_GUID() [1/4]

DEFINE_GUID ( CLSID_Testclass  ,
0x12345678  ,
0x1234  ,
0x1234  ,
0x12  ,
0x34  ,
0x56  ,
0x78  ,
0x9a  ,
0xbc  ,
0xde  ,
0xf0   
)

◆ DEFINE_GUID() [2/4]

DEFINE_GUID ( CLSID_testclsid  ,
0xacd014c7  ,
0x9535  ,
0x4fac  ,
0x8b  ,
0x53  ,
0xa4  ,
0x8c  ,
0xa7  ,
0xf4  ,
0xd7  ,
0x26   
)

◆ DEFINE_GUID() [3/4]

DEFINE_GUID ( CLSID_WineOOPTest  ,
0x5201163f  ,
0x8164  ,
0x4fd0  ,
0xa1  ,
0xa2  ,
0x5d  ,
0x5a  ,
0x36  ,
0x54  ,
0xd3  ,
0xbd   
)

◆ DEFINE_GUID() [4/4]

DEFINE_GUID ( IID_IWineTest  ,
0x5201163f  ,
0x8164  ,
0x4fd0  ,
0xa1  ,
0xa2  ,
0x5d  ,
0x5a  ,
0x36  ,
0x54  ,
0xd3  ,
0xbd   
)

◆ EnumOLEVERB_AddRef()

static ULONG WINAPI EnumOLEVERB_AddRef ( IEnumOLEVERB iface)
static

Definition at line 1037 of file compobj.c.

1038{
1039 return 2;
1040}

◆ EnumOLEVERB_Clone()

static HRESULT WINAPI EnumOLEVERB_Clone ( IEnumOLEVERB iface,
IEnumOLEVERB **  ppenum 
)
static

Definition at line 1065 of file compobj.c.

1066{
1067 ok(0, "unexpected call\n");
1068 return E_NOTIMPL;
1069}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ EnumOLEVERB_Next()

static HRESULT WINAPI EnumOLEVERB_Next ( IEnumOLEVERB iface,
ULONG  celt,
OLEVERB *  rgelt,
ULONG fetched 
)
static

Definition at line 1047 of file compobj.c.

1048{
1049 ok(0, "unexpected call\n");
1050 return E_NOTIMPL;
1051}

◆ EnumOLEVERB_QueryInterface()

static HRESULT WINAPI EnumOLEVERB_QueryInterface ( IEnumOLEVERB iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1032 of file compobj.c.

1033{
1034 return IUnknown_QueryInterface(&Test_Unknown, riid, ppv);
1035}
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static IUnknown Test_Unknown
Definition: compobj.c:1030

◆ EnumOLEVERB_Release()

static ULONG WINAPI EnumOLEVERB_Release ( IEnumOLEVERB iface)
static

Definition at line 1042 of file compobj.c.

1043{
1044 return 1;
1045}

◆ EnumOLEVERB_Reset()

static HRESULT WINAPI EnumOLEVERB_Reset ( IEnumOLEVERB iface)
static

Definition at line 1059 of file compobj.c.

1060{
1061 ok(0, "unexpected call\n");
1062 return E_NOTIMPL;
1063}

◆ EnumOLEVERB_Skip()

static HRESULT WINAPI EnumOLEVERB_Skip ( IEnumOLEVERB iface,
ULONG  celt 
)
static

Definition at line 1053 of file compobj.c.

1054{
1055 ok(0, "unexpected call\n");
1056 return E_NOTIMPL;
1057}

◆ extract_resource()

static void extract_resource ( const char name,
const char type,
const char path 
)
static

Definition at line 217 of file compobj.c.

218{
219 DWORD written;
220 HANDLE file;
221 HRSRC res;
222 void *ptr;
223
225 ok(file != INVALID_HANDLE_VALUE, "Failed to create a file at %s, error %ld.\n", path, GetLastError());
226
228 ok(res != 0, "Failed to find resource.\n");
231 ok(written == SizeofResource(GetModuleHandleA(NULL), res), "Failed to write file.\n" );
233}
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define GENERIC_READ
Definition: compat.h:135
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
GLuint res
Definition: glext.h:9613
static PVOID ptr
Definition: dispmode.c:27
Definition: name.c:39

Referenced by START_TEST().

◆ flush_messages()

static void flush_messages ( void  )
static

Definition at line 2659 of file compobj.c.

2660{
2661 MSG msg;
2662 while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ));
2663}

Referenced by test_CoWaitForMultipleHandles().

◆ free_libraries_thread()

static DWORD CALLBACK free_libraries_thread ( LPVOID  p)
static

Definition at line 1855 of file compobj.c.

1856{
1858 return 0;
1859}
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void)
Definition: combase.c:1936

Referenced by test_CoFreeUnusedLibraries().

◆ get_class_object()

static HRESULT get_class_object ( CLSCTX  clsctx)
static

Definition at line 1685 of file compobj.c.

1686{
1687 HRESULT hr;
1688 IClassFactory *pcf;
1689
1691 (void **)&pcf);
1692
1693 if (SUCCEEDED(hr))
1694 IClassFactory_Release(pcf);
1695
1696 return hr;
1697}
const GUID IID_IClassFactory
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD clscontext, COSERVERINFO *server_info, REFIID riid, void **obj)
Definition: combase.c:1925
#define SUCCEEDED(hr)
Definition: intsafe.h:50
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:140

Referenced by get_class_object_thread(), and test_registered_object_thread_affinity().

◆ get_class_object_proxy_thread()

static DWORD CALLBACK get_class_object_proxy_thread ( LPVOID  pv)
static

Definition at line 1713 of file compobj.c.

1714{
1715 CLSCTX clsctx = (CLSCTX)(DWORD_PTR)pv;
1716 HRESULT hr;
1717 IClassFactory *pcf;
1718 IMultiQI *pMQI;
1719
1721
1723 (void **)&pcf);
1724
1725 if (SUCCEEDED(hr))
1726 {
1727 hr = IClassFactory_QueryInterface(pcf, &IID_IMultiQI, (void **)&pMQI);
1728 if (SUCCEEDED(hr))
1729 IMultiQI_Release(pMQI);
1730 IClassFactory_Release(pcf);
1731 }
1732
1734
1735 return hr;
1736}
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(void *reserved, DWORD model)
Definition: combase.c:2803
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:279
uint32_t DWORD_PTR
Definition: typedefs.h:65

Referenced by test_registered_object_thread_affinity().

◆ get_class_object_thread()

static DWORD CALLBACK get_class_object_thread ( LPVOID  pv)
static

Definition at line 1699 of file compobj.c.

1700{
1701 CLSCTX clsctx = (CLSCTX)(DWORD_PTR)pv;
1702 HRESULT hr;
1703
1705
1706 hr = get_class_object(clsctx);
1707
1709
1710 return hr;
1711}
static HRESULT get_class_object(CLSCTX clsctx)
Definition: compobj.c:1685

Referenced by test_registered_object_thread_affinity().

◆ get_oletlsflags()

static DWORD get_oletlsflags ( void  )
static

Definition at line 4297 of file compobj.c.

4298{
4299 struct oletlsdata *data = NtCurrentTeb()->ReservedForOle;
4300 return data ? data->flags : 0;
4301}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define NtCurrentTeb

Referenced by oletlsdata_test_thread(), and test_oletlsdata().

◆ getinstance_cf_AddRef()

static ULONG WINAPI getinstance_cf_AddRef ( IClassFactory iface)
static

Definition at line 3765 of file compobj.c.

3766{
3767 return 2;
3768}

◆ getinstance_cf_CreateInstance()

static HRESULT WINAPI getinstance_cf_CreateInstance ( IClassFactory iface,
IUnknown outer,
REFIID  riid,
void **  obj 
)
static

Definition at line 3775 of file compobj.c.

3777{
3778 if (IsEqualIID(riid, &IID_IUnknown)) {
3779 *obj = &testpersistfile;
3780 return S_OK;
3781 }
3782
3783 ok(0, "unexpected call, riid %s\n", wine_dbgstr_guid(riid));
3784 *obj = NULL;
3785 return E_NOTIMPL;
3786}
static IPersistFile testpersistfile
Definition: compobj.c:3751
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:206

◆ getinstance_cf_LockServer()

static HRESULT WINAPI getinstance_cf_LockServer ( IClassFactory iface,
BOOL  lock 
)
static

Definition at line 3788 of file compobj.c.

3789{
3790 ok(0, "unexpected call\n");
3791 return E_NOTIMPL;
3792}

◆ getinstance_cf_QI()

static HRESULT WINAPI getinstance_cf_QI ( IClassFactory iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 3753 of file compobj.c.

3754{
3756 *obj = iface;
3757 IClassFactory_AddRef(iface);
3758 return S_OK;
3759 }
3760
3761 *obj = NULL;
3762 return E_NOINTERFACE;
3763}
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ getinstance_cf_Release()

static ULONG WINAPI getinstance_cf_Release ( IClassFactory iface)
static

Definition at line 3770 of file compobj.c.

3771{
3772 return 1;
3773}

◆ HRESULT()

static HRESULT ( WINAPI pCoGetObjectContext)
static

◆ impl_from_IUnknown()

static Test_CallContext * impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 2008 of file compobj.c.

2009{
2010 return CONTAINING_RECORD(iface, Test_CallContext, IUnknown_iface);
2011}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by Test_CallContext_AddRef(), and Test_CallContext_Release().

◆ implicit_mta_proc()

static DWORD CALLBACK implicit_mta_proc ( void param)
static

Definition at line 3977 of file compobj.c.

3978{
3979 IComThreadingInfo *threading_info;
3981 IUnknown *unk;
3982 DWORD cookie;
3983 CLSID clsid;
3984 HRESULT hr;
3985
3987
3988 hr = CoCreateInstance(&CLSID_InternetZoneManager, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
3989 ok_ole_success(hr, "CoCreateInstance");
3990 IUnknown_Release(unk);
3991
3992 hr = CoGetClassObject(&CLSID_InternetZoneManager, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&unk);
3993 ok_ole_success(hr, "CoGetClassObject");
3994 IUnknown_Release(unk);
3995
3996 hr = CoGetObjectContext(&IID_IComThreadingInfo, (void **)&threading_info);
3997 ok_ole_success(hr, "CoGetObjectContext");
3998 IComThreadingInfo_Release(threading_info);
3999
4001 ok_ole_success(hr, "CoGetContextToken");
4002
4004 ok_ole_success(hr, "CoRegisterPSClsid");
4005
4007 ok_ole_success(hr, "CoGetPSClsid");
4008
4010 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
4011 ok_ole_success(hr, "CoRegisterClassObject");
4012
4014 ok_ole_success(hr, "CoRevokeClassObject");
4015
4017 ok(hr == CO_E_NOT_SUPPORTED, "got %#lx\n", hr);
4018
4020 ok_ole_success(hr, "CoLockObjectExternal");
4021
4023 ok_ole_success(hr, "CoDisconnectObject");
4024
4025 return 0;
4026}
HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
Definition: combase.c:2294
HRESULT WINAPI CoRegisterMessageFilter(IMessageFilter *filter, IMessageFilter **ret_filter)
Definition: combase.c:2220
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD cookie)
Definition: combase.c:3107
HRESULT WINAPI CoGetContextToken(ULONG_PTR *token)
Definition: combase.c:2668
HRESULT WINAPI CoDisconnectObject(IUnknown *object, DWORD reserved)
Definition: combase.c:3190
HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv)
Definition: combase.c:1176
HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid)
Definition: combase.c:2359
HRESULT WINAPI CoLockObjectExternal(IUnknown *object, BOOL lock, BOOL last_unlock_releases)
Definition: combase.c:3237
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, IUnknown *object, DWORD clscontext, DWORD flags, DWORD *cookie)
Definition: combase.c:2970
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
#define test_apt_type(t, q)
Definition: compobj.c:663
static const CLSID CLSID_WineTestPSFactoryBuffer
Definition: compobj.c:1187
#define ok_ole_success(hr, func)
Definition: compobj.c:87
static IClassFactory Test_ClassFactory
Definition: compobj.c:191
static const IID IID_IWineTest
Definition: marshal.c:121
const CLSID * clsid
Definition: msctf.cpp:50
@ REGCLS_SINGLEUSE
Definition: objbase.h:395
@ APTTYPEQUALIFIER_IMPLICIT_MTA
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define CO_E_NOT_SUPPORTED
Definition: winerror.h:3510

Referenced by test_implicit_mta().

◆ init_funcs()

static void init_funcs ( void  )
static

Definition at line 3958 of file compobj.c.

3959{
3960 HMODULE hOle32 = GetModuleHandleA("ole32");
3961 HMODULE hAdvapi32 = GetModuleHandleA("advapi32");
3962 HMODULE hkernel32 = GetModuleHandleA("kernel32");
3963
3964 pCoGetObjectContext = (void*)GetProcAddress(hOle32, "CoGetObjectContext");
3965 pCoSwitchCallContext = (void*)GetProcAddress(hOle32, "CoSwitchCallContext");
3966 pCoGetContextToken = (void*)GetProcAddress(hOle32, "CoGetContextToken");
3967 pCoGetApartmentType = (void*)GetProcAddress(hOle32, "CoGetApartmentType");
3968 pCoIncrementMTAUsage = (void*)GetProcAddress(hOle32, "CoIncrementMTAUsage");
3969 pCoDecrementMTAUsage = (void*)GetProcAddress(hOle32, "CoDecrementMTAUsage");
3970 pCoCreateInstanceFromApp = (void*)GetProcAddress(hOle32, "CoCreateInstanceFromApp");
3971 pRegDeleteKeyExA = (void*)GetProcAddress(hAdvapi32, "RegDeleteKeyExA");
3972 pRegOverridePredefKey = (void*)GetProcAddress(hAdvapi32, "RegOverridePredefKey");
3973
3974 pIsWow64Process = (void*)GetProcAddress(hkernel32, "IsWow64Process");
3975}
#define GetProcAddress(x, y)
Definition: compat.h:753
static HINSTANCE hkernel32
Definition: process.c:68

Referenced by START_TEST().

◆ is_module_loaded()

static BOOL is_module_loaded ( const char module)
inlinestatic

Definition at line 1861 of file compobj.c.

1862{
1863 return GetModuleHandleA(module) != 0;
1864}

Referenced by test_CoFreeUnusedLibraries().

◆ LockModule()

static void LockModule ( void  )
static

Definition at line 121 of file compobj.c.

122{
124}
#define InterlockedIncrement
Definition: armddk.h:53
static LONG cLocks
Definition: compobj.c:119

Referenced by Test_IClassFactory_AddRef().

◆ LONG()

static LONG ( WINAPI pRegDeleteKeyExA)
static

◆ MessageFilter_AddRef()

static ULONG WINAPI MessageFilter_AddRef ( IMessageFilter iface)
static

Definition at line 936 of file compobj.c.

937{
938 return 2; /* non-heap object */
939}

◆ MessageFilter_HandleInComingCall()

static DWORD WINAPI MessageFilter_HandleInComingCall ( IMessageFilter iface,
DWORD  dwCallType,
HTASK  threadIDCaller,
DWORD  dwTickCount,
LPINTERFACEINFO  lpInterfaceInfo 
)
static

Definition at line 946 of file compobj.c.

952{
953 trace("HandleInComingCall\n");
954 return SERVERCALL_ISHANDLED;
955}
#define trace
Definition: atltest.h:70

◆ MessageFilter_MessagePending()

static DWORD WINAPI MessageFilter_MessagePending ( IMessageFilter iface,
HTASK  threadIDCallee,
DWORD  dwTickCount,
DWORD  dwPendingType 
)
static

Definition at line 967 of file compobj.c.

972{
973 trace("MessagePending\n");
974 todo_wine ok(0, "unexpected call\n");
975 return PENDINGMSG_WAITNOPROCESS;
976}
#define todo_wine
Definition: minitest.h:80

◆ MessageFilter_QueryInterface()

static HRESULT WINAPI MessageFilter_QueryInterface ( IMessageFilter iface,
REFIID  riid,
void **  ppvObj 
)
static

Definition at line 921 of file compobj.c.

922{
923 if (ppvObj == NULL) return E_POINTER;
924
926 IsEqualGUID(riid, &IID_IMessageFilter))
927 {
928 *ppvObj = iface;
929 IMessageFilter_AddRef(iface);
930 return S_OK;
931 }
932
933 return E_NOINTERFACE;
934}
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_POINTER
Definition: winerror.h:3480

◆ MessageFilter_Release()

static ULONG WINAPI MessageFilter_Release ( IMessageFilter iface)
static

Definition at line 941 of file compobj.c.

942{
943 return 1; /* non-heap object */
944}

◆ MessageFilter_RetryRejectedCall()

static DWORD WINAPI MessageFilter_RetryRejectedCall ( IMessageFilter iface,
HTASK  threadIDCallee,
DWORD  dwTickCount,
DWORD  dwRejectType 
)
static

Definition at line 957 of file compobj.c.

962{
963 trace("RetryRejectedCall\n");
964 return 0;
965}

◆ oletlsdata_test_thread()

static DWORD CALLBACK oletlsdata_test_thread ( void arg)
static

Definition at line 4303 of file compobj.c.

4304{
4305 IUnknown *unk;
4306 DWORD flags;
4307 HRESULT hr;
4308
4309 hr = CoCreateInstance(&CLSID_InternetZoneManager, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
4310 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4311 IUnknown_Release(unk);
4312
4313 /* Flag is not set for implicit MTA. */
4315 ok(!(flags & OLETLS_MULTITHREADED), "Unexpected flags %#lx.\n", flags);
4316
4317 return 0;
4318}
GLbitfield flags
Definition: glext.h:7161
static DWORD get_oletlsflags(void)
Definition: compobj.c:4297

Referenced by test_oletlsdata().

◆ post_message_thread()

static DWORD CALLBACK post_message_thread ( LPVOID  arg)
static

Definition at line 2607 of file compobj.c.

2608{
2609 HWND hWnd = arg;
2611 return 0;
2612}
HWND hWnd
Definition: settings.c:17
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_CoWaitForMultipleHandles().

◆ PSFactoryBuffer_AddRef()

static ULONG WINAPI PSFactoryBuffer_AddRef ( IPSFactoryBuffer This)
static

Definition at line 1139 of file compobj.c.

1141{
1142 return 2;
1143}

◆ PSFactoryBuffer_CreateProxy()

static HRESULT WINAPI PSFactoryBuffer_CreateProxy ( IPSFactoryBuffer This,
IUnknown pUnkOuter,
REFIID  riid,
IRpcProxyBuffer **  ppProxy,
void **  ppv 
)
static

Definition at line 1151 of file compobj.c.

1157{
1158 return E_NOTIMPL;
1159}

◆ PSFactoryBuffer_CreateStub()

static HRESULT WINAPI PSFactoryBuffer_CreateStub ( IPSFactoryBuffer This,
REFIID  riid,
IUnknown pUnkServer,
IRpcStubBuffer **  ppStub 
)
static

Definition at line 1161 of file compobj.c.

1166{
1167 CHECK_EXPECT(CreateStub);
1168
1169 ok(pUnkServer == &Test_Unknown, "unexpected pUnkServer %p\n", pUnkServer);
1171 return E_NOTIMPL;
1172
1173 return IPSFactoryBuffer_CreateStub(ps_factory_buffer, &IID_IEnumOLEVERB, pUnkServer, ppStub);
1174}
#define CHECK_EXPECT(func)
Definition: compobj.c:54
static IPSFactoryBuffer * ps_factory_buffer
Definition: compobj.c:1122

◆ PSFactoryBuffer_QueryInterface()

static HRESULT WINAPI PSFactoryBuffer_QueryInterface ( IPSFactoryBuffer This,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 1124 of file compobj.c.

1128{
1129 if (IsEqualIID(riid, &IID_IUnknown) ||
1130 IsEqualIID(riid, &IID_IPSFactoryBuffer))
1131 {
1132 *ppvObject = This;
1133 IPSFactoryBuffer_AddRef(This);
1134 return S_OK;
1135 }
1136 return E_NOINTERFACE;
1137}

◆ PSFactoryBuffer_Release()

static ULONG WINAPI PSFactoryBuffer_Release ( IPSFactoryBuffer This)
static

Definition at line 1145 of file compobj.c.

1147{
1148 return 1;
1149}

◆ register_class_object_thread()

static DWORD CALLBACK register_class_object_thread ( LPVOID  pv)
static

Definition at line 1738 of file compobj.c.

1739{
1740 HRESULT hr;
1741 DWORD cookie;
1742
1744
1746 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1747
1749
1750 return hr;
1751}

Referenced by test_registered_object_thread_affinity().

◆ register_dummy_class()

static ATOM register_dummy_class ( void  )
static

Definition at line 889 of file compobj.c.

890{
891 WNDCLASSA wc =
892 {
893 0,
895 0,
896 0,
898 NULL,
900 (HBRUSH)(COLOR_BTNFACE+1),
901 NULL,
902 "WineOleTestClass",
903 };
904
905 return RegisterClassA(&wc);
906}
#define IDC_ARROW
Definition: winuser.h:695
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2459
#define COLOR_BTNFACE
Definition: winuser.h:939
char * LPSTR
Definition: xmlstorage.h:182

Referenced by test_ole_menu().

◆ register_ps_clsid_thread()

static DWORD CALLBACK register_ps_clsid_thread ( void context)
static

Definition at line 1195 of file compobj.c.

1196{
1197 HRESULT hr;
1198 CLSID clsid = {0};
1199
1201
1203 ok_ole_success(hr, "CoGetPSClsid");
1204 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1206
1207 /* test registering a PSClsid in an apartment which is then destroyed */
1209 ok_ole_success(hr, "CoRegisterPSClsid");
1210
1212
1213 return hr;
1214}
static const GUID IID_TestPS
Definition: compobj.c:101

Referenced by test_CoRegisterPSClsid().

◆ release_semaphore_thread()

static DWORD CALLBACK release_semaphore_thread ( LPVOID  arg)
static

Definition at line 2583 of file compobj.c.

2584{
2585 HANDLE handle = arg;
2588 return 0;
2589}
#define WAIT_TIMEOUT
Definition: dderror.h:14
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:491

Referenced by test_CoWaitForMultipleHandles().

◆ revoke_class_object_thread()

static DWORD CALLBACK revoke_class_object_thread ( LPVOID  pv)
static

Definition at line 1753 of file compobj.c.

1754{
1755 DWORD cookie = (DWORD_PTR)pv;
1756 HRESULT hr;
1757
1759
1761
1763
1764 return hr;
1765}
#define DWORD_PTR
Definition: treelist.c:76

Referenced by test_registered_object_thread_affinity().

◆ send_and_post_user_message_thread()

static DWORD CALLBACK send_and_post_user_message_thread ( void arg)
static

Definition at line 2598 of file compobj.c.

2599{
2600 HWND hwnd = arg;
2601 Sleep(30);
2602 SendMessageA(hwnd, WM_USER, 0, 0);
2603 PostMessageA(hwnd, WM_USER, 0, 0);
2604 return 0;
2605}
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:726
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_USER
Definition: winuser.h:1923

Referenced by test_CoWaitForMultipleHandles().

◆ send_message_thread()

static DWORD CALLBACK send_message_thread ( LPVOID  arg)
static

Definition at line 2591 of file compobj.c.

2592{
2593 HWND hWnd = arg;
2595 return 0;
2596}

Referenced by test_CoWaitForMultipleHandles().

◆ START_TEST()

START_TEST ( compobj  )

Definition at line 4372 of file compobj.c.

4373{
4374 init_funcs();
4375
4378 lstrcatA(testlib, "\\testlib.dll");
4379 extract_resource("testlib.dll", "TESTDLL", testlib);
4380
4388 test_ole_menu();
4424
4426}
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2125
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:1973
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
static void test_CoInitializeEx(void)
Definition: compobj.c:2282
static void test_CoMarshalInterThreadInterfaceInStream(void)
Definition: compobj.c:1544
static void test_CoRegisterMessageFilter(void)
Definition: compobj.c:990
static void test_CoGetInstanceFromFile(void)
Definition: compobj.c:3804
static void test_CoGetClassObject(void)
Definition: compobj.c:744
static void test_ole_menu(void)
Definition: compobj.c:908
static void test_registered_object_thread_affinity(void)
Definition: compobj.c:1767
static void test_CoCreateInstanceFromApp(void)
Definition: compobj.c:4122
static void test_CoGetApartmentType(void)
Definition: compobj.c:3245
static void test_implicit_mta(void)
Definition: compobj.c:4030
static void test_OleRegGetUserType(void)
Definition: compobj.c:2414
static void test_TreatAsClass(void)
Definition: compobj.c:2182
static char testlib[MAX_PATH]
Definition: compobj.c:235
static void test_call_cancellation(void)
Definition: compobj.c:4223
static void test_CoCreateInstance(void)
Definition: compobj.c:681
static void test_GlobalOptions(void)
Definition: compobj.c:3919
static void test_CoGetInterfaceAndReleaseStream(void)
Definition: compobj.c:1495
static void test_IInitializeSpy(BOOL mt)
Definition: compobj.c:3554
static void test_CoRegisterClassObject(void)
Definition: compobj.c:1578
static void test_CoFreeUnusedLibraries(void)
Definition: compobj.c:1866
static void test_CoRegisterPSClsid(void)
Definition: compobj.c:1216
static void test_CoMarshalInterface(void)
Definition: compobj.c:1509
static void test_StringFromGUID2(void)
Definition: compobj.c:635
static void test_CoGetCurrentProcess(void)
Definition: compobj.c:4050
static void test_ProgIDFromCLSID(void)
Definition: compobj.c:379
static void test_IMallocSpy(void)
Definition: compobj.c:3410
static void test_CoGetCurrentLogicalThreadId(void)
Definition: compobj.c:3446
static void test_CoGetObjectContext(void)
Definition: compobj.c:1909
static void extract_resource(const char *name, const char *type, const char *path)
Definition: compobj.c:217
static void test_CoGetMalloc(void)
Definition: compobj.c:3176
static void test_CoGetContextToken(void)
Definition: compobj.c:2110
static void test_OleInitialize_InitCounting(void)
Definition: compobj.c:2304
static void test_OleRegGetMiscStatus(void)
Definition: compobj.c:2371
static void test_CoCreateGuid(void)
Definition: compobj.c:2570
static void test_oletlsdata(void)
Definition: compobj.c:4320
static void test_CLSIDFromProgID(void)
Definition: compobj.c:431
static void init_funcs(void)
Definition: compobj.c:3958
static void test_CoGetCallContext(void)
Definition: compobj.c:2053
static void test_CoCreateInstanceEx(void)
Definition: compobj.c:865
static void test_mta_usage(void)
Definition: compobj.c:4067
static void test_CoWaitForMultipleHandles(void)
Definition: compobj.c:2791
static void test_CoGetPSClsid(void)
Definition: compobj.c:1319
static void test_CLSIDFromString(void)
Definition: compobj.c:497
static void test_CoUnmarshalInterface(void)
Definition: compobj.c:1466
static void test_IIDFromString(void)
Definition: compobj.c:573

◆ test_call_cancellation()

static void test_call_cancellation ( void  )
static

Definition at line 4223 of file compobj.c.

4224{
4225 HRESULT hr;
4226
4227 /* Cancellation is disabled initially. */
4229 ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
4230
4232 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4233
4235 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4236
4238 ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
4239
4241 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4242
4243 /* Counter is not affected by initialization. */
4244 hr = CoInitialize(NULL);
4245 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4246
4248 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4249
4251 ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
4252
4254 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4255
4257
4259 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4260
4262 ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
4263
4264 /* It's cumulative. */
4266 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4267
4269 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4270
4272 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4273
4275 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4276
4278 ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
4279}
HRESULT WINAPI CoDisableCallCancellation(void *reserved)
Definition: combase.c:3284
HRESULT WINAPI CoEnableCallCancellation(void *reserved)
Definition: combase.c:3305
#define CO_E_CANCEL_DISABLED
Definition: winerror.h:3611

Referenced by START_TEST().

◆ Test_CallContext_AddRef()

static ULONG WINAPI Test_CallContext_AddRef ( IUnknown iface)
static

Definition at line 2031 of file compobj.c.

2032{
2034 return InterlockedIncrement(&This->refs);
2035}
static Test_CallContext * impl_from_IUnknown(IUnknown *iface)
Definition: compobj.c:2008

◆ Test_CallContext_QueryInterface()

static HRESULT WINAPI Test_CallContext_QueryInterface ( IUnknown iface,
REFIID  riid,
LPVOID ppvObj 
)
static

Definition at line 2013 of file compobj.c.

2017{
2018 if (ppvObj == NULL) return E_POINTER;
2019
2021 {
2022 *ppvObj = iface;
2023 IUnknown_AddRef(iface);
2024 return S_OK;
2025 }
2026
2027 *ppvObj = NULL;
2028 return E_NOINTERFACE;
2029}

◆ Test_CallContext_Release()

static ULONG WINAPI Test_CallContext_Release ( IUnknown iface)
static

Definition at line 2037 of file compobj.c.

2038{
2040 ULONG refs = InterlockedDecrement(&This->refs);
2041 if (!refs)
2042 free(This);
2043 return refs;
2044}
#define InterlockedDecrement
Definition: armddk.h:52
#define free
Definition: debug_ros.c:5
uint32_t ULONG
Definition: typedefs.h:59

◆ test_CLSIDFromProgID()

static void test_CLSIDFromProgID ( void  )
static

Definition at line 431 of file compobj.c.

432{
433 ULONG_PTR cookie = 0;
435 CLSID clsid;
437 ok(hr == S_OK, "CLSIDFromProgID failed with error 0x%08lx\n", hr);
438 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
439
441 ok_ole_success(hr, "CLSIDFromString");
442 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
443
444 /* test some failure cases */
445
447 ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
448
450 ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
451
452 memset(&clsid, 0xcc, sizeof(clsid));
454 ok(hr == CO_E_CLASSSTRING, "CLSIDFromProgID on nonexistent ProgID should have returned CO_E_CLASSSTRING instead of 0x%08lx\n", hr);
455 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "CLSIDFromProgID should have set clsid to all-zeros on failure\n");
456
457 /* fails without proper context */
458 memset(&clsid, 0xcc, sizeof(clsid));
460 ok(hr == CO_E_CLASSSTRING, "got 0x%08lx\n", hr);
461 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "wrong clsid\n");
462
464 {
465 GUID clsid1;
466
467 memset(&clsid, 0xcc, sizeof(clsid));
469 ok(hr == CO_E_CLASSSTRING, "got 0x%08lx\n", hr);
470 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "should have zero CLSID on failure\n");
471
472 /* CLSIDFromString() doesn't check activation context */
474 ok(hr == CO_E_CLASSSTRING, "got 0x%08lx\n", hr);
475
478 ok(hr == S_OK, "got 0x%08lx\n", hr);
479 /* it returns generated CLSID here */
481 "got wrong clsid %s\n", wine_dbgstr_guid(&clsid));
482
483 /* duplicate progid present in context - returns generated guid here too */
486 ok(hr == S_OK, "got 0x%08lx\n", hr);
487 clsid1 = CLSID_StdFont;
488 /* that's where it differs from StdFont */
489 clsid1.Data4[7] = 0x52;
491 "got %s\n", wine_dbgstr_guid(&clsid));
492
494 }
495}
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, CLSID *clsid)
Definition: combase.c:1437
HRESULT WINAPI CLSIDFromString(LPCOLESTR str, LPCLSID clsid)
Definition: combase.c:1470
static void deactivate_context(HANDLE handle, ULONG_PTR cookie)
Definition: compobj.c:281
static const char actctx_manifest[]
Definition: compobj.c:290
static const WCHAR stdfont[]
Definition: compobj.c:105
static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
Definition: compobj.c:237
static const WCHAR progidW[]
Definition: compobj.c:112
static const CLSID CLSID_non_existent
Definition: compobj.c:91
static const CLSID CLSID_StdFont
Definition: compobj.c:92
static const WCHAR wszNonExistent[]
Definition: compobj.c:106
#define CLSID_NULL
Definition: guiddef.h:99
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
#define CO_E_CLASSSTRING
Definition: winerror.h:3919

Referenced by START_TEST().

◆ test_CLSIDFromString()

static void test_CLSIDFromString ( void  )
static

Definition at line 497 of file compobj.c.

498{
499 CLSID clsid;
500 WCHAR wszCLSID_Broken[50];
501 UINT i;
502
504 ok_ole_success(hr, "CLSIDFromString");
505 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
506
507 memset(&clsid, 0xab, sizeof(clsid));
509 ok(hr == S_OK, "got 0x%08lx\n", hr);
510 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n");
511
512 /* string is longer, but starts with a valid CLSID */
513 memset(&clsid, 0, sizeof(clsid));
515 ok(hr == CO_E_CLASSSTRING, "got 0x%08lx\n", hr);
517
518 lstrcpyW(wszCLSID_Broken, wszCLSID_StdFont);
519 for(i = lstrlenW(wszCLSID_StdFont); i < 49; i++)
520 wszCLSID_Broken[i] = 'A';
521 wszCLSID_Broken[i] = '\0';
522
523 memset(&clsid, 0, sizeof(CLSID));
524 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
525 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
526 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
527
528 wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = 'A';
529 memset(&clsid, 0, sizeof(CLSID));
530 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
531 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
532 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
533
534 wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)] = '\0';
535 memset(&clsid, 0, sizeof(CLSID));
536 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
537 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
538 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
539
540 wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = '\0';
541 memset(&clsid, 0, sizeof(CLSID));
542 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
543 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
544 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
545
546 memset(&clsid, 0xcc, sizeof(CLSID));
547 hr = CLSIDFromString(wszCLSID_Broken+1, &clsid);
548 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
549 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n");
550
551 wszCLSID_Broken[9] = '*';
552 memset(&clsid, 0xcc, sizeof(CLSID));
553 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
554 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
555 ok(clsid.Data1 == CLSID_StdFont.Data1, "Got %s\n", debugstr_guid(&clsid));
556 ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
557
558 wszCLSID_Broken[3] = '*';
559 memset(&clsid, 0xcc, sizeof(CLSID));
560 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
561 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
562 ok(clsid.Data1 == 0xb, "Got %s\n", debugstr_guid(&clsid));
563 ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
564
565 wszCLSID_Broken[3] = '\0';
566 memset(&clsid, 0xcc, sizeof(CLSID));
567 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
568 ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
569 ok(clsid.Data1 == 0xb, "Got %s\n", debugstr_guid(&clsid));
570 ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
571}
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
GLsizei GLenum const GLvoid GLsizei GLenum 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 const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_guid
Definition: kernel32.h:35
static const WCHAR wszCLSID_StdFont[]
Definition: compobj.c:107
static const WCHAR cf_brokenW[]
Definition: compobj.c:113
unsigned int UINT
Definition: ndis.h:50

Referenced by START_TEST().

◆ test_CoCreateGuid()

static void test_CoCreateGuid ( void  )
static

Definition at line 2570 of file compobj.c.

2571{
2572 HRESULT hr;
2573
2574 hr = CoCreateGuid(NULL);
2575 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
2576}
HRESULT WINAPI CoCreateGuid(GUID *guid)
Definition: combase.c:1016

Referenced by START_TEST().

◆ test_CoCreateInstance()

static void test_CoCreateInstance ( void  )
static

Definition at line 681 of file compobj.c.

682{
683 HRESULT hr;
684 IUnknown *pUnk;
685 REFCLSID rclsid = &CLSID_InternetZoneManager;
686
687 pUnk = (IUnknown *)0xdeadbeef;
688 hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
689 ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
690 ok(pUnk == NULL, "CoCreateInstance should have changed the passed in pointer to NULL, instead of %p\n", pUnk);
691
693
694 /* test errors returned for non-registered clsids */
695 hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
696 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc server should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
697 hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&pUnk);
698 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc handler should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
699 hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_LOCAL_SERVER, &IID_IUnknown, (void **)&pUnk);
700 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered local server should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
701 hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_REMOTE_SERVER, &IID_IUnknown, (void **)&pUnk);
702 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered remote server should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
703
704 hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
706 {
707 skip("IE not installed so can't test CoCreateInstance\n");
709 return;
710 }
711
712 ok_ole_success(hr, "CoCreateInstance");
713 if(pUnk) IUnknown_Release(pUnk);
715
716 hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
717 ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
718
719 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
720}
#define skip(...)
Definition: atltest.h:64
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:162
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:218
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
@ APTTYPEQUALIFIER_NONE
#define REFCLSID
Definition: guiddef.h:117
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:3801

Referenced by START_TEST().

◆ test_CoCreateInstanceEx()

static void test_CoCreateInstanceEx ( void  )
static

Definition at line 865 of file compobj.c.

866{
867 MULTI_QI qi_res = { &IID_IMoniker };
869 HRESULT hr;
870
872
874 CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie);
875 ok_ole_success(hr, "CoRegisterClassObject");
876
878 hr = CoCreateInstanceEx(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER, NULL, 1, &qi_res);
879 ok(hr == E_NOINTERFACE, "CoCreateInstanceEx failed: %08lx\n", hr);
880 ok(IsEqualGUID(&create_instance_iid, qi_res.pIID), "Unexpected CreateInstance iid %s\n",
882
884 ok_ole_success(hr, "CoRevokeClassObject");
885
887}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, COSERVERINFO *server_info, ULONG count, MULTI_QI *results)
Definition: combase.c:1882
static IID create_instance_iid
Definition: compobj.c:162
@ REGCLS_MULTIPLEUSE
Definition: objbase.h:396
#define IID_NULL
Definition: guiddef.h:98

Referenced by START_TEST().

◆ test_CoCreateInstanceFromApp()

static void test_CoCreateInstanceFromApp ( void  )
static

Definition at line 4122 of file compobj.c.

4123{
4124 static const CLSID *supported_classes[] =
4125 {
4129 };
4130 static const CLSID *unsupported_classes[] =
4131 {
4133 };
4134 unsigned int i;
4135 IUnknown *unk;
4136 DWORD cookie;
4137 MULTI_QI mqi;
4138 HRESULT hr;
4139 HANDLE handle;
4140 ULONG_PTR actctx_cookie;
4141
4142 if (!pCoCreateInstanceFromApp)
4143 {
4144 win_skip("CoCreateInstanceFromApp() is not available.\n");
4145 return;
4146 }
4147
4149
4150 for (i = 0; i < ARRAY_SIZE(supported_classes); ++i)
4151 {
4152 memset(&mqi, 0, sizeof(mqi));
4153 mqi.pIID = &IID_IUnknown;
4154 hr = pCoCreateInstanceFromApp(supported_classes[i], NULL, CLSCTX_INPROC_SERVER, NULL, 1, &mqi);
4155 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4156 IUnknown_Release(mqi.pItf);
4157
4158 hr = CoCreateInstance(supported_classes[i], NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
4159 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4160 IUnknown_Release(unk);
4161 }
4162
4163 for (i = 0; i < ARRAY_SIZE(unsupported_classes); ++i)
4164 {
4165 memset(&mqi, 0, sizeof(mqi));
4166 mqi.pIID = &IID_IUnknown;
4167 hr = pCoCreateInstanceFromApp(unsupported_classes[i], NULL, CLSCTX_INPROC_SERVER, NULL, 1, &mqi);
4168 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
4169
4170 hr = CoCreateInstance(unsupported_classes[i], NULL, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER,
4171 &IID_IUnknown, (void **)&unk);
4172 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
4173
4174 hr = CoCreateInstance(unsupported_classes[i], NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
4175 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4176 IUnknown_Release(unk);
4177 }
4178
4179 /* Locally registered classes are filtered out. */
4182 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4183
4184 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void **)&unk);
4185 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4186
4187 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER, NULL,
4188 &IID_IClassFactory, (void **)&unk);
4189 todo_wine
4190 ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
4191
4192 hr = CoCreateInstance(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
4193 ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
4194
4195 hr = CoCreateInstance(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER,
4196 &IID_IUnknown, (void **)&unk);
4197 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
4198
4199 memset(&mqi, 0, sizeof(mqi));
4200 mqi.pIID = &IID_IUnknown;
4201 hr = pCoCreateInstanceFromApp(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER, NULL, 1, &mqi);
4202 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
4203
4205 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4206
4207 /* Activation context */
4208 if ((handle = activate_context(actctx_manifest, &actctx_cookie)))
4209 {
4210 hr = CoCreateInstance(&IID_Testiface7, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
4211 ok(hr == 0x80001235, "Unexpected hr %#lx.\n", hr);
4212
4213 hr = CoCreateInstance(&IID_Testiface7, NULL, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER,
4214 &IID_IUnknown, (void **)&unk);
4215 ok(hr == 0x80001235, "Unexpected hr %#lx.\n", hr);
4216
4217 deactivate_context(handle, actctx_cookie);
4218 }
4219
4221}
const CLSID CLSID_GlobalOptions
const CLSID CLSID_ManualResetEvent
const CLSID CLSID_InProcFreeMarshaler
const CLSID CLSID_StdGlobalInterfaceTable
static const GUID IID_Testiface7
Definition: compobj.c:99

Referenced by START_TEST().

◆ test_CoFreeUnusedLibraries()

static void test_CoFreeUnusedLibraries ( void  )
static

Definition at line 1866 of file compobj.c.

1867{
1868 HRESULT hr;
1869 IUnknown *pUnk;
1870 DWORD tid;
1871 HANDLE thread;
1872
1874
1875 ok(!is_module_loaded("urlmon.dll"), "urlmon.dll shouldn't be loaded\n");
1876
1877 hr = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pUnk);
1878 if (hr == REGDB_E_CLASSNOTREG)
1879 {
1880 skip("IE not installed so can't run CoFreeUnusedLibraries test\n");
1882 return;
1883 }
1884 ok_ole_success(hr, "CoCreateInstance");
1885
1886 ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1887
1888 ok(pUnk != NULL ||
1889 broken(pUnk == NULL), /* win9x */
1890 "Expected a valid pointer\n");
1891 if (pUnk)
1892 IUnknown_Release(pUnk);
1893
1894 ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1895
1897 ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1899
1900 ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1901
1903
1904 ok(!is_module_loaded("urlmon.dll"), "urlmon.dll shouldn't be loaded\n");
1905
1907}
static HANDLE thread
Definition: service.c:33
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:137
static TfClientId tid
static DWORD CALLBACK free_libraries_thread(LPVOID p)
Definition: compobj.c:1855
static BOOL is_module_loaded(const char *module)
Definition: compobj.c:1861

Referenced by START_TEST().

◆ test_CoGetApartmentType()

static void test_CoGetApartmentType ( void  )
static

Definition at line 3245 of file compobj.c.

3246{
3248 APTTYPE type;
3249 HRESULT hr;
3250
3251 if (!pCoGetApartmentType)
3252 {
3253 win_skip("CoGetApartmentType not present\n");
3254 return;
3255 }
3256
3257 hr = pCoGetApartmentType(NULL, NULL);
3258 ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08lx\n", hr);
3259
3260 type = 0xdeadbeef;
3261 hr = pCoGetApartmentType(&type, NULL);
3262 ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08lx\n", hr);
3263 ok(type == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", type);
3264
3265 qualifier = 0xdeadbeef;
3266 hr = pCoGetApartmentType(NULL, &qualifier);
3267 ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08lx\n", hr);
3268 ok(qualifier == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", qualifier);
3269
3270 type = 0xdeadbeef;
3271 qualifier = 0xdeadbeef;
3272 hr = pCoGetApartmentType(&type, &qualifier);
3273 ok(hr == CO_E_NOTINITIALIZED, "CoGetApartmentType succeeded, error: 0x%08lx\n", hr);
3274 ok(type == APTTYPE_CURRENT, "Expected APTTYPE_CURRENT, got %u\n", type);
3275 ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3276
3277 type = 0xdeadbeef;
3278 qualifier = 0xdeadbeef;
3280 ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08lx\n", hr);
3281 hr = pCoGetApartmentType(&type, &qualifier);
3282 ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08lx\n", hr);
3283 ok(type == APTTYPE_MAINSTA, "Expected APTTYPE_MAINSTA, got %u\n", type);
3284 ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3286
3287 type = 0xdeadbeef;
3288 qualifier = 0xdeadbeef;
3290 ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08lx\n", hr);
3291 hr = pCoGetApartmentType(&type, &qualifier);
3292 ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08lx\n", hr);
3293 ok(type == APTTYPE_MTA, "Expected APTTYPE_MTA, got %u\n", type);
3294 ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3296}
@ COINIT_MULTITHREADED
Definition: objbase.h:280

Referenced by START_TEST().

◆ test_CoGetCallContext()

static void test_CoGetCallContext ( void  )
static

Definition at line 2053 of file compobj.c.

2054{
2055 HRESULT hr;
2056 ULONG refs;
2057 IUnknown *pUnk;
2059
2060 if (!pCoSwitchCallContext)
2061 {
2062 skip("CoSwitchCallContext not present\n");
2063 return;
2064 }
2065
2067
2069 test_object->IUnknown_iface.lpVtbl = &TestCallContext_Vtbl;
2070 test_object->refs = 1;
2071
2072 hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
2073 ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08lx\n", hr);
2074
2075 pUnk = (IUnknown*)0xdeadbeef;
2076 hr = pCoSwitchCallContext(&test_object->IUnknown_iface, &pUnk);
2077 ok_ole_success(hr, "CoSwitchCallContext");
2078 ok(pUnk == NULL, "expected NULL, got %p\n", pUnk);
2079 refs = IUnknown_AddRef(&test_object->IUnknown_iface);
2080 ok(refs == 2, "Expected refcount 2, got %ld\n", refs);
2081 IUnknown_Release(&test_object->IUnknown_iface);
2082
2083 pUnk = (IUnknown*)0xdeadbeef;
2084 hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
2085 ok_ole_success(hr, "CoGetCallContext");
2086 ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n",
2087 &test_object->IUnknown_iface, pUnk);
2088 refs = IUnknown_AddRef(&test_object->IUnknown_iface);
2089 ok(refs == 3, "Expected refcount 3, got %ld\n", refs);
2090 IUnknown_Release(&test_object->IUnknown_iface);
2091 IUnknown_Release(pUnk);
2092
2093 pUnk = (IUnknown*)0xdeadbeef;
2094 hr = pCoSwitchCallContext(NULL, &pUnk);
2095 ok_ole_success(hr, "CoSwitchCallContext");
2096 ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n",
2097 &test_object->IUnknown_iface, pUnk);
2098 refs = IUnknown_AddRef(&test_object->IUnknown_iface);
2099 ok(refs == 2, "Expected refcount 2, got %ld\n", refs);
2100 IUnknown_Release(&test_object->IUnknown_iface);
2101
2102 hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
2103 ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08lx\n", hr);
2104
2105 IUnknown_Release(&test_object->IUnknown_iface);
2106
2108}
#define malloc
Definition: debug_ros.c:4
HRESULT WINAPI CoGetCallContext(REFIID riid, void **obj)
Definition: combase.c:1944
static void test_object(void)
Definition: d3drm.c:1575
static const IUnknownVtbl TestCallContext_Vtbl
Definition: compobj.c:2046
#define RPC_E_CALL_COMPLETE
Definition: winerror.h:3571

Referenced by START_TEST().

◆ test_CoGetClassObject()

static void test_CoGetClassObject ( void  )
static

Definition at line 744 of file compobj.c.

745{
746 HRESULT hr;
749 IUnknown *pUnk;
750 REFCLSID rclsid = &CLSID_InternetZoneManager;
751 HKEY hkey;
752 LONG res;
753
754 hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
755 ok(hr == CO_E_NOTINITIALIZED, "CoGetClassObject should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
756 ok(pUnk == NULL, "CoGetClassObject should have changed the passed in pointer to NULL, instead of %p\n", pUnk);
757
758 hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, NULL);
759 ok(hr == E_INVALIDARG ||
760 broken(hr == CO_E_NOTINITIALIZED), /* win9x */
761 "CoGetClassObject should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
762
763 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
764
765 if (!pRegOverridePredefKey)
766 {
767 win_skip("RegOverridePredefKey not available\n");
768 return;
769 }
770
772
773 hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
774 if (hr == S_OK)
775 {
776 IUnknown_Release(pUnk);
777
778 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0,
779 KEY_ALL_ACCESS, NULL, &hkey, NULL);
780 ok(!res, "RegCreateKeyEx returned %ld\n", res);
781
782 res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
783 ok(!res, "RegOverridePredefKey returned %ld\n", res);
784
785 hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
786 ok(hr == S_OK, "CoGetClassObject should have returned S_OK instead of 0x%08lx\n", hr);
787
788 res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
789 ok(!res, "RegOverridePredefKey returned %ld\n", res);
790
791 if (hr == S_OK) IUnknown_Release(pUnk);
792 RegCloseKey(hkey);
793 }
794
795 hr = CoGetClassObject(&CLSID_InProcFreeMarshaler, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
796 ok(hr == S_OK, "got 0x%08lx\n", hr);
797 IUnknown_Release(pUnk);
798
799 /* context redefines FreeMarshaler CLSID */
801 {
802 hr = CoGetClassObject(&CLSID_InProcFreeMarshaler, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
803 ok(hr == S_OK, "got 0x%08lx\n", hr);
804 IUnknown_Release(pUnk);
805
806 hr = CoGetClassObject(&IID_Testiface7, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
807 ok(hr == 0x80001235 || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* winxp */, "Unexpected hr %#lx.\n", hr);
808
809 hr = CoGetClassObject(&IID_Testiface8, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
810 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
811
813 }
814
816 {
817 struct comclassredirect_data *comclass;
818 ACTCTX_SECTION_KEYED_DATA data;
819 BOOL ret;
820
821 /* This one will load test dll and get back specific error code. */
822 hr = CoGetClassObject(&IID_Testiface7, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
823 ok(hr == 0x80001235 || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* winxp */, "Unexpected hr %#lx.\n", hr);
824
825 hr = CoGetClassObject(&IID_Testiface8, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
826 ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
827
828 memset(&data, 0, sizeof(data));
829 data.cbSize = sizeof(data);
830 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION, &IID_Testiface8, &data);
831 ok(ret, "Section not found.\n");
832
833 memset(&data, 0, sizeof(data));
834 data.cbSize = sizeof(data);
835
836 /* External proxy-stubs are not accessible. */
837 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_Testiface3, &data);
838 ok(!ret, "Unexpected return value.\n");
839
840 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_TestPS, &data);
841 ok(!ret, "Unexpected return value.\n");
842
843 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_Testiface7, &data);
844 ok(ret, "Unexpected return value.\n");
845
846 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_Testiface4, &data);
847 ok(!ret, "Unexpected return value.\n");
848
849 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_Testiface8, &data);
850 ok(ret, "Unexpected return value.\n");
851
852 comclass = data.lpData;
853 if (comclass)
854 {
855 WCHAR *name = (WCHAR *)((char *)data.lpSectionBase + comclass->name_offset);
856 ok(!lstrcmpW(name, L"testlib4.dll"), "Unexpected module name %s.\n", wine_dbgstr_w(name));
857 }
858
860 }
861
863}
#define RegCloseKey(hKey)
Definition: registry.h:49
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:1034
#define ERROR_MOD_NOT_FOUND
Definition: compat.h:104
BOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, const GUID *lpSearchGuid, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:265
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
#define L(x)
Definition: resources.c:13
#define FAILED(hr)
Definition: intsafe.h:51
#define wine_dbgstr_w
Definition: kernel32.h:34
static const GUID IID_Testiface4
Definition: compobj.c:96
static const char actctx_manifest2[]
Definition: compobj.c:351
static const GUID IID_Testiface3
Definition: compobj.c:95
static const GUID IID_Testiface8
Definition: compobj.c:100
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
long LONG
Definition: pedump.c:60
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by START_TEST().

◆ test_CoGetContextToken()

static void test_CoGetContextToken ( void  )
static

Definition at line 2110 of file compobj.c.

2111{
2112 HRESULT hr;
2113 ULONG refs;
2114 ULONG_PTR token, token2;
2116
2117 if (!pCoGetContextToken)
2118 {
2119 win_skip("CoGetContextToken not present\n");
2120 return;
2121 }
2122
2123 token = 0xdeadbeef;
2124 hr = pCoGetContextToken(&token);
2125 ok(hr == CO_E_NOTINITIALIZED, "Expected CO_E_NOTINITIALIZED, got 0x%08lx\n", hr);
2126 ok(token == 0xdeadbeef, "Expected 0, got 0x%Ix\n", token);
2127
2128 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
2129
2131
2133
2134 hr = pCoGetContextToken(NULL);
2135 ok(hr == E_POINTER, "Expected E_POINTER, got 0x%08lx\n", hr);
2136
2137 token = 0;
2138 hr = pCoGetContextToken(&token);
2139 ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
2140 ok(token, "Expected token != 0\n");
2141
2142 token2 = 0;
2143 hr = pCoGetContextToken(&token2);
2144 ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
2145 ok(token2 == token, "got different token\n");
2146
2147 refs = IUnknown_AddRef((IUnknown *)token);
2148 ok(refs == 1, "Expected 1, got %lu\n", refs);
2149
2150 hr = pCoGetObjectContext(&IID_IObjContext, (void **)&ctx);
2151 ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
2152 ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
2153
2154 refs = IObjContext_AddRef(ctx);
2155 ok(refs == 3, "Expected 3, got %lu\n", refs);
2156
2157 refs = IObjContext_Release(ctx);
2158 ok(refs == 2, "Expected 2, got %lu\n", refs);
2159
2160 refs = IUnknown_Release((IUnknown *)token);
2161 ok(refs == 1, "Expected 1, got %lu\n", refs);
2162
2163 /* CoGetContextToken does not add a reference */
2164 token = 0;
2165 hr = pCoGetContextToken(&token);
2166 ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
2167 ok(token, "Expected token != 0\n");
2168 ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
2169
2170 refs = IObjContext_AddRef(ctx);
2171 ok(refs == 2, "Expected 1, got %lu\n", refs);
2172
2173 refs = IObjContext_Release(ctx);
2174 ok(refs == 1, "Expected 0, got %lu\n", refs);
2175
2176 refs = IObjContext_Release(ctx);
2177 ok(refs == 0, "Expected 0, got %lu\n", refs);
2178
2180}

Referenced by START_TEST().

◆ test_CoGetCurrentLogicalThreadId()

static void test_CoGetCurrentLogicalThreadId ( void  )
static

Definition at line 3446 of file compobj.c.

3447{
3448 HRESULT hr;
3449 GUID id;
3450
3452 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3453
3454 id = GUID_NULL;
3456 ok(hr == S_OK, "got 0x%08lx\n", hr);
3457 ok(!IsEqualGUID(&id, &GUID_NULL), "got null id\n");
3458}
HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *id)
Definition: combase.c:2714
GLuint id
Definition: glext.h:5910
#define GUID_NULL
Definition: ks.h:106

Referenced by START_TEST().

◆ test_CoGetCurrentProcess()

static void test_CoGetCurrentProcess ( void  )
static

Definition at line 4050 of file compobj.c.

4051{
4052 DWORD id, id2;
4053 HANDLE thread;
4054
4055 id = CoGetCurrentProcess();
4056 ok(!!id && id != GetCurrentProcessId() && id != GetCurrentThreadId(), "Unexpected result %ld.\n", id);
4057
4058 id2 = 0;
4060 ok(thread != NULL, "Failed to create test thread.\n");
4061 ok(!WaitForSingleObject(thread, 10000), "Wait timed out.\n");
4063
4064 ok(id2 && id2 != id, "Unexpected id from another thread.\n");
4065}
static DWORD WINAPI co_get_current_process_thread(void *param)
Definition: compobj.c:4042
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1156

Referenced by START_TEST().

◆ test_CoGetInstanceFromFile()

static void test_CoGetInstanceFromFile ( void  )
static

Definition at line 3804 of file compobj.c.

3805{
3806 static const WCHAR filenameW[] = {'d','u','m','m','y','p','a','t','h',0};
3807 CLSID *clsid = (CLSID*)&CLSID_testclsid;
3808 MULTI_QI mqi[2];
3809 DWORD cookie;
3810 HRESULT hr;
3811
3813 ok(hr == S_OK, "got 0x%08lx\n", hr);
3814
3815 /* CLSID is not specified, file does not exist */
3816 mqi[0].pIID = &IID_IUnknown;
3817 mqi[0].pItf = NULL;
3818 mqi[0].hr = E_NOTIMPL;
3819 hr = CoGetInstanceFromFile(NULL, NULL, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3820 todo_wine
3821 ok(hr == MK_E_CANTOPENFILE, "got 0x%08lx\n", hr);
3822 ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3823 ok(mqi[0].hr == E_NOINTERFACE, "got 0x%08lx\n", mqi[0].hr);
3824
3825 /* class is not available */
3826 mqi[0].pIID = &IID_IUnknown;
3827 mqi[0].pItf = NULL;
3828 mqi[0].hr = E_NOTIMPL;
3829 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3830 ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08lx\n", hr);
3831 ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3832 ok(mqi[0].hr == REGDB_E_CLASSNOTREG, "got 0x%08lx\n", mqi[0].hr);
3833
3835 &cookie);
3836 ok(hr == S_OK, "got 0x%08lx\n", hr);
3837
3838 mqi[0].pIID = &IID_IUnknown;
3839 mqi[0].pItf = (void*)0xdeadbeef;
3840 mqi[0].hr = S_OK;
3841 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3842todo_wine {
3843 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3844 ok(mqi[0].pItf == (void*)0xdeadbeef, "got %p\n", mqi[0].pItf);
3845}
3846 ok(mqi[0].hr == S_OK, "got 0x%08lx\n", mqi[0].hr);
3847
3848 mqi[0].pIID = &IID_IUnknown;
3849 mqi[0].pItf = (void*)0xdeadbeef;
3850 mqi[0].hr = E_NOTIMPL;
3851 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3852todo_wine {
3853 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3854 ok(mqi[0].pItf == (void*)0xdeadbeef, "got %p\n", mqi[0].pItf);
3855 ok(mqi[0].hr == E_NOTIMPL, "got 0x%08lx\n", mqi[0].hr);
3856}
3857 mqi[0].pIID = &IID_IUnknown;
3858 mqi[0].pItf = NULL;
3859 mqi[0].hr = E_NOTIMPL;
3860 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3861 ok(hr == S_OK, "got 0x%08lx\n", hr);
3862 ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3863 ok(mqi[0].hr == S_OK, "got 0x%08lx\n", mqi[0].hr);
3864
3865 mqi[0].pIID = &IID_IUnknown;
3866 mqi[0].pItf = NULL;
3867 mqi[0].hr = S_OK;
3868 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3869 ok(hr == S_OK, "got 0x%08lx\n", hr);
3870 ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3871 ok(mqi[0].hr == S_OK, "got 0x%08lx\n", mqi[0].hr);
3872
3873 mqi[0].pIID = &IID_IUnknown;
3874 mqi[0].pItf = NULL;
3875 mqi[0].hr = S_OK;
3877 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3878 ok(hr == S_OK, "got 0x%08lx\n", hr);
3879 ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3880 ok(mqi[0].hr == S_OK, "got 0x%08lx\n", mqi[0].hr);
3882
3883 mqi[0].pIID = &IID_IUnknown;
3884 mqi[0].pItf = NULL;
3885 mqi[0].hr = S_OK;
3886 mqi[1].pIID = &IID_IUnknown;
3887 mqi[1].pItf = NULL;
3888 mqi[1].hr = S_OK;
3889 g_persistfile_qi_ret = 0x8000efef;
3890 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 2, mqi);
3891 ok(hr == 0x8000efef, "got 0x%08lx\n", hr);
3892 ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3893 ok(mqi[0].hr == 0x8000efef, "got 0x%08lx\n", mqi[0].hr);
3894 ok(mqi[1].pItf == NULL, "got %p\n", mqi[1].pItf);
3895 ok(mqi[1].hr == 0x8000efef, "got 0x%08lx\n", mqi[1].hr);
3897
3898 mqi[0].pIID = &IID_IUnknown;
3899 mqi[0].pItf = NULL;
3900 mqi[0].hr = S_OK;
3901 mqi[1].pIID = &IID_IUnknown;
3902 mqi[1].pItf = NULL;
3903 mqi[1].hr = S_OK;
3904 g_persistfile_load_ret = 0x8000fefe;
3905 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 2, mqi);
3906 ok(hr == 0x8000fefe, "got 0x%08lx\n", hr);
3907 ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3908 ok(mqi[0].hr == 0x8000fefe, "got 0x%08lx\n", mqi[0].hr);
3909 ok(mqi[1].pItf == NULL, "got %p\n", mqi[1].pItf);
3910 ok(mqi[1].hr == 0x8000fefe, "got 0x%08lx\n", mqi[1].hr);
3912
3914 ok(hr == S_OK, "got 0x%08lx\n", hr);
3915
3917}
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: combase.c:1575
WCHAR OLECHAR
Definition: compat.h:2292
static const WCHAR filenameW[]
Definition: amstream.c:41
static HRESULT g_persistfile_qi_ret
Definition: compobj.c:3670
static IClassFactory getinstance_cf
Definition: compobj.c:3802
static HRESULT g_persistfile_load_ret
Definition: compobj.c:3671
#define STGM_READ
Definition: objbase.h:934
#define S_FALSE
Definition: winerror.h:3451
#define MK_E_CANTOPENFILE
Definition: winerror.h:3905

Referenced by START_TEST().

◆ test_CoGetInterfaceAndReleaseStream()

static void test_CoGetInterfaceAndReleaseStream ( void  )
static

Definition at line 1495 of file compobj.c.

1496{
1497 HRESULT hr;
1498 IUnknown *pUnk;
1499
1501
1503 ok(hr == E_INVALIDARG, "hr %08lx\n", hr);
1504
1506}
HRESULT WINAPI CoGetInterfaceAndReleaseStream(IStream *stream, REFIID riid, void **obj)
Definition: marshal.c:139

Referenced by START_TEST().

◆ test_CoGetMalloc()

static void test_CoGetMalloc ( void  )
static

Definition at line 3176 of file compobj.c.

3177{
3178 IMalloc *imalloc;
3179 SIZE_T size;
3180 HRESULT hr;
3181 char *ptr;
3182 int ret;
3183
3184 if (0) /* crashes on native */
3185 hr = CoGetMalloc(0, NULL);
3186
3187 imalloc = (void*)0xdeadbeef;
3188 hr = CoGetMalloc(0, &imalloc);
3189 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3190 ok(imalloc == NULL, "got %p\n", imalloc);
3191
3192 imalloc = (void*)0xdeadbeef;
3193 hr = CoGetMalloc(MEMCTX_SHARED, &imalloc);
3194 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3195 ok(imalloc == NULL, "got %p\n", imalloc);
3196
3197 imalloc = (void*)0xdeadbeef;
3198 hr = CoGetMalloc(MEMCTX_MACSYSTEM, &imalloc);
3199 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3200 ok(imalloc == NULL, "got %p\n", imalloc);
3201
3202 imalloc = (void*)0xdeadbeef;
3203 hr = CoGetMalloc(MEMCTX_UNKNOWN, &imalloc);
3204 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3205 ok(imalloc == NULL, "got %p\n", imalloc);
3206
3207 imalloc = (void*)0xdeadbeef;
3208 hr = CoGetMalloc(MEMCTX_SAME, &imalloc);
3209 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3210 ok(imalloc == NULL, "got %p\n", imalloc);
3211
3212 imalloc = NULL;
3213 hr = CoGetMalloc(MEMCTX_TASK, &imalloc);
3214 ok(hr == S_OK, "got 0x%08lx\n", hr);
3215 ok(imalloc != NULL, "got %p\n", imalloc);
3216
3217 /* DidAlloc() */
3218 ptr = IMalloc_Alloc(imalloc, 16);
3219 ok(!!ptr, "Failed to allocate block.\n");
3220
3221 ret = IMalloc_DidAlloc(imalloc, ptr);
3222 ok(ret == 1, "Unexpected return value %d.\n", ret);
3223
3224 ret = IMalloc_DidAlloc(imalloc, NULL);
3225 ok(ret == -1, "Unexpected return value %d.\n", ret);
3226
3227 ret = IMalloc_DidAlloc(imalloc, (void *)0x1);
3228 ok(ret == 0, "Unexpected return value %d.\n", ret);
3229
3230 ret = IMalloc_DidAlloc(imalloc, ptr + 4);
3231 ok(ret == 0, "Unexpected return value %d.\n", ret);
3232
3233 /* GetSize() */
3234 size = IMalloc_GetSize(imalloc, NULL);
3235 ok(size == (SIZE_T)-1, "Unexpected return value.\n");
3236
3237 size = IMalloc_GetSize(imalloc, ptr);
3238 ok(size == 16, "Unexpected return value.\n");
3239
3240 IMalloc_Free(imalloc, ptr);
3241
3242 IMalloc_Release(imalloc);
3243}
HRESULT WINAPI CoGetMalloc(DWORD context, IMalloc **imalloc)
Definition: malloc.c:365
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by START_TEST().

◆ test_CoGetObjectContext()

static void test_CoGetObjectContext ( void  )
static

Definition at line 1909 of file compobj.c.

1910{
1911 HRESULT hr;
1912 ULONG refs;
1913 IComThreadingInfo *pComThreadingInfo, *threadinginfo2;
1914 IContextCallback *pContextCallback;
1915 IObjContext *pObjContext;
1916 APTTYPE apttype;
1917 THDTYPE thdtype;
1918 GUID id, id2;
1919
1920 if (!pCoGetObjectContext)
1921 {
1922 win_skip("CoGetObjectContext not present\n");
1923 return;
1924 }
1925
1926 hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1927 ok(hr == CO_E_NOTINITIALIZED, "CoGetObjectContext should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
1928 ok(pComThreadingInfo == NULL, "pComThreadingInfo should have been set to NULL\n");
1929
1931
1933
1934 hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1935 ok_ole_success(hr, "CoGetObjectContext");
1936
1937 threadinginfo2 = NULL;
1938 hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&threadinginfo2);
1939 ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
1940 ok(pComThreadingInfo == threadinginfo2, "got different instance\n");
1941 IComThreadingInfo_Release(threadinginfo2);
1942
1943 hr = IComThreadingInfo_GetCurrentLogicalThreadId(pComThreadingInfo, NULL);
1944 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
1945
1946 id = id2 = GUID_NULL;
1947 hr = IComThreadingInfo_GetCurrentLogicalThreadId(pComThreadingInfo, &id);
1948 ok(hr == S_OK, "got 0x%08lx\n", hr);
1949
1951 ok(IsEqualGUID(&id, &id2), "got %s, expected %s\n", wine_dbgstr_guid(&id), wine_dbgstr_guid(&id2));
1952
1953 hr = IComThreadingInfo_GetCurrentApartmentType(pComThreadingInfo, &apttype);
1954 ok_ole_success(hr, "IComThreadingInfo_GetCurrentApartmentType");
1955 ok(apttype == APTTYPE_MAINSTA, "apartment type should be APTTYPE_MAINSTA instead of %d\n", apttype);
1956
1957 hr = IComThreadingInfo_GetCurrentThreadType(pComThreadingInfo, &thdtype);
1958 ok_ole_success(hr, "IComThreadingInfo_GetCurrentThreadType");
1959 ok(thdtype == THDTYPE_PROCESSMESSAGES, "thread type should be THDTYPE_PROCESSMESSAGES instead of %d\n", thdtype);
1960
1961 refs = IComThreadingInfo_Release(pComThreadingInfo);
1962 ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %ld refs\n", refs);
1963
1964 hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
1965 ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
1966
1967 refs = IContextCallback_Release(pContextCallback);
1968 ok(refs == 0, "pContextCallback should have 0 refs instead of %ld refs\n", refs);
1969
1971
1973
1974 hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1975 ok_ole_success(hr, "CoGetObjectContext");
1976
1977 hr = IComThreadingInfo_GetCurrentApartmentType(pComThreadingInfo, &apttype);
1978 ok_ole_success(hr, "IComThreadingInfo_GetCurrentApartmentType");
1979 ok(apttype == APTTYPE_MTA, "apartment type should be APTTYPE_MTA instead of %d\n", apttype);
1980
1981 hr = IComThreadingInfo_GetCurrentThreadType(pComThreadingInfo, &thdtype);
1982 ok_ole_success(hr, "IComThreadingInfo_GetCurrentThreadType");
1983 ok(thdtype == THDTYPE_BLOCKMESSAGES, "thread type should be THDTYPE_BLOCKMESSAGES instead of %d\n", thdtype);
1984
1985 refs = IComThreadingInfo_Release(pComThreadingInfo);
1986 ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %ld refs\n", refs);
1987
1988 hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
1989 ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
1990
1991 refs = IContextCallback_Release(pContextCallback);
1992 ok(refs == 0, "pContextCallback should have 0 refs instead of %ld refs\n", refs);
1993
1994 hr = pCoGetObjectContext(&IID_IObjContext, (void **)&pObjContext);
1995 ok_ole_success(hr, "CoGetObjectContext");
1996
1997 refs = IObjContext_Release(pObjContext);
1998 ok(refs == 0, "pObjContext should have 0 refs instead of %ld refs\n", refs);
1999
2001}
enum _THDTYPE THDTYPE
@ THDTYPE_PROCESSMESSAGES
@ THDTYPE_BLOCKMESSAGES

Referenced by START_TEST().

◆ test_CoGetPSClsid()

static void test_CoGetPSClsid ( void  )
static

Definition at line 1319 of file compobj.c.

1320{
1322 HANDLE handle;
1323 HRESULT hr;
1324 CLSID clsid;
1325 HKEY hkey;
1326 LONG res;
1327 const BOOL is_win64 = (sizeof(void*) != sizeof(int));
1329
1332 "CoGetPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n",
1333 hr);
1334
1336
1338 ok_ole_success(hr, "CoGetPSClsid");
1339
1342 "CoGetPSClsid for random IID returned 0x%08lx instead of REGDB_E_IIDNOTREG\n",
1343 hr);
1344
1346 ok(hr == E_INVALIDARG,
1347 "CoGetPSClsid for null clsid returned 0x%08lx instead of E_INVALIDARG\n",
1348 hr);
1349
1350 if (!pRegOverridePredefKey)
1351 {
1352 win_skip("RegOverridePredefKey not available\n");
1354 return;
1355 }
1357 ok_ole_success(hr, "CoGetPSClsid");
1358
1359 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0,
1360 KEY_ALL_ACCESS, NULL, &hkey, NULL);
1361 ok(!res, "RegCreateKeyEx returned %ld\n", res);
1362
1363 res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
1364 ok(!res, "RegOverridePredefKey returned %ld\n", res);
1365
1367 ok_ole_success(hr, "CoGetPSClsid");
1368
1369 res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
1370 ok(!res, "RegOverridePredefKey returned %ld\n", res);
1371
1372 RegCloseKey(hkey);
1373
1374 /* not registered CLSID */
1376 ok(hr == REGDB_E_IIDNOTREG, "got 0x%08lx\n", hr);
1377
1379 {
1380 memset(&clsid, 0, sizeof(clsid));
1382 ok(hr == S_OK, "got 0x%08lx\n", hr);
1383 ok(IsEqualGUID(&clsid, &IID_Testiface), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1384
1385 memset(&clsid, 0, sizeof(clsid));
1387 ok(hr == S_OK, "got 0x%08lx\n", hr);
1388 ok(IsEqualGUID(&clsid, &IID_Testiface2), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1389
1390 memset(&clsid, 0, sizeof(clsid));
1392 ok(hr == S_OK, "got 0x%08lx\n", hr);
1393 ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1394
1395 memset(&clsid, 0xaa, sizeof(clsid));
1397 ok(hr == S_OK, "got 0x%08lx\n", hr);
1398 ok(IsEqualGUID(&clsid, &GUID_NULL), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1399
1400 memset(&clsid, 0xaa, sizeof(clsid));
1402 ok(hr == S_OK, "Failed to get PS CLSID, hr %#lx.\n", hr);
1403 ok(IsEqualGUID(&clsid, &IID_Testiface7), "Unexpected CLSID %s.\n", wine_dbgstr_guid(&clsid));
1404
1405 /* register same interface and try to get CLSID back */
1407 ok(hr == S_OK, "got 0x%08lx\n", hr);
1408 memset(&clsid, 0, sizeof(clsid));
1410 ok(hr == S_OK, "got 0x%08lx\n", hr);
1411 ok(IsEqualGUID(&clsid, &IID_Testiface4), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1412
1414 }
1415
1416 if (pRegDeleteKeyExA &&
1417 (is_win64 ||
1418 (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64)))
1419 {
1420 static GUID IID_DeadBeef = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}};
1421 static const char clsidDeadBeef[] = "{deadbeef-dead-beef-dead-beefdeadbeef}";
1422 static const char clsidA[] = "{66666666-8888-7777-6666-555555555555}";
1423 HKEY hkey_iface, hkey_psclsid;
1425
1426 hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
1427 ok(hr == REGDB_E_IIDNOTREG, "got 0x%08lx\n", hr);
1428
1429 res = RegCreateKeyExA(HKEY_CLASSES_ROOT, "Interface",
1430 0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_iface, NULL);
1431 ok(!res, "RegCreateKeyEx returned %ld\n", res);
1432 res = RegCreateKeyExA(hkey_iface, clsidDeadBeef,
1433 0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey, NULL);
1434 if (res == ERROR_ACCESS_DENIED)
1435 {
1436 win_skip("Failed to create a key, skipping some of CoGetPSClsid() tests\n");
1437 goto cleanup;
1438 }
1439
1440 ok(!res, "RegCreateKeyEx returned %ld\n", res);
1441 res = RegCreateKeyExA(hkey, "ProxyStubClsid32",
1442 0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_psclsid, NULL);
1443 ok(!res, "RegCreateKeyEx returned %ld\n", res);
1444 res = RegSetValueExA(hkey_psclsid, NULL, 0, REG_SZ, (const BYTE *)clsidA, strlen(clsidA)+1);
1445 ok(!res, "RegSetValueEx returned %ld\n", res);
1446 RegCloseKey(hkey_psclsid);
1447
1448 hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
1449 ok_ole_success(hr, "CoGetPSClsid");
1450 ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1451
1452 res = pRegDeleteKeyExA(hkey, "ProxyStubClsid32", opposite, 0);
1453 ok(!res, "RegDeleteKeyEx returned %ld\n", res);
1454 RegCloseKey(hkey);
1455 res = pRegDeleteKeyExA(hkey_iface, clsidDeadBeef, opposite, 0);
1456 ok(!res, "RegDeleteKeyEx returned %ld\n", res);
1457
1458 cleanup:
1459 RegCloseKey(hkey_iface);
1460 }
1461
1463}
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799
#define GetCurrentProcess()
Definition: compat.h:759
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
static void cleanup(void)
Definition: main.c:1335
BOOL is_wow64
Definition: main.c:38
static const BOOL is_win64
Definition: kernelbase.h:49
#define REG_SZ
Definition: layer.c:22
static const GUID IID_Testiface
Definition: compobj.c:93
static const GUID IID_Testiface2
Definition: compobj.c:94
#define REGDB_E_IIDNOTREG
Definition: winerror.h:3802
ACCESS_MASK REGSAM
Definition: winreg.h:76
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ test_CoInitializeEx()

static void test_CoInitializeEx ( void  )
static

Definition at line 2282 of file compobj.c.

2283{
2284 HRESULT hr;
2285
2287 ok(hr == S_OK, "CoInitializeEx failed with error 0x%08lx\n", hr);
2288
2289 /* Calling OleInitialize for the first time should yield S_OK even with
2290 * apartment already initialized by previous CoInitialize(Ex) calls. */
2292 ok(hr == S_OK, "OleInitialize failed with error 0x%08lx\n", hr);
2293
2294 /* Subsequent calls to OleInitialize should return S_FALSE */
2296 ok(hr == S_FALSE, "Expected S_FALSE, hr = 0x%08lx\n", hr);
2297
2298 /* Cleanup */
2302}

Referenced by START_TEST().

◆ test_CoMarshalInterface()

static void test_CoMarshalInterface ( void  )
static

Definition at line 1509 of file compobj.c.

1510{
1511 IStream *pStream;
1512 HRESULT hr;
1513 static const LARGE_INTEGER llZero;
1514
1516
1517 hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
1518 ok_ole_success(hr, "CreateStreamOnHGlobal");
1519
1520 hr = CoMarshalInterface(pStream, &IID_IUnknown, NULL, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1521 ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
1522
1523 hr = CoMarshalInterface(NULL, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1524 ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
1525
1526 hr = CoMarshalInterface(pStream, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1527 ok_ole_success(hr, "CoMarshalInterface");
1528
1529 /* stream not rewound */
1530 hr = CoReleaseMarshalData(pStream);
1531 ok(hr == STG_E_READFAULT, "CoReleaseMarshalData should have returned STG_E_READFAULT instead of 0x%08lx\n", hr);
1532
1533 hr = IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
1534 ok_ole_success(hr, "IStream_Seek");
1535
1536 hr = CoReleaseMarshalData(pStream);
1537 ok_ole_success(hr, "CoReleaseMarshalData");
1538
1539 IStream_Release(pStream);
1540
1542}
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL delete_on_release, IStream **stream)
HRESULT WINAPI CoMarshalInterface(IStream *stream, REFIID riid, IUnknown *unk, DWORD dest_context, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:483
HRESULT WINAPI CoReleaseMarshalData(IStream *stream)
Definition: marshal.c:673
static const LARGE_INTEGER llZero
Definition: moniker.c:1425
#define STG_E_READFAULT
Definition: winerror.h:3671

Referenced by START_TEST().

◆ test_CoMarshalInterThreadInterfaceInStream()

static void test_CoMarshalInterThreadInterfaceInStream ( void  )
static

Definition at line 1544 of file compobj.c.

1545{
1546 IStream *pStream;
1547 HRESULT hr;
1548 IClassFactory *pProxy;
1549
1551
1552 cLocks = 0;
1553
1555 ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
1556
1558 ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
1559
1560 ok_no_locks();
1561
1563 ok_ole_success(hr, "CoMarshalInterThreadInterfaceInStream");
1564
1566
1567 hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
1568 ok_ole_success(hr, "CoUnmarshalInterface");
1569
1570 IClassFactory_Release(pProxy);
1571 IStream_Release(pStream);
1572
1573 ok_no_locks();
1574
1576}
HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, IUnknown *unk, IStream **stream)
Definition: marshal.c:154
#define ok_more_than_one_lock()
Definition: compobj.c:88
#define ok_no_locks()
Definition: compobj.c:89

Referenced by START_TEST().

◆ test_CoRegisterClassObject()

static void test_CoRegisterClassObject ( void  )
static

Definition at line 1578 of file compobj.c.

1579{
1580 ULONG_PTR ctxcookie;
1581 HANDLE handle;
1582 DWORD cookie;
1583 HRESULT hr;
1584 IClassFactory *pcf;
1585
1587
1588 /* CLSCTX_INPROC_SERVER */
1590 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1591 ok_ole_success(hr, "CoRegisterClassObject");
1593 ok_ole_success(hr, "CoRevokeClassObject");
1594
1596 CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie);
1597 ok_ole_success(hr, "CoRegisterClassObject");
1599 ok_ole_success(hr, "CoRevokeClassObject");
1600
1602 CLSCTX_INPROC_SERVER, REGCLS_MULTI_SEPARATE, &cookie);
1603 ok_ole_success(hr, "CoRegisterClassObject");
1605 ok_ole_success(hr, "CoRevokeClassObject");
1606
1607 /* CLSCTX_LOCAL_SERVER */
1609 CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1610 ok_ole_success(hr, "CoRegisterClassObject");
1612 ok_ole_success(hr, "CoRevokeClassObject");
1613
1615 CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &cookie);
1616 ok_ole_success(hr, "CoRegisterClassObject");
1618 ok_ole_success(hr, "CoRevokeClassObject");
1619
1621 CLSCTX_LOCAL_SERVER, REGCLS_MULTI_SEPARATE, &cookie);
1622 ok_ole_success(hr, "CoRegisterClassObject");
1624 ok_ole_success(hr, "CoRevokeClassObject");
1625
1626 /* CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER */
1628 CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1629 ok_ole_success(hr, "CoRegisterClassObject");
1631 ok_ole_success(hr, "CoRevokeClassObject");
1632
1633 /* test whether an object that doesn't support IClassFactory can be
1634 * registered for CLSCTX_LOCAL_SERVER */
1636 CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1637 ok_ole_success(hr, "CoRegisterClassObject");
1639 ok_ole_success(hr, "CoRevokeClassObject");
1640
1641 /* test whether registered class becomes invalid when apartment is destroyed */
1643 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1644 ok_ole_success(hr, "CoRegisterClassObject");
1645
1648
1649 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL,
1650 &IID_IClassFactory, (void **)&pcf);
1651 ok(hr == REGDB_E_CLASSNOTREG, "object registered in an apartment shouldn't accessible after it is destroyed\n");
1652
1653 /* crashes with at least win9x DCOM! */
1654 if (0)
1656
1657 /* test that object is accessible */
1660 ok(hr == S_OK, "got 0x%08lx\n", hr);
1661
1662 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1663 ok(hr == S_OK, "got 0x%08lx\n", hr);
1664 IClassFactory_Release(pcf);
1665
1666 /* context now contains CLSID_WineOOPTest, test if registered one could still be used */
1667 if ((handle = activate_context(actctx_manifest, &ctxcookie)))
1668 {
1669 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1670 ok(hr == 0x80001234 || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* winxp */, "Unexpected hr %#lx.\n", hr);
1671
1672 deactivate_context(handle, ctxcookie);
1673 }
1674
1675 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1676 ok(hr == S_OK, "got 0x%08lx\n", hr);
1677 IClassFactory_Release(pcf);
1678
1680 ok(hr == S_OK, "got 0x%08lx\n", hr);
1681
1683}
@ REGCLS_MULTI_SEPARATE
Definition: objbase.h:397

Referenced by START_TEST().

◆ test_CoRegisterMessageFilter()

static void test_CoRegisterMessageFilter ( void  )
static

Definition at line 990 of file compobj.c.

991{
992 HRESULT hr;
993 IMessageFilter *prev_filter;
994
995 hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
997 "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08lx\n",
998 hr);
999
1001 prev_filter = (IMessageFilter *)0xdeadbeef;
1002 hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
1004 "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08lx\n",
1005 hr);
1006 ok(prev_filter == (IMessageFilter *)0xdeadbeef,
1007 "prev_filter should have been set to %p\n", prev_filter);
1009
1011
1013 ok_ole_success(hr, "CoRegisterMessageFilter");
1014
1015 prev_filter = (IMessageFilter *)0xdeadbeef;
1016 hr = CoRegisterMessageFilter(NULL, &prev_filter);
1017 ok_ole_success(hr, "CoRegisterMessageFilter");
1018 ok(prev_filter == NULL, "prev_filter should have been set to NULL instead of %p\n", prev_filter);
1019
1020 hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
1021 ok_ole_success(hr, "CoRegisterMessageFilter");
1022 ok(prev_filter == NULL, "prev_filter should have been set to NULL instead of %p\n", prev_filter);
1023
1025 ok_ole_success(hr, "CoRegisterMessageFilter");
1026
1028}
static IMessageFilter MessageFilter
Definition: compobj.c:988

Referenced by START_TEST().

◆ test_CoRegisterPSClsid()

static void test_CoRegisterPSClsid ( void  )
static

Definition at line 1216 of file compobj.c.

1217{
1218 HRESULT hr;
1219 DWORD dwRegistrationKey;
1220 IStream *stream;
1221 CLSID clsid;
1222 HANDLE thread;
1223 DWORD tid;
1224
1226 ok(hr == CO_E_NOTINITIALIZED, "CoRegisterPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
1227
1229
1231 CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &dwRegistrationKey);
1232 ok_ole_success(hr, "CoRegisterClassObject");
1233
1235 ok_ole_success(hr, "CoRegisterPSClsid");
1236
1238 ok_ole_success(hr, "CoGetPSClsid");
1239 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1241
1243 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1244 ok(!WaitForSingleObject(thread, 10000), "wait timed out\n");
1246
1248 ok_ole_success(hr, "CoGetPSClsid");
1249 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1251
1253 ok_ole_success(hr, "CreateStreamOnHGlobal");
1254
1255 SET_EXPECT(CreateStub);
1256 hr = CoMarshalInterface(stream, &IID_IWineTest, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1257 ok(hr == E_NOTIMPL, "CoMarshalInterface should have returned E_NOTIMPL instead of 0x%08lx\n", hr);
1258 CHECK_CALLED(CreateStub, 1);
1259
1261 ok_ole_success(hr, "CoGetPSClsid");
1262
1263 hr = CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IPSFactoryBuffer, (void **)&ps_factory_buffer);
1264 ok_ole_success(hr, "CoGetClassObject");
1265
1267 ok_ole_success(hr, "CoRegisterPSClsid");
1268
1269 SET_EXPECT(CreateStub);
1270 hr = CoMarshalInterface(stream, &IID_IEnumOLEVERB, (IUnknown*)&EnumOLEVERB, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1271 ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08lx\n", hr);
1272 CHECK_CALLED(CreateStub, 1);
1273
1274 hr = CoMarshalInterface(stream, &IID_IEnumOLEVERB, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1275 ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08lx\n", hr);
1276
1277 IStream_Release(stream);
1278 IPSFactoryBuffer_Release(ps_factory_buffer);
1280
1281 hr = CoRevokeClassObject(dwRegistrationKey);
1282 ok_ole_success(hr, "CoRevokeClassObject");
1283
1285
1287
1289 ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08lx\n", hr);
1290
1292 ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08lx\n", hr);
1293
1295
1297
1299 ok_ole_success(hr, "CoRegisterPSClsid");
1300
1302 ok_ole_success(hr, "CoGetPSClsid");
1303 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1305
1307 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1308 ok(!WaitForSingleObject(thread, 10000), "wait timed out\n");
1310
1312 ok_ole_success(hr, "CoGetPSClsid");
1313 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1315
1317}
#define SET_EXPECT(func)
Definition: compobj.c:45
static DWORD CALLBACK register_ps_clsid_thread(void *context)
Definition: compobj.c:1195
#define CHECK_CALLED(func, n)
Definition: compobj.c:60

Referenced by START_TEST().

◆ test_CoUnmarshalInterface()

static void test_CoUnmarshalInterface ( void  )
static

Definition at line 1466 of file compobj.c.

1467{
1468 IUnknown *pProxy;
1469 IStream *pStream;
1470 HRESULT hr;
1471
1472 hr = CoUnmarshalInterface(NULL, &IID_IUnknown, (void **)&pProxy);
1473 ok(hr == E_INVALIDARG, "CoUnmarshalInterface should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
1474
1475 hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
1476 ok_ole_success(hr, "CreateStreamOnHGlobal");
1477
1478 hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)&pProxy);
1479 todo_wine
1480 ok(hr == CO_E_NOTINITIALIZED, "CoUnmarshalInterface should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
1481
1483
1484 hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)&pProxy);
1485 ok(hr == STG_E_READFAULT, "CoUnmarshalInterface should have returned STG_E_READFAULT instead of 0x%08lx\n", hr);
1486
1488
1490 ok(hr == E_INVALIDARG, "CoUnmarshalInterface should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
1491
1492 IStream_Release(pStream);
1493}

Referenced by START_TEST().

◆ test_CoWaitForMultipleHandles()

static void test_CoWaitForMultipleHandles ( void  )
static

Definition at line 2791 of file compobj.c.

2792{
2793 HANDLE handles[2], thread;
2794 DWORD index, tid;
2795 WNDCLASSEXA wc;
2796 BOOL success;
2797 HRESULT hr;
2798 HWND hWnd;
2799 MSG msg;
2800
2802 ok(hr == S_OK, "CoInitializeEx failed with error 0x%08lx\n", hr);
2803
2804 memset(&wc, 0, sizeof(wc));
2805 wc.cbSize = sizeof(wc);
2809 wc.hbrBackground = NULL;
2812 success = RegisterClassExA(&wc) != 0;
2813 ok(success, "RegisterClassExA failed %lu\n", GetLastError());
2814
2815 hWnd = CreateWindowExA(0, cls_name, "Test", WS_TILEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0);
2816 ok(hWnd != 0, "CreateWindowExA failed %lu\n", GetLastError());
2817 handles[0] = CreateSemaphoreA(NULL, 1, 1, NULL);
2818 ok(handles[0] != 0, "CreateSemaphoreA failed %lu\n", GetLastError());
2819 handles[1] = CreateSemaphoreA(NULL, 1, 1, NULL);
2820 ok(handles[1] != 0, "CreateSemaphoreA failed %lu\n", GetLastError());
2821
2822 /* test without flags */
2823
2826 ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08lx\n", hr);
2828 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2829
2830 index = 0xdeadbeef;
2832 hr = CoWaitForMultipleHandles(0, 50, 0, NULL, &index);
2833 ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08lx\n", hr);
2834 ok(index == 0, "expected index 0, got %lu\n", index);
2836 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2837
2838 index = 0xdeadbeef;
2841 ok(hr == RPC_E_NO_SYNC, "expected RPC_E_NO_SYNC, got 0x%08lx\n", hr);
2842 ok(index == 0, "expected index 0, got %lu\n", index);
2844 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2845
2846 index = 0xdeadbeef;
2849 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2850 ok(index == 0, "expected index 0, got %lu\n", index);
2852 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2853
2854 index = 0xdeadbeef;
2857 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2858 ok(index == 1, "expected index 1, got %lu\n", index);
2860 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2861
2862 index = 0xdeadbeef;
2865 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2866 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2868 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2869
2870 /* test PostMessageA/SendMessageA from a different thread */
2871
2872 index = 0xdeadbeef;
2874 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
2875 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2876 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2877 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2879 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2881 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2883
2884 index = 0xdeadbeef;
2886 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
2887 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2888 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2889 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2891 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2893 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2895
2898
2899 /* test with COWAIT_WAITALL */
2900
2901 index = 0xdeadbeef;
2904 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2905 ok(index == 0, "expected index 0, got %lu\n", index);
2907 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2908
2909 index = 0xdeadbeef;
2912 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2913 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2915 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2916
2919
2920 /* test with COWAIT_ALERTABLE */
2921
2922 index = 0xdeadbeef;
2925 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2926 ok(index == 0, "expected index 0, got %lu\n", index);
2928 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2929
2930 index = 0xdeadbeef;
2933 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2934 ok(index == 1, "expected index 1, got %lu\n", index);
2936 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2937
2938 index = 0xdeadbeef;
2941 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2942 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2944 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2945
2946 index = 0xdeadbeef;
2949 ok(success, "QueueUserAPC failed %lu\n", GetLastError());
2951 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2952 ok(index == WAIT_IO_COMPLETION, "expected index WAIT_IO_COMPLETION, got %lu\n", index);
2954 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2955
2956 /* test with COWAIT_INPUTAVAILABLE (semaphores are still locked) */
2957
2958 index = 0xdeadbeef;
2961 ok(success, "PeekMessageA returned FALSE\n");
2963 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2964 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2966 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2967
2968 index = 0xdeadbeef;
2971 ok(success, "PeekMessageA returned FALSE\n");
2973 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
2975 ok(hr == RPC_S_CALLPENDING || broken(hr == E_INVALIDARG) || broken(hr == S_OK) /* Win 8 */,
2976 "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2977 if (hr != S_OK) ReleaseSemaphore(handles[1], 1, NULL);
2978 ok(index == 0 || broken(index == 1) /* Win 8 */, "expected index 0, got %lu\n", index);
2981 "CoWaitForMultipleHandles didn't pump any messages\n");
2983 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2985
2987 PostMessageA(hWnd, 0, 0, 0);
2989 PostMessageA(hWnd, WM_USER+1, 0, 0);
2990 PostMessageA(hWnd, WM_DDE_FIRST+1, 0, 0);
2992 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
2993
2994 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2995 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2996
3004
3006 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3008
3009 /* test behaviour of WM_QUIT (semaphores are still locked) */
3010
3011 PostMessageA(hWnd, WM_QUIT, 40, 0);
3012 memset(&msg, 0, sizeof(msg));
3014 ok(success, "PeekMessageA failed, error %lu\n", GetLastError());
3015 ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
3016 ok(msg.wParam == 40, "expected msg.wParam = 40, got %Iu\n", msg.wParam);
3018 ok(!success, "PeekMessageA succeeded\n");
3019
3021 PostMessageA(hWnd, WM_QUIT, 40, 0);
3022 PostMessageA(hWnd, 0, 0, 0);
3024 PostMessageA(hWnd, WM_USER+1, 0, 0);
3025 PostMessageA(hWnd, WM_DDE_FIRST+1, 0, 0);
3027 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
3028
3029 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3030 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
3031
3038
3040 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3042
3043 index = 0xdeadbeef;
3045 PostMessageA(hWnd, WM_QUIT, 41, 0);
3047 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
3048 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3049 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
3050 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
3052 todo_wine
3053 ok(success || broken(!success) /* Win 2000/XP/8 */, "PeekMessageA failed, error %lu\n", GetLastError());
3055 ok(!success, "PeekMessageA succeeded\n");
3056 memset(&msg, 0, sizeof(msg));
3058 todo_wine
3059 ok(!success || broken(success) /* Win 2000/XP/8 */, "PeekMessageA succeeded\n");
3060 if (success)
3061 {
3062 ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
3063 ok(msg.wParam == 41, "expected msg.wParam = 41, got %Iu\n", msg.wParam);
3064 }
3066 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3068
3069 index = 0xdeadbeef;
3071 PostMessageA(hWnd, WM_QUIT, 42, 0);
3073 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
3074 hr = CoWaitForMultipleHandles(0, 500, 2, handles, &index);
3075 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
3076 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
3078 ok(!success, "CoWaitForMultipleHandles didn't pump all WM_DDE_FIRST messages\n");
3079 memset(&msg, 0, sizeof(msg));
3081 ok(success, "PeekMessageA failed, error %lu\n", GetLastError());
3082 ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
3083 ok(msg.wParam == 42, "expected msg.wParam = 42, got %Iu\n", msg.wParam);
3085 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3087
3088 PostQuitMessage(43);
3089 memset(&msg, 0, sizeof(msg));
3091 ok(success || broken(!success) /* Win 8 */, "PeekMessageA failed, error %lu\n", GetLastError());
3092 if (!success)
3093 win_skip("PostQuitMessage didn't queue a WM_QUIT message, skipping tests\n");
3094 else
3095 {
3096 ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
3097 ok(msg.wParam == 43, "expected msg.wParam = 43, got %Iu\n", msg.wParam);
3099 ok(!success, "PeekMessageA succeeded\n");
3100
3101 index = 0xdeadbeef;
3103 PostQuitMessage(44);
3105 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
3106 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3107 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
3108 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
3110 ok(success, "PeekMessageA failed, error %lu\n", GetLastError());
3112 ok(!success, "PeekMessageA succeeded\n");
3114 ok(!success, "CoWaitForMultipleHandles didn't remove WM_QUIT messages\n");
3116 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3118
3119 index = 0xdeadbeef;
3121 PostQuitMessage(45);
3123 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
3124 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3125 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
3126 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
3128 ok(success, "PeekMessageA failed, error %lu\n", GetLastError());
3130 ok(!success, "PeekMessageA succeeded\n");
3132 ok(!success, "CoWaitForMultipleHandles didn't remove WM_QUIT messages\n");
3134 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3136 }
3137
3138 /* test message pumping when CoWaitForMultipleHandles is called from non main apartment thread */
3141 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3143
3145
3146 /* If COM was not initialized, messages are neither pumped nor peeked at */
3148 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3149 ok(hr == RPC_S_CALLPENDING, "got %#lx\n", hr);
3151 ok(success == 0, "MsgWaitForMultipleObjects returned %x\n", success);
3153 ok(success, "PeekMessage failed: %lu\n", GetLastError());
3154
3155 /* same in an MTA */
3157
3159 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3160 ok(hr == RPC_S_CALLPENDING, "got %#lx\n", hr);
3162 ok(success == 0, "MsgWaitForMultipleObjects returned %x\n", success);
3164 ok(success, "PeekMessage failed: %lu\n", GetLastError());
3165
3167
3168 CloseHandle(handles[0]);
3169 CloseHandle(handles[1]);
3171
3173 ok(success, "UnregisterClass failed %lu\n", GetLastError());
3174}
#define index(s, c)
Definition: various.h:29
HRESULT WINAPI CoWaitForMultipleHandles(DWORD flags, DWORD timeout, ULONG handle_count, HANDLE *handles, DWORD *index)
Definition: combase.c:2067
DWORD WINAPI QueueUserAPC(IN PAPCFUNC pfnAPC, IN HANDLE hThread, IN ULONG_PTR dwData)
Definition: thread.c:959
GLuint index
Definition: glext.h:6031
static LRESULT CALLBACK cowait_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: compobj.c:2665
static DWORD CALLBACK send_message_thread(LPVOID arg)
Definition: compobj.c:2591
static DWORD CALLBACK send_and_post_user_message_thread(void *arg)
Definition: compobj.c:2598
static void CALLBACK apc_test_proc(ULONG_PTR param)
Definition: compobj.c:2578
static const char cls_name[]
Definition: compobj.c:2614
#define cowait_msgs_expect_queued(a, b)
Definition: compobj.c:2646
#define cowait_msgs_expect_notified(a)
Definition: compobj.c:2633
static void flush_messages(void)
Definition: compobj.c:2659
static DWORD CALLBACK post_message_thread(LPVOID arg)
Definition: compobj.c:2607
static DWORD CALLBACK release_semaphore_thread(LPVOID arg)
Definition: compobj.c:2583
static DWORD CALLBACK test_CoWaitForMultipleHandles_thread(LPVOID arg)
Definition: compobj.c:2701
#define cowait_msgs_expect_empty()
Definition: compobj.c:2623
@ COWAIT_ALERTABLE
Definition: objbase.h:714
@ COWAIT_INPUTAVAILABLE
Definition: objbase.h:715
@ COWAIT_WAITALL
Definition: objbase.h:713
#define WS_TILEDWINDOW
Definition: pedump.c:643
HINSTANCE hInstance
Definition: winuser.h:3308
HCURSOR hCursor
Definition: winuser.h:3310
UINT style
Definition: winuser.h:3304
UINT cbSize
Definition: winuser.h:3303
WNDPROC lpfnWndProc
Definition: winuser.h:3305
LPCSTR lpszClassName
Definition: winuser.h:3313
HBRUSH hbrBackground
Definition: winuser.h:3311
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCSTR lpName OPTIONAL)
Definition: synchansi.c:44
static EFI_HANDLE * handles
Definition: uefidisk.c:118
HANDLE WINAPI GetCurrentThread(void)
Definition: proc.c:1146
#define WAIT_IO_COMPLETION
Definition: winbase.h:388
#define WAIT_OBJECT_0
Definition: winbase.h:383
#define RPC_S_CALLPENDING
Definition: winerror.h:3569
#define RPC_E_NO_SYNC
Definition: winerror.h:3580
#define CS_VREDRAW
Definition: winuser.h:666
#define WM_QUIT
Definition: winuser.h:1651
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
#define MWMO_ALERTABLE
Definition: winuser.h:920
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define CS_HREDRAW
Definition: winuser.h:661
#define QS_ALLPOSTMESSAGE
Definition: winuser.h:893
DWORD WINAPI MsgWaitForMultipleObjectsEx(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask, _In_ DWORD dwFlags)
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define PM_NOREMOVE
Definition: winuser.h:1206
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by START_TEST().

◆ test_CoWaitForMultipleHandles_thread()

static DWORD CALLBACK test_CoWaitForMultipleHandles_thread ( LPVOID  arg)
static

Definition at line 2701 of file compobj.c.

2702{
2704 IStream *stream;
2705 BOOL success;
2706 DWORD index, tid;
2707 HRESULT hr;
2708 HWND hWnd;
2709 UINT uMSG = 0xc065;
2710 MSG msg;
2711 int ret;
2712
2714 ok(hr == S_OK, "CoInitializeEx failed with error 0x%08lx\n", hr);
2715
2716 hWnd = CreateWindowExA(0, cls_name, "Test (thread)", WS_TILEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0);
2717 ok(hWnd != 0, "CreateWindowExA failed %lu\n", GetLastError());
2718
2719 index = 0xdeadbeef;
2722 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2723 ok(index==0 || index==0xdeadbeef/* Win 8 */, "expected index 0, got %lu\n", index);
2725 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2726
2727 index = 0xdeadbeef;
2728 PostMessageA(hWnd, WM_USER, 0, 0);
2730 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2731 ok(index==0 || index==0xdeadbeef/* Win 8 */, "expected index 0, got %lu\n", index);
2733 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2734
2735 /* Even if CoWaitForMultipleHandles does not pump a message it peeks
2736 * at ALL of them */
2737 index = 0xdeadbeef;
2738 PostMessageA(NULL, uMSG, 0, 0);
2739
2741 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2742 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
2743
2744 /* Make sure message was peeked at */
2746 ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %x\n", ret);
2747
2748 /* But not pumped */
2749 success = PeekMessageA(&msg, NULL, uMSG, uMSG, PM_REMOVE);
2750 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2751
2754
2756 ok(hr == S_OK, "CoInitializeEx failed with error 0x%08lx\n", hr);
2757
2759 ok(hr == S_OK, "CreateStreamOnHGlobal failed: %08lx\n", hr);
2760
2761 hr = CoMarshalInterface(stream, &IID_IUnknown, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
2762 ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08lx\n", hr);
2763
2764 event = CreateEventW(NULL, TRUE, FALSE, NULL);
2765
2766 PostQuitMessage(66);
2768
2770 ok(hr == S_OK, "CoRegisterMessageFilter failed: %08lx\n", hr);
2771
2773 ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
2774 hr = CoWaitForMultipleHandles(0, 50, 1, &event, &index);
2775 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
2776 hr = CoWaitForMultipleHandles(0, 200, 1, &thread, &index);
2777 ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
2778 ok(index == WAIT_OBJECT_0, "cowait_unmarshal_thread didn't finish\n");
2780
2782 ok(hr == S_OK, "CoRegisterMessageFilter failed: %08lx\n", hr);
2783
2784 IStream_Release(stream);
2785
2788 return 0;
2789}
struct _cl_event * event
Definition: glext.h:7739
static DWORD CALLBACK cowait_unmarshal_thread(void *arg)
Definition: compobj.c:2674
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587
BOOL WINAPI PostThreadMessageW(_In_ DWORD, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_CoWaitForMultipleHandles().

◆ test_GlobalOptions()

static void test_GlobalOptions ( void  )
static

Definition at line 3919 of file compobj.c.

3920{
3923 HRESULT hres;
3924
3926
3927 hres = CoCreateInstance(&CLSID_GlobalOptions, NULL, CLSCTX_INPROC_SERVER,
3928 &IID_IGlobalOptions, (void**)&global_options);
3929 ok(hres == S_OK || broken(hres == E_NOINTERFACE), "CoCreateInstance(CLSID_GlobalOptions) failed: %08lx\n", hres);
3930 if(FAILED(hres))
3931 {
3932 win_skip("CLSID_GlobalOptions not available\n");
3934 return;
3935 }
3936
3937 hres = IGlobalOptions_Query(global_options, 0, &value);
3938 ok(FAILED(hres), "Unexpected hr %#lx.\n", hres);
3939
3940 hres = IGlobalOptions_Query(global_options, COMGLB_PROPERTIES_RESERVED3 + 1, &value);
3941 ok(FAILED(hres), "Unexpected hr %#lx.\n", hres);
3942
3943 value = ~0u;
3944 hres = IGlobalOptions_Query(global_options, COMGLB_EXCEPTION_HANDLING, &value);
3945 ok(hres == S_OK || broken(hres == E_FAIL) /* Vista */, "Unexpected hr %#lx.\n", hres);
3946 if (SUCCEEDED(hres))
3947 ok(value == COMGLB_EXCEPTION_HANDLE, "Unexpected value %Id.\n", value);
3948
3949 IGlobalOptions_Release(global_options);
3950
3951 hres = CoCreateInstance(&CLSID_GlobalOptions, (IUnknown*)0xdeadbeef, CLSCTX_INPROC_SERVER,
3952 &IID_IGlobalOptions, (void**)&global_options);
3953 ok(hres == E_INVALIDARG, "CoCreateInstance(CLSID_GlobalOptions) failed: %08lx\n", hres);
3954
3956}
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hres
Definition: protocol.c:465
@ COMGLB_EXCEPTION_HANDLE
Definition: pdh_main.c:96

Referenced by START_TEST().

◆ Test_IClassFactory_AddRef()

static ULONG WINAPI Test_IClassFactory_AddRef ( LPCLASSFACTORY  iface)
static

Definition at line 150 of file compobj.c.

151{
152 LockModule();
153 return 2; /* non-heap-based object */
154}
static void LockModule(void)
Definition: compobj.c:121

◆ Test_IClassFactory_CreateInstance()

static HRESULT WINAPI Test_IClassFactory_CreateInstance ( LPCLASSFACTORY  iface,
IUnknown pUnkOuter,
REFIID  riid,
LPVOID ppvObj 
)
static

Definition at line 163 of file compobj.c.

168{
169 *ppvObj = NULL;
171 if (pUnkOuter) return CLASS_E_NOAGGREGATION;
172 return E_NOINTERFACE;
173}
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771

◆ Test_IClassFactory_LockServer()

static HRESULT WINAPI Test_IClassFactory_LockServer ( LPCLASSFACTORY  iface,
BOOL  fLock 
)
static

Definition at line 175 of file compobj.c.

178{
179 return S_OK;
180}

◆ Test_IClassFactory_QueryInterface()

static HRESULT WINAPI Test_IClassFactory_QueryInterface ( LPCLASSFACTORY  iface,
REFIID  riid,
LPVOID ppvObj 
)
static

Definition at line 131 of file compobj.c.

135{
136 if (ppvObj == NULL) return E_POINTER;
137
140 {
141 *ppvObj = iface;
142 IClassFactory_AddRef(iface);
143 return S_OK;
144 }
145
146 *ppvObj = NULL;
147 return E_NOINTERFACE;
148}

◆ Test_IClassFactory_Release()

static ULONG WINAPI Test_IClassFactory_Release ( LPCLASSFACTORY  iface)
static

Definition at line 156 of file compobj.c.

157{
158 UnlockModule();
159 return 1; /* non-heap-based object */
160}
static void UnlockModule(void)
Definition: compobj.c:126

◆ test_IIDFromString()

static void test_IIDFromString ( void  )
static

Definition at line 573 of file compobj.c.

574{
575 static const WCHAR cfW[] = {'{','0','0','0','0','0','0','0','1','-','0','0','0','0','-','0','0','0','0','-',
576 'c','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}',0};
577 static const WCHAR brokenW[] = {'{','0','0','0','0','0','0','0','1','-','0','0','0','0','-','0','0','0','0','-',
578 'g','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}',0};
579 static const WCHAR broken2W[] = {'{','0','0','0','0','0','0','0','1','=','0','0','0','0','-','0','0','0','0','-',
580 'g','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}',0};
581 static const WCHAR broken3W[] = {'b','r','o','k','e','n','0','0','1','=','0','0','0','0','-','0','0','0','0','-',
582 'g','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}',0};
583 HRESULT hr;
584 IID iid;
585
587 ok(hr == S_OK, "got 0x%08lx\n", hr);
588 ok(IsEqualIID(&iid, &CLSID_StdFont), "got iid %s\n", wine_dbgstr_guid(&iid));
589
590 memset(&iid, 0xab, sizeof(iid));
591 hr = IIDFromString(NULL, &iid);
592 ok(hr == S_OK, "got 0x%08lx\n", hr);
593 ok(IsEqualIID(&iid, &CLSID_NULL), "got iid %s\n", wine_dbgstr_guid(&iid));
594
595 hr = IIDFromString(cfW, &iid);
596 ok(hr == S_OK, "got 0x%08lx\n", hr);
597 ok(IsEqualIID(&iid, &IID_IClassFactory), "got iid %s\n", wine_dbgstr_guid(&iid));
598
599 /* string starts with a valid IID but is longer */
600 memset(&iid, 0xab, sizeof(iid));
601 hr = IIDFromString(cf_brokenW, &iid);
602 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
603 ok(iid.Data1 == 0xabababab, "Got %s\n", debugstr_guid(&iid));
604
605 /* invalid IID in a valid format */
606 memset(&iid, 0xab, sizeof(iid));
607 hr = IIDFromString(brokenW, &iid);
608 ok(hr == CO_E_IIDSTRING, "got 0x%08lx\n", hr);
609 ok(iid.Data1 == 0x00000001, "Got %s\n", debugstr_guid(&iid));
610
611 memset(&iid, 0xab, sizeof(iid));
612 hr = IIDFromString(broken2W, &iid);
613 ok(hr == CO_E_IIDSTRING, "got 0x%08lx\n", hr);
614 ok(iid.Data1 == 0x00000001, "Got %s\n", debugstr_guid(&iid));
615
616 /* format is broken, but string length is okay */
617 memset(&iid, 0xab, sizeof(iid));
618 hr = IIDFromString(broken3W, &iid);
619 ok(hr == CO_E_IIDSTRING, "got 0x%08lx\n", hr);
620 ok(iid.Data1 == 0xabababab, "Got %s\n", debugstr_guid(&iid));
621
622 /* invalid string */
623 memset(&iid, 0xab, sizeof(iid));
625 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
626 ok(iid.Data1 == 0xabababab, "Got %s\n", debugstr_guid(&iid));
627
628 /* valid ProgID */
629 memset(&iid, 0xab, sizeof(iid));
630 hr = IIDFromString(stdfont, &iid);
631 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
632 ok(iid.Data1 == 0xabababab, "Got %s\n", debugstr_guid(&iid));
633}
HRESULT WINAPI IIDFromString(LPCOLESTR str, IID *iid)
Definition: combase.c:1492
#define CO_E_IIDSTRING
Definition: winerror.h:3920

Referenced by START_TEST().

◆ test_IInitializeSpy()

static void test_IInitializeSpy ( BOOL  mt)
static

Definition at line 3554 of file compobj.c.

3555{
3556 HRESULT hr;
3557
3558 if (mt)
3559 {
3561 ok(hr == S_OK, "CoInitializeEx failed: %#lx\n", hr);
3562 }
3563
3565 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3566
3567 init_cookies[0].QuadPart = 1;
3569 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3570 ok(init_cookies[0].QuadPart == 1, "got wrong cookie\n");
3571
3573 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3574
3575 init_cookies[0].HighPart = 0;
3576 init_cookies[0].LowPart = 1;
3578 ok(hr == S_OK, "got 0x%08lx\n", hr);
3579 ok(init_cookies[0].HighPart == GetCurrentThreadId(), "got high part 0x%08lx, expected 0x%08lx\n", init_cookies[0].HighPart,
3581 if (!mt) ok(init_cookies[0].LowPart == 0, "got wrong low part 0x%lx\n", init_cookies[0].LowPart);
3582
3583 /* register same instance one more time */
3584 init_cookies[1].HighPart = 0;
3585 init_cookies[1].LowPart = 0;
3587 ok(hr == S_OK, "got 0x%08lx\n", hr);
3588 ok(init_cookies[1].HighPart == GetCurrentThreadId(), "got high part 0x%08lx, expected 0x%08lx\n", init_cookies[1].HighPart,
3590 if (!mt) ok(init_cookies[1].LowPart == 1, "got wrong low part 0x%lx\n", init_cookies[1].LowPart);
3591
3592 init_cookies[2].HighPart = 0;
3593 init_cookies[2].LowPart = 0;
3595 ok(hr == S_OK, "got 0x%08lx\n", hr);
3596 ok(init_cookies[2].HighPart == GetCurrentThreadId(), "got high part 0x%08lx, expected 0x%08lx\n", init_cookies[2].HighPart,
3598 if (!mt) ok(init_cookies[2].LowPart == 2, "got wrong low part 0x%lx\n", init_cookies[2].LowPart);
3599
3601 ok(hr == S_OK, "got 0x%08lx\n", hr);
3602
3604 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3605
3606 init_cookies[1].HighPart = 0;
3607 init_cookies[1].LowPart = 0;
3609 ok(hr == S_OK, "got 0x%08lx\n", hr);
3610 ok(init_cookies[1].HighPart == GetCurrentThreadId(), "got high part 0x%08lx, expected 0x%08lx\n", init_cookies[1].HighPart,
3612 if (!mt) ok(init_cookies[1].LowPart == 1, "got wrong low part 0x%lx\n", init_cookies[1].LowPart);
3613
3614 SET_EXPECT(PreInitialize);
3615 SET_EXPECT(PostInitialize);
3617 ok(hr == (mt ? S_FALSE : S_OK), "Failed to initialize COM, hr %#lx.\n", hr);
3618 CHECK_CALLED(PreInitialize, 3);
3619 CHECK_CALLED(PostInitialize, 3);
3620
3621 if (mt)
3622 {
3623 HANDLE thread;
3625 ok(thread != NULL, "CreateThread failed: %lu\n", GetLastError());
3626 ok(!WaitForSingleObject(thread, 1000), "wait failed\n");
3627 }
3628
3629 SET_EXPECT(PreInitialize);
3630 SET_EXPECT(PostInitialize);
3632 ok(hr == S_FALSE, "Failed to initialize COM, hr %#lx.\n", hr);
3633 CHECK_CALLED(PreInitialize, 3);
3634 CHECK_CALLED(PostInitialize, 3);
3635
3636 SET_EXPECT(PreUninitialize);
3637 SET_EXPECT(PostUninitialize);
3639 CHECK_CALLED(PreUninitialize, 3);
3640 CHECK_CALLED(PostUninitialize, 3);
3641
3642 SET_EXPECT(PreUninitialize);
3643 SET_EXPECT(PostUninitialize);
3645 CHECK_CALLED(PreUninitialize, 3);
3646 CHECK_CALLED(PostUninitialize, 3);
3647
3648 if (mt)
3649 {
3650 SET_EXPECT(PreUninitialize);
3651 SET_EXPECT(PostUninitialize);
3653 CHECK_CALLED(PreUninitialize, 3);
3654 CHECK_CALLED(PostUninitialize, 3);
3655 }
3656
3657 SET_EXPECT(PreInitialize);
3658 SET_EXPECT(PostInitialize);
3660 ok(hr == S_OK, "Failed to initialize COM, hr %#lx.\n", hr);
3661 CHECK_CALLED(PreInitialize, 3);
3662 CHECK_CALLED(PostInitialize, 3);
3663
3664 SET_EXPECT(PreUninitialize);
3667 CHECK_CALLED(PreUninitialize, 1);
3668}
HRESULT WINAPI CoRegisterInitializeSpy(IInitializeSpy *spy, ULARGE_INTEGER *cookie)
Definition: combase.c:1983
HRESULT WINAPI CoRevokeInitializeSpy(ULARGE_INTEGER cookie)
Definition: combase.c:2029
static DWORD expected_coinit_flags
Definition: compobj.c:3483
static DWORD WINAPI test_init_spies_proc(void *arg)
Definition: compobj.c:3540
static BOOL revoke_spies_on_uninit
Definition: compobj.c:3485
static ULARGE_INTEGER init_cookies[3]
Definition: compobj.c:3484
static IInitializeSpy testinitialize
Definition: compobj.c:3538
@ COINIT_DISABLE_OLE1DDE
Definition: objbase.h:281
$ULONG LowPart
Definition: ntbasedef.h:581
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
$ULONG HighPart
Definition: ntbasedef.h:582
ret QuadPart
Definition: rtlfuncs.h:3106

Referenced by START_TEST().

◆ test_IMallocSpy()

static void test_IMallocSpy ( void  )
static

Definition at line 3410 of file compobj.c.

3411{
3412 IMalloc *imalloc;
3413 HRESULT hr;
3414
3416 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3417
3419 ok(hr == CO_E_OBJNOTREG, "got 0x%08lx\n", hr);
3420
3422 ok(hr == S_OK, "got 0x%08lx\n", hr);
3423
3425 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3426
3428 ok(hr == CO_E_OBJISREG, "got 0x%08lx\n", hr);
3429
3430 imalloc = NULL;
3431 hr = CoGetMalloc(MEMCTX_TASK, &imalloc);
3432 ok(hr == S_OK, "got 0x%08lx\n", hr);
3433 ok(imalloc != NULL, "got %p\n", imalloc);
3434
3435 IMalloc_Free(imalloc, NULL);
3436
3437 IMalloc_Release(imalloc);
3438
3440 ok(hr == S_OK, "got 0x%08lx\n", hr);
3441
3443 ok(hr == CO_E_OBJNOTREG, "got 0x%08lx\n", hr);
3444}
HRESULT WINAPI CoRevokeMallocSpy(void)
Definition: malloc.c:431
HRESULT WINAPI CoRegisterMallocSpy(IMallocSpy *spy)
Definition: malloc.c:405
static IMallocSpy testspy
Definition: compobj.c:3408
#define CO_E_OBJNOTREG
Definition: winerror.h:3927
#define CO_E_OBJISREG
Definition: winerror.h:3928

Referenced by START_TEST().

◆ test_implicit_mta()

static void test_implicit_mta ( void  )
static

Definition at line 4030 of file compobj.c.

4031{
4032 HANDLE thread;
4033
4035
4037 ok(!WaitForSingleObject(thread, 1000), "wait failed\n");
4038
4040}
static DWORD CALLBACK implicit_mta_proc(void *param)
Definition: compobj.c:3977

Referenced by START_TEST().

◆ test_init_spies_proc()

static DWORD WINAPI test_init_spies_proc ( void arg)
static

Definition at line 3540 of file compobj.c.

3541{
3542 HRESULT hr;
3543
3545 ok(hr == S_OK, "Failed to initialize COM, hr %#lx.\n", hr);
3546
3548 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
3549
3551 return 0;
3552}

Referenced by test_IInitializeSpy().

◆ Test_IUnknown_AddRef()

static ULONG WINAPI Test_IUnknown_AddRef ( IUnknown iface)
static

Definition at line 1103 of file compobj.c.

1104{
1105 return 2; /* non-heap-based object */
1106}

◆ Test_IUnknown_QueryInterface()

static HRESULT WINAPI Test_IUnknown_QueryInterface ( IUnknown iface,
REFIID  riid,
LPVOID ppvObj 
)
static

Definition at line 1083 of file compobj.c.

1087{
1088 if (ppvObj == NULL) return E_POINTER;
1089
1091 *ppvObj = iface;
1092 }else if(IsEqualIID(riid, &IID_IEnumOLEVERB)) {
1093 *ppvObj = &EnumOLEVERB;
1094 }else {
1095 *ppvObj = NULL;
1096 return E_NOINTERFACE;
1097 }
1098
1099 IUnknown_AddRef((IUnknown*)*ppvObj);
1100 return S_OK;
1101}
static IEnumOLEVERB EnumOLEVERB
Definition: compobj.c:1081

◆ Test_IUnknown_Release()

static ULONG WINAPI Test_IUnknown_Release ( IUnknown iface)
static

Definition at line 1108 of file compobj.c.

1109{
1110 return 1; /* non-heap-based object */
1111}

◆ test_mta_usage()

static void test_mta_usage ( void  )
static

Definition at line 4067 of file compobj.c.

4068{
4069 CO_MTA_USAGE_COOKIE cookie, cookie2;
4070 HRESULT hr;
4071
4072 if (!pCoIncrementMTAUsage)
4073 {
4074 win_skip("CoIncrementMTAUsage() is not available.\n");
4075 return;
4076 }
4077
4078 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
4079
4080 cookie = 0;
4081 hr = pCoIncrementMTAUsage(&cookie);
4082 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4083 ok(cookie != NULL, "Unexpected cookie %p.\n", cookie);
4084
4085 cookie2 = 0;
4086 hr = pCoIncrementMTAUsage(&cookie2);
4087 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4088 ok(cookie2 != NULL && cookie2 != cookie, "Unexpected cookie %p.\n", cookie2);
4089
4091
4092 hr = pCoDecrementMTAUsage(cookie);
4093 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4094
4096
4097 hr = pCoDecrementMTAUsage(cookie2);
4098 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4099
4100 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
4101
4103 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4104
4106
4107 cookie = 0;
4108 hr = pCoIncrementMTAUsage(&cookie);
4109 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4110 ok(cookie != NULL, "Unexpected cookie %p.\n", cookie);
4111
4113
4114 hr = pCoDecrementMTAUsage(cookie);
4115 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4116
4118
4119 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
4120}

Referenced by START_TEST().

◆ test_ole_menu()

static void test_ole_menu ( void  )
static

Definition at line 908 of file compobj.c.

909{
910 HWND hwndFrame;
911 HRESULT hr;
912
914 hr = OleSetMenuDescriptor(NULL, hwndFrame, NULL, NULL, NULL);
915 todo_wine ok_ole_success(hr, "OleSetMenuDescriptor");
916
917 DestroyWindow(hwndFrame);
918}
HRESULT WINAPI OleSetMenuDescriptor(HOLEMENU hOleMenu, HWND hwndFrame, HWND hwndActiveObject, LPOLEINPLACEFRAME lpFrame, LPOLEINPLACEACTIVEOBJECT lpActiveObject)
Definition: ole2.c:1856
static ATOM register_dummy_class(void)
Definition: compobj.c:889
#define MAKEINTATOM(i)
Definition: winbase.h:1220
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4417
#define CW_USEDEFAULT
Definition: winuser.h:225

Referenced by START_TEST().

◆ test_OleInitialize_InitCounting()

static void test_OleInitialize_InitCounting ( void  )
static

Definition at line 2304 of file compobj.c.

2305{
2306 HRESULT hr;
2307 IUnknown *pUnk;
2308 REFCLSID rclsid = &CLSID_InternetZoneManager;
2309
2310 /* 1. OleInitialize fails but OleUninitialize is still called: apartment stays initialized */
2312 ok(hr == S_OK, "CoInitializeEx(COINIT_MULTITHREADED) failed with error 0x%08lx\n", hr);
2313
2315 ok(hr == RPC_E_CHANGED_MODE, "OleInitialize should have returned 0x%08lx instead of 0x%08lx\n", RPC_E_CHANGED_MODE, hr);
2317
2318 pUnk = (IUnknown *)0xdeadbeef;
2319 hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
2320 ok(hr == S_OK, "CoCreateInstance should have returned 0x%08lx instead of 0x%08lx\n", S_OK, hr);
2321 if (pUnk) IUnknown_Release(pUnk);
2322
2324
2325 /* 2. Extra multiple OleUninitialize: apartment stays initialized until CoUninitialize */
2326 hr = CoInitialize(NULL);
2327 ok(hr == S_OK, "CoInitialize() failed with error 0x%08lx\n", hr);
2328
2330 ok(hr == S_OK, "OleInitialize should have returned 0x%08lx instead of 0x%08lx\n", S_OK, hr);
2334
2335 pUnk = (IUnknown *)0xdeadbeef;
2336 hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
2337 ok(hr == S_OK, "CoCreateInstance should have returned 0x%08lx instead of 0x%08lx\n", S_OK, hr);
2338 if (pUnk) IUnknown_Release(pUnk);
2339
2341
2342 pUnk = (IUnknown *)0xdeadbeef;
2343 hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
2344 ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned 0x%08lx instead of 0x%08lx\n", CO_E_NOTINITIALIZED, hr);
2345 if (pUnk) IUnknown_Release(pUnk);
2346
2347 /* 3. CoUninitialize does not formally deinit Ole */
2348 hr = CoInitialize(NULL);
2349 ok(hr == S_OK, "CoInitialize() failed with error 0x%08lx\n", hr);
2350
2352 ok(hr == S_OK, "OleInitialize should have returned 0x%08lx instead of 0x%08lx\n", S_OK, hr);
2353
2356
2357 pUnk = (IUnknown *)0xdeadbeef;
2358 hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
2359 ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned 0x%08lx instead of 0x%08lx\n", CO_E_NOTINITIALIZED, hr);
2360 /* COM is not initialized anymore */
2361 if (pUnk) IUnknown_Release(pUnk);
2362
2364 ok(hr == S_FALSE, "OleInitialize should have returned 0x%08lx instead of 0x%08lx\n", S_FALSE, hr);
2365 /* ... but native OleInit returns S_FALSE as if Ole is considered initialized */
2366
2368
2369}
#define RPC_E_CHANGED_MODE
Definition: winerror.h:3554

Referenced by START_TEST().

◆ test_OleRegGetMiscStatus()

static void test_OleRegGetMiscStatus ( void  )
static

Definition at line 2371 of file compobj.c.

2372{
2374 HANDLE handle;
2375 DWORD status;
2376 HRESULT hr;
2377
2378 hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, NULL);
2379 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
2380
2381 status = 0xdeadbeef;
2382 hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, &status);
2383 ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08lx\n", hr);
2384 ok(status == 0, "got 0x%08lx\n", status);
2385
2386 status = -1;
2387 hr = OleRegGetMiscStatus(&CLSID_StdFont, DVASPECT_ICON, &status);
2388 ok(hr == S_OK, "got 0x%08lx\n", hr);
2389 ok(status == 0, "got 0x%08lx\n", status);
2390
2392 {
2393 status = 0;
2394 hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, &status);
2395 ok(hr == S_OK, "got 0x%08lx\n", hr);
2396 ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08lx\n", status);
2397
2398 /* context data takes precedence over registration info */
2399 status = 0;
2400 hr = OleRegGetMiscStatus(&CLSID_StdFont, DVASPECT_ICON, &status);
2401 ok(hr == S_OK, "got 0x%08lx\n", hr);
2402 ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08lx\n", status);
2403
2404 /* there's no such attribute in context */
2405 status = -1;
2406 hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_DOCPRINT, &status);
2407 ok(hr == S_OK, "got 0x%08lx\n", hr);
2408 ok(status == 0, "got 0x%08lx\n", status);
2409
2411 }
2412}
HRESULT WINAPI OleRegGetMiscStatus(REFCLSID clsid, DWORD dwAspect, DWORD *pdwStatus)
Definition: ole2.c:848
@ OLEMISC_RECOMPOSEONRESIZE
Definition: actctx.c:82
Definition: ps.c:97

Referenced by START_TEST().

◆ test_OleRegGetUserType()

static void test_OleRegGetUserType ( void  )
static

Definition at line 2414 of file compobj.c.

2415{
2416 static const WCHAR stdfont_usertypeW[] = {'S','t','a','n','d','a','r','d',' ','F','o','n','t',0};
2417 static const WCHAR stdfont2_usertypeW[] = {'C','L','S','I','D','_','S','t','d','F','o','n','t',0};
2418 static const WCHAR clsidkeyW[] = {'C','L','S','I','D',0};
2419 static const WCHAR defvalueW[] = {'D','e','f','a','u','l','t',' ','N','a','m','e',0};
2420 static const WCHAR auxvalue0W[] = {'A','u','x',' ','N','a','m','e',' ','0',0};
2421 static const WCHAR auxvalue2W[] = {'A','u','x',' ','N','a','m','e',' ','2',0};
2422 static const WCHAR auxvalue3W[] = {'A','u','x',' ','N','a','m','e',' ','3',0};
2423 static const WCHAR auxvalue4W[] = {'A','u','x',' ','N','a','m','e',' ','4',0};
2424
2425 static const char auxvalues[][16] = {
2426 "Aux Name 0",
2427 "Aux Name 1",
2428 "Aux Name 2",
2429 "Aux Name 3",
2430 "Aux Name 4"
2431 };
2432
2433 HKEY clsidhkey, hkey, auxhkey, classkey;
2434 DWORD form, ret, disposition;
2435 WCHAR clsidW[39];
2437 HANDLE handle;
2438 HRESULT hr;
2439 WCHAR *str;
2440 int i;
2441
2442 for (form = 0; form <= USERCLASSTYPE_APPNAME+1; form++) {
2443 hr = OleRegGetUserType(&CLSID_Testclass, form, NULL);
2444 ok(hr == E_INVALIDARG, "form %lu: got 0x%08lx\n", form, hr);
2445
2446 str = (void*)0xdeadbeef;
2447 hr = OleRegGetUserType(&CLSID_Testclass, form, &str);
2448 ok(hr == REGDB_E_CLASSNOTREG, "form %lu: got 0x%08lx\n", form, hr);
2449 ok(str == NULL, "form %lu: got %p\n", form, str);
2450
2451 /* same string returned for StdFont for all form types */
2452 str = NULL;
2454 ok(hr == S_OK, "form %lu: got 0x%08lx\n", form, hr);
2455 ok(!lstrcmpW(str, stdfont_usertypeW) || !lstrcmpW(str, stdfont2_usertypeW) /* winxp */,
2456 "form %lu, got %s\n", form, wine_dbgstr_w(str));
2458 }
2459
2461 {
2462 for (form = 0; form <= USERCLASSTYPE_APPNAME+1; form++) {
2463 str = (void*)0xdeadbeef;
2464 hr = OleRegGetUserType(&CLSID_Testclass, form, &str);
2465 ok(hr == REGDB_E_CLASSNOTREG, "form %lu: got 0x%08lx\n", form, hr);
2466 ok(str == NULL, "form %lu: got %s\n", form, wine_dbgstr_w(str));
2467
2468 /* same string returned for StdFont for all form types */
2469 str = NULL;
2471 ok(hr == S_OK, "form %lu: got 0x%08lx\n", form, hr);
2472 ok(!lstrcmpW(str, stdfont_usertypeW) || !lstrcmpW(str, stdfont2_usertypeW) /* winxp */,
2473 "form %lu, got %s\n", form, wine_dbgstr_w(str));
2475 }
2476
2478 }
2479
2480 /* test using registered CLSID */
2482
2483 ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsidkeyW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &clsidhkey, &disposition);
2484 if (!ret)
2485 {
2486 ret = RegCreateKeyExW(clsidhkey, clsidW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &classkey, NULL);
2487 if (ret)
2488 RegCloseKey(clsidhkey);
2489 }
2490
2491 if (ret == ERROR_ACCESS_DENIED)
2492 {
2493 win_skip("Failed to create test key, skipping some of OleRegGetUserType() tests.\n");
2494 return;
2495 }
2496
2497 ok(!ret, "failed to create a key, error %ld\n", ret);
2498
2499 ret = RegSetValueExW(classkey, NULL, 0, REG_SZ, (const BYTE*)defvalueW, sizeof(defvalueW));
2500 ok(!ret, "got error %ld\n", ret);
2501
2502 ret = RegCreateKeyExA(classkey, "AuxUserType", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &auxhkey, NULL);
2503 ok(!ret, "got error %ld\n", ret);
2504
2505 /* populate AuxUserType */
2506 for (i = 0; i <= 4; i++) {
2507 char name[16];
2508
2509 sprintf(name, "AuxUserType\\%d", i);
2510 ret = RegCreateKeyExA(classkey, name, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL);
2511 ok(!ret, "got error %ld\n", ret);
2512
2513 ret = RegSetValueExA(hkey, NULL, 0, REG_SZ, (const BYTE*)auxvalues[i], strlen(auxvalues[i]));
2514 ok(!ret, "got error %ld\n", ret);
2515 RegCloseKey(hkey);
2516 }
2517
2518 str = NULL;
2520 ok(hr == S_OK, "got 0x%08lx\n", hr);
2521 ok(!lstrcmpW(str, auxvalue0W), "got %s\n", wine_dbgstr_w(str));
2523
2524 str = NULL;
2525 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_FULL, &str);
2526 ok(hr == S_OK, "got 0x%08lx\n", hr);
2527 ok(!lstrcmpW(str, defvalueW), "got %s\n", wine_dbgstr_w(str));
2529
2530 str = NULL;
2531 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_SHORT, &str);
2532 ok(hr == S_OK, "got 0x%08lx\n", hr);
2533 ok(!lstrcmpW(str, auxvalue2W), "got %s\n", wine_dbgstr_w(str));
2535
2536 str = NULL;
2537 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_APPNAME, &str);
2538 ok(hr == S_OK, "got 0x%08lx\n", hr);
2539 ok(!lstrcmpW(str, auxvalue3W), "got %s\n", wine_dbgstr_w(str));
2541
2542 str = NULL;
2543 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_APPNAME+1, &str);
2544 ok(hr == S_OK, "got 0x%08lx\n", hr);
2545 ok(!lstrcmpW(str, auxvalue4W), "got %s\n", wine_dbgstr_w(str));
2547
2548 str = NULL;
2549 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_APPNAME+2, &str);
2550 ok(hr == S_OK, "got 0x%08lx\n", hr);
2551 ok(!lstrcmpW(str, defvalueW), "got %s\n", wine_dbgstr_w(str));
2553
2554 /* registry cleanup */
2555 for (i = 0; i <= 4; i++)
2556 {
2557 char name[2];
2558 sprintf(name, "%d", i);
2559 RegDeleteKeyA(auxhkey, name);
2560 }
2561 RegCloseKey(auxhkey);
2562 RegDeleteKeyA(classkey, "AuxUserType");
2563 RegCloseKey(classkey);
2564 RegDeleteKeyW(clsidhkey, clsidW);
2565 RegCloseKey(clsidhkey);
2566 if (disposition == REG_CREATED_NEW_KEY)
2568}
static const WCHAR clsidW[]
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1224
INT WINAPI StringFromGUID2(REFGUID guid, LPOLESTR str, INT cmax)
Definition: combase.c:1525
HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype)
Definition: ole2.c:668
int form
Definition: main.c:89
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define sprintf
Definition: sprintf.c:45
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1087
const WCHAR * str

Referenced by START_TEST().

◆ test_oletlsdata()

static void test_oletlsdata ( void  )
static

Definition at line 4320 of file compobj.c.

4321{
4322 HANDLE thread;
4323 DWORD flags;
4324 HRESULT hr;
4325 GUID guid;
4326
4327 /* STA */
4328 hr = CoInitialize(NULL);
4329 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4331 ok(flags & OLETLS_APARTMENTTHREADED && !(flags & OLETLS_DISABLE_OLE1DDE), "Unexpected flags %#lx.\n", flags);
4334 ok(!(flags & (OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED | OLETLS_DISABLE_OLE1DDE)), "Unexpected flags %#lx.\n", flags);
4335
4337 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4339 ok(flags & OLETLS_APARTMENTTHREADED && flags & OLETLS_DISABLE_OLE1DDE, "Unexpected flags %#lx.\n", flags);
4342 ok(!(flags & (OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED | OLETLS_DISABLE_OLE1DDE)), "Unexpected flags %#lx.\n", flags);
4343
4344 /* MTA */
4346 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4348 ok(flags & OLETLS_MULTITHREADED && flags & OLETLS_DISABLE_OLE1DDE, "Unexpected flags %#lx.\n", flags);
4349
4350 /* Implicit case. */
4352 ok(thread != NULL, "Failed to create a test thread, error %ld.\n", GetLastError());
4353 ok(!WaitForSingleObject(thread, 5000), "Wait timed out.\n");
4355
4358 ok(!(flags & (OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED | OLETLS_DISABLE_OLE1DDE)), "Unexpected flags %#lx.\n", flags);
4359
4360 /* Thread ID. */
4362 ok(!(flags & OLETLS_UUIDINITIALIZED), "Unexpected flags %#lx.\n", flags);
4363
4365 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
4366
4369 "Unexpected flags %#lx.\n", flags);
4370}
GUID guid
Definition: version.c:147
static DWORD CALLBACK oletlsdata_test_thread(void *arg)
Definition: compobj.c:4303

Referenced by START_TEST().

◆ test_ProgIDFromCLSID()

static void test_ProgIDFromCLSID ( void  )
static

Definition at line 379 of file compobj.c.

380{
381 ULONG_PTR cookie = 0;
384 HRESULT hr;
385
387 ok(hr == S_OK, "ProgIDFromCLSID failed with error 0x%08lx\n", hr);
388 if (hr == S_OK)
389 {
390 ok(!lstrcmpiW(progid, stdfont), "Didn't get expected prog ID\n");
392 }
393
394 progid = (LPWSTR)0xdeadbeef;
396 ok(hr == REGDB_E_CLASSNOTREG, "ProgIDFromCLSID returned %08lx\n", hr);
397 ok(progid == NULL, "ProgIDFromCLSID returns with progid %p\n", progid);
398
400 ok(hr == E_INVALIDARG, "ProgIDFromCLSID should return E_INVALIDARG instead of 0x%08lx\n", hr);
401
403 {
404 static const WCHAR customfontW[] = {'C','u','s','t','o','m','F','o','n','t',0};
405
407 ok(hr == S_OK, "got 0x%08lx\n", hr);
408 ok(!lstrcmpiW(progid, progidW), "got %s\n", wine_dbgstr_w(progid));
410
411 /* try something registered and redirected */
412 progid = NULL;
414 ok(hr == S_OK, "got 0x%08lx\n", hr);
415 ok(!lstrcmpiW(progid, customfontW), "got wrong progid %s\n", wine_dbgstr_w(progid));
417
418 /* classes without default progid, progid list is not used */
419 progid = (void *)0xdeadbeef;
421 ok(hr == REGDB_E_CLASSNOTREG && progid == NULL, "got 0x%08lx, progid %p\n", hr, progid);
422
423 progid = (void *)0xdeadbeef;
425 ok(hr == REGDB_E_CLASSNOTREG && progid == NULL, "got 0x%08lx, progid %p\n", hr, progid);
426
428 }
429}
HRESULT WINAPI DECLSPEC_HOTPATCH ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *progid)
Definition: combase.c:1262
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4171
#define progid(str)
Definition: exdisp.idl:31
static const GUID IID_Testiface6
Definition: compobj.c:98
static const GUID IID_Testiface5
Definition: compobj.c:97
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by START_TEST().

◆ test_registered_object_thread_affinity()

static void test_registered_object_thread_affinity ( void  )
static

Definition at line 1767 of file compobj.c.

1768{
1769 HRESULT hr;
1770 DWORD cookie;
1771 HANDLE thread;
1772 DWORD tid;
1773 DWORD exitcode;
1774
1776
1777 /* CLSCTX_INPROC_SERVER */
1778
1780 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1781 ok_ole_success(hr, "CoRegisterClassObject");
1782
1783 thread = CreateThread(NULL, 0, get_class_object_thread, (LPVOID)CLSCTX_INPROC_SERVER, 0, &tid);
1784 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1785 ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1786 GetExitCodeThread(thread, &exitcode);
1787 hr = exitcode;
1788 ok(hr == REGDB_E_CLASSNOTREG, "CoGetClassObject on inproc object "
1789 "registered in different thread should return REGDB_E_CLASSNOTREG "
1790 "instead of 0x%08lx\n", hr);
1791
1792 hr = get_class_object(CLSCTX_INPROC_SERVER);
1793 ok(hr == S_OK, "CoGetClassObject on inproc object registered in same "
1794 "thread should return S_OK instead of 0x%08lx\n", hr);
1795
1797 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1798 ok ( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1799 GetExitCodeThread(thread, &exitcode);
1800 hr = exitcode;
1801 ok(hr == S_OK, "CoRegisterClassObject with same CLSID but in different thread should return S_OK instead of 0x%08lx\n", hr);
1802
1804 ok_ole_success(hr, "CoRevokeClassObject");
1805
1806 /* CLSCTX_LOCAL_SERVER */
1807
1809 CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &cookie);
1810 ok_ole_success(hr, "CoRegisterClassObject");
1811
1812 thread = CreateThread(NULL, 0, get_class_object_proxy_thread, (LPVOID)CLSCTX_LOCAL_SERVER, 0, &tid);
1813 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1815 {
1816 MSG msg;
1817 while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
1818 {
1821 }
1822 }
1823 GetExitCodeThread(thread, &exitcode);
1824 hr = exitcode;
1825 ok(hr == S_OK, "CoGetClassObject on local server object "
1826 "registered in different thread should return S_OK "
1827 "instead of 0x%08lx\n", hr);
1828
1829 hr = get_class_object(CLSCTX_LOCAL_SERVER);
1830 ok(hr == S_OK, "CoGetClassObject on local server object registered in same "
1831 "thread should return S_OK instead of 0x%08lx\n", hr);
1832
1834 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1835 ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1836 GetExitCodeThread(thread, &exitcode);
1837 hr = exitcode;
1838 ok(hr == RPC_E_WRONG_THREAD || broken(hr == S_OK) /* win8 */, "CoRevokeClassObject called from different "
1839 "thread to where registered should return RPC_E_WRONG_THREAD instead of 0x%08lx\n", hr);
1840
1842 ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
1843 ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1844 GetExitCodeThread(thread, &exitcode);
1845 hr = exitcode;
1846 ok(hr == S_OK, "CoRegisterClassObject with same CLSID but in different "
1847 "thread should return S_OK instead of 0x%08lx\n", hr);
1848
1850 ok_ole_success(hr, "CoRevokeClassObject");
1851
1853}
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:541
static DWORD CALLBACK get_class_object_proxy_thread(LPVOID pv)
Definition: compobj.c:1713
static DWORD CALLBACK register_class_object_thread(LPVOID pv)
Definition: compobj.c:1738
static DWORD CALLBACK revoke_class_object_thread(LPVOID pv)
Definition: compobj.c:1753
static DWORD CALLBACK get_class_object_thread(LPVOID pv)
Definition: compobj.c:1699
#define RPC_E_WRONG_THREAD
Definition: winerror.h:3562
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define QS_ALLINPUT
Definition: winuser.h:914
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)

Referenced by START_TEST().

◆ test_StringFromGUID2()

static void test_StringFromGUID2 ( void  )
static

Definition at line 635 of file compobj.c.

636{
637 WCHAR str[50];
638 int len;
639
640 /* invalid pointer */
641 SetLastError(0xdeadbeef);
643 ok(len == 0, "len: %d (expected 0)\n", len);
644 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %lx\n", GetLastError());
645
646 /* Test corner cases for buffer size */
648 ok(len == 39, "len: %d (expected 39)\n", len);
649 ok(!lstrcmpiW(str, wszCLSID_StdFont),"string wasn't equal for CLSID_StdFont\n");
650
651 memset(str,0,sizeof str);
653 ok(len == 39, "len: %d (expected 39)\n", len);
654 ok(!lstrcmpiW(str, wszCLSID_StdFont),"string wasn't equal for CLSID_StdFont\n");
655
657 ok(len == 0, "len: %d (expected 0)\n", len);
658
660 ok(len == 0, "len: %d (expected 0)\n", len);
661}
#define SetLastError(x)
Definition: compat.h:752
GLenum GLsizei len
Definition: glext.h:6722

Referenced by START_TEST().

◆ test_TreatAsClass()

static void test_TreatAsClass ( void  )
static

Definition at line 2182 of file compobj.c.

2183{
2184 HRESULT hr;
2185 CLSID out;
2186 static GUID deadbeef = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}};
2187 static const char deadbeefA[] = "{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}";
2188 IInternetProtocol *pIP = NULL;
2189 HKEY clsidkey, deadbeefkey;
2190 LONG lr;
2191
2192 hr = CoGetTreatAsClass(&deadbeef,&out);
2193 ok (hr == S_FALSE, "expected S_FALSE got %lx\n",hr);
2194 ok (IsEqualGUID(&out,&deadbeef), "expected to get same clsid back\n");
2195
2197 ok(hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr);
2198 ok(IsEqualGUID(&out, &deadbeef), "expected no change to the clsid\n");
2199
2200 hr = CoGetTreatAsClass(&deadbeef, NULL);
2201 ok(hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr);
2202
2203 lr = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ, &clsidkey);
2204 ok(!lr, "Couldn't open CLSID key, error %ld\n", lr);
2205
2206 lr = RegCreateKeyExA(clsidkey, deadbeefA, 0, NULL, 0, KEY_WRITE, NULL, &deadbeefkey, NULL);
2207 if (lr) {
2208 win_skip("CoGetTreatAsClass() tests will be skipped (failed to create a test key, error %ld)\n", lr);
2209 RegCloseKey(clsidkey);
2210 return;
2211 }
2212
2213 hr = CoTreatAsClass(&deadbeef, &deadbeef);
2214 ok(hr == REGDB_E_WRITEREGDB, "CoTreatAsClass gave wrong error: %08lx\n", hr);
2215
2216 hr = CoTreatAsClass(&deadbeef, &CLSID_FileProtocol);
2217 if(hr == REGDB_E_WRITEREGDB){
2218 win_skip("Insufficient privileges to use CoTreatAsClass\n");
2219 goto exit;
2220 }
2221 ok(hr == S_OK, "CoTreatAsClass failed: %08lx\n", hr);
2222
2223 hr = CoGetTreatAsClass(&deadbeef, &out);
2224 ok(hr == S_OK, "CoGetTreatAsClass failed: %08lx\n",hr);
2225 ok(IsEqualGUID(&out, &CLSID_FileProtocol), "expected to get substituted clsid\n");
2226
2228
2229 hr = CoCreateInstance(&deadbeef, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pIP);
2230 if(hr == REGDB_E_CLASSNOTREG)
2231 {
2232 win_skip("IE not installed so can't test CoCreateInstance\n");
2233 goto exit;
2234 }
2235
2236 ok(hr == S_OK, "CoCreateInstance failed: %08lx\n", hr);
2237 if(pIP){
2238 IInternetProtocol_Release(pIP);
2239 pIP = NULL;
2240 }
2241
2242 if (pCoCreateInstanceFromApp)
2243 {
2244 MULTI_QI mqi = { 0 };
2245
2246 mqi.pIID = &IID_IInternetProtocol;
2247 hr = pCoCreateInstanceFromApp(&deadbeef, NULL, CLSCTX_INPROC_SERVER, NULL, 1, &mqi);
2248 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
2249
2250 hr = CoCreateInstance(&deadbeef, NULL, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER, &IID_IInternetProtocol,
2251 (void **)&pIP);
2252 ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
2253
2254 hr = CoCreateInstance(&deadbeef, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pIP);
2255 ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
2256 IUnknown_Release(pIP);
2257 }
2258
2259 hr = CoTreatAsClass(&deadbeef, &CLSID_NULL);
2260 ok(hr == S_OK, "CoTreatAsClass failed: %08lx\n", hr);
2261
2262 hr = CoGetTreatAsClass(&deadbeef, &out);
2263 ok(hr == S_FALSE, "expected S_FALSE got %08lx\n", hr);
2264 ok(IsEqualGUID(&out, &deadbeef), "expected to get same clsid back\n");
2265
2266 /* bizarrely, native's CoTreatAsClass takes some time to take effect in CoCreateInstance */
2267 Sleep(200);
2268
2269 hr = CoCreateInstance(&deadbeef, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pIP);
2270 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance gave wrong error: %08lx\n", hr);
2271
2272 if(pIP)
2273 IInternetProtocol_Release(pIP);
2274
2275exit:
2277 RegCloseKey(deadbeefkey);
2278 RegDeleteKeyA(clsidkey, deadbeefA);
2279 RegCloseKey(clsidkey);
2280}
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, CLSID *clsidNew)
Definition: combase.c:1224
HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
Definition: compobj.c:716
#define KEY_READ
Definition: nt_native.h:1026
#define KEY_WRITE
Definition: nt_native.h:1034
#define exit(n)
Definition: config.h:202
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define REGDB_E_WRITEREGDB
Definition: winerror.h:3798

Referenced by START_TEST().

◆ testinitialize_AddRef()

static ULONG WINAPI testinitialize_AddRef ( IInitializeSpy iface)
static

Definition at line 3473 of file compobj.c.

3474{
3475 return 2;
3476}

◆ testinitialize_PostInitialize()

static HRESULT WINAPI testinitialize_PostInitialize ( IInitializeSpy iface,
HRESULT  hr,
DWORD  coinit,
DWORD  aptrefs 
)
static

Definition at line 3494 of file compobj.c.

3495{
3496 CHECK_EXPECT2(PostInitialize);
3497 ok(coinit == expected_coinit_flags, "Unexpected init flags %#lx, expected %#lx.\n", coinit, expected_coinit_flags);
3498 return hr;
3499}
#define CHECK_EXPECT2(func)
Definition: compobj.c:48

◆ testinitialize_PostUninitialize()

static HRESULT WINAPI testinitialize_PostUninitialize ( IInitializeSpy iface,
DWORD  aptrefs 
)
static

Definition at line 3521 of file compobj.c.

3522{
3523 CHECK_EXPECT2(PostUninitialize);
3524 return E_NOTIMPL;
3525}

◆ testinitialize_PreInitialize()

static HRESULT WINAPI testinitialize_PreInitialize ( IInitializeSpy iface,
DWORD  coinit,
DWORD  aptrefs 
)
static

Definition at line 3487 of file compobj.c.

3488{
3489 CHECK_EXPECT2(PreInitialize);
3490 ok(coinit == expected_coinit_flags, "Unexpected init flags %#lx, expected %#lx.\n", coinit, expected_coinit_flags);
3491 return S_OK;
3492}

◆ testinitialize_PreUninitialize()

static HRESULT WINAPI testinitialize_PreUninitialize ( IInitializeSpy iface,
DWORD  aptrefs 
)
static

Definition at line 3501 of file compobj.c.

3502{
3503 HRESULT hr;
3504 CHECK_EXPECT2(PreUninitialize);
3506 {
3508 ok(hr == S_OK, "got 0x%08lx\n", hr);
3509
3511 ok(hr == S_OK, "got 0x%08lx\n", hr);
3512
3514 ok(hr == S_OK, "got 0x%08lx\n", hr);
3515
3517 }
3518 return S_OK;
3519}

◆ testinitialize_QI()

static HRESULT WINAPI testinitialize_QI ( IInitializeSpy iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 3460 of file compobj.c.

3461{
3462 if (IsEqualIID(riid, &IID_IInitializeSpy) || IsEqualIID(riid, &IID_IUnknown))
3463 {
3464 *obj = iface;
3465 IInitializeSpy_AddRef(iface);
3466 return S_OK;
3467 }
3468
3469 *obj = NULL;
3470 return E_NOINTERFACE;
3471}

◆ testinitialize_Release()

static ULONG WINAPI testinitialize_Release ( IInitializeSpy iface)
static

Definition at line 3478 of file compobj.c.

3479{
3480 return 1;
3481}

◆ testinstance_AddRef()

static ULONG WINAPI testinstance_AddRef ( IPersistFile iface)
static

Definition at line 3695 of file compobj.c.

3696{
3697 return 2;
3698}

◆ testinstance_GetClassID()

static HRESULT WINAPI testinstance_GetClassID ( IPersistFile iface,
CLSID clsid 
)
static

Definition at line 3705 of file compobj.c.

3706{
3707 ok(0, "unexpected call\n");
3708 return E_NOTIMPL;
3709}

◆ testinstance_GetCurFile()

static HRESULT WINAPI testinstance_GetCurFile ( IPersistFile iface,
LPOLESTR filename 
)
static

Definition at line 3733 of file compobj.c.

3734{
3735 ok(0, "unexpected call\n");
3736 return E_NOTIMPL;
3737}

◆ testinstance_IsDirty()

static HRESULT WINAPI testinstance_IsDirty ( IPersistFile iface)
static

Definition at line 3711 of file compobj.c.

3712{
3713 ok(0, "unexpected call\n");
3714 return E_NOTIMPL;
3715}

◆ testinstance_Load()

static HRESULT WINAPI testinstance_Load ( IPersistFile iface,
LPCOLESTR  filename,
DWORD  mode 
)
static

Definition at line 3717 of file compobj.c.

3718{
3720}

◆ testinstance_QI()

static HRESULT WINAPI testinstance_QI ( IPersistFile iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 3672 of file compobj.c.

3673{
3674 if (IsEqualIID(riid, &IID_IUnknown)) {
3675 *obj = iface;
3676 IUnknown_AddRef(iface);
3677 return S_OK;
3678 }
3679
3682 *obj = iface;
3683 IUnknown_AddRef(iface);
3684 }
3685 else
3686 *obj = NULL;
3687 return g_persistfile_qi_ret;
3688 }
3689
3690 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
3691 *obj = NULL;
3692 return E_NOINTERFACE;
3693}
const GUID IID_IPersistFile

◆ testinstance_Release()

static ULONG WINAPI testinstance_Release ( IPersistFile iface)
static

Definition at line 3700 of file compobj.c.

3701{
3702 return 1;
3703}

◆ testinstance_Save()

static HRESULT WINAPI testinstance_Save ( IPersistFile iface,
LPCOLESTR  filename,
BOOL  remember 
)
static

Definition at line 3722 of file compobj.c.

3723{
3724 return E_NOTIMPL;
3725}

◆ testinstance_SaveCompleted()

static HRESULT WINAPI testinstance_SaveCompleted ( IPersistFile iface,
LPCOLESTR  filename 
)
static

Definition at line 3727 of file compobj.c.

3728{
3729 ok(0, "unexpected call\n");
3730 return E_NOTIMPL;
3731}

◆ testspy_AddRef()

static ULONG WINAPI testspy_AddRef ( IMallocSpy iface)
static

Definition at line 3310 of file compobj.c.

3311{
3312 return 2;
3313}

◆ testspy_PostAlloc()

static void *WINAPI testspy_PostAlloc ( IMallocSpy iface,
void ptr 
)
static

Definition at line 3326 of file compobj.c.

3327{
3328 ok(0, "unexpected call\n");
3329 return NULL;
3330}

◆ testspy_PostDidAlloc()

static int WINAPI testspy_PostDidAlloc ( IMallocSpy iface,
void ptr,
BOOL  spyed,
int  actual 
)
static

Definition at line 3373 of file compobj.c.

3374{
3375 ok(0, "unexpected call\n");
3376 return 0;
3377}

◆ testspy_PostFree()

static void WINAPI testspy_PostFree ( IMallocSpy iface,
BOOL  spyed 
)
static

Definition at line 3338 of file compobj.c.

3339{
3340 ok(0, "unexpected call\n");
3341}

◆ testspy_PostGetSize()

static SIZE_T WINAPI testspy_PostGetSize ( IMallocSpy iface,
SIZE_T  actual,
BOOL  spyed 
)
static

Definition at line 3361 of file compobj.c.

3362{
3363 ok(0, "unexpected call\n");
3364 return 0;
3365}

◆ testspy_PostHeapMinimize()

static void WINAPI testspy_PostHeapMinimize ( IMallocSpy iface)
static

Definition at line 3384 of file compobj.c.

3385{
3386 ok(0, "unexpected call\n");
3387}

◆ testspy_PostRealloc()

static void *WINAPI testspy_PostRealloc ( IMallocSpy iface,
void ptr,
BOOL  spyed 
)
static

Definition at line 3349 of file compobj.c.

3350{
3351 ok(0, "unexpected call\n");
3352 return NULL;
3353}

◆ testspy_PreAlloc()

static SIZE_T WINAPI testspy_PreAlloc ( IMallocSpy iface,
SIZE_T  cb 
)
static

Definition at line 3320 of file compobj.c.

3321{
3322 ok(0, "unexpected call\n");
3323 return 0;
3324}

◆ testspy_PreDidAlloc()

static void *WINAPI testspy_PreDidAlloc ( IMallocSpy iface,
void ptr,
BOOL  spyed 
)
static

Definition at line 3367 of file compobj.c.

3368{
3369 ok(0, "unexpected call\n");
3370 return NULL;
3371}

◆ testspy_PreFree()

static void *WINAPI testspy_PreFree ( IMallocSpy iface,
void ptr,
BOOL  spyed 
)
static

Definition at line 3332 of file compobj.c.

3333{
3334 ok(0, "unexpected call\n");
3335 return NULL;
3336}

◆ testspy_PreGetSize()

static void *WINAPI testspy_PreGetSize ( IMallocSpy iface,
void ptr,
BOOL  spyed 
)
static

Definition at line 3355 of file compobj.c.

3356{
3357 ok(0, "unexpected call\n");
3358 return NULL;
3359}

◆ testspy_PreHeapMinimize()

static void WINAPI testspy_PreHeapMinimize ( IMallocSpy iface)
static

Definition at line 3379 of file compobj.c.

3380{
3381 ok(0, "unexpected call\n");
3382}

◆ testspy_PreRealloc()

static SIZE_T WINAPI testspy_PreRealloc ( IMallocSpy iface,
void ptr,
SIZE_T  cb,
void **  newptr,
BOOL  spyed 
)
static

Definition at line 3343 of file compobj.c.

3344{
3345 ok(0, "unexpected call\n");
3346 return 0;
3347}

◆ testspy_QI()

static HRESULT WINAPI testspy_QI ( IMallocSpy iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 3298 of file compobj.c.

3299{
3300 if (IsEqualIID(riid, &IID_IMallocSpy) || IsEqualIID(riid, &IID_IUnknown))
3301 {
3302 *obj = iface;
3303 IMallocSpy_AddRef(iface);
3304 return S_OK;
3305 }
3306
3307 return E_NOINTERFACE;
3308}

◆ testspy_Release()

static ULONG WINAPI testspy_Release ( IMallocSpy iface)
static

Definition at line 3315 of file compobj.c.

3316{
3317 return 1;
3318}

◆ UnlockModule()

static void UnlockModule ( void  )
static

Definition at line 126 of file compobj.c.

127{
129}

Referenced by Test_IClassFactory_Release().

Variable Documentation

◆ actctx_manifest

◆ actctx_manifest2

const char actctx_manifest2[]
static
Initial value:
=
"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
"<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\""
" publicKeyToken=\"6595b6414666f1df\" />"
"<file name=\"testlib.dll\">"
" <comInterfaceProxyStub "
" name=\"Testiface7\""
" iid=\"{52222222-1234-1234-1234-56789abcdef0}\""
" proxyStubClsid32=\"{82222222-1234-1234-1234-56789abcdef0}\""
" threadingModel=\"Apartment\""
" />"
"</file>"
"<file name=\"testlib4.dll\">"
" <comInterfaceProxyStub "
" name=\"Testiface8\""
" iid=\"{92222222-1234-1234-1234-56789abcdef0}\""
" threadingModel=\"Apartment\""
" />"
"</file>"
" <comInterfaceExternalProxyStub "
" name=\"Iifaceps3\""
" iid=\"{42222222-1234-1234-1234-56789abcdef0}\""
" proxyStubClsid32=\"{66666666-8888-7777-6666-555555555555}\""
" />"
"</assembly>"

Definition at line 351 of file compobj.c.

Referenced by test_CoGetClassObject().

◆ cf_brokenW

const WCHAR cf_brokenW[]
static
Initial value:
= {'{','0','0','0','0','0','0','0','1','-','0','0','0','0','-','0','0','0','0','-',
'c','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}','a',0}

Definition at line 113 of file compobj.c.

Referenced by test_CLSIDFromString(), and test_IIDFromString().

◆ cLocks

◆ cls_name

const char cls_name[] = "cowait_test_class"
static

◆ clscontext

◆ CLSID_non_existent

const CLSID CLSID_non_existent = { 0x12345678, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
static

◆ CLSID_StdFont

◆ CLSID_WineTestPSFactoryBuffer

const CLSID CLSID_WineTestPSFactoryBuffer
static
Initial value:
=
{
0x52011640,
0x8164,
0x4fd0,
{0xa1, 0xa2, 0x5d, 0x5a, 0x36, 0x54, 0xd3, 0xbd}
}

Definition at line 1187 of file compobj.c.

Referenced by implicit_mta_proc(), register_ps_clsid_thread(), and test_CoRegisterPSClsid().

◆ count

Definition at line 83 of file compobj.c.

◆ cowait_msgs

UINT cowait_msgs[100]
static

◆ cowait_msgs_first

UINT cowait_msgs_first
static

◆ cowait_msgs_last

UINT cowait_msgs_last
static

◆ create_instance_iid

IID create_instance_iid
static

Definition at line 162 of file compobj.c.

Referenced by test_CoCreateInstanceEx(), and Test_IClassFactory_CreateInstance().

◆ DWORD

Definition at line 80 of file compobj.c.

◆ EnumOLEVERB

Definition at line 1081 of file compobj.c.

Referenced by Test_IUnknown_QueryInterface().

◆ EnumOLEVERBVtbl

const IEnumOLEVERBVtbl EnumOLEVERBVtbl
static
Initial value:
= {
}
static HRESULT WINAPI EnumOLEVERB_Next(IEnumOLEVERB *iface, ULONG celt, OLEVERB *rgelt, ULONG *fetched)
Definition: compobj.c:1047
static HRESULT WINAPI EnumOLEVERB_QueryInterface(IEnumOLEVERB *iface, REFIID riid, void **ppv)
Definition: compobj.c:1032
static ULONG WINAPI EnumOLEVERB_AddRef(IEnumOLEVERB *iface)
Definition: compobj.c:1037
static ULONG WINAPI EnumOLEVERB_Release(IEnumOLEVERB *iface)
Definition: compobj.c:1042
static HRESULT WINAPI EnumOLEVERB_Reset(IEnumOLEVERB *iface)
Definition: compobj.c:1059
static HRESULT WINAPI EnumOLEVERB_Clone(IEnumOLEVERB *iface, IEnumOLEVERB **ppenum)
Definition: compobj.c:1065
static HRESULT WINAPI EnumOLEVERB_Skip(IEnumOLEVERB *iface, ULONG celt)
Definition: compobj.c:1053

Definition at line 1071 of file compobj.c.

◆ expected_coinit_flags

DWORD expected_coinit_flags
static

◆ g_persistfile_load_ret

HRESULT g_persistfile_load_ret
static

Definition at line 3671 of file compobj.c.

Referenced by test_CoGetInstanceFromFile(), and testinstance_Load().

◆ g_persistfile_qi_ret

HRESULT g_persistfile_qi_ret
static

Definition at line 3670 of file compobj.c.

Referenced by test_CoGetInstanceFromFile(), and testinstance_QI().

◆ getinstance_cf

IClassFactory getinstance_cf = { &getinstance_cf_vtbl }
static

Definition at line 3802 of file compobj.c.

Referenced by test_CoGetInstanceFromFile().

◆ getinstance_cf_vtbl

const IClassFactoryVtbl getinstance_cf_vtbl
static
Initial value:
= {
}
static HRESULT WINAPI getinstance_cf_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
Definition: compobj.c:3775
static HRESULT WINAPI getinstance_cf_QI(IClassFactory *iface, REFIID riid, void **obj)
Definition: compobj.c:3753
static ULONG WINAPI getinstance_cf_Release(IClassFactory *iface)
Definition: compobj.c:3770
static HRESULT WINAPI getinstance_cf_LockServer(IClassFactory *iface, BOOL lock)
Definition: compobj.c:3788
static ULONG WINAPI getinstance_cf_AddRef(IClassFactory *iface)
Definition: compobj.c:3765

Definition at line 3794 of file compobj.c.

◆ IID_Testiface

const GUID IID_Testiface = { 0x22222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
static

Definition at line 93 of file compobj.c.

Referenced by test_CoGetPSClsid().

◆ IID_Testiface2

const GUID IID_Testiface2 = { 0x32222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
static

Definition at line 94 of file compobj.c.

Referenced by test_CoGetPSClsid().

◆ IID_Testiface3

const GUID IID_Testiface3 = { 0x42222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
static

Definition at line 95 of file compobj.c.

Referenced by test_CoGetClassObject(), and test_CoGetPSClsid().

◆ IID_Testiface4

const GUID IID_Testiface4 = { 0x52222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
static

Definition at line 96 of file compobj.c.

Referenced by test_CoGetClassObject(), and test_CoGetPSClsid().

◆ IID_Testiface5

const GUID IID_Testiface5 = { 0x62222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
static

Definition at line 97 of file compobj.c.

Referenced by test_ProgIDFromCLSID().

◆ IID_Testiface6

const GUID IID_Testiface6 = { 0x72222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
static

Definition at line 98 of file compobj.c.

Referenced by test_ProgIDFromCLSID().

◆ IID_Testiface7

const GUID IID_Testiface7 = { 0x82222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
static

◆ IID_Testiface8

const GUID IID_Testiface8 = { 0x92222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }
static

Definition at line 100 of file compobj.c.

Referenced by test_CoGetClassObject().

◆ IID_TestPS

const GUID IID_TestPS = { 0x66666666, 0x8888, 0x7777, { 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 } }
static

◆ init_cookies

ULARGE_INTEGER init_cookies[3]
static

◆ LPBOOL

Definition at line 85 of file compobj.c.

◆ LPCSTR

Definition at line 80 of file compobj.c.

◆ manifest_path

WCHAR manifest_path[MAX_PATH]
static

Definition at line 193 of file compobj.c.

Referenced by create_manifest_file().

◆ MessageFilter

IMessageFilter MessageFilter = { &MessageFilter_Vtbl }
static

◆ MessageFilter_Vtbl

const IMessageFilterVtbl MessageFilter_Vtbl
static
Initial value:
=
{
}
static ULONG WINAPI MessageFilter_AddRef(IMessageFilter *iface)
Definition: compobj.c:936
static ULONG WINAPI MessageFilter_Release(IMessageFilter *iface)
Definition: compobj.c:941
static DWORD WINAPI MessageFilter_RetryRejectedCall(IMessageFilter *iface, HTASK threadIDCallee, DWORD dwTickCount, DWORD dwRejectType)
Definition: compobj.c:957
static DWORD WINAPI MessageFilter_HandleInComingCall(IMessageFilter *iface, DWORD dwCallType, HTASK threadIDCaller, DWORD dwTickCount, LPINTERFACEINFO lpInterfaceInfo)
Definition: compobj.c:946
static HRESULT WINAPI MessageFilter_QueryInterface(IMessageFilter *iface, REFIID riid, void **ppvObj)
Definition: compobj.c:921
static DWORD WINAPI MessageFilter_MessagePending(IMessageFilter *iface, HTASK threadIDCallee, DWORD dwTickCount, DWORD dwPendingType)
Definition: compobj.c:967

Definition at line 978 of file compobj.c.

◆ outer

IUnknown* outer

Definition at line 82 of file compobj.c.

Referenced by CAccPropServices_CreateInstance(), CF_CreateInstance(), CInternetFolder_CreateInstance(), ClassFactory_CreateInstance(), CoCreateFreeThreadedMarshaler(), CoCreateInstance(), CoCreateInstanceEx(), CoCreateInstanceFromApp(), CoGetInstanceFromFile(), CoGetInstanceFromIStorage(), ConnectionPointContainer_Init(), create_enumvariant(), create_http_protocol(), create_msiserver(), create_text_services(), create_webbrowser(), CreateProxyFromTypeInfo(), CreateTextServices(), d3drm1_CreateObject(), d3drm2_CreateObject(), d3drm3_CreateObject(), d3drm_animation1_Clone(), d3drm_animation2_Clone(), d3drm_device1_Clone(), d3drm_device2_Clone(), d3drm_device3_Clone(), d3drm_device_win_Clone(), d3drm_face1_Clone(), d3drm_face2_Clone(), d3drm_frame1_Clone(), d3drm_frame2_Clone(), d3drm_frame3_Clone(), d3drm_light_Clone(), d3drm_material_Clone(), d3drm_mesh_builder2_Clone(), d3drm_mesh_builder3_Clone(), d3drm_mesh_Clone(), d3drm_texture1_Clone(), d3drm_texture2_Clone(), d3drm_texture3_Clone(), d3drm_viewport1_Clone(), d3drm_viewport2_Clone(), d3drm_wrap_Clone(), DECLARE_INTERFACE_(), Dictionary_CreateInstance(), DirectDrawCreate(), DirectDrawCreateEx(), DirectInput8Create(), dispatch_create_proxy(), dispatch_typelib_ps_CreateProxy(), factory_CreateInstance(), FileProtocol_Construct(), FileSystem_CreateInstance(), FtpProtocol_Construct(), global_options_CreateInstance(), HlinkFrame_Init(), HttpProtocol_Construct(), HttpSProtocol_Construct(), init_classinfo(), init_dispex(), InMemoryPropertyStoreFactory_CreateInstance(), InstallEngineCF_CreateInstance(), InternetShortcut_Create(), ItemMoniker_CreateInstance(), ITSProtocol_create(), ITSSCF_CreateInstance(), IUPnPNAT_create(), JScriptEncodeFactory_CreateInstance(), JScriptFactory_CreateInstance(), ManualResetEvent_CreateInstance(), MimeAllocator_create(), MimeBody_create(), MimeFilter_CreateInstance(), MimeHtmlProtocol_create(), MimeMessage_create(), MimeSecurity_create(), MkProtocol_Construct(), MLangConvertCharset_create(), module_get_containee(), MonikerMarshal_Create(), NetFwPolicy2_create(), ProtocolCF_CreateInstance(), PSFactoryBuffer_CreateProxy(), QCAP_createAudioCaptureFilter(), QCAP_createSmartTeeFilter(), requestcf_CreateInstance(), StdURLMoniker_Construct(), test_com_aggregation(), test_mhtml_protocol(), typelib_proxy_init(), VirtualStream_create(), and WshShellFactory_CreateInstance().

◆ override

HKEY override

Definition at line 81 of file compobj.c.

◆ ppOldObject

IUnknown** ppOldObject

Definition at line 75 of file compobj.c.

◆ ppv

Definition at line 74 of file compobj.c.

◆ progidW

const WCHAR progidW[] = {'P','r','o','g','I','d','.','P','r','o','g','I','d',0}
static

Definition at line 112 of file compobj.c.

Referenced by test_actctx(), test_CLSIDFromProgID(), and test_ProgIDFromCLSID().

◆ ps_factory_buffer

IPSFactoryBuffer* ps_factory_buffer
static

Definition at line 1122 of file compobj.c.

Referenced by PSFactoryBuffer_CreateStub(), and test_CoRegisterPSClsid().

◆ PSFactoryBuffer

Definition at line 1185 of file compobj.c.

◆ PSFactoryBufferVtbl

IPSFactoryBufferVtbl PSFactoryBufferVtbl
static
Initial value:
=
{
}
static ULONG WINAPI PSFactoryBuffer_AddRef(IPSFactoryBuffer *This)
Definition: compobj.c:1139
static HRESULT WINAPI PSFactoryBuffer_QueryInterface(IPSFactoryBuffer *This, REFIID riid, void **ppvObject)
Definition: compobj.c:1124
static HRESULT WINAPI PSFactoryBuffer_CreateProxy(IPSFactoryBuffer *This, IUnknown *pUnkOuter, REFIID riid, IRpcProxyBuffer **ppProxy, void **ppv)
Definition: compobj.c:1151
static ULONG WINAPI PSFactoryBuffer_Release(IPSFactoryBuffer *This)
Definition: compobj.c:1145
static HRESULT WINAPI PSFactoryBuffer_CreateStub(IPSFactoryBuffer *This, REFIID riid, IUnknown *pUnkServer, IRpcStubBuffer **ppStub)
Definition: compobj.c:1161

Definition at line 1176 of file compobj.c.

◆ qualifier

◆ REGSAM

Definition at line 80 of file compobj.c.

◆ reserved

IUnknown DWORD void* reserved

Definition at line 83 of file compobj.c.

◆ results

IUnknown DWORD void DWORD MULTI_QI* results

Definition at line 83 of file compobj.c.

◆ revoke_spies_on_uninit

BOOL revoke_spies_on_uninit
static

Definition at line 3485 of file compobj.c.

Referenced by test_IInitializeSpy(), and testinitialize_PreUninitialize().

◆ stdfont

const WCHAR stdfont[] = {'S','t','d','F','o','n','t',0}
static

Definition at line 105 of file compobj.c.

Referenced by test_CLSIDFromProgID(), test_IIDFromString(), and test_ProgIDFromCLSID().

◆ Test_ClassFactory

◆ Test_Unknown

◆ TestCallContext_Vtbl

const IUnknownVtbl TestCallContext_Vtbl
static
Initial value:
=
{
}
static ULONG WINAPI Test_CallContext_AddRef(IUnknown *iface)
Definition: compobj.c:2031
static ULONG WINAPI Test_CallContext_Release(IUnknown *iface)
Definition: compobj.c:2037
static HRESULT WINAPI Test_CallContext_QueryInterface(IUnknown *iface, REFIID riid, LPVOID *ppvObj)
Definition: compobj.c:2013

Definition at line 2046 of file compobj.c.

Referenced by test_CoGetCallContext().

◆ TestClassFactory_Vtbl

const IClassFactoryVtbl TestClassFactory_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI Test_IClassFactory_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
Definition: compobj.c:131
static HRESULT WINAPI Test_IClassFactory_LockServer(LPCLASSFACTORY iface, BOOL fLock)
Definition: compobj.c:175
static HRESULT WINAPI Test_IClassFactory_CreateInstance(LPCLASSFACTORY iface, IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObj)
Definition: compobj.c:163
static ULONG WINAPI Test_IClassFactory_AddRef(LPCLASSFACTORY iface)
Definition: compobj.c:150
static ULONG WINAPI Test_IClassFactory_Release(LPCLASSFACTORY iface)
Definition: compobj.c:156

Definition at line 182 of file compobj.c.

◆ testinitialize

IInitializeSpy testinitialize = { &testinitializevtbl }
static

Definition at line 3538 of file compobj.c.

Referenced by test_IInitializeSpy().

◆ testinitializevtbl

const IInitializeSpyVtbl testinitializevtbl
static
Initial value:
=
{
}
static HRESULT WINAPI testinitialize_QI(IInitializeSpy *iface, REFIID riid, void **obj)
Definition: compobj.c:3460
static HRESULT WINAPI testinitialize_PreUninitialize(IInitializeSpy *iface, DWORD aptrefs)
Definition: compobj.c:3501
static HRESULT WINAPI testinitialize_PostInitialize(IInitializeSpy *iface, HRESULT hr, DWORD coinit, DWORD aptrefs)
Definition: compobj.c:3494
static ULONG WINAPI testinitialize_Release(IInitializeSpy *iface)
Definition: compobj.c:3478
static HRESULT WINAPI testinitialize_PreInitialize(IInitializeSpy *iface, DWORD coinit, DWORD aptrefs)
Definition: compobj.c:3487
static ULONG WINAPI testinitialize_AddRef(IInitializeSpy *iface)
Definition: compobj.c:3473
static HRESULT WINAPI testinitialize_PostUninitialize(IInitializeSpy *iface, DWORD aptrefs)
Definition: compobj.c:3521

Definition at line 3527 of file compobj.c.

◆ testlib

char testlib[MAX_PATH]
static

Definition at line 235 of file compobj.c.

Referenced by START_TEST().

◆ testpersistfile

IPersistFile testpersistfile = { &testpersistfilevtbl }
static

Definition at line 3751 of file compobj.c.

Referenced by getinstance_cf_CreateInstance().

◆ testpersistfilevtbl

const IPersistFileVtbl testpersistfilevtbl
static
Initial value:
= {
}
static HRESULT WINAPI testinstance_QI(IPersistFile *iface, REFIID riid, void **obj)
Definition: compobj.c:3672
static HRESULT WINAPI testinstance_Save(IPersistFile *iface, LPCOLESTR filename, BOOL remember)
Definition: compobj.c:3722
static ULONG WINAPI testinstance_Release(IPersistFile *iface)
Definition: compobj.c:3700
static HRESULT WINAPI testinstance_GetCurFile(IPersistFile *iface, LPOLESTR *filename)
Definition: compobj.c:3733
static HRESULT WINAPI testinstance_SaveCompleted(IPersistFile *iface, LPCOLESTR filename)
Definition: compobj.c:3727
static ULONG WINAPI testinstance_AddRef(IPersistFile *iface)
Definition: compobj.c:3695
static HRESULT WINAPI testinstance_Load(IPersistFile *iface, LPCOLESTR filename, DWORD mode)
Definition: compobj.c:3717
static HRESULT WINAPI testinstance_GetClassID(IPersistFile *iface, CLSID *clsid)
Definition: compobj.c:3705
static HRESULT WINAPI testinstance_IsDirty(IPersistFile *iface)
Definition: compobj.c:3711

Definition at line 3739 of file compobj.c.

◆ testspy

IMallocSpy testspy = { &testspyvtbl }
static

Definition at line 3408 of file compobj.c.

Referenced by test_IMallocSpy().

◆ testspyvtbl

const IMallocSpyVtbl testspyvtbl
static
Initial value:
=
{
}
static int WINAPI testspy_PostDidAlloc(IMallocSpy *iface, void *ptr, BOOL spyed, int actual)
Definition: compobj.c:3373
static void *WINAPI testspy_PreGetSize(IMallocSpy *iface, void *ptr, BOOL spyed)
Definition: compobj.c:3355
static ULONG WINAPI testspy_AddRef(IMallocSpy *iface)
Definition: compobj.c:3310
static void WINAPI testspy_PreHeapMinimize(IMallocSpy *iface)
Definition: compobj.c:3379
static SIZE_T WINAPI testspy_PostGetSize(IMallocSpy *iface, SIZE_T actual, BOOL spyed)
Definition: compobj.c:3361
static SIZE_T WINAPI testspy_PreAlloc(IMallocSpy *iface, SIZE_T cb)
Definition: compobj.c:3320
static void WINAPI testspy_PostFree(IMallocSpy *iface, BOOL spyed)
Definition: compobj.c:3338
static void WINAPI testspy_PostHeapMinimize(IMallocSpy *iface)
Definition: compobj.c:3384
static void *WINAPI testspy_PreDidAlloc(IMallocSpy *iface, void *ptr, BOOL spyed)
Definition: compobj.c:3367
static SIZE_T WINAPI testspy_PreRealloc(IMallocSpy *iface, void *ptr, SIZE_T cb, void **newptr, BOOL spyed)
Definition: compobj.c:3343
static void *WINAPI testspy_PreFree(IMallocSpy *iface, void *ptr, BOOL spyed)
Definition: compobj.c:3332
static HRESULT WINAPI testspy_QI(IMallocSpy *iface, REFIID riid, void **obj)
Definition: compobj.c:3298
static void *WINAPI testspy_PostAlloc(IMallocSpy *iface, void *ptr)
Definition: compobj.c:3326
static ULONG WINAPI testspy_Release(IMallocSpy *iface)
Definition: compobj.c:3315
static void *WINAPI testspy_PostRealloc(IMallocSpy *iface, void *ptr, BOOL spyed)
Definition: compobj.c:3349

Definition at line 3389 of file compobj.c.

◆ TestUnknown_Vtbl

const IUnknownVtbl TestUnknown_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI Test_IUnknown_QueryInterface(IUnknown *iface, REFIID riid, LPVOID *ppvObj)
Definition: compobj.c:1083
static ULONG WINAPI Test_IUnknown_Release(IUnknown *iface)
Definition: compobj.c:1108
static ULONG WINAPI Test_IUnknown_AddRef(IUnknown *iface)
Definition: compobj.c:1103

Definition at line 1113 of file compobj.c.

◆ wszCLSID_StdFont

const WCHAR wszCLSID_StdFont[]
static
Initial value:
=
{
'{','0','b','e','3','5','2','0','3','-','8','f','9','1','-','1','1','c','e','-',
'9','d','e','3','-','0','0','a','a','0','0','4','b','b','8','5','1','}',0
}

Definition at line 107 of file compobj.c.

Referenced by test_CLSIDFromString(), test_IIDFromString(), and test_StringFromGUID2().

◆ wszNonExistent

const WCHAR wszNonExistent[] = {'N','o','n','E','x','i','s','t','e','n','t',0}
static

Definition at line 106 of file compobj.c.

Referenced by test_bind_context(), test_CLSIDFromProgID(), and test_IIDFromString().