ReactOS 0.4.15-dev-7958-gcd0bb1a
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:1196
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 broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
#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:160
#define memset(x, y, z)
Definition: compat.h:39
Definition: cookie.c:34
static const CHAR manifest[]
Definition: v6util.h:39
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:33
#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:79
#define ros_skip_flaky
Definition: test.h:177

◆ 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:2090
#define COLOR_BTNFACE
Definition: winuser.h:928
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:1895

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:54
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 ok(success, "PeekMessageA returned FALSE\n");
2824 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2825 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
2827 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2828
2829 index = 0xdeadbeef;
2832 ok(success, "PeekMessageA returned FALSE\n");
2834 ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
2836 ok(hr == RPC_S_CALLPENDING || broken(hr == E_INVALIDARG) || broken(hr == S_OK) /* Win 8 */,
2837 "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2838 if (hr != S_OK) ReleaseSemaphore(handles[1], 1, NULL);
2839 ok(index == 0 || broken(index == 1) /* Win 8 */, "expected index 0, got %u\n", index);
2842 "CoWaitForMultipleHandles didn't pump any messages\n");
2844 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2846
2848 PostMessageA(hWnd, 0, 0, 0);
2850 PostMessageA(hWnd, WM_USER+1, 0, 0);
2851 PostMessageA(hWnd, WM_DDE_FIRST+1, 0, 0);
2853 ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
2854
2855 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2856 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2857
2865
2867 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2869
2870 /* test behaviour of WM_QUIT (semaphores are still locked) */
2871
2872 PostMessageA(hWnd, WM_QUIT, 40, 0);
2873 memset(&msg, 0, sizeof(msg));
2875 ok(success, "PeekMessageA failed, error %u\n", GetLastError());
2876 ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
2877 ok(msg.wParam == 40, "expected msg.wParam = 40, got %lu\n", msg.wParam);
2879 ok(!success, "PeekMessageA succeeded\n");
2880
2882 PostMessageA(hWnd, WM_QUIT, 40, 0);
2883 PostMessageA(hWnd, 0, 0, 0);
2885 PostMessageA(hWnd, WM_USER+1, 0, 0);
2886 PostMessageA(hWnd, WM_DDE_FIRST+1, 0, 0);
2888 ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
2889
2890 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2891 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2892
2899
2901 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2903
2904 index = 0xdeadbeef;
2906 PostMessageA(hWnd, WM_QUIT, 41, 0);
2908 ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
2909 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2910 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2911 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
2913 todo_wine
2914 ok(success || broken(!success) /* Win 2000/XP/8 */, "PeekMessageA failed, error %u\n", GetLastError());
2916 ok(!success, "PeekMessageA succeeded\n");
2917 memset(&msg, 0, sizeof(msg));
2919 todo_wine
2920 ok(!success || broken(success) /* Win 2000/XP/8 */, "PeekMessageA succeeded\n");
2921 if (success)
2922 {
2923 ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
2924 ok(msg.wParam == 41, "expected msg.wParam = 41, got %lu\n", msg.wParam);
2925 }
2927 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2929
2930 index = 0xdeadbeef;
2932 PostMessageA(hWnd, WM_QUIT, 42, 0);
2934 ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
2935 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2936 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2937 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
2939 ok(!success, "CoWaitForMultipleHandles didn't pump all WM_DDE_FIRST messages\n");
2940 memset(&msg, 0, sizeof(msg));
2942 ok(success, "PeekMessageA failed, error %u\n", GetLastError());
2943 ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
2944 ok(msg.wParam == 42, "expected msg.wParam = 42, got %lu\n", msg.wParam);
2946 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2948
2949 PostQuitMessage(43);
2950 memset(&msg, 0, sizeof(msg));
2952 ok(success || broken(!success) /* Win 8 */, "PeekMessageA failed, error %u\n", GetLastError());
2953 if (!success)
2954 win_skip("PostQuitMessage didn't queue a WM_QUIT message, skipping tests\n");
2955 else
2956 {
2957 ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
2958 ok(msg.wParam == 43, "expected msg.wParam = 43, got %lu\n", msg.wParam);
2960 ok(!success, "PeekMessageA succeeded\n");
2961
2962 index = 0xdeadbeef;
2964 PostQuitMessage(44);
2966 ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
2967 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2968 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2969 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
2971 ok(success, "PeekMessageA failed, error %u\n", GetLastError());
2973 ok(!success, "PeekMessageA succeeded\n");
2975 ok(!success, "CoWaitForMultipleHandles didn't remove WM_QUIT messages\n");
2977 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2979
2980 index = 0xdeadbeef;
2982 PostQuitMessage(45);
2984 ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
2985 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
2986 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2987 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
2989 ok(success, "PeekMessageA failed, error %u\n", GetLastError());
2991 ok(!success, "PeekMessageA succeeded\n");
2993 ok(!success, "CoWaitForMultipleHandles didn't remove WM_QUIT messages\n");
2995 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2997 }
2998
2999 /* test message pumping when CoWaitForMultipleHandles is called from non main apartment thread */
3002 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
3004
3006
3007 /* If COM was not initialized, messages are neither pumped nor peeked at */
3009 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3010 ok(hr == RPC_S_CALLPENDING, "got %#x\n", hr);
3012 ok(success == 0, "MsgWaitForMultipleObjects returned %x\n", success);
3014 ok(success, "PeekMessage failed: %u\n", GetLastError());
3015
3016 /* same in an MTA */
3018
3020 hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
3021 ok(hr == RPC_S_CALLPENDING, "got %#x\n", hr);
3023 ok(success == 0, "MsgWaitForMultipleObjects returned %x\n", success);
3025 ok(success, "PeekMessage failed: %u\n", GetLastError());
3026
3028
3029 CloseHandle(handles[0]);
3030 CloseHandle(handles[1]);
3032
3034 ok(success, "UnregisterClass failed %u\n", GetLastError());
3035}
#define index(s, c)
Definition: various.h:29
DWORD WINAPI QueueUserAPC(IN PAPCFUNC pfnAPC, IN HANDLE hThread, IN ULONG_PTR dwData)
Definition: thread.c:959
HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags, DWORD dwTimeout, ULONG cHandles, LPHANDLE pHandles, LPDWORD lpdwindex)
Definition: compobj.c:4578
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
GLuint index
Definition: glext.h:6031
static LRESULT CALLBACK cowait_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: compobj.c:2527
static DWORD CALLBACK send_message_thread(LPVOID arg)
Definition: compobj.c:2451
static DWORD CALLBACK send_and_post_user_message_thread(void *arg)
Definition: compobj.c:2459
static void CALLBACK apc_test_proc(ULONG_PTR param)
Definition: compobj.c:2438
static const char cls_name[]
Definition: compobj.c:2476
#define cowait_msgs_expect_queued(a, b)
Definition: compobj.c:2508
#define cowait_msgs_expect_notified(a)
Definition: compobj.c:2495
static void flush_messages(void)
Definition: compobj.c:2521
static DWORD CALLBACK post_message_thread(LPVOID arg)
Definition: compobj.c:2468
static DWORD CALLBACK release_semaphore_thread(LPVOID arg)
Definition: compobj.c:2443
static DWORD CALLBACK test_CoWaitForMultipleHandles_thread(LPVOID arg)
Definition: compobj.c:2563
#define cowait_msgs_expect_empty()
Definition: compobj.c:2485
@ COWAIT_ALERTABLE
Definition: objbase.h:697
@ COWAIT_INPUTAVAILABLE
Definition: objbase.h:698
@ COWAIT_WAITALL
Definition: objbase.h:696
#define WS_TILEDWINDOW
Definition: pedump.c:643
HINSTANCE hInstance
Definition: winuser.h:3206
HCURSOR hCursor
Definition: winuser.h:3208
UINT style
Definition: winuser.h:3202
UINT cbSize
Definition: winuser.h:3201
WNDPROC lpfnWndProc
Definition: winuser.h:3203
LPCSTR lpszClassName
Definition: winuser.h:3211
HBRUSH hbrBackground
Definition: winuser.h:3209
HANDLE WINAPI DECLSPEC_HOTPATCH CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, IN LONG lInitialCount, IN LONG lMaximumCount, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:430
static EFI_HANDLE * handles
Definition: uefidisk.c:62
HANDLE WINAPI GetCurrentThread(void)
Definition: proc.c:1148
#define WAIT_IO_COMPLETION
Definition: winbase.h:411
#define WAIT_OBJECT_0
Definition: winbase.h:406
#define RPC_S_CALLPENDING
Definition: winerror.h:2497
#define RPC_E_NO_SYNC
Definition: winerror.h:2508
#define CS_VREDRAW
Definition: winuser.h:658
#define WM_QUIT
Definition: winuser.h:1623
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
#define MWMO_ALERTABLE
Definition: winuser.h:909
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define CS_HREDRAW
Definition: winuser.h:653
#define QS_ALLPOSTMESSAGE
Definition: winuser.h:882
DWORD WINAPI MsgWaitForMultipleObjectsEx(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask, _In_ DWORD dwFlags)
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define PM_NOREMOVE
Definition: winuser.h:1195
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by START_TEST().

◆ test_CoWaitForMultipleHandles_thread()

