ReactOS  0.4.14-dev-114-gc8cbd56
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 "initguid.h"
Include dependency graph for compobj.c:

Go to the source code of this file.

Classes

struct  Test_CallContext
 

Macros

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

Functions

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

Variables

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

Macro Definition Documentation

◆ CHECK_CALLED

#define CHECK_CALLED (   func)
Value:
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
GLenum func
Definition: glext.h:6028

Definition at line 59 of file compobj.c.

◆ CHECK_EXPECT

#define CHECK_EXPECT (   func)
Value:
do { \
CHECK_EXPECT2(func); \
expect_ ## func = FALSE; \
}while(0)
GLenum func
Definition: glext.h:6028

Definition at line 53 of file compobj.c.

◆ CHECK_EXPECT2

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

Definition at line 47 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 2479 of file compobj.c.

◆ cowait_msgs_expect_notified

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

Definition at line 2489 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 2502 of file compobj.c.

◆ DEFINE_EXPECT

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

Definition at line 41 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 %d\n", cLocks)

Definition at line 85 of file compobj.c.

◆ ok_no_locks

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

Definition at line 86 of file compobj.c.

◆ ok_ole_success

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

Definition at line 84 of file compobj.c.

◆ SET_EXPECT

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

Definition at line 44 of file compobj.c.

◆ test_apt_type

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

Definition at line 603 of file compobj.c.

◆ USE_COM_CONTEXT_DEF

#define USE_COM_CONTEXT_DEF

Definition at line 29 of file compobj.c.

Function Documentation

◆ _cowait_msgs_expect_empty()

static void _cowait_msgs_expect_empty ( unsigned  line)
static

Definition at line 2480 of file compobj.c.

2481 {
2483  ok_(__FILE__,line)(0, "unexpected message %u\n", cowait_msgs[cowait_msgs_first]);
2485  }
2487 }
Definition: parser.c:48
static UINT cowait_msgs[100]
Definition: compobj.c:2472
static UINT cowait_msgs_first
Definition: compobj.c:2472
static UINT cowait_msgs_last
Definition: compobj.c:2472
static void cowait_msgs_reset(void)
Definition: compobj.c:2474
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _cowait_msgs_expect_notified()

static void _cowait_msgs_expect_notified ( unsigned  line,
UINT  expected_msg 
)
static

Definition at line 2490 of file compobj.c.

2491 {
2493  ok_(__FILE__,line)(0, "expected message %u, received none\n", expected_msg);
2494  }else {
2495  ok_(__FILE__,line)(cowait_msgs[cowait_msgs_first] == expected_msg,
2496  "expected message %u, received %u \n",
2497  expected_msg, cowait_msgs[cowait_msgs_first]);
2499  }
2500 }
Definition: parser.c:48
static UINT cowait_msgs[100]
Definition: compobj.c:2472
static UINT cowait_msgs_first
Definition: compobj.c:2472
static UINT cowait_msgs_last
Definition: compobj.c:2472
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _cowait_msgs_expect_queued()

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

Definition at line 2503 of file compobj.c.

