ReactOS  r76032
compobj.c File Reference
#include "precomp.h"
#include <ctxtcall.h>
#include <dde.h>
Include dependency graph for compobj.c:

Go to the source code of this file.

Classes

struct  comclassredirect_data
 
struct  ifacepsredirect_data
 
struct  progidredirect_data
 
struct  class_reg_data
 
struct  registered_psclsid
 
struct  LocalServer
 
struct  tagRegisteredClass
 
struct  tagOpenDll
 
struct  apartment_loaded_dll
 
struct  ManualResetEvent
 
struct  host_object_params
 
struct  host_thread_params
 
struct  Context
 
struct  GlobalOptions
 

Macros

#define ARRAYSIZE(array)   (sizeof(array)/sizeof((array)[0]))
 

Typedefs

typedef struct tagRegisteredClass RegisteredClass
 
typedef HRESULT(CALLBACKDllGetClassObjectFunc )(REFCLSID clsid, REFIID iid, LPVOID *ppv)
 
typedef HRESULT(WINAPIDllCanUnloadNowFunc )(void)
 
typedef struct tagOpenDll OpenDll
 
typedef struct ManualResetEvent MREImpl
 
typedef struct Context Context
 

Enumerations

enum  comclass_threadingmodel {
  ThreadingModel_Apartment = 1, ThreadingModel_Free = 2, ThreadingModel_No = 3, ThreadingModel_Both = 4,
  ThreadingModel_Neutral = 5, ThreadingModel_Apartment = 1, ThreadingModel_Free = 2, ThreadingModel_No = 3,
  ThreadingModel_Both = 4, ThreadingModel_Neutral = 5, ThreadingModel_Apartment = 1, ThreadingModel_Free = 2,
  ThreadingModel_No = 3, ThreadingModel_Both = 4, ThreadingModel_Neutral = 5
}
 
