ReactOS 0.4.16-dev-336-gb667d82
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; static unsigned int called_ ## func = 0
 
#define SET_EXPECT(func)    expect_ ## func = TRUE
 
#define CHECK_EXPECT2(func)
 
#define CHECK_EXPECT(func)
 
#define CHECK_CALLED(func, n)
 
#define ok_ole_success(hr, func)   ok(hr == S_OK, func " failed with error 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)
 
 DEFINE_EXPECT (PreInitialize)
 
 DEFINE_EXPECT (PostInitialize)
 
 DEFINE_EXPECT (PreUninitialize)
 
 DEFINE_EXPECT (PostUninitialize)
 
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 DWORD WINAPI test_init_spies_proc (void *arg)
 
static void test_IInitializeSpy (BOOL mt)
 
static HRESULT WINAPI testinstance_QI (IPersistFile *iface, REFIID riid, void **obj)
 
static ULONG WINAPI testinstance_AddRef (IPersistFile *iface)
 
static ULONG WINAPI testinstance_Release (IPersistFile *iface)
 
static HRESULT WINAPI testinstance_GetClassID (IPersistFile *iface, CLSID *clsid)
 
static HRESULT WINAPI testinstance_IsDirty (IPersistFile *iface)
 
static HRESULT WINAPI testinstance_Load (IPersistFile *iface, LPCOLESTR filename, DWORD mode)
 
static HRESULT WINAPI testinstance_Save (IPersistFile *iface, LPCOLESTR filename, BOOL remember)
 
static HRESULT WINAPI testinstance_SaveCompleted (IPersistFile *iface, LPCOLESTR filename)
 
static HRESULT WINAPI testinstance_GetCurFile (IPersistFile *iface, LPOLESTR *filename)
 
static HRESULT WINAPI getinstance_cf_QI (IClassFactory *iface, REFIID riid, void **obj)
 
static ULONG WINAPI getinstance_cf_AddRef (IClassFactory *iface)
 
static ULONG WINAPI getinstance_cf_Release (IClassFactory *iface)
 
static HRESULT WINAPI getinstance_cf_CreateInstance (IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
 
static HRESULT WINAPI getinstance_cf_LockServer (IClassFactory *iface, BOOL lock)
 
static void test_CoGetInstanceFromFile (void)
 
static void test_GlobalOptions (void)
 
static void init_funcs (void)
 
static DWORD CALLBACK implicit_mta_proc (void *param)
 
static void test_implicit_mta (void)
 
 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 DWORD expected_coinit_flags
 
static ULARGE_INTEGER init_cookies [3]
 
static BOOL revoke_spies_on_uninit
 
static const IInitializeSpyVtbl testinitializevtbl
 
static IInitializeSpy testinitialize = { &testinitializevtbl }
 
static HRESULT g_persistfile_qi_ret
 
static HRESULT g_persistfile_load_ret
 
static const IPersistFileVtbl testpersistfilevtbl
 
static IPersistFile testpersistfile = { &testpersistfilevtbl }
 
static const IClassFactoryVtbl getinstance_cf_vtbl
 
static IClassFactory getinstance_cf = { &getinstance_cf_vtbl }
 

Macro Definition Documentation

◆ CHECK_CALLED

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

Definition at line 59 of file compobj.c.

◆ CHECK_EXPECT

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

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++; \
}while(0)

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

◆ cowait_msgs_expect_notified

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

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

◆ DEFINE_EXPECT

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

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 90 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 91 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 89 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 608 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 2486 of file compobj.c.

2487{
2489 ok_(__FILE__,line)(0, "unexpected message %u\n", cowait_msgs[cowait_msgs_first]);
2491 }
2493}
#define ok_(x1, x2)
Definition: atltest.h:61
static void cowait_msgs_reset(void)
Definition: compobj.c:2480
static UINT cowait_msgs[100]
Definition: compobj.c:2478
static UINT cowait_msgs_first
Definition: compobj.c:2478
static UINT cowait_msgs_last
Definition: compobj.c:2478
Definition: parser.c:49

◆ _cowait_msgs_expect_notified()

static void _cowait_msgs_expect_notified ( unsigned  line,
UINT  expected_msg 
)
static

Definition at line 2496 of file compobj.c.

2497{
2499 ok_(__FILE__,line)(0, "expected message %u, received none\n", expected_msg);
2500 }else {
2501 ok_(__FILE__,line)(cowait_msgs[cowait_msgs_first] == expected_msg,
2502 "expected message %u, received %u \n",
2503 expected_msg, cowait_msgs[cowait_msgs_first]);
2505 }
2506}

◆ _cowait_msgs_expect_queued()

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

Definition at line 2509 of file compobj.c.

2510{
2511 MSG msg;
2512 BOOL success;
2513
2514 success = PeekMessageA(&msg, hwnd, expected_msg, expected_msg, PM_REMOVE);
2515 ok_(__FILE__,line)(success, "PeekMessageA failed: %u\n", GetLastError());
2516 if(success)
2517 ok_(__FILE__,line)(msg.message == expected_msg, "unexpected message %u, expected %u\n",
2518 msg.message, expected_msg);
2519}
#define msg(x)
Definition: auth_time.c:54
unsigned int BOOL
Definition: ntddk_ex.h:94
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define success(from, fromstr, to, tostr)
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define PM_REMOVE
Definition: winuser.h:1199
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)

◆ _test_apt_type()

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

Definition at line 609 of file compobj.c.

610{
612 APTTYPE type = ~0u;
613 HRESULT hr;
614
615 if (!pCoGetApartmentType)
616 return;
617
618 hr = pCoGetApartmentType(&type, &qualifier);
619 ok_(__FILE__, line)(hr == S_OK || hr == CO_E_NOTINITIALIZED, "Unexpected return code: 0x%08x\n", hr);
620 ok_(__FILE__, line)(type == expected_type, "Wrong apartment type %d, expected %d\n", type, expected_type);
621 ok_(__FILE__, line)(qualifier == expected_qualifier, "Wrong apartment qualifier %d, expected %d\n", qualifier,
622 expected_qualifier);
623}
#define CO_E_NOTINITIALIZED
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define S_OK
Definition: intsafe.h:52
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:79
enum _APTTYPEQUALIFIER APTTYPEQUALIFIER
HRESULT hr
Definition: shlfolder.c:183

◆ activate_context()

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

Definition at line 217 of file compobj.c.

218{
220 ACTCTXW actctx;
222 BOOL ret;
223
224 if (!pCreateActCtxW) return NULL;
225
226 create_manifest_file("file.manifest", manifest);
227
228 MultiByteToWideChar( CP_ACP, 0, "file.manifest", -1, path, MAX_PATH );
229 memset(&actctx, 0, sizeof(ACTCTXW));
230 actctx.cbSize = sizeof(ACTCTXW);
231 actctx.lpSource = path;
232
233 handle = pCreateActCtxW(&actctx);
234 ok(handle != INVALID_HANDLE_VALUE || broken(handle == INVALID_HANDLE_VALUE) /* some old XP/2k3 versions */,
235 "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
237 {
238 win_skip("activation context generation failed, some tests will be skipped\n");
239 handle = NULL;
240 }
241
242 ok(actctx.cbSize == sizeof(ACTCTXW), "actctx.cbSize=%d\n", actctx.cbSize);
243 ok(actctx.dwFlags == 0, "actctx.dwFlags=%d\n", actctx.dwFlags);
244 ok(actctx.lpSource == path, "actctx.lpSource=%p\n", actctx.lpSource);
245 ok(actctx.wProcessorArchitecture == 0, "actctx.wProcessorArchitecture=%d\n", actctx.wProcessorArchitecture);
246 ok(actctx.wLangId == 0, "actctx.wLangId=%d\n", actctx.wLangId);
247 ok(actctx.lpAssemblyDirectory == NULL, "actctx.lpAssemblyDirectory=%p\n", actctx.lpAssemblyDirectory);
248 ok(actctx.lpResourceName == NULL, "actctx.lpResourceName=%p\n", actctx.lpResourceName);
249 ok(actctx.lpApplicationName == NULL, "actctx.lpApplicationName=%p\n", actctx.lpApplicationName);
250 ok(actctx.hModule == NULL, "actctx.hModule=%p\n", actctx.hModule);
251
252 DeleteFileA("file.manifest");
253
254 if (handle)
255 {
256 ret = pActivateActCtx(handle, cookie);
257 ok(ret, "ActivateActCtx failed: %u\n", GetLastError());
258 }
259
260 return handle;
261}
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define MultiByteToWideChar
Definition: compat.h:110
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define actctx
Definition: kernel32.h:8
static BOOL create_manifest_file(const char *filename, const char *manifest)
Definition: compobj.c:195
#define win_skip
Definition: test.h:163
#define memset(x, y, z)
Definition: compat.h:39
Definition: cookie.c:34
static const CHAR manifest[]
Definition: v6util.h:41
int ret
__wchar_t WCHAR
Definition: xmlstorage.h:180

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

2439{
2440 /* nothing */
2441}

Referenced by test_CoWaitForMultipleHandles().

◆ BOOL()

static BOOL ( WINAPI pActivateActCtx)
static

◆ cowait_msgs_reset()

static void cowait_msgs_reset ( void  )
static

Definition at line 2480 of file compobj.c.

2481{
2483}

Referenced by _cowait_msgs_expect_empty(), and test_CoWaitForMultipleHandles().

◆ cowait_unmarshal_thread()

static DWORD CALLBACK cowait_unmarshal_thread ( void arg)
static

Definition at line 2536 of file compobj.c.

2537{
2538 IStream *stream = arg;
2539 IEnumOLEVERB *enum_verb;
2541 IUnknown *unk;
2542 HRESULT hr;
2543
2545
2546 zero.QuadPart = 0;
2547 hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
2548 ok(hr == S_OK, "Seek failed: %08x\n", hr);
2549
2550 hr = CoUnmarshalInterface(stream, &IID_IUnknown, (void**)&unk);
2551 ok(hr == S_OK, "CoUnmarshalInterface failed: %08x\n", hr);
2552
2553 hr = IUnknown_QueryInterface(unk, &IID_IEnumOLEVERB, (void**)&enum_verb);
2554 ok(hr == S_OK, "QueryInterface failed: %08x\n", hr);
2555
2556 IEnumOLEVERB_Release(enum_verb);
2557 IUnknown_Release(unk);
2558
2560 return 0;
2561}
const GUID IID_IUnknown
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1981
const GUID IID_IEnumOLEVERB
int zero
Definition: sehframes.cpp:29
Definition: parse.h:23
void * arg
Definition: msvc.h:10

Referenced by test_CoWaitForMultipleHandles_thread().

◆ cowait_window_proc()

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

Definition at line 2527 of file compobj.c.

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

Referenced by test_CoWaitForMultipleHandles().

◆ create_manifest_file()

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

Definition at line 195 of file compobj.c.

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

Referenced by activate_context().

◆ DEFINE_EXPECT() [1/5]

DEFINE_EXPECT ( CreateStub  )

◆ DEFINE_EXPECT() [2/5]

DEFINE_EXPECT ( PostInitialize  )

◆ DEFINE_EXPECT() [3/5]

DEFINE_EXPECT ( PostUninitialize  )

◆ DEFINE_EXPECT() [4/5]

DEFINE_EXPECT ( PreInitialize  )

◆ DEFINE_EXPECT() [5/5]

DEFINE_EXPECT ( PreUninitialize  )

◆ DEFINE_GUID() [1/4]

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

◆ DEFINE_GUID() [2/4]

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

◆ DEFINE_GUID() [3/4]

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

◆ DEFINE_GUID() [4/4]

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

◆ EnumOLEVERB_AddRef()

static ULONG WINAPI EnumOLEVERB_AddRef ( IEnumOLEVERB iface)
static

Definition at line 908 of file compobj.c.

909{
910 return 2;
911}

◆ EnumOLEVERB_Clone()

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

Definition at line 936 of file compobj.c.

937{
938 ok(0, "unexpected call\n");
939 return E_NOTIMPL;
940}
#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 918 of file compobj.c.

919{
920 ok(0, "unexpected call\n");
921 return E_NOTIMPL;
922}

◆ EnumOLEVERB_QueryInterface()

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

Definition at line 903 of file compobj.c.

904{
905 return IUnknown_QueryInterface(&Test_Unknown, riid, ppv);
906}
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static IUnknown Test_Unknown
Definition: compobj.c:901

◆ EnumOLEVERB_Release()

static ULONG WINAPI EnumOLEVERB_Release ( IEnumOLEVERB iface)
static

Definition at line 913 of file compobj.c.

914{
915 return 1;
916}

◆ EnumOLEVERB_Reset()

static HRESULT WINAPI EnumOLEVERB_Reset ( IEnumOLEVERB iface)
static

Definition at line 930 of file compobj.c.

931{
932 ok(0, "unexpected call\n");
933 return E_NOTIMPL;
934}

◆ EnumOLEVERB_Skip()

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

Definition at line 924 of file compobj.c.

925{
926 ok(0, "unexpected call\n");
927 return E_NOTIMPL;
928}

◆ flush_messages()

static void flush_messages ( void  )
static

Definition at line 2521 of file compobj.c.

2522{
2523 MSG msg;
2524 while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ));
2525}