2504 {
2505  MSG msg;
2506  BOOL success;
2507 
2508  success = PeekMessageA(&msg, hwnd, expected_msg, expected_msg, PM_REMOVE);
2509  ok_(__FILE__,line)(success, "PeekMessageA failed: %u\n", GetLastError());
2510  if(success)
2511  ok_(__FILE__,line)(msg.message == expected_msg, "unexpected message %u, expected %u\n",
2512  msg.message, expected_msg);
2513 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: parser.c:48
#define success(from, fromstr, to, tostr)
#define msg(x)
Definition: auth_time.c:54
#define PM_REMOVE
Definition: winuser.h:1182
#define ok_(x1, x2)
Definition: atltest.h:61

◆ _test_apt_type()

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

Definition at line 604 of file compobj.c.

605 {
607  APTTYPE type = ~0u;
608  HRESULT hr;
609 
610  if (!pCoGetApartmentType)
611  return;
612 
613  hr = pCoGetApartmentType(&type, &qualifier);
614  ok_(__FILE__, line)(hr == S_OK || hr == CO_E_NOTINITIALIZED, "Unexpected return code: 0x%08x\n", hr);
615  ok_(__FILE__, line)(type == expected_type, "Wrong apartment type %d, expected %d\n", type, expected_type);
616  ok_(__FILE__, line)(qualifier == expected_qualifier, "Wrong apartment qualifier %d, expected %d\n", qualifier,
617  expected_qualifier);
618 }
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
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define CO_E_NOTINITIALIZED
enum _APTTYPEQUALIFIER APTTYPEQUALIFIER
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:74
Definition: parser.c:48
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define ok_(x1, x2)
Definition: atltest.h:61

◆ activate_context()

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

Definition at line 212 of file compobj.c.

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

Referenced by test_CLSIDFromProgID(), 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 2432 of file compobj.c.

2433 {
2434  /* nothing */
2435 }

Referenced by test_CoWaitForMultipleHandles().

◆ BOOL()

static BOOL ( WINAPI pActivateActCtx)
static

◆ cowait_msgs_reset()

static void cowait_msgs_reset ( void  )
static

Definition at line 2474 of file compobj.c.

2475 {
2477 }
static UINT cowait_msgs_first
Definition: compobj.c:2472
static UINT cowait_msgs_last
Definition: compobj.c:2472

Referenced by _cowait_msgs_expect_empty(), and test_CoWaitForMultipleHandles().

◆ cowait_unmarshal_thread()

static DWORD CALLBACK cowait_unmarshal_thread ( void arg)
static

Definition at line 2530 of file compobj.c.

2531 {
2532  IStream *stream = arg;
2533  IEnumOLEVERB *enum_verb;
2535  IUnknown *unk;
2536  HRESULT hr;
2537 
2538  CoInitialize(NULL);
2539 
2540  zero.QuadPart = 0;
2541  hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
2542  ok(hr == S_OK, "Seek failed: %08x\n", hr);
2543 
2544  hr = CoUnmarshalInterface(stream, &IID_IUnknown, (void**)&unk);
2545  ok(hr == S_OK, "CoUnmarshalInterface failed: %08x\n", hr);
2546 
2547  hr = IUnknown_QueryInterface(unk, &IID_IEnumOLEVERB, (void**)&enum_verb);
2548  ok(hr == S_OK, "QueryInterface failed: %08x\n", hr);
2549 
2550  IEnumOLEVERB_Release(enum_verb);
2551  IUnknown_Release(unk);
2552 
2553  CoUninitialize();
2554  return 0;
2555 }
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1982
HRESULT hr
Definition: shlfolder.c:183
const GUID IID_IEnumOLEVERB
void * arg
Definition: msvc.h:12
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
static double zero
Definition: j0_y0.c:96
Definition: parse.h:22
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897

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 2521 of file compobj.c.

2522 {
2525  if(msg == WM_DDE_FIRST)
2526  return 6;
2527  return DefWindowProcA(hwnd, msg, wparam, lparam);
2528 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
static UINT cowait_msgs[100]
Definition: compobj.c:2472
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static UINT cowait_msgs_last
Definition: compobj.c:2472
#define WM_DDE_FIRST
Definition: dde.h:47
#define ARRAY_SIZE(a)
Definition: main.h:24
#define msg(x)
Definition: auth_time.c:54
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by test_CoWaitForMultipleHandles().

◆ create_manifest_file()

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

Definition at line 190 of file compobj.c.

191 {
192  int manifest_len;
193  DWORD size;
194  HANDLE file;
196 
199 
200  manifest_len = strlen(manifest);
203  ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
205  return FALSE;
206  WriteFile(file, manifest, manifest_len, &size, NULL);
207  CloseHandle(file);
208 
209  return TRUE;
210 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CP_ACP
Definition: compat.h:99
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1105
static WCHAR manifest_path[MAX_PATH]
Definition: compobj.c:188
const char * filename
Definition: ioapi.h:135
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define CREATE_ALWAYS
Definition: disk.h:72
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
Definition: services.c:325
#define MultiByteToWideChar
Definition: compat.h:100
#define CreateFileW
Definition: compat.h:400
static const CHAR manifest[]
Definition: v6util.h:39
Definition: fci.c:126

Referenced by activate_context().

◆ DEFINE_EXPECT()

DEFINE_EXPECT ( CreateStub  )

◆ DEFINE_GUID() [1/4]

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

◆ DEFINE_GUID() [2/4]

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

◆ 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 ( CLSID_Testclass  ,
0x12345678  ,
0x1234  ,
0x1234  ,
0x12  ,
0x34  ,
0x56  ,
0x78  ,
0x9a  ,
0xbc  ,
0xde  ,
0xf0   
)

◆ EnumOLEVERB_AddRef()

static ULONG WINAPI EnumOLEVERB_AddRef ( IEnumOLEVERB iface)
static

Definition at line 902 of file compobj.c.

903 {
904  return 2;
905 }

◆ EnumOLEVERB_Clone()

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

Definition at line 930 of file compobj.c.

931 {
932  ok(0, "unexpected call\n");
933  return E_NOTIMPL;
934 }
#define ok(value,...)
Definition: atltest.h:57
#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 912 of file compobj.c.

913 {
914  ok(0, "unexpected call\n");
915  return E_NOTIMPL;
916 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ EnumOLEVERB_QueryInterface()

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

Definition at line 897 of file compobj.c.

898 {
899  return IUnknown_QueryInterface(&Test_Unknown, riid, ppv);
900 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static IUnknown Test_Unknown
Definition: compobj.c:895

◆ EnumOLEVERB_Release()

static ULONG WINAPI EnumOLEVERB_Release ( IEnumOLEVERB iface)
static

Definition at line 907 of file compobj.c.

908 {
909  return 1;
910 }

◆ EnumOLEVERB_Reset()

static HRESULT WINAPI EnumOLEVERB_Reset ( IEnumOLEVERB iface)
static

Definition at line 924 of file compobj.c.

925 {
926  ok(0, "unexpected call\n");
927  return E_NOTIMPL;
928 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ EnumOLEVERB_Skip()

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

Definition at line 918 of file compobj.c.

919 {
920  ok(0, "unexpected call\n");
921  return E_NOTIMPL;
922 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ flush_messages()

static void flush_messages ( void  )
static

Definition at line 2515 of file compobj.c.

2516 {
2517  MSG msg;
2518  while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ));
2519 }
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define msg(x)
Definition: auth_time.c:54
#define PM_REMOVE
Definition: winuser.h:1182

Referenced by test_CoWaitForMultipleHandles().

◆ free_libraries_thread()

static DWORD CALLBACK free_libraries_thread ( LPVOID  p)
static

Definition at line 1718 of file compobj.c.

1719 {
1721  return 0;
1722 }
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void)
Definition: compobj.c:3610

Referenced by test_CoFreeUnusedLibraries().

◆ get_class_object()

static HRESULT get_class_object ( CLSCTX  clsctx)
static

Definition at line 1548 of file compobj.c.

1549 {
1550  HRESULT hr;
1551  IClassFactory *pcf;
1552 
1554  (void **)&pcf);
1555 
1556  if (SUCCEEDED(hr))
1557  IClassFactory_Release(pcf);
1558 
1559  return hr;
1560 }
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3012
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:141
const GUID IID_IClassFactory
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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 1576 of file compobj.c.

1577 {
1578  CLSCTX clsctx = (CLSCTX)(DWORD_PTR)pv;
1579  HRESULT hr;
1580  IClassFactory *pcf;
1581  IMultiQI *pMQI;
1582 
1583  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1584 
1586  (void **)&pcf);
1587 
1588  if (SUCCEEDED(hr))
1589  {
1590  hr = IClassFactory_QueryInterface(pcf, &IID_IMultiQI, (void **)&pMQI);
1591  if (SUCCEEDED(hr))
1592  IMultiQI_Release(pMQI);
1593  IClassFactory_Release(pcf);
1594  }
1595 
1596  CoUninitialize();
1597 
1598  return hr;
1599 }
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3012
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:141
uint32_t DWORD_PTR
Definition: typedefs.h:63
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
const GUID IID_IClassFactory
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by test_registered_object_thread_affinity().

◆ get_class_object_thread()

static DWORD CALLBACK get_class_object_thread ( LPVOID  pv)
static

Definition at line 1562 of file compobj.c.

1563 {
1564  CLSCTX clsctx = (CLSCTX)(DWORD_PTR)pv;
1565  HRESULT hr;
1566 
1567  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1568 
1569  hr = get_class_object(clsctx);
1570 
1571  CoUninitialize();
1572 
1573  return hr;
1574 }
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
uint32_t DWORD_PTR
Definition: typedefs.h:63
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
static HRESULT get_class_object(CLSCTX clsctx)
Definition: compobj.c:1548

Referenced by test_registered_object_thread_affinity().

◆ getinstance_cf_AddRef()

static ULONG WINAPI getinstance_cf_AddRef ( IClassFactory iface)
static

Definition at line 3513 of file compobj.c.

3514 {
3515  return 2;
3516 }

◆ getinstance_cf_CreateInstance()

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

Definition at line 3523 of file compobj.c.

3525 {
3526  if (IsEqualIID(riid, &IID_IUnknown)) {
3527  *obj = &testpersistfile;
3528  return S_OK;
3529  }
3530 
3531  ok(0, "unexpected call, riid %s\n", wine_dbgstr_guid(riid));
3532  *obj = NULL;
3533  return E_NOTIMPL;
3534 }
REFIID riid
Definition: precomp.h:44
const char * wine_dbgstr_guid(const GUID *guid)
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99
static IPersistFile testpersistfile
Definition: compobj.c:3499
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ getinstance_cf_LockServer()

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

Definition at line 3536 of file compobj.c.

3537 {
3538  ok(0, "unexpected call\n");
3539  return E_NOTIMPL;
3540 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ getinstance_cf_QI()

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

Definition at line 3501 of file compobj.c.

3502 {
3504  *obj = iface;
3505  IClassFactory_AddRef(iface);
3506  return S_OK;
3507  }
3508 
3509  *obj = NULL;
3510  return E_NOINTERFACE;
3511 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
const GUID IID_IClassFactory
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ getinstance_cf_Release()

static ULONG WINAPI getinstance_cf_Release ( IClassFactory iface)
static

Definition at line 3518 of file compobj.c.

3519 {
3520  return 1;
3521 }

◆ HANDLE()

static ULONG_PTR* static HANDLE ( WINAPI pCreateActCtxW)
static

◆ HRESULT()

static HRESULT ( WINAPI pCoInitializeEx)
static

◆ impl_from_IUnknown()

static Test_CallContext* impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 1871 of file compobj.c.

1872 {
1873  return CONTAINING_RECORD(iface, Test_CallContext, IUnknown_iface);
1874 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by Test_CallContext_AddRef(), and Test_CallContext_Release().

◆ implicit_mta_proc()

static DWORD CALLBACK implicit_mta_proc ( void param)
static

Definition at line 3716 of file compobj.c.

3717 {
3718  IComThreadingInfo *threading_info;
3719  ULONG_PTR token;
3720  IUnknown *unk;
3721  DWORD cookie;
3722  CLSID clsid;
3723  HRESULT hr;
3724 
3726 
3727  hr = CoCreateInstance(&CLSID_InternetZoneManager, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
3728  ok_ole_success(hr, "CoCreateInstance");
3729  IUnknown_Release(unk);
3730 
3731  hr = CoGetClassObject(&CLSID_InternetZoneManager, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&unk);
3732  ok_ole_success(hr, "CoGetClassObject");
3733  IUnknown_Release(unk);
3734 
3735  hr = CoGetObjectContext(&IID_IComThreadingInfo, (void **)&threading_info);
3736  ok_ole_success(hr, "CoGetObjectContext");
3737  IComThreadingInfo_Release(threading_info);
3738 
3740  ok_ole_success(hr, "CoGetContextToken");
3741 
3743  ok_ole_success(hr, "CoRegisterPSClsid");
3744 
3746  ok_ole_success(hr, "CoGetPSClsid");
3747 
3749  CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
3750  ok_ole_success(hr, "CoRegisterClassObject");
3751 
3752  hr = CoRevokeClassObject(cookie);
3753  ok_ole_success(hr, "CoRevokeClassObject");
3754 
3756  ok(hr == CO_E_NOT_SUPPORTED, "got %#x\n", hr);
3757 
3759  ok_ole_success(hr, "CoLockObjectExternal");
3760 
3762  ok_ole_success(hr, "CoDisconnectObject");
3763 
3764  return 0;
3765 }
#define TRUE
Definition: types.h:120
static IClassFactory Test_ClassFactory
Definition: compobj.c:186
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv)
Definition: compobj.c:5005
HRESULT WINAPI CoDisconnectObject(LPUNKNOWN lpUnk, DWORD reserved)
Definition: compobj.c:2058
#define test_apt_type(t, q)
Definition: compobj.c:603
HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid)
Definition: compobj.c:2687
static IUnknown Test_Unknown
Definition: compobj.c:895
#define ok_ole_success(hr, func)
Definition: compobj.c:84
HRESULT WINAPI CoGetContextToken(ULONG_PTR *token)
Definition: compobj.c:5023
uint32_t ULONG_PTR
Definition: typedefs.h:63
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
smooth NULL
Definition: ftsmooth.c:416
#define CO_E_NOT_SUPPORTED
Definition: winerror.h:2397
HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
Definition: compobj.c:2599
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1089
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3012
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases)
Definition: compobj.c:3652
const GUID IID_IUnknown
unsigned long DWORD
Definition: ntddk_ex.h:95
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:141
REFCLSID clsid
Definition: msctf.c:84
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2806
#define ok(value,...)
Definition: atltest.h:57
static const IID IID_IWineTest
Definition: marshal.c:122
const GUID IID_IClassFactory
HRESULT WINAPI CoRegisterMessageFilter(LPMESSAGEFILTER lpMessageFilter, LPMESSAGEFILTER *lplpMessageFilter)
Definition: compobj.c:3955
static const CLSID CLSID_WineTestPSFactoryBuffer
Definition: compobj.c:1052

Referenced by test_implicit_mta().

◆ init_funcs()

static void init_funcs ( void  )
static

Definition at line 3693 of file compobj.c.

3694 {
3695  HMODULE hOle32 = GetModuleHandleA("ole32");
3696  HMODULE hAdvapi32 = GetModuleHandleA("advapi32");
3697  HMODULE hkernel32 = GetModuleHandleA("kernel32");
3698 
3699  pCoGetObjectContext = (void*)GetProcAddress(hOle32, "CoGetObjectContext");
3700  pCoSwitchCallContext = (void*)GetProcAddress(hOle32, "CoSwitchCallContext");
3701  pCoGetTreatAsClass = (void*)GetProcAddress(hOle32,"CoGetTreatAsClass");
3702  pCoTreatAsClass = (void*)GetProcAddress(hOle32,"CoTreatAsClass");
3703  pCoGetContextToken = (void*)GetProcAddress(hOle32, "CoGetContextToken");
3704  pCoGetApartmentType = (void*)GetProcAddress(hOle32, "CoGetApartmentType");
3705  pRegDeleteKeyExA = (void*)GetProcAddress(hAdvapi32, "RegDeleteKeyExA");
3706  pRegOverridePredefKey = (void*)GetProcAddress(hAdvapi32, "RegOverridePredefKey");
3707  pCoInitializeEx = (void*)GetProcAddress(hOle32, "CoInitializeEx");
3708 
3709  pActivateActCtx = (void*)GetProcAddress(hkernel32, "ActivateActCtx");
3710  pCreateActCtxW = (void*)GetProcAddress(hkernel32, "CreateActCtxW");
3711  pDeactivateActCtx = (void*)GetProcAddress(hkernel32, "DeactivateActCtx");
3712  pIsWow64Process = (void*)GetProcAddress(hkernel32, "IsWow64Process");
3713  pReleaseActCtx = (void*)GetProcAddress(hkernel32, "ReleaseActCtx");
3714 }
static HINSTANCE hkernel32
Definition: process.c:66
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define GetProcAddress(x, y)
Definition: compat.h:410

Referenced by START_TEST().

◆ is_module_loaded()

static BOOL is_module_loaded ( const char module)
inlinestatic

Definition at line 1724 of file compobj.c.

1725 {
1726  return GetModuleHandleA(module) != 0;
1727 }
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821

Referenced by test_CoFreeUnusedLibraries().

◆ LockModule()

static void LockModule ( void  )
static

Definition at line 116 of file compobj.c.

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

Referenced by Test_IClassFactory_AddRef().

◆ LONG()

static LONG ( WINAPI pRegDeleteKeyExA)
static

◆ MessageFilter_AddRef()

static ULONG WINAPI MessageFilter_AddRef ( IMessageFilter iface)
static

Definition at line 801 of file compobj.c.

802 {
803  return 2; /* non-heap object */
804 }

◆ MessageFilter_HandleInComingCall()

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

Definition at line 811 of file compobj.c.

817 {
818  trace("HandleInComingCall\n");
819  return SERVERCALL_ISHANDLED;
820 }
#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 832 of file compobj.c.

837 {
838  trace("MessagePending\n");
839  todo_wine ok(0, "unexpected call\n");
840  return PENDINGMSG_WAITNOPROCESS;
841 }
#define trace
Definition: atltest.h:70
#define todo_wine
Definition: test.h:154
#define ok(value,...)
Definition: atltest.h:57

◆ MessageFilter_QueryInterface()

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

Definition at line 786 of file compobj.c.

787 {
788  if (ppvObj == NULL) return E_POINTER;
789 
790  if (IsEqualGUID(riid, &IID_IUnknown) ||
792  {
793  *ppvObj = iface;
794  IMessageFilter_AddRef(iface);
795  return S_OK;
796  }
797 
798  return E_NOINTERFACE;
799 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define E_POINTER
Definition: winerror.h:2365
const GUID IID_IClassFactory

◆ MessageFilter_Release()

static ULONG WINAPI MessageFilter_Release ( IMessageFilter iface)
static

Definition at line 806 of file compobj.c.

807 {
808  return 1; /* non-heap object */
809 }

◆ MessageFilter_RetryRejectedCall()

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

Definition at line 822 of file compobj.c.

827 {
828  trace("RetryRejectedCall\n");
829  return 0;
830 }
#define trace
Definition: atltest.h:70

◆ post_message_thread()

static DWORD CALLBACK post_message_thread ( LPVOID  arg)
static

Definition at line 2462 of file compobj.c.

2463 {
2464  HWND hWnd = arg;
2465  Sleep(50);
2466  PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
2467  return 0;
2468 }
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hWnd
Definition: settings.c:17
void * arg
Definition: msvc.h:12
#define WM_DDE_FIRST
Definition: dde.h:47

Referenced by test_CoWaitForMultipleHandles().

◆ PSFactoryBuffer_AddRef()

static ULONG WINAPI PSFactoryBuffer_AddRef ( IPSFactoryBuffer This)
static

Definition at line 1004 of file compobj.c.

1006 {
1007  return 2;
1008 }

◆ PSFactoryBuffer_CreateProxy()

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

Definition at line 1016 of file compobj.c.

1022 {
1023  return E_NOTIMPL;
1024 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ PSFactoryBuffer_CreateStub()

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

Definition at line 1026 of file compobj.c.

1031 {
1032  CHECK_EXPECT(CreateStub);
1033 
1034  ok(pUnkServer == (IUnknown*)&Test_Unknown, "unexpected pUnkServer %p\n", pUnkServer);
1035  if(!ps_factory_buffer)
1036  return E_NOTIMPL;
1037 
1038  return IPSFactoryBuffer_CreateStub(ps_factory_buffer, &IID_IEnumOLEVERB, pUnkServer, ppStub);
1039 }
const GUID IID_IEnumOLEVERB
static IUnknown Test_Unknown
Definition: compobj.c:895
static IPSFactoryBuffer * ps_factory_buffer
Definition: compobj.c:987
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99
#define CHECK_EXPECT(func)
Definition: compobj.c:53

◆ PSFactoryBuffer_QueryInterface()

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

Definition at line 989 of file compobj.c.

993 {
994  if (IsEqualIID(riid, &IID_IUnknown) ||
995  IsEqualIID(riid, &IID_IPSFactoryBuffer))
996  {
997  *ppvObject = This;
998  IPSFactoryBuffer_AddRef(This);
999  return S_OK;
1000  }
1001  return E_NOINTERFACE;
1002 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ PSFactoryBuffer_Release()

static ULONG WINAPI PSFactoryBuffer_Release ( IPSFactoryBuffer This)
static

Definition at line 1010 of file compobj.c.

1012 {
1013  return 1;
1014 }

◆ register_class_object_thread()

static DWORD CALLBACK register_class_object_thread ( LPVOID  pv)
static

Definition at line 1601 of file compobj.c.

1602 {
1603  HRESULT hr;
1604  DWORD cookie;
1605 
1606  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1607 
1609  CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1610 
1611  CoUninitialize();
1612 
1613  return hr;
1614 }
static IClassFactory Test_ClassFactory
Definition: compobj.c:186
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:141
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2806
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991

Referenced by test_registered_object_thread_affinity().

◆ register_dummy_class()

static ATOM register_dummy_class ( void  )
static

Definition at line 754 of file compobj.c.

755 {
756  WNDCLASSA wc =
757  {
758  0,
760  0,
761  0,
763  NULL,
765  (HBRUSH)(COLOR_BTNFACE+1),
766  NULL,
767  "WineOleTestClass",
768  };
769 
770  return RegisterClassA(&wc);
771 }
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:416
#define COLOR_BTNFACE
Definition: winuser.h:918
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
#define IDC_ARROW
Definition: winuser.h:682
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)

Referenced by test_ole_menu().

◆ register_ps_clsid_thread()

static DWORD CALLBACK register_ps_clsid_thread ( void context)
static

Definition at line 1060 of file compobj.c.

1061 {
1062  HRESULT hr;
1063  CLSID clsid = {0};
1064 
1065  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1066 
1068  ok_ole_success(hr, "CoGetPSClsid");
1069  ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1071 
1072  /* test registering a PSClsid in an apartment which is then destroyed */
1074  ok_ole_success(hr, "CoRegisterPSClsid");
1075 
1076  CoUninitialize();
1077 
1078  return hr;
1079 }
HRESULT hr
Definition: shlfolder.c:183
const char * wine_dbgstr_guid(const GUID *guid)
HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid)
Definition: compobj.c:2687
#define ok_ole_success(hr, func)
Definition: compobj.c:84
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
Definition: compobj.c:2599
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:84
static const GUID IID_TestPS
Definition: compobj.c:96
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
#define ok(value,...)
Definition: atltest.h:57
static const IID IID_IWineTest
Definition: marshal.c:122
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static const CLSID CLSID_WineTestPSFactoryBuffer
Definition: compobj.c:1052

Referenced by test_CoRegisterPSClsid().

◆ release_semaphore_thread()

static DWORD CALLBACK release_semaphore_thread ( LPVOID  arg)
static

Definition at line 2437 of file compobj.c.

2438 {
2439  HANDLE handle = arg;
2442  return 0;
2443 }
void * arg
Definition: msvc.h:12
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:416
#define WAIT_TIMEOUT
Definition: dderror.h:14
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:542

Referenced by test_CoWaitForMultipleHandles().

◆ revoke_class_object_thread()

static DWORD CALLBACK revoke_class_object_thread ( LPVOID  pv)
static

Definition at line 1616 of file compobj.c.

1617 {
1618  DWORD cookie = (DWORD_PTR)pv;
1619  HRESULT hr;
1620 
1621  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1622 
1623  hr = CoRevokeClassObject(cookie);
1624 
1625  CoUninitialize();
1626 
1627  return hr;
1628 }
#define DWORD_PTR
Definition: treelist.c:76
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1089
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991

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 2453 of file compobj.c.

2454 {
2455  HWND hwnd = arg;
2456  Sleep(30);
2457  SendMessageA(hwnd, WM_USER, 0, 0);
2458  PostMessageA(hwnd, WM_USER, 0, 0);
2459  return 0;
2460 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
void * arg
Definition: msvc.h:12
#define WM_USER
Definition: winuser.h:1877

Referenced by test_CoWaitForMultipleHandles().

◆ send_message_thread()

static DWORD CALLBACK send_message_thread ( LPVOID  arg)
static

Definition at line 2445 of file compobj.c.

2446 {
2447  HWND hWnd = arg;
2448  Sleep(50);
2449  SendMessageA(hWnd, WM_DDE_FIRST, 0, 0);
2450  return 0;
2451 }
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND hWnd
Definition: settings.c:17
void * arg
Definition: msvc.h:12
#define WM_DDE_FIRST
Definition: dde.h:47

Referenced by test_CoWaitForMultipleHandles().

◆ START_TEST()

START_TEST ( compobj  )

Definition at line 3781 of file compobj.c.

3782 {
3783  init_funcs();
3784 
3785  if (!pCoInitializeEx)
3786  {
3787  trace("You need DCOM95 installed to run this test\n");
3788  return;
3789  }
3790 
3791  if (!pCreateActCtxW)
3792  win_skip("Activation contexts are not supported, some tests will be skipped.\n");
3793 
3800  test_ole_menu();
3822  test_CoGetMalloc();
3825  test_IMallocSpy();
3831 }
static void test_IInitializeSpy(void)
Definition: compobj.c:3346
static void test_CoInitializeEx(void)
Definition: compobj.c:2134
static void test_CoCreateInstanceEx(void)
Definition: compobj.c:730
static void test_CLSIDFromProgID(void)
Definition: compobj.c:370
static void test_implicit_mta(void)
Definition: compobj.c:3769
static void test_CoCreateInstance(void)
Definition: compobj.c:620
static void test_CoUnmarshalInterface(void)
Definition: compobj.c:1327
static void test_CoRegisterPSClsid(void)
Definition: compobj.c:1081
static void test_CoWaitForMultipleHandles(void)
Definition: compobj.c:2646
static void test_ProgIDFromCLSID(void)
Definition: compobj.c:317
static void init_funcs(void)
Definition: compobj.c:3693
static void test_CoGetClassObject(void)
Definition: compobj.c:661
static void test_StringFromGUID2(void)
Definition: compobj.c:575
static void test_CoRegisterMessageFilter(void)
Definition: compobj.c:855
static void test_OleRegGetUserType(void)
Definition: compobj.c:2267
static void test_IMallocSpy(void)
Definition: compobj.c:3236
static void test_CoGetCurrentLogicalThreadId(void)
Definition: compobj.c:3272
static void test_CoGetPSClsid(void)
Definition: compobj.c:1184
static void test_ole_menu(void)
Definition: compobj.c:773
#define trace
Definition: atltest.h:70
static void test_CoRegisterClassObject(void)
Definition: compobj.c:1439
static void test_CoCreateGuid(void)
Definition: compobj.c:2424
static void test_CoGetInstanceFromFile(void)
Definition: compobj.c:3552
static void test_CoGetMalloc(void)
Definition: compobj.c:3031
static void test_CoFreeUnusedLibraries(void)
Definition: compobj.c:1729
static void test_OleRegGetMiscStatus(void)
Definition: compobj.c:2223
static void test_CoGetApartmentType(void)
Definition: compobj.c:3071
static void test_CoGetObjectContext(void)
Definition: compobj.c:1772
static void test_CoGetContextToken(void)
Definition: compobj.c:1973
static void test_CoGetInterfaceAndReleaseStream(void)
Definition: compobj.c:1356
static void test_GlobalOptions(void)
Definition: compobj.c:3667
static void test_CLSIDFromString(void)
Definition: compobj.c:437
static void test_CoMarshalInterThreadInterfaceInStream(void)
Definition: compobj.c:1405
static void test_CoGetCallContext(void)
Definition: compobj.c:1916
static void test_IIDFromString(void)
Definition: compobj.c:513
static void test_TreatAsClass(void)
Definition: compobj.c:2045
static void test_OleInitialize_InitCounting(void)
Definition: compobj.c:2156
#define win_skip
Definition: test.h:141
static void test_registered_object_thread_affinity(void)
Definition: compobj.c:1630
static void test_CoMarshalInterface(void)
Definition: compobj.c:1370

◆ Test_CallContext_AddRef()

static ULONG WINAPI Test_CallContext_AddRef ( IUnknown iface)
static

Definition at line 1894 of file compobj.c.

1895 {
1897  return InterlockedIncrement(&This->refs);
1898 }
static Test_CallContext * impl_from_IUnknown(IUnknown *iface)
Definition: compobj.c:1871
#define InterlockedIncrement
Definition: armddk.h:53

◆ Test_CallContext_QueryInterface()

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

Definition at line 1876 of file compobj.c.

1880 {
1881  if (ppvObj == NULL) return E_POINTER;
1882 
1883  if (IsEqualGUID(riid, &IID_IUnknown))
1884  {
1885  *ppvObj = iface;
1886  IUnknown_AddRef(iface);
1887  return S_OK;
1888  }
1889 
1890  *ppvObj = NULL;
1891  return E_NOINTERFACE;
1892 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define E_POINTER
Definition: winerror.h:2365

◆ Test_CallContext_Release()

static ULONG WINAPI Test_CallContext_Release ( IUnknown iface)
static

Definition at line 1900 of file compobj.c.

1901 {
1903  ULONG refs = InterlockedDecrement(&This->refs);
1904  if (!refs)
1905  HeapFree(GetProcessHeap(), 0, This);
1906  return refs;
1907 }
static Test_CallContext * impl_from_IUnknown(IUnknown *iface)
Definition: compobj.c:1871
#define GetProcessHeap()
Definition: compat.h:395
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ test_CLSIDFromProgID()

static void test_CLSIDFromProgID ( void  )
static

Definition at line 370 of file compobj.c.

371 {
372  ULONG_PTR cookie = 0;
373  HANDLE handle;
374  CLSID clsid;
376  ok(hr == S_OK, "CLSIDFromProgID failed with error 0x%08x\n", hr);
377  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
378 
380  ok_ole_success(hr, "CLSIDFromString");
381  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
382 
383  /* test some failure cases */
384 
386  ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08x\n", hr);
387 
389  ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08x\n", hr);
390 
391  memset(&clsid, 0xcc, sizeof(clsid));
393  ok(hr == CO_E_CLASSSTRING, "CLSIDFromProgID on nonexistent ProgID should have returned CO_E_CLASSSTRING instead of 0x%08x\n", hr);
394  ok(IsEqualCLSID(&clsid, &CLSID_NULL), "CLSIDFromProgID should have set clsid to all-zeros on failure\n");
395 
396  /* fails without proper context */
397  memset(&clsid, 0xcc, sizeof(clsid));
399  ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
400  ok(IsEqualCLSID(&clsid, &CLSID_NULL), "wrong clsid\n");
401 
402  if ((handle = activate_context(actctx_manifest, &cookie)))
403  {
404  GUID clsid1;
405 
406  memset(&clsid, 0xcc, sizeof(clsid));
408  ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
409  ok(IsEqualCLSID(&clsid, &CLSID_NULL), "should have zero CLSID on failure\n");
410 
411  /* CLSIDFromString() doesn't check activation context */
413  ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
414 
415  clsid = CLSID_NULL;
417  ok(hr == S_OK, "got 0x%08x\n", hr);
418  /* it returns generated CLSID here */
420  "got wrong clsid %s\n", wine_dbgstr_guid(&clsid));
421 
422  /* duplicate progid present in context - returns generated guid here too */
423  clsid = CLSID_NULL;
425  ok(hr == S_OK, "got 0x%08x\n", hr);
426  clsid1 = CLSID_StdFont;
427  /* that's where it differs from StdFont */
428  clsid1.Data4[7] = 0x52;
430  "got %s\n", wine_dbgstr_guid(&clsid));
431 
432  pDeactivateActCtx(0, cookie);
433  pReleaseActCtx(handle);
434  }
435 }
static const CLSID CLSID_StdFont
Definition: compobj.c:89
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
HRESULT hr
Definition: shlfolder.c:183
const char * wine_dbgstr_guid(const GUID *guid)
static const WCHAR wszNonExistent[]
Definition: compobj.c:101
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2511
#define ok_ole_success(hr, func)
Definition: compobj.c:84
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR stdfont[]
Definition: compobj.c:100
#define CLSID_NULL
Definition: guiddef.h:99
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_non_existent
Definition: compobj.c:88
REFCLSID clsid
Definition: msctf.c:84
static const char actctx_manifest[]
Definition: compobj.c:258
static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
Definition: compobj.c:212
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2247
#define CO_E_CLASSSTRING
Definition: winerror.h:2806
#define memset(x, y, z)
Definition: compat.h:39
static const WCHAR progidW[]
Definition: compobj.c:107
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96

Referenced by START_TEST().

◆ test_CLSIDFromString()

static void test_CLSIDFromString ( void  )
static

Definition at line 437 of file compobj.c.

438 {
439  CLSID clsid;
440  WCHAR wszCLSID_Broken[50];
441  UINT i;
442 
444  ok_ole_success(hr, "CLSIDFromString");
445  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
446 
447  memset(&clsid, 0xab, sizeof(clsid));
449  ok(hr == S_OK, "got 0x%08x\n", hr);
450  ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n");
451 
452  /* string is longer, but starts with a valid CLSID */
453  memset(&clsid, 0, sizeof(clsid));
455  ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
457 
458  lstrcpyW(wszCLSID_Broken, wszCLSID_StdFont);
459  for(i = lstrlenW(wszCLSID_StdFont); i < 49; i++)
460  wszCLSID_Broken[i] = 'A';
461  wszCLSID_Broken[i] = '\0';
462 
463  memset(&clsid, 0, sizeof(CLSID));
464  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
465  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
466  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
467 
468  wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = 'A';
469  memset(&clsid, 0, sizeof(CLSID));
470  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
471  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
472  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
473 
474  wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)] = '\0';
475  memset(&clsid, 0, sizeof(CLSID));
476  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
477  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
478  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
479 
480  wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = '\0';
481  memset(&clsid, 0, sizeof(CLSID));
482  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
483  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
484  ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
485 
486  memset(&clsid, 0xcc, sizeof(CLSID));
487  hr = CLSIDFromString(wszCLSID_Broken+1, &clsid);
488  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
489  ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n");
490 
491  wszCLSID_Broken[9] = '*';
492  memset(&clsid, 0xcc, sizeof(CLSID));
493  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
494  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
495  ok(clsid.Data1 == CLSID_StdFont.Data1, "Got %08x\n", clsid.Data1);
496  ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
497 
498  wszCLSID_Broken[3] = '*';
499  memset(&clsid, 0xcc, sizeof(CLSID));
500  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
501  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
502  ok(clsid.Data1 == 0xb, "Got %08x\n", clsid.Data1);
503  ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
504 
505  wszCLSID_Broken[3] = '\0';
506  memset(&clsid, 0xcc, sizeof(CLSID));
507  hr = CLSIDFromString(wszCLSID_Broken, &clsid);
508  ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
509  ok(clsid.Data1 == 0xb, "Got %08x\n", clsid.Data1);
510  ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
511 }
static const CLSID CLSID_StdFont
Definition: compobj.c:89
HRESULT hr
Definition: shlfolder.c:183
const char * wine_dbgstr_guid(const GUID *guid)
#define lstrlenW
Definition: compat.h:407
#define ok_ole_success(hr, func)
Definition: compobj.c:84
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
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR wszCLSID_StdFont[]
Definition: compobj.c:102
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CLSID_NULL
Definition: guiddef.h:99
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:84
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:406
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
static const WCHAR cf_brokenW[]
Definition: compobj.c:108
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2247
#define CO_E_CLASSSTRING
Definition: winerror.h:2806
const GUID IID_IClassFactory
#define memset(x, y, z)
Definition: compat.h:39
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96

Referenced by START_TEST().

◆ test_CoCreateGuid()

static void test_CoCreateGuid ( void  )
static

Definition at line 2424 of file compobj.c.

2425 {
2426  HRESULT hr;
2427 
2428  hr = CoCreateGuid(NULL);
2429  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
2430 }
HRESULT hr
Definition: shlfolder.c:183
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2115
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_CoCreateInstance()

static void test_CoCreateInstance ( void  )
static

Definition at line 620 of file compobj.c.

621 {
622  HRESULT hr;
623  IUnknown *pUnk;
624  REFCLSID rclsid = &CLSID_InternetZoneManager;
625 
626  pUnk = (IUnknown *)0xdeadbeef;
627  hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
628  ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
629  ok(pUnk == NULL, "CoCreateInstance should have changed the passed in pointer to NULL, instead of %p\n", pUnk);
630 
632 
633  /* test errors returned for non-registered clsids */
634  hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
635  ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
636  hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&pUnk);
637  ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc handler should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
638  hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_LOCAL_SERVER, &IID_IUnknown, (void **)&pUnk);
639  ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered local server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
640  hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_REMOTE_SERVER, &IID_IUnknown, (void **)&pUnk);
641  ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered remote server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
642 
643  hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
644  if(hr == REGDB_E_CLASSNOTREG)
645  {
646  skip("IE not installed so can't test CoCreateInstance\n");
647  OleUninitialize();
648  return;
649  }
650 
651  ok_ole_success(hr, "CoCreateInstance");
652  if(pUnk) IUnknown_Release(pUnk);
653  OleUninitialize();
654 
655  hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
656  ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
657 
658  test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
659 }
HRESULT hr
Definition: shlfolder.c:183
#define REFCLSID
Definition: guiddef.h:117
#define test_apt_type(t, q)
Definition: compobj.c:603
#define ok_ole_success(hr, func)
Definition: compobj.c:84
#define CO_E_NOTINITIALIZED
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
static const CLSID CLSID_non_existent
Definition: compobj.c:88
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:172
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:233
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