enum  comclass_miscfields {
  MiscStatus = 1, MiscStatusIcon = 2, MiscStatusContent = 4, MiscStatusThumbnail = 8,
  MiscStatusDocPrint = 16, MiscStatus = 1, MiscStatusIcon = 2, MiscStatusContent = 4,
  MiscStatusThumbnail = 8, MiscStatusDocPrint = 16, MiscStatus = 1, MiscStatusIcon = 2,
  MiscStatusContent = 4, MiscStatusThumbnail = 8, MiscStatusDocPrint = 16
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static enum comclass_miscfields dvaspect_to_miscfields (DWORD aspect)
 
BOOL actctx_get_miscstatus (const CLSID *clsid, DWORD aspect, DWORD *status)
 
static NTSTATUS create_key (HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr)
 
static HKEY create_classes_root_hkey (DWORD access)
 
static HKEY get_classes_root_hkey (HKEY hkey, REGSAM access)
 
LSTATUS create_classes_key (HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey)
 
LSTATUS open_classes_key (HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey)
 
static OpenDllCOMPOBJ_DllList_Get (LPCWSTR library_name)
 
static HRESULT COMPOBJ_DllList_Add (LPCWSTR library_name, OpenDll **ret)
 
static void COMPOBJ_DllList_ReleaseRef (OpenDll *entry, BOOL free_entry)
 
static void COMPOBJ_DllList_Free (void)
 
static DWORD apartment_addref (struct apartment *apt)
 
static APARTMENTapartment_construct (DWORD model)
 
static APARTMENTapartment_get_or_create (DWORD model)
 
static BOOL apartment_is_model (const APARTMENT *apt, DWORD model)
 
static void COM_RevokeRegisteredClassObject (RegisteredClass *curClass)
 
static void COM_RevokeAllClasses (const struct apartment *apt)
 
static void revoke_registered_psclsids (void)
 
static MREImplimpl_from_ISynchronize (ISynchronize *iface)
 
static HRESULT WINAPI ISynchronize_fnQueryInterface (ISynchronize *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ISynchronize_fnAddRef (ISynchronize *iface)
 
static ULONG WINAPI ISynchronize_fnRelease (ISynchronize *iface)
 
static HRESULT WINAPI ISynchronize_fnWait (ISynchronize *iface, DWORD dwFlags, DWORD dwMilliseconds)
 
static HRESULT WINAPI ISynchronize_fnSignal (ISynchronize *iface)
 
static HRESULT WINAPI ISynchronize_fnReset (ISynchronize *iface)
 
static MREImplimpl_from_ISynchronizeHandle (ISynchronizeHandle *iface)
 
static HRESULT WINAPI SynchronizeHandle_QueryInterface (ISynchronizeHandle *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI SynchronizeHandle_AddRef (ISynchronizeHandle *iface)
 
static ULONG WINAPI SynchronizeHandle_Release (ISynchronizeHandle *iface)
 
static HRESULT WINAPI SynchronizeHandle_GetHandle (ISynchronizeHandle *iface, HANDLE *ph)
 
static HRESULT ManualResetEvent_Construct (IUnknown *punkouter, REFIID iid, void **ppv)
 
static LocalServerimpl_from_IServiceProvider (IServiceProvider *iface)
 
static HRESULT WINAPI LocalServer_QueryInterface (IServiceProvider *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI LocalServer_AddRef (IServiceProvider *iface)
 
static ULONG WINAPI LocalServer_Release (IServiceProvider *iface)
 
static HRESULT WINAPI LocalServer_QueryService (IServiceProvider *iface, REFGUID guid, REFIID riid, void **ppv)
 
static HRESULT get_local_server_stream (APARTMENT *apt, IStream **ret)
 
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject (DWORD dwRegister)
 
static void apartment_freeunusedlibraries (struct apartment *apt, DWORD delay)
 
DWORD apartment_release (struct apartment *apt)
 
APARTMENTapartment_findfromoxid (OXID oxid, BOOL ref)
 
APARTMENTapartment_findfromtid (DWORD tid)
 
static APARTMENTapartment_findmain (void)
 
static APARTMENTapartment_find_multi_threaded (void)
 
static HRESULT apartment_getclassobject (struct apartment *apt, LPCWSTR dllpath, BOOL apartment_threaded, REFCLSID rclsid, REFIID riid, void **ppv)
 
static DWORD COM_RegReadPath (const struct class_reg_data *regdata, WCHAR *dst, DWORD dstlen)
 
static HRESULT apartment_hostobject (struct apartment *apt, const struct host_object_params *params)
 
static LRESULT CALLBACK apartment_wndproc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static DWORD CALLBACK apartment_hostobject_thread (LPVOID p)
 
static HRESULT apartment_hostobject_in_hostapt (struct apartment *apt, BOOL multi_threaded, BOOL main_apartment, const struct class_reg_data *regdata, REFCLSID rclsid, REFIID riid, void **ppv)
 
static BOOL WINAPI register_class (INIT_ONCE *once, void *param, void **context)
 
HRESULT apartment_createwindowifneeded (struct apartment *apt)
 
HWND apartment_getwindow (const struct apartment *apt)
 
void apartment_joinmta (void)
 
static void COM_TlsDestroy (void)
 
DWORD WINAPI CoBuildVersion (void)
 
HRESULT WINAPI CoRegisterInitializeSpy (IInitializeSpy *spy, ULARGE_INTEGER *cookie)
 
HRESULT WINAPI CoRevokeInitializeSpy (ULARGE_INTEGER cookie)
 
HRESULT WINAPI CoInitialize (LPVOID lpReserved)
 
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx (LPVOID lpReserved, DWORD dwCoInit)
 
void WINAPI DECLSPEC_HOTPATCH CoUninitialize (void)
 
HRESULT WINAPI CoDisconnectObject (LPUNKNOWN lpUnk, DWORD reserved)
 
HRESULT WINAPI CoCreateGuid (GUID *pguid)
 
static BOOL is_valid_hex (WCHAR c)
 
static BOOL guid_from_string (LPCWSTR s, GUID *id)
 
static HRESULT clsid_from_string_reg (LPCOLESTR progid, CLSID *clsid)
 
HRESULT WINAPI CLSIDFromString (LPCOLESTR idstr, LPCLSID id)
 
HRESULT WINAPI IIDFromString (LPCOLESTR s, IID *iid)
 
HRESULT WINAPI StringFromCLSID (REFCLSID id, LPOLESTR *idstr)
 
INT WINAPI StringFromGUID2 (REFGUID id, LPOLESTR str, INT cmax)
 
HRESULT COM_OpenKeyForCLSID (REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
 
HRESULT COM_OpenKeyForAppIdFromCLSID (REFCLSID clsid, REGSAM access, HKEY *subkey)
 
HRESULT WINAPI DECLSPEC_HOTPATCH ProgIDFromCLSID (REFCLSID clsid, LPOLESTR *ppszProgID)
 
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID (LPCOLESTR progid, LPCLSID clsid)
 
HRESULT WINAPI CLSIDFromProgIDEx (LPCOLESTR progid, LPCLSID clsid)
 
static HRESULT get_ps_clsid_from_registry (const WCHAR *path, REGSAM access, CLSID *pclsid)
 
HRESULT WINAPI CoGetPSClsid (REFIID riid, CLSID *pclsid)
 
HRESULT WINAPI CoRegisterPSClsid (REFIID riid, REFCLSID rclsid)
 
static HRESULT COM_GetRegisteredClassObject (const struct apartment *apt, REFCLSID rclsid, DWORD dwClsContext, LPUNKNOWN *ppUnk)
 
HRESULT WINAPI CoRegisterClassObject (REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
 
static enum comclass_threadingmodel get_threading_model (const struct class_reg_data *data)
 
static HRESULT get_inproc_class_object (APARTMENT *apt, const struct class_reg_data *regdata, REFCLSID rclsid, REFIID riid, BOOL hostifnecessary, void **ppv)
 
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject (REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
 
HRESULT WINAPI CoResumeClassObjects (void)
 
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance (REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
 
static void init_multi_qi (DWORD count, MULTI_QI *mqi, HRESULT hr)
 
static HRESULT return_multi_qi (IUnknown *unk, DWORD count, MULTI_QI *mqi, BOOL include_unk)
 
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx (REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, COSERVERINFO *pServerInfo, ULONG cmq, MULTI_QI *pResults)
 
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetInstanceFromFile (COSERVERINFO *server_info, CLSID *rclsid, IUnknown *outer, DWORD cls_context, DWORD grfmode, OLECHAR *filename, DWORD count, MULTI_QI *results)
 
HRESULT WINAPI CoGetInstanceFromIStorage (COSERVERINFO *server_info, CLSID *rclsid, IUnknown *outer, DWORD cls_context, IStorage *storage, DWORD count, MULTI_QI *results)
 
HINSTANCE WINAPI CoLoadLibrary (LPOLESTR lpszLibName, BOOL bAutoFree)
 
void WINAPI CoFreeLibrary (HINSTANCE hLibrary)
 
void WINAPI CoFreeAllLibraries (void)
 
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibrariesEx (DWORD dwUnloadDelay, DWORD dwReserved)
 
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries (void)
 
HRESULT WINAPI CoFileTimeNow (FILETIME *lpFileTime)
 
HRESULT WINAPI CoLockObjectExternal (LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases)
 
HRESULT WINAPI CoInitializeWOW (DWORD x, DWORD y)
 
HRESULT WINAPI CoGetState (IUnknown **ppv)
 
HRESULT WINAPI CoSetState (IUnknown *pv)
 
HRESULT WINAPI CoTreatAsClass (REFCLSID clsidOld, REFCLSID clsidNew)
 
HRESULT WINAPI CoGetTreatAsClass (REFCLSID clsidOld, LPCLSID clsidNew)
 
DWORD WINAPI CoGetCurrentProcess (void)
 
HRESULT WINAPI CoGetCurrentLogicalThreadId (GUID *id)
 
HRESULT WINAPI CoRegisterMessageFilter (LPMESSAGEFILTER lpMessageFilter, LPMESSAGEFILTER *lplpMessageFilter)
 
BOOL WINAPI CoIsOle1Class (REFCLSID clsid)
 
BOOL WINAPI IsEqualGUID (REFGUID rguid1, REFGUID rguid2)
 
HRESULT WINAPI CoInitializeSecurity (PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, SOLE_AUTHENTICATION_SERVICE *asAuthSvc, void *pReserved1, DWORD dwAuthnLevel, DWORD dwImpLevel, void *pReserved2, DWORD dwCapabilities, void *pReserved3)
 
HRESULT WINAPI CoSuspendClassObjects (void)
 
ULONG WINAPI CoAddRefServerProcess (void)
 
ULONG WINAPI CoReleaseServerProcess (void)
 
BOOL WINAPI CoIsHandlerConnected (IUnknown *pUnk)
 
HRESULT WINAPI CoAllowSetForegroundWindow (IUnknown *pUnk, void *pvReserved)
 
HRESULT WINAPI CoQueryProxyBlanket (IUnknown *pProxy, DWORD *pAuthnSvc, DWORD *pAuthzSvc, OLECHAR **ppServerPrincName, DWORD *pAuthnLevel, DWORD *pImpLevel, void **ppAuthInfo, DWORD *pCapabilities)
 
HRESULT WINAPI CoSetProxyBlanket (IUnknown *pProxy, DWORD AuthnSvc, DWORD AuthzSvc, OLECHAR *pServerPrincName, DWORD AuthnLevel, DWORD ImpLevel, void *pAuthInfo, DWORD Capabilities)
 
HRESULT WINAPI CoCopyProxy (IUnknown *pProxy, IUnknown **ppCopy)
 
HRESULT WINAPI CoGetCallContext (REFIID riid, void **ppv)
 
HRESULT WINAPI CoSwitchCallContext (IUnknown *pObject, IUnknown **ppOldObject)
 
HRESULT WINAPI CoQueryClientBlanket (DWORD *pAuthnSvc, DWORD *pAuthzSvc, OLECHAR **pServerPrincName, DWORD *pAuthnLevel, DWORD *pImpLevel, RPC_AUTHZ_HANDLE *pPrivs, DWORD *pCapabilities)
 
HRESULT WINAPI CoImpersonateClient (void)
 
HRESULT WINAPI CoRevertToSelf (void)
 
static BOOL COM_PeekMessage (struct apartment *apt, MSG *msg)
 
HRESULT WINAPI CoWaitForMultipleHandles (DWORD dwFlags, DWORD dwTimeout, ULONG cHandles, LPHANDLE pHandles, LPDWORD lpdwindex)
 
HRESULT WINAPI CoGetObject (LPCWSTR pszName, BIND_OPTS *pBindOptions, REFIID riid, void **ppv)
 
HRESULT WINAPI CoRegisterChannelHook (REFGUID guidExtension, IChannelHook *pChannelHook)
 
static Contextimpl_from_IComThreadingInfo (IComThreadingInfo *iface)
 
static Contextimpl_from_IContextCallback (IContextCallback *iface)
 
static Contextimpl_from_IObjContext (IObjContext *iface)
 
static HRESULT Context_QueryInterface (Context *iface, REFIID riid, LPVOID *ppv)
 
static ULONG Context_AddRef (Context *This)
 
static ULONG Context_Release (Context *This)
 
static HRESULT WINAPI Context_CTI_QueryInterface (IComThreadingInfo *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI Context_CTI_AddRef (IComThreadingInfo *iface)
 
static ULONG WINAPI Context_CTI_Release (IComThreadingInfo *iface)
 
static HRESULT WINAPI Context_CTI_GetCurrentApartmentType (IComThreadingInfo *iface, APTTYPE *apttype)
 
static HRESULT WINAPI Context_CTI_GetCurrentThreadType (IComThreadingInfo *iface, THDTYPE *thdtype)
 
static HRESULT WINAPI Context_CTI_GetCurrentLogicalThreadId (IComThreadingInfo *iface, GUID *logical_thread_id)
 
static HRESULT WINAPI Context_CTI_SetCurrentLogicalThreadId (IComThreadingInfo *iface, REFGUID logical_thread_id)
 
static HRESULT WINAPI Context_CC_QueryInterface (IContextCallback *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI Context_CC_AddRef (IContextCallback *iface)
 
static ULONG WINAPI Context_CC_Release (IContextCallback *iface)
 
static HRESULT WINAPI Context_CC_ContextCallback (IContextCallback *iface, PFNCONTEXTCALL pCallback, ComCallData *param, REFIID riid, int method, IUnknown *punk)
 
static HRESULT WINAPI Context_OC_QueryInterface (IObjContext *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI Context_OC_AddRef (IObjContext *iface)
 
static ULONG WINAPI Context_OC_Release (IObjContext *iface)
 
static HRESULT WINAPI Context_OC_SetProperty (IObjContext *iface, REFGUID propid, CPFLAGS flags, IUnknown *punk)
 
static HRESULT WINAPI Context_OC_RemoveProperty (IObjContext *iface, REFGUID propid)
 
static HRESULT WINAPI Context_OC_GetProperty (IObjContext *iface, REFGUID propid, CPFLAGS *flags, IUnknown **punk)
 
static HRESULT WINAPI Context_OC_EnumContextProps (IObjContext *iface, IEnumContextProps **props)
 
static void WINAPI Context_OC_Reserved1 (IObjContext *iface)
 
static void WINAPI Context_OC_Reserved2 (IObjContext *iface)
 
static void WINAPI Context_OC_Reserved3 (IObjContext *iface)
 
static void WINAPI Context_OC_Reserved4 (IObjContext *iface)
 
static void WINAPI Context_OC_Reserved5 (IObjContext *iface)
 
static void WINAPI Context_OC_Reserved6 (IObjContext *iface)
 
static void WINAPI Context_OC_Reserved7 (IObjContext *iface)
 
HRESULT WINAPI CoGetObjectContext (REFIID riid, void **ppv)
 
HRESULT WINAPI CoGetContextToken (ULONG_PTR *token)
 
HRESULT WINAPI CoGetDefaultContext (APTTYPE type, REFIID riid, LPVOID *ppv)
 
HRESULT Handler_DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
HRESULT WINAPI CoGetApartmentType (APTTYPE *type, APTTYPEQUALIFIER *qualifier)
 
HRESULT WINAPI CoRegisterSurrogate (ISurrogate *surrogate)
 
HRESULT WINAPI CoRegisterSurrogateEx (REFGUID guid, void *reserved)
 
static GlobalOptionsimpl_from_IGlobalOptions (IGlobalOptions *iface)
 
static HRESULT WINAPI GlobalOptions_QueryInterface (IGlobalOptions *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI GlobalOptions_AddRef (IGlobalOptions *iface)
 
static ULONG WINAPI GlobalOptions_Release (IGlobalOptions *iface)
 
static HRESULT WINAPI GlobalOptions_Set (IGlobalOptions *iface, GLOBALOPT_PROPERTIES property, ULONG_PTR value)
 
static HRESULT WINAPI GlobalOptions_Query (IGlobalOptions *iface, GLOBALOPT_PROPERTIES property, ULONG_PTR *value)
 
HRESULT WINAPI GlobalOptions_CreateInstance (IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID reserved)
 
HRESULT WINAPI DllRegisterServer (void)
 
HRESULT WINAPI DllUnregisterServer (void)
 

Variables

static APARTMENTMTA
 
static APARTMENTMainApartment
 
static struct list apts = LIST_INIT( apts )
 
static CRITICAL_SECTION csApartment = { &critsect_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG critsect_debug
 
static struct list registered_psclsid_list = LIST_INIT(registered_psclsid_list)
 
static CRITICAL_SECTION cs_registered_psclsid_list = { &psclsid_cs_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG psclsid_cs_debug
 
static LONG s_COMLockCount = 0
 
static LONG s_COMServerProcessReferences = 0
 
static struct list RegisteredClassList = LIST_INIT(RegisteredClassList)
 
static CRITICAL_SECTION csRegisteredClassList = { &class_cs_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG class_cs_debug
 
static const WCHAR classes_rootW []
 
static HKEY classes_root_hkey
 
static struct list openDllList = LIST_INIT(openDllList)
 
static CRITICAL_SECTION csOpenDllList = { &dll_cs_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG dll_cs_debug
 
static const WCHAR wszAptWinClass [] = {'O','l','e','M','a','i','n','T','h','r','e','a','d','W','n','d','C','l','a','s','s',0}
 
static ISynchronizeVtbl vt_ISynchronize
 
static const ISynchronizeHandleVtbl SynchronizeHandleVtbl
 
static const IServiceProviderVtbl LocalServerVtbl
 
static const BYTE guid_conv_table [256]
 
static const IComThreadingInfoVtbl Context_Threading_Vtbl
 
static const IContextCallbackVtbl Context_Callback_Vtbl
 
static const IObjContextVtbl Context_Object_Vtbl
 
static const IGlobalOptionsVtbl GlobalOptionsVtbl
 

Macro Definition Documentation

Typedef Documentation

typedef HRESULT(WINAPI * DllCanUnloadNowFunc)(void)

Definition at line 427 of file compobj.c.

typedef HRESULT(CALLBACK * DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv)

Definition at line 426 of file compobj.c.

Enumeration Type Documentation

Enumerator
MiscStatus 
MiscStatusIcon 
MiscStatusContent 
MiscStatusThumbnail 
MiscStatusDocPrint 
MiscStatus 
MiscStatusIcon 
MiscStatusContent 
MiscStatusThumbnail 
MiscStatusDocPrint 
MiscStatus 
MiscStatusIcon 
MiscStatusContent 
MiscStatusThumbnail 
MiscStatusDocPrint 

Definition at line 75 of file compobj.c.

Enumerator
ThreadingModel_Apartment 
ThreadingModel_Free 
ThreadingModel_No 
ThreadingModel_Both 
ThreadingModel_Neutral 
ThreadingModel_Apartment 
ThreadingModel_Free 
ThreadingModel_No 
ThreadingModel_Both 
ThreadingModel_Neutral 
ThreadingModel_Apartment 
ThreadingModel_Free 
ThreadingModel_No 
ThreadingModel_Both 
ThreadingModel_Neutral 

Definition at line 66 of file compobj.c.

Function Documentation

BOOL actctx_get_miscstatus ( const CLSID clsid,
DWORD  aspect,
DWORD status 
)

Definition at line 231 of file compobj.c.

Referenced by OleRegGetMiscStatus().

232 {
233  ACTCTX_SECTION_KEYED_DATA data;
234 
235  data.cbSize = sizeof(data);
236  if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION,
237  clsid, &data))
238  {
239  struct comclassredirect_data *comclass = (struct comclassredirect_data*)data.lpData;
240  enum comclass_miscfields misc = dvaspect_to_miscfields(aspect);
241 
242  if (!(comclass->miscmask & misc))
243  {
244  if (!(comclass->miscmask & MiscStatus))
245  {
246  *status = 0;
247  return TRUE;
248  }
249  misc = MiscStatus;
250  }
251 
252  switch (misc)
253  {
254  case MiscStatus:
255  *status = comclass->miscstatus;
256  break;
257  case MiscStatusIcon:
258  *status = comclass->miscstatusicon;
259  break;
260  case MiscStatusContent:
261  *status = comclass->miscstatuscontent;
262  break;
263  case MiscStatusThumbnail:
264  *status = comclass->miscstatusthumbnail;
265  break;
266  case MiscStatusDocPrint:
267  *status = comclass->miscstatusdocprint;
268  break;
269  default:
270  ;
271  };
272 
273  return TRUE;
274  }
275  else
276  return FALSE;
277 }
#define TRUE
Definition: types.h:120
comclass_miscfields
Definition: compobj.c:75
DWORD miscstatusdocprint
Definition: compobj.c:105
#define FALSE
Definition: types.h:117
static enum comclass_miscfields dvaspect_to_miscfields(DWORD aspect)
Definition: compobj.c:214
smooth NULL
Definition: ftsmooth.c:557
DWORD miscstatusthumbnail
Definition: compobj.c:103
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, const GUID *lpSearchGuid, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:183
Definition: ps.c:97
static DWORD apartment_addref ( struct apartment apt)
static

Definition at line 594 of file compobj.c.

Referenced by apartment_find_multi_threaded(), apartment_findfromoxid(), apartment_findfromtid(), apartment_findmain(), apartment_get_or_create(), and apartment_joinmta().

595 {
596  DWORD refs = InterlockedIncrement(&apt->refs);
597  TRACE("%s: before = %d\n", wine_dbgstr_longlong(apt->oxid), refs - 1);
598  return refs;
599 }
DWORD DWORD
Definition: winlogon.h:75
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
static APARTMENT* apartment_construct ( DWORD  model)
static

Definition at line 603 of file compobj.c.

Referenced by apartment_get_or_create().

604 {
605  APARTMENT *apt;
606 
607  TRACE("creating new apartment, model=%d\n", model);
608 
609  apt = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*apt));
610  apt->tid = GetCurrentThreadId();
611 
612  list_init(&apt->proxies);
613  list_init(&apt->stubmgrs);
614  list_init(&apt->loaded_dlls);
615  apt->ipidc = 0;
616  apt->refs = 1;
617  apt->remunk_exported = FALSE;
618  apt->oidc = 1;
620  DEBUG_SET_CRITSEC_NAME(&apt->cs, "apartment");
621 
623 
624  if (apt->multi_threaded)
625  {
626  /* FIXME: should be randomly generated by in an RPC call to rpcss */
627  apt->oxid = ((OXID)GetCurrentProcessId() << 32) | 0xcafe;
628  }
629  else
630  {
631  /* FIXME: should be randomly generated by in an RPC call to rpcss */
632  apt->oxid = ((OXID)GetCurrentProcessId() << 32) | GetCurrentThreadId();
633  }
634 
635  TRACE("Created apartment on OXID %s\n", wine_dbgstr_longlong(apt->oxid));
636 
637  list_add_head(&apts, &apt->entry);
638 
639  return apt;
640 }
#define DEBUG_SET_CRITSEC_NAME(cs, name)
BOOL multi_threaded
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
#define FALSE
Definition: types.h:117
static struct list apts
Definition: compobj.c:55
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
struct list proxies
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:443
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct list loaded_dlls
struct list entry
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
struct list stubmgrs
const XML_Char XML_Content * model
Definition: expat.h:151
CRITICAL_SECTION cs
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1203
BOOL remunk_exported
HRESULT apartment_createwindowifneeded ( struct apartment apt)

Definition at line 1670 of file compobj.c.

Referenced by apartment_get_or_create(), apartment_hostobject_thread(), and marshal_object().

1671 {
1672  static INIT_ONCE class_init_once = INIT_ONCE_STATIC_INIT;
1673 
1674  if (apt->multi_threaded)
1675  return S_OK;
1676 
1677  if (!apt->win)
1678  {
1679  HWND hwnd;
1680 
1681  InitOnceExecuteOnce( &class_init_once, register_class, NULL, NULL );
1682 
1683  hwnd = CreateWindowW(wszAptWinClass, NULL, 0, 0, 0, 0, 0,
1684  HWND_MESSAGE, 0, hProxyDll, NULL);
1685  if (!hwnd)
1686  {
1687  ERR("CreateWindow failed with error %d\n", GetLastError());
1688  return HRESULT_FROM_WIN32(GetLastError());
1689  }
1690  if (InterlockedCompareExchangePointer((PVOID *)&apt->win, hwnd, NULL))
1691  /* someone beat us to it */
1692  DestroyWindow(hwnd);
1693  }
1694 
1695  return S_OK;
1696 }
DWORD *typedef PVOID
Definition: winlogon.h:52
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
BOOL multi_threaded
#define INIT_ONCE_STATIC_INIT
Definition: winbase.h:579
HANDLE HWND
Definition: compat.h:13
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1056
#define HWND_MESSAGE
Definition: winuser.h:1186
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4164
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
smooth NULL
Definition: ftsmooth.c:557
BOOL NTAPI InitOnceExecuteOnce(INIT_ONCE *once, PINIT_ONCE_FN func, void *param, void **context)
static BOOL WINAPI register_class(INIT_ONCE *once, void *param, void **context)
Definition: compobj.c:1647
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static const WCHAR wszAptWinClass[]
Definition: compobj.c:458
static APARTMENT* apartment_find_multi_threaded ( void  )
static

Definition at line 1279 of file compobj.c.

Referenced by CoCreateInstanceEx(), CoGetClassObject(), and CoGetContextToken().

1280 {
1281  APARTMENT *result = NULL;
1282  struct list *cursor;
1283 
1285 
1286  LIST_FOR_EACH( cursor, &apts )
1287  {
1288  struct apartment *apt = LIST_ENTRY( cursor, struct apartment, entry );
1289  if (apt->multi_threaded)
1290  {
1291  result = apt;
1292  apartment_addref(result);
1293  break;
1294  }
1295  }
1296 
1298  return result;
1299 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:594
uint8_t entry
Definition: isohybrid.c:63
BOOL multi_threaded
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static struct list apts
Definition: compobj.c:55
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:557
static CRITICAL_SECTION csApartment
Definition: compobj.c:57
Definition: _list.h:228
const char cursor[]
Definition: icontest.c:13
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
GLuint64EXT * result
Definition: glext.h:11304
APARTMENT* apartment_findfromoxid ( OXID  oxid,
BOOL  ref 
)

Definition at line 1214 of file compobj.c.

Referenced by ipid_to_stub_manager(), StdMarshalImpl_ReleaseMarshalData(), and StdMarshalImpl_UnmarshalInterface().

1215 {
1216  APARTMENT *result = NULL;
1217  struct list *cursor;
1218 
1220  LIST_FOR_EACH( cursor, &apts )
1221  {
1222  struct apartment *apt = LIST_ENTRY( cursor, struct apartment, entry );
1223  if (apt->oxid == oxid)
1224  {
1225  result = apt;
1226  if (ref) apartment_addref(result);
1227  break;
1228  }
1229  }
1231 
1232  return result;
1233 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:594
uint8_t entry
Definition: isohybrid.c:63
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
Definition: send.c:47
static struct list apts
Definition: compobj.c:55
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:557
static CRITICAL_SECTION csApartment
Definition: compobj.c:57
Definition: _list.h:228
const char cursor[]
Definition: icontest.c:13
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
GLuint64EXT * result
Definition: glext.h:11304
APARTMENT* apartment_findfromtid ( DWORD  tid)

Definition at line 1238 of file compobj.c.

Referenced by ipid_to_stub_manager().

1239 {
1240  APARTMENT *result = NULL;
1241  struct list *cursor;
1242 
1244  LIST_FOR_EACH( cursor, &apts )
1245  {
1246  struct apartment *apt = LIST_ENTRY( cursor, struct apartment, entry );
1247  if (apt->tid == tid)
1248  {
1249  result = apt;
1250  apartment_addref(result);
1251  break;
1252  }
1253  }
1255 
1256  return result;
1257 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:594
uint8_t entry
Definition: isohybrid.c:63
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static struct list apts
Definition: compobj.c:55
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:557
static CRITICAL_SECTION csApartment
Definition: compobj.c:57
Definition: _list.h:228
const char cursor[]
Definition: icontest.c:13
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
GLuint64EXT * result
Definition: glext.h:11304
static TfClientId tid
static APARTMENT* apartment_findmain ( void  )
static

Definition at line 1262 of file compobj.c.

Referenced by apartment_hostobject_in_hostapt().

1263 {
1264  APARTMENT *result;
1265 
1267 
1268  result = MainApartment;
1269  if (result) apartment_addref(result);
1270 
1272 
1273  return result;
1274 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:594
static APARTMENT * MainApartment
Definition: compobj.c:54
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION csApartment
Definition: compobj.c:57
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
GLuint64EXT * result
Definition: glext.h:11304
static void apartment_freeunusedlibraries ( struct apartment apt,
DWORD  delay 
)
static

Definition at line 1078 of file compobj.c.

Referenced by apartment_release(), and CoFreeUnusedLibrariesEx().

1079 {
1080  struct apartment_loaded_dll *entry, *next;
1081  EnterCriticalSection(&apt->cs);
1082  LIST_FOR_EACH_ENTRY_SAFE(entry, next, &apt->loaded_dlls, struct apartment_loaded_dll, entry)
1083  {
1084  if (entry->dll->DllCanUnloadNow && (entry->dll->DllCanUnloadNow() == S_OK))
1085  {
1086  DWORD real_delay = delay;
1087 
1088  if (real_delay == INFINITE)
1089  {
1090  /* DLLs that return multi-threaded objects aren't unloaded
1091  * straight away to cope for programs that have races between
1092  * last object destruction and threads in the DLLs that haven't
1093  * finished, despite DllCanUnloadNow returning S_OK */
1094  if (entry->multi_threaded)
1095  real_delay = 10 * 60 * 1000; /* 10 minutes */
1096  else
1097  real_delay = 0;
1098  }
1099 
1100  if (!real_delay || (entry->unload_time && ((int)(GetTickCount() - entry->unload_time) > 0)))
1101  {
1102  list_remove(&entry->entry);
1104  HeapFree(GetProcessHeap(), 0, entry);
1105  }
1106  else
1107  {
1108  entry->unload_time = GetTickCount() + real_delay;
1109  if (!entry->unload_time) entry->unload_time = 1;
1110  }
1111  }
1112  else if (entry->unload_time)
1113  entry->unload_time = 0;
1114  }
1115  LeaveCriticalSection(&apt->cs);
1116 }
#define TRUE
Definition: types.h:120
uint8_t entry
Definition: isohybrid.c:63
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
DllCanUnloadNowFunc DllCanUnloadNow
Definition: compobj.c:435
DWORD DWORD
Definition: winlogon.h:75
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define GetProcessHeap()
Definition: compat.h:395
struct list entry
Definition: compobj.c:452
static void COMPOBJ_DllList_ReleaseRef(OpenDll *entry, BOOL free_entry)
Definition: compobj.c:558
void delay(unsigned msec)
Definition: i386rtl.c:32
struct list loaded_dlls
#define S_OK
Definition: intsafe.h:59
static unsigned __int64 next
Definition: rand_nt.c:6
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define INFINITE
Definition: serial.h:102
CRITICAL_SECTION cs
#define HeapFree(x, y, z)
Definition: compat.h:394
static APARTMENT* apartment_get_or_create ( DWORD  model)
static

Definition at line 645 of file compobj.c.

Referenced by CoInitializeEx().

646 {
647  APARTMENT *apt = COM_CurrentApt();
648 
649  if (!apt)
650  {
652  {
654 
655  apt = apartment_construct(model);
656  if (!MainApartment)
657  {
658  MainApartment = apt;
659  apt->main = TRUE;
660  TRACE("Created main-threaded apartment with OXID %s\n", wine_dbgstr_longlong(apt->oxid));
661  }
662 
664 
665  if (apt->main)
667  }
668  else
669  {
671 
672  /* The multi-threaded apartment (MTA) contains zero or more threads interacting
673  * with free threaded (ie thread safe) COM objects. There is only ever one MTA
674  * in a process */
675  if (MTA)
676  {
677  TRACE("entering the multithreaded apartment %s\n", wine_dbgstr_longlong(MTA->oxid));
679  }
680  else
682 
683  apt = MTA;
684 
686  }
687  COM_CurrentInfo()->apt = apt;
688  }
689 
690  return apt;
691 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:594
#define TRUE
Definition: types.h:120
HRESULT apartment_createwindowifneeded(struct apartment *apt)
Definition: compobj.c:1670
static APARTMENT * apartment_construct(DWORD model)
Definition: compobj.c:603
static APARTMENT * MainApartment
Definition: compobj.c:54
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static struct oletls * COM_CurrentInfo(void)
static APARTMENT * COM_CurrentApt(void)
static APARTMENT * MTA
Definition: compobj.c:53
#define TRACE(s)
Definition: solgame.cpp:4
static CRITICAL_SECTION csApartment
Definition: compobj.c:57
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
const XML_Char XML_Content * model
Definition: expat.h:151
static HRESULT apartment_getclassobject ( struct apartment apt,
LPCWSTR  dllpath,
BOOL  apartment_threaded,
REFCLSID  rclsid,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1303 of file compobj.c.

Referenced by apartment_hostobject(), and get_inproc_class_object().

1306 {
1307  static const WCHAR wszOle32[] = {'o','l','e','3','2','.','d','l','l',0};
1308  HRESULT hr = S_OK;
1309  BOOL found = FALSE;
1311 
1312  if (!strcmpiW(dllpath, wszOle32))
1313  {
1314  /* we don't need to control the lifetime of this dll, so use the local
1315  * implementation of DllGetClassObject directly */
1316  TRACE("calling ole32!DllGetClassObject\n");
1317  hr = DllGetClassObject(rclsid, riid, ppv);
1318 
1319  if (hr != S_OK)
1320  ERR("DllGetClassObject returned error 0x%08x\n", hr);
1321 
1322  return hr;
1323  }
1324 
1325  EnterCriticalSection(&apt->cs);
1326 
1327  LIST_FOR_EACH_ENTRY(apartment_loaded_dll, &apt->loaded_dlls, struct apartment_loaded_dll, entry)
1328  if (!strcmpiW(dllpath, apartment_loaded_dll->dll->library_name))
1329  {
1330  TRACE("found %s already loaded\n", debugstr_w(dllpath));
1331  found = TRUE;
1332  break;
1333  }
1334 
1335  if (!found)
1336  {
1337  apartment_loaded_dll = HeapAlloc(GetProcessHeap(), 0, sizeof(*apartment_loaded_dll));
1338  if (!apartment_loaded_dll)
1339  hr = E_OUTOFMEMORY;
1340  if (SUCCEEDED(hr))
1341  {
1342  apartment_loaded_dll->unload_time = 0;
1343  apartment_loaded_dll->multi_threaded = FALSE;
1344  hr = COMPOBJ_DllList_Add( dllpath, &apartment_loaded_dll->dll );
1345  if (FAILED(hr))
1346  HeapFree(GetProcessHeap(), 0, apartment_loaded_dll);
1347  }
1348  if (SUCCEEDED(hr))
1349  {
1350  TRACE("added new loaded dll %s\n", debugstr_w(dllpath));
1351  list_add_tail(&apt->loaded_dlls, &apartment_loaded_dll->entry);
1352  }
1353  }
1354 
1355  LeaveCriticalSection(&apt->cs);
1356 
1357  if (SUCCEEDED(hr))
1358  {
1359  /* one component being multi-threaded overrides any number of
1360  * apartment-threaded components */
1361  if (!apartment_threaded)
1362  apartment_loaded_dll->multi_threaded = TRUE;
1363 
1364  TRACE("calling DllGetClassObject %p\n", apartment_loaded_dll->dll->DllGetClassObject);
1365  /* OK: get the ClassObject */
1366  hr = apartment_loaded_dll->dll->DllGetClassObject(rclsid, riid, ppv);
1367 
1368  if (hr != S_OK)
1369  ERR("DllGetClassObject returned error 0x%08x\n", hr);
1370  }
1371 
1372  return hr;
1373 }
#define TRUE
Definition: types.h:120
__wchar_t WCHAR
Definition: xmlstorage.h:180
REFIID riid
Definition: precomp.h:44
uint8_t entry
Definition: isohybrid.c:63
static HRESULT COMPOBJ_DllList_Add(LPCWSTR library_name, OpenDll **ret)
Definition: compobj.c:483
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: shsvcs.c:38
static HMODULE dll
Definition: str.c:188
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:704
LONG HRESULT
Definition: typedefs.h:77
struct list entry
Definition: compobj.c:452
struct list loaded_dlls
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
CRITICAL_SECTION cs
#define HeapFree(x, y, z)
Definition: compat.h:394
#define SUCCEEDED(hr)
Definition: intsafe.h:57
DllGetClassObjectFunc DllGetClassObject
Definition: compobj.c:434
HWND apartment_getwindow ( const struct apartment apt)

Definition at line 1699 of file compobj.c.

Referenced by apartment_hostobject_in_hostapt(), apartment_hostobject_thread(), ClientRpcChannelBuffer_GetBuffer(), and dispatch_rpc().

1700 {
1701  assert(!apt->multi_threaded);
1702  return apt->win;
1703 }
BOOL multi_threaded
#define assert(x)
Definition: debug.h:53
static HRESULT apartment_hostobject ( struct apartment apt,
const struct host_object_params params 
)
static

Definition at line 1434 of file compobj.c.

Referenced by apartment_hostobject_thread(), and apartment_wndproc().

1436 {
1437  IUnknown *object;
1438  HRESULT hr;
1439  static const LARGE_INTEGER llZero;
1440  WCHAR dllpath[MAX_PATH+1];
1441 
1442  TRACE("clsid %s, iid %s\n", debugstr_guid(&params->clsid), debugstr_guid(&params->iid));
1443 
1444  if (COM_RegReadPath(&params->regdata, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS)
1445  {
1446  /* failure: CLSID is not found in registry */
1447  WARN("class %s not registered inproc\n", debugstr_guid(&params->clsid));
1448  return REGDB_E_CLASSNOTREG;
1449  }
1450 
1451  hr = apartment_getclassobject(apt, dllpath, params->apartment_threaded,
1452  &params->clsid, &params->iid, (void **)&object);
1453  if (FAILED(hr))
1454  return hr;
1455 
1456  hr = CoMarshalInterface(params->stream, &params->iid, object, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1457  if (FAILED(hr))
1458  IUnknown_Release(object);
1459  IStream_Seek(params->stream, llZero, STREAM_SEEK_SET, NULL);
1460 
1461  return hr;
1462 }
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WARN(fmt,...)
Definition: debug.h:111
static HRESULT apartment_getclassobject(struct apartment *apt, LPCWSTR dllpath, BOOL apartment_threaded, REFCLSID rclsid, REFIID riid, void **ppv)
Definition: compobj.c:1303
static DWORD COM_RegReadPath(const struct class_reg_data *regdata, WCHAR *dst, DWORD dstlen)
Definition: compobj.c:1380
smooth NULL
Definition: ftsmooth.c:557
static const LARGE_INTEGER llZero
Definition: moniker.c:1119
#define debugstr_guid
Definition: kernel32.h:35
BOOL apartment_threaded
Definition: compobj.c:1431
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
#define ARRAYSIZE(array)
Definition: compobj.c:47
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
struct class_reg_data regdata
Definition: compobj.c:1425
HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:1693
void * object
Definition: jmemsys.h:48
IStream * stream
Definition: compobj.c:1430
static HRESULT apartment_hostobject_in_hostapt ( struct apartment apt,
BOOL  multi_threaded,
BOOL  main_apartment,
const struct class_reg_data regdata,
REFCLSID  rclsid,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1539 of file compobj.c.

Referenced by get_inproc_class_object().

1542 {
1543  struct host_object_params params;
1544  HWND apartment_hwnd = NULL;
1545  DWORD apartment_tid = 0;
1546  HRESULT hr;
1547 
1548  if (!multi_threaded && main_apartment)
1549  {
1550  APARTMENT *host_apt = apartment_findmain();
1551  if (host_apt)
1552  {
1553  apartment_hwnd = apartment_getwindow(host_apt);
1554  apartment_release(host_apt);
1555  }
1556  }
1557 
1558  if (!apartment_hwnd)
1559  {
1560  EnterCriticalSection(&apt->cs);
1561 
1562  if (!apt->host_apt_tid)
1563  {
1564  struct host_thread_params thread_params;
1565  HANDLE handles[2];
1566  DWORD wait_value;
1567 
1568  thread_params.threading_model = multi_threaded ? COINIT_MULTITHREADED : COINIT_APARTMENTTHREADED;
1569  handles[0] = thread_params.ready_event = CreateEventW(NULL, FALSE, FALSE, NULL);
1570  thread_params.apartment_hwnd = NULL;
1571  handles[1] = CreateThread(NULL, 0, apartment_hostobject_thread, &thread_params, 0, &apt->host_apt_tid);
1572  if (!handles[1])
1573  {
1574  CloseHandle(handles[0]);
1575  LeaveCriticalSection(&apt->cs);
1576  return E_OUTOFMEMORY;
1577  }
1578  wait_value = WaitForMultipleObjects(2, handles, FALSE, INFINITE);
1579  CloseHandle(handles[0]);
1580  CloseHandle(handles[1]);
1581  if (wait_value == WAIT_OBJECT_0)
1582  apt->host_apt_hwnd = thread_params.apartment_hwnd;
1583  else
1584  {
1585  LeaveCriticalSection(&apt->cs);
1586  return E_OUTOFMEMORY;
1587  }
1588  }
1589 
1590  if (multi_threaded || !main_apartment)
1591  {
1592  apartment_hwnd = apt->host_apt_hwnd;
1593  apartment_tid = apt->host_apt_tid;
1594  }
1595 
1596  LeaveCriticalSection(&apt->cs);
1597  }
1598 
1599  /* another thread may have become the main apartment in the time it took
1600  * us to create the thread for the host apartment */
1601  if (!apartment_hwnd && !multi_threaded && main_apartment)
1602  {
1603  APARTMENT *host_apt = apartment_findmain();
1604  if (host_apt)
1605  {
1606  apartment_hwnd = apartment_getwindow(host_apt);
1607  apartment_release(host_apt);
1608  }
1609  }
1610 
1611  params.regdata = *regdata;
1612  params.clsid = *rclsid;
1613  params.iid = *riid;
1614  hr = CreateStreamOnHGlobal(NULL, TRUE, &params.stream);
1615  if (FAILED(hr))
1616  return hr;
1617  params.apartment_threaded = !multi_threaded;
1618  if (multi_threaded)
1619  {
1620  params.hr = S_OK;
1621  params.event = CreateEventW(NULL, FALSE, FALSE, NULL);
1622  if (!PostThreadMessageW(apartment_tid, DM_HOSTOBJECT, 0, (LPARAM)&params))
1623  hr = E_OUTOFMEMORY;
1624  else
1625  {
1626  WaitForSingleObject(params.event, INFINITE);
1627  hr = params.hr;
1628  }
1629  CloseHandle(params.event);
1630  }
1631  else
1632  {
1633  if (!apartment_hwnd)
1634  {
1635  ERR("host apartment didn't create window\n");
1636  hr = E_OUTOFMEMORY;
1637  }
1638  else
1639  hr = SendMessageW(apartment_hwnd, DM_HOSTOBJECT, 0, (LPARAM)&params);
1640  }
1641  if (SUCCEEDED(hr))
1642  hr = CoUnmarshalInterface(params.stream, riid, ppv);
1643  IStream_Release(params.stream);
1644  return hr;
1645 }
DWORD host_apt_tid
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1807
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
REFIID riid
Definition: precomp.h:44
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1118
#define DM_HOSTOBJECT
HANDLE HWND
Definition: compat.h:13
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
Definition: synch.c:151
DWORD DWORD
Definition: winlogon.h:75
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HWND host_apt_hwnd
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FALSE
Definition: types.h:117
GLenum const GLfloat * params
Definition: glext.h:5645
LONG_PTR LPARAM
Definition: windef.h:231
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
#define WAIT_OBJECT_0
Definition: winbase.h:378
static object_header_t ** handles
Definition: handle.c:34
LONG HRESULT
Definition: typedefs.h:77
HWND apartment_getwindow(const struct apartment *apt)
Definition: compobj.c:1699
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
DWORD *typedef HANDLE
Definition: winlogon.h:52
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static DWORD CALLBACK apartment_hostobject_thread(LPVOID p)
Definition: compobj.c:1487
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define INFINITE
Definition: serial.h:102
CRITICAL_SECTION cs
BOOL WINAPI PostThreadMessageW(_In_ DWORD, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static APARTMENT * apartment_findmain(void)
Definition: compobj.c:1262
static DWORD CALLBACK apartment_hostobject_thread ( LPVOID  p)
static

Definition at line 1487 of file compobj.c.

Referenced by apartment_hostobject_in_hostapt().

1488 {
1489  struct host_thread_params *params = p;
1490  MSG msg;
1491  HRESULT hr;
1492  struct apartment *apt;
1493 
1494  TRACE("\n");
1495 
1496  hr = CoInitializeEx(NULL, params->threading_model);
1497  if (FAILED(hr)) return hr;
1498 
1499  apt = COM_CurrentApt();
1501  {
1503  params->apartment_hwnd = apartment_getwindow(apt);
1504  }
1505  else
1506  params->apartment_hwnd = NULL;
1507 
1508  /* force the message queue to be created before signaling parent thread */
1510 
1511  SetEvent(params->ready_event);
1512  params = NULL; /* can't touch params after here as it may be invalid */
1513 
1514  while (GetMessageW(&msg, NULL, 0, 0))
1515  {
1516  if (!msg.hwnd && (msg.message == DM_HOSTOBJECT))
1517  {
1518  struct host_object_params *obj_params = (struct host_object_params *)msg.lParam;
1519  obj_params->hr = apartment_hostobject(apt, obj_params);
1520  SetEvent(obj_params->event);
1521  }
1522  else
1523  {
1524  TranslateMessage(&msg);
1525  DispatchMessageW(&msg);
1526  }
1527  }
1528 
1529  TRACE("exiting\n");
1530 
1531  CoUninitialize();
1532 
1533  return S_OK;
1534 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
HRESULT apartment_createwindowifneeded(struct apartment *apt)
Definition: compobj.c:1670
#define DM_HOSTOBJECT
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
COINIT threading_model
Definition: compobj.c:1480
static APARTMENT * COM_CurrentApt(void)
#define PM_NOREMOVE
Definition: winuser.h:1171
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
GLenum const GLfloat * params
Definition: glext.h:5645
smooth NULL
Definition: ftsmooth.c:557
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HWND apartment_getwindow(const struct apartment *apt)
Definition: compobj.c:1699
HANDLE ready_event
Definition: compobj.c:1481
#define WM_USER
Definition: winuser.h:1846
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1944
static HRESULT apartment_hostobject(struct apartment *apt, const struct host_object_params *params)
Definition: compobj.c:1434
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:1870
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
GLfloat GLfloat p
Definition: glext.h:8902
static BOOL apartment_is_model ( const APARTMENT apt,
DWORD  model 
)
inlinestatic

Definition at line 693 of file compobj.c.

Referenced by CoInitializeEx().

694 {
695  return (apt->multi_threaded == !(model & COINIT_APARTMENTTHREADED));
696 }
BOOL multi_threaded
const XML_Char XML_Content * model
Definition: expat.h:151
void apartment_joinmta ( void  )

Definition at line 1705 of file compobj.c.

Referenced by dispatch_rpc().

1706 {
1708  COM_CurrentInfo()->apt = MTA;
1709 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:594
static struct oletls * COM_CurrentInfo(void)
static APARTMENT * MTA
Definition: compobj.c:53
DWORD apartment_release ( struct apartment apt)

Definition at line 1118 of file compobj.c.

Referenced by apartment_hostobject_in_hostapt(), ClientRpcChannelBuffer_GetBuffer(), CoCreateInstanceEx(), CoGetClassObject(), CoGetContextToken(), COM_TlsDestroy(), CoUninitialize(), dispatch_rpc(), ipid_get_dispatch_params(), ipid_to_stub_manager(), RemUnknown_RemAddRef(), RemUnknown_RemQueryInterface(), RemUnknown_RemRelease(), StdMarshalImpl_ReleaseMarshalData(), and StdMarshalImpl_UnmarshalInterface().

1119 {
1120  DWORD ret;
1121 
1123 
1124  ret = InterlockedDecrement(&apt->refs);
1125  TRACE("%s: after = %d\n", wine_dbgstr_longlong(apt->oxid), ret);
1126  /* destruction stuff that needs to happen under csApartment CS */
1127  if (ret == 0)
1128  {
1129  if (apt == MTA) MTA = NULL;
1130  else if (apt == MainApartment) MainApartment = NULL;
1131  list_remove(&apt->entry);
1132  }
1133 
1135 
1136  if (ret == 0)
1137  {
1138  struct list *cursor, *cursor2;
1139 
1140  TRACE("destroying apartment %p, oxid %s\n", apt, wine_dbgstr_longlong(apt->oxid));
1141 
1142  if(apt->local_server) {
1145 
1146  memset(&zero, 0, sizeof(zero));
1147  IStream_Seek(local_server->marshal_stream, zero, STREAM_SEEK_SET, NULL);
1148  CoReleaseMarshalData(local_server->marshal_stream);
1149  IStream_Release(local_server->marshal_stream);
1150  local_server->marshal_stream = NULL;
1151 
1152  apt->local_server = NULL;
1153  local_server->apt = NULL;
1154  IServiceProvider_Release(&local_server->IServiceProvider_iface);
1155  }
1156 
1157  /* Release the references to the registered class objects */
1158  COM_RevokeAllClasses(apt);
1159 
1160  /* no locking is needed for this apartment, because no other thread
1161  * can access it at this point */
1162 
1164 
1165  if (apt->win) DestroyWindow(apt->win);
1166  if (apt->host_apt_tid) PostThreadMessageW(apt->host_apt_tid, WM_QUIT, 0, 0);
1167 
1168  LIST_FOR_EACH_SAFE(cursor, cursor2, &apt->stubmgrs)
1169  {
1170  struct stub_manager *stubmgr = LIST_ENTRY(cursor, struct stub_manager, entry);
1171  /* release the implicit reference given by the fact that the
1172  * stub has external references (it must do since it is in the
1173  * stub manager list in the apartment and all non-apartment users
1174  * must have a ref on the apartment and so it cannot be destroyed).
1175  */
1176  stub_manager_int_release(stubmgr);
1177  }
1178 
1179  /* if this assert fires, then another thread took a reference to a
1180  * stub manager without taking a reference to the containing
1181  * apartment, which it must do. */
1182  assert(list_empty(&apt->stubmgrs));
1183 
1184  if (apt->filter) IMessageFilter_Release(apt->filter);
1185 
1186  /* free as many unused libraries as possible... */
1188 
1189  /* ... and free the memory for the apartment loaded dll entry and
1190  * release the dll list reference without freeing the library for the
1191  * rest */
1192  while ((cursor = list_head(&apt->loaded_dlls)))
1193  {
1194  struct apartment_loaded_dll *apartment_loaded_dll = LIST_ENTRY(cursor, struct apartment_loaded_dll, entry);
1195  COMPOBJ_DllList_ReleaseRef(apartment_loaded_dll->dll, FALSE);
1196  list_remove(cursor);
1197  HeapFree(GetProcessHeap(), 0, apartment_loaded_dll);
1198  }
1199 
1201  DeleteCriticalSection(&apt->cs);
1202 
1203  HeapFree(GetProcessHeap(), 0, apt);
1204  }
1205 
1206  return ret;
1207 }
HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
Definition: marshal.c:1876
DWORD host_apt_tid
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
Definition: list.h:192
static void apartment_freeunusedlibraries(struct apartment *apt, DWORD delay)
Definition: compobj.c:1078
IStream * marshal_stream
Definition: compobj.c:171
ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN
Definition: stubmanager.c:296
uint8_t entry
Definition: isohybrid.c:63
static APARTMENT * MainApartment
Definition: compobj.c:54
#define WM_QUIT
Definition: winuser.h:1595
#define assert(x)
Definition: debug.h:53
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
BOOL WINAPI DestroyWindow(_In_ HWND)
DWORD DWORD
Definition: winlogon.h:75
IServiceProvider IServiceProvider_iface
Definition: compobj.c:168
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
#define FALSE
Definition: types.h:117
#define DEBUG_CLEAR_CRITSEC_NAME(cs)
static APARTMENT * MTA
Definition: compobj.c:53
smooth NULL
Definition: ftsmooth.c:557
LocalServer * local_server
static void COM_RevokeAllClasses(const struct apartment *apt)
Definition: compobj.c:709
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
static double zero
Definition: j0_y0.c:96
int ret
static void COMPOBJ_DllList_ReleaseRef(OpenDll *entry, BOOL free_entry)
Definition: compobj.c:558
#define InterlockedDecrement
Definition: armddk.h:52
struct list loaded_dlls
static CRITICAL_SECTION csApartment
Definition: compobj.c:57
Definition: _list.h:228
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
HRESULT apartment_disconnectproxies(struct apartment *apt) DECLSPEC_HIDDEN
Definition: marshal.c:1124
const char cursor[]
Definition: icontest.c:13
struct list entry
APARTMENT * apt
Definition: compobj.c:170
LPMESSAGEFILTER filter
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
struct list stubmgrs
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
CRITICAL_SECTION cs
#define memset(x, y, z)
Definition: compat.h:39
BOOL WINAPI PostThreadMessageW(_In_ DWORD, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HeapFree(x, y, z)
Definition: compat.h:394
static LRESULT CALLBACK apartment_wndproc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1464 of file compobj.c.

Referenced by register_class().

1465 {
1466  switch (msg)
1467  {
1468  case DM_EXECUTERPC:
1470  return 0;
1471  case DM_HOSTOBJECT:
1472  return apartment_hostobject(COM_CurrentApt(), (const struct host_object_params *)lParam);
1473  default:
1474  return DefWindowProcW(hWnd, msg, wParam, lParam);
1475  }
1476 }
#define DM_HOSTOBJECT
HWND hWnd
Definition: settings.c:17
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static APARTMENT * COM_CurrentApt(void)
void RPC_ExecuteCall(struct dispatch_params *params) DECLSPEC_HIDDEN
Definition: rpc.c:1304
UINT WPARAM wParam
Definition: precomp.h:53
static HRESULT apartment_hostobject(struct apartment *apt, const struct host_object_params *params)
Definition: compobj.c:1434
UINT WPARAM LPARAM lParam
Definition: precomp.h:53
UINT msg
Definition: msvc.h:92
#define DM_EXECUTERPC
static HRESULT clsid_from_string_reg ( LPCOLESTR  progid,
CLSID clsid 
)
static

Definition at line 2155 of file compobj.c.

Referenced by CLSIDFromProgID(), and CLSIDFromString().

2156 {
2157  static const WCHAR clsidW[] = { '\\','C','L','S','I','D',0 };
2158  WCHAR buf2[CHARS_IN_GUID];
2159  LONG buf2len = sizeof(buf2);
2160  HKEY xhkey;
2161  WCHAR *buf;
2162 
2163  memset(clsid, 0, sizeof(*clsid));
2164  buf = HeapAlloc( GetProcessHeap(),0,(strlenW(progid)+8) * sizeof(WCHAR) );
2165  if (!buf) return E_OUTOFMEMORY;
2166  strcpyW( buf, progid );
2167  strcatW( buf, clsidW );
2169  {
2170  HeapFree(GetProcessHeap(),0,buf);
2171  WARN("couldn't open key for ProgID %s\n", debugstr_w(progid));
2172  return CO_E_CLASSSTRING;
2173  }
2174  HeapFree(GetProcessHeap(),0,buf);
2175 
2176  if (RegQueryValueW(xhkey,NULL,buf2,&buf2len))
2177  {
2178  RegCloseKey(xhkey);
2179  WARN("couldn't query clsid value for ProgID %s\n", debugstr_w(progid));
2180  return CO_E_CLASSSTRING;
2181  }
2182  RegCloseKey(xhkey);
2183  return guid_from_string(buf2, clsid) ? S_OK : CO_E_CLASSSTRING;
2184 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static BOOL guid_from_string(LPCWSTR s, GUID *id)
Definition: compobj.c:2103
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WARN(fmt,...)
Definition: debug.h:111
#define CHARS_IN_GUID
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:557
static const WCHAR clsidW[]
Definition: actctx.c:592
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HANDLE HKEY
Definition: registry.h:24
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4272
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
LSTATUS open_classes_key(HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey)
Definition: compobj.c:397
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
#define progid(str)
Definition: exdisp.idl:31
#define CO_E_CLASSSTRING
Definition: winerror.h:2806
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:394
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID ( LPCOLESTR  progid,
LPCLSID  clsid 
)

Definition at line 2467 of file compobj.c.

Referenced by call_script(), CLSIDFromProgIDEx(), create_activex_object(), create_object(), get_content_type(), get_engine_clsid(), get_guid_from_language(), get_moniker_for_progid_display_name(), GetClassFile(), Host_CreateObject(), MkProtocol_StartEx(), OLECONVERT_CreateCompObjStream(), run_script(), START_TEST(), test_CLSIDFromProgID(), and test_IWinHttpRequest_Invoke().

2468 {
2469  ACTCTX_SECTION_KEYED_DATA data;
2470 
2471  if (!progid || !clsid)
2472  return E_INVALIDARG;
2473 
2474  data.cbSize = sizeof(data);
2475  if (FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION,
2476  progid, &data))
2477  {
2478  struct progidredirect_data *progiddata = (struct progidredirect_data*)data.lpData;
2479  CLSID *alias = (CLSID*)((BYTE*)data.lpSectionBase + progiddata->clsid_offset);
2480  *clsid = *alias;
2481  return S_OK;
2482  }
2483 
2484  return clsid_from_string_reg(progid, clsid);
2485 }
static HRESULT clsid_from_string_reg(LPCOLESTR progid, CLSID *clsid)
Definition: compobj.c:2155
BOOL WINAPI FindActCtxSectionStringW(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, LPCWSTR lpSearchStr, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:156
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
const WCHAR * alias
Definition: main.c:67
unsigned char BYTE
Definition: ntddk_ex.h:96
#define S_OK
Definition: intsafe.h:59
#define progid(str)
Definition: exdisp.idl:31
HRESULT WINAPI CLSIDFromProgIDEx ( LPCOLESTR  progid,
LPCLSID  clsid 
)

Definition at line 2490 of file compobj.c.

2491 {
2492  FIXME("%s,%p: semi-stub\n", debugstr_w(progid), clsid);
2493 
2494  return CLSIDFromProgID(progid, clsid);
2495 }
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2467
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define progid(str)
Definition: exdisp.idl:31
HRESULT WINAPI CLSIDFromString ( LPCOLESTR  idstr,
LPCLSID  id 
)

Definition at line 2203 of file compobj.c.

Referenced by ACTION_MsiPublishAssemblies(), ACTION_PublishFeatures(), build_directshowfilters_tree(), CategoryMgr_FindClosestCategory(), CATIDEnumGUID_Next(), CLSIDEnumGUID_Next(), CLSIDFromStringWrap(), CoGetTreatAsClass(), COMCAT_IEnumCATEGORYINFO_Next(), ComponentInfo_GetGuidList(), ComponentInfo_GetGUIDValue(), CoTreatAsClass(), CreateComponentEnumerator(), CreateNotificationObject(), DEVENUM_IMediaCatMoniker_BindToObject(), DEVENUM_IParseDisplayName_ParseDisplayName(), DEVENUM_ReadPinTypes(), DEVENUM_RegisterLegacyAmFilters(), DirectPlayEnumerateAW(), do_enum(), DP_LoadSP(), EnumClientServiceProtocol(), CDefaultContextMenu::EnumerateDynamicContextHandlerForKey(), CNetConnectionManager::EnumerateINetConnections(), EnumerateNetworkAdapter(), EnumTfLanguageProfiles_Next(), FilterMapper3_EnumMatchingFilters(), FilterMapper_EnumMatchingFilters(), get_content_type(), get_mime_clsid(), get_mime_filter(), get_protocol_cf(), get_ps_clsid_from_registry(), GetClassMediaFile(), GetCLSIDForFileType(), GetFilterInfo(), CQueryAssociations::GetString(), GUIDFromStringA(), GUIDFromStringW(), IDirectMusic8Impl_GetDefaultPort(), IDirectPlay4AImpl_EnumConnections(), IDirectPlayLobby3AImpl_EnumAddressTypes(), IDirectPlayLobby3AImpl_EnumLocalApplications(), IEnumDMO_fnNext(), InitIconOverlays(), InitShellServices(), InputProcessorProfiles_GetDefaultLanguageProfile(), InternetProtocolSink_ReportProgress(), IsProductCode(), ITERATE_RegisterTypeLibraries(), ITERATE_UnregisterTypeLibraries(), load_devices_from_reg(), MMDevPropStore_GetAt(), msi_create_component_advertise_string(), next_LanguageProfile(), OleGetAutoConvert(), parse_classid(), process_extensions(), ProfilesEnumGuid_Next(), ATL::CRegKey::QueryGUIDValue(), read_types(), SSOThread::Run(), CShellLink::SetAdvertiseInfo(), CDeviceNode::SetupNode(), SHCLSIDFromStringA(), SHCLSIDFromStringW(), SHDOCVW_GetShellInstanceObjectClassObject(), SHELL32_GetCLSIDForDirectory(), ShellExecute_FromContextMenu(), CShellBrowser::ShowBrowserBar(), squash_guid(), statusclb_OnProgress(), test_CLSIDFromProgID(), test_CLSIDFromString(), test_first_device(), and UIINSERTOBJECTDLG_PopulateObjectTypes().

2204 {
2206  CLSID tmp_id;
2207 
2208  if (!id)
2209  return E_INVALIDARG;
2210 
2211  if (guid_from_string(idstr, id))
2212  return S_OK;
2213 
2214  /* It appears a ProgID is also valid */
2215  ret = clsid_from_string_reg(idstr, &tmp_id);
2216  if(SUCCEEDED(ret))
2217  *id = tmp_id;
2218 
2219  return ret;
2220 }
static HRESULT clsid_from_string_reg(LPCOLESTR progid, CLSID *clsid)
Definition: compobj.c:2155
static BOOL guid_from_string(LPCWSTR s, GUID *id)
Definition: compobj.c:2103
#define E_INVALIDARG
Definition: ddrawi.h:101
LONG HRESULT
Definition: typedefs.h:77
int ret
#define S_OK
Definition: intsafe.h:59
#define CO_E_CLASSSTRING
Definition: winerror.h:2806
#define SUCCEEDED(hr)
Definition: intsafe.h:57
ULONG WINAPI CoAddRefServerProcess ( void  )

Definition at line 4020 of file compobj.c.

Referenced by LockModuleOOP().

4021 {
4022  ULONG refs;
4023 
4024  TRACE("\n");
4025 
4029 
4030  TRACE("refs before: %d\n", refs - 1);
4031 
4032  return refs;
4033 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION csRegisteredClassList
Definition: compobj.c:205
#define TRACE(s)
Definition: solgame.cpp:4
static LONG s_COMServerProcessReferences
Definition: compobj.c:181
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
HRESULT WINAPI CoAllowSetForegroundWindow ( IUnknown pUnk,
void pvReserved 
)

Definition at line 4092 of file compobj.c.

4093 {
4094  FIXME("(%p, %p): stub\n", pUnk, pvReserved);
4095  return S_OK;
4096 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59
DWORD WINAPI CoBuildVersion ( void  )

Definition at line 1736 of file compobj.c.

1737 {
1738  TRACE("Returning version %d, build %d.\n", rmm, rup);
1739  return (rmm<<16)+rup;
1740 }
#define rmm
Definition: ole2ver.h:41
#define rup
Definition: ole2ver.h:42
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI CoCopyProxy ( IUnknown pProxy,
IUnknown **  ppCopy 
)

Definition at line 4204 of file compobj.c.

4205 {
4206  IClientSecurity *pCliSec;
4207  HRESULT hr;
4208 
4209  TRACE("%p\n", pProxy);
4210 
4211  hr = IUnknown_QueryInterface(pProxy, &IID_IClientSecurity, (void **)&pCliSec);
4212  if (SUCCEEDED(hr))
4213  {
4214  hr = IClientSecurity_CopyProxy(pCliSec, pProxy, ppCopy);
4215  IClientSecurity_Release(pCliSec);
4216  }
4217 
4218  if (FAILED(hr)) ERR("-- failed with 0x%08x\n", hr);
4219  return hr;
4220 }
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define ERR(fmt,...)
Definition: debug.h:109
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HRESULT WINAPI CoCreateGuid ( GUID pguid)

Definition at line 2071 of file compobj.c.

Referenced by BackgroundCopyJobConstructor(), COM_CurrentCausalityId(), compose_base85_guid(), create_test_guid(), do_msidbCustomActionTypeDll(), do_msidbCustomActionTypeScript(), DP_SetSessionDesc(), main(), test_ClientId(), test_CoCreateGuid(), test_fm2_enummatchingfilters(), test_legacy_filter_registration(), test_NewWorkItem(), test_register_filter_with_null_clsMinorType(), test_session(), test_session_creation(), test_TfGuidAtom(), test_volume_dependence(), and ThreadMgr_ActivateEx().

2072 {
2073  DWORD status;
2074 
2075  if(!pguid) return E_INVALIDARG;
2076 
2077  status = UuidCreate(pguid);
2078  if (status == RPC_S_OK || status == RPC_S_UUID_LOCAL_ONLY) return S_OK;
2079  return HRESULT_FROM_WIN32( status );
2080 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
DWORD DWORD
Definition: winlogon.h:75
#define E_INVALIDARG
Definition: ddrawi.h:101
#define S_OK
Definition: intsafe.h:59
RPC_STATUS WINAPI UuidCreate(UUID *Uuid)
Definition: rpcrt4_main.c:281
static SERVICE_STATUS status
Definition: service.c:26
#define RPC_S_UUID_LOCAL_ONLY
Definition: winerror.h:1131
#define RPC_S_OK
Definition: rpcnterr.h:22
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance ( REFCLSID  rclsid,
LPUNKNOWN  pUnkOuter,
DWORD  dwClsContext,
REFIID  iid,
LPVOID ppv 
)

Definition at line 3185 of file compobj.c.

Referenced by _CBandSite_CreateInstance(), _CBandSiteMenu_CreateInstance(), _create_object(), _CStartMenu_CreateInstance(), activate_given_ts(), add_favs_to_menu(), AMovieDllRegisterServer2(), AtlAxCreateControlLicEx(), AtlRegisterClassCategoriesHelper(), ATL::AtlRegisterClassCategoriesHelper(), AVIFileOpenW(), AVIMakeCompressedStream(), AVIStreamCreate(), BaseOutputPinImpl_InitAllocator(), build_directshowfilters_tree(), cache_InstallAssembly(), cache_UninstallAssembly(), CAddressBand_CreateInstance(), CAddressEditBox_CreateInstance(), call_script(), CBandProxy_CreateInstance(), CBrandBand_CreateInstance(), CExplorerBand_CreateInstance(), check_bits20(), check_bits25(), check_ie(), check_jscript(), check_lnk_(), check_tiff_format(), check_vbscript(), CInternetToolbar_CreateInstance(), CMenuBand_CreateInstance(), CMergedFolder_CreateInstance(), CNetworkConnections::CNetworkConnections(), CoGetInstanceFromFile(), CoGetInstanceFromIStorage(), CommitDecommitTest(), confirm_safety(), cp_from_charset_string(), create_ammultimediastream(), create_audio_data(), create_avisplitter(), create_configuration(), create_doc_from_url(), create_document(), create_dsound_renderer(), create_engine(), create_instance(), create_jscript(), create_lnk_(), create_mime_object(), create_mpeg_splitter(), create_path(), create_root_IDxDiagContainer(), create_script(), create_script_host(), create_session(), create_system_ports_list(), create_test(), create_vbscript(), create_video_renderer(), create_xhr(), CreateAndInitXMLDOMDocument(), CreateCShellMenu(), createfiltergraph(), CreateFilterInstanceAndLoadFile(), SIfacePtr< IShellLink >::CreateInstance(), CreateNotificationObject(), CInputPin::CreatePin(), COutputPin::CreatePin(), CreatePosPassThru(), CreateShellLink(), CreateShortcut(), D3DXGetImageInfoFromFileInMemory(), D3DXLoadSurfaceFromFileInMemory(), D3DXSaveSurfaceToFileInMemory(), DefaultHandler_Construct(), DefaultHandler_Run(), determine_patch_sequence(), DEVENUM_CreateSpecialCategories(), DEVENUM_IMediaCatMoniker_BindToObject(), DEVENUM_RegisterLegacyAmFilters(), device_tests(), DI8CF_CreateInstance(), DirectInput8Create(), DllRegisterServer(), do_child(), do_enum(), CShellBrowser::DoFolderOptions(), DragSourceHelper::DragSourceHelper(), ebrowser_instantiate(), EnumConnections_cb(), FileAsyncReader_RequestAllocator(), FileMonikerImpl_BindToObject(), fill_filter_data_information(), fill_processor_information(), FilterGraph2_SetDefaultSyncSource(), FilterGraph_create(), FilterMapper3_EnumMatchingFilters(), FilterMapper3_GetICreateDevEnum(), FilterMapper3_RegisterFilter(), get_class_support_data(), get_component_info(), get_mime_filter(), get_mlang(), BtrfsContextMenu::get_uac_icon(), get_unmarshaler_from_stream(), GetExeFromLnk(), GetFileSourceFilter(), GetSplitter(), getstring_test(), hlink_frame_navigate(), HlinkCreateBrowseContext(), HlinkCreateFromMoniker(), HlinkCreateFromString(), Host_CreateObject(), IAMMultiMediaStreamImpl_AddMediaStream(), IAMMultiMediaStreamImpl_Initialize(), IDirectSound8_tests(), IDirectSound_tests(), IDirectSoundFullDuplex_tests(), IDropTargetImpl::IDropTargetImpl(), init_explorerbrowser(), init_TCPIP_provider(), initialize(), CNetConnectionPropertyUi::InitializeLANPropertiesUIDlg(), InitializeObjectPicker(), InitializeRemoteRegistryPicker(), InitializeSecurity(), InitIconOverlays(), CSysTray::InitNetShell(), InitShellServices(), InstanceObjectFactory_IClassFactory_CreateInstance(), CBandSiteMenu::InvokeCommand(), is_firewall_enabled(), ITERATE_CreateShortcuts(), ITypeInfo_fnCreateInstance(), CComCatCachedCategory::LoadFromComCatMgr(), CShellBrowser::LoadHistory(), CInputPin::LoadProxyPlugins(), COutputPin::LoadProxyPlugins(), CKsProxy::LoadProxyPlugins(), LoadShellLinkConsoleInfo(), locator_ConnectServer(), MCIQTZ_mciOpen(), MediaDet_put_Filename(), MkProtocol_StartEx(), MMDevice_Activate(), MsiGetShortcutTargetW(), navigate_new_window(), OleCreate(), OleCreatePropertyFrameIndirect(), OleLoad(), OleLoadFromStream(), OLEPictureImpl_LoadWICDecoder(), CShellBrowser::OnSearch(), OpenCHM(), parse_config(), parse_path(), perform_test(), query_prop(), register_filters(), run_script(), SampleGrabber_create(), set_firewall(), setup(), setup_task(), setup_trigger(), SHAddToRecentDocs(), SHCoCreateInstance(), SHCoCreateInstanceAC(), SHCreatePropSheetExtArrayEx(), shellex_load_object_and_run(), SHFileOperationW(), SHLoadInProc(), CShellBrowser::ShowBand(), ShowNetConnectionProperties(), START_TEST(), synth_port_create(), test_ACListISF(), test_ACListISF_CURRENTDIR(), test_ACListISF_DESKTOP(), test_ACListISF_FAVORITES(), test_ACListISF_FILESYSDIRS(), test_ACListISF_FILESYSONLY(), test_ACListISF_MYCOMPUTER(), test_ACListISF_NONE(), test_ACLMulti(), test_Activate(), test_Add(), test_advise(), test_aggregate_filter_graph(), test_aggregate_filter_mapper(), test_aggregation(), test_AtlAxAttachControl(), test_bad_icondirentry_size(), test_basics(), test_CAccPropServices(), test_capture(), test_checklinkpath(), test_CoCreateInstance(), test_cocreateinstance_proxy(), test_CoFreeUnusedLibraries(), test_COM(), test_COM_dplobby(), test_COM_sg_enumpins(), test_COM_wavfile(), test_comparemode(), test_componentinfo(), test_create_decoder(), test_create_manager(), test_create_reader(), test_CreateBody(), test_createElement(), test_createfromstream(), test_CreateGroup(), test_CreateJob(), test_CreatePlayer(), test_CShellMenu_with_DeskBar(), test_customize(), test_datalink(), test_decode_1bpp(), test_decode_24bpp(), test_decode_4bpp(), test_decode_rle4(), test_decode_rle8(), test_default_converter(), test_default_handler(), test_default_handler_run(), test_default_properties(), test_devenum(), test_dispex(), test_domdoc(), test_dragdrophelper(), test_dsound(), test_dsound8(), test_early_abort(), test_empty_propertybag(), test_Enum(), test_EnumAddressTypes(), test_EnumConnections(), test_EnumGroups(), test_EnumGroupsInGroup(), test_EnumJobs(), test_EnumPlayers(), test_EnumSessions(), test_events(), test_Exists(), test_file_protocol_fail(), test_filename_opendlg_(), test_filename_savedlg_(), test_filesourcefilter(), test_filled_propertybag(), test_filter_graph2(), test_first_device(), test_fm2_enummatchingfilters(), test_FolderShortcut(), test_get_set(), test_GetCaps(), test_GetIconLocation(), test_GetMessageCount(), test_GetMessageQueue(), test_GetPlayerAccount(), test_GetPlayerAddress(), test_GetPlayerCaps(), test_GetPlayerFlags(), test_GetRootContainer(), test_GetTargetComputer(), test_gif_notrailer(), test_globalinterfacetable(), test_globalness(), test_GlobalOptions(), test_graph_builder(), test_graph_builder_addfilter(), test_GroupOwner(), test_groups_cs(), test_groups_p2p(), test_hash_value(), test_host_migration(), test_HTMLLoadOptions(), test_IClientSecurity(), test_iconlocation(), test_IEnumVARIANT(), test_ifiltermapper_from_filtergraph(), test_init(), test_Initialize(), test_InitializeConnection(), test_inmemorystore(), test_inproc_handler(), test_instantiation(), test_interfaces(), test_invalid_init(), test_IObjectSafety(), test_IPersistStream(), test_IProgressDialog_QueryInterface(), test_IQueryAssociations_GetString(), test_IQueryAssociations_Init(), test_IQueryAssociations_QueryInterface(), test_IReferenceClock_SystemClock(), test_Item(), test_items(), test_IWbemLocator(), test_IWinHttpRequest(), test_IWinHttpRequest_Invoke(), test_Keys(), test_knownFolders(), test_legacy_filter_registration(), test_Load(), test_local_server(), test_locator(), test_manualresetevent(), test_media_streams(), test_mediadet(), test_metadata_APE(), test_metadata_cHRM(), test_metadata_Exif(), test_metadata_gAMA(), test_metadata_GCE(), test_metadata_gif(), test_metadata_GIF_comment(), test_metadata_IFD(), test_metadata_IMD(), test_metadata_LSD(), test_metadata_png(), test_metadata_tEXt(), test_metadata_unknown(), test_mhtml_protocol_binding(), test_mhtml_protocol_info(), test_moniker_isequal(), test_multi_encoder(), test_mxattr_addAttribute(), test_mxattr_clear(), test_mxattr_dispex(), test_mxattr_localname(), test_mxattr_qi(), test_mxnamespacemanager(), test_mxnamespacemanager_override(), test_mxwriter_cdata(), test_mxwriter_characters(), test_mxwriter_comment(), test_mxwriter_default_properties(), test_mxwriter_dispex(), test_mxwriter_dtd(), test_mxwriter_encoding(), test_mxwriter_flush(), test_mxwriter_handlers(), test_mxwriter_ignorablespaces(), test_mxwriter_indent(), test_mxwriter_pi(), test_mxwriter_properties(), test_mxwriter_startenddocument(), test_mxwriter_startendelement(), test_mxwriter_startendelement_batch(), test_mxwriter_startendelement_batch2(), test_mxwriter_stream(), test_namespace(), test_namespaces_change(), test_NewWorkItem(), test_OleInitialize_InitCounting(), test_Open(), test_overwrite(), test_parse_filter_data(), test_ParseDisplayName(), test_ParseName(), test_persistent_state(), test_persistserialized(), test_persiststreaminit(), test_PlayerData(), test_PlayerName(), test_preinitialization(), test_printers_folder(), test_propertystore(), test_QueryInterface(), test_queryreader(), test_reader_info(), test_Receive(), test_RegExp(), test_register_filter_with_null_clsMinorType(), test_registrar(), test_registry(), test_remote_data_replication(), test_Remove(), test_render_filter_priority(), test_res_url(), test_RtlQueryPackageIdentity(), test_samplegrabber(), test_saxreader(), test_saxreader_dispex(), test_saxreader_encoding(), test_saxreader_features(), test_saxreader_properties(), test_Send(), test_service(), test_SessionDesc(), test_set_frame_palette(), test_SetData(), test_SetTargetComputer(), test_ShellExecute(), test_ShellWindows(), test_StdHlink(), test_StdURLMoniker(), test_stillimage_aggregation(), test_StreamOnMemory(), test_StreamOnStreamRange(), test_supporterrorinfo(), test_threads(), test_TreatAsClass(), test_try_xmldoc(), test_UninitializedUri(), test_Verbs(), test_whitespace(), test_wshshell(), test_xmldoc(), test_xmlelem(), test_xmlelem_children(), test_xmlelem_collection(), test_XPath(), test_xsltemplate(), TestDescription(), TestGetUIObjectOf(), TestInitialize(), TestModuleInterfaces(), TestUninitialized(), TransformFilter_Init(), unregister_filters(), WICCreateColorTransform_Proxy(), and WshShortcut_Create().

3191 {
3192  MULTI_QI multi_qi = { iid };
3193  HRESULT hres;
3194 
3195  TRACE("(rclsid=%s, pUnkOuter=%p, dwClsContext=%08x, riid=%s, ppv=%p)\n", debugstr_guid(rclsid),
3196  pUnkOuter, dwClsContext, debugstr_guid(iid), ppv);
3197 
3198  if (ppv==0)
3199  return E_POINTER;
3200 
3201  hres = CoCreateInstanceEx(rclsid, pUnkOuter, dwClsContext, NULL, 1, &multi_qi);
3202  *ppv = multi_qi.pItf;
3203  return hres;
3204 }
smooth NULL
Definition: ftsmooth.c:557
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:461
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
#define E_POINTER
Definition: winerror.h:2365
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx ( REFCLSID  rclsid,
LPUNKNOWN  pUnkOuter,
DWORD  dwClsContext,
COSERVERINFO pServerInfo,
ULONG  cmq,
MULTI_QI *  pResults 
)

Definition at line 3247 of file compobj.c.

Referenced by CoCreateInstance(), and test_CoCreateInstanceEx().

3254 {
3255  IUnknown *unk = NULL;
3256  IClassFactory *cf;
3257  APARTMENT *apt;
3258  CLSID clsid;
3259  HRESULT hres;
3260 
3261  TRACE("(%s %p %x %p %u %p)\n", debugstr_guid(rclsid), pUnkOuter, dwClsContext, pServerInfo, cmq, pResults);
3262 
3263  if (!cmq || !pResults)
3264  return E_INVALIDARG;
3265 
3266  if (pServerInfo)
3267  FIXME("() non-NULL pServerInfo not supported!\n");
3268 
3269  init_multi_qi(cmq, pResults, E_NOINTERFACE);
3270 
3271  hres = CoGetTreatAsClass(rclsid, &clsid);
3272  if(FAILED(hres))
3273  clsid = *rclsid;
3274 
3275  if (!(apt = COM_CurrentApt()))
3276  {
3277  if (!(apt = apartment_find_multi_threaded()))
3278  {
3279  ERR("apartment not initialised\n");
3280  return CO_E_NOTINITIALIZED;
3281  }
3282  apartment_release(apt);
3283  }
3284 
3285  /*
3286  * The Standard Global Interface Table (GIT) object is a process-wide singleton.
3287  */
3289  {
3291  TRACE("Retrieving GIT\n");
3292  return return_multi_qi((IUnknown*)git, cmq, pResults, FALSE);
3293  }
3294 
3295  if (IsEqualCLSID(&clsid, &CLSID_ManualResetEvent)) {
3296  hres = ManualResetEvent_Construct(pUnkOuter, pResults[0].pIID, (void**)&unk);
3297  if (FAILED(hres))
3298  return hres;
3299  return return_multi_qi(unk, cmq, pResults, TRUE);
3300  }
3301 
3302  /*
3303  * Get a class factory to construct the object we want.
3304  */
3305  hres = CoGetClassObject(&clsid, dwClsContext, NULL, &IID_IClassFactory, (void**)&cf);
3306  if (FAILED(hres))
3307  return hres;
3308 
3309  /*
3310  * Create the object and don't forget to release the factory
3311  */
3312  hres = IClassFactory_CreateInstance(cf, pUnkOuter, pResults[0].pIID, (void**)&unk);
3313  IClassFactory_Release(cf);
3314  if (FAILED(hres))
3315  {
3316  if (hres == CLASS_E_NOAGGREGATION && pUnkOuter)
3317  FIXME("Class %s does not support aggregation\n", debugstr_guid(&clsid));
3318  else
3319  FIXME("no instance created for interface %s of class %s, hres is 0x%08x\n",
3320  debugstr_guid(pResults[0].pIID),
3321  debugstr_guid(&clsid),hres);
3322  return hres;
3323  }
3324 
3325  return return_multi_qi(unk, cmq, pResults, TRUE);
3326 }
static IClassFactory * cf
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
static HRESULT return_multi_qi(IUnknown *unk, DWORD count, MULTI_QI *mqi, BOOL include_unk)
Definition: compobj.c:3217
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1118
#define CO_E_NOTINITIALIZED
const GUID IID_IClassFactory
static APARTMENT * COM_CurrentApt(void)
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:110
static HRESULT ManualResetEvent_Construct(IUnknown *punkouter, REFIID iid, void **ppv)
Definition: compobj.c:870
#define E_INVALIDARG
Definition: ddrawi.h:101
IGlobalInterfaceTable * get_std_git(void) DECLSPEC_HIDDEN
Definition: git.c:346
smooth NULL
Definition: ftsmooth.c:557
#define debugstr_guid
Definition: kernel32.h:35
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv)
Definition: compobj.c:2958
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:461
LONG HRESULT
Definition: typedefs.h:77
const CLSID CLSID_StdGlobalInterfaceTable
REFCLSID clsid
Definition: msctf.c:66
static APARTMENT * apartment_find_multi_threaded(void)
Definition: compobj.c:1279
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define ERR(fmt,...)
Definition: debug.h:109
const CLSID CLSID_ManualResetEvent
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:91
static void init_multi_qi(DWORD count, MULTI_QI *mqi, HRESULT hr)
Definition: compobj.c:3206
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID clsidNew)
Definition: compobj.c:3817
HRESULT WINAPI CoDisconnectObject ( LPUNKNOWN  lpUnk,
DWORD  reserved 
)

Definition at line 2017 of file compobj.c.

Referenced by local_server_GetClassID(), test_disconnect_stub(), and test_lock_object_external().

2018 {
2019  struct stub_manager *manager;
2020  HRESULT hr;
2021  IMarshal *marshal;
2022  APARTMENT *apt;
2023 
2024  TRACE("(%p, 0x%08x)\n", lpUnk, reserved);
2025 
2026  if (!lpUnk) return E_INVALIDARG;
2027 
2028  hr = IUnknown_QueryInterface(lpUnk, &IID_IMarshal, (void **)&marshal);
2029  if (hr == S_OK)
2030  {
2031  hr = IMarshal_DisconnectObject(marshal, reserved);
2032  IMarshal_Release(marshal);
2033  return hr;
2034  }
2035 
2036  apt = COM_CurrentApt();
2037  if (!apt)
2038  return CO_E_NOTINITIALIZED;
2039 
2040  manager = get_stub_manager_from_object(apt, lpUnk, FALSE);
2041  if (manager) {
2042  stub_manager_disconnect(manager);
2043  /* Release stub manager twice, to remove the apartment reference. */
2044  stub_manager_int_release(manager);
2045  stub_manager_int_release(manager);
2046  }
2047 
2048  /* Note: native is pretty broken here because it just silently
2049  * fails, without returning an appropriate error code if the object was
2050  * not found, making apps think that the object was disconnected, when
2051  * it actually wasn't */
2052 
2053  return S_OK;
2054 }
ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN
Definition: stubmanager.c:296
APARTMENT * apt
#define CO_E_NOTINITIALIZED
static APARTMENT * COM_CurrentApt(void)
#define FALSE
Definition: types.h:117
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
r reserved
Definition: btrfs.c:2594
void stub_manager_disconnect(struct stub_manager *m) DECLSPEC_HIDDEN
Definition: stubmanager.c:229
struct stub_manager * get_stub_manager_from_object(APARTMENT *apt, IUnknown *object, BOOL alloc) DECLSPEC_HIDDEN
Definition: stubmanager.c:322
HRESULT WINAPI CoFileTimeNow ( FILETIME lpFileTime)

Definition at line 3580 of file compobj.c.

Referenced by RunningObjectTableImpl_Register().

3581 {
3582  GetSystemTimeAsFileTime( lpFileTime );
3583  return S_OK;
3584 }
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
#define S_OK
Definition: intsafe.h:59
void WINAPI CoFreeAllLibraries ( void  )

Definition at line 3518 of file compobj.c.

3519 {
3520  /* NOP */
3521 }
void WINAPI CoFreeLibrary ( HINSTANCE  hLibrary)

Definition at line 3501 of file compobj.c.

3502 {
3504 }
#define FreeLibrary(x)
Definition: compat.h:405
HMODULE hLibrary
Definition: odbccp32.c:12
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries ( void  )

Definition at line 3564 of file compobj.c.

Referenced by AMovieDllRegisterServer2(), free_libraries_thread(), SHFreeUnusedLibraries(), and test_CoFreeUnusedLibraries().

3565 {
3567 }
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved)
Definition: compobj.c:3540
#define INFINITE
Definition: serial.h:102
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibrariesEx ( DWORD  dwUnloadDelay,
DWORD  dwReserved 
)

Definition at line 3540 of file compobj.c.

Referenced by CoFreeUnusedLibraries().

3541 {
3542  struct apartment *apt = COM_CurrentApt();
3543  if (!apt)
3544  {
3545  ERR("apartment not initialised\n");
3546  return;
3547  }
3548 
3549  apartment_freeunusedlibraries(apt, dwUnloadDelay);
3550 }
static void apartment_freeunusedlibraries(struct apartment *apt, DWORD delay)
Definition: compobj.c:1078
static APARTMENT * COM_CurrentApt(void)
#define ERR(fmt,...)
Definition: debug.h:109
HRESULT WINAPI CoGetApartmentType ( APTTYPE *  type,
APTTYPEQUALIFIER qualifier 
)

Definition at line 5053 of file compobj.c.

Referenced by Context_CTI_GetCurrentApartmentType(), and Context_CTI_GetCurrentThreadType().

5054 {
5055  struct oletls *info = COM_CurrentInfo();
5056 
5057  FIXME("(%p, %p): semi-stub\n", type, qualifier);
5058 
5059  if (!type || !qualifier)
5060  return E_INVALIDARG;
5061 
5062  if (!info)
5063  return E_OUTOFMEMORY;
5064 
5065  if (!info->apt)
5066  *type = APTTYPE_CURRENT;
5067  else if (info->apt->multi_threaded)
5068  *type = APTTYPE_MTA;
5069  else if (info->apt->main)
5070  *type = APTTYPE_MAINSTA;
5071  else
5072  *type = APTTYPE_STA;
5073 
5075 
5076  return info->apt ? S_OK : CO_E_NOTINITIALIZED;
5077 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
enum APTTYPE_MTA
Definition: compobj.c:613
static struct oletls * COM_CurrentInfo(void)
#define CO_E_NOTINITIALIZED
enum APTTYPE_MAINSTA
struct apartment * apt
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:82
#define S_OK
Definition: intsafe.h:59
enum APTTYPE_STA
HRESULT WINAPI CoGetCallContext ( REFIID  riid,
void **  ppv 
)

Definition at line 4237 of file compobj.c.

Referenced by CoImpersonateClient(), CoQueryClientBlanket(), CoRevertToSelf(), and test_CoGetCallContext().

4238 {
4239  struct oletls *info = COM_CurrentInfo();
4240 
4241  TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
4242 
4243  if (!info)
4244  return E_OUTOFMEMORY;
4245 
4246  if (!info->call_state)
4247  return RPC_E_CALL_COMPLETE;
4248 
4249  return IUnknown_QueryInterface(info->call_state, riid, ppv);
4250 }
REFIID riid
Definition: precomp.h:44
Definition: compobj.c:613
static struct oletls * COM_CurrentInfo(void)
IUnknown * call_state
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define RPC_E_CALL_COMPLETE
Definition: winerror.h:2499
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject ( REFCLSID  rclsid,
DWORD  dwClsContext,
COSERVERINFO pServerInfo,
REFIID  iid,
LPVOID ppv 
)

Definition at line 2958 of file compobj.c.

Referenced by ClassMoniker_BindToObject(), CoCreateInstanceEx(), create_activex_object(), create_object(), get_class_object(), get_class_object_proxy_thread(), get_facbuf_for_iid(), get_protocol_cf(), IDirectSound8_tests(), IDirectSound_tests(), is_jscript_available(), register_protocols(), START_TEST(), test_about_protocol(), test_capture(), test_CoGetClassObject(), test_CoRegisterClassObject(), test_CoRegisterPSClsid(), test_file_protocol_url(), test_ftp_protocol(), test_gopher_protocol(), test_http_protocol_url(), test_its_protocol(), test_javascript_protocol(), test_local_server(), test_mhtml_protocol(), test_mk_protocol(), test_OleCreateFontIndirect(), test_proxybuffer(), test_res_protocol(), test_stub(), and test_stubbuffer().

2961 {
2962  struct class_reg_data clsreg;
2963  IUnknown *regClassObject;
2965  APARTMENT *apt;
2966  BOOL release_apt = FALSE;
2967 
2968  TRACE("CLSID: %s,IID: %s\n", debugstr_guid(rclsid), debugstr_guid(iid));
2969 
2970  if (!ppv)
2971  return E_INVALIDARG;
2972 
2973  *ppv = NULL;
2974 
2975  if (!(apt = COM_CurrentApt()))
2976  {
2977  if (!(apt = apartment_find_multi_threaded()))
2978  {
2979  ERR("apartment not initialised\n");
2980  return CO_E_NOTINITIALIZED;
2981  }
2982  release_apt = TRUE;
2983  }
2984 
2985  if (pServerInfo) {
2986  FIXME("pServerInfo->name=%s pAuthInfo=%p\n",
2987  debugstr_w(pServerInfo->pwszName), pServerInfo->pAuthInfo);
2988  }
2989 
2990  if (CLSCTX_INPROC_SERVER & dwClsContext)
2991  {
2993  {
2994  if (release_apt) apartment_release(apt);
2995  return FTMarshalCF_Create(iid, ppv);
2996  }
2997  if (IsEqualCLSID(rclsid, &CLSID_GlobalOptions))
2998  return IClassFactory_QueryInterface(&GlobalOptionsCF, iid, ppv);
2999  }
3000 
3001  if (CLSCTX_INPROC & dwClsContext)
3002  {
3003  ACTCTX_SECTION_KEYED_DATA data;
3004 
3005  data.cbSize = sizeof(data);
3006  /* search activation context first */
3007  if (FindActCtxSectionGuid(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL,
3008  ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION,
3009  rclsid, &data))
3010  {
3011  struct comclassredirect_data *comclass = (struct comclassredirect_data*)data.lpData;
3012 
3013  clsreg.u.actctx.hactctx = data.hActCtx;
3014  clsreg.u.actctx.data = data.lpData;
3015  clsreg.u.actctx.section = data.lpSectionBase;
3016  clsreg.hkey = FALSE;
3017 
3018  hres = get_inproc_class_object(apt, &clsreg, &comclass->clsid, iid, !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv);
3019  ReleaseActCtx(data.hActCtx);
3020  if (release_apt) apartment_release(apt);
3021  return hres;
3022  }
3023  }
3024 
3025  /*
3026  * First, try and see if we can't match the class ID with one of the
3027  * registered classes.
3028  */
3029  if (S_OK == COM_GetRegisteredClassObject(apt, rclsid, dwClsContext,
3030  &regClassObject))
3031  {
3032  /* Get the required interface from the retrieved pointer. */
3033  hres = IUnknown_QueryInterface(regClassObject, iid, ppv);
3034 
3035  /*
3036  * Since QI got another reference on the pointer, we want to release the
3037  * one we already have. If QI was unsuccessful, this will release the object. This
3038  * is good since we are not returning it in the "out" parameter.
3039  */
3040  IUnknown_Release(regClassObject);
3041  if (release_apt) apartment_release(apt);
3042  return hres;
3043  }
3044 
3045  /* First try in-process server */
3046  if (CLSCTX_INPROC_SERVER & dwClsContext)
3047  {
3048  static const WCHAR wszInprocServer32[] = {'I','n','p','r','o','c','S','e','r','v','e','r','3','2',0};
3049  HKEY hkey;
3050 
3051  hres = COM_OpenKeyForCLSID(rclsid, wszInprocServer32, KEY_READ, &hkey);
3052  if (FAILED(hres))
3053  {
3054  if (hres == REGDB_E_CLASSNOTREG)
3055  ERR("class %s not registered\n", debugstr_guid(rclsid));
3056  else if (hres == REGDB_E_KEYMISSING)
3057  {
3058  WARN("class %s not registered as in-proc server\n", debugstr_guid(rclsid));
3059  hres = REGDB_E_CLASSNOTREG;
3060  }
3061  }
3062 
3063  if (SUCCEEDED(hres))
3064  {
3065  clsreg.u.hkey = hkey;
3066  clsreg.hkey = TRUE;
3067 
3068  hres = get_inproc_class_object(apt, &clsreg, rclsid, iid, !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv);
3069  RegCloseKey(hkey);
3070  }
3071 
3072  /* return if we got a class, otherwise fall through to one of the
3073  * other types */
3074  if (SUCCEEDED(hres))
3075  {
3076  if (release_apt) apartment_release(apt);
3077  return hres;
3078  }
3079  }
3080 
3081  /* Next try in-process handler */
3082  if (CLSCTX_INPROC_HANDLER & dwClsContext)
3083  {
3084  static const WCHAR wszInprocHandler32[] = {'I','n','p','r','o','c','H','a','n','d','l','e','r','3','2',0};
3085  HKEY hkey;
3086 
3087  hres = COM_OpenKeyForCLSID(rclsid, wszInprocHandler32, KEY_READ, &hkey);
3088  if (FAILED(hres))
3089  {
3090  if (hres == REGDB_E_CLASSNOTREG)
3091  ERR("class %s not registered\n", debugstr_guid(rclsid));
3092  else if (hres == REGDB_E_KEYMISSING)
3093  {
3094  WARN("class %s not registered in-proc handler\n", debugstr_guid(rclsid));
3095  hres = REGDB_E_CLASSNOTREG;
3096  }
3097  }
3098 
3099  if (SUCCEEDED(hres))
3100  {
3101  clsreg.u.hkey = hkey;
3102  clsreg.hkey = TRUE;
3103 
3104  hres = get_inproc_class_object(apt, &clsreg, rclsid, iid, !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv);
3105  RegCloseKey(hkey);
3106  }
3107 
3108  /* return if we got a class, otherwise fall through to one of the
3109  * other types */
3110  if (SUCCEEDED(hres))
3111  {
3112  if (release_apt) apartment_release(apt);
3113  return hres;
3114  }
3115  }
3116  if (release_apt) apartment_release(apt);
3117 
3118  /* Next try out of process */
3119  if (CLSCTX_LOCAL_SERVER & dwClsContext)
3120  {
3121  hres = RPC_GetLocalClassObject(rclsid,iid,ppv);
3122  if (SUCCEEDED(hres))
3123  return hres;
3124  }
3125 
3126  /* Finally try remote: this requires networked DCOM (a lot of work) */
3127  if (CLSCTX_REMOTE_SERVER & dwClsContext)
3128  {
3129  FIXME ("CLSCTX_REMOTE_SERVER not supported\n");
3130  hres = REGDB_E_CLASSNOTREG;
3131  }
3132 
3133  if (FAILED(hres))
3134  ERR("no class object %s could be created for context 0x%x\n",
3135  debugstr_guid(rclsid), dwClsContext);
3136  return hres;
3137 }
#define TRUE
Definition: types.h:120
#define KEY_READ
Definition: nt_native.h:1023
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1118
#define WARN(fmt,...)
Definition: debug.h:111
const CLSID CLSID_InProcFreeMarshaler
#define REGDB_E_KEYMISSING
Definition: winerror.h:2694
#define CO_E_NOTINITIALIZED
static APARTMENT * COM_CurrentApt(void)
static HRESULT COM_GetRegisteredClassObject(const struct apartment *apt, REFCLSID rclsid, DWORD dwClsContext, LPUNKNOWN *ppUnk)
Definition: compobj.c:2695
COAUTHINFO * pAuthInfo
Definition: objidl.idl:34
const CLSID CLSID_GlobalOptions
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
HRESULT RPC_GetLocalClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) DECLSPEC_HIDDEN
Definition: rpc.c:1780
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2313
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
HRESULT hres
Definition: protocol.c:461
LONG HRESULT
Definition: typedefs.h:77
HANDLE HKEY
Definition: registry.h:24
static LPVOID * ppv
Definition: compobj.c:77
VOID WINAPI ReleaseActCtx(IN HANDLE hActCtx)
Definition: actctx.c:208
#define WINE_CLSCTX_DONT_HOST
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static APARTMENT * apartment_find_multi_threaded(void)
Definition: compobj.c:1279
#define ERR(fmt,...)
Definition: debug.h:109
IClassFactory GlobalOptionsCF
Definition: oleproxy.c:142
#define S_OK
Definition: intsafe.h:59
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
HRESULT FTMarshalCF_Create(REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN
Definition: ftmarshal.c:397
static HRESULT get_inproc_class_object(APARTMENT *apt, const struct class_reg_data *regdata, REFCLSID rclsid, REFIID riid, BOOL hostifnecessary, void **ppv)
Definition: compobj.c:2881
#define E_UNEXPECTED
Definition: winerror.h:2456
LPWSTR pwszName
Definition: objidl.idl:33
BOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, const GUID *lpSearchGuid, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:183
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:91
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HRESULT WINAPI CoGetContextToken ( ULONG_PTR token)

Definition at line 4962 of file compobj.c.

Referenced by CoGetObjectContext().

4963 {
4964  struct oletls *info = COM_CurrentInfo();
4965 
4966  TRACE("(%p)\n", token);
4967 
4968  if (!info)
4969  return E_OUTOFMEMORY;
4970 
4971  if (!info->apt)
4972  {
4973  APARTMENT *apt;
4974  if (!(apt = apartment_find_multi_threaded()))
4975  {
4976  ERR("apartment not initialised\n");
4977  return CO_E_NOTINITIALIZED;
4978  }
4979  apartment_release(apt);
4980  }
4981 
4982  if (!token)
4983  return E_POINTER;
4984 
4985  if (!info->context_token)
4986  {
4987  Context *context;
4988 
4989  context = HeapAlloc(GetProcessHeap(), 0, sizeof(*context));
4990  if (!context)
4991  return E_OUTOFMEMORY;
4992 
4994  context->IContextCallback_iface.lpVtbl = &Context_Callback_Vtbl;
4995  context->IObjContext_iface.lpVtbl = &Context_Object_Vtbl;
4996  /* Context token does not take a reference, it's always zero until the
4997  interface is explicitly requested with CoGetObjectContext(). */
4998  context->refs = 0;
4999 
5000  info->context_token = &context->IObjContext_iface;
5001  }
5002 
5003  *token = (ULONG_PTR)info->context_token;
5004  TRACE("context_token=%p\n", info->context_token);
5005 
5006  return S_OK;
5007 }
IObjContext * context_token
LONG refs
Definition: compobj.c:4647
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1118
Definition: compobj.c:613
static struct oletls * COM_CurrentInfo(void)
#define CO_E_NOTINITIALIZED
IObjContext IObjContext_iface
Definition: compobj.c:4646
struct apartment * apt
static const IObjContextVtbl Context_Object_Vtbl
Definition: compobj.c:4913
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
int token
Definition: lex.c:57
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
IContextCallback IContextCallback_iface
Definition: compobj.c:4645
static const IContextCallbackVtbl Context_Callback_Vtbl
Definition: compobj.c:4813
IComThreadingInfo IComThreadingInfo_iface
Definition: compobj.c:4644
static APARTMENT * apartment_find_multi_threaded(void)
Definition: compobj.c:1279
const XML_Char * context
Definition: expat.h:434
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static ULONG_PTR
Definition: compobj.c:88
#define E_POINTER
Definition: winerror.h:2365
static const IComThreadingInfoVtbl Context_Threading_Vtbl
Definition: compobj.c:4775
HRESULT WINAPI CoGetCurrentLogicalThreadId ( GUID id)

Definition at line 3870 of file compobj.c.

Referenced by Context_CTI_GetCurrentLogicalThreadId(), test_CoGetCurrentLogicalThreadId(), and test_CoGetObjectContext().

3871 {
3872  TRACE("(%p)\n", id);
3873 
3874  if (!id)
3875  return E_INVALIDARG;
3876 
3877  *id = COM_CurrentCausalityId();
3878  return S_OK;
3879 }
static GUID COM_CurrentCausalityId(void)
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
DWORD WINAPI CoGetCurrentProcess ( void  )

Definition at line 3862 of file compobj.c.

3863 {
3864  return GetCurrentProcessId();
3865 }
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1203
HRESULT WINAPI CoGetDefaultContext ( APTTYPE  type,
REFIID  riid,
LPVOID ppv 
)

Definition at line 5012 of file compobj.c.

5013 {
5014  FIXME("%d %s %p stub\n", type, debugstr_guid(riid), ppv);
5015  return E_NOINTERFACE;
5016 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
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 at line 3331 of file compobj.c.

Referenced by test_CoGetInstanceFromFile().

3341 {
3342  IPersistFile *pf = NULL;
3343  IUnknown* unk = NULL;
3344  CLSID clsid;
3345  HRESULT hr;
3346 
3347  if (count == 0 || !results)
3348  return E_INVALIDARG;
3349 
3350  if (server_info)
3351  FIXME("() non-NULL server_info not supported\n");
3352 
3354 
3355  /* optionally get CLSID from a file */
3356  if (!rclsid)
3357  {
3358  hr = GetClassFile(filename, &clsid);
3359  if (FAILED(hr))
3360  {
3361  ERR("failed to get CLSID from a file\n");
3362  return hr;
3363  }
3364 
3365  rclsid = &clsid;
3366  }
3367 
3368  hr = CoCreateInstance(rclsid,
3369  outer,
3370  cls_context,
3371  &IID_IUnknown,
3372  (void**)&unk);
3373 
3374  if (hr != S_OK)
3375  {
3376  init_multi_qi(count, results, hr);
3377  return hr;
3378  }
3379 
3380  /* init from file */
3381  hr = IUnknown_QueryInterface(unk, &IID_IPersistFile, (void**)&pf);
3382  if (FAILED(hr))
3383  {
3384  init_multi_qi(count, results, hr);
3385  IUnknown_Release(unk);
3386  return hr;
3387  }
3388 
3389  hr = IPersistFile_Load(pf, filename, grfmode);
3390  IPersistFile_Release(pf);
3391  if (SUCCEEDED(hr))
3392  return return_multi_qi(unk, count, results, FALSE);
3393  else
3394  {
3395  init_multi_qi(count, results, hr);
3396  IUnknown_Release(unk);
3397  return hr;
3398  }
3399 }
#define E_NOINTERFACE
Definition: winerror.h:2364
static HRESULT return_multi_qi(IUnknown *unk, DWORD count, MULTI_QI *mqi, BOOL include_unk)
Definition: compobj.c:3217
const GUID IID_IUnknown
HRESULT WINAPI GetClassFile(LPCOLESTR filePathName, CLSID *pclsid)
Definition: moniker.c:1199
#define FALSE
Definition: types.h:117
LPCSTR filename
Definition: alphablend.c:63
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
LONG HRESULT
Definition: typedefs.h:77
GLuint GLuint GLsizei count
Definition: gl.h:1545
struct _test_info results[8]
Definition: SetCursorPos.c:33
REFCLSID clsid
Definition: msctf.c:66
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3185
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
const GUID IID_IPersistFile
static void init_multi_qi(DWORD count, MULTI_QI *mqi, HRESULT hr)
Definition: compobj.c:3206
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HRESULT WINAPI CoGetInstanceFromIStorage ( COSERVERINFO server_info,
CLSID rclsid,
IUnknown outer,
DWORD  cls_context,
IStorage storage,
DWORD  count,
MULTI_QI *  results 
)

Definition at line 3404 of file compobj.c.

3413 {
3414  IPersistStorage *ps = NULL;
3415  IUnknown* unk = NULL;
3416  STATSTG stat;
3417  HRESULT hr;
3418 
3419  if (count == 0 || !results || !storage)
3420  return E_INVALIDARG;
3421 
3422  if (server_info)
3423  FIXME("() non-NULL server_info not supported\n");
3424 
3426 
3427  /* optionally get CLSID from a file */
3428  if (!rclsid)
3429  {
3430  memset(&stat.clsid, 0, sizeof(stat.clsid));
3431  hr = IStorage_Stat(storage, &stat, STATFLAG_NONAME);
3432  if (FAILED(hr))
3433  {
3434  ERR("failed to get CLSID from a file\n");
3435  return hr;
3436  }
3437 
3438  rclsid = &stat.clsid;
3439  }
3440 
3441  hr = CoCreateInstance(rclsid,
3442  outer,
3443  cls_context,
3444  &IID_IUnknown,
3445  (void**)&unk);
3446 
3447  if (hr != S_OK)
3448  return hr;
3449 
3450  /* init from IStorage */
3451  hr = IUnknown_QueryInterface(unk, &IID_IPersistStorage, (void**)&ps);
3452  if (FAILED(hr))
3453  ERR("failed to get IPersistStorage\n");
3454 
3455  if (ps)
3456  {
3457  IPersistStorage_Load(ps, storage);
3458  IPersistStorage_Release(ps);
3459  }
3460 
3461  return return_multi_qi(unk, count, results, FALSE);
3462 }
#define E_NOINTERFACE
Definition: winerror.h:2364
static HRESULT return_multi_qi(IUnknown *unk, DWORD count, MULTI_QI *mqi, BOOL include_unk)
Definition: compobj.c:3217
const GUID IID_IUnknown
const GUID IID_IPersistStorage
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
LONG HRESULT
Definition: typedefs.h:77
GLuint GLuint GLsizei count
Definition: gl.h:1545
struct _test_info results[8]
Definition: SetCursorPos.c:33
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3185
#define ERR(fmt,...)
Definition: debug.h:109
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define S_OK
Definition: intsafe.h:59
#define memset(x, y, z)
Definition: compat.h:39
static void init_multi_qi(DWORD count, MULTI_QI *mqi, HRESULT hr)
Definition: compobj.c:3206
HRESULT WINAPI CoGetObject ( LPCWSTR  pszName,
BIND_OPTS *  pBindOptions,
REFIID  riid,
void **  ppv 
)

Definition at line 4590 of file compobj.c.

4592 {
4593  IBindCtx *pbc;
4594  HRESULT hr;
4595 
4596  *ppv = NULL;
4597 
4598  hr = CreateBindCtx(0, &pbc);
4599  if (SUCCEEDED(hr))
4600  {
4601  if (pBindOptions)
4602  hr = IBindCtx_SetBindOptions(pbc, pBindOptions);
4603 
4604  if (SUCCEEDED(hr))
4605  {
4606  ULONG chEaten;
4607  IMoniker *pmk;
4608 
4609  hr = MkParseDisplayName(pbc, pszName, &chEaten, &pmk);
4610  if (SUCCEEDED(hr))
4611  {
4612  hr = IMoniker_BindToObject(pmk, pbc, NULL, riid, ppv);
4613  IMoniker_Release(pmk);
4614  }
4615  }
4616 
4617  IBindCtx_Release(pbc);
4618  }
4619  return hr;
4620 }
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:557
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:545
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, LPMONIKER *ppmk)
Definition: moniker.c:1115
unsigned int ULONG
Definition: retypes.h:1
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HRESULT WINAPI CoGetObjectContext ( REFIID  riid,
void **  ppv 
)

Definition at line 4944 of file compobj.c.

4945 {
4947  HRESULT hr;
4948 
4949  TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
4950 
4951  *ppv = NULL;
4952  hr = CoGetContextToken((ULONG_PTR*)&context);
4953  if (FAILED(hr))
4954  return hr;
4955 
4956  return IObjContext_QueryInterface(context, riid, ppv);
4957 }
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI CoGetContextToken(ULONG_PTR *token)
Definition: compobj.c:4962
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:557
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
const XML_Char * context
Definition: expat.h:434
HRESULT WINAPI CoGetPSClsid ( REFIID  riid,
CLSID pclsid 
)

Definition at line 2555 of file compobj.c.

Referenced by get_facbuf_for_iid(), register_ps_clsid_thread(), test_CoGetPSClsid(), test_CoRegisterPSClsid(), test_proxybuffer(), test_stub(), and test_stubbuffer().

2556 {
2557  static const WCHAR wszInterface[] = {'I','n','t','e','r','f','a','c','e','\\',0};
2558  static const WCHAR wszPSC[] = {'\\','P','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2',0};
2559  WCHAR path[ARRAYSIZE(wszInterface) - 1 + CHARS_IN_GUID - 1 + ARRAYSIZE(wszPSC)];
2562  ACTCTX_SECTION_KEYED_DATA data;
2563  HRESULT hr;
2564  REGSAM opposite = (sizeof(void*) > sizeof(int)) ? KEY_WOW64_32KEY : KEY_WOW64_64KEY;
2565  BOOL is_wow64;
2566 
2567  TRACE("() riid=%s, pclsid=%p\n", debugstr_guid(riid), pclsid);
2568 
2569  if (!apt)
2570  {
2571  ERR("apartment not initialised\n");
2572  return CO_E_NOTINITIALIZED;
2573  }
2574 
2575  if (!pclsid)
2576  return E_INVALIDARG;
2577 
2579 
2580  LIST_FOR_EACH_ENTRY(registered_psclsid, &registered_psclsid_list, struct registered_psclsid, entry)
2581  if (IsEqualIID(&registered_psclsid->iid, riid))
2582  {
2583  *pclsid = registered_psclsid->clsid;
2585  return S_OK;
2586  }
2587 
2589 
2590  data.cbSize = sizeof(data);
2591  if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION,
2592  riid, &data))
2593  {
2594  struct ifacepsredirect_data *ifaceps = (struct ifacepsredirect_data*)data.lpData;
2595  *pclsid = ifaceps->iid;
2596  return S_OK;
2597  }
2598 
2599  /* Interface\\{string form of riid}\\ProxyStubClsid32 */
2600  strcpyW(path, wszInterface);
2601  StringFromGUID2(riid, path + ARRAYSIZE(wszInterface) - 1, CHARS_IN_GUID);
2602  strcpyW(path + ARRAYSIZE(wszInterface) - 1 + CHARS_IN_GUID - 1, wszPSC);
2603 
2604  hr = get_ps_clsid_from_registry(path, 0, pclsid);
2605  if (FAILED(hr) && (opposite == KEY_WOW64_32KEY ||
2606  (IsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64)))
2607  hr = get_ps_clsid_from_registry(path, opposite, pclsid);
2608 
2609  if (hr == S_OK)
2610  TRACE ("() Returning CLSID=%s\n", debugstr_guid(pclsid));
2611  else
2612  WARN("No PSFactoryBuffer object is registered for IID %s\n", debugstr_guid(riid));
2613 
2614  return hr;
2615 }
static struct list registered_psclsid_list
Definition: compobj.c:149
static CRITICAL_SECTION cs_registered_psclsid_list
Definition: compobj.c:151
__wchar_t WCHAR
Definition: xmlstorage.h:180
REFIID riid
Definition: precomp.h:44
uint8_t entry
Definition: isohybrid.c:63
#define WARN(fmt,...)
Definition: debug.h:111
#define CHARS_IN_GUID
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define CO_E_NOTINITIALIZED
static APARTMENT * COM_CurrentApt(void)
struct apartment * apt
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
static STATEMGRSTATUS *static BOOL is_wow64
Definition: action.c:57
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
#define debugstr_guid
Definition: kernel32.h:35
BOOL WINAPI IsWow64Process(IN HANDLE hProcess, OUT PBOOL Wow64Process)
Definition: proc.c:2019
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
if(!(yy_init))
Definition: macro.lex.yy.c:704
LONG HRESULT
Definition: typedefs.h:77
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1183
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2299
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define ARRAYSIZE(array)
Definition: compobj.c:47
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
Definition: services.c:311
ACCESS_MASK REGSAM
Definition: winreg.h:69
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
BOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, const GUID *lpSearchGuid, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:183
static HRESULT get_ps_clsid_from_registry(const WCHAR *path, REGSAM access, CLSID *pclsid)
Definition: compobj.c:2497
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
HRESULT WINAPI CoGetState ( IUnknown **  ppv)

Definition at line 3677 of file compobj.c.

3678 {
3679  struct oletls *info = COM_CurrentInfo();
3680  if (!info) return E_OUTOFMEMORY;
3681 
3682  *ppv = NULL;
3683 
3684  if (info->state)
3685  {
3686  IUnknown_AddRef(info->state);
3687  *ppv = info->state;
3688  TRACE("apt->state=%p\n", info->state);
3689  }
3690 
3691  return S_OK;
3692 }
IUnknown * state
Definition: compobj.c:613
static struct oletls * COM_CurrentInfo(void)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:557
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI CoGetTreatAsClass ( REFCLSID  clsidOld,
LPCLSID  clsidNew 
)

Definition at line 3817 of file compobj.c.

Referenced by CoCreateInstanceEx().

3818 {
3819  static const WCHAR wszTreatAs[] = {'T','r','e','a','t','A','s',0};
3820  HKEY hkey = NULL;
3821  WCHAR szClsidNew[CHARS_IN_GUID];
3822  HRESULT res = S_OK;
3823  LONG len = sizeof(szClsidNew);
3824 
3825  TRACE("(%s,%p)\n", debugstr_guid(clsidOld), clsidNew);
3826 
3827  if (!clsidOld || !clsidNew)
3828  return E_INVALIDARG;
3829 
3830  *clsidNew = *clsidOld; /* copy over old value */
3831 
3832  res = COM_OpenKeyForCLSID(clsidOld, wszTreatAs, KEY_READ, &hkey);
3833  if (FAILED(res))
3834  {
3835  res = S_FALSE;
3836  goto done;
3837  }
3838  if (RegQueryValueW(hkey, NULL, szClsidNew, &len))
3839  {
3840  res = S_FALSE;
3841  goto done;
3842  }
3843  res = CLSIDFromString(szClsidNew,clsidNew);
3844  if (FAILED(res))
3845  ERR("Failed CLSIDFromStringA(%s), hres 0x%08x\n", debugstr_w(szClsidNew), res);
3846 done:
3847  if (hkey) RegCloseKey(hkey);
3848  return res;
3849 }
#define KEY_READ
Definition: nt_native.h:1023
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CHARS_IN_GUID
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:557
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2313
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HANDLE HKEY
Definition: registry.h:24
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4272
GLenum GLsizei len
Definition: glext.h:6722
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2203
HRESULT WINAPI CoImpersonateClient ( void  )

Definition at line 4352 of file compobj.c.

4353 {
4354  IServerSecurity *pSrvSec;
4355  HRESULT hr;
4356 
4357  TRACE("\n");
4358 
4359  hr = CoGetCallContext(&IID_IServerSecurity, (void **)&pSrvSec);
4360  if (SUCCEEDED(hr))
4361  {
4362  hr = IServerSecurity_ImpersonateClient(pSrvSec);
4363  IServerSecurity_Release(pSrvSec);
4364  }
4365 
4366  return hr;
4367 }
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI CoGetCallContext(REFIID riid, void **ppv)
Definition: compobj.c:4237
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HRESULT WINAPI CoInitialize ( LPVOID  lpReserved)

Definition at line 1832 of file compobj.c.

Referenced by _CmdWndProc(), CRecyclerDropTarget::_DoDeleteThreadProc(), CFSDropTarget::_DoDropThreadProc(), ACTION_CreateShortcuts(), AMovieDllRegisterServer2(), cache_InstallAssembly(), cache_UninstallAssembly(), call_script(), CCoInit::CCoInit(), CGuidItemExtractIcon_CreateInstance(), ComInit::ComInit(), crash_couninitialize_proc(), CreateSecurityPage(), CreateShortcut(), CreateShortcuts(), DirectInput8Create(), DllMain(), DllRegisterServer(), get_global_interface_proc(), IEWinMain(), init_test(), initialize(), InitIconOverlays(), InitInstance(), InitXMLDOMParser(), LoadShellLinkConsoleInfo(), main(), MsiGetShortcutTargetW(), OLEPictureImpl_LoadWICDecoder(), query_prop(), register_filters(), run_script(), SHAddToRecentDocs(), SHCreateFromDesktop(), shellex_load_object_and_run(), SHFileOperationW(), START_TEST(), test_click_make_new_folder_button(), test_CoCreateInstanceEx(), test_CoGetCallContext(), test_CoGetContextToken(), test_DPA_LoadStream(), test_DPA_SaveStream(), test_GlobalOptions(), test_IWinHttpRequest(), test_IWinHttpRequest_Invoke(), test_knownFolders(), test_MsiSetComponentState(), test_OleInitialize_InitCounting(), test_packagecoltypes(), test_printers_folder(), test_PSRefreshPropertySchema(), test_selection(), test_set_clipboard(), test_StreamOnMemory(), test_StreamOnStreamRange(), unregister_filters(), WinMain(), and wWinMain().

1833 {
1834  /*
1835  * Just delegate to the newer method.
1836  */
1837  return CoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED);
1838 }
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:1870
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx ( LPVOID  lpReserved,
DWORD  dwCoInit 
)

Definition at line 1870 of file compobj.c.

Referenced by apartment_hostobject_thread(), ChooseFolder(), CoInitialize(), D3DXGetImageInfoFromFileInMemory(), D3DXLoadSurfaceFromFileInMemory(), D3DXSaveSurfaceToFileInMemory(), DllMain(), FileExtractDialogWndProc(), host_object_proc(), InitializeSecurity(), is_firewall_enabled(), MCIQTZ_mciOpen(), ole_server(), OleInitialize(), parse_config_file(), PullPin_Thread_Main(), set_firewall(), SHLWAPI_ThreadWrapper(), START_TEST(), StartCount(), CSysTray::SysTrayThreadProc(), test_IInitializeSpy_register2(), test_IInitializeSpy_switch_apt(), test_render_with_multithread(), test_RtlQueryPackageIdentity(), test_shortcut(), test_stub(), test_WICCreateColorTransform_Proxy(), TestClasses(), and WICCreateColorTransform_Proxy().

1871 {
1872  struct oletls *info = COM_CurrentInfo();
1873  HRESULT hr = S_OK;
1874  APARTMENT *apt;
1875 
1876  TRACE("(%p, %x)\n", lpReserved, (int)dwCoInit);
1877 
1878  if (lpReserved!=NULL)
1879  {
1880  ERR("(%p, %x) - Bad parameter passed-in %p, must be an old Windows Application\n", lpReserved, (int)dwCoInit, lpReserved);
1881  }
1882 
1883  /*
1884  * Check the lock count. If this is the first time going through the initialize
1885  * process, we have to initialize the libraries.
1886  *
1887  * And crank-up that lock count.
1888  */
1890  {
1891  /*
1892  * Initialize the various COM libraries and data structures.
1893  */
1894  TRACE("() - Initializing the COM libraries\n");
1895 
1896  /* we may need to defer this until after apartment initialisation */
1898  }
1899 
1900  if (info->spy)
1901  IInitializeSpy_PreInitialize(info->spy, dwCoInit, info->inits);
1902 
1903  if (!(apt = info->apt))
1904  {
1906  if (!apt) return E_OUTOFMEMORY;
1907  }
1908  else if (!apartment_is_model(apt, dwCoInit))
1909  {
1910  /* Changing the threading model after it's been set is illegal. If this warning is triggered by Wine
1911  code then we are probably using the wrong threading model to implement that API. */
1912  ERR("Attempt to change threading model of this apartment from %s to %s\n",
1913  apt->multi_threaded ? "multi-threaded" : "apartment threaded",
1914  dwCoInit & COINIT_APARTMENTTHREADED ? "apartment threaded" : "multi-threaded");
1915  return RPC_E_CHANGED_MODE;
1916  }
1917  else
1918  hr = S_FALSE;
1919 
1920  info->inits++;
1921 
1922  if (info->spy)
1923  IInitializeSpy_PostInitialize(info->spy, hr, dwCoInit, info->inits);
1924 
1925  return hr;
1926 }
IInitializeSpy * spy
BOOL multi_threaded
static DWORD dwCoInit
Definition: compobj.c:76
static BOOL apartment_is_model(const APARTMENT *apt, DWORD model)
Definition: compobj.c:693
Definition: compobj.c:613
static struct oletls * COM_CurrentInfo(void)
struct apartment * apt
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:557
#define InterlockedExchangeAdd
Definition: interlocked.h:181
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define RPC_E_CHANGED_MODE
Definition: winerror.h:2482
DWORD inits
static APARTMENT * apartment_get_or_create(DWORD model)
Definition: compobj.c:645
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static LONG s_COMLockCount
Definition: compobj.c:179
HRESULT WINAPI RunningObjectTableImpl_Initialize(void) DECLSPEC_HIDDEN
Definition: moniker.c:965
HRESULT WINAPI CoInitializeSecurity ( PSECURITY_DESCRIPTOR  pSecDesc,
LONG  cAuthSvc,
SOLE_AUTHENTICATION_SERVICE *  asAuthSvc,
void pReserved1,
DWORD  dwAuthnLevel,
DWORD  dwImpLevel,
void pReserved2,
DWORD  dwCapabilities,
void pReserved3 
)

Definition at line 3980 of file compobj.c.

Referenced by InitializeSecurity(), query_prop(), START_TEST(), and StartCount().

3985 {
3986  FIXME("(%p,%d,%p,%p,%d,%d,%p,%d,%p) - stub!\n", pSecDesc, cAuthSvc,
3987  asAuthSvc, pReserved1, dwAuthnLevel, dwImpLevel, pReserved2,
3988  dwCapabilities, pReserved3);
3989  return S_OK;
3990 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI CoInitializeWOW ( DWORD  x,
DWORD  y 
)

Definition at line 3651 of file compobj.c.

3652 {
3653  FIXME("(0x%08x,0x%08x),stub!\n",x,y);
3654  return 0;
3655 }
#define FIXME(fmt,...)
Definition: debug.h:110
INT INT y
Definition: msvc.h:62
INT x
Definition: msvc.h:62
BOOL WINAPI CoIsHandlerConnected ( IUnknown pUnk)

Definition at line 4081 of file compobj.c.

4082 {
4083  FIXME("%p\n", pUnk);
4084 
4085  return TRUE;
4086 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:110
BOOL WINAPI CoIsOle1Class ( REFCLSID  clsid)

Definition at line 3951 of file compobj.c.

3952 {
3953  FIXME("%s\n", debugstr_guid(clsid));
3954  return FALSE;
3955 }
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
REFCLSID clsid
Definition: msctf.c:66
HINSTANCE WINAPI CoLoadLibrary ( LPOLESTR  lpszLibName,
BOOL  bAutoFree 
)

Definition at line 3480 of file compobj.c.

3481 {
3482  TRACE("(%s, %d)\n", debugstr_w(lpszLibName), bAutoFree);
3483 
3484  return LoadLibraryExW(lpszLibName, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
3485 }
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:286
#define LOAD_WITH_ALTERED_SEARCH_PATH
Definition: winbase.h:336
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI CoLockObjectExternal ( LPUNKNOWN  pUnk,
BOOL  fLock,
BOOL  fLastUnlockReleases 
)

Definition at line 3606 of file compobj.c.

Referenced by CoRegisterClassObject(), OleNoteObjectVisible(), test_disconnect_stub(), and test_lock_object_external().

3610 {
3611  struct stub_manager *stubmgr;
3612  struct apartment *apt;
3613 
3614  TRACE("pUnk=%p, fLock=%s, fLastUnlockReleases=%s\n",
3615  pUnk, fLock ? "TRUE" : "FALSE", fLastUnlockReleases ? "TRUE" : "FALSE");
3616 
3617  apt = COM_CurrentApt();
3618  if (!apt) return CO_E_NOTINITIALIZED;
3619 
3620  stubmgr = get_stub_manager_from_object(apt, pUnk, fLock);
3621  if (!stubmgr)
3622  {
3623  WARN("stub object not found %p\n", pUnk);
3624  /* Note: native is pretty broken here because it just silently
3625  * fails, without returning an appropriate error code, making apps
3626  * think that the object was disconnected, when it actually wasn't */
3627  return S_OK;
3628  }
3629 
3630  if (fLock)
3631  stub_manager_ext_addref(stubmgr, 1, FALSE);
3632  else
3633  stub_manager_ext_release(stubmgr, 1, FALSE, fLastUnlockReleases);
3634 
3635  stub_manager_int_release(stubmgr);
3636  return S_OK;
3637 }
ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN
Definition: stubmanager.c:296
#define WARN(fmt,...)
Definition: debug.h:111
#define CO_E_NOTINITIALIZED
static APARTMENT * COM_CurrentApt(void)
#define FALSE
Definition: types.h:117
ULONG stub_manager_ext_addref(struct stub_manager *m, ULONG refs, BOOL tableweak) DECLSPEC_HIDDEN
Definition: stubmanager.c:393
#define TRACE(s)
Definition: solgame.cpp:4
ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL tableweak, BOOL last_unlock_releases) DECLSPEC_HIDDEN
Definition: stubmanager.c:424
#define S_OK
Definition: intsafe.h:59
struct stub_manager * get_stub_manager_from_object(APARTMENT *apt, IUnknown *object, BOOL alloc) DECLSPEC_HIDDEN
Definition: stubmanager.c:322
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
static HRESULT COM_GetRegisteredClassObject ( const struct apartment apt,
REFCLSID  rclsid,
DWORD  dwClsContext,
LPUNKNOWN ppUnk 
)
static

Definition at line 2695 of file compobj.c.

Referenced by CoGetClassObject(), and CoRegisterClassObject().

2697 {
2698  HRESULT hr = S_FALSE;
2699  RegisteredClass *curClass;
2700 
2702 
2704  {
2705  /*
2706  * Check if we have a match on the class ID and context.
2707  */
2708  if ((apt->oxid == curClass->apartment_id) &&
2709  (dwClsContext & curClass->runContext) &&
2710  IsEqualGUID(&(curClass->classIdentifier), rclsid))
2711  {
2712  /*
2713  * We have a match, return the pointer to the class object.
2714  */
2715  *ppUnk = curClass->classObject;
2716 
2717  IUnknown_AddRef(curClass->classObject);
2718 
2719  hr = S_OK;
2720  break;
2721  }
2722  }
2723 
2725 
2726  return hr;
2727 }
uint8_t entry
Definition: isohybrid.c:63
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define S_FALSE
Definition: winerror.h:2357
LPUNKNOWN classObject
Definition: compobj.c:196
static CRITICAL_SECTION csRegisteredClassList
Definition: compobj.c:205
CLSID classIdentifier
Definition: compobj.c:194
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:3970
static struct list RegisteredClassList
Definition: compobj.c:203
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
HRESULT COM_OpenKeyForAppIdFromCLSID ( REFCLSID  clsid,
REGSAM  access,
HKEY subkey 
)

Definition at line 2345 of file compobj.c.

Referenced by create_local_service().

2346 {
2347  static const WCHAR szAppId[] = { 'A','p','p','I','d',0 };
2348  static const WCHAR szAppIdKey[] = { 'A','p','p','I','d','\\',0 };
2349  DWORD res;
2351  WCHAR keyname[ARRAYSIZE(szAppIdKey) + CHARS_IN_GUID];
2352  DWORD size;
2353  HKEY hkey;
2354  DWORD type;
2355  HRESULT hr;
2356 
2357  /* read the AppID value under the class's key */
2358  hr = COM_OpenKeyForCLSID(clsid, NULL, KEY_READ, &hkey);
2359  if (FAILED(hr))
2360  return hr;
2361 
2362  size = sizeof(buf);
2363  res = RegQueryValueExW(hkey, szAppId, NULL, &type, (LPBYTE)buf, &size);
2364  RegCloseKey(hkey);
2365  if (res == ERROR_FILE_NOT_FOUND)
2366  return REGDB_E_KEYMISSING;
2367  else if (res != ERROR_SUCCESS || type!=REG_SZ)
2368  return REGDB_E_READREGDB;
2369 
2370  strcpyW(keyname, szAppIdKey);
2371  strcatW(keyname, buf);
2372  res = open_classes_key(HKEY_CLASSES_ROOT, keyname, access, subkey);
2373  if (res == ERROR_FILE_NOT_FOUND)
2374  return REGDB_E_KEYMISSING;
2375  else if (res != ERROR_SUCCESS)
2376  return REGDB_E_READREGDB;
2377 
2378  return S_OK;
2379 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define REGDB_E_READREGDB
Definition: winerror.h:2692
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char * LPBYTE
Definition: typedefs.h:52
#define CHARS_IN_GUID
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define REGDB_E_KEYMISSING
Definition: winerror.h:2694
DWORD DWORD
Definition: winlogon.h:75
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:557
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2313
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
LONG HRESULT
Definition: typedefs.h:77
HANDLE HKEY
Definition: registry.h:24
REFCLSID clsid
Definition: msctf.c:66
#define ARRAYSIZE(array)
Definition: compobj.c:47
#define S_OK
Definition: intsafe.h:59