Referenced by test_CoWaitForMultipleHandles().

◆ free_libraries_thread()

static DWORD CALLBACK free_libraries_thread ( LPVOID  p)
static

Definition at line 1724 of file compobj.c.

1725{
1727 return 0;
1728}
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void)
Definition: compobj.c:3701

Referenced by test_CoFreeUnusedLibraries().

◆ get_class_object()

static HRESULT get_class_object ( CLSCTX  clsctx)
static

Definition at line 1554 of file compobj.c.

1555{
1556 HRESULT hr;
1557 IClassFactory *pcf;
1558
1560 (void **)&pcf);
1561
1562 if (SUCCEEDED(hr))
1563 IClassFactory_Release(pcf);
1564
1565 return hr;
1566}
const GUID IID_IClassFactory
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3103
#define SUCCEEDED(hr)
Definition: intsafe.h:50
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:141

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

1583{
1584 CLSCTX clsctx = (CLSCTX)(DWORD_PTR)pv;
1585 HRESULT hr;
1586 IClassFactory *pcf;
1587 IMultiQI *pMQI;
1588
1589 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1590
1592 (void **)&pcf);
1593
1594 if (SUCCEEDED(hr))
1595 {
1596 hr = IClassFactory_QueryInterface(pcf, &IID_IMultiQI, (void **)&pMQI);
1597 if (SUCCEEDED(hr))
1598 IMultiQI_Release(pMQI);
1599 IClassFactory_Release(pcf);
1600 }
1601
1603
1604 return hr;
1605}
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
uint32_t DWORD_PTR
Definition: typedefs.h:65

Referenced by test_registered_object_thread_affinity().

◆ get_class_object_thread()

static DWORD CALLBACK get_class_object_thread ( LPVOID  pv)
static

Definition at line 1568 of file compobj.c.

1569{
1570 CLSCTX clsctx = (CLSCTX)(DWORD_PTR)pv;
1571 HRESULT hr;
1572
1573 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1574
1575 hr = get_class_object(clsctx);
1576
1578
1579 return hr;
1580}
static HRESULT get_class_object(CLSCTX clsctx)
Definition: compobj.c:1554

Referenced by test_registered_object_thread_affinity().

◆ getinstance_cf_AddRef()

static ULONG WINAPI getinstance_cf_AddRef ( IClassFactory iface)
static

Definition at line 3597 of file compobj.c.

3598{
3599 return 2;
3600}

◆ getinstance_cf_CreateInstance()

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

Definition at line 3607 of file compobj.c.

3609{
3610 if (IsEqualIID(riid, &IID_IUnknown)) {
3611 *obj = &testpersistfile;
3612 return S_OK;
3613 }
3614
3615 ok(0, "unexpected call, riid %s\n", wine_dbgstr_guid(riid));
3616 *obj = NULL;
3617 return E_NOTIMPL;
3618}
static IPersistFile testpersistfile
Definition: compobj.c:3583
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197

◆ getinstance_cf_LockServer()

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

Definition at line 3620 of file compobj.c.

3621{
3622 ok(0, "unexpected call\n");
3623 return E_NOTIMPL;
3624}

◆ getinstance_cf_QI()

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

Definition at line 3585 of file compobj.c.

3586{
3588 *obj = iface;
3589 IClassFactory_AddRef(iface);
3590 return S_OK;
3591 }
3592
3593 *obj = NULL;
3594 return E_NOINTERFACE;
3595}
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ getinstance_cf_Release()

static ULONG WINAPI getinstance_cf_Release ( IClassFactory iface)
static

Definition at line 3602 of file compobj.c.

3603{
3604 return 1;
3605}

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

1878{
1879 return CONTAINING_RECORD(iface, Test_CallContext, IUnknown_iface);
1880}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by Test_CallContext_AddRef(), and Test_CallContext_Release().

◆ implicit_mta_proc()

static DWORD CALLBACK implicit_mta_proc ( void param)
static

Definition at line 3800 of file compobj.c.

3801{
3802 IComThreadingInfo *threading_info;
3804 IUnknown *unk;
3805 DWORD cookie;
3806 CLSID clsid;
3807 HRESULT hr;
3808
3810
3811 hr = CoCreateInstance(&CLSID_InternetZoneManager, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
3812 ok_ole_success(hr, "CoCreateInstance");
3813 IUnknown_Release(unk);
3814
3815 hr = CoGetClassObject(&CLSID_InternetZoneManager, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&unk);
3816 ok_ole_success(hr, "CoGetClassObject");
3817 IUnknown_Release(unk);
3818
3819 hr = CoGetObjectContext(&IID_IComThreadingInfo, (void **)&threading_info);
3820 ok_ole_success(hr, "CoGetObjectContext");
3821 IComThreadingInfo_Release(threading_info);
3822
3824 ok_ole_success(hr, "CoGetContextToken");
3825
3827 ok_ole_success(hr, "CoRegisterPSClsid");
3828
3830 ok_ole_success(hr, "CoGetPSClsid");
3831
3833 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
3834 ok_ole_success(hr, "CoRegisterClassObject");
3835
3837 ok_ole_success(hr, "CoRevokeClassObject");
3838
3840 ok(hr == CO_E_NOT_SUPPORTED, "got %#x\n", hr);
3841
3843 ok_ole_success(hr, "CoLockObjectExternal");
3844
3846 ok_ole_success(hr, "CoDisconnectObject");
3847
3848 return 0;
3849}
HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
Definition: compobj.c:2690
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2897
HRESULT WINAPI CoRegisterMessageFilter(LPMESSAGEFILTER lpMessageFilter, LPMESSAGEFILTER *lplpMessageFilter)
Definition: compobj.c:4046
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI CoDisconnectObject(LPUNKNOWN lpUnk, DWORD reserved)
Definition: compobj.c:2149
HRESULT WINAPI CoGetContextToken(ULONG_PTR *token)
Definition: compobj.c:5114
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1086
HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv)
Definition: compobj.c:5096
HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid)
Definition: compobj.c:2778
HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases)
Definition: compobj.c:3743
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
#define test_apt_type(t, q)
Definition: compobj.c:608
static const CLSID CLSID_WineTestPSFactoryBuffer
Definition: compobj.c:1058
#define ok_ole_success(hr, func)
Definition: compobj.c:89
static IClassFactory Test_ClassFactory
Definition: compobj.c:191
static const IID IID_IWineTest
Definition: marshal.c:122
REFCLSID clsid
Definition: msctf.c:82
@ REGCLS_SINGLEUSE
Definition: objbase.h:392
@ APTTYPEQUALIFIER_IMPLICIT_MTA
Definition: objidl.idl:2332
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define CO_E_NOT_SUPPORTED
Definition: winerror.h:2397

Referenced by test_implicit_mta().

◆ init_funcs()

static void init_funcs ( void  )
static

Definition at line 3777 of file compobj.c.

3778{
3779 HMODULE hOle32 = GetModuleHandleA("ole32");
3780 HMODULE hAdvapi32 = GetModuleHandleA("advapi32");
3781 HMODULE hkernel32 = GetModuleHandleA("kernel32");
3782
3783 pCoGetObjectContext = (void*)GetProcAddress(hOle32, "CoGetObjectContext");
3784 pCoSwitchCallContext = (void*)GetProcAddress(hOle32, "CoSwitchCallContext");
3785 pCoGetTreatAsClass = (void*)GetProcAddress(hOle32,"CoGetTreatAsClass");
3786 pCoTreatAsClass = (void*)GetProcAddress(hOle32,"CoTreatAsClass");
3787 pCoGetContextToken = (void*)GetProcAddress(hOle32, "CoGetContextToken");
3788 pCoGetApartmentType = (void*)GetProcAddress(hOle32, "CoGetApartmentType");
3789 pRegDeleteKeyExA = (void*)GetProcAddress(hAdvapi32, "RegDeleteKeyExA");
3790 pRegOverridePredefKey = (void*)GetProcAddress(hAdvapi32, "RegOverridePredefKey");
3791 pCoInitializeEx = (void*)GetProcAddress(hOle32, "CoInitializeEx");
3792
3793 pActivateActCtx = (void*)GetProcAddress(hkernel32, "ActivateActCtx");
3794 pCreateActCtxW = (void*)GetProcAddress(hkernel32, "CreateActCtxW");
3795 pDeactivateActCtx = (void*)GetProcAddress(hkernel32, "DeactivateActCtx");
3796 pIsWow64Process = (void*)GetProcAddress(hkernel32, "IsWow64Process");
3797 pReleaseActCtx = (void*)GetProcAddress(hkernel32, "ReleaseActCtx");
3798}
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static HINSTANCE hkernel32
Definition: process.c:66