Referenced by START_TEST().

◆ test_CoCreateInstanceEx()

static void test_CoCreateInstanceEx ( void  )
static

Definition at line 730 of file compobj.c.

731 {
732  MULTI_QI qi_res = { &IID_IMoniker };
733  DWORD cookie;
734  HRESULT hr;
735 
737 
739  CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie);
740  ok_ole_success(hr, "CoRegisterClassObject");
741 
743  hr = CoCreateInstanceEx(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER, NULL, 1, &qi_res);
744  ok(hr == E_NOINTERFACE, "CoCreateInstanceEx failed: %08x\n", hr);
745  ok(IsEqualGUID(&create_instance_iid, qi_res.pIID), "Unexpected CreateInstance iid %s\n",
747 
748  hr = CoRevokeClassObject(cookie);
749  ok_ole_success(hr, "CoRevokeClassObject");
750 
751  CoUninitialize();
752 }
static IClassFactory Test_ClassFactory
Definition: compobj.c:186
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
const char * wine_dbgstr_guid(const GUID *guid)
static IID create_instance_iid
Definition: compobj.c:157
#define ok_ole_success(hr, func)
Definition: compobj.c:84
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1089
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, COSERVERINFO *pServerInfo, ULONG cmq, MULTI_QI *pResults)
Definition: compobj.c:3296
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:141
#define IID_NULL
Definition: guiddef.h:98
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2806
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897