static DWORD CALLBACK test_CoWaitForMultipleHandles_thread ( LPVOID  arg)
static

Definition at line 2563 of file compobj.c.

2564{
2566 IStream *stream;
2567 BOOL success;
2568 DWORD index, tid;
2569 HRESULT hr;
2570 HWND hWnd;
2571 UINT uMSG = 0xc065;
2572 MSG msg;
2573 int ret;
2574
2575 hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
2576 ok(hr == S_OK, "CoInitializeEx failed with error 0x%08x\n", hr);
2577
2578 hWnd = CreateWindowExA(0, cls_name, "Test (thread)", WS_TILEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0);
2579 ok(hWnd != 0, "CreateWindowExA failed %u\n", GetLastError());
2580
2581 index = 0xdeadbeef;
2584 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2585 ok(index==0 || index==0xdeadbeef/* Win 8 */, "expected index 0, got %u\n", index);
2587 ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
2588
2589 index = 0xdeadbeef;
2590 PostMessageA(hWnd, WM_USER, 0, 0);
2592 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2593 ok(index==0 || index==0xdeadbeef/* Win 8 */, "expected index 0, got %u\n", index);
2595 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2596
2597 /* Even if CoWaitForMultipleHandles does not pump a message it peeks
2598 * at ALL of them */
2599 index = 0xdeadbeef;
2600 PostMessageA(NULL, uMSG, 0, 0);
2601
2603 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2604 ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
2605
2606 /* Make sure message was peeked at */
2608 ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %x\n", ret);
2609
2610 /* But not pumped */
2611 success = PeekMessageA(&msg, NULL, uMSG, uMSG, PM_REMOVE);
2612 ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
2613
2616
2617 hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
2618 ok(hr == S_OK, "CoInitializeEx failed with error 0x%08x\n", hr);
2619
2621 ok(hr == S_OK, "CreateStreamOnHGlobal failed: %08x\n", hr);
2622
2623 hr = CoMarshalInterface(stream, &IID_IUnknown, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
2624 ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08x\n", hr);
2625
2626 event = CreateEventW(NULL, TRUE, FALSE, NULL);
2627
2628 PostQuitMessage(66);
2630
2632 ok(hr == S_OK, "CoRegisterMessageFilter failed: %08x\n", hr);
2633
2635 ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
2636 hr = CoWaitForMultipleHandles(0, 50, 1, &event, &index);
2637 ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
2639 ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
2641
2643 ok(hr == S_OK, "CoRegisterMessageFilter failed: %08x\n", hr);
2644
2645 IStream_Release(stream);
2646
2649 return 0;
2650}
struct _cl_event * event
Definition: glext.h:7739
static DWORD CALLBACK cowait_unmarshal_thread(void *arg)
Definition: compobj.c:2536
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
BOOL WINAPI PostThreadMessageW(_In_ DWORD, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_CoWaitForMultipleHandles().

◆ test_GlobalOptions()

static void test_GlobalOptions ( void  )
static

Definition at line 3751 of file compobj.c.

3752{
3754 HRESULT hres;
3755
3757
3758 hres = CoCreateInstance(&CLSID_GlobalOptions, NULL, CLSCTX_INPROC_SERVER,
3759 &IID_IGlobalOptions, (void**)&global_options);
3760 ok(hres == S_OK || broken(hres == E_NOINTERFACE), "CoCreateInstance(CLSID_GlobalOptions) failed: %08x\n", hres);
3761 if(FAILED(hres))
3762 {
3763 win_skip("CLSID_GlobalOptions not available\n");
3765 return;
3766 }
3767
3768 IGlobalOptions_Release(global_options);
3769
3770 hres = CoCreateInstance(&CLSID_GlobalOptions, (IUnknown*)0xdeadbeef, CLSCTX_INPROC_SERVER,
3771 &IID_IGlobalOptions, (void**)&global_options);
3772 ok(hres == E_INVALIDARG, "CoCreateInstance(CLSID_GlobalOptions) failed: %08x\n", hres);
3773
3775}
static const struct optioninfo global_options[]
Definition: adh-opts.c:43
const CLSID CLSID_GlobalOptions
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hres
Definition: protocol.c:465

Referenced by START_TEST().

◆ Test_IClassFactory_AddRef()

static ULONG WINAPI Test_IClassFactory_AddRef ( LPCLASSFACTORY  iface)
static

Definition at line 150 of file compobj.c.

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

◆ Test_IClassFactory_CreateInstance()

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

Definition at line 163 of file compobj.c.

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

◆ Test_IClassFactory_LockServer()

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

Definition at line 175 of file compobj.c.

178{
179 return S_OK;
180}

◆ Test_IClassFactory_QueryInterface()

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

Definition at line 131 of file compobj.c.

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

◆ Test_IClassFactory_Release()

static ULONG WINAPI Test_IClassFactory_Release ( LPCLASSFACTORY  iface)
static

Definition at line 156 of file compobj.c.

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

◆ test_IIDFromString()

static void test_IIDFromString ( void  )
static

Definition at line 518 of file compobj.c.

519{
520 static const WCHAR cfW[] = {'{','0','0','0','0','0','0','0','1','-','0','0','0','0','-','0','0','0','0','-',
521 'c','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}',0};
522 static const WCHAR brokenW[] = {'{','0','0','0','0','0','0','0','1','-','0','0','0','0','-','0','0','0','0','-',
523 'g','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}',0};
524 static const WCHAR broken2W[] = {'{','0','0','0','0','0','0','0','1','=','0','0','0','0','-','0','0','0','0','-',
525 'g','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}',0};
526 static const WCHAR broken3W[] = {'b','r','o','k','e','n','0','0','1','=','0','0','0','0','-','0','0','0','0','-',
527 'g','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}',0};
528 HRESULT hr;
529 IID iid;
530
532 ok(hr == S_OK, "got 0x%08x\n", hr);
533 ok(IsEqualIID(&iid, &CLSID_StdFont), "got iid %s\n", wine_dbgstr_guid(&iid));
534
535 memset(&iid, 0xab, sizeof(iid));
536 hr = IIDFromString(NULL, &iid);
537 ok(hr == S_OK, "got 0x%08x\n", hr);
538 ok(IsEqualIID(&iid, &CLSID_NULL), "got iid %s\n", wine_dbgstr_guid(&iid));
539
540 hr = IIDFromString(cfW, &iid);
541 ok(hr == S_OK, "got 0x%08x\n", hr);
542 ok(IsEqualIID(&iid, &IID_IClassFactory), "got iid %s\n", wine_dbgstr_guid(&iid));
543
544 /* string starts with a valid IID but is longer */
545 memset(&iid, 0xab, sizeof(iid));
546 hr = IIDFromString(cf_brokenW, &iid);
547 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
548 ok(iid.Data1 == 0xabababab, "Got %08x\n", iid.Data1);
549
550 /* invalid IID in a valid format */
551 memset(&iid, 0xab, sizeof(iid));
552 hr = IIDFromString(brokenW, &iid);
553 ok(hr == CO_E_IIDSTRING, "got 0x%08x\n", hr);
554 ok(iid.Data1 == 0x00000001, "Got %08x\n", iid.Data1);
555
556 memset(&iid, 0xab, sizeof(iid));
557 hr = IIDFromString(broken2W, &iid);
558 ok(hr == CO_E_IIDSTRING, "got 0x%08x\n", hr);
559 ok(iid.Data1 == 0x00000001, "Got %08x\n", iid.Data1);
560
561 /* format is broken, but string length is okay */
562 memset(&iid, 0xab, sizeof(iid));
563 hr = IIDFromString(broken3W, &iid);
564 ok(hr == CO_E_IIDSTRING, "got 0x%08x\n", hr);
565 ok(iid.Data1 == 0xabababab, "Got %08x\n", iid.Data1);
566
567 /* invalid string */
568 memset(&iid, 0xab, sizeof(iid));
570 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
571 ok(iid.Data1 == 0xabababab, "Got %08x\n", iid.Data1);
572
573 /* valid ProgID */
574 memset(&iid, 0xab, sizeof(iid));
575 hr = IIDFromString(stdfont, &iid);
576 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
577 ok(iid.Data1 == 0xabababab, "Got %08x\n", iid.Data1);
578}
HRESULT WINAPI IIDFromString(LPCOLESTR s, IID *iid)
Definition: compobj.c:2374
#define CO_E_IIDSTRING
Definition: winerror.h:2807

Referenced by START_TEST().

◆ test_IInitializeSpy()

static void test_IInitializeSpy ( BOOL  mt)
static

Definition at line 3386 of file compobj.c.

3387{
3388 HRESULT hr;
3389
3390 if (mt)
3391 {
3392 hr = pCoInitializeEx(NULL, COINIT_MULTITHREADED);
3393 ok(hr == S_OK, "CoInitializeEx failed: %#x\n", hr);
3394 }
3395
3397 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3398
3399 init_cookies[0].QuadPart = 1;
3401 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3402 ok(init_cookies[0].QuadPart == 1, "got wrong cookie\n");
3403
3405 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3406
3407 init_cookies[0].HighPart = 0;
3408 init_cookies[0].LowPart = 1;
3410 ok(hr == S_OK, "got 0x%08x\n", hr);
3411 ok(init_cookies[0].HighPart == GetCurrentThreadId(), "got high part 0x%08x, expected 0x%08x\n", init_cookies[0].HighPart,
3413 if (!mt) ok(init_cookies[0].LowPart == 0, "got wrong low part 0x%x\n", init_cookies[0].LowPart);
3414
3415 /* register same instance one more time */
3416 init_cookies[1].HighPart = 0;
3417 init_cookies[1].LowPart = 0;
3419 ok(hr == S_OK, "got 0x%08x\n", hr);
3420 ok(init_cookies[1].HighPart == GetCurrentThreadId(), "got high part 0x%08x, expected 0x%08x\n", init_cookies[1].HighPart,
3422 if (!mt) ok(init_cookies[1].LowPart == 1, "got wrong low part 0x%x\n", init_cookies[1].LowPart);
3423
3424 init_cookies[2].HighPart = 0;
3425 init_cookies[2].LowPart = 0;
3427 ok(hr == S_OK, "got 0x%08x\n", hr);
3428 ok(init_cookies[2].HighPart == GetCurrentThreadId(), "got high part 0x%08x, expected 0x%08x\n", init_cookies[2].HighPart,
3430 if (!mt) ok(init_cookies[2].LowPart == 2, "got wrong low part 0x%x\n", init_cookies[2].LowPart);
3431
3433 ok(hr == S_OK, "got 0x%08x\n", hr);
3434
3436 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3437
3438 init_cookies[1].HighPart = 0;
3439 init_cookies[1].LowPart = 0;
3441 ok(hr == S_OK, "got 0x%08x\n", hr);
3442 ok(init_cookies[1].HighPart == GetCurrentThreadId(), "got high part 0x%08x, expected 0x%08x\n", init_cookies[1].HighPart,
3444 if (!mt) ok(init_cookies[1].LowPart == 1, "got wrong low part 0x%x\n", init_cookies[1].LowPart);
3445
3446 SET_EXPECT(PreInitialize);
3447 SET_EXPECT(PostInitialize);
3449 ok(hr == (mt ? S_FALSE : S_OK), "Failed to initialize COM, hr %#x.\n", hr);
3450 CHECK_CALLED(PreInitialize, 3);
3451 CHECK_CALLED(PostInitialize, 3);
3452
3453 if (mt)
3454 {
3455 HANDLE thread;
3457 ok(thread != NULL, "CreateThread failed: %u\n", GetLastError());
3458 ok(!WaitForSingleObject(thread, 1000), "wait failed\n");
3459 }
3460
3461 SET_EXPECT(PreInitialize);
3462 SET_EXPECT(PostInitialize);
3464 ok(hr == S_FALSE, "Failed to initialize COM, hr %#x.\n", hr);
3465 CHECK_CALLED(PreInitialize, 3);
3466 CHECK_CALLED(PostInitialize, 3);
3467
3468 SET_EXPECT(PreUninitialize);
3469 SET_EXPECT(PostUninitialize);
3471 CHECK_CALLED(PreUninitialize, 3);
3472 CHECK_CALLED(PostUninitialize, 3);
3473
3474 SET_EXPECT(PreUninitialize);
3475 SET_EXPECT(PostUninitialize);
3477 CHECK_CALLED(PreUninitialize, 3);
3478 CHECK_CALLED(PostUninitialize, 3);
3479
3480 if (mt)
3481 {
3482 SET_EXPECT(PreUninitialize);
3483 SET_EXPECT(PostUninitialize);
3485 CHECK_CALLED(PreUninitialize, 3);
3486 CHECK_CALLED(PostUninitialize, 3);
3487 }
3488
3489 SET_EXPECT(PreInitialize);
3490 SET_EXPECT(PostInitialize);
3492 ok(hr == S_OK, "Failed to initialize COM, hr %#x.\n", hr);
3493 CHECK_CALLED(PreInitialize, 3);
3494 CHECK_CALLED(PostInitialize, 3);
3495
3496 SET_EXPECT(PreUninitialize);
3499 CHECK_CALLED(PreUninitialize, 1);
3500}
HRESULT WINAPI CoRegisterInitializeSpy(IInitializeSpy *spy, ULARGE_INTEGER *cookie)
Definition: compobj.c:1832
HRESULT WINAPI CoRevokeInitializeSpy(ULARGE_INTEGER cookie)
Definition: compobj.c:1891
static DWORD expected_coinit_flags
Definition: compobj.c:3315
static DWORD WINAPI test_init_spies_proc(void *arg)
Definition: compobj.c:3372
static BOOL revoke_spies_on_uninit
Definition: compobj.c:3317
static ULARGE_INTEGER init_cookies[3]
Definition: compobj.c:3316
static IInitializeSpy testinitialize
Definition: compobj.c:3370
@ COINIT_DISABLE_OLE1DDE
Definition: objbase.h:280
$ULONG LowPart
Definition: ntbasedef.h:569
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
$ULONG HighPart
Definition: ntbasedef.h:570
ret QuadPart
Definition: rtlfuncs.h:3089

Referenced by START_TEST().

◆ test_IMallocSpy()

static void test_IMallocSpy ( void  )
static

Definition at line 3242 of file compobj.c.

3243{
3244 IMalloc *imalloc;
3245 HRESULT hr;
3246
3248 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3249
3251 ok(hr == CO_E_OBJNOTREG, "got 0x%08x\n", hr);
3252
3254 ok(hr == S_OK, "got 0x%08x\n", hr);
3255
3257 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3258
3260 ok(hr == CO_E_OBJISREG, "got 0x%08x\n", hr);
3261
3262 imalloc = NULL;
3263 hr = CoGetMalloc(MEMCTX_TASK, &imalloc);
3264 ok(hr == S_OK, "got 0x%08x\n", hr);
3265 ok(imalloc != NULL, "got %p\n", imalloc);
3266
3267 IMalloc_Free(imalloc, NULL);
3268
3269 IMalloc_Release(imalloc);
3270
3272 ok(hr == S_OK, "got 0x%08x\n", hr);
3273
3275 ok(hr == CO_E_OBJNOTREG, "got 0x%08x\n", hr);
3276}
HRESULT WINAPI CoRevokeMallocSpy(void)
Definition: ifs.c:522
HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy)
Definition: ifs.c:482
static IMallocSpy testspy
Definition: compobj.c:3240
#define CO_E_OBJNOTREG
Definition: winerror.h:2814
#define CO_E_OBJISREG
Definition: winerror.h:2815

Referenced by START_TEST().

◆ test_implicit_mta()

static void test_implicit_mta ( void  )
static

Definition at line 3853 of file compobj.c.

3854{
3855 HANDLE thread;
3856
3858
3860 ok(!WaitForSingleObject(thread, 1000), "wait failed\n");
3861
3863}
static DWORD CALLBACK implicit_mta_proc(void *param)
Definition: compobj.c:3800

Referenced by START_TEST().

◆ test_init_spies_proc()

static DWORD WINAPI test_init_spies_proc ( void arg)
static

Definition at line 3372 of file compobj.c.

3373{
3374 HRESULT hr;
3375
3377 ok(hr == S_OK, "Failed to initialize COM, hr %#x.\n", hr);
3378
3380 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3381
3383 return 0;
3384}

Referenced by test_IInitializeSpy().

◆ Test_IUnknown_AddRef()

static ULONG WINAPI Test_IUnknown_AddRef ( IUnknown iface)
static

Definition at line 974 of file compobj.c.

975{
976 return 2; /* non-heap-based object */
977}

◆ Test_IUnknown_QueryInterface()

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

Definition at line 954 of file compobj.c.

958{
959 if (ppvObj == NULL) return E_POINTER;
960
962 *ppvObj = iface;
963 }else if(IsEqualIID(riid, &IID_IEnumOLEVERB)) {
964 *ppvObj = &EnumOLEVERB;
965 }else {
966 *ppvObj = NULL;
967 return E_NOINTERFACE;
968 }
969
970 IUnknown_AddRef((IUnknown*)*ppvObj);
971 return S_OK;
972}
static IEnumOLEVERB EnumOLEVERB
Definition: compobj.c:952

◆ Test_IUnknown_Release()

static ULONG WINAPI Test_IUnknown_Release ( IUnknown iface)
static

Definition at line 979 of file compobj.c.

980{
981 return 1; /* non-heap-based object */
982}

◆ test_ole_menu()

static void test_ole_menu ( void  )
static

Definition at line 778 of file compobj.c.

779{
780 HWND hwndFrame;
781 HRESULT hr;
782
784 hr = OleSetMenuDescriptor(NULL, hwndFrame, NULL, NULL, NULL);
785 todo_wine ok_ole_success(hr, "OleSetMenuDescriptor");
786
787 DestroyWindow(hwndFrame);
788}
HRESULT WINAPI OleSetMenuDescriptor(HOLEMENU hOleMenu, HWND hwndFrame, HWND hwndActiveObject, LPOLEINPLACEFRAME lpFrame, LPOLEINPLACEACTIVEOBJECT lpActiveObject)
Definition: ole2.c:1875
static ATOM register_dummy_class(void)
Definition: compobj.c:759
#define MAKEINTATOM(i)
Definition: winbase.h:1463
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4315
#define CW_USEDEFAULT
Definition: winuser.h:225

Referenced by START_TEST().

◆ test_OleInitialize_InitCounting()

static void test_OleInitialize_InitCounting ( void  )
static

Definition at line 2162 of file compobj.c.

2163{
2164 HRESULT hr;
2165 IUnknown *pUnk;
2166 REFCLSID rclsid = &CLSID_InternetZoneManager;
2167
2168 /* 1. OleInitialize fails but OleUninitialize is still called: apartment stays initialized */
2169 hr = pCoInitializeEx(NULL, COINIT_MULTITHREADED);
2170 ok(hr == S_OK, "CoInitializeEx(COINIT_MULTITHREADED) failed with error 0x%08x\n", hr);
2171
2173 ok(hr == RPC_E_CHANGED_MODE, "OleInitialize should have returned 0x%08x instead of 0x%08x\n", RPC_E_CHANGED_MODE, hr);
2175
2176 pUnk = (IUnknown *)0xdeadbeef;
2177 hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
2178 ok(hr == S_OK, "CoCreateInstance should have returned 0x%08x instead of 0x%08x\n", S_OK, hr);
2179 if (pUnk) IUnknown_Release(pUnk);
2180
2182
2183 /* 2. Extra multiple OleUninitialize: apartment stays initialized until CoUninitialize */
2184 hr = CoInitialize(NULL);
2185 ok(hr == S_OK, "CoInitialize() failed with error 0x%08x\n", hr);
2186
2188 ok(hr == S_OK, "OleInitialize should have returned 0x%08x instead of 0x%08x\n", S_OK, hr);
2192
2193 pUnk = (IUnknown *)0xdeadbeef;
2194 hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
2195 ok(hr == S_OK, "CoCreateInstance should have returned 0x%08x instead of 0x%08x\n", S_OK, hr);
2196 if (pUnk) IUnknown_Release(pUnk);
2197
2199
2200 pUnk = (IUnknown *)0xdeadbeef;
2201 hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
2202 ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned 0x%08x instead of 0x%08x\n", CO_E_NOTINITIALIZED, hr);
2203 if (pUnk) IUnknown_Release(pUnk);
2204
2205 /* 3. CoUninitialize does not formally deinit Ole */
2206 hr = CoInitialize(NULL);
2207 ok(hr == S_OK, "CoInitialize() failed with error 0x%08x\n", hr);
2208
2210 ok(hr == S_OK, "OleInitialize should have returned 0x%08x instead of 0x%08x\n", S_OK, hr);
2211
2214
2215 pUnk = (IUnknown *)0xdeadbeef;
2216 hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
2217 ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned 0x%08x instead of 0x%08x\n", CO_E_NOTINITIALIZED, hr);
2218 /* COM is not initialized anymore */
2219 if (pUnk) IUnknown_Release(pUnk);
2220
2222 ok(hr == S_FALSE, "OleInitialize should have returned 0x%08x instead of 0x%08x\n", S_FALSE, hr);
2223 /* ... but native OleInit returns S_FALSE as if Ole is considered initialized */
2224
2226
2227}
#define RPC_E_CHANGED_MODE
Definition: winerror.h:2482

Referenced by START_TEST().

◆ test_OleRegGetMiscStatus()

static void test_OleRegGetMiscStatus ( void  )
static

Definition at line 2229 of file compobj.c.

2230{
2232 HANDLE handle;
2233 DWORD status;
2234 HRESULT hr;
2235
2236 hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, NULL);
2237 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
2238
2239 status = 0xdeadbeef;
2240 hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, &status);
2241 ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08x\n", hr);
2242 ok(status == 0, "got 0x%08x\n", status);
2243
2244 status = -1;
2245 hr = OleRegGetMiscStatus(&CLSID_StdFont, DVASPECT_ICON, &status);
2246 ok(hr == S_OK, "got 0x%08x\n", hr);
2247 ok(status == 0, "got 0x%08x\n", status);
2248
2250 {
2251 status = 0;
2252 hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, &status);
2253 ok(hr == S_OK, "got 0x%08x\n", hr);
2254 ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08x\n", status);
2255
2256 /* context data takes precedence over registration info */
2257 status = 0;
2258 hr = OleRegGetMiscStatus(&CLSID_StdFont, DVASPECT_ICON, &status);
2259 ok(hr == S_OK, "got 0x%08x\n", hr);
2260 ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08x\n", status);
2261
2262 /* there's no such attribute in context */
2263 status = -1;
2264 hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_DOCPRINT, &status);
2265 ok(hr == S_OK, "got 0x%08x\n", hr);
2266 ok(status == 0, "got 0x%08x\n", status);
2267
2268 pDeactivateActCtx(0, cookie);
2269 pReleaseActCtx(handle);
2270 }
2271}
HRESULT WINAPI OleRegGetMiscStatus(REFCLSID clsid, DWORD dwAspect, DWORD *pdwStatus)
Definition: ole2.c:864
Definition: ps.c:97