Referenced by START_TEST().

◆ is_module_loaded()

static BOOL is_module_loaded ( const char module)
inlinestatic

Definition at line 1730 of file compobj.c.

1731{
1732 return GetModuleHandleA(module) != 0;
1733}

Referenced by test_CoFreeUnusedLibraries().

◆ LockModule()

static void LockModule ( void  )
static

Definition at line 121 of file compobj.c.

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

Referenced by Test_IClassFactory_AddRef().

◆ LONG()

static LONG ( WINAPI pRegDeleteKeyExA)
static

◆ MessageFilter_AddRef()

static ULONG WINAPI MessageFilter_AddRef ( IMessageFilter iface)
static

Definition at line 806 of file compobj.c.

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

◆ MessageFilter_HandleInComingCall()

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

Definition at line 816 of file compobj.c.

822{
823 trace("HandleInComingCall\n");
824 return SERVERCALL_ISHANDLED;
825}
#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 837 of file compobj.c.

842{
843 trace("MessagePending\n");
845 todo_wine ok(0, "unexpected call\n");
846 return PENDINGMSG_WAITNOPROCESS;
847}
#define todo_wine
Definition: custom.c:89
#define ros_skip_flaky
Definition: test.h:180

◆ MessageFilter_QueryInterface()

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

Definition at line 791 of file compobj.c.

792{
793 if (ppvObj == NULL) return E_POINTER;
794
796 IsEqualGUID(riid, &IID_IMessageFilter))
797 {
798 *ppvObj = iface;
799 IMessageFilter_AddRef(iface);
800 return S_OK;
801 }
802
803 return E_NOINTERFACE;
804}
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_POINTER
Definition: winerror.h:2365

◆ MessageFilter_Release()

static ULONG WINAPI MessageFilter_Release ( IMessageFilter iface)
static

Definition at line 811 of file compobj.c.

812{
813 return 1; /* non-heap object */
814}

◆ MessageFilter_RetryRejectedCall()

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

Definition at line 827 of file compobj.c.

832{
833 trace("RetryRejectedCall\n");
834 return 0;
835}

◆ post_message_thread()

static DWORD CALLBACK post_message_thread ( LPVOID  arg)
static

Definition at line 2468 of file compobj.c.

2469{
2470 HWND hWnd = arg;
2471 Sleep(50);
2473 return 0;
2474}
HWND hWnd
Definition: settings.c:17
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_CoWaitForMultipleHandles().

◆ PSFactoryBuffer_AddRef()

static ULONG WINAPI PSFactoryBuffer_AddRef ( IPSFactoryBuffer This)
static

Definition at line 1010 of file compobj.c.

1012{
1013 return 2;
1014}

◆ PSFactoryBuffer_CreateProxy()

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

Definition at line 1022 of file compobj.c.

1028{
1029 return E_NOTIMPL;
1030}

◆ PSFactoryBuffer_CreateStub()

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

Definition at line 1032 of file compobj.c.

1037{
1038 CHECK_EXPECT(CreateStub);
1039
1040 ok(pUnkServer == &Test_Unknown, "unexpected pUnkServer %p\n", pUnkServer);
1042 return E_NOTIMPL;
1043
1044 return IPSFactoryBuffer_CreateStub(ps_factory_buffer, &IID_IEnumOLEVERB, pUnkServer, ppStub);
1045}
#define CHECK_EXPECT(func)
Definition: compobj.c:53
static IPSFactoryBuffer * ps_factory_buffer
Definition: compobj.c:993

◆ PSFactoryBuffer_QueryInterface()

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

Definition at line 995 of file compobj.c.

999{
1000 if (IsEqualIID(riid, &IID_IUnknown) ||
1001 IsEqualIID(riid, &IID_IPSFactoryBuffer))
1002 {
1003 *ppvObject = This;
1004 IPSFactoryBuffer_AddRef(This);
1005 return S_OK;
1006 }
1007 return E_NOINTERFACE;
1008}
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082

◆ PSFactoryBuffer_Release()

static ULONG WINAPI PSFactoryBuffer_Release ( IPSFactoryBuffer This)
static

Definition at line 1016 of file compobj.c.

1018{
1019 return 1;
1020}

◆ register_class_object_thread()

static DWORD CALLBACK register_class_object_thread ( LPVOID  pv)
static

Definition at line 1607 of file compobj.c.

1608{
1609 HRESULT hr;
1610 DWORD cookie;
1611
1612 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1613
1615 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1616
1618
1619 return hr;
1620}

Referenced by test_registered_object_thread_affinity().

◆ register_dummy_class()

static ATOM register_dummy_class ( void  )
static

Definition at line 759 of file compobj.c.

760{
761 WNDCLASSA wc =
762 {
763 0,
765 0,
766 0,
768 NULL,
770 (HBRUSH)(COLOR_BTNFACE+1),
771 NULL,
772 "WineOleTestClass",
773 };
774
775 return RegisterClassA(&wc);
776}
#define IDC_ARROW
Definition: winuser.h:687
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2142
#define COLOR_BTNFACE
Definition: winuser.h:931
char * LPSTR
Definition: xmlstorage.h:182

Referenced by test_ole_menu().

◆ register_ps_clsid_thread()

static DWORD CALLBACK register_ps_clsid_thread ( void context)
static

Definition at line 1066 of file compobj.c.

1067{
1068 HRESULT hr;
1069 CLSID clsid = {0};
1070
1071 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1072
1074 ok_ole_success(hr, "CoGetPSClsid");
1075 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1077
1078 /* test registering a PSClsid in an apartment which is then destroyed */
1080 ok_ole_success(hr, "CoRegisterPSClsid");
1081
1083
1084 return hr;
1085}
static const GUID IID_TestPS
Definition: compobj.c:101

Referenced by test_CoRegisterPSClsid().

◆ release_semaphore_thread()

static DWORD CALLBACK release_semaphore_thread ( LPVOID  arg)
static

Definition at line 2443 of file compobj.c.

2444{
2445 HANDLE handle = arg;
2448 return 0;
2449}
#define WAIT_TIMEOUT
Definition: dderror.h:14
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:542

Referenced by test_CoWaitForMultipleHandles().

◆ revoke_class_object_thread()

static DWORD CALLBACK revoke_class_object_thread ( LPVOID  pv)
static

Definition at line 1622 of file compobj.c.

1623{
1624 DWORD cookie = (DWORD_PTR)pv;
1625 HRESULT hr;
1626
1627 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1628
1630
1632
1633 return hr;
1634}
#define DWORD_PTR
Definition: treelist.c:76

Referenced by test_registered_object_thread_affinity().

◆ send_and_post_user_message_thread()

static DWORD CALLBACK send_and_post_user_message_thread ( void arg)
static

Definition at line 2459 of file compobj.c.

2460{
2461 HWND hwnd = arg;
2462 Sleep(30);
2463 SendMessageA(hwnd, WM_USER, 0, 0);
2464 PostMessageA(hwnd, WM_USER, 0, 0);
2465 return 0;
2466}
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_USER
Definition: winuser.h:1898

Referenced by test_CoWaitForMultipleHandles().

◆ send_message_thread()

static DWORD CALLBACK send_message_thread ( LPVOID  arg)
static

Definition at line 2451 of file compobj.c.

2452{
2453 HWND hWnd = arg;
2454 Sleep(50);
2456 return 0;
2457}

Referenced by test_CoWaitForMultipleHandles().

◆ START_TEST()

START_TEST ( compobj  )

Definition at line 3865 of file compobj.c.

3866{
3867 init_funcs();
3868
3869 if (!pCoInitializeEx)
3870 {
3871 trace("You need DCOM95 installed to run this test\n");
3872 return;
3873 }
3874
3875 if (!pCreateActCtxW)
3876 win_skip("Activation contexts are not supported, some tests will be skipped.\n");
3877
3884 test_ole_menu();
3916}
static void test_CoInitializeEx(void)
Definition: compobj.c:2140
static void test_CoMarshalInterThreadInterfaceInStream(void)
Definition: compobj.c:1411
static void test_CoRegisterMessageFilter(void)
Definition: compobj.c:861
static void test_CoGetInstanceFromFile(void)
Definition: compobj.c:3636
static void test_CoGetClassObject(void)
Definition: compobj.c:666
static void test_ole_menu(void)
Definition: compobj.c:778
static void test_registered_object_thread_affinity(void)
Definition: compobj.c:1636
static void test_CoGetApartmentType(void)
Definition: compobj.c:3077
static void test_implicit_mta(void)
Definition: compobj.c:3853
static void test_OleRegGetUserType(void)
Definition: compobj.c:2273
static void test_TreatAsClass(void)
Definition: compobj.c:2051
static void test_CoCreateInstance(void)
Definition: compobj.c:625
static void test_GlobalOptions(void)
Definition: compobj.c:3751
static void test_CoGetInterfaceAndReleaseStream(void)
Definition: compobj.c:1362
static void test_IInitializeSpy(BOOL mt)
Definition: compobj.c:3386
static void test_CoRegisterClassObject(void)
Definition: compobj.c:1445
static void test_CoFreeUnusedLibraries(void)
Definition: compobj.c:1735
static void test_CoRegisterPSClsid(void)
Definition: compobj.c:1087
static void test_CoMarshalInterface(void)
Definition: compobj.c:1376
static void test_StringFromGUID2(void)
Definition: compobj.c:580
static void test_ProgIDFromCLSID(void)
Definition: compobj.c:322
static void test_IMallocSpy(void)
Definition: compobj.c:3242
static void test_CoGetCurrentLogicalThreadId(void)
Definition: compobj.c:3278
static void test_CoGetObjectContext(void)
Definition: compobj.c:1778
static void test_CoGetMalloc(void)
Definition: compobj.c:3037
static void test_CoGetContextToken(void)
Definition: compobj.c:1979
static void test_OleInitialize_InitCounting(void)
Definition: compobj.c:2162
static void test_OleRegGetMiscStatus(void)
Definition: compobj.c:2229
static void test_CoCreateGuid(void)
Definition: compobj.c:2430
static void test_CLSIDFromProgID(void)
Definition: compobj.c:375
static void init_funcs(void)
Definition: compobj.c:3777
static void test_CoGetCallContext(void)
Definition: compobj.c:1922
static void test_CoCreateInstanceEx(void)
Definition: compobj.c:735
static void test_CoWaitForMultipleHandles(void)
Definition: compobj.c:2652
static void test_CoGetPSClsid(void)
Definition: compobj.c:1190
static void test_CLSIDFromString(void)
Definition: compobj.c:442
static void test_CoUnmarshalInterface(void)
Definition: compobj.c:1333
static void test_IIDFromString(void)
Definition: compobj.c:518

◆ Test_CallContext_AddRef()

static ULONG WINAPI Test_CallContext_AddRef ( IUnknown iface)
static

Definition at line 1900 of file compobj.c.