Referenced by START_TEST().

◆ test_CoFreeUnusedLibraries()

static void test_CoFreeUnusedLibraries ( void  )
static

Definition at line 1729 of file compobj.c.

1730 {
1731  HRESULT hr;
1732  IUnknown *pUnk;
1733  DWORD tid;
1734  HANDLE thread;
1735 
1736  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1737 
1738  ok(!is_module_loaded("urlmon.dll"), "urlmon.dll shouldn't be loaded\n");
1739 
1740  hr = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pUnk);
1741  if (hr == REGDB_E_CLASSNOTREG)
1742  {
1743  skip("IE not installed so can't run CoFreeUnusedLibraries test\n");
1744  CoUninitialize();
1745  return;
1746  }
1747  ok_ole_success(hr, "CoCreateInstance");
1748 
1749  ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1750 
1751  ok(pUnk != NULL ||
1752  broken(pUnk == NULL), /* win9x */
1753  "Expected a valid pointer\n");
1754  if (pUnk)
1755  IUnknown_Release(pUnk);
1756 
1757  ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1758 
1760  ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1762 
1763  ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1764 
1766 
1767  ok(!is_module_loaded("urlmon.dll"), "urlmon.dll shouldn't be loaded\n");
1768 
1769  CoUninitialize();
1770 }
#define CloseHandle
Definition: compat.h:398
HRESULT hr
Definition: shlfolder.c:183
static BOOL is_module_loaded(const char *module)
Definition: compobj.c:1724
#define ok_ole_success(hr, func)
Definition: compobj.c:84
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void)
Definition: compobj.c:3610
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:136
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
static DWORD CALLBACK free_libraries_thread(LPVOID p)
Definition: compobj.c:1718
unsigned long DWORD
Definition: ntddk_ex.h:95
static HANDLE thread
Definition: service.c:33
#define broken(x)
Definition: _sntprintf.h:21
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
static TfClientId tid