Referenced by START_TEST().

◆ test_OleRegGetUserType()

static void test_OleRegGetUserType ( void  )
static

Definition at line 2273 of file compobj.c.

2274{
2275 static const WCHAR stdfont_usertypeW[] = {'S','t','a','n','d','a','r','d',' ','F','o','n','t',0};
2276 static const WCHAR stdfont2_usertypeW[] = {'C','L','S','I','D','_','S','t','d','F','o','n','t',0};
2277 static const WCHAR clsidkeyW[] = {'C','L','S','I','D',0};
2278 static const WCHAR defvalueW[] = {'D','e','f','a','u','l','t',' ','N','a','m','e',0};
2279 static const WCHAR auxvalue0W[] = {'A','u','x',' ','N','a','m','e',' ','0',0};
2280 static const WCHAR auxvalue2W[] = {'A','u','x',' ','N','a','m','e',' ','2',0};
2281 static const WCHAR auxvalue3W[] = {'A','u','x',' ','N','a','m','e',' ','3',0};
2282 static const WCHAR auxvalue4W[] = {'A','u','x',' ','N','a','m','e',' ','4',0};
2283
2284 static const char auxvalues[][16] = {
2285 "Aux Name 0",
2286 "Aux Name 1",
2287 "Aux Name 2",
2288 "Aux Name 3",
2289 "Aux Name 4"
2290 };
2291
2292 HKEY clsidhkey, hkey, auxhkey, classkey;
2293 DWORD form, ret, disposition;
2294 WCHAR clsidW[39];
2296 HANDLE handle;
2297 HRESULT hr;
2298 WCHAR *str;
2299 int i;
2300
2301 for (form = 0; form <= USERCLASSTYPE_APPNAME+1; form++) {
2302 hr = OleRegGetUserType(&CLSID_Testclass, form, NULL);
2303 ok(hr == E_INVALIDARG, "form %u: got 0x%08x\n", form, hr);
2304
2305 str = (void*)0xdeadbeef;
2306 hr = OleRegGetUserType(&CLSID_Testclass, form, &str);
2307 ok(hr == REGDB_E_CLASSNOTREG, "form %u: got 0x%08x\n", form, hr);
2308 ok(str == NULL, "form %u: got %p\n", form, str);
2309
2310 /* same string returned for StdFont for all form types */
2311 str = NULL;
2313 ok(hr == S_OK, "form %u: got 0x%08x\n", form, hr);
2314 ok(!lstrcmpW(str, stdfont_usertypeW) || !lstrcmpW(str, stdfont2_usertypeW) /* winxp */,
2315 "form %u, got %s\n", form, wine_dbgstr_w(str));
2317 }
2318
2320 {
2321 for (form = 0; form <= USERCLASSTYPE_APPNAME+1; form++) {
2322 str = (void*)0xdeadbeef;
2323 hr = OleRegGetUserType(&CLSID_Testclass, form, &str);
2324 ok(hr == REGDB_E_CLASSNOTREG, "form %u: got 0x%08x\n", form, hr);
2325 ok(str == NULL, "form %u: got %s\n", form, wine_dbgstr_w(str));
2326
2327 /* same string returned for StdFont for all form types */
2328 str = NULL;
2330 ok(hr == S_OK, "form %u: got 0x%08x\n", form, hr);
2331 ok(!lstrcmpW(str, stdfont_usertypeW) || !lstrcmpW(str, stdfont2_usertypeW) /* winxp */,
2332 "form %u, got %s\n", form, wine_dbgstr_w(str));
2334 }
2335
2336 pDeactivateActCtx(0, cookie);
2337 pReleaseActCtx(handle);
2338 }
2339
2340 /* test using registered CLSID */
2342
2343 ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsidkeyW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &clsidhkey, &disposition);
2344 if (!ret)
2345 {
2346 ret = RegCreateKeyExW(clsidhkey, clsidW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &classkey, NULL);
2347 if (ret)
2348 RegCloseKey(clsidhkey);
2349 }
2350
2351 if (ret == ERROR_ACCESS_DENIED)
2352 {
2353 win_skip("Failed to create test key, skipping some of OleRegGetUserType() tests.\n");
2354 return;
2355 }
2356
2357 ok(!ret, "failed to create a key, error %d\n", ret);
2358
2359 ret = RegSetValueExW(classkey, NULL, 0, REG_SZ, (const BYTE*)defvalueW, sizeof(defvalueW));
2360 ok(!ret, "got error %d\n", ret);
2361
2362 ret = RegCreateKeyExA(classkey, "AuxUserType", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &auxhkey, NULL);
2363 ok(!ret, "got error %d\n", ret);
2364
2365 /* populate AuxUserType */
2366 for (i = 0; i <= 4; i++) {
2367 char name[16];
2368
2369 sprintf(name, "AuxUserType\\%d", i);
2370 ret = RegCreateKeyExA(classkey, name, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL);
2371 ok(!ret, "got error %d\n", ret);
2372
2373 ret = RegSetValueExA(hkey, NULL, 0, REG_SZ, (const BYTE*)auxvalues[i], strlen(auxvalues[i]));
2374 ok(!ret, "got error %d\n", ret);
2375 RegCloseKey(hkey);
2376 }
2377
2378 str = NULL;
2380 ok(hr == S_OK, "got 0x%08x\n", hr);
2381 ok(!lstrcmpW(str, auxvalue0W), "got %s\n", wine_dbgstr_w(str));
2383
2384 str = NULL;
2385 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_FULL, &str);
2386 ok(hr == S_OK, "got 0x%08x\n", hr);
2387 ok(!lstrcmpW(str, defvalueW), "got %s\n", wine_dbgstr_w(str));
2389
2390 str = NULL;
2391 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_SHORT, &str);
2392 ok(hr == S_OK, "got 0x%08x\n", hr);
2393 ok(!lstrcmpW(str, auxvalue2W), "got %s\n", wine_dbgstr_w(str));
2395
2396 str = NULL;
2397 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_APPNAME, &str);
2398 ok(hr == S_OK, "got 0x%08x\n", hr);
2399 ok(!lstrcmpW(str, auxvalue3W), "got %s\n", wine_dbgstr_w(str));
2401
2402 str = NULL;
2403 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_APPNAME+1, &str);
2404 ok(hr == S_OK, "got 0x%08x\n", hr);
2405 ok(!lstrcmpW(str, auxvalue4W), "got %s\n", wine_dbgstr_w(str));
2407
2408 str = NULL;
2409 hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_APPNAME+2, &str);
2410 ok(hr == S_OK, "got 0x%08x\n", hr);
2411 ok(!lstrcmpW(str, defvalueW), "got %s\n", wine_dbgstr_w(str));
2413
2414 /* registry cleanup */
2415 for (i = 0; i <= 4; i++)
2416 {
2417 char name[2];
2418 sprintf(name, "%d", i);
2419 RegDeleteKeyA(auxhkey, name);
2420 }
2421 RegCloseKey(auxhkey);
2422 RegDeleteKeyA(classkey, "AuxUserType");
2423 RegCloseKey(classkey);
2424 RegDeleteKeyW(clsidhkey, clsidW);
2425 RegCloseKey(clsidhkey);
2426 if (disposition == REG_CREATED_NEW_KEY)
2428}
static const WCHAR clsidW[]
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1224
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype)
Definition: ole2.c:678
int form
Definition: main.c:89
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define wine_dbgstr_w
Definition: kernel32.h:34
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1084
const WCHAR * str
Definition: name.c:39