1901{
1903 return InterlockedIncrement(&This->refs);
1904}
static Test_CallContext * impl_from_IUnknown(IUnknown *iface)
Definition: compobj.c:1877

◆ Test_CallContext_QueryInterface()

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

Definition at line 1882 of file compobj.c.

1886{
1887 if (ppvObj == NULL) return E_POINTER;
1888
1890 {
1891 *ppvObj = iface;
1892 IUnknown_AddRef(iface);
1893 return S_OK;
1894 }
1895
1896 *ppvObj = NULL;
1897 return E_NOINTERFACE;
1898}

◆ Test_CallContext_Release()

static ULONG WINAPI Test_CallContext_Release ( IUnknown iface)
static

Definition at line 1906 of file compobj.c.

1907{
1909 ULONG refs = InterlockedDecrement(&This->refs);
1910 if (!refs)
1912 return refs;
1913}
#define InterlockedDecrement
Definition: armddk.h:52
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
uint32_t ULONG
Definition: typedefs.h:59

◆ test_CLSIDFromProgID()

static void test_CLSIDFromProgID ( void  )
static

Definition at line 375 of file compobj.c.

376{
377 ULONG_PTR cookie = 0;
379 CLSID clsid;
381 ok(hr == S_OK, "CLSIDFromProgID failed with error 0x%08x\n", hr);
382 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
383
385 ok_ole_success(hr, "CLSIDFromString");
386 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
387
388 /* test some failure cases */
389
391 ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08x\n", hr);
392
394 ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08x\n", hr);
395
396 memset(&clsid, 0xcc, sizeof(clsid));
398 ok(hr == CO_E_CLASSSTRING, "CLSIDFromProgID on nonexistent ProgID should have returned CO_E_CLASSSTRING instead of 0x%08x\n", hr);
399 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "CLSIDFromProgID should have set clsid to all-zeros on failure\n");
400
401 /* fails without proper context */
402 memset(&clsid, 0xcc, sizeof(clsid));
404 ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
405 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "wrong clsid\n");
406
408 {
409 GUID clsid1;
410
411 memset(&clsid, 0xcc, sizeof(clsid));
413 ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
414 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "should have zero CLSID on failure\n");
415
416 /* CLSIDFromString() doesn't check activation context */
418 ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
419
422 ok(hr == S_OK, "got 0x%08x\n", hr);
423 /* it returns generated CLSID here */
425 "got wrong clsid %s\n", wine_dbgstr_guid(&clsid));
426
427 /* duplicate progid present in context - returns generated guid here too */
430 ok(hr == S_OK, "got 0x%08x\n", hr);
431 clsid1 = CLSID_StdFont;
432 /* that's where it differs from StdFont */
433 clsid1.Data4[7] = 0x52;
435 "got %s\n", wine_dbgstr_guid(&clsid));
436
437 pDeactivateActCtx(0, cookie);
438 pReleaseActCtx(handle);
439 }
440}
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2602
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
static const char actctx_manifest[]
Definition: compobj.c:263
static const WCHAR stdfont[]
Definition: compobj.c:105
static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
Definition: compobj.c:217
static const WCHAR progidW[]
Definition: compobj.c:112
static const CLSID CLSID_non_existent
Definition: compobj.c:93
static const CLSID CLSID_StdFont
Definition: compobj.c:94
static const WCHAR wszNonExistent[]
Definition: compobj.c:106
#define CLSID_NULL
Definition: guiddef.h:99
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
#define CO_E_CLASSSTRING
Definition: winerror.h:2806

Referenced by START_TEST().

◆ test_CLSIDFromString()

static void test_CLSIDFromString ( void  )
static

Definition at line 442 of file compobj.c.

443{
444 CLSID clsid;
445 WCHAR wszCLSID_Broken[50];
446 UINT i;
447
449 ok_ole_success(hr, "CLSIDFromString");
450 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
451
452 memset(&clsid, 0xab, sizeof(clsid));
454 ok(hr == S_OK, "got 0x%08x\n", hr);
455 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n");
456
457 /* string is longer, but starts with a valid CLSID */
458 memset(&clsid, 0, sizeof(clsid));
460 ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
462
463 lstrcpyW(wszCLSID_Broken, wszCLSID_StdFont);
464 for(i = lstrlenW(wszCLSID_StdFont); i < 49; i++)
465 wszCLSID_Broken[i] = 'A';
466 wszCLSID_Broken[i] = '\0';
467
468 memset(&clsid, 0, sizeof(CLSID));
469 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
470 ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
471 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
472
473 wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = 'A';
474 memset(&clsid, 0, sizeof(CLSID));
475 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
476 ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
477 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
478
479 wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)] = '\0';
480 memset(&clsid, 0, sizeof(CLSID));
481 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
482 ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
483 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
484
485 wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = '\0';
486 memset(&clsid, 0, sizeof(CLSID));
487 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
488 ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
489 ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
490
491 memset(&clsid, 0xcc, sizeof(CLSID));
492 hr = CLSIDFromString(wszCLSID_Broken+1, &clsid);
493 ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
494 ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n");
495
496 wszCLSID_Broken[9] = '*';
497 memset(&clsid, 0xcc, sizeof(CLSID));
498 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
499 ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
500 ok(clsid.Data1 == CLSID_StdFont.Data1, "Got %08x\n", clsid.Data1);
501 ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
502
503 wszCLSID_Broken[3] = '*';
504 memset(&clsid, 0xcc, sizeof(CLSID));
505 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
506 ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
507 ok(clsid.Data1 == 0xb, "Got %08x\n", clsid.Data1);
508 ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
509
510 wszCLSID_Broken[3] = '\0';
511 memset(&clsid, 0xcc, sizeof(CLSID));
512 hr = CLSIDFromString(wszCLSID_Broken, &clsid);
513 ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
514 ok(clsid.Data1 == 0xb, "Got %08x\n", clsid.Data1);
515 ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
516}
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const WCHAR wszCLSID_StdFont[]
Definition: compobj.c:107
static const WCHAR cf_brokenW[]
Definition: compobj.c:113
unsigned int UINT
Definition: ndis.h:50

Referenced by START_TEST().

◆ test_CoCreateGuid()

static void test_CoCreateGuid ( void  )
static

Definition at line 2430 of file compobj.c.

2431{
2432 HRESULT hr;
2433
2434 hr = CoCreateGuid(NULL);
2435 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
2436}
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2206

Referenced by START_TEST().

◆ test_CoCreateInstance()

static void test_CoCreateInstance ( void  )
static

Definition at line 625 of file compobj.c.

626{
627 HRESULT hr;
628 IUnknown *pUnk;
629 REFCLSID rclsid = &CLSID_InternetZoneManager;
630
631 pUnk = (IUnknown *)0xdeadbeef;
632 hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
633 ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
634 ok(pUnk == NULL, "CoCreateInstance should have changed the passed in pointer to NULL, instead of %p\n", pUnk);
635
637
638 /* test errors returned for non-registered clsids */
639 hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
640 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
641 hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&pUnk);
642 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc handler should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
643 hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_LOCAL_SERVER, &IID_IUnknown, (void **)&pUnk);
644 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered local server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
645 hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_REMOTE_SERVER, &IID_IUnknown, (void **)&pUnk);
646 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered remote server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
647
648 hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
650 {
651 skip("IE not installed so can't test CoCreateInstance\n");
653 return;
654 }
655
656 ok_ole_success(hr, "CoCreateInstance");
657 if(pUnk) IUnknown_Release(pUnk);
659
660 hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
661 ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
662
663 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
664}
#define skip(...)
Definition: atltest.h:64
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
@ APTTYPEQUALIFIER_NONE
Definition: objidl.idl:2331
#define REFCLSID
Definition: guiddef.h:117
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696

Referenced by START_TEST().

◆ test_CoCreateInstanceEx()

static void test_CoCreateInstanceEx ( void  )
static

Definition at line 735 of file compobj.c.

736{
737 MULTI_QI qi_res = { &IID_IMoniker };
739 HRESULT hr;
740
742
744 CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie);
745 ok_ole_success(hr, "CoRegisterClassObject");
746
748 hr = CoCreateInstanceEx(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER, NULL, 1, &qi_res);
749 ok(hr == E_NOINTERFACE, "CoCreateInstanceEx failed: %08x\n", hr);
750 ok(IsEqualGUID(&create_instance_iid, qi_res.pIID), "Unexpected CreateInstance iid %s\n",
752
754 ok_ole_success(hr, "CoRevokeClassObject");
755
757}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, COSERVERINFO *pServerInfo, ULONG cmq, MULTI_QI *pResults)
Definition: compobj.c:3387
static IID create_instance_iid
Definition: compobj.c:162
@ REGCLS_MULTIPLEUSE
Definition: objbase.h:393
#define IID_NULL
Definition: guiddef.h:98

Referenced by START_TEST().

◆ test_CoFreeUnusedLibraries()

static void test_CoFreeUnusedLibraries ( void  )
static

Definition at line 1735 of file compobj.c.

1736{
1737 HRESULT hr;
1738 IUnknown *pUnk;
1739 DWORD tid;
1740 HANDLE thread;
1741
1742 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1743
1744 ok(!is_module_loaded("urlmon.dll"), "urlmon.dll shouldn't be loaded\n");
1745
1746 hr = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pUnk);
1747 if (hr == REGDB_E_CLASSNOTREG)
1748 {
1749 skip("IE not installed so can't run CoFreeUnusedLibraries test\n");
1751 return;
1752 }
1753 ok_ole_success(hr, "CoCreateInstance");
1754
1755 ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1756
1757 ok(pUnk != NULL ||
1758 broken(pUnk == NULL), /* win9x */
1759 "Expected a valid pointer\n");
1760 if (pUnk)
1761 IUnknown_Release(pUnk);
1762
1763 ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1764
1766 ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1768
1769 ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1770
1772
1773 ok(!is_module_loaded("urlmon.dll"), "urlmon.dll shouldn't be loaded\n");
1774
1776}
static HANDLE thread
Definition: service.c:33
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
static TfClientId tid
static DWORD CALLBACK free_libraries_thread(LPVOID p)
Definition: compobj.c:1724
static BOOL is_module_loaded(const char *module)
Definition: compobj.c:1730

Referenced by START_TEST().

◆ test_CoGetApartmentType()

static void test_CoGetApartmentType ( void  )
static

Definition at line 3077 of file compobj.c.