Referenced by START_TEST().

◆ test_CoGetApartmentType()

static void test_CoGetApartmentType ( void  )
static

Definition at line 3071 of file compobj.c.

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

Referenced by START_TEST().

◆ test_CoGetCallContext()

static void test_CoGetCallContext ( void  )
static

Definition at line 1916 of file compobj.c.

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

Referenced by START_TEST().

◆ test_CoGetClassObject()

static void test_CoGetClassObject ( void  )
static

Definition at line 661 of file compobj.c.

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

Referenced by START_TEST().

◆ test_CoGetContextToken()

static void test_CoGetContextToken ( void  )
static

Definition at line 1973 of file compobj.c.

1974 {
1975  HRESULT hr;
1976  ULONG refs;
1977  ULONG_PTR token, token2;
1978  IObjContext *ctx;
1979 
1980  if (!pCoGetContextToken)
1981  {
1982  win_skip("CoGetContextToken not present\n");
1983  return;
1984  }
1985 
1986  token = 0xdeadbeef;
1987  hr = pCoGetContextToken(&token);
1988  ok(hr == CO_E_NOTINITIALIZED, "Expected CO_E_NOTINITIALIZED, got 0x%08x\n", hr);
1989  ok(token == 0xdeadbeef, "Expected 0, got 0x%lx\n", token);
1990 
1991  test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
1992 
1993  CoInitialize(NULL);
1994 
1996 
1997  hr = pCoGetContextToken(NULL);
1998  ok(hr == E_POINTER, "Expected E_POINTER, got 0x%08x\n", hr);
1999 
2000  token = 0;
2001  hr = pCoGetContextToken(&token);
2002  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2003  ok(token, "Expected token != 0\n");
2004 
2005  token2 = 0;
2006  hr = pCoGetContextToken(&token2);
2007  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2008  ok(token2 == token, "got different token\n");
2009 
2010  refs = IUnknown_AddRef((IUnknown *)token);
2011  ok(refs == 1, "Expected 1, got %u\n", refs);
2012 
2013  hr = pCoGetObjectContext(&IID_IObjContext, (void **)&ctx);
2014  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2015  ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
2016 
2017  refs = IObjContext_AddRef(ctx);
2018  ok(refs == 3, "Expected 3, got %u\n", refs);
2019 
2020  refs = IObjContext_Release(ctx);
2021  ok(refs == 2, "Expected 2, got %u\n", refs);
2022 
2023  refs = IUnknown_Release((IUnknown *)token);
2024  ok(refs == 1, "Expected 1, got %u\n", refs);
2025 
2026  /* CoGetContextToken does not add a reference */
2027  token = 0;
2028  hr = pCoGetContextToken(&token);
2029  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2030  ok(token, "Expected token != 0\n");
2031  ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
2032 
2033  refs = IObjContext_AddRef(ctx);
2034  ok(refs == 2, "Expected 1, got %u\n", refs);
2035 
2036  refs = IObjContext_Release(ctx);
2037  ok(refs == 1, "Expected 0, got %u\n", refs);
2038 
2039  refs = IObjContext_Release(ctx);
2040  ok(refs == 0, "Expected 0, got %u\n", refs);
2041 
2042  CoUninitialize();
2043 }
HRESULT hr
Definition: shlfolder.c:183
#define test_apt_type(t, q)
Definition: compobj.c:603
#define CO_E_NOTINITIALIZED
uint32_t ULONG_PTR
Definition: typedefs.h:63
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
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897
unsigned int ULONG
Definition: retypes.h:1
#define E_POINTER
Definition: winerror.h:2365
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_CoGetCurrentLogicalThreadId()