Referenced by START_TEST().

◆ test_ProgIDFromCLSID()

static void test_ProgIDFromCLSID ( void  )
static

Definition at line 322 of file compobj.c.

323{
324 ULONG_PTR cookie = 0;
327 HRESULT hr;
328
330 ok(hr == S_OK, "ProgIDFromCLSID failed with error 0x%08x\n", hr);
331 if (hr == S_OK)
332 {
333 ok(!lstrcmpiW(progid, stdfont), "Didn't get expected prog ID\n");
335 }
336
337 progid = (LPWSTR)0xdeadbeef;
339 ok(hr == REGDB_E_CLASSNOTREG, "ProgIDFromCLSID returned %08x\n", hr);
340 ok(progid == NULL, "ProgIDFromCLSID returns with progid %p\n", progid);
341
343 ok(hr == E_INVALIDARG, "ProgIDFromCLSID should return E_INVALIDARG instead of 0x%08x\n", hr);
344
346 {
347 static const WCHAR customfontW[] = {'C','u','s','t','o','m','F','o','n','t',0};
348
350 ok(hr == S_OK, "got 0x%08x\n", hr);
351 ok(!lstrcmpiW(progid, progidW), "got %s\n", wine_dbgstr_w(progid));
353
354 /* try something registered and redirected */
355 progid = NULL;
357 ok(hr == S_OK, "got 0x%08x\n", hr);
358 ok(!lstrcmpiW(progid, customfontW), "got wrong progid %s\n", wine_dbgstr_w(progid));
360
361 /* classes without default progid, progid list is not used */
362 progid = (void *)0xdeadbeef;
364 ok(hr == REGDB_E_CLASSNOTREG && progid == NULL, "got 0x%08x, progid %p\n", hr, progid);
365
366 progid = (void *)0xdeadbeef;
368 ok(hr == REGDB_E_CLASSNOTREG && progid == NULL, "got 0x%08x, progid %p\n", hr, progid);
369
370 pDeactivateActCtx(0, cookie);
371 pReleaseActCtx(handle);
372 }
373}
HRESULT WINAPI DECLSPEC_HOTPATCH ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID)
Definition: compobj.c:2530
#define progid(str)
Definition: exdisp.idl:31
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
static const GUID IID_Testiface6
Definition: compobj.c:100
static const GUID IID_Testiface5
Definition: compobj.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by START_TEST().