3078{
3080 APTTYPE type;
3081 HRESULT hr;
3082
3083 if (!pCoGetApartmentType)
3084 {
3085 win_skip("CoGetApartmentType not present\n");
3086 return;
3087 }
3088
3089 hr = pCoGetApartmentType(NULL, NULL);
3090 ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
3091
3092 type = 0xdeadbeef;
3093 hr = pCoGetApartmentType(&type, NULL);
3094 ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
3095 ok(type == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", type);
3096
3097 qualifier = 0xdeadbeef;
3098 hr = pCoGetApartmentType(NULL, &qualifier);
3099 ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
3100 ok(qualifier == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", qualifier);
3101
3102 type = 0xdeadbeef;
3103 qualifier = 0xdeadbeef;
3104 hr = pCoGetApartmentType(&type, &qualifier);
3105 ok(hr == CO_E_NOTINITIALIZED, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
3106 ok(type == APTTYPE_CURRENT, "Expected APTTYPE_CURRENT, got %u\n", type);
3107 ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3108
3109 type = 0xdeadbeef;
3110 qualifier = 0xdeadbeef;
3111 hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
3112 ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08x\n", hr);
3113 hr = pCoGetApartmentType(&type, &qualifier);
3114 ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08x\n", hr);
3115 ok(type == APTTYPE_MAINSTA, "Expected APTTYPE_MAINSTA, got %u\n", type);
3116 ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3118
3119 type = 0xdeadbeef;
3120 qualifier = 0xdeadbeef;
3121 hr = pCoInitializeEx(NULL, COINIT_MULTITHREADED);
3122 ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08x\n", hr);
3123 hr = pCoGetApartmentType(&type, &qualifier);
3124 ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08x\n", hr);
3125 ok(type == APTTYPE_MTA, "Expected APTTYPE_MTA, got %u\n", type);
3126 ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3128}
@ COINIT_MULTITHREADED
Definition: objbase.h:279

Referenced by START_TEST().

◆ test_CoGetCallContext()

static void test_CoGetCallContext ( void  )
static

Definition at line 1922 of file compobj.c.

1923{
1924 HRESULT hr;
1925 ULONG refs;
1926 IUnknown *pUnk;
1928
1929 if (!pCoSwitchCallContext)
1930 {
1931 skip("CoSwitchCallContext not present\n");
1932 return;
1933 }
1934
1936
1938 test_object->IUnknown_iface.lpVtbl = &TestCallContext_Vtbl;
1939 test_object->refs = 1;
1940
1941 hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
1942 ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08x\n", hr);
1943
1944 pUnk = (IUnknown*)0xdeadbeef;
1945 hr = pCoSwitchCallContext(&test_object->IUnknown_iface, &pUnk);
1946 ok_ole_success(hr, "CoSwitchCallContext");
1947 ok(pUnk == NULL, "expected NULL, got %p\n", pUnk);
1948 refs = IUnknown_AddRef(&test_object->IUnknown_iface);
1949 ok(refs == 2, "Expected refcount 2, got %d\n", refs);
1950 IUnknown_Release(&test_object->IUnknown_iface);
1951
1952 pUnk = (IUnknown*)0xdeadbeef;
1953 hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
1954 ok_ole_success(hr, "CoGetCallContext");
1955 ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n",
1956 &test_object->IUnknown_iface, pUnk);
1957 refs = IUnknown_AddRef(&test_object->IUnknown_iface);
1958 ok(refs == 3, "Expected refcount 3, got %d\n", refs);
1959 IUnknown_Release(&test_object->IUnknown_iface);
1960 IUnknown_Release(pUnk);
1961
1962 pUnk = (IUnknown*)0xdeadbeef;
1963 hr = pCoSwitchCallContext(NULL, &pUnk);
1964 ok_ole_success(hr, "CoSwitchCallContext");
1965 ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n",
1966 &test_object->IUnknown_iface, pUnk);
1967 refs = IUnknown_AddRef(&test_object->IUnknown_iface);
1968 ok(refs == 2, "Expected refcount 2, got %d\n", refs);
1969 IUnknown_Release(&test_object->IUnknown_iface);
1970
1971 hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
1972 ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08x\n", hr);
1973
1974 IUnknown_Release(&test_object->IUnknown_iface);
1975
1977}
#define HeapAlloc
Definition: compat.h:733
HRESULT WINAPI CoGetCallContext(REFIID riid, void **ppv)
Definition: compobj.c:4379
static void test_object(void)
Definition: d3drm.c:1575
static const IUnknownVtbl TestCallContext_Vtbl
Definition: compobj.c:1915
#define RPC_E_CALL_COMPLETE
Definition: winerror.h:2499

Referenced by START_TEST().

◆ test_CoGetClassObject()

static void test_CoGetClassObject ( void  )
static

Definition at line 666 of file compobj.c.

667{
668 HRESULT hr;
671 IUnknown *pUnk;
672 REFCLSID rclsid = &CLSID_InternetZoneManager;
673 HKEY hkey;
674 LONG res;
675
676 hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
677 ok(hr == CO_E_NOTINITIALIZED, "CoGetClassObject should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
678 ok(pUnk == NULL, "CoGetClassObject should have changed the passed in pointer to NULL, instead of %p\n", pUnk);
679
680 hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, NULL);
681 ok(hr == E_INVALIDARG ||
682 broken(hr == CO_E_NOTINITIALIZED), /* win9x */
683 "CoGetClassObject should have returned E_INVALIDARG instead of 0x%08x\n", hr);
684
685 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
686
687 if (!pRegOverridePredefKey)
688 {
689 win_skip("RegOverridePredefKey not available\n");
690 return;
691 }
692
693 pCoInitializeEx(NULL, COINIT_MULTITHREADED);
694
695 hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
696 if (hr == S_OK)
697 {
698 IUnknown_Release(pUnk);
699
700 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0,
701 KEY_ALL_ACCESS, NULL, &hkey, NULL);
702 ok(!res, "RegCreateKeyEx returned %d\n", res);
703
704 res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
705 ok(!res, "RegOverridePredefKey returned %d\n", res);
706
707 hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
708 ok(hr == S_OK, "CoGetClassObject should have returned S_OK instead of 0x%08x\n", hr);
709
710 res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
711 ok(!res, "RegOverridePredefKey returned %d\n", res);
712
713 if (hr == S_OK) IUnknown_Release(pUnk);
714 RegCloseKey(hkey);
715 }
716
717 hr = CoGetClassObject(&CLSID_InProcFreeMarshaler, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
718 ok(hr == S_OK, "got 0x%08x\n", hr);
719 IUnknown_Release(pUnk);
720
721 /* context redefines FreeMarshaler CLSID */
723 {
724 hr = CoGetClassObject(&CLSID_InProcFreeMarshaler, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
725 ok(hr == S_OK, "got 0x%08x\n", hr);
726 IUnknown_Release(pUnk);
727
728 pDeactivateActCtx(0, cookie);
729 pReleaseActCtx(handle);
730 }
731
733}
#define RegCloseKey(hKey)
Definition: registry.h:49
const CLSID CLSID_InProcFreeMarshaler
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1034
GLuint res
Definition: glext.h:9613
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
long LONG
Definition: pedump.c:60
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by START_TEST().

◆ test_CoGetContextToken()

static void test_CoGetContextToken ( void  )
static

Definition at line 1979 of file compobj.c.

1980{
1981 HRESULT hr;
1982 ULONG refs;
1983 ULONG_PTR token, token2;
1985
1986 if (!pCoGetContextToken)
1987 {
1988 win_skip("CoGetContextToken not present\n");
1989 return;
1990 }
1991
1992 token = 0xdeadbeef;
1993 hr = pCoGetContextToken(&token);
1994 ok(hr == CO_E_NOTINITIALIZED, "Expected CO_E_NOTINITIALIZED, got 0x%08x\n", hr);
1995 ok(token == 0xdeadbeef, "Expected 0, got 0x%lx\n", token);
1996
1997 test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
1998
2000
2002
2003 hr = pCoGetContextToken(NULL);
2004 ok(hr == E_POINTER, "Expected E_POINTER, got 0x%08x\n", hr);
2005
2006 token = 0;
2007 hr = pCoGetContextToken(&token);
2008 ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2009 ok(token, "Expected token != 0\n");
2010
2011 token2 = 0;
2012 hr = pCoGetContextToken(&token2);
2013 ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2014 ok(token2 == token, "got different token\n");
2015
2016 refs = IUnknown_AddRef((IUnknown *)token);
2017 ok(refs == 1, "Expected 1, got %u\n", refs);
2018
2019 hr = pCoGetObjectContext(&IID_IObjContext, (void **)&ctx);
2020 ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2021 ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
2022
2023 refs = IObjContext_AddRef(ctx);
2024 ok(refs == 3, "Expected 3, got %u\n", refs);
2025
2026 refs = IObjContext_Release(ctx);
2027 ok(refs == 2, "Expected 2, got %u\n", refs);
2028
2029 refs = IUnknown_Release((IUnknown *)token);
2030 ok(refs == 1, "Expected 1, got %u\n", refs);
2031
2032 /* CoGetContextToken does not add a reference */
2033 token = 0;
2034 hr = pCoGetContextToken(&token);
2035 ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2036 ok(token, "Expected token != 0\n");
2037 ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
2038
2039 refs = IObjContext_AddRef(ctx);
2040 ok(refs == 2, "Expected 1, got %u\n", refs);
2041
2042 refs = IObjContext_Release(ctx);
2043 ok(refs == 1, "Expected 0, got %u\n", refs);
2044
2045 refs = IObjContext_Release(ctx);
2046 ok(refs == 0, "Expected 0, got %u\n", refs);
2047
2049}

Referenced by START_TEST().

◆ test_CoGetCurrentLogicalThreadId()

static void test_CoGetCurrentLogicalThreadId ( void  )
static

Definition at line 3278 of file compobj.c.

3279{
3280 HRESULT hr;
3281 GUID id;
3282
3284 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3285
3286 id = GUID_NULL;
3288 ok(hr == S_OK, "got 0x%08x\n", hr);
3289 ok(!IsEqualGUID(&id, &GUID_NULL), "got null id\n");
3290}
HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *id)
Definition: compobj.c:4012
GLuint id
Definition: glext.h:5910
#define GUID_NULL
Definition: ks.h:106

Referenced by START_TEST().

◆ test_CoGetInstanceFromFile()

static void test_CoGetInstanceFromFile ( void  )
static

Definition at line 3636 of file compobj.c.

3637{
3638 static const WCHAR filenameW[] = {'d','u','m','m','y','p','a','t','h',0};
3639 CLSID *clsid = (CLSID*)&CLSID_testclsid;
3640 MULTI_QI mqi[2];
3641 DWORD cookie;
3642 HRESULT hr;
3643
3644 hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
3645 ok(hr == S_OK, "got 0x%08x\n", hr);
3646
3647 /* CLSID is not specified, file does not exist */
3648 mqi[0].pIID = &IID_IUnknown;
3649 mqi[0].pItf = NULL;
3650 mqi[0].hr = E_NOTIMPL;
3651 hr = CoGetInstanceFromFile(NULL, NULL, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3653 ok(hr == MK_E_CANTOPENFILE, "got 0x%08x\n", hr);
3654 ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3655 ok(mqi[0].hr == E_NOINTERFACE, "got 0x%08x\n", mqi[0].hr);
3656
3657 /* class is not available */
3658 mqi[0].pIID = &IID_IUnknown;
3659 mqi[0].pItf = NULL;
3660 mqi[0].hr = E_NOTIMPL;
3661 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3662 ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08x\n", hr);
3663 ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3664 ok(mqi[0].hr == REGDB_E_CLASSNOTREG, "got 0x%08x\n", mqi[0].hr);
3665
3667 &cookie);
3668 ok(hr == S_OK, "got 0x%08x\n", hr);
3669
3670 mqi[0].pIID = &IID_IUnknown;
3671 mqi[0].pItf = (void*)0xdeadbeef;
3672 mqi[0].hr = S_OK;
3673 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3674todo_wine {
3675 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3676 ok(mqi[0].pItf == (void*)0xdeadbeef, "got %p\n", mqi[0].pItf);
3677}
3678 ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
3679
3680 mqi[0].pIID = &IID_IUnknown;
3681 mqi[0].pItf = (void*)0xdeadbeef;
3682 mqi[0].hr = E_NOTIMPL;
3683 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3684todo_wine {
3685 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3686 ok(mqi[0].pItf == (void*)0xdeadbeef, "got %p\n", mqi[0].pItf);
3687 ok(mqi[0].hr == E_NOTIMPL, "got 0x%08x\n", mqi[0].hr);
3688}
3689 mqi[0].pIID = &IID_IUnknown;
3690 mqi[0].pItf = NULL;
3691 mqi[0].hr = E_NOTIMPL;
3692 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3693 ok(hr == S_OK, "got 0x%08x\n", hr);
3694 ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3695 ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
3696
3697 mqi[0].pIID = &IID_IUnknown;
3698 mqi[0].pItf = NULL;
3699 mqi[0].hr = S_OK;
3700 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3701 ok(hr == S_OK, "got 0x%08x\n", hr);
3702 ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3703 ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
3704
3705 mqi[0].pIID = &IID_IUnknown;
3706 mqi[0].pItf = NULL;
3707 mqi[0].hr = S_OK;
3709 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3710 ok(hr == S_OK, "got 0x%08x\n", hr);
3711 ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3712 ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
3714
3715 mqi[0].pIID = &IID_IUnknown;
3716 mqi[0].pItf = NULL;
3717 mqi[0].hr = S_OK;
3718 mqi[1].pIID = &IID_IUnknown;
3719 mqi[1].pItf = NULL;
3720 mqi[1].hr = S_OK;
3721 g_persistfile_qi_ret = 0x8000efef;
3722 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 2, mqi);
3723 ok(hr == 0x8000efef, "got 0x%08x\n", hr);
3724 ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3725 ok(mqi[0].hr == 0x8000efef, "got 0x%08x\n", mqi[0].hr);
3726 ok(mqi[1].pItf == NULL, "got %p\n", mqi[1].pItf);
3727 ok(mqi[1].hr == 0x8000efef, "got 0x%08x\n", mqi[1].hr);
3729
3730 mqi[0].pIID = &IID_IUnknown;
3731 mqi[0].pItf = NULL;
3732 mqi[0].hr = S_OK;
3733 mqi[1].pIID = &IID_IUnknown;
3734 mqi[1].pItf = NULL;
3735 mqi[1].hr = S_OK;
3736 g_persistfile_load_ret = 0x8000fefe;
3737 hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 2, mqi);
3738 ok(hr == 0x8000fefe, "got 0x%08x\n", hr);
3739 ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3740 ok(mqi[0].hr == 0x8000fefe, "got 0x%08x\n", mqi[0].hr);
3741 ok(mqi[1].pItf == NULL, "got %p\n", mqi[1].pItf);
3742 ok(mqi[1].hr == 0x8000fefe, "got 0x%08x\n", mqi[1].hr);
3744
3746 ok(hr == S_OK, "got 0x%08x\n", hr);
3747
3749}
WCHAR OLECHAR
Definition: compat.h:2292
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:3468
static const WCHAR filenameW[]
Definition: amstream.c:41
static HRESULT g_persistfile_qi_ret
Definition: compobj.c:3502
static IClassFactory getinstance_cf
Definition: compobj.c:3634
static HRESULT g_persistfile_load_ret
Definition: compobj.c:3503
#define STGM_READ
Definition: objbase.h:917
#define S_FALSE
Definition: winerror.h:2357
#define MK_E_CANTOPENFILE
Definition: winerror.h:2791

Referenced by START_TEST().

◆ test_CoGetInterfaceAndReleaseStream()

static void test_CoGetInterfaceAndReleaseStream ( void  )
static

Definition at line 1362 of file compobj.c.

1363{
1364 HRESULT hr;
1365 IUnknown *pUnk;
1366
1367 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1368
1370 ok(hr == E_INVALIDARG, "hr %08x\n", hr);
1371
1373}
HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID riid, LPVOID *ppv)
Definition: marshal.c:2144

Referenced by START_TEST().

◆ test_CoGetMalloc()

static void test_CoGetMalloc ( void  )
static

Definition at line 3037 of file compobj.c.

3038{
3039 IMalloc *imalloc;
3040 HRESULT hr;
3041
3042 if (0) /* crashes on native */
3043 hr = CoGetMalloc(0, NULL);
3044
3045 imalloc = (void*)0xdeadbeef;
3046 hr = CoGetMalloc(0, &imalloc);
3047 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3048 ok(imalloc == NULL, "got %p\n", imalloc);
3049
3050 imalloc = (void*)0xdeadbeef;
3051 hr = CoGetMalloc(MEMCTX_SHARED, &imalloc);
3052 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3053 ok(imalloc == NULL, "got %p\n", imalloc);
3054
3055 imalloc = (void*)0xdeadbeef;
3056 hr = CoGetMalloc(MEMCTX_MACSYSTEM, &imalloc);
3057 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3058 ok(imalloc == NULL, "got %p\n", imalloc);
3059
3060 imalloc = (void*)0xdeadbeef;
3061 hr = CoGetMalloc(MEMCTX_UNKNOWN, &imalloc);
3062 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3063 ok(imalloc == NULL, "got %p\n", imalloc);
3064
3065 imalloc = (void*)0xdeadbeef;
3066 hr = CoGetMalloc(MEMCTX_SAME, &imalloc);
3067 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3068 ok(imalloc == NULL, "got %p\n", imalloc);
3069
3070 imalloc = NULL;
3071 hr = CoGetMalloc(MEMCTX_TASK, &imalloc);
3072 ok(hr == S_OK, "got 0x%08x\n", hr);
3073 ok(imalloc != NULL, "got %p\n", imalloc);
3074 IMalloc_Release(imalloc);
3075}
HRESULT WINAPI CoGetMalloc(DWORD context, IMalloc **imalloc)
Definition: ifs.c:403

Referenced by START_TEST().

◆ test_CoGetObjectContext()

static void test_CoGetObjectContext ( void  )
static

Definition at line 1778 of file compobj.c.

1779{
1780 HRESULT hr;
1781 ULONG refs;
1782 IComThreadingInfo *pComThreadingInfo, *threadinginfo2;
1783 IContextCallback *pContextCallback;
1784 IObjContext *pObjContext;
1785 APTTYPE apttype;
1786 THDTYPE thdtype;
1787 GUID id, id2;
1788
1789 if (!pCoGetObjectContext)
1790 {
1791 win_skip("CoGetObjectContext not present\n");
1792 return;
1793 }
1794
1795 hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1796 ok(hr == CO_E_NOTINITIALIZED, "CoGetObjectContext should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
1797 ok(pComThreadingInfo == NULL, "pComThreadingInfo should have been set to NULL\n");
1798
1799 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1800
1802
1803 hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1804 ok_ole_success(hr, "CoGetObjectContext");
1805
1806 threadinginfo2 = NULL;
1807 hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&threadinginfo2);
1808 ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
1809 ok(pComThreadingInfo == threadinginfo2, "got different instance\n");
1810 IComThreadingInfo_Release(threadinginfo2);
1811
1812 hr = IComThreadingInfo_GetCurrentLogicalThreadId(pComThreadingInfo, NULL);
1813 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
1814
1815 id = id2 = GUID_NULL;
1816 hr = IComThreadingInfo_GetCurrentLogicalThreadId(pComThreadingInfo, &id);
1817 ok(hr == S_OK, "got 0x%08x\n", hr);
1818
1820 ok(IsEqualGUID(&id, &id2), "got %s, expected %s\n", wine_dbgstr_guid(&id), wine_dbgstr_guid(&id2));
1821
1822 hr = IComThreadingInfo_GetCurrentApartmentType(pComThreadingInfo, &apttype);
1823 ok_ole_success(hr, "IComThreadingInfo_GetCurrentApartmentType");
1824 ok(apttype == APTTYPE_MAINSTA, "apartment type should be APTTYPE_MAINSTA instead of %d\n", apttype);
1825
1826 hr = IComThreadingInfo_GetCurrentThreadType(pComThreadingInfo, &thdtype);
1827 ok_ole_success(hr, "IComThreadingInfo_GetCurrentThreadType");
1828 ok(thdtype == THDTYPE_PROCESSMESSAGES, "thread type should be THDTYPE_PROCESSMESSAGES instead of %d\n", thdtype);
1829
1830 refs = IComThreadingInfo_Release(pComThreadingInfo);
1831 ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %d refs\n", refs);
1832
1833 hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
1834 ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
1835
1836 refs = IContextCallback_Release(pContextCallback);
1837 ok(refs == 0, "pContextCallback should have 0 refs instead of %d refs\n", refs);
1838
1840
1841 pCoInitializeEx(NULL, COINIT_MULTITHREADED);
1842
1843 hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1844 ok_ole_success(hr, "CoGetObjectContext");
1845
1846 hr = IComThreadingInfo_GetCurrentApartmentType(pComThreadingInfo, &apttype);
1847 ok_ole_success(hr, "IComThreadingInfo_GetCurrentApartmentType");
1848 ok(apttype == APTTYPE_MTA, "apartment type should be APTTYPE_MTA instead of %d\n", apttype);
1849
1850 hr = IComThreadingInfo_GetCurrentThreadType(pComThreadingInfo, &thdtype);
1851 ok_ole_success(hr, "IComThreadingInfo_GetCurrentThreadType");
1852 ok(thdtype == THDTYPE_BLOCKMESSAGES, "thread type should be THDTYPE_BLOCKMESSAGES instead of %d\n", thdtype);
1853
1854 refs = IComThreadingInfo_Release(pComThreadingInfo);
1855 ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %d refs\n", refs);
1856
1857 hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
1858 ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
1859
1860 refs = IContextCallback_Release(pContextCallback);
1861 ok(refs == 0, "pContextCallback should have 0 refs instead of %d refs\n", refs);
1862
1863 hr = pCoGetObjectContext(&IID_IObjContext, (void **)&pObjContext);
1864 ok_ole_success(hr, "CoGetObjectContext");
1865
1866 refs = IObjContext_Release(pObjContext);
1867 ok(refs == 0, "pObjContext should have 0 refs instead of %d refs\n", refs);
1868
1870}
enum _THDTYPE THDTYPE
@ THDTYPE_PROCESSMESSAGES
Definition: objidl.idl:2341
@ THDTYPE_BLOCKMESSAGES
Definition: objidl.idl:2340