static void test_CoGetCurrentLogicalThreadId ( void  )
static

Definition at line 3272 of file compobj.c.

3273 {
3274  HRESULT hr;
3275  GUID id;
3276 
3278  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3279 
3280  id = GUID_NULL;
3282  ok(hr == S_OK, "got 0x%08x\n", hr);
3283  ok(!IsEqualGUID(&id, &GUID_NULL), "got null id\n");
3284 }
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *id)
Definition: compobj.c:3921
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define GUID_NULL
Definition: ks.h:106
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
GLenum GLuint id
Definition: glext.h:5579

Referenced by START_TEST().

◆ test_CoGetInstanceFromFile()

static void test_CoGetInstanceFromFile ( void  )
static

Definition at line 3552 of file compobj.c.

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

Referenced by START_TEST().

◆ test_CoGetInterfaceAndReleaseStream()

static void test_CoGetInterfaceAndReleaseStream ( void  )
static

Definition at line 1356 of file compobj.c.

1357 {
1358  HRESULT hr;
1359  IUnknown *pUnk;
1360 
1361  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1362 
1364  ok(hr == E_INVALIDARG, "hr %08x\n", hr);
1365 
1366  CoUninitialize();
1367 }
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID riid, LPVOID *ppv)
Definition: marshal.c:2145
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
#define ok(value,...)
Definition: atltest.h:57
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

