ReactOS  r76032
compobj.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <winreg.h>
#include <initguid.h>
#include <ole2.h>
#include <urlmon.h>
#include <dde.h>
#include <ctxtcall.h>
#include <wine/test.h>
Include dependency graph for compobj.c:

Go to the source code of this file.

Classes

struct  info
 
struct  Test_CallContext
 

Macros

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

Functions

 DEFINE_EXPECT (CreateStub)
 
static HRESULT (WINAPI *pCoInitializeEx)(LPVOID lpReserved
 
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY
 
static BOOL (WINAPI *pActivateActCtx)(HANDLE
 
static ULONG_PTR *static HANDLE (WINAPI *pCreateActCtxW)(PCACTCTXW)
 
static void (WINAPI *pReleaseActCtx)(HANDLE)
 
 DEFINE_GUID (CLSID_InProcFreeMarshaler, 0x0000033a, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (CLSID_testclsid, 0xacd014c7, 0x9535, 0x4fac, 0x8b, 0x53, 0xa4, 0x8c, 0xa7, 0xf4, 0xd7, 0x26)
 
 DEFINE_GUID (CLSID_GlobalOptions, 0x0000034b, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)
 
 DEFINE_GUID (IID_IWineTest, 0x5201163f, 0x8164, 0x4fd0, 0xa1, 0xa2, 0x5d, 0x5a, 0x36, 0x54, 0xd3, 0xbd)
 
 DEFINE_GUID (CLSID_WineOOPTest, 0x5201163f, 0x8164, 0x4fd0, 0xa1, 0xa2, 0x5d, 0x5a, 0x36, 0x54, 0xd3, 0xbd)
 
static void LockModule (void)
 
static void UnlockModule (void)
 
static HRESULT WINAPI Test_IClassFactory_QueryInterface (LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
 
static ULONG WINAPI Test_IClassFactory_AddRef (LPCLASSFACTORY iface)
 
static ULONG WINAPI Test_IClassFactory_Release (LPCLASSFACTORY iface)
 
static HRESULT WINAPI Test_IClassFactory_CreateInstance (LPCLASSFACTORY iface, IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObj)
 
static HRESULT WINAPI Test_IClassFactory_LockServer (LPCLASSFACTORY iface, BOOL fLock)
 
static BOOL create_manifest_file (const char *filename, const char *manifest)
 
static HANDLE activate_context (const char *manifest, ULONG_PTR *cookie)
 
 DEFINE_GUID (CLSID_Testclass, 0x12345678, 0x1234, 0x1234, 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0)
 
static void test_ProgIDFromCLSID (void)
 
static void test_CLSIDFromProgID (void)
 
static void test_CLSIDFromString (void)
 
static void test_IIDFromString (void)
 
static void test_StringFromGUID2 (void)
 
static DWORD CALLBACK ole_initialize_thread (LPVOID pv)
 
static void _test_apt_type (APTTYPE expected_type, APTTYPEQUALIFIER expected_qualifier, BOOL todo_type, BOOL todo_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 post_message_thread (LPVOID arg)
 
static DWORD CALLBACK test_CoWaitForMultipleHandles_thread (LPVOID arg)
 
static void test_CoWaitForMultipleHandles (void)
 
static void test_CoGetMalloc (void)
 
static void test_CoGetApartmentType (void)
 
static HRESULT WINAPI testspy_QI (IMallocSpy *iface, REFIID riid, void **obj)
 
static ULONG WINAPI testspy_AddRef (IMallocSpy *iface)
 
static ULONG WINAPI testspy_Release (IMallocSpy *iface)
 
static SIZE_T WINAPI testspy_PreAlloc (IMallocSpy *iface, SIZE_T cb)
 
static void *WINAPI testspy_PostAlloc (IMallocSpy *iface, void *ptr)
 
static void *WINAPI testspy_PreFree (IMallocSpy *iface, void *ptr, BOOL spyed)
 
static void WINAPI testspy_PostFree (IMallocSpy *iface, BOOL spyed)
 
static SIZE_T WINAPI testspy_PreRealloc (IMallocSpy *iface, void *ptr, SIZE_T cb, void **newptr, BOOL spyed)
 
static void *WINAPI testspy_PostRealloc (IMallocSpy *iface, void *ptr, BOOL spyed)
 
static void *WINAPI testspy_PreGetSize (IMallocSpy *iface, void *ptr, BOOL spyed)
 
static SIZE_T WINAPI testspy_PostGetSize (IMallocSpy *iface, SIZE_T actual, BOOL spyed)
 
static void *WINAPI testspy_PreDidAlloc (IMallocSpy *iface, void *ptr, BOOL spyed)
 
static int WINAPI testspy_PostDidAlloc (IMallocSpy *iface, void *ptr, BOOL spyed, int actual)
 
static void WINAPI testspy_PreHeapMinimize (IMallocSpy *iface)
 
static void WINAPI testspy_PostHeapMinimize (IMallocSpy *iface)
 
static void test_IMallocSpy (void)
 
static void test_CoGetCurrentLogicalThreadId (void)
 
static HRESULT WINAPI testinitialize_QI (IInitializeSpy *iface, REFIID riid, void **obj)
 
static ULONG WINAPI testinitialize_AddRef (IInitializeSpy *iface)
 
static ULONG WINAPI testinitialize_Release (IInitializeSpy *iface)
 
static HRESULT WINAPI testinitialize_PreInitialize (IInitializeSpy *iface, DWORD coinit, DWORD aptrefs)
 
static HRESULT WINAPI testinitialize_PostInitialize (IInitializeSpy *iface, HRESULT hr, DWORD coinit, DWORD aptrefs)
 
static HRESULT WINAPI testinitialize_PreUninitialize (IInitializeSpy *iface, DWORD aptrefs)
 
static HRESULT WINAPI testinitialize_PostUninitialize (IInitializeSpy *iface, DWORD aptrefs)
 
static void test_IInitializeSpy (void)
 
static HRESULT WINAPI testinstance_QI (IPersistFile *iface, REFIID riid, void **obj)
 
static ULONG WINAPI testinstance_AddRef (IPersistFile *iface)
 
static ULONG WINAPI testinstance_Release (IPersistFile *iface)
 
static HRESULT WINAPI testinstance_GetClassID (IPersistFile *iface, CLSID *clsid)
 
static HRESULT WINAPI testinstance_IsDirty (IPersistFile *iface)
 
static HRESULT WINAPI testinstance_Load (IPersistFile *iface, LPCOLESTR filename, DWORD mode)
 
static HRESULT WINAPI testinstance_Save (IPersistFile *iface, LPCOLESTR filename, BOOL remember)
 
static HRESULT WINAPI testinstance_SaveCompleted (IPersistFile *iface, LPCOLESTR filename)
 
static HRESULT WINAPI testinstance_GetCurFile (IPersistFile *iface, LPOLESTR *filename)
 
static HRESULT WINAPI getinstance_cf_QI (IClassFactory *iface, REFIID riid, void **obj)
 
static ULONG WINAPI getinstance_cf_AddRef (IClassFactory *iface)
 
static ULONG WINAPI getinstance_cf_Release (IClassFactory *iface)
 
static HRESULT WINAPI getinstance_cf_CreateInstance (IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
 
static HRESULT WINAPI getinstance_cf_LockServer (IClassFactory *iface, BOOL lock)
 
static void test_CoGetInstanceFromFile (void)
 
static void test_GlobalOptions (void)
 
static void init_funcs (void)
 
 START_TEST (compobj)
 

Variables

const IID GUID_NULL
 
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 const IMallocSpyVtbl testspyvtbl
 
static IMallocSpy testspy = { &testspyvtbl }
 
static const IInitializeSpyVtbl testinitializevtbl
 
static IInitializeSpy testinitialize = { &testinitializevtbl }
 
static HRESULT g_persistfile_qi_ret
 
static HRESULT g_persistfile_load_ret
 
static const IPersistFileVtbl testpersistfilevtbl
 
static IPersistFile testpersistfile = { &testpersistfilevtbl }
 
static const IClassFactoryVtbl getinstance_cf_vtbl
 
static IClassFactory getinstance_cf = { &getinstance_cf_vtbl }
 

Macro Definition Documentation

#define _INC_WINDOWS

Definition at line 22 of file compobj.c.

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

Definition at line 67 of file compobj.c.

Referenced by test_CoRegisterPSClsid().

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

Definition at line 61 of file compobj.c.

Referenced by PSFactoryBuffer_CreateStub().

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

Definition at line 55 of file compobj.c.

#define COBJMACROS

Definition at line 25 of file compobj.c.

#define COM_NO_WINDOWS_H

Definition at line 23 of file compobj.c.

#define CONST_VTABLE

Definition at line 26 of file compobj.c.

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

Definition at line 49 of file compobj.c.

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

Definition at line 93 of file compobj.c.

Referenced by test_CoMarshalInterThreadInterfaceInStream().

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

Definition at line 94 of file compobj.c.

Referenced by test_CoMarshalInterThreadInterfaceInStream().

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

Definition at line 52 of file compobj.c.

Referenced by test_CoRegisterPSClsid().

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

Definition at line 35 of file compobj.c.

#define WIN32_NO_STATUS

Definition at line 21 of file compobj.c.

Function Documentation

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

Definition at line 633 of file compobj.c.

635 {
637  APTTYPE type = ~0u;
638  HRESULT hr;
639 
640  if (!pCoGetApartmentType)
641  return;
642 
643  hr = pCoGetApartmentType(&type, &qualifier);
644  ok_(__FILE__, line)(hr == S_OK || hr == CO_E_NOTINITIALIZED, "Unexpected return code: 0x%08x\n", hr);
645 todo_wine_if(todo_type)
646  ok_(__FILE__, line)(type == expected_type, "Wrong apartment type %d, expected %d\n", type, expected_type);
647 todo_wine_if(todo_qualifier)
648  ok_(__FILE__, line)(qualifier == expected_qualifier, "Wrong apartment qualifier %d, expected %d\n", qualifier,
649  expected_qualifier);
650 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble * u
Definition: glfuncs.h:88
#define CO_E_NOTINITIALIZED
GLuint n
Definition: s_context.h:57
enum _APTTYPEQUALIFIER APTTYPEQUALIFIER
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:82
Definition: parser.c:48
#define todo_wine_if(is_todo)
Definition: test.h:155
#define d
Definition: ke_i.h:81
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
BOOL expected
Definition: store.c:2140
#define ok_(x1, x2)
Definition: CString.cpp:56
static HANDLE activate_context ( const char manifest,
ULONG_PTR cookie 
)
static

Definition at line 222 of file compobj.c.

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

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

Definition at line 2622 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

2623 {
2624  /* nothing */
2625 }
static BOOL ( WINAPI pActivateActCtx)
static
static BOOL create_manifest_file ( const char filename,
const char manifest 
)
static

Definition at line 200 of file compobj.c.

Referenced by activate_context().

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

Definition at line 1011 of file compobj.c.

1012 {
1013  return 2;
1014 }
static HRESULT WINAPI EnumOLEVERB_Clone ( IEnumOLEVERB iface,
IEnumOLEVERB **  ppenum 
)
static

Definition at line 1039 of file compobj.c.

1040 {
1041  ok(0, "unexpected call\n");
1042  return E_NOTIMPL;
1043 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define ok(value,...)
Definition: CImage.cpp:33
static HRESULT WINAPI EnumOLEVERB_Next ( IEnumOLEVERB iface,
ULONG  celt,
OLEVERB *  rgelt,
ULONG fetched 
)
static

Definition at line 1021 of file compobj.c.

1022 {
1023  ok(0, "unexpected call\n");
1024  return E_NOTIMPL;
1025 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define ok(value,...)
Definition: CImage.cpp:33
static HRESULT WINAPI EnumOLEVERB_QueryInterface ( IEnumOLEVERB iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1006 of file compobj.c.

1007 {
1008  return IUnknown_QueryInterface(&Test_Unknown, riid, ppv);
1009 }
REFIID riid
Definition: precomp.h:44
static IUnknown Test_Unknown
Definition: compobj.c:1004
static ULONG WINAPI EnumOLEVERB_Release ( IEnumOLEVERB iface)
static

Definition at line 1016 of file compobj.c.

1017 {
1018  return 1;
1019 }
static HRESULT WINAPI EnumOLEVERB_Reset ( IEnumOLEVERB iface)
static

Definition at line 1033 of file compobj.c.

1034 {
1035  ok(0, "unexpected call\n");
1036  return E_NOTIMPL;
1037 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define ok(value,...)
Definition: CImage.cpp:33
static HRESULT WINAPI EnumOLEVERB_Skip ( IEnumOLEVERB iface,
ULONG  celt 
)
static

Definition at line 1027 of file compobj.c.

1028 {
1029  ok(0, "unexpected call\n");
1030  return E_NOTIMPL;
1031 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define ok(value,...)
Definition: CImage.cpp:33
static DWORD CALLBACK free_libraries_thread ( LPVOID  p)
static

Definition at line 1827 of file compobj.c.

Referenced by test_CoFreeUnusedLibraries().

1828 {
1830  return 0;
1831 }
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void)
Definition: compobj.c:3564
static HRESULT get_class_object ( CLSCTX  clsctx)
static

Definition at line 1657 of file compobj.c.

Referenced by get_class_object_thread(), and test_registered_object_thread_affinity().

1658 {
1659  HRESULT hr;
1660  IClassFactory *pcf;
1661 
1663  (void **)&pcf);
1664 
1665  if (SUCCEEDED(hr))
1666  IClassFactory_Release(pcf);
1667 
1668  return hr;
1669 }
const GUID IID_IClassFactory
smooth NULL
Definition: ftsmooth.c:557
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:2958
const CHARFORMATW * pcf
Definition: msvc.h:84
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:79
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static DWORD CALLBACK get_class_object_proxy_thread ( LPVOID  pv)
static

Definition at line 1685 of file compobj.c.

Referenced by test_registered_object_thread_affinity().

1686 {
1687  CLSCTX clsctx = (CLSCTX)(DWORD_PTR)pv;
1688  HRESULT hr;
1689  IClassFactory *pcf;
1690  IMultiQI *pMQI;
1691 
1692  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1693 
1695  (void **)&pcf);
1696 
1697  if (SUCCEEDED(hr))
1698  {
1699  hr = IClassFactory_QueryInterface(pcf, &IID_IMultiQI, (void **)&pMQI);
1700  if (SUCCEEDED(hr))
1701  IMultiQI_Release(pMQI);
1702  IClassFactory_Release(pcf);
1703  }
1704 
1705  CoUninitialize();
1706 
1707  return hr;
1708 }
const GUID IID_IClassFactory
smooth NULL
Definition: ftsmooth.c:557
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:2958
const CHARFORMATW * pcf
Definition: msvc.h:84
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:79
DWORD void * pv
Definition: msvc.h:87
uint32_t DWORD_PTR
Definition: typedefs.h:63
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static DWORD CALLBACK get_class_object_thread ( LPVOID  pv)
static

Definition at line 1671 of file compobj.c.

Referenced by test_registered_object_thread_affinity().

1672 {
1673  CLSCTX clsctx = (CLSCTX)(DWORD_PTR)pv;
1674  HRESULT hr;
1675 
1676  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1677 
1678  hr = get_class_object(clsctx);
1679 
1680  CoUninitialize();
1681 
1682  return hr;
1683 }
smooth NULL
Definition: ftsmooth.c:557
LONG HRESULT
Definition: typedefs.h:77
DWORD void * pv
Definition: msvc.h:87
uint32_t DWORD_PTR
Definition: typedefs.h:63
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
static HRESULT get_class_object(CLSCTX clsctx)
Definition: compobj.c:1657
static ULONG WINAPI getinstance_cf_AddRef ( IClassFactory iface)
static

Definition at line 3490 of file compobj.c.

3491 {
3492  return 2;
3493 }
static HRESULT WINAPI getinstance_cf_CreateInstance ( IClassFactory iface,
IUnknown outer,
REFIID  riid,
void **  obj 
)
static

Definition at line 3500 of file compobj.c.

3502 {
3503  if (IsEqualIID(riid, &IID_IUnknown)) {
3504  *obj = &testpersistfile;
3505  return S_OK;
3506  }
3507 
3508  ok(0, "unexpected call, riid %s\n", wine_dbgstr_guid(riid));
3509  *obj = NULL;
3510  return E_NOTIMPL;
3511 }
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
const char * wine_dbgstr_guid(const GUID *guid)
smooth NULL
Definition: ftsmooth.c:557
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
static IPersistFile testpersistfile
Definition: compobj.c:3476
#define ok(value,...)
Definition: CImage.cpp:33
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
static HRESULT WINAPI getinstance_cf_LockServer ( IClassFactory iface,
BOOL  lock 
)
static

Definition at line 3513 of file compobj.c.

3514 {
3515  ok(0, "unexpected call\n");
3516  return E_NOTIMPL;
3517 }
#define E_NOTIMPL
Definition: ddrawi.h:99
#define ok(value,...)
Definition: CImage.cpp:33
static HRESULT WINAPI getinstance_cf_QI ( IClassFactory iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 3478 of file compobj.c.

3479 {
3481  *obj = iface;
3482  IClassFactory_AddRef(iface);
3483  return S_OK;
3484  }
3485 
3486  *obj = NULL;
3487  return E_NOINTERFACE;
3488 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
const GUID IID_IClassFactory
smooth NULL
Definition: ftsmooth.c:557
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
static ULONG WINAPI getinstance_cf_Release ( IClassFactory iface)
static

Definition at line 3495 of file compobj.c.

3496 {
3497  return 1;
3498 }
static ULONG_PTR* static HANDLE ( WINAPI pCreateActCtxW)
static
static HRESULT ( WINAPI pCoInitializeEx)
static
static Test_CallContext* impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 2020 of file compobj.c.

Referenced by Test_CallContext_AddRef(), and Test_CallContext_Release().

2021 {
2022  return CONTAINING_RECORD(iface, Test_CallContext, IUnknown_iface);
2023 }
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:259
static void init_funcs ( void  )
static

Definition at line 3670 of file compobj.c.

Referenced by START_TEST().

3671 {
3672  HMODULE hOle32 = GetModuleHandleA("ole32");
3673  HMODULE hAdvapi32 = GetModuleHandleA("advapi32");
3674  HMODULE hkernel32 = GetModuleHandleA("kernel32");
3675 
3676  pCoGetObjectContext = (void*)GetProcAddress(hOle32, "CoGetObjectContext");
3677  pCoSwitchCallContext = (void*)GetProcAddress(hOle32, "CoSwitchCallContext");
3678  pCoGetTreatAsClass = (void*)GetProcAddress(hOle32,"CoGetTreatAsClass");
3679  pCoTreatAsClass = (void*)GetProcAddress(hOle32,"CoTreatAsClass");
3680  pCoGetContextToken = (void*)GetProcAddress(hOle32, "CoGetContextToken");
3681  pCoGetApartmentType = (void*)GetProcAddress(hOle32, "CoGetApartmentType");
3682  pRegDeleteKeyExA = (void*)GetProcAddress(hAdvapi32, "RegDeleteKeyExA");
3683  pRegOverridePredefKey = (void*)GetProcAddress(hAdvapi32, "RegOverridePredefKey");
3684  pCoInitializeEx = (void*)GetProcAddress(hOle32, "CoInitializeEx");
3685 
3686  pActivateActCtx = (void*)GetProcAddress(hkernel32, "ActivateActCtx");
3687  pCreateActCtxW = (void*)GetProcAddress(hkernel32, "CreateActCtxW");
3688  pDeactivateActCtx = (void*)GetProcAddress(hkernel32, "DeactivateActCtx");
3689  pIsWow64Process = (void*)GetProcAddress(hkernel32, "IsWow64Process");
3690  pReleaseActCtx = (void*)GetProcAddress(hkernel32, "ReleaseActCtx");
3691 }
static HINSTANCE hkernel32
Definition: process.c:64
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:818
HANDLE HMODULE
Definition: typedefs.h:75
#define GetProcAddress(x, y)
Definition: compat.h:410
static BOOL is_module_loaded ( const char module)
inlinestatic

Definition at line 1833 of file compobj.c.

Referenced by test_CoFreeUnusedLibraries().

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

Definition at line 126 of file compobj.c.

Referenced by Test_IClassFactory_AddRef().

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

Definition at line 911 of file compobj.c.

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

Definition at line 921 of file compobj.c.

927 {
928  trace("HandleInComingCall\n");
929  return SERVERCALL_ISHANDLED;
930 }
#define trace(...)
Definition: kmt_test.h:172
static DWORD WINAPI MessageFilter_MessagePending ( IMessageFilter iface,
HTASK  threadIDCallee,
DWORD  dwTickCount,
DWORD  dwPendingType 
)
static

Definition at line 942 of file compobj.c.

947 {
948  trace("MessagePending\n");
949  return PENDINGMSG_WAITNOPROCESS;
950 }
#define trace(...)
Definition: kmt_test.h:172
static HRESULT WINAPI MessageFilter_QueryInterface ( IMessageFilter iface,
REFIID  riid,
void **  ppvObj 
)
static

Definition at line 896 of file compobj.c.

897 {
898  if (ppvObj == NULL) return E_POINTER;
899 
900  if (IsEqualGUID(riid, &IID_IUnknown) ||
902  {
903  *ppvObj = iface;
904  IMessageFilter_AddRef(iface);
905  return S_OK;
906  }
907 
908  return E_NOINTERFACE;
909 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
const GUID IID_IClassFactory
smooth NULL
Definition: ftsmooth.c:557
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:3970
#define E_POINTER
Definition: winerror.h:2365
static ULONG WINAPI MessageFilter_Release ( IMessageFilter iface)
static

Definition at line 916 of file compobj.c.

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

Definition at line 932 of file compobj.c.

937 {
938  trace("RetryRejectedCall\n");
939  return 0;
940 }
#define trace(...)
Definition: kmt_test.h:172
static DWORD CALLBACK ole_initialize_thread ( LPVOID  pv)
static

Definition at line 618 of file compobj.c.

Referenced by test_CoCreateInstance(), test_CoGetClassObject(), test_CoGetContextToken(), and test_CoGetObjectContext().

619 {
620  HRESULT hr;
621  struct info *info = pv;
622 
623  hr = pCoInitializeEx(NULL, COINIT_MULTITHREADED);
624 
625  SetEvent(info->wait);
626  WaitForSingleObject(info->stop, 10000);
627 
628  CoUninitialize();
629  return hr;
630 }
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
Definition: compobj.c:613
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:557
HANDLE wait
Definition: compobj.c:615
LONG HRESULT
Definition: typedefs.h:77
DWORD void * pv
Definition: msvc.h:87
HANDLE stop
Definition: compobj.c:615
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
static DWORD CALLBACK post_message_thread ( LPVOID  arg)
static

Definition at line 2643 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

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

Definition at line 1113 of file compobj.c.

1115 {
1116  return 2;
1117 }
static HRESULT WINAPI PSFactoryBuffer_CreateProxy ( IPSFactoryBuffer This,
IUnknown pUnkOuter,
REFIID  riid,
IRpcProxyBuffer **  ppProxy,
void **  ppv 
)
static

Definition at line 1125 of file compobj.c.

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

Definition at line 1135 of file compobj.c.

1140 {
1141  CHECK_EXPECT(CreateStub);
1142 
1143  ok(pUnkServer == (IUnknown*)&Test_Unknown, "unexpected pUnkServer %p\n", pUnkServer);
1144  if(!ps_factory_buffer)
1145  return E_NOTIMPL;
1146 
1147  return IPSFactoryBuffer_CreateStub(ps_factory_buffer, &IID_IEnumOLEVERB, pUnkServer, ppStub);
1148 }
const GUID IID_IEnumOLEVERB
static IUnknown Test_Unknown
Definition: compobj.c:1004
static IPSFactoryBuffer * ps_factory_buffer
Definition: compobj.c:1096
#define E_NOTIMPL
Definition: ddrawi.h:99
#define CHECK_EXPECT(func)
Definition: compobj.c:61
#define ok(value,...)
Definition: CImage.cpp:33
static HRESULT WINAPI PSFactoryBuffer_QueryInterface ( IPSFactoryBuffer This,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 1098 of file compobj.c.

1102 {
1103  if (IsEqualIID(riid, &IID_IUnknown) ||
1104  IsEqualIID(riid, &IID_IPSFactoryBuffer))
1105  {
1106  *ppvObject = This;
1107  IPSFactoryBuffer_AddRef(This);
1108  return S_OK;
1109  }
1110  return E_NOINTERFACE;
1111 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
static ULONG WINAPI PSFactoryBuffer_Release ( IPSFactoryBuffer This)
static

Definition at line 1119 of file compobj.c.

1121 {
1122  return 1;
1123 }
static DWORD CALLBACK register_class_object_thread ( LPVOID  pv)
static

Definition at line 1710 of file compobj.c.

Referenced by test_registered_object_thread_affinity().

1711 {
1712  HRESULT hr;
1713  DWORD cookie;
1714 
1715  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1716 
1718  CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1719 
1720  CoUninitialize();
1721 
1722  return hr;
1723 }
static IClassFactory Test_ClassFactory
Definition: compobj.c:196
DWORD DWORD
Definition: winlogon.h:75
smooth NULL
Definition: ftsmooth.c:557
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:79
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2760
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
static ATOM register_dummy_class ( void  )
static

Definition at line 864 of file compobj.c.

Referenced by test_ole_menu().

865 {
866  WNDCLASSA wc =
867  {
868  0,
870  0,
871  0,
873  NULL,
874  LoadCursorA(NULL, (LPSTR)IDC_ARROW),
875  (HBRUSH)(COLOR_BTNFACE+1),
876  NULL,
877  "WineOleTestClass",
878  };
879 
880  return RegisterClassA(&wc);
881 }
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:557
#define COLOR_BTNFACE
Definition: winuser.h:908
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:818
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2061
#define IDC_ARROW
Definition: winuser.h:682
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
static DWORD CALLBACK register_ps_clsid_thread ( void context)
static

Definition at line 1169 of file compobj.c.

Referenced by test_CoRegisterPSClsid().

1170 {
1171  HRESULT hr;
1172  CLSID clsid = {0};
1173 
1174  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1175 
1176  hr = CoGetPSClsid(&IID_IWineTest, &clsid);
1177  ok_ole_success(hr, "CoGetPSClsid");
1178  ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1180 
1181  /* test registering a PSClsid in an apartment which is then destroyed */
1182  hr = CoRegisterPSClsid(&IID_TestPS, &clsid);
1183  ok_ole_success(hr, "CoRegisterPSClsid");
1184 
1185  CoUninitialize();
1186 
1187  return hr;
1188 }
const char * wine_dbgstr_guid(const GUID *guid)
HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid)
Definition: compobj.c:2642
#define ok_ole_success(hr, func)
Definition: compobj.c:92
smooth NULL
Definition: ftsmooth.c:557
HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
Definition: compobj.c:2555
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:66
static const GUID IID_TestPS
Definition: compobj.c:104
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
static const IID IID_IWineTest
Definition: marshal.c:60
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:3970
#define ok(value,...)
Definition: CImage.cpp:33
static const CLSID CLSID_WineTestPSFactoryBuffer
Definition: compobj.c:1161
static DWORD CALLBACK release_semaphore_thread ( LPVOID  arg)
static

Definition at line 2627 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

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

Definition at line 1725 of file compobj.c.

Referenced by test_registered_object_thread_affinity().

1726 {
1727  DWORD cookie = (DWORD_PTR)pv;
1728  HRESULT hr;
1729 
1730  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1731 
1732  hr = CoRevokeClassObject(cookie);
1733 
1734  CoUninitialize();
1735 
1736  return hr;
1737 }
DWORD DWORD
Definition: winlogon.h:75
smooth NULL
Definition: ftsmooth.c:557
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1031
LONG HRESULT
Definition: typedefs.h:77
#define DWORD_PTR
Definition: generated.c:22
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
static DWORD CALLBACK send_message_thread ( LPVOID  arg)
static

Definition at line 2635 of file compobj.c.

Referenced by test_CoWaitForMultipleHandles().

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

Definition at line 3693 of file compobj.c.

3694 {
3695  init_funcs();
3696 
3697  if (!pCoInitializeEx)
3698  {
3699  trace("You need DCOM95 installed to run this test\n");
3700  return;
3701  }
3702 
3703  if (!pCreateActCtxW)
3704  win_skip("Activation contexts are not supported, some tests will be skipped.\n");
3705 
3712  test_ole_menu();
3734  test_CoGetMalloc();
3737  test_IMallocSpy();
3742 }
#define trace(...)
Definition: kmt_test.h:172
static void test_IInitializeSpy(void)
Definition: compobj.c:3323
static void test_CoInitializeEx(void)
Definition: compobj.c:2324
static void test_CoCreateInstanceEx(void)
Definition: compobj.c:840
static void test_CLSIDFromProgID(void)
Definition: compobj.c:380
static void test_CoCreateInstance(void)
Definition: compobj.c:652
static void test_CoUnmarshalInterface(void)
Definition: compobj.c:1436
static void test_CoRegisterPSClsid(void)
Definition: compobj.c:1190
static void test_CoWaitForMultipleHandles(void)
Definition: compobj.c:2688
static void test_ProgIDFromCLSID(void)
Definition: compobj.c:327
static void init_funcs(void)
Definition: compobj.c:3670
static void test_CoGetClassObject(void)
Definition: compobj.c:730
static void test_StringFromGUID2(void)
Definition: compobj.c:585
static void test_CoRegisterMessageFilter(void)
Definition: compobj.c:964
static void test_OleRegGetUserType(void)
Definition: compobj.c:2457
static void test_IMallocSpy(void)
Definition: compobj.c:3213
static void test_CoGetCurrentLogicalThreadId(void)
Definition: compobj.c:3249
static void test_CoGetPSClsid(void)
Definition: compobj.c:1293
static void test_ole_menu(void)
Definition: compobj.c:883
static void test_CoRegisterClassObject(void)
Definition: compobj.c:1548
static void test_CoCreateGuid(void)
Definition: compobj.c:2614
static void test_CoGetInstanceFromFile(void)
Definition: compobj.c:3529
static void test_CoGetMalloc(void)
Definition: compobj.c:3008
static void test_CoFreeUnusedLibraries(void)
Definition: compobj.c:1838
static void test_OleRegGetMiscStatus(void)
Definition: compobj.c:2413
static void test_CoGetApartmentType(void)
Definition: compobj.c:3048
static void test_CoGetObjectContext(void)
Definition: compobj.c:1881
static void test_CoGetContextToken(void)
Definition: compobj.c:2122
static void test_CoGetInterfaceAndReleaseStream(void)
Definition: compobj.c:1465
static void test_GlobalOptions(void)
Definition: compobj.c:3644
static void test_CLSIDFromString(void)
Definition: compobj.c:447
static void test_CoMarshalInterThreadInterfaceInStream(void)
Definition: compobj.c:1514
static void test_CoGetCallContext(void)
Definition: compobj.c:2065
static void test_IIDFromString(void)
Definition: compobj.c:523
static void test_TreatAsClass(void)
Definition: compobj.c:2235
static void test_OleInitialize_InitCounting(void)
Definition: compobj.c:2346
#define win_skip
Definition: test.h:141
static void test_registered_object_thread_affinity(void)
Definition: compobj.c:1739
static void test_CoMarshalInterface(void)
Definition: compobj.c:1479
static ULONG WINAPI Test_CallContext_AddRef ( IUnknown iface)
static

Definition at line 2043 of file compobj.c.

2044 {
2045  Test_CallContext *This = impl_from_IUnknown(iface);
2046  return InterlockedIncrement(&This->refs);
2047 }
static Test_CallContext * impl_from_IUnknown(IUnknown *iface)
Definition: compobj.c:2020
#define InterlockedIncrement
Definition: armddk.h:53
static HRESULT WINAPI Test_CallContext_QueryInterface ( IUnknown iface,
REFIID  riid,
LPVOID ppvObj 
)
static

Definition at line 2025 of file compobj.c.

2029 {
2030  if (ppvObj == NULL) return E_POINTER;
2031 
2032  if (IsEqualGUID(riid, &IID_IUnknown))
2033  {
2034  *ppvObj = iface;
2035  IUnknown_AddRef(iface);
2036  return S_OK;
2037  }
2038 
2039  *ppvObj = NULL;
2040  return E_NOINTERFACE;
2041 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:557
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:3970
#define E_POINTER
Definition: winerror.h:2365
static ULONG WINAPI Test_CallContext_Release ( IUnknown iface)
static

Definition at line 2049 of file compobj.c.

2050 {
2051  Test_CallContext *This = impl_from_IUnknown(iface);
2052  ULONG refs = InterlockedDecrement(&This->refs);
2053  if (!refs)
2054  HeapFree(GetProcessHeap(), 0, This);
2055  return refs;
2056 }
static Test_CallContext * impl_from_IUnknown(IUnknown *iface)
Definition: compobj.c:2020
#define GetProcessHeap()
Definition: compat.h:395
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394
static void test_CLSIDFromProgID ( void  )
static

Definition at line 380 of file compobj.c.

Referenced by START_TEST().

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

Definition at line 447 of file compobj.c.

Referenced by START_TEST().

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

Definition at line 2614 of file compobj.c.

Referenced by START_TEST().

2615 {
2616  HRESULT hr;
2617 
2618  hr = CoCreateGuid(NULL);
2619  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
2620 }
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2071
#define ok(value,...)
Definition: CImage.cpp:33
static void test_CoCreateInstance ( void  )
static

Definition at line 652 of file compobj.c.

Referenced by START_TEST().

653 {
654  HRESULT hr;
655  HANDLE thread;
656  DWORD tid, exitcode;
657  IUnknown *pUnk;
658  struct info info;
659  REFCLSID rclsid = &CLSID_InternetZoneManager;
660 
661  pUnk = (IUnknown *)0xdeadbeef;
662  hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
663  ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
664  ok(pUnk == NULL, "CoCreateInstance should have changed the passed in pointer to NULL, instead of %p\n", pUnk);
665 
667 
668  /* test errors returned for non-registered clsids */
669  hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
670  ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
671  hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&pUnk);
672  ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc handler should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
673  hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_LOCAL_SERVER, &IID_IUnknown, (void **)&pUnk);
674  ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered local server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
675  hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_REMOTE_SERVER, &IID_IUnknown, (void **)&pUnk);
676  ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered remote server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
677 
678  hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
679  if(hr == REGDB_E_CLASSNOTREG)
680  {
681  skip("IE not installed so can't test CoCreateInstance\n");
682  OleUninitialize();
683  return;
684  }
685 
686  ok_ole_success(hr, "CoCreateInstance");
687  if(pUnk) IUnknown_Release(pUnk);
688  OleUninitialize();
689 
690  hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
691  ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
692 
693  /* show that COM doesn't have to be initialized for multi-threaded apartments if another
694  thread has already done so */
695 
696  test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE, FALSE, FALSE);
697 
699  ok(info.wait != NULL, "CreateEvent failed with error %d\n", GetLastError());
700 
702  ok(info.stop != NULL, "CreateEvent failed with error %d\n", GetLastError());
703 
704  thread = CreateThread(NULL, 0, ole_initialize_thread, &info, 0, &tid);
705  ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
706 
707  ok( !WaitForSingleObject(info.wait, 10000 ), "wait timed out\n" );
708 
710 
711  pUnk = (IUnknown *)0xdeadbeef;
712  hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
713  ok(hr == S_OK, "CoCreateInstance should have returned S_OK instead of 0x%08x\n", hr);
714  if (pUnk) IUnknown_Release(pUnk);
715 
716  SetEvent(info.stop);
717  ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
718 
719  GetExitCodeThread(thread, &exitcode);
720  hr = exitcode;
721  ok(hr == S_OK, "thread should have returned S_OK instead of 0x%08x\n", hr);
722 
723  CloseHandle(thread);
726 
727  test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE, FALSE, FALSE);
728 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
const GUID IID_IUnknown
#define REFCLSID
Definition: guiddef.h:112
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
Definition: compobj.c:613
#define ok_ole_success(hr, func)
Definition: compobj.c:92
DWORD DWORD
Definition: winlogon.h:75
#define test_apt_type(t, q, t_t, t_q)
Definition: compobj.c:632
#define CO_E_NOTINITIALIZED
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:525
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define FALSE
Definition: types.h:117
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:135
smooth NULL
Definition: ftsmooth.c:557
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:583
HANDLE wait
Definition: compobj.c:615
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_non_existent
Definition: compobj.c:96
static HANDLE thread
Definition: service.c:25
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3185
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:145
HANDLE stop
Definition: compobj.c:615
#define S_OK
Definition: intsafe.h:59
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
#define skip(...)
Definition: CString.cpp:57
static DWORD CALLBACK ole_initialize_thread(LPVOID pv)
Definition: compobj.c:618
#define ok(value,...)
Definition: CImage.cpp:33
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:206
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
static TfClientId tid
static void test_CoCreateInstanceEx ( void  )
static

Definition at line 840 of file compobj.c.

Referenced by START_TEST().

841 {
842  MULTI_QI qi_res = { &IID_IMoniker };
843  DWORD cookie;
844  HRESULT hr;
845 
847 
849  CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie);
850  ok_ole_success(hr, "CoRegisterClassObject");
851 
853  hr = CoCreateInstanceEx(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER, NULL, 1, &qi_res);
854  ok(hr == E_NOINTERFACE, "CoCreateInstanceEx failed: %08x\n", hr);
855  ok(IsEqualGUID(&create_instance_iid, qi_res.pIID), "Unexpected CreateInstance iid %s\n",
857 
858  hr = CoRevokeClassObject(cookie);
859  ok_ole_success(hr, "CoRevokeClassObject");
860 
861  CoUninitialize();
862 }
static IClassFactory Test_ClassFactory
Definition: compobj.c:196
#define E_NOINTERFACE
Definition: winerror.h:2364
const char * wine_dbgstr_guid(const GUID *guid)
static IID create_instance_iid
Definition: compobj.c:167
#define ok_ole_success(hr, func)
Definition: compobj.c:92
DWORD DWORD
Definition: winlogon.h:75
smooth NULL
Definition: ftsmooth.c:557
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1031
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, COSERVERINFO *pServerInfo, ULONG cmq, MULTI_QI *pResults)
Definition: compobj.c:3247
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:79
#define IID_NULL
Definition: guiddef.h:93
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2760
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:3970
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1832
#define ok(value,...)
Definition: CImage.cpp:33
static void test_CoFreeUnusedLibraries ( void  )
static

Definition at line 1838 of file compobj.c.

Referenced by START_TEST().

1839 {
1840  HRESULT hr;
1841  IUnknown *pUnk;
1842  DWORD tid;
1843  HANDLE thread;
1844 
1845  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1846 
1847  ok(!is_module_loaded("urlmon.dll"), "urlmon.dll shouldn't be loaded\n");
1848 
1849  hr = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pUnk);
1850  if (hr == REGDB_E_CLASSNOTREG)
1851  {
1852  skip("IE not installed so can't run CoFreeUnusedLibraries test\n");
1853  CoUninitialize();
1854  return;
1855  }
1856  ok_ole_success(hr, "CoCreateInstance");
1857 
1858  ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1859 
1860  ok(pUnk != NULL ||
1861  broken(pUnk == NULL), /* win9x */
1862  "Expected a valid pointer\n");
1863  if (pUnk)
1864  IUnknown_Release(pUnk);
1865 
1866  ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1867 
1868  thread = CreateThread(NULL, 0, free_libraries_thread, NULL, 0, &tid);
1869  ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1870  CloseHandle(thread);
1871 
1872  ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
1873 
1875 
1876  ok(!is_module_loaded("urlmon.dll"), "urlmon.dll shouldn't be loaded\n");
1877 
1878  CoUninitialize();
1879 }
#define CloseHandle
Definition: compat.h:398
static BOOL is_module_loaded(const char *module)
Definition: compobj.c:1833
#define ok_ole_success(hr, func)
Definition: compobj.c:92
DWORD DWORD
Definition: winlogon.h:75
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void)
Definition: compobj.c:3564
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:135
smooth NULL
Definition: ftsmooth.c:557
LONG HRESULT
Definition: typedefs.h:77
static DWORD CALLBACK free_libraries_thread(LPVOID p)
Definition: compobj.c:1827
static HANDLE thread
Definition: service.c:25
#define broken(x)
Definition: _sntprintf.h:21
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3185
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
#define skip(...)
Definition: CString.cpp:57
#define ok(value,...)
Definition: CImage.cpp:33
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
static TfClientId tid
static void test_CoGetApartmentType ( void  )
static

Definition at line 3048 of file compobj.c.

Referenced by START_TEST().

3049 {
3051  APTTYPE type;
3052  HRESULT hr;
3053 
3054  if (!pCoGetApartmentType)
3055  {
3056  win_skip("CoGetApartmentType not present\n");
3057  return;
3058  }
3059 
3060  hr = pCoGetApartmentType(NULL, NULL);
3061  ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
3062 
3063  type = 0xdeadbeef;
3064  hr = pCoGetApartmentType(&type, NULL);
3065  ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
3066  ok(type == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", type);
3067 
3068  qualifier = 0xdeadbeef;
3069  hr = pCoGetApartmentType(NULL, &qualifier);
3070  ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
3071  ok(qualifier == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", qualifier);
3072 
3073  type = 0xdeadbeef;
3074  qualifier = 0xdeadbeef;
3075  hr = pCoGetApartmentType(&type, &qualifier);
3076  ok(hr == CO_E_NOTINITIALIZED, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
3077  ok(type == APTTYPE_CURRENT, "Expected APTTYPE_CURRENT, got %u\n", type);
3078  ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3079 
3080  type = 0xdeadbeef;
3081  qualifier = 0xdeadbeef;
3082  hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
3083  ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08x\n", hr);
3084  hr = pCoGetApartmentType(&type, &qualifier);
3085  ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08x\n", hr);
3086  ok(type == APTTYPE_MAINSTA, "Expected APTTYPE_MAINSTA, got %u\n", type);
3087  ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3088  CoUninitialize();
3089 
3090  type = 0xdeadbeef;
3091  qualifier = 0xdeadbeef;
3092  hr = pCoInitializeEx(NULL, COINIT_MULTITHREADED);
3093  ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08x\n", hr);
3094  hr = pCoGetApartmentType(&type, &qualifier);
3095  ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08x\n", hr);
3096  ok(type == APTTYPE_MTA, "Expected APTTYPE_MTA, got %u\n", type);
3097  ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
3098  CoUninitialize();
3099 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define CO_E_NOTINITIALIZED
enum _APTTYPEQUALIFIER APTTYPEQUALIFIER
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:82
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
#define ok(value,...)
Definition: CImage.cpp:33
#define win_skip
Definition: test.h:141
static void test_CoGetCallContext ( void  )
static

Definition at line 2065 of file compobj.c.

Referenced by START_TEST().

2066 {
2067  HRESULT hr;
2068  ULONG refs;
2069  IUnknown *pUnk;
2071 
2072  if (!pCoSwitchCallContext)
2073  {
2074  skip("CoSwitchCallContext not present\n");
2075  return;
2076  }
2077 
2078  CoInitialize(NULL);
2079 
2080  test_object = HeapAlloc(GetProcessHeap(), 0, sizeof(Test_CallContext));
2081  test_object->IUnknown_iface.lpVtbl = &TestCallContext_Vtbl;
2082  test_object->refs = 1;
2083 
2084  hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
2085  ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08x\n", hr);
2086 
2087  pUnk = (IUnknown*)0xdeadbeef;
2088  hr = pCoSwitchCallContext(&test_object->IUnknown_iface, &pUnk);
2089  ok_ole_success(hr, "CoSwitchCallContext");
2090  ok(pUnk == NULL, "expected NULL, got %p\n", pUnk);
2091  refs = IUnknown_AddRef(&test_object->IUnknown_iface);
2092  ok(refs == 2, "Expected refcount 2, got %d\n", refs);
2093  IUnknown_Release(&test_object->IUnknown_iface);
2094 
2095  pUnk = (IUnknown*)0xdeadbeef;
2096  hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
2097  ok_ole_success(hr, "CoGetCallContext");
2098  ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n",
2099  &test_object->IUnknown_iface, pUnk);
2100  refs = IUnknown_AddRef(&test_object->IUnknown_iface);
2101  ok(refs == 3, "Expected refcount 3, got %d\n", refs);
2102  IUnknown_Release(&test_object->IUnknown_iface);
2103  IUnknown_Release(pUnk);
2104 
2105  pUnk = (IUnknown*)0xdeadbeef;
2106  hr = pCoSwitchCallContext(NULL, &pUnk);
2107  ok_ole_success(hr, "CoSwitchCallContext");
2108  ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n",
2109  &test_object->IUnknown_iface, pUnk);
2110  refs = IUnknown_AddRef(&test_object->IUnknown_iface);
2111  ok(refs == 2, "Expected refcount 2, got %d\n", refs);
2112  IUnknown_Release(&test_object->IUnknown_iface);
2113 
2114  hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
2115  ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08x\n", hr);
2116 
2117  IUnknown_Release(&test_object->IUnknown_iface);
2118 
2119  CoUninitialize();
2120 }
const GUID IID_IUnknown
#define ok_ole_success(hr, func)
Definition: compobj.c:92
smooth NULL
Definition: ftsmooth.c:557
#define RPC_E_CALL_COMPLETE
Definition: winerror.h:2499
IUnknown IUnknown_iface
Definition: compobj.c:2016
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI CoGetCallContext(REFIID riid, void **ppv)
Definition: compobj.c:4237
static void test_object(void)
Definition: d3drm.c:1511
static const IUnknownVtbl TestCallContext_Vtbl
Definition: compobj.c:2058
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
#define skip(...)
Definition: CString.cpp:57
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1832
unsigned int ULONG
Definition: retypes.h:1
#define ok(value,...)
Definition: CImage.cpp:33
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
static void test_CoGetClassObject ( void  )
static

Definition at line 730 of file compobj.c.

Referenced by START_TEST().

731 {
732  HRESULT hr;
734  DWORD tid, exitcode;
735  ULONG_PTR cookie;
736  IUnknown *pUnk;
737  struct info info;
738  REFCLSID rclsid = &CLSID_InternetZoneManager;
739  HKEY hkey;
740  LONG res;
741 
742  hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
743  ok(hr == CO_E_NOTINITIALIZED, "CoGetClassObject should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
744  ok(pUnk == NULL, "CoGetClassObject should have changed the passed in pointer to NULL, instead of %p\n", pUnk);
745 
746  hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, NULL);
747  ok(hr == E_INVALIDARG ||
748  broken(hr == CO_E_NOTINITIALIZED), /* win9x */
749  "CoGetClassObject should have returned E_INVALIDARG instead of 0x%08x\n", hr);
750 
751  /* show that COM doesn't have to be initialized for multi-threaded apartments if another
752  thread has already done so */
753 
754  test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE, FALSE, FALSE);
755 
757  ok(info.wait != NULL, "CreateEvent failed with error %d\n", GetLastError());
758 
760  ok(info.stop != NULL, "CreateEvent failed with error %d\n", GetLastError());
761 
762  thread = CreateThread(NULL, 0, ole_initialize_thread, &info, 0, &tid);
763  ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
764 
765  ok( !WaitForSingleObject(info.wait, 10000), "wait timed out\n" );
766 
768 
769  pUnk = (IUnknown *)0xdeadbeef;
770  hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
771  if(hr == REGDB_E_CLASSNOTREG)
772  skip("IE not installed so can't test CoGetClassObject\n");
773  else
774  {
775  ok(hr == S_OK, "CoGetClassObject should have returned S_OK instead of 0x%08x\n", hr);
776  if (pUnk) IUnknown_Release(pUnk);
777  }
778 
779  SetEvent(info.stop);
780  ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
781 
782  GetExitCodeThread(thread, &exitcode);
783  hr = exitcode;
784  ok(hr == S_OK, "thread should have returned S_OK instead of 0x%08x\n", hr);
785 
786  CloseHandle(thread);
789 
790  test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE, FALSE, FALSE);
791 
792  if (!pRegOverridePredefKey)
793  {
794  win_skip("RegOverridePredefKey not available\n");
795  return;
796  }
797 
798  pCoInitializeEx(NULL, COINIT_MULTITHREADED);
799 
800  hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
801  if (hr == S_OK)
802  {
803  IUnknown_Release(pUnk);
804 
805  res = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0,
806  KEY_ALL_ACCESS, NULL, &hkey, NULL);
807  ok(!res, "RegCreateKeyEx returned %d\n", res);
808 
809  res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
810  ok(!res, "RegOverridePredefKey returned %d\n", res);
811 
812  hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
813  ok(hr == S_OK, "CoGetClassObject should have returned S_OK instead of 0x%08x\n", hr);
814 
815  res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
816  ok(!res, "RegOverridePredefKey returned %d\n", res);
817 
818  if (hr == S_OK) IUnknown_Release(pUnk);
819  RegCloseKey(hkey);
820  }
821 
822  hr = CoGetClassObject(&CLSID_InProcFreeMarshaler, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
823  ok(hr == S_OK, "got 0x%08x\n", hr);
824  IUnknown_Release(pUnk);
825 
826  /* context redefines FreeMarshaler CLSID */
827  if ((handle = activate_context(actctx_manifest, &cookie)))
828  {
829  hr = CoGetClassObject(&CLSID_InProcFreeMarshaler, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
830  ok(hr == S_OK, "got 0x%08x\n", hr);
831  IUnknown_Release(pUnk);
832 
833  pDeactivateActCtx(0, cookie);
834  pReleaseActCtx(handle);
835  }
836 
837  CoUninitialize();
838 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:79
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
const GUID IID_IUnknown
#define REFCLSID
Definition: guiddef.h:112
#define HKEY_CURRENT_USER
Definition: winreg.h:11
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
const CLSID CLSID_InProcFreeMarshaler
Definition: compobj.c:613
DWORD DWORD
Definition: winlogon.h:75
#define test_apt_type(t, q, t_t, t_q)
Definition: compobj.c:632
#define CO_E_NOTINITIALIZED
uint32_t ULONG_PTR
Definition: typedefs.h:63
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:525
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
#define E_INVALIDARG
Definition: ddrawi.h:101
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:135
smooth NULL
Definition: ftsmooth.c:557
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:583
HANDLE wait
Definition: compobj.c:615
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:2958
LONG HRESULT
Definition: typedefs.h:77
HANDLE HKEY
Definition: registry.h:24
static HANDLE thread
Definition: service.c:25
static const char actctx_manifest[]
Definition: compobj.c:268
#define broken(x)
Definition: _sntprintf.h:21
HANDLE stop
Definition: compobj.c:615
static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
Definition: compobj.c:222
#define S_OK
Definition: intsafe.h:59
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define skip(...)
Definition: CString.cpp:57
static DWORD CALLBACK ole_initialize_thread(LPVOID pv)
Definition: compobj.c:618
GLuint res
Definition: glext.h:9613
#define ok(value,...)
Definition: CImage.cpp:33
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1032
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
#define win_skip
Definition: test.h:141
static TfClientId tid
static void test_CoGetContextToken ( void  )
static

Definition at line 2122 of file compobj.c.

Referenced by START_TEST().

2123 {
2124  HRESULT hr;
2125  ULONG refs;
2126  ULONG_PTR token, token2;
2127  IObjContext *ctx;
2128  struct info info;
2129  HANDLE thread;
2130  DWORD tid, exitcode;
2131 
2132  if (!pCoGetContextToken)
2133  {
2134  win_skip("CoGetContextToken not present\n");
2135  return;
2136  }
2137 
2138  token = 0xdeadbeef;
2139  hr = pCoGetContextToken(&token);
2140  ok(hr == CO_E_NOTINITIALIZED, "Expected CO_E_NOTINITIALIZED, got 0x%08x\n", hr);
2141  ok(token == 0xdeadbeef, "Expected 0, got 0x%lx\n", token);
2142 
2143  /* show that COM doesn't have to be initialized for multi-threaded apartments if another
2144  thread has already done so */
2145 
2146  test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE, FALSE, FALSE);
2147 
2149  ok(info.wait != NULL, "CreateEvent failed with error %d\n", GetLastError());
2150 
2152  ok(info.stop != NULL, "CreateEvent failed with error %d\n", GetLastError());
2153 
2154  thread = CreateThread(NULL, 0, ole_initialize_thread, &info, 0, &tid);
2155  ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
2156 
2157  ok( !WaitForSingleObject(info.wait, 10000), "wait timed out\n" );
2158 
2160 
2161  token = 0;
2162  hr = pCoGetContextToken(&token);
2163  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2164 
2165  token2 = 0;
2166  hr = pCoGetContextToken(&token2);
2167  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2168  ok(token == token2, "got different token\n");
2169 
2170  SetEvent(info.stop);
2171  ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
2172 
2173  GetExitCodeThread(thread, &exitcode);
2174  hr = exitcode;
2175  ok(hr == S_OK, "thread should have returned S_OK instead of 0x%08x\n", hr);
2176 
2177  CloseHandle(thread);
2180 
2181  test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE, FALSE, FALSE);
2182 
2183  CoInitialize(NULL);
2184 
2186 
2187  hr = pCoGetContextToken(NULL);
2188  ok(hr == E_POINTER, "Expected E_POINTER, got 0x%08x\n", hr);
2189 
2190  token = 0;
2191  hr = pCoGetContextToken(&token);
2192  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2193  ok(token, "Expected token != 0\n");
2194 
2195  token2 = 0;
2196  hr = pCoGetContextToken(&token2);
2197  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2198  ok(token2 == token, "got different token\n");
2199 
2200  refs = IUnknown_AddRef((IUnknown *)token);
2201  ok(refs == 1, "Expected 1, got %u\n", refs);
2202 
2203  hr = pCoGetObjectContext(&IID_IObjContext, (void **)&ctx);
2204  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2205  ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
2206 
2207  refs = IObjContext_AddRef(ctx);
2208  ok(refs == 3, "Expected 3, got %u\n", refs);
2209 
2210  refs = IObjContext_Release(ctx);
2211  ok(refs == 2, "Expected 2, got %u\n", refs);
2212 
2213  refs = IUnknown_Release((IUnknown *)token);
2214  ok(refs == 1, "Expected 1, got %u\n", refs);
2215 
2216  /* CoGetContextToken does not add a reference */
2217  token = 0;
2218  hr = pCoGetContextToken(&token);
2219  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
2220  ok(token, "Expected token != 0\n");
2221  ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
2222 
2223  refs = IObjContext_AddRef(ctx);
2224  ok(refs == 2, "Expected 1, got %u\n", refs);
2225 
2226  refs = IObjContext_Release(ctx);
2227  ok(refs == 1, "Expected 0, got %u\n", refs);
2228 
2229  refs = IObjContext_Release(ctx);
2230  ok(refs == 0, "Expected 0, got %u\n", refs);
2231 
2232  CoUninitialize();
2233 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
Definition: compobj.c:613
DWORD DWORD
Definition: winlogon.h:75
#define test_apt_type(t, q, t_t, t_q)
Definition: compobj.c:632
#define CO_E_NOTINITIALIZED
uint32_t ULONG_PTR
Definition: typedefs.h:63
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:525
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define FALSE
Definition: types.h:117
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:135
smooth NULL
Definition: ftsmooth.c:557
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:583
HANDLE wait
Definition: compobj.c:615
int token
Definition: lex.c:57
LONG HRESULT
Definition: typedefs.h:77
static HANDLE thread
Definition: service.c:25
HANDLE stop
Definition: compobj.c:615
#define S_OK
Definition: intsafe.h:59
DWORD *typedef HANDLE
Definition: winlogon.h:52
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1832
static DWORD CALLBACK ole_initialize_thread(LPVOID pv)
Definition: compobj.c:618
unsigned int ULONG
Definition: retypes.h:1
#define ok(value,...)
Definition: CImage.cpp:33
#define E_POINTER
Definition: winerror.h:2365
#define win_skip
Definition: test.h:141
static TfClientId tid
static void test_CoGetCurrentLogicalThreadId ( void  )
static

Definition at line 3249 of file compobj.c.

Referenced by START_TEST().

3250 {
3251  HRESULT hr;
3252  GUID id;
3253 
3255  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3256 
3257  id = GUID_NULL;
3258  hr = CoGetCurrentLogicalThreadId(&id);
3259  ok(hr == S_OK, "got 0x%08x\n", hr);
3260  ok(!IsEqualGUID(&id, &GUID_NULL), "got null id\n");
3261 }
HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *id)
Definition: compobj.c:3870
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
LONG HRESULT
Definition: typedefs.h:77
const IID GUID_NULL
Definition: pin.cpp:13
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:3970
GLenum GLuint id
Definition: glext.h:5579
#define ok(value,...)
Definition: CImage.cpp:33
static void test_CoGetInstanceFromFile ( void  )
static

Definition at line 3529 of file compobj.c.

Referenced by START_TEST().

3530 {
3531  static const WCHAR filenameW[] = {'d','u','m','m','y','p','a','t','h',0};
3532  CLSID *clsid = (CLSID*)&CLSID_testclsid;
3533  MULTI_QI mqi[2];
3534  DWORD cookie;
3535  HRESULT hr;
3536 
3537  hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
3538  ok(hr == S_OK, "got 0x%08x\n", hr);
3539 
3540  /* CLSID is not specified, file does not exist */
3541  mqi[0].pIID = &IID_IUnknown;
3542  mqi[0].pItf = NULL;
3543  mqi[0].hr = E_NOTIMPL;
3544  hr = CoGetInstanceFromFile(NULL, NULL, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3545 todo_wine
3546  ok(hr == MK_E_CANTOPENFILE, "got 0x%08x\n", hr);
3547  ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3548  ok(mqi[0].hr == E_NOINTERFACE, "got 0x%08x\n", mqi[0].hr);
3549 
3550  /* class is not available */
3551  mqi[0].pIID = &IID_IUnknown;
3552  mqi[0].pItf = NULL;
3553  mqi[0].hr = E_NOTIMPL;
3554  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3555  ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08x\n", hr);
3556  ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3557  ok(mqi[0].hr == REGDB_E_CLASSNOTREG, "got 0x%08x\n", mqi[0].hr);
3558 
3559  hr = CoRegisterClassObject(clsid, (IUnknown*)&getinstance_cf, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE,
3560  &cookie);
3561  ok(hr == S_OK, "got 0x%08x\n", hr);
3562 
3563  mqi[0].pIID = &IID_IUnknown;
3564  mqi[0].pItf = (void*)0xdeadbeef;
3565  mqi[0].hr = S_OK;
3566  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3567 todo_wine {
3568  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3569  ok(mqi[0].pItf == (void*)0xdeadbeef, "got %p\n", mqi[0].pItf);
3570 }
3571  ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
3572 
3573  mqi[0].pIID = &IID_IUnknown;
3574  mqi[0].pItf = (void*)0xdeadbeef;
3575  mqi[0].hr = E_NOTIMPL;
3576  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3577 todo_wine {
3578  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3579  ok(mqi[0].pItf == (void*)0xdeadbeef, "got %p\n", mqi[0].pItf);
3580  ok(mqi[0].hr == E_NOTIMPL, "got 0x%08x\n", mqi[0].hr);
3581 }
3582  mqi[0].pIID = &IID_IUnknown;
3583  mqi[0].pItf = NULL;
3584  mqi[0].hr = E_NOTIMPL;
3585  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3586  ok(hr == S_OK, "got 0x%08x\n", hr);
3587  ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3588  ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
3589 
3590  mqi[0].pIID = &IID_IUnknown;
3591  mqi[0].pItf = NULL;
3592  mqi[0].hr = S_OK;
3593  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3594  ok(hr == S_OK, "got 0x%08x\n", hr);
3595  ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3596  ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
3597 
3598  mqi[0].pIID = &IID_IUnknown;
3599  mqi[0].pItf = NULL;
3600  mqi[0].hr = S_OK;
3602  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
3603  ok(hr == S_OK, "got 0x%08x\n", hr);
3604  ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
3605  ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
3607 
3608  mqi[0].pIID = &IID_IUnknown;
3609  mqi[0].pItf = NULL;
3610  mqi[0].hr = S_OK;
3611  mqi[1].pIID = &IID_IUnknown;
3612  mqi[1].pItf = NULL;
3613  mqi[1].hr = S_OK;
3614  g_persistfile_qi_ret = 0x8000efef;
3615  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 2, mqi);
3616  ok(hr == 0x8000efef, "got 0x%08x\n", hr);
3617  ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3618  ok(mqi[0].hr == 0x8000efef, "got 0x%08x\n", mqi[0].hr);
3619  ok(mqi[1].pItf == NULL, "got %p\n", mqi[1].pItf);
3620  ok(mqi[1].hr == 0x8000efef, "got 0x%08x\n", mqi[1].hr);
3622 
3623  mqi[0].pIID = &IID_IUnknown;
3624  mqi[0].pItf = NULL;
3625  mqi[0].hr = S_OK;
3626  mqi[1].pIID = &IID_IUnknown;
3627  mqi[1].pItf = NULL;
3628  mqi[1].hr = S_OK;
3629  g_persistfile_load_ret = 0x8000fefe;
3630  hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 2, mqi);
3631  ok(hr == 0x8000fefe, "got 0x%08x\n", hr);
3632  ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
3633  ok(mqi[0].hr == 0x8000fefe, "got 0x%08x\n", mqi[0].hr);
3634  ok(mqi[1].pItf == NULL, "got %p\n", mqi[1].pItf);
3635  ok(mqi[1].hr == 0x8000fefe, "got 0x%08x\n", mqi[1].hr);
3637 
3638  hr = CoRevokeClassObject(cookie);
3639  ok(hr == S_OK, "got 0x%08x\n", hr);
3640 
3641  CoUninitialize();
3642 }
WCHAR OLECHAR
Definition: compat.h:1926
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
__wchar_t WCHAR
Definition: xmlstorage.h:180
static IClassFactory getinstance_cf
Definition: compobj.c:3527
static HRESULT g_persistfile_load_ret
Definition: compobj.c:3396
DWORD DWORD
Definition: winlogon.h:75
static const WCHAR filenameW[]
Definition: amstream.c:48
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1031
#define STGM_READ
Definition: objbase.h:916
#define MK_E_CANTOPENFILE
Definition: winerror.h:2791
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:66
#define todo_wine
Definition: test.h:154
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2760
#define S_OK
Definition: intsafe.h:59
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
#define E_NOTIMPL
Definition: ddrawi.h:99
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetInstanceFromFile(COSERVERINFO *server_info, CLSID *rclsid, IUnknown *outer, DWORD cls_context, DWORD grfmode, OLECHAR *filename, DWORD count, MULTI_QI *results)
Definition: compobj.c:3331
#define ok(value,...)
Definition: CImage.cpp:33
static HRESULT g_persistfile_qi_ret
Definition: compobj.c:3395
static void test_CoGetInterfaceAndReleaseStream ( void  )
static

Definition at line 1465 of file compobj.c.

Referenced by START_TEST().

1466 {
1467  HRESULT hr;
1468  IUnknown *pUnk;
1469 
1470  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1471 
1472  hr = CoGetInterfaceAndReleaseStream(NULL, &IID_IUnknown, (void**)&pUnk);
1473  ok(hr == E_INVALIDARG, "hr %08x\n", hr);
1474 
1475  CoUninitialize();
1476 }
const GUID IID_IUnknown
HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1958
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
LONG HRESULT
Definition: typedefs.h:77
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
#define ok(value,...)
Definition: CImage.cpp:33
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
static void test_CoGetMalloc ( void  )
static

Definition at line 3008 of file compobj.c.

Referenced by START_TEST().

3009 {
3010  IMalloc *imalloc;
3011  HRESULT hr;
3012 
3013  if (0) /* crashes on native */
3014  hr = CoGetMalloc(0, NULL);
3015 
3016  imalloc = (void*)0xdeadbeef;
3017  hr = CoGetMalloc(0, &imalloc);
3018  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3019  ok(imalloc == NULL, "got %p\n", imalloc);
3020 
3021  imalloc = (void*)0xdeadbeef;
3022  hr = CoGetMalloc(MEMCTX_SHARED, &imalloc);
3023  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3024  ok(imalloc == NULL, "got %p\n", imalloc);
3025 
3026  imalloc = (void*)0xdeadbeef;
3027  hr = CoGetMalloc(MEMCTX_MACSYSTEM, &imalloc);
3028  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3029  ok(imalloc == NULL, "got %p\n", imalloc);
3030 
3031  imalloc = (void*)0xdeadbeef;
3032  hr = CoGetMalloc(MEMCTX_UNKNOWN, &imalloc);
3033  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3034  ok(imalloc == NULL, "got %p\n", imalloc);
3035 
3036  imalloc = (void*)0xdeadbeef;
3037  hr = CoGetMalloc(MEMCTX_SAME, &imalloc);
3038  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
3039  ok(imalloc == NULL, "got %p\n", imalloc);
3040 
3041  imalloc = NULL;
3042  hr = CoGetMalloc(MEMCTX_TASK, &imalloc);
3043  ok(hr == S_OK, "got 0x%08x\n", hr);
3044  ok(imalloc != NULL, "got %p\n", imalloc);
3045  IMalloc_Release(imalloc);
3046 }
HRESULT WINAPI CoGetMalloc(DWORD context, IMalloc **imalloc)
Definition: ifs.c:367
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: CImage.cpp:33
static void test_CoGetObjectContext ( void  )
static

Definition at line 1881 of file compobj.c.

Referenced by START_TEST().

1882 {
1883  HRESULT hr;
1884  ULONG refs;
1885  IComThreadingInfo *pComThreadingInfo, *threadinginfo2;
1886  IContextCallback *pContextCallback;
1887  IObjContext *pObjContext;
1888  APTTYPE apttype;
1889  THDTYPE thdtype;
1890  struct info info;
1891  HANDLE thread;
1892  DWORD tid, exitcode;
1893  GUID id, id2;
1894 
1895  if (!pCoGetObjectContext)
1896  {
1897  win_skip("CoGetObjectContext not present\n");
1898  return;
1899  }
1900 
1901  hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1902  ok(hr == CO_E_NOTINITIALIZED, "CoGetObjectContext should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
1903  ok(pComThreadingInfo == NULL, "pComThreadingInfo should have been set to NULL\n");
1904 
1905  /* show that COM doesn't have to be initialized for multi-threaded apartments if another
1906  thread has already done so */
1907 
1908  test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE, FALSE, FALSE);
1909 
1911  ok(info.wait != NULL, "CreateEvent failed with error %d\n", GetLastError());
1912 
1914  ok(info.stop != NULL, "CreateEvent failed with error %d\n", GetLastError());
1915 
1916  thread = CreateThread(NULL, 0, ole_initialize_thread, &info, 0, &tid);
1917  ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
1918 
1919  ok( !WaitForSingleObject(info.wait, 10000), "wait timed out\n" );
1920 
1922 
1923  pComThreadingInfo = NULL;
1924  hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1925  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
1926 
1927  threadinginfo2 = NULL;
1928  hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&threadinginfo2);
1929  ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
1930  ok(pComThreadingInfo == threadinginfo2, "got different instance\n");
1931  IComThreadingInfo_Release(threadinginfo2);
1932 
1933  hr = IComThreadingInfo_GetCurrentLogicalThreadId(pComThreadingInfo, NULL);
1934  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
1935 
1936  id = id2 = GUID_NULL;
1937  hr = IComThreadingInfo_GetCurrentLogicalThreadId(pComThreadingInfo, &id);
1938  ok(hr == S_OK, "got 0x%08x\n", hr);
1939 
1940  hr = CoGetCurrentLogicalThreadId(&id2);
1941  ok(IsEqualGUID(&id, &id2), "got %s, expected %s\n", wine_dbgstr_guid(&id), wine_dbgstr_guid(&id2));
1942 
1943  IComThreadingInfo_Release(pComThreadingInfo);
1944 
1945  SetEvent(info.stop);
1946  ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
1947 
1948  GetExitCodeThread(thread, &exitcode);
1949  hr = exitcode;
1950  ok(hr == S_OK, "thread should have returned S_OK instead of 0x%08x\n", hr);
1951 
1952  CloseHandle(thread);
1955 
1956  test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE, FALSE, FALSE);
1957 
1958  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1959 
1961 
1962  hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1963  ok_ole_success(hr, "CoGetObjectContext");
1964 
1965  hr = IComThreadingInfo_GetCurrentApartmentType(pComThreadingInfo, &apttype);
1966  ok_ole_success(hr, "IComThreadingInfo_GetCurrentApartmentType");
1967  ok(apttype == APTTYPE_MAINSTA, "apartment type should be APTTYPE_MAINSTA instead of %d\n", apttype);
1968 
1969  hr = IComThreadingInfo_GetCurrentThreadType(pComThreadingInfo, &thdtype);
1970  ok_ole_success(hr, "IComThreadingInfo_GetCurrentThreadType");
1971  ok(thdtype == THDTYPE_PROCESSMESSAGES, "thread type should be THDTYPE_PROCESSMESSAGES instead of %d\n", thdtype);
1972 
1973  refs = IComThreadingInfo_Release(pComThreadingInfo);
1974  ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %d refs\n", refs);
1975 
1976  hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
1977  ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
1978 
1979  refs = IContextCallback_Release(pContextCallback);
1980  ok(refs == 0, "pContextCallback should have 0 refs instead of %d refs\n", refs);
1981 
1982  CoUninitialize();
1983 
1984  pCoInitializeEx(NULL, COINIT_MULTITHREADED);
1985 
1986  hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
1987  ok_ole_success(hr, "CoGetObjectContext");
1988 
1989  hr = IComThreadingInfo_GetCurrentApartmentType(pComThreadingInfo, &apttype);
1990  ok_ole_success(hr, "IComThreadingInfo_GetCurrentApartmentType");
1991  ok(apttype == APTTYPE_MTA, "apartment type should be APTTYPE_MTA instead of %d\n", apttype);
1992 
1993  hr = IComThreadingInfo_GetCurrentThreadType(pComThreadingInfo, &thdtype);
1994  ok_ole_success(hr, "IComThreadingInfo_GetCurrentThreadType");
1995  ok(thdtype == THDTYPE_BLOCKMESSAGES, "thread type should be THDTYPE_BLOCKMESSAGES instead of %d\n", thdtype);
1996 
1997  refs = IComThreadingInfo_Release(pComThreadingInfo);
1998  ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %d refs\n", refs);
1999 
2000  hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
2001  ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
2002 
2003  refs = IContextCallback_Release(pContextCallback);
2004  ok(refs == 0, "pContextCallback should have 0 refs instead of %d refs\n", refs);
2005 
2006  hr = pCoGetObjectContext(&IID_IObjContext, (void **)&pObjContext);
2007  ok_ole_success(hr, "CoGetObjectContext");
2008 
2009  refs = IObjContext_Release(pObjContext);
2010  ok(refs == 0, "pObjContext should have 0 refs instead of %d refs\n", refs);
2011 
2012  CoUninitialize();
2013 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
const char * wine_dbgstr_guid(const GUID *guid)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
Definition: compobj.c:613
#define ok_ole_success(hr, func)
Definition: compobj.c:92
DWORD DWORD
Definition: winlogon.h:75
#define test_apt_type(t, q, t_t, t_q)
Definition: compobj.c:632
#define CO_E_NOTINITIALIZED
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:525
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define FALSE
Definition: types.h:117
HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *id)
Definition: compobj.c:3870
#define E_INVALIDARG
Definition: ddrawi.h:101
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:135
smooth NULL
Definition: ftsmooth.c:557
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:583
HANDLE wait
Definition: compobj.c:615
LONG HRESULT
Definition: typedefs.h:77
static HANDLE thread
Definition: service.c:25
enum _THDTYPE THDTYPE
HANDLE stop
Definition: compobj.c:615
const IID GUID_NULL
Definition: pin.cpp:13
#define S_OK
Definition: intsafe.h:59
DWORD *typedef HANDLE
Definition: winlogon.h:52
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:3970
static DWORD CALLBACK ole_initialize_thread(LPVOID pv)
Definition: compobj.c:618
unsigned int ULONG
Definition: retypes.h:1
GLenum GLuint id
Definition: glext.h:5579
#define ok(value,...)
Definition: CImage.cpp:33
#define win_skip
Definition: test.h:141
static TfClientId tid
static void test_CoGetPSClsid ( void  )
static

Definition at line 1293 of file compobj.c.

Referenced by START_TEST().

1294 {
1295  ULONG_PTR cookie;
1296  HANDLE handle;
1297  HRESULT hr;
1298  CLSID clsid;
1299  HKEY hkey;
1300  LONG res;
1301  const BOOL is_win64 = (sizeof(void*) != sizeof(int));
1302  BOOL is_wow64 = FALSE;
1303 
1304  hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
1305  ok(hr == CO_E_NOTINITIALIZED,
1306  "CoGetPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n",
1307  hr);
1308 
1309  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1310 
1311  hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
1312  ok_ole_success(hr, "CoGetPSClsid");
1313 
1314  hr = CoGetPSClsid(&IID_IWineTest, &clsid);
1315  ok(hr == REGDB_E_IIDNOTREG,
1316  "CoGetPSClsid for random IID returned 0x%08x instead of REGDB_E_IIDNOTREG\n",
1317  hr);
1318 
1320  ok(hr == E_INVALIDARG,
1321  "CoGetPSClsid for null clsid returned 0x%08x instead of E_INVALIDARG\n",
1322  hr);
1323 
1324  if (!pRegOverridePredefKey)
1325  {
1326  win_skip("RegOverridePredefKey not available\n");
1327  CoUninitialize();
1328  return;
1329  }
1330  hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
1331  ok_ole_success(hr, "CoGetPSClsid");
1332 
1333  res = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0,
1334  KEY_ALL_ACCESS, NULL, &hkey, NULL);
1335  ok(!res, "RegCreateKeyEx returned %d\n", res);
1336 
1337  res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
1338  ok(!res, "RegOverridePredefKey returned %d\n", res);
1339 
1340  hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
1341  ok_ole_success(hr, "CoGetPSClsid");
1342 
1343  res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
1344  ok(!res, "RegOverridePredefKey returned %d\n", res);
1345 
1346  RegCloseKey(hkey);
1347 
1348  /* not registered CLSID */
1349  hr = CoGetPSClsid(&IID_Testiface, &clsid);
1350  ok(hr == REGDB_E_IIDNOTREG, "got 0x%08x\n", hr);
1351 
1352  if ((handle = activate_context(actctx_manifest, &cookie)))
1353  {
1354  memset(&clsid, 0, sizeof(clsid));
1355  hr = CoGetPSClsid(&IID_Testiface, &clsid);
1356  ok(hr == S_OK, "got 0x%08x\n", hr);
1357  ok(IsEqualGUID(&clsid, &IID_Testiface), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1358 
1359  memset(&clsid, 0, sizeof(clsid));
1360  hr = CoGetPSClsid(&IID_Testiface2, &clsid);
1361  ok(hr == S_OK, "got 0x%08x\n", hr);
1362  ok(IsEqualGUID(&clsid, &IID_Testiface2), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1363 
1364  memset(&clsid, 0, sizeof(clsid));
1365  hr = CoGetPSClsid(&IID_Testiface3, &clsid);
1366  ok(hr == S_OK, "got 0x%08x\n", hr);
1367  ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1368 
1369  memset(&clsid, 0xaa, sizeof(clsid));
1370  hr = CoGetPSClsid(&IID_Testiface4, &clsid);
1371  ok(hr == S_OK, "got 0x%08x\n", hr);
1372  ok(IsEqualGUID(&clsid, &GUID_NULL), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1373 
1374  /* register same interface and try to get CLSID back */
1376  ok(hr == S_OK, "got 0x%08x\n", hr);
1377  memset(&clsid, 0, sizeof(clsid));
1378  hr = CoGetPSClsid(&IID_Testiface, &clsid);
1379  ok(hr == S_OK, "got 0x%08x\n", hr);
1380  ok(IsEqualGUID(&clsid, &IID_Testiface4), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1381 
1382  pDeactivateActCtx(0, cookie);
1383  pReleaseActCtx(handle);
1384  }
1385 
1386  if (pRegDeleteKeyExA &&
1387  (is_win64 ||
1388  (pIsWow64Process && pIsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64)))
1389  {
1390  static GUID IID_DeadBeef = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}};
1391  static const char clsidDeadBeef[] = "{deadbeef-dead-beef-dead-beefdeadbeef}";
1392  static const char clsidA[] = "{66666666-8888-7777-6666-555555555555}";
1393  HKEY hkey_iface, hkey_psclsid;
1394  REGSAM opposite = is_win64 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY;
1395 
1396  hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
1397  ok(hr == REGDB_E_IIDNOTREG, "got 0x%08x\n", hr);
1398 
1399  res = RegCreateKeyExA(HKEY_CLASSES_ROOT, "Interface",
1400  0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_iface, NULL);
1401  ok(!res, "RegCreateKeyEx returned %d\n", res);
1402  res = RegCreateKeyExA(hkey_iface, clsidDeadBeef,
1403  0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey, NULL);
1404  if (res == ERROR_ACCESS_DENIED)
1405  {
1406  win_skip("Failed to create a key, skipping some of CoGetPSClsid() tests\n");
1407  goto cleanup;
1408  }
1409 
1410  ok(!res, "RegCreateKeyEx returned %d\n", res);
1411  res = RegCreateKeyExA(hkey, "ProxyStubClsid32",
1412  0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_psclsid, NULL);
1413  ok(!res, "RegCreateKeyEx returned %d\n", res);
1414  res = RegSetValueExA(hkey_psclsid, NULL, 0, REG_SZ, (const BYTE *)clsidA, strlen(clsidA)+1);
1415  ok(!res, "RegSetValueEx returned %d\n", res);
1416  RegCloseKey(hkey_psclsid);
1417 
1418  hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
1419  ok_ole_success(hr, "CoGetPSClsid");
1420  ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
1421 
1422  res = pRegDeleteKeyExA(hkey, "ProxyStubClsid32", opposite, 0);
1423  ok(!res, "RegDeleteKeyEx returned %d\n", res);
1424  RegCloseKey(hkey);
1425  res = pRegDeleteKeyExA(hkey_iface, clsidDeadBeef, opposite, 0);
1426  ok(!res, "RegDeleteKeyEx returned %d\n", res);
1427 
1428  cleanup:
1429  RegCloseKey(hkey_iface);
1430  }
1431 
1432  CoUninitialize();
1433 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:79
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define REGDB_E_IIDNOTREG
Definition: winerror.h:2697
const char * wine_dbgstr_guid(const GUID *guid)
HRESULT WINAPI CoRegisterPSClsid(REFIID riid, REFCLSID rclsid)
Definition: compobj.c:2642
#define ok_ole_success(hr, func)
Definition: compobj.c:92
#define CO_E_NOTINITIALIZED
const GUID IID_IClassFactory
uint32_t ULONG_PTR
Definition: typedefs.h:63
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
long LONG
Definition: pedump.c:60
static STATEMGRSTATUS *static BOOL is_wow64
Definition: action.c:57
#define E_INVALIDARG
Definition: ddrawi.h:101
static const BOOL is_win64
Definition: shellpath.c:50
smooth NULL
Definition: ftsmooth.c:557
HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
Definition: compobj.c:2555
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG HRESULT
Definition: typedefs.h:77
HANDLE HKEY
Definition: registry.h:24
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1183
REFCLSID clsid
Definition: msctf.c:66
static const char actctx_manifest[]
Definition: compobj.c:268
static const GUID IID_Testiface3
Definition: compobj.c:100
unsigned char BYTE
Definition: ntddk_ex.h:96
static const GUID IID_Testiface2
Definition: compobj.c:99
static const GUID IID_TestPS
Definition: compobj.c:104
static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
Definition: compobj.c:222
const IID GUID_NULL
Definition: pin.cpp:13
#define S_OK
Definition: intsafe.h:59
DWORD *typedef HANDLE
Definition: winlogon.h:52
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
ACCESS_MASK REGSAM
Definition: winreg.h:69
static const IID IID_IWineTest
Definition: marshal.c:60
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:3970
GLuint res
Definition: glext.h:9613
char * cleanup(char *str)
Definition: wpickclick.c:99
#define ok(value,...)
Definition: CImage.cpp:33
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4831
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1032
static const GUID IID_Testiface4
Definition: compobj.c:101
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141
static const GUID IID_Testiface
Definition: compobj.c:98
#define REG_SZ
Definition: layer.c:22
static void test_CoInitializeEx ( void  )
static

Definition at line 2324 of file compobj.c.

Referenced by START_TEST().

2325 {
2326  HRESULT hr;
2327 
2328  hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
2329  ok(hr == S_OK, "CoInitializeEx failed with error 0x%08x\n", hr);
2330 
2331  /* Calling OleInitialize for the first time should yield S_OK even with
2332  * apartment already initialized by previous CoInitialize(Ex) calls. */
2333  hr = OleInitialize(NULL);
2334  ok(hr == S_OK, "OleInitialize failed with error 0x%08x\n", hr);
2335 
2336  /* Subsequent calls to OleInitialize should return S_FALSE */
2337  hr = OleInitialize(NULL);
2338  ok(hr == S_FALSE, "Expected S_FALSE, hr = 0x%08x\n", hr);
2339 
2340  /* Cleanup */
2341  CoUninitialize();
2342  OleUninitialize();
2343  OleUninitialize();
2344 }
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:557
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:145
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
#define ok(value,...)
Definition: CImage.cpp:33
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:206
static void test_CoMarshalInterface ( void  )
static

Definition at line 1479 of file compobj.c.

Referenced by START_TEST().

1480 {
1481  IStream *pStream;
1482  HRESULT hr;
1483  static const LARGE_INTEGER llZero;
1484 
1485  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1486 
1487  hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
1488  ok_ole_success(hr, "CreateStreamOnHGlobal");
1489 
1490  hr = CoMarshalInterface(pStream, &IID_IUnknown, NULL, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1491  ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1492 
1493  hr = CoMarshalInterface(NULL, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1494  ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1495 
1496  hr = CoMarshalInterface(pStream, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1497  ok_ole_success(hr, "CoMarshalInterface");
1498 
1499  /* stream not rewound */
1500  hr = CoReleaseMarshalData(pStream);
1501  ok(hr == STG_E_READFAULT, "CoReleaseMarshalData should have returned STG_E_READFAULT instead of 0x%08x\n", hr);
1502 
1503  hr = IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
1504  ok_ole_success(hr, "IStream_Seek");
1505 
1506  hr = CoReleaseMarshalData(pStream);
1507  ok_ole_success(hr, "CoReleaseMarshalData");
1508 
1509  IStream_Release(pStream);
1510 
1511  CoUninitialize();
1512 }
HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
Definition: marshal.c:1876
#define TRUE
Definition: types.h:120
static IClassFactory Test_ClassFactory
Definition: compobj.c:196
const GUID IID_IUnknown
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
#define ok_ole_success(hr, func)
Definition: compobj.c:92
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
static const LARGE_INTEGER llZero
Definition: moniker.c:1119
LONG HRESULT
Definition: typedefs.h:77
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
#define STG_E_READFAULT
Definition: winerror.h:2576
#define ok(value,...)
Definition: CImage.cpp:33
HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:1693
static void test_CoMarshalInterThreadInterfaceInStream ( void  )
static

Definition at line 1514 of file compobj.c.

Referenced by START_TEST().

1515 {
1516  IStream *pStream;
1517  HRESULT hr;
1518  IClassFactory *pProxy;
1519 
1520  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1521 
1522  cLocks = 0;
1523 
1525  ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1526 
1528  ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1529 
1530  ok_no_locks();
1531 
1533  ok_ole_success(hr, "CoMarshalInterThreadInterfaceInStream");
1534 
1536 
1537  hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy);
1538  ok_ole_success(hr, "CoUnmarshalInterface");
1539 
1540  IClassFactory_Release(pProxy);
1541  IStream_Release(pStream);
1542 
1543  ok_no_locks();
1544 
1545  CoUninitialize();
1546 }
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1807
static IClassFactory Test_ClassFactory
Definition: compobj.c:196
const GUID IID_IUnknown
static LONG cLocks
Definition: compobj.c:124
#define ok_ole_success(hr, func)
Definition: compobj.c:92
const GUID IID_IClassFactory
#define ok_more_than_one_lock()
Definition: compobj.c:93
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM *ppStm)
Definition: marshal.c:1914
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
#define ok_no_locks()
Definition: compobj.c:94
#define ok(value,...)
Definition: CImage.cpp:33
static void test_CoRegisterClassObject ( void  )
static

Definition at line 1548 of file compobj.c.

Referenced by START_TEST().

1549 {
1550  ULONG_PTR ctxcookie;
1551  HANDLE handle;
1552  DWORD cookie;
1553  HRESULT hr;
1554  IClassFactory *pcf;
1555 
1556  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1557 
1558  /* CLSCTX_INPROC_SERVER */
1560  CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1561  ok_ole_success(hr, "CoRegisterClassObject");
1562  hr = CoRevokeClassObject(cookie);
1563  ok_ole_success(hr, "CoRevokeClassObject");
1564 
1566  CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie);
1567  ok_ole_success(hr, "CoRegisterClassObject");
1568  hr = CoRevokeClassObject(cookie);
1569  ok_ole_success(hr, "CoRevokeClassObject");
1570 
1572  CLSCTX_INPROC_SERVER, REGCLS_MULTI_SEPARATE, &cookie);
1573  ok_ole_success(hr, "CoRegisterClassObject");
1574  hr = CoRevokeClassObject(cookie);
1575  ok_ole_success(hr, "CoRevokeClassObject");
1576 
1577  /* CLSCTX_LOCAL_SERVER */
1579  CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1580  ok_ole_success(hr, "CoRegisterClassObject");
1581  hr = CoRevokeClassObject(cookie);
1582  ok_ole_success(hr, "CoRevokeClassObject");
1583 
1585  CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &cookie);
1586  ok_ole_success(hr, "CoRegisterClassObject");
1587  hr = CoRevokeClassObject(cookie);
1588  ok_ole_success(hr, "CoRevokeClassObject");
1589 
1591  CLSCTX_LOCAL_SERVER, REGCLS_MULTI_SEPARATE, &cookie);
1592  ok_ole_success(hr, "CoRegisterClassObject");
1593  hr = CoRevokeClassObject(cookie);
1594  ok_ole_success(hr, "CoRevokeClassObject");
1595 
1596  /* CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER */
1598  CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1599  ok_ole_success(hr, "CoRegisterClassObject");
1600  hr = CoRevokeClassObject(cookie);
1601  ok_ole_success(hr, "CoRevokeClassObject");
1602 
1603  /* test whether an object that doesn't support IClassFactory can be
1604  * registered for CLSCTX_LOCAL_SERVER */
1606  CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE, &cookie);
1607  ok_ole_success(hr, "CoRegisterClassObject");
1608  hr = CoRevokeClassObject(cookie);
1609  ok_ole_success(hr, "CoRevokeClassObject");
1610 
1611  /* test whether registered class becomes invalid when apartment is destroyed */
1613  CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
1614  ok_ole_success(hr, "CoRegisterClassObject");
1615 
1616  CoUninitialize();
1617  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1618 
1619  hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL,
1620  &IID_IClassFactory, (void **)&pcf);
1621  ok(hr == REGDB_E_CLASSNOTREG, "object registered in an apartment shouldn't accessible after it is destroyed\n");
1622 
1623  /* crashes with at least win9x DCOM! */
1624  if (0)
1625  CoRevokeClassObject(cookie);
1626 
1627  /* test that object is accessible */
1628  hr = CoRegisterClassObject(&CLSID_WineOOPTest, (IUnknown *)&Test_ClassFactory, CLSCTX_INPROC_SERVER,
1629  REGCLS_MULTIPLEUSE, &cookie);
1630  ok(hr == S_OK, "got 0x%08x\n", hr);
1631 
1632  hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1633  ok(hr == S_OK, "got 0x%08x\n", hr);
1634  IClassFactory_Release(pcf);
1635 
1636  /* context now contains CLSID_WineOOPTest, test if registered one could still be used */
1637  if ((handle = activate_context(actctx_manifest, &ctxcookie)))
1638  {
1639  hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1640 todo_wine
1641  ok(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND), "got 0x%08x\n", hr);
1642 
1643  pDeactivateActCtx(0, ctxcookie);
1644  pReleaseActCtx(handle);
1645  }
1646 
1647  hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
1648  ok(hr == S_OK, "got 0x%08x\n", hr);
1649  IClassFactory_Release(pcf);
1650 
1651  hr = CoRevokeClassObject(cookie);
1652  ok(hr == S_OK, "got 0x%08x\n", hr);
1653 
1654  CoUninitialize();
1655 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:79
static IClassFactory Test_ClassFactory
Definition: compobj.c:196
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
static IUnknown Test_Unknown
Definition: compobj.c:1004
#define ok_ole_success(hr, func)
Definition: compobj.c:92
DWORD DWORD
Definition: winlogon.h:75
const GUID IID_IClassFactory
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:557
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1031
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:2958
const CHARFORMATW * pcf
Definition: msvc.h:84
LONG HRESULT
Definition: typedefs.h:77
static const CLSID CLSID_WineOOPTest
Definition: marshal.c:79
#define todo_wine
Definition: test.h:154
static const char actctx_manifest[]
Definition: compobj.c:268
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2760
static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
Definition: compobj.c:222
#define S_OK
Definition: intsafe.h:59
DWORD *typedef HANDLE
Definition: winlogon.h:52
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
#define ERROR_MOD_NOT_FOUND
Definition: compat.h:94
#define ok(value,...)
Definition: CImage.cpp:33
static void test_CoRegisterMessageFilter ( void  )
static

Definition at line 964 of file compobj.c.

Referenced by START_TEST().

965 {
966  HRESULT hr;
967  IMessageFilter *prev_filter;
968 
969  hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
970  ok(hr == CO_E_NOT_SUPPORTED,
971  "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08x\n",
972  hr);
973 
974  pCoInitializeEx(NULL, COINIT_MULTITHREADED);
975  prev_filter = (IMessageFilter *)0xdeadbeef;
976  hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
977  ok(hr == CO_E_NOT_SUPPORTED,
978  "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08x\n",
979  hr);
980  ok(prev_filter == (IMessageFilter *)0xdeadbeef,
981  "prev_filter should have been set to %p\n", prev_filter);
982  CoUninitialize();
983 
984  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
985 
987  ok_ole_success(hr, "CoRegisterMessageFilter");
988 
989  prev_filter = (IMessageFilter *)0xdeadbeef;
990  hr = CoRegisterMessageFilter(NULL, &prev_filter);
991  ok_ole_success(hr, "CoRegisterMessageFilter");
992  ok(prev_filter == NULL, "prev_filter should have been set to NULL instead of %p\n", prev_filter);
993 
994  hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
995  ok_ole_success(hr, "CoRegisterMessageFilter");
996  ok(prev_filter == NULL, "prev_filter should have been set to NULL instead of %p\n", prev_filter);
997 
999  ok_ole_success(hr, "CoRegisterMessageFilter");
1000 
1001  CoUninitialize();
1002 }
#define ok_ole_success(hr, func)
Definition: compobj.c:92
smooth NULL
Definition: ftsmooth.c:557
#define CO_E_NOT_SUPPORTED
Definition: winerror.h:2397
static IMessageFilter MessageFilter
Definition: compobj.c:962
LONG HRESULT
Definition: typedefs.h:77
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
#define ok(value,...)
Definition: CImage.cpp:33
HRESULT WINAPI CoRegisterMessageFilter(LPMESSAGEFILTER lpMessageFilter, LPMESSAGEFILTER *lplpMessageFilter)
Definition: compobj.c:3904
static void test_CoRegisterPSClsid ( void  )
static

Definition at line 1190 of file compobj.c.

Referenced by START_TEST().

1191 {
1192  HRESULT hr;
1193  DWORD dwRegistrationKey;
1194  IStream *stream;
1195  CLSID clsid;
1196  HANDLE thread;
1197  DWORD tid;
1198 
1200  ok(hr == CO_E_NOTINITIALIZED, "CoRegisterPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
1201 
1202  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1203 
1205  CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &dwRegistrationKey);
1206  ok_ole_success(hr, "CoRegisterClassObject");
1207 
1209  ok_ole_success(hr, "CoRegisterPSClsid");
1210 
1211  hr = CoGetPSClsid(&IID_IWineTest, &clsid);
1212  ok_ole_success(hr, "CoGetPSClsid");
1213  ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1215 
1216  thread = CreateThread(NULL, 0, register_ps_clsid_thread, NULL, 0, &tid);
1217  ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
1218  ok(!WaitForSingleObject(thread, 10000), "wait timed out\n");
1219  CloseHandle(thread);
1220 
1221  hr = CoGetPSClsid(&IID_TestPS, &clsid);
1222  ok_ole_success(hr, "CoGetPSClsid");
1223  ok(IsEqualGUID(&clsid, &CLSID_WineTestPSFactoryBuffer), "expected %s, got %s\n",
1225 
1226  hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
1227  ok_ole_success(hr, "CreateStreamOnHGlobal");
1228 
1229  SET_EXPECT(CreateStub);
1230  hr = CoMarshalInterface(stream, &IID_IWineTest, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1231  ok(hr == E_NOTIMPL, "CoMarshalInterface should have returned E_NOTIMPL instead of 0x%08x\n", hr);
1232  CHECK_CALLED(CreateStub);
1233 
1234  hr = CoGetPSClsid(&IID_IEnumOLEVERB, &clsid);
1235  ok_ole_success(hr, "CoGetPSClsid");
1236 
1237  hr = CoGetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IPSFactoryBuffer, (void **)&ps_factory_buffer);
1238  ok_ole_success(hr, "CoGetClassObject");
1239 
1241  ok_ole_success(hr, "CoRegisterPSClsid");
1242 
1243  SET_EXPECT(CreateStub);
1244  hr = CoMarshalInterface(stream, &IID_IEnumOLEVERB, (IUnknown*)&EnumOLEVERB, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1245  ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08x\n", hr);
1246  CHECK_CALLED(CreateStub);
1247 
1248  hr = CoMarshalInterface(stream, &IID_IEnumOLEVERB, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1249  ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08x\n", hr);
1250 
1251  IStream_Release(stream);
1252  IPSFactoryBuffer_Release(ps_factory_buffer);
1254 
1255  hr = CoRevokeClassObject(dwRegistrationKey);
1256  ok_ole_success(hr, "CoRevokeClassObject");
1257 
1258  CoUninitialize();
1259 
1260  pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1261 
1262  hr = CoGetPSClsid(&IID_IWineTest, &clsid);
1263  ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08x\n", hr);
1264 
1265  hr = CoGetPSClsid(&IID_TestPS, &clsid);
1266  ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08x\n", hr);
1267 
1268