◆ test_registered_object_thread_affinity()

static void test_registered_object_thread_affinity ( void  )
static

Definition at line 1636 of file compobj.c.

1637{
1638 HRESULT hr;
1639 DWORD cookie;
1640 HANDLE thread;
1641 DWORD tid;
1642 DWORD exitcode;
1643
1644 pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1645
1646 /* CLSCTX_INPROC_SERVER */
1647
1649 CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1650 ok_ole_success(hr, "CoRegisterClassObject");
1651
1652 thread = CreateThread(NULL, 0, get_class_object_thread, (LPVOID)CLSCTX_INPROC_SERVER, 0, &tid);
1653 ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
1654 ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1655 GetExitCodeThread(thread, &exitcode);
1656 hr = exitcode;
1657 ok(hr == REGDB_E_CLASSNOTREG, "CoGetClassObject on inproc object "
1658 "registered in different thread should return REGDB_E_CLASSNOTREG "
1659 "instead of 0x%08x\n", hr);
1660
1661 hr = get_class_object(CLSCTX_INPROC_SERVER);
1662 ok(hr == S_OK, "CoGetClassObject on inproc object registered in same "
1663 "thread should return S_OK instead of 0x%08x\n", hr);
1664
1666 ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
1667 ok ( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1668 GetExitCodeThread(thread, &exitcode);
1669 hr = exitcode;
1670 ok(hr == S_OK, "CoRegisterClassObject with same CLSID but in different thread should return S_OK instead of 0x%08x\n", hr);
1671
1673 ok_ole_success(hr, "CoRevokeClassObject");
1674
1675 /* CLSCTX_LOCAL_SERVER */
1676
1678 CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &cookie);
1679 ok_ole_success(hr, "CoRegisterClassObject");
1680
1681 thread = CreateThread(NULL, 0, get_class_object_proxy_thread, (LPVOID)CLSCTX_LOCAL_SERVER, 0, &tid);
1682 ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
1684 {
1685 MSG msg;
1686 while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
1687 {
1690 }
1691 }
1692 GetExitCodeThread(thread, &exitcode);
1693 hr = exitcode;
1694 ok(hr == S_OK, "CoGetClassObject on local server object "
1695 "registered in different thread should return S_OK "
1696 "instead of 0x%08x\n", hr);
1697
1698 hr = get_class_object(CLSCTX_LOCAL_SERVER);
1699 ok(hr == S_OK, "CoGetClassObject on local server object registered in same "
1700 "thread should return S_OK instead of 0x%08x\n", hr);
1701
1703 ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
1704 ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1705 GetExitCodeThread(thread, &exitcode);
1706 hr = exitcode;
1707 ok(hr == RPC_E_WRONG_THREAD || broken(hr == S_OK) /* win8 */, "CoRevokeClassObject called from different "
1708 "thread to where registered should return RPC_E_WRONG_THREAD instead of 0x%08x\n", hr);
1709
1711 ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
1712 ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1713 GetExitCodeThread(thread, &exitcode);
1714 hr = exitcode;
1715 ok(hr == S_OK, "CoRegisterClassObject with same CLSID but in different "
1716 "thread should return S_OK instead of 0x%08x\n", hr);
1717
1719 ok_ole_success(hr, "CoRevokeClassObject");
1720
1722}
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:541
static DWORD CALLBACK get_class_object_proxy_thread(LPVOID pv)
Definition: compobj.c:1582
static DWORD CALLBACK register_class_object_thread(LPVOID pv)
Definition: compobj.c:1607
static DWORD CALLBACK revoke_class_object_thread(LPVOID pv)
Definition: compobj.c:1622
static DWORD CALLBACK get_class_object_thread(LPVOID pv)
Definition: compobj.c:1568
#define RPC_E_WRONG_THREAD
Definition: winerror.h:2490
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define QS_ALLINPUT
Definition: winuser.h:903
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)

Referenced by START_TEST().

◆ test_StringFromGUID2()

static void test_StringFromGUID2 ( void  )
static

Definition at line 580 of file compobj.c.

581{
582 WCHAR str[50];
583 int len;
584
585 /* invalid pointer */
586 SetLastError(0xdeadbeef);
588 ok(len == 0, "len: %d (expected 0)\n", len);
589 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %x\n", GetLastError());
590
591 /* Test corner cases for buffer size */
593 ok(len == 39, "len: %d (expected 39)\n", len);
594 ok(!lstrcmpiW(str, wszCLSID_StdFont),"string wasn't equal for CLSID_StdFont\n");
595
596 memset(str,0,sizeof str);
598 ok(len == 39, "len: %d (expected 39)\n", len);
599 ok(!lstrcmpiW(str, wszCLSID_StdFont),"string wasn't equal for CLSID_StdFont\n");
600
602 ok(len == 0, "len: %d (expected 0)\n", len);
603
605 ok(len == 0, "len: %d (expected 0)\n", len);
606}
#define SetLastError(x)
Definition: compat.h:752
GLenum GLsizei len
Definition: glext.h:6722

Referenced by START_TEST().

◆ test_TreatAsClass()

static void test_TreatAsClass ( void  )
static

Definition at line 2051 of file compobj.c.

2052{
2053 HRESULT hr;
2054 CLSID out;
2055 static GUID deadbeef = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}};
2056 static const char deadbeefA[] = "{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}";
2057 IInternetProtocol *pIP = NULL;
2058 HKEY clsidkey, deadbeefkey;
2059 LONG lr;
2060
2061 if (!pCoGetTreatAsClass)
2062 {
2063 win_skip("CoGetTreatAsClass not present\n");
2064 return;
2065 }
2066
2067 hr = pCoGetTreatAsClass(&deadbeef,&out);
2068 ok (hr == S_FALSE, "expected S_FALSE got %x\n",hr);
2069 ok (IsEqualGUID(&out,&deadbeef), "expected to get same clsid back\n");
2070
2071 hr = pCoGetTreatAsClass(NULL, &out);
2072 ok(hr == E_INVALIDARG, "expected E_INVALIDARG got %08x\n", hr);
2073 ok(IsEqualGUID(&out, &deadbeef), "expected no change to the clsid\n");
2074
2075 hr = pCoGetTreatAsClass(&deadbeef, NULL);
2076 ok(hr == E_INVALIDARG, "expected E_INVALIDARG got %08x\n", hr);
2077
2078 lr = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ, &clsidkey);
2079 ok(!lr, "Couldn't open CLSID key, error %d\n", lr);
2080
2081 lr = RegCreateKeyExA(clsidkey, deadbeefA, 0, NULL, 0, KEY_WRITE, NULL, &deadbeefkey, NULL);
2082 if (lr) {
2083 win_skip("CoGetTreatAsClass() tests will be skipped (failed to create a test key, error %d)\n", lr);
2084 RegCloseKey(clsidkey);
2085 return;
2086 }
2087
2088 hr = pCoTreatAsClass(&deadbeef, &deadbeef);
2089 ok(hr == REGDB_E_WRITEREGDB, "CoTreatAsClass gave wrong error: %08x\n", hr);
2090
2091 hr = pCoTreatAsClass(&deadbeef, &CLSID_FileProtocol);
2092 if(hr == REGDB_E_WRITEREGDB){
2093 win_skip("Insufficient privileges to use CoTreatAsClass\n");
2094 goto exit;
2095 }
2096 ok(hr == S_OK, "CoTreatAsClass failed: %08x\n", hr);
2097
2098 hr = pCoGetTreatAsClass(&deadbeef, &out);
2099 ok(hr == S_OK, "CoGetTreatAsClass failed: %08x\n",hr);
2100 ok(IsEqualGUID(&out, &CLSID_FileProtocol), "expected to get substituted clsid\n");
2101
2103
2104 hr = CoCreateInstance(&deadbeef, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pIP);
2105 if(hr == REGDB_E_CLASSNOTREG)
2106 {
2107 win_skip("IE not installed so can't test CoCreateInstance\n");
2108 goto exit;
2109 }
2110
2111 ok(hr == S_OK, "CoCreateInstance failed: %08x\n", hr);
2112 if(pIP){
2113 IInternetProtocol_Release(pIP);
2114 pIP = NULL;
2115 }
2116
2117 hr = pCoTreatAsClass(&deadbeef, &CLSID_NULL);
2118 ok(hr == S_OK, "CoTreatAsClass failed: %08x\n", hr);
2119
2120 hr = pCoGetTreatAsClass(&deadbeef, &out);
2121 ok(hr == S_FALSE, "expected S_FALSE got %08x\n", hr);
2122 ok(IsEqualGUID(&out, &deadbeef), "expected to get same clsid back\n");
2123
2124 /* bizarrely, native's CoTreatAsClass takes some time to take effect in CoCreateInstance */
2125 Sleep(200);
2126
2127 hr = CoCreateInstance(&deadbeef, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pIP);
2128 ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance gave wrong error: %08x\n", hr);
2129
2130 if(pIP)
2131 IInternetProtocol_Release(pIP);
2132
2133exit:
2135 RegCloseKey(deadbeefkey);
2136 RegDeleteKeyA(clsidkey, deadbeefA);
2137 RegCloseKey(clsidkey);
2138}
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3298
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_WRITE
Definition: nt_native.h:1031
static FILE * out
Definition: regtests2xml.c:44
#define exit(n)
Definition: config.h:202
#define REGDB_E_WRITEREGDB
Definition: winerror.h:2693

Referenced by START_TEST().

◆ testinitialize_AddRef()

static ULONG WINAPI testinitialize_AddRef ( IInitializeSpy iface)
static

Definition at line 3305 of file compobj.c.

3306{
3307 return 2;
3308}

◆ testinitialize_PostInitialize()

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

Definition at line 3326 of file compobj.c.

3327{
3328 CHECK_EXPECT2(PostInitialize);
3329 ok(coinit == expected_coinit_flags, "Unexpected init flags %#x, expected %#x.\n", coinit, expected_coinit_flags);
3330 return hr;
3331}
#define CHECK_EXPECT2(func)
Definition: compobj.c:47

◆ testinitialize_PostUninitialize()

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

Definition at line 3353 of file compobj.c.

3354{
3355 CHECK_EXPECT2(PostUninitialize);
3356 return E_NOTIMPL;
3357}

◆ testinitialize_PreInitialize()

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

Definition at line 3319 of file compobj.c.

3320{
3321 CHECK_EXPECT2(PreInitialize);
3322 ok(coinit == expected_coinit_flags, "Unexpected init flags %#x, expected %#x.\n", coinit, expected_coinit_flags);
3323 return S_OK;
3324}

◆ testinitialize_PreUninitialize()

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

Definition at line 3333 of file compobj.c.

3334{
3335 HRESULT hr;
3336 CHECK_EXPECT2(PreUninitialize);
3338 {
3340 ok(hr == S_OK, "got 0x%08x\n", hr);
3341
3343 ok(hr == S_OK, "got 0x%08x\n", hr);
3344
3346 ok(hr == S_OK, "got 0x%08x\n", hr);
3347
3349 }
3350 return S_OK;
3351}

◆ testinitialize_QI()

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

Definition at line 3292 of file compobj.c.

3293{
3294 if (IsEqualIID(riid, &IID_IInitializeSpy) || IsEqualIID(riid, &IID_IUnknown))
3295 {
3296 *obj = iface;
3297 IInitializeSpy_AddRef(iface);
3298 return S_OK;
3299 }
3300
3301 *obj = NULL;
3302 return E_NOINTERFACE;
3303}

◆ testinitialize_Release()

static ULONG WINAPI testinitialize_Release ( IInitializeSpy iface)
static

Definition at line 3310 of file compobj.c.

3311{
3312 return 1;
3313}

◆ testinstance_AddRef()

static ULONG WINAPI testinstance_AddRef ( IPersistFile iface)
static

Definition at line 3527 of file compobj.c.

3528{
3529 return 2;
3530}

◆ testinstance_GetClassID()

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

Definition at line 3537 of file compobj.c.

3538{
3539 ok(0, "unexpected call\n");
3540 return E_NOTIMPL;
3541}

◆ testinstance_GetCurFile()

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

Definition at line 3565 of file compobj.c.

3566{
3567 ok(0, "unexpected call\n");
3568 return E_NOTIMPL;
3569}

◆ testinstance_IsDirty()

static HRESULT WINAPI testinstance_IsDirty ( IPersistFile iface)
static

Definition at line 3543 of file compobj.c.

3544{
3545 ok(0, "unexpected call\n");
3546 return E_NOTIMPL;
3547}

◆ testinstance_Load()

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

Definition at line 3549 of file compobj.c.

3550{
3552}

◆ testinstance_QI()

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

Definition at line 3504 of file compobj.c.

3505{
3506 if (IsEqualIID(riid, &IID_IUnknown)) {
3507 *obj = iface;
3508 IUnknown_AddRef(iface);
3509 return S_OK;
3510 }
3511
3514 *obj = iface;
3515 IUnknown_AddRef(iface);
3516 }
3517 else
3518 *obj = NULL;
3519 return g_persistfile_qi_ret;
3520 }
3521
3522 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid));
3523 *obj = NULL;
3524 return E_NOINTERFACE;
3525}
const GUID IID_IPersistFile

◆ testinstance_Release()

static ULONG WINAPI testinstance_Release ( IPersistFile iface)
static

Definition at line 3532 of file compobj.c.

3533{
3534 return 1;
3535}

◆ testinstance_Save()

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

Definition at line 3554 of file compobj.c.

3555{
3556 return E_NOTIMPL;
3557}

◆ testinstance_SaveCompleted()

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

Definition at line 3559 of file compobj.c.

3560{
3561 ok(0, "unexpected call\n");
3562 return E_NOTIMPL;
3563}

◆ testspy_AddRef()

static ULONG WINAPI testspy_AddRef ( IMallocSpy iface)
static

Definition at line 3142 of file compobj.c.

3143{
3144 return 2;
3145}

◆ testspy_PostAlloc()

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

Definition at line 3158 of file compobj.c.

3159{
3160 ok(0, "unexpected call\n");
3161 return NULL;
3162}

◆ testspy_PostDidAlloc()

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

Definition at line 3205 of file compobj.c.

3206{
3207 ok(0, "unexpected call\n");
3208 return 0;
3209}

◆ testspy_PostFree()

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

Definition at line 3170 of file compobj.c.

3171{
3172 ok(0, "unexpected call\n");
3173}

◆ testspy_PostGetSize()

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

Definition at line 3193 of file compobj.c.

3194{
3195 ok(0, "unexpected call\n");
3196 return 0;
3197}

◆ testspy_PostHeapMinimize()

static void WINAPI testspy_PostHeapMinimize ( IMallocSpy iface)
static

Definition at line 3216 of file compobj.c.

3217{
3218 ok(0, "unexpected call\n");
3219}

◆ testspy_PostRealloc()

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

Definition at line 3181 of file compobj.c.

3182{
3183 ok(0, "unexpected call\n");
3184 return NULL;
3185}

◆ testspy_PreAlloc()

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

Definition at line 3152 of file compobj.c.

3153{
3154 ok(0, "unexpected call\n");
3155 return 0;
3156}

◆ testspy_PreDidAlloc()

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

Definition at line 3199 of file compobj.c.

3200{
3201 ok(0, "unexpected call\n");
3202 return NULL;
3203}

◆ testspy_PreFree()

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

Definition at line 3164 of file compobj.c.

3165{
3166 ok(0, "unexpected call\n");
3167 return NULL;
3168}

◆ testspy_PreGetSize()

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

Definition at line 3187 of file compobj.c.

3188{
3189 ok(0, "unexpected call\n");
3190 return NULL;
3191}

◆ testspy_PreHeapMinimize()

static void WINAPI testspy_PreHeapMinimize ( IMallocSpy iface)
static

Definition at line 3211 of file compobj.c.

3212{
3213 ok(0, "unexpected call\n");
3214}

◆ testspy_PreRealloc()

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

Definition at line 3175 of file compobj.c.

3176{
3177 ok(0, "unexpected call\n");
3178 return 0;
3179}

◆ testspy_QI()

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

Definition at line 3130 of file compobj.c.

3131{
3132 if (IsEqualIID(riid, &IID_IMallocSpy) || IsEqualIID(riid, &IID_IUnknown))
3133 {
3134 *obj = iface;
3135 IMallocSpy_AddRef(iface);
3136 return S_OK;
3137 }
3138
3139 return E_NOINTERFACE;
3140}

◆ testspy_Release()

static ULONG WINAPI testspy_Release ( IMallocSpy iface)
static

Definition at line 3147 of file compobj.c.

3148{
3149 return 1;
3150}

◆ UnlockModule()

static void UnlockModule ( void  )
static

Definition at line 126 of file compobj.c.

127{
129}

Referenced by Test_IClassFactory_Release().

◆ void()

static void ( WINAPI pReleaseActCtx)
static

Variable Documentation

◆ actctx_manifest

◆ cf_brokenW

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

Definition at line 113 of file compobj.c.

Referenced by test_CLSIDFromString(), and test_IIDFromString().

◆ cLocks

◆ cls_name

const char cls_name[] = "cowait_test_class"
static

◆ CLSID_non_existent

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

◆ CLSID_StdFont

◆ CLSID_WineTestPSFactoryBuffer

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

Definition at line 1058 of file compobj.c.

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

◆ cowait_msgs

UINT cowait_msgs[100]
static

◆ cowait_msgs_first

UINT cowait_msgs_first
static

◆ cowait_msgs_last

UINT cowait_msgs_last
static

◆ create_instance_iid

IID create_instance_iid
static

Definition at line 162 of file compobj.c.

Referenced by test_CoCreateInstanceEx(), and Test_IClassFactory_CreateInstance().

◆ dwCoInit

◆ DWORD

Definition at line 80 of file compobj.c.

◆ EnumOLEVERB

Definition at line 952 of file compobj.c.

Referenced by Test_IUnknown_QueryInterface().

◆ EnumOLEVERBVtbl

const IEnumOLEVERBVtbl EnumOLEVERBVtbl
static
Initial value:
= {
}
static HRESULT WINAPI EnumOLEVERB_Next(IEnumOLEVERB *iface, ULONG celt, OLEVERB *rgelt, ULONG *fetched)
Definition: compobj.c:918
static HRESULT WINAPI EnumOLEVERB_QueryInterface(IEnumOLEVERB *iface, REFIID riid, void **ppv)
Definition: compobj.c:903
static ULONG WINAPI EnumOLEVERB_AddRef(IEnumOLEVERB *iface)
Definition: compobj.c:908
static ULONG WINAPI EnumOLEVERB_Release(IEnumOLEVERB *iface)
Definition: compobj.c:913
static HRESULT WINAPI EnumOLEVERB_Reset(IEnumOLEVERB *iface)
Definition: compobj.c:930
static HRESULT WINAPI EnumOLEVERB_Clone(IEnumOLEVERB *iface, IEnumOLEVERB **ppenum)
Definition: compobj.c:936
static HRESULT WINAPI EnumOLEVERB_Skip(IEnumOLEVERB *iface, ULONG celt)
Definition: compobj.c:924

Definition at line 942 of file compobj.c.

◆ expected_coinit_flags

DWORD expected_coinit_flags
static

◆ g_persistfile_load_ret

HRESULT g_persistfile_load_ret
static

Definition at line 3503 of file compobj.c.

Referenced by test_CoGetInstanceFromFile(), and testinstance_Load().

◆ g_persistfile_qi_ret

HRESULT g_persistfile_qi_ret
static

Definition at line 3502 of file compobj.c.

Referenced by test_CoGetInstanceFromFile(), and testinstance_QI().

◆ getinstance_cf

IClassFactory getinstance_cf = { &getinstance_cf_vtbl }
static

Definition at line 3634 of file compobj.c.

Referenced by test_CoGetInstanceFromFile().

◆ getinstance_cf_vtbl

const IClassFactoryVtbl getinstance_cf_vtbl
static
Initial value:
= {
}
static HRESULT WINAPI getinstance_cf_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
Definition: compobj.c:3607
static HRESULT WINAPI getinstance_cf_QI(IClassFactory *iface, REFIID riid, void **obj)
Definition: compobj.c:3585
static ULONG WINAPI getinstance_cf_Release(IClassFactory *iface)
Definition: compobj.c:3602
static HRESULT WINAPI getinstance_cf_LockServer(IClassFactory *iface, BOOL lock)
Definition: compobj.c:3620
static ULONG WINAPI getinstance_cf_AddRef(IClassFactory *iface)
Definition: compobj.c:3597

Definition at line 3626 of file compobj.c.

◆ IID_Testiface

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

Definition at line 95 of file compobj.c.

Referenced by test_CoGetPSClsid().

◆ IID_Testiface2

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

Definition at line 96 of file compobj.c.

Referenced by test_CoGetPSClsid().

◆ IID_Testiface3

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

Definition at line 97 of file compobj.c.

Referenced by test_CoGetPSClsid().

◆ IID_Testiface4

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

Definition at line 98 of file compobj.c.

Referenced by test_CoGetPSClsid().

◆ IID_Testiface5

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

Definition at line 99 of file compobj.c.

Referenced by test_ProgIDFromCLSID().

◆ IID_Testiface6

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

Definition at line 100 of file compobj.c.

Referenced by test_ProgIDFromCLSID().

◆ IID_TestPS

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

Definition at line 101 of file compobj.c.

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

◆ init_cookies

ULARGE_INTEGER init_cookies[3]
static

◆ LPBOOL

Definition at line 86 of file compobj.c.

◆ LPCSTR

Definition at line 80 of file compobj.c.

◆ manifest_path

WCHAR manifest_path[MAX_PATH]
static

Definition at line 193 of file compobj.c.

Referenced by create_manifest_file().

◆ MessageFilter

IMessageFilter MessageFilter = { &MessageFilter_Vtbl }
static

◆ MessageFilter_Vtbl

const IMessageFilterVtbl MessageFilter_Vtbl
static
Initial value:
=
{
}
static ULONG WINAPI MessageFilter_AddRef(IMessageFilter *iface)
Definition: compobj.c:806
static ULONG WINAPI MessageFilter_Release(IMessageFilter *iface)
Definition: compobj.c:811
static DWORD WINAPI MessageFilter_RetryRejectedCall(IMessageFilter *iface, HTASK threadIDCallee, DWORD dwTickCount, DWORD dwRejectType)
Definition: compobj.c:827
static DWORD WINAPI MessageFilter_HandleInComingCall(IMessageFilter *iface, DWORD dwCallType, HTASK threadIDCaller, DWORD dwTickCount, LPINTERFACEINFO lpInterfaceInfo)
Definition: compobj.c:816
static HRESULT WINAPI MessageFilter_QueryInterface(IMessageFilter *iface, REFIID riid, void **ppvObj)
Definition: compobj.c:791
static DWORD WINAPI MessageFilter_MessagePending(IMessageFilter *iface, HTASK threadIDCallee, DWORD dwTickCount, DWORD dwPendingType)
Definition: compobj.c:837

Definition at line 849 of file compobj.c.

◆ override

HKEY override

Definition at line 81 of file compobj.c.

◆ pClsidNew

static REFCLSID pClsidNew

Definition at line 76 of file compobj.c.

Referenced by OleDoAutoConvert(), and OleGetAutoConvert().

◆ ppOldObject

IUnknown** ppOldObject

Definition at line 75 of file compobj.c.

Referenced by CoSwitchCallContext().

◆ ppv

Definition at line 74 of file compobj.c.

◆ progidW

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

◆ ps_factory_buffer

IPSFactoryBuffer* ps_factory_buffer
static

Definition at line 993 of file compobj.c.

Referenced by PSFactoryBuffer_CreateStub(), and test_CoRegisterPSClsid().

◆ PSFactoryBuffer

Definition at line 1056 of file compobj.c.

◆ PSFactoryBufferVtbl

IPSFactoryBufferVtbl PSFactoryBufferVtbl
static
Initial value:
=
{
}
static ULONG WINAPI PSFactoryBuffer_AddRef(IPSFactoryBuffer *This)
Definition: compobj.c:1010
static HRESULT WINAPI PSFactoryBuffer_QueryInterface(IPSFactoryBuffer *This, REFIID riid, void **ppvObject)
Definition: compobj.c:995
static HRESULT WINAPI PSFactoryBuffer_CreateProxy(IPSFactoryBuffer *This, IUnknown *pUnkOuter, REFIID riid, IRpcProxyBuffer **ppProxy, void **ppv)
Definition: compobj.c:1022
static ULONG WINAPI PSFactoryBuffer_Release(IPSFactoryBuffer *This)
Definition: compobj.c:1016
static HRESULT WINAPI PSFactoryBuffer_CreateStub(IPSFactoryBuffer *This, REFIID riid, IUnknown *pUnkServer, IRpcStubBuffer **ppStub)
Definition: compobj.c:1032

Definition at line 1047 of file compobj.c.

◆ qualifier

◆ REGSAM

Definition at line 80 of file compobj.c.

◆ revoke_spies_on_uninit

BOOL revoke_spies_on_uninit
static

Definition at line 3317 of file compobj.c.

Referenced by test_IInitializeSpy(), and testinitialize_PreUninitialize().

◆ stdfont

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

Definition at line 105 of file compobj.c.

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

◆ Test_ClassFactory

◆ Test_Unknown

◆ TestCallContext_Vtbl

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

Definition at line 1915 of file compobj.c.

Referenced by test_CoGetCallContext().

◆ TestClassFactory_Vtbl

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

Definition at line 182 of file compobj.c.

◆ testinitialize

IInitializeSpy testinitialize = { &testinitializevtbl }
static

Definition at line 3370 of file compobj.c.

Referenced by test_IInitializeSpy().

◆ testinitializevtbl

const IInitializeSpyVtbl testinitializevtbl
static
Initial value:
=
{
}
static HRESULT WINAPI testinitialize_QI(IInitializeSpy *iface, REFIID riid, void **obj)
Definition: compobj.c:3292
static HRESULT WINAPI testinitialize_PreUninitialize(IInitializeSpy *iface, DWORD aptrefs)
Definition: compobj.c:3333
static HRESULT WINAPI testinitialize_PostInitialize(IInitializeSpy *iface, HRESULT hr, DWORD coinit, DWORD aptrefs)
Definition: compobj.c:3326
static ULONG WINAPI testinitialize_Release(IInitializeSpy *iface)
Definition: compobj.c:3310
static HRESULT WINAPI testinitialize_PreInitialize(IInitializeSpy *iface, DWORD coinit, DWORD aptrefs)
Definition: compobj.c:3319
static ULONG WINAPI testinitialize_AddRef(IInitializeSpy *iface)
Definition: compobj.c:3305
static HRESULT WINAPI testinitialize_PostUninitialize(IInitializeSpy *iface, DWORD aptrefs)
Definition: compobj.c:3353

Definition at line 3359 of file compobj.c.

◆ testpersistfile

IPersistFile testpersistfile = { &testpersistfilevtbl }
static

Definition at line 3583 of file compobj.c.

Referenced by getinstance_cf_CreateInstance().

◆ testpersistfilevtbl

const IPersistFileVtbl testpersistfilevtbl
static
Initial value:
= {
}
static HRESULT WINAPI testinstance_QI(IPersistFile *iface, REFIID riid, void **obj)
Definition: compobj.c:3504
static HRESULT WINAPI testinstance_Save(IPersistFile *iface, LPCOLESTR filename, BOOL remember)
Definition: compobj.c:3554
static ULONG WINAPI testinstance_Release(IPersistFile *iface)
Definition: compobj.c:3532
static HRESULT WINAPI testinstance_GetCurFile(IPersistFile *iface, LPOLESTR *filename)
Definition: compobj.c:3565
static HRESULT WINAPI testinstance_SaveCompleted(IPersistFile *iface, LPCOLESTR filename)
Definition: compobj.c:3559
static ULONG WINAPI testinstance_AddRef(IPersistFile *iface)
Definition: compobj.c:3527
static HRESULT WINAPI testinstance_Load(IPersistFile *iface, LPCOLESTR filename, DWORD mode)
Definition: compobj.c:3549
static HRESULT WINAPI testinstance_GetClassID(IPersistFile *iface, CLSID *clsid)
Definition: compobj.c:3537
static HRESULT WINAPI testinstance_IsDirty(IPersistFile *iface)
Definition: compobj.c:3543

Definition at line 3571 of file compobj.c.

◆ testspy

IMallocSpy testspy = { &testspyvtbl }
static

Definition at line 3240 of file compobj.c.

Referenced by test_IMallocSpy().

◆ testspyvtbl

const IMallocSpyVtbl testspyvtbl
static
Initial value:
=
{
}
static int WINAPI testspy_PostDidAlloc(IMallocSpy *iface, void *ptr, BOOL spyed, int actual)
Definition: compobj.c:3205
static void *WINAPI testspy_PreGetSize(IMallocSpy *iface, void *ptr, BOOL spyed)
Definition: compobj.c:3187
static ULONG WINAPI testspy_AddRef(IMallocSpy *iface)
Definition: compobj.c:3142
static void WINAPI testspy_PreHeapMinimize(IMallocSpy *iface)
Definition: compobj.c:3211
static SIZE_T WINAPI testspy_PostGetSize(IMallocSpy *iface, SIZE_T actual, BOOL spyed)
Definition: compobj.c:3193
static SIZE_T WINAPI testspy_PreAlloc(IMallocSpy *iface, SIZE_T cb)
Definition: compobj.c:3152
static void WINAPI testspy_PostFree(IMallocSpy *iface, BOOL spyed)
Definition: compobj.c:3170
static void WINAPI testspy_PostHeapMinimize(IMallocSpy *iface)
Definition: compobj.c:3216
static void *WINAPI testspy_PreDidAlloc(IMallocSpy *iface, void *ptr, BOOL spyed)
Definition: compobj.c:3199
static SIZE_T WINAPI testspy_PreRealloc(IMallocSpy *iface, void *ptr, SIZE_T cb, void **newptr, BOOL spyed)
Definition: compobj.c:3175
static void *WINAPI testspy_PreFree(IMallocSpy *iface, void *ptr, BOOL spyed)
Definition: compobj.c:3164
static HRESULT WINAPI testspy_QI(IMallocSpy *iface, REFIID riid, void **obj)
Definition: compobj.c:3130
static void *WINAPI testspy_PostAlloc(IMallocSpy *iface, void *ptr)
Definition: compobj.c:3158
static ULONG WINAPI testspy_Release(IMallocSpy *iface)
Definition: compobj.c:3147
static void *WINAPI testspy_PostRealloc(IMallocSpy *iface, void *ptr, BOOL spyed)
Definition: compobj.c:3181

Definition at line 3221 of file compobj.c.

◆ TestUnknown_Vtbl

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

Definition at line 984 of file compobj.c.

◆ ULONG_PTR

Definition at line 85 of file compobj.c.

◆ wszCLSID_StdFont

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

Definition at line 107 of file compobj.c.

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

◆ wszNonExistent

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

Definition at line 106 of file compobj.c.

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