Referenced by START_TEST().

◆ test_CoGetMalloc()

static void test_CoGetMalloc ( void  )
static

Definition at line 3031 of file compobj.c.

3032 {
3033  IMalloc *imalloc;
3034  HRESULT hr;
3035 
3036  if (0) /* crashes on native */
3037  hr = CoGetMalloc(0, NULL);
3038 
3039  imalloc = (void*)0xdeadbeef;
3040  hr = CoGetMalloc(0, &imalloc);
3041  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3042  ok(imalloc == NULL, "got %p\n", imalloc);
3043 
3044  imalloc = (void*)0xdeadbeef;
3045  hr = CoGetMalloc(MEMCTX_SHARED, &imalloc);
3046  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3047  ok(imalloc == NULL, "got %p\n", imalloc);
3048 
3049  imalloc = (void*)0xdeadbeef;
3050  hr = CoGetMalloc(MEMCTX_MACSYSTEM, &imalloc);
3051  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3052  ok(imalloc == NULL, "got %p\n", imalloc);
3053 
3054  imalloc = (void*)0xdeadbeef;
3055  hr = CoGetMalloc(MEMCTX_UNKNOWN, &imalloc);
3056  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3057  ok(imalloc == NULL, "got %p\n", imalloc);
3058 
3059  imalloc = (void*)0xdeadbeef;
3060  hr = CoGetMalloc(MEMCTX_SAME, &imalloc);
3061  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3062  ok(imalloc == NULL, "got %p\n", imalloc);
3063 
3064  imalloc = NULL;
3065  hr = CoGetMalloc(MEMCTX_TASK, &imalloc);
3066  ok(hr == S_OK, "got 0x%08x\n", hr);
3067  ok(imalloc != NULL, "got %p\n", imalloc);
3068  IMalloc_Release(imalloc);
3069 }
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI CoGetMalloc(DWORD context, IMalloc **imalloc)
Definition: ifs.c:383
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_CoGetObjectContext()

static void test_CoGetObjectContext ( void  )
static

Definition at line 1772 of file compobj.c.

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

Referenced by START_TEST().

◆ test_CoGetPSClsid()

static void test_CoGetPSClsid ( void  )
static

Definition at line 1184 of file compobj.c.