Referenced by START_TEST().

◆ test_CoGetPSClsid()

static void test_CoGetPSClsid ( void  )
static

Definition at line 1190 of file compobj.c.

1191{
1193 HANDLE handle;
1194 HRESULT hr;
1195 CLSID clsid;
1196 HKEY hkey;
1197 LONG res;
1198 const BOOL is_win64 = (sizeof(void*) != sizeof(int));
1200
1203 "CoGetPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n",
1204 hr);
1205
1206 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1207
1209 ok_ole_success(hr, "CoGetPSClsid");
1210
1213 "CoGetPSClsid for random IID returned 0x%08x instead of REGDB_E_IIDNOTREG\n",
1214 hr);
1215
1217 ok(hr == E_INVALIDARG,
1218 "CoGetPSClsid for null clsid returned 0x%08x instead of E_INVALIDARG\n",
1219 hr);
1220
1221 if (!pRegOverridePredefKey)
1222 {
1223 win_skip("RegOverridePredefKey not available\n");
1225 return;
1226 }
1228 ok_ole_success(hr, "CoGetPSClsid");
1229
1230 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0,
1231 KEY_ALL_ACCESS, NULL, &hkey, NULL);
1232 ok(!res, "RegCreateKeyEx returned %d\n", res);
1233
1234 res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
1235 ok(!res, "RegOverridePredefKey returned %d\n", res);
1236
1238 ok_ole_success(hr, "CoGetPSClsid");
1239
1240 res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
1241 ok(!res, "RegOverridePredefKey returned %d\n", res);
1242
1243 RegCloseKey(hkey);
1244
1245 /* not registered CLSID */
1247 ok(hr == REGDB_E_IIDNOTREG, "got 0x%08x\n", hr);
1248
1250 {
1251 memset(&clsid, 0, sizeof(clsid));
1253 ok(hr == S_OK, "got 0x%08x\n", hr);
1254 ok(IsEqualGUID(&clsid, &IID_Testiface), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1255
1256 memset(&clsid, 0, sizeof(clsid));
1258 ok(hr == S_OK, "got 0x%08x\n", hr);
1259 ok(IsEqualGUID(&clsid, &IID_Testiface2), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1260
1261 memset(&clsid, 0, sizeof(clsid));
1263 ok(hr == S_OK, "got 0x%08x\n", hr);
1264 ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1265
1266 memset(&clsid, 0xaa, sizeof(clsid));
1268 ok(hr == S_OK, "got 0x%08x\n", hr);
1269 ok(IsEqualGUID(&clsid, &GUID_NULL), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1270
1271 /* register same interface and try to get CLSID back */
1273 ok(hr == S_OK, "got 0x%08x\n", hr);
1274 memset(&clsid, 0, sizeof(clsid));
1276 ok(hr == S_OK, "got 0x%08x\n", hr);
1277 ok(IsEqualGUID(&clsid, &IID_Testiface4), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1278
1279 pDeactivateActCtx(0, cookie);
1280 pReleaseActCtx(handle);
1281 }
1282
1283 if (pRegDeleteKeyExA &&
1284 (is_win64 ||
1285 (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64)))
1286 {
1287 static GUID IID_DeadBeef = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}};
1288 static const char clsidDeadBeef[] = "{deadbeef-dead-beef-dead-beefdeadbeef}";
1289 static const char clsidA[] = "{66666666-8888-7777-6666-555555555555}";
1290 HKEY hkey_iface, hkey_psclsid;
1292
1293 hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
1294 ok(hr == REGDB_E_IIDNOTREG, "got 0x%08x\n", hr);
1295
1296 res = RegCreateKeyExA(HKEY_CLASSES_ROOT, "Interface",
1297 0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_iface, NULL);
1298 ok(!res, "RegCreateKeyEx returned %d\n", res);
1299 res = RegCreateKeyExA(hkey_iface, clsidDeadBeef,
1300 0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey, NULL);
1301 if (res == ERROR_ACCESS_DENIED)
1302 {
1303 win_skip("Failed to create a key, skipping some of CoGetPSClsid() tests\n");
1304 goto cleanup;
1305 }
1306
1307 ok(!res, "RegCreateKeyEx returned %d\n", res);
1308 res = RegCreateKeyExA(hkey, "ProxyStubClsid32",
1309 0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_psclsid, NULL);
1310 ok(!res, "RegCreateKeyEx returned %d\n", res);
1311 res = RegSetValueExA(hkey_psclsid, NULL, 0, REG_SZ, (const BYTE *)clsidA, strlen(clsidA)+1);
1312 ok(!res, "RegSetValueEx returned %d\n", res);
1313 RegCloseKey(hkey_psclsid);
1314
1315 hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
1316 ok_ole_success(hr, "CoGetPSClsid");
1317 ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1318
1319 res = pRegDeleteKeyExA(hkey, "ProxyStubClsid32", opposite, 0);
1320 ok(!res, "RegDeleteKeyEx returned %d\n", res);
1321 RegCloseKey(hkey);
1322 res = pRegDeleteKeyExA(hkey_iface, clsidDeadBeef, opposite, 0);
1323 ok(!res, "RegDeleteKeyEx returned %d\n", res);
1324
1325 cleanup:
1326 RegCloseKey(hkey_iface);
1327 }
1328
1330}
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4799
#define GetCurrentProcess()
Definition: compat.h:759
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
static void cleanup(void)
Definition: main.c:1335
BOOL is_wow64
Definition: msi.c:52
static const BOOL is_win64
Definition: shellpath.c:59
#define REG_SZ
Definition: layer.c:22
static const GUID IID_Testiface
Definition: compobj.c:95
static const GUID IID_Testiface4
Definition: compobj.c:98
static const GUID IID_Testiface3
Definition: compobj.c:97
static const GUID IID_Testiface2
Definition: compobj.c:96
#define REGDB_E_IIDNOTREG
Definition: winerror.h:2697
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ test_CoInitializeEx()

static void test_CoInitializeEx ( void  )
static

Definition at line 2140 of file compobj.c.

2141{
2142 HRESULT hr;
2143
2144 hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
2145 ok(hr == S_OK, "CoInitializeEx failed with error 0x%08x\n", hr);
2146
2147 /* Calling OleInitialize for the first time should yield S_OK even with
2148 * apartment already initialized by previous CoInitialize(Ex) calls. */
2150 ok(hr == S_OK, "OleInitialize failed with error 0x%08x\n", hr);
2151
2152 /* Subsequent calls to OleInitialize should return S_FALSE */
2154 ok(hr == S_FALSE, "Expected S_FALSE, hr = 0x%08x\n", hr);
2155
2156 /* Cleanup */
2160}

Referenced by START_TEST().

◆ test_CoMarshalInterface()

static void test_CoMarshalInterface ( void  )
static

Definition at line 1376 of file compobj.c.

1377{
1378 IStream *pStream;
1379 HRESULT hr;
1380 static const LARGE_INTEGER llZero;
1381
1382 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1383
1384 hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
1385 ok_ole_success(hr, "CreateStreamOnHGlobal");
1386
1387 hr = CoMarshalInterface(pStream, &IID_IUnknown, NULL, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1388 ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1389
1390 hr = CoMarshalInterface(NULL, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1391 ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1392
1393 hr = CoMarshalInterface(pStream, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1394 ok_ole_success(hr, "CoMarshalInterface");
1395
1396 /* stream not rewound */
1397 hr = CoReleaseMarshalData(pStream);
1398 ok(hr == STG_E_READFAULT, "CoReleaseMarshalData should have returned STG_E_READFAULT instead of 0x%08x\n", hr);
1399
1400 hr = IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
1401 ok_ole_success(hr, "IStream_Seek");
1402
1403 hr = CoReleaseMarshalData(pStream);
1404 ok_ole_success(hr, "CoReleaseMarshalData");
1405
1406 IStream_Release(pStream);
1407
1409}
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
Definition: marshal.c:2055
HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:1876
static const LARGE_INTEGER llZero
Definition: moniker.c:1113
#define STG_E_READFAULT
Definition: winerror.h:2576

Referenced by START_TEST().

◆ test_CoMarshalInterThreadInterfaceInStream()

static void test_CoMarshalInterThreadInterfaceInStream ( void  )
static

Definition at line 1411 of file compobj.c.

1412{
1413 IStream *pStream;
1414 HRESULT hr;
1415 IClassFactory *pProxy;
1416
1417 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1418
1419 cLocks = 0;
1420
1422 ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1423
1425 ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1426
1427 ok_no_locks();
1428
1430 ok_ole_success(hr, "CoMarshalInterThreadInterfaceInStream");
1431
1433
1434 hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
1435 ok_ole_success(hr, "CoUnmarshalInterface");
1436
1437 IClassFactory_Release(pProxy);
1438 IStream_Release(pStream);
1439
1440 ok_no_locks();
1441
1443}
HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM *ppStm)
Definition: marshal.c:2100
#define ok_more_than_one_lock()
Definition: compobj.c:90
#define ok_no_locks()
Definition: compobj.c:91

Referenced by START_TEST().

◆ test_CoRegisterClassObject()

static void test_CoRegisterClassObject ( void  )
static

Definition at line 1445 of file compobj.c.

1446{
1447 ULONG_PTR ctxcookie;
1448 HANDLE handle;
1449 DWORD cookie;
1450 HRESULT hr;
1451 IClassFactory *pcf;
1452
1453 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1454
1455 /* CLSCTX_INPROC_SERVER */
1457 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1458 ok_ole_success(hr, "CoRegisterClassObject");
1460 ok_ole_success(hr, "CoRevokeClassObject");
1461
1463 CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie);
1464 ok_ole_success(hr, "CoRegisterClassObject");
1466 ok_ole_success(hr, "CoRevokeClassObject");
1467
1469 CLSCTX_INPROC_SERVER, REGCLS_MULTI_SEPARATE, &cookie);
1470 ok_ole_success(hr, "CoRegisterClassObject");
1472 ok_ole_success(hr, "CoRevokeClassObject");
1473
1474 /* CLSCTX_LOCAL_SERVER */
1476 CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1477 ok_ole_success(hr, "CoRegisterClassObject");
1479 ok_ole_success(hr, "CoRevokeClassObject");
1480
1482 CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &cookie);
1483 ok_ole_success(hr, "CoRegisterClassObject");
1485 ok_ole_success(hr, "CoRevokeClassObject");
1486
1488 CLSCTX_LOCAL_SERVER, REGCLS_MULTI_SEPARATE, &cookie);
1489 ok_ole_success(hr, "CoRegisterClassObject");
1491 ok_ole_success(hr, "CoRevokeClassObject");
1492
1493 /* CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER */
1495 CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1496 ok_ole_success(hr, "CoRegisterClassObject");
1498 ok_ole_success(hr, "CoRevokeClassObject");
1499
1500 /* test whether an object that doesn't support IClassFactory can be
1501 * registered for CLSCTX_LOCAL_SERVER */
1503 CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1504 ok_ole_success(hr, "CoRegisterClassObject");
1506 ok_ole_success(hr, "CoRevokeClassObject");
1507
1508 /* test whether registered class becomes invalid when apartment is destroyed */
1510 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1511 ok_ole_success(hr, "CoRegisterClassObject");
1512
1514 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1515
1516 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL,
1517 &IID_IClassFactory, (void **)&pcf);
1518 ok(hr == REGDB_E_CLASSNOTREG, "object registered in an apartment shouldn't accessible after it is destroyed\n");
1519
1520 /* crashes with at least win9x DCOM! */
1521 if (0)
1523
1524 /* test that object is accessible */
1527 ok(hr == S_OK, "got 0x%08x\n", hr);
1528
1529 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1530 ok(hr == S_OK, "got 0x%08x\n", hr);
1531 IClassFactory_Release(pcf);
1532
1533 /* context now contains CLSID_WineOOPTest, test if registered one could still be used */
1534 if ((handle = activate_context(actctx_manifest, &ctxcookie)))
1535 {
1536 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1538 ok(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND), "got 0x%08x\n", hr);
1539
1540 pDeactivateActCtx(0, ctxcookie);
1541 pReleaseActCtx(handle);
1542 }
1543
1544 hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1545 ok(hr == S_OK, "got 0x%08x\n", hr);
1546 IClassFactory_Release(pcf);
1547
1549 ok(hr == S_OK, "got 0x%08x\n", hr);
1550
1552}
#define ERROR_MOD_NOT_FOUND
Definition: compat.h:104
@ REGCLS_MULTI_SEPARATE
Definition: objbase.h:394
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

Referenced by START_TEST().

◆ test_CoRegisterMessageFilter()

static void test_CoRegisterMessageFilter ( void  )
static

Definition at line 861 of file compobj.c.

862{
863 HRESULT hr;
864 IMessageFilter *prev_filter;
865
866 hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
868 "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08x\n",
869 hr);
870
871 pCoInitializeEx(NULL, COINIT_MULTITHREADED);
872 prev_filter = (IMessageFilter *)0xdeadbeef;
873 hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
875 "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08x\n",
876 hr);
877 ok(prev_filter == (IMessageFilter *)0xdeadbeef,
878 "prev_filter should have been set to %p\n", prev_filter);
880
881 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
882
884 ok_ole_success(hr, "CoRegisterMessageFilter");
885
886 prev_filter = (IMessageFilter *)0xdeadbeef;
887 hr = CoRegisterMessageFilter(NULL, &prev_filter);
888 ok_ole_success(hr, "CoRegisterMessageFilter");
889 ok(prev_filter == NULL, "prev_filter should have been set to NULL instead of %p\n", prev_filter);
890
891 hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
892 ok_ole_success(hr, "CoRegisterMessageFilter");
893 ok(prev_filter == NULL, "prev_filter should have been set to NULL instead of %p\n", prev_filter);
894
896 ok_ole_success(hr, "CoRegisterMessageFilter");
897
899}
static IMessageFilter MessageFilter
Definition: compobj.c:859

Referenced by START_TEST().

◆ test_CoRegisterPSClsid()

static void test_CoRegisterPSClsid ( void  )
static

Definition at line 1087 of file compobj.c.

1088{
1089 HRESULT hr;
1090 DWORD dwRegistrationKey;
1091 IStream *stream;
1092 CLSID clsid;
1093 HANDLE thread;
1094 DWORD tid;
1095
1097 ok(hr == CO_E_NOTINITIALIZED, "CoRegisterPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
1098
1099 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1100
1102 CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &dwRegistrationKey);
1103 ok_ole_success(hr, "CoRegisterClassObject");
1104
1106 ok_ole_success(hr, "CoRegisterPSClsid");
1107
1109 ok_ole_success(hr, "CoGetPSClsid");
1110 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1112
1114 ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
1115 ok(!WaitForSingleObject(thread, 10000), "wait timed out\n");
1117
1119 ok_ole_success(hr, "CoGetPSClsid");
1120 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1122
1124 ok_ole_success(hr, "CreateStreamOnHGlobal");
1125
1126 SET_EXPECT(CreateStub);
1127 hr = CoMarshalInterface(stream, &IID_IWineTest, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1128 ok(hr == E_NOTIMPL, "CoMarshalInterface should have returned E_NOTIMPL instead of 0x%08x\n", hr);
1129 CHECK_CALLED(CreateStub, 1);
1130
1132 ok_ole_success(hr, "CoGetPSClsid");
1133
1134 hr = CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IPSFactoryBuffer, (void **)&ps_factory_buffer);
1135 ok_ole_success(hr, "CoGetClassObject");
1136
1138 ok_ole_success(hr, "CoRegisterPSClsid");
1139
1140 SET_EXPECT(CreateStub);
1141 hr = CoMarshalInterface(stream, &IID_IEnumOLEVERB, (IUnknown*)&EnumOLEVERB, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1142 ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08x\n", hr);
1143 CHECK_CALLED(CreateStub, 1);
1144
1145 hr = CoMarshalInterface(stream, &IID_IEnumOLEVERB, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1146 ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08x\n", hr);
1147
1148 IStream_Release(stream);
1149 IPSFactoryBuffer_Release(ps_factory_buffer);
1151
1152 hr = CoRevokeClassObject(dwRegistrationKey);
1153 ok_ole_success(hr, "CoRevokeClassObject");
1154
1156
1157 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1158
1160 ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08x\n", hr);
1161
1163 ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08x\n", hr);
1164
1166
1167 pCoInitializeEx(NULL, COINIT_MULTITHREADED);
1168
1170 ok_ole_success(hr, "CoRegisterPSClsid");
1171
1173 ok_ole_success(hr, "CoGetPSClsid");
1174 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1176
1178 ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
1179 ok(!WaitForSingleObject(thread, 10000), "wait timed out\n");
1181
1183 ok_ole_success(hr, "CoGetPSClsid");
1184 ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1186
1188}
#define SET_EXPECT(func)
Definition: compobj.c:44
static DWORD CALLBACK register_ps_clsid_thread(void *context)
Definition: compobj.c:1066
#define CHECK_CALLED(func, n)
Definition: compobj.c:59

Referenced by START_TEST().

◆ test_CoUnmarshalInterface()

static void test_CoUnmarshalInterface ( void  )
static

Definition at line 1333 of file compobj.c.

1334{
1335 IUnknown *pProxy;
1336 IStream *pStream;
1337 HRESULT hr;
1338
1339 hr = CoUnmarshalInterface(NULL, &IID_IUnknown, (void **)&pProxy);
1340 ok(hr == E_INVALIDARG, "CoUnmarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1341
1342 hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
1343 ok_ole_success(hr, "CreateStreamOnHGlobal");
1344
1345 hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)&pProxy);
1346 todo_wine
1347 ok(hr == CO_E_NOTINITIALIZED, "CoUnmarshalInterface should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
1348
1349 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1350
1351 hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)&pProxy);
1352 ok(hr == STG_E_READFAULT, "CoUnmarshalInterface should have returned STG_E_READFAULT instead of 0x%08x\n", hr);
1353
1355
1357 ok(hr == E_INVALIDARG, "CoUnmarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1358
1359 IStream_Release(pStream);
1360}

Referenced by START_TEST().

◆ test_CoWaitForMultipleHandles()

static void test_CoWaitForMultipleHandles ( void  )
static

Definition at line 2652 of file compobj.c.

2653{
2654 HANDLE handles[2], thread;
2655 DWORD index, tid;
2656 WNDCLASSEXA wc;
2657 BOOL success;
2658 HRESULT hr;
2659 HWND hWnd;
2660 MSG msg;
2661
2662 hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
2663 ok(hr == S_OK, "CoInitializeEx failed with error 0x%08x\n", hr);
2664
2665 memset(&wc, 0, sizeof(wc));
2666 wc.cbSize = sizeof(wc);
2670 wc.hbrBackground = NULL;
2673 success = RegisterClassExA(&wc) != 0;
2674 ok(success, "RegisterClassExA failed %u\n", GetLastError());
2675
2676 hWnd = CreateWindowExA(0, cls_name, "Test", WS_TILEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0);
2677 ok(hWnd != 0, "CreateWindowExA failed %u\n", GetLastError());
2678 handles[0] = CreateSemaphoreA(NULL, 1, 1, NULL);
2679 ok(handles[0] != 0, "CreateSemaphoreA failed %u\n", GetLastError());
2680 handles[1] = CreateSemaphoreA(NULL, 1, 1, NULL);
2681 ok(handles[1] != 0, "CreateSemaphoreA failed %u\n", GetLastError());
2682
2683 /* test without flags */
2684
2687 ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
2689 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2690
2691 index = 0xdeadbeef;
2693 hr = CoWaitForMultipleHandles(0, 50, 0, NULL, &index);
2694 ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
2695 ok(index == 0, "expected index 0, got %u\n", index);
2697 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2698
2699 index = 0xdeadbeef;
2702 ok(hr == RPC_E_NO_SYNC, "expected RPC_E_NO_SYNC, got 0x%08x\n", hr);
2703 ok(index == 0, "expected index 0, got %u\n", index);
2705 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2706
2707 index = 0xdeadbeef;
2710 ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
2711 ok(index == 0, "expected index 0, got %u\n", index);
2713 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2714
2715 index = 0xdeadbeef;
2718 ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
2719 ok(index == 1, "expected index 1, got %u\n", index);
2721 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2722
2723 index = 0xdeadbeef;
2726 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2727 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
2729 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2730
2731 /* test PostMessageA/SendMessageA from a different thread */
2732
2733 index = 0xdeadbeef;
2735 ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
2736 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2737 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2738 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
2740 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2742 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2744
2745 index = 0xdeadbeef;
2747 ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
2748 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2749 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2750 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
2752 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2754 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2756
2759
2760 /* test with COWAIT_WAITALL */
2761
2762 index = 0xdeadbeef;
2765 ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
2766 ok(index == 0, "expected index 0, got %u\n", index);
2768 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2769
2770 index = 0xdeadbeef;
2773 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2774 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
2776 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2777
2780
2781 /* test with COWAIT_ALERTABLE */
2782
2783 index = 0xdeadbeef;
2786 ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
2787 ok(index == 0, "expected index 0, got %u\n", index);
2789 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2790
2791 index = 0xdeadbeef;
2794 ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
2795 ok(index == 1, "expected index 1, got %u\n", index);
2797 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2798
2799 index = 0xdeadbeef;
2802 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2803 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
2805 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2806
2807 index = 0xdeadbeef;
2810 ok(success, "QueueUserAPC failed %u\n", GetLastError());
2812 ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
2813 ok(index == WAIT_IO_COMPLETION, "expected index WAIT_IO_COMPLETION, got %u\n", index);
2815 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2816
2817 /* test with COWAIT_INPUTAVAILABLE (semaphores are still locked) */
2818
2819 index = 0xdeadbeef;
2822