1185 {
1186  ULONG_PTR cookie;
1187  HANDLE handle;
1188  HRESULT hr;
1189  CLSID clsid;
1190  HKEY hkey;
1191  LONG res;
1192  const BOOL is_win64 = (sizeof(void*) != sizeof(int));
1193  BOOL is_wow64 = FALSE;
1194 
1197  "CoGetPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n",
1198  hr);
1199 
1200  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1201 
1203  ok_ole_success(hr, "CoGetPSClsid");
1204 
1206  ok(hr == REGDB_E_IIDNOTREG,
1207  "CoGetPSClsid for random IID returned 0x%08x instead of REGDB_E_IIDNOTREG\n",
1208  hr);
1209 
1211  ok(hr == E_INVALIDARG,
1212  "CoGetPSClsid for null clsid returned 0x%08x instead of E_INVALIDARG\n",
1213  hr);
1214 
1215  if (!pRegOverridePredefKey)
1216  {
1217  win_skip("RegOverridePredefKey not available\n");
1218  CoUninitialize();
1219  return;
1220  }
1222  ok_ole_success(hr, "CoGetPSClsid");
1223 
1224  res = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0,
1225  KEY_ALL_ACCESS, NULL, &hkey, NULL);
1226  ok(!res, "RegCreateKeyEx returned %d\n", res);
1227 
1228  res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
1229  ok(!res, "RegOverridePredefKey returned %d\n", res);
1230 
1232  ok_ole_success(hr, "CoGetPSClsid");
1233 
1234  res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
1235  ok(!res, "RegOverridePredefKey returned %d\n", res);
1236 
1237  RegCloseKey(hkey);
1238 
1239  /* not registered CLSID */
1241  ok(hr == REGDB_E_IIDNOTREG, "got 0x%08x\n", hr);
1242 
1243  if ((handle = activate_context(actctx_manifest, &cookie)))
1244  {
1245  memset(&clsid, 0, sizeof(clsid));
1247  ok(hr == S_OK, "got 0x%08x\n", hr);
1248  ok(IsEqualGUID(&clsid, &IID_Testiface), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1249 
1250  memset(&clsid, 0, sizeof(clsid));
1252  ok(hr == S_OK, "got 0x%08x\n", hr);
1253  ok(IsEqualGUID(&clsid, &IID_Testiface2), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1254 
1255  memset(&clsid, 0, sizeof(clsid));
1257  ok(hr == S_OK, "got 0x%08x\n", hr);
1258  ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1259 
1260  memset(&clsid, 0xaa, sizeof(clsid));
1262  ok(hr == S_OK, "got 0x%08x\n", hr);
1263  ok(IsEqualGUID(&clsid, &GUID_NULL), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1264 
1265  /* register same interface and try to get CLSID back */
1267  ok(hr == S_OK, "got 0x%08x\n", hr);
1268  memset(&clsid, 0, sizeof(clsid));
1270  ok(hr == S_OK, "got 0x%08x\n", hr);
1271  ok(IsEqualGUID(&clsid, &IID_Testiface4), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1272 
1273  pDeactivateActCtx(0, cookie);
1274  pReleaseActCtx(handle);
1275  }
1276 
1277  if (pRegDeleteKeyExA &&
1278  (is_win64 ||
1279  (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64)))
1280  {
1281  static GUID IID_DeadBeef = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}};
1282  static const char clsidDeadBeef[] = "{deadbeef-dead-beef-dead-beefdeadbeef}";
1283  static const char clsidA[] = "{66666666-8888-7777-6666-555555555555}";
1284  HKEY hkey_iface, hkey_psclsid;
1286 
1287  hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
1288  ok(hr == REGDB_E_IIDNOTREG, "got 0x%08x\n", hr);
1289 
1290  res = RegCreateKeyExA(HKEY_CLASSES_ROOT, "Interface",
1291  0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_iface, NULL);
1292  ok(!res, "RegCreateKeyEx returned %d\n", res);
1293  res = RegCreateKeyExA(hkey_iface, clsidDeadBeef,
1294  0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey, NULL);
1295  if (res == ERROR_ACCESS_DENIED)
1296  {
1297  win_skip("Failed to create a key, skipping some of CoGetPSClsid() tests\n");
1298  goto cleanup;
1299  }
1300 
1301  ok(!res, "RegCreateKeyEx returned %d\n", res);
1302  res = RegCreateKeyExA(hkey, "ProxyStubClsid32",
1303  0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_psclsid, NULL);
1304  ok(!res, "RegCreateKeyEx returned %d\n", res);
1305  res = RegSetValueExA(hkey_psclsid, NULL, 0, REG_SZ, (const BYTE *)clsidA, strlen(clsidA)+1);
1306  ok(!res, "RegSetValueEx returned %d\n", res);
1307  RegCloseKey(hkey_psclsid);
1308 
1309  hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
1310  ok_ole_success(hr, "CoGetPSClsid");
1311  ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1312 
1313  res = pRegDeleteKeyExA(hkey, "ProxyStubClsid32", opposite, 0);
1314  ok(!res, "RegDeleteKeyEx returned %d\n", res);
1315  RegCloseKey(hkey);
1316  res = pRegDeleteKeyExA(hkey_iface, clsidDeadBeef, opposite, 0);
1317  ok(!res, "RegDeleteKeyEx returned %d\n", res);
1318 
1319  cleanup:
1320  RegCloseKey(hkey_iface);
1321  }
1322 
1323  CoUninitialize();
1324 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define REGDB_E_IIDNOTREG
Definition: winerror.h:2697
const char * wine_dbgstr_guid(const GUID *guid)
HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid)
Definition: compobj.c:2687
#define ok_ole_success(hr, func)
Definition: compobj.c:84
#define CO_E_NOTINITIALIZED
uint32_t ULONG_PTR
Definition: typedefs.h:63
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define E_INVALIDARG
Definition: ddrawi.h:101
static const BOOL is_win64
Definition: shellpath.c:54
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
Definition: compobj.c:2599
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
LONG HRESULT
Definition: typedefs.h:77
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
static BOOL is_wow64
Definition: loader.c:55
REFCLSID clsid
Definition: msctf.c:84
static const char actctx_manifest[]
Definition: compobj.c:258
static const GUID IID_Testiface3
Definition: compobj.c:92
unsigned char BYTE
Definition: mem.h:68
#define GUID_NULL
Definition: ks.h:106
static const GUID IID_Testiface2
Definition: compobj.c:91
static const GUID IID_TestPS
Definition: compobj.c:96
static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
Definition: compobj.c:212
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define ok(value,...)
Definition: atltest.h:57
ACCESS_MASK REGSAM
Definition: winreg.h:69
static const IID IID_IWineTest
Definition: marshal.c:122
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
GLuint res
Definition: glext.h:9613
char * cleanup(char *str)
Definition: wpickclick.c:99
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4812
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:1029
static const GUID IID_Testiface4
Definition: compobj.c:93
const GUID IID_IClassFactory
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141
static const GUID IID_Testiface
Definition: compobj.c:90
#define REG_SZ
Definition: layer.c:22

Referenced by START_TEST().

◆ test_CoInitializeEx()

static void test_CoInitializeEx ( void  )
static

Definition at line 2134 of file compobj.c.

2135 {
2136  HRESULT hr;
2137 
2138  hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
2139  ok(hr == S_OK, "CoInitializeEx failed with error 0x%08x\n", hr);
2140 
2141  /* Calling OleInitialize for the first time should yield S_OK even with
2142  * apartment already initialized by previous CoInitialize(Ex) calls. */
2143  hr = OleInitialize(NULL);
2144  ok(hr == S_OK, "OleInitialize failed with error 0x%08x\n", hr);
2145 
2146  /* Subsequent calls to OleInitialize should return S_FALSE */
2147  hr = OleInitialize(NULL);
2148  ok(hr == S_FALSE, "Expected S_FALSE, hr = 0x%08x\n", hr);
2149 
2150  /* Cleanup */
2151  CoUninitialize();
2152  OleUninitialize();
2153  OleUninitialize();
2154 }
HRESULT hr
Definition: shlfolder.c:183
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:172
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
#define ok(value,...)
Definition: atltest.h:57
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:233

Referenced by START_TEST().

◆ test_CoMarshalInterface()

static void test_CoMarshalInterface ( void  )
static

Definition at line 1370 of file compobj.c.

1371 {
1372  IStream *pStream;
1373  HRESULT hr;
1374  static const LARGE_INTEGER llZero;
1375 
1376  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1377 
1378  hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
1379  ok_ole_success(hr, "CreateStreamOnHGlobal");
1380 
1381  hr = CoMarshalInterface(pStream, &IID_IUnknown, NULL, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1382  ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1383 
1384  hr = CoMarshalInterface(NULL, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1385  ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1386 
1387  hr = CoMarshalInterface(pStream, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1388  ok_ole_success(hr, "CoMarshalInterface");
1389 
1390  /* stream not rewound */
1391  hr = CoReleaseMarshalData(pStream);
1392  ok(hr == STG_E_READFAULT, "CoReleaseMarshalData should have returned STG_E_READFAULT instead of 0x%08x\n", hr);
1393 
1394  hr = IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
1395  ok_ole_success(hr, "IStream_Seek");
1396 
1397  hr = CoReleaseMarshalData(pStream);
1398  ok_ole_success(hr, "CoReleaseMarshalData");
1399 
1400  IStream_Release(pStream);
1401 
1402  CoUninitialize();
1403 }
HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
Definition: marshal.c:2056
#define TRUE
Definition: types.h:120
static IClassFactory Test_ClassFactory
Definition: compobj.c:186
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
#define ok_ole_success(hr, func)
Definition: compobj.c:84
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static const LARGE_INTEGER llZero
Definition: moniker.c:1113
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
#define ok(value,...)
Definition: atltest.h:57
#define STG_E_READFAULT
Definition: winerror.h:2576
HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:1877

Referenced by START_TEST().

◆ test_CoMarshalInterThreadInterfaceInStream()

static void test_CoMarshalInterThreadInterfaceInStream ( void  )
static

Definition at line 1405 of file compobj.c.

1406 {
1407  IStream *pStream;
1408  HRESULT hr;
1409  IClassFactory *pProxy;
1410 
1411  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1412 
1413  cLocks = 0;
1414 
1416  ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1417 
1419  ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1420 
1421  ok_no_locks();
1422 
1424  ok_ole_success(hr, "CoMarshalInterThreadInterfaceInStream");
1425 
1427 
1428  hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
1429  ok_ole_success(hr, "CoUnmarshalInterface");
1430 
1431  IClassFactory_Release(pProxy);
1432  IStream_Release(pStream);
1433 
1434  ok_no_locks();
1435 
1436  CoUninitialize();
1437 }
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1982
static IClassFactory Test_ClassFactory
Definition: compobj.c:186
HRESULT hr
Definition: shlfolder.c:183
static LONG cLocks
Definition: compobj.c:114
#define ok_ole_success(hr, func)
Definition: compobj.c:84
#define ok_more_than_one_lock()
Definition: compobj.c:85
#define E_INVALIDARG
Definition: