ReactOS  0.4.13-dev-39-g8b6696f
compobj.c File Reference
#include "config.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "ntstatus.h"
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winreg.h"
#include "winuser.h"
#include "objbase.h"
#include "ole2.h"
#include "ole2ver.h"
#include "ctxtcall.h"
#include "dde.h"
#include "servprov.h"
#include "initguid.h"
#include "compobj_private.h"
#include "moniker.h"
#include "wine/unicode.h"
#include "wine/debug.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 COBJMACROS
 
#define NONAMELESSUNION
 
#define WIN32_NO_STATUS
 
#define USE_COM_CONTEXT_DEF
 

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 APARTMENTapartment_find_mta (void)
 
APARTMENTapartment_get_current_or_mta (void)
 
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 HRESULT apartment_getclassobject (struct apartment *apt, LPCWSTR dllpath, BOOL apartment_threaded, REFCLSID rclsid, REFIID riid, void **ppv)
 
static BOOL get_object_dll_path (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)
 
static void COM_TlsDestroy (void)
 
DWORD WINAPI CoBuildVersion (void)
 
HRESULT WINAPI CoRegisterInitializeSpy (IInitializeSpy *spy, ULARGE_INTEGER *cookie)
 
HRESULT WINAPI CoRevokeInitializeSpy (ULARGE_INTEGER cookie)
 
HRESULT enter_apartment (struct oletls *info, DWORD model)
 
void leave_apartment (struct oletls *info)
 
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 ATOM apt_win_class
 
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

◆ COBJMACROS

#define COBJMACROS

Definition at line 46 of file compobj.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 47 of file compobj.c.

◆ USE_COM_CONTEXT_DEF

#define USE_COM_CONTEXT_DEF

Definition at line 56 of file compobj.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 50 of file compobj.c.

Typedef Documentation

◆ Context

◆ DllCanUnloadNowFunc

typedef HRESULT(WINAPI * DllCanUnloadNowFunc) (void)

Definition at line 453 of file compobj.c.

◆ DllGetClassObjectFunc

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

Definition at line 452 of file compobj.c.

◆ MREImpl

◆ OpenDll

◆ RegisteredClass

Enumeration Type Documentation

◆ comclass_miscfields

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

Definition at line 101 of file compobj.c.

◆ comclass_threadingmodel

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

Function Documentation

◆ actctx_get_miscstatus()

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

Definition at line 257 of file compobj.c.

258 {
259  ACTCTX_SECTION_KEYED_DATA data;
260 
261  data.cbSize = sizeof(data);
262  if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION,
263  clsid, &data))
264  {
265  struct comclassredirect_data *comclass = (struct comclassredirect_data*)data.lpData;
266  enum comclass_miscfields misc = dvaspect_to_miscfields(aspect);
267 
268  if (!(comclass->miscmask & misc))
269  {
270  if (!(comclass->miscmask & MiscStatus))
271  {
272  *status = 0;
273  return TRUE;
274  }
275  misc = MiscStatus;
276  }
277 
278  switch (misc)
279  {
280  case MiscStatus:
281  *status = comclass->miscstatus;
282  break;
283  case MiscStatusIcon:
284  *status = comclass->miscstatusicon;
285  break;
286  case MiscStatusContent:
287  *status = comclass->miscstatuscontent;
288  break;
289  case MiscStatusThumbnail:
290  *status = comclass->miscstatusthumbnail;
291  break;
292  case MiscStatusDocPrint:
293  *status = comclass->miscstatusdocprint;
294  break;
295  default:
296  ;
297  };
298 
299  return TRUE;
300  }
301  else
302  return FALSE;
303 }
#define TRUE
Definition: types.h:120
comclass_miscfields
Definition: compobj.c:101
DWORD miscstatusdocprint
Definition: compobj.c:131
static enum comclass_miscfields dvaspect_to_miscfields(DWORD aspect)
Definition: compobj.c:240
smooth NULL
Definition: ftsmooth.c:416
DWORD miscstatusthumbnail
Definition: compobj.c:129
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
REFCLSID clsid
Definition: msctf.c:84
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

Referenced by OleRegGetMiscStatus().

◆ apartment_addref()

static DWORD apartment_addref ( struct apartment apt)
static

Definition at line 622 of file compobj.c.

623 {
624  DWORD refs = InterlockedIncrement(&apt->refs);
625  TRACE("%s: before = %d\n", wine_dbgstr_longlong(apt->oxid), refs - 1);
626  return refs;
627 }
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define InterlockedIncrement
Definition: armddk.h:53
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41

Referenced by apartment_find_mta(), apartment_findfromoxid(), apartment_findfromtid(), apartment_findmain(), apartment_get_current_or_mta(), and apartment_get_or_create().

◆ apartment_construct()

static APARTMENT* apartment_construct ( DWORD  model)
static

Definition at line 631 of file compobj.c.

632 {
633  APARTMENT *apt;
634 
635  TRACE("creating new apartment, model=%d\n", model);
636 
637  apt = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*apt));
638  apt->tid = GetCurrentThreadId();
639 
640  list_init(&apt->proxies);
641  list_init(&apt->stubmgrs);
642  list_init(&apt->loaded_dlls);
643  apt->ipidc = 0;
644  apt->refs = 1;
645  apt->remunk_exported = FALSE;
646  apt->oidc = 1;
648  DEBUG_SET_CRITSEC_NAME(&apt->cs, "apartment");
649 
651 
652  if (apt->multi_threaded)
653  {
654  /* FIXME: should be randomly generated by in an RPC call to rpcss */
655  apt->oxid = ((OXID)GetCurrentProcessId() << 32) | 0xcafe;
656  }
657  else
658  {
659  /* FIXME: should be randomly generated by in an RPC call to rpcss */
660  apt->oxid = ((OXID)GetCurrentProcessId() << 32) | GetCurrentThreadId();
661  }
662 
663  TRACE("Created apartment on OXID %s\n", wine_dbgstr_longlong(apt->oxid));
664 
665  list_add_head(&apts, &apt->entry);
666 
667  return apt;
668 }
#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
static struct list apts
Definition: compobj.c:81
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
struct list proxies
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:421
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct list loaded_dlls
UINT64 OXID
Definition: marshal.c:87
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
CRITICAL_SECTION cs
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1188
BOOL remunk_exported

Referenced by apartment_get_or_create().

◆ apartment_createwindowifneeded()

HRESULT apartment_createwindowifneeded ( struct apartment apt)

Definition at line 1707 of file compobj.c.

1708 {
1709  static INIT_ONCE class_init_once = INIT_ONCE_STATIC_INIT;
1710 
1711  if (apt->multi_threaded)
1712  return S_OK;
1713 
1714  if (!apt->win)
1715  {
1716  HWND hwnd;
1717 
1718  InitOnceExecuteOnce( &class_init_once, register_class, NULL, NULL );
1719 
1720  hwnd = CreateWindowW(wszAptWinClass, NULL, 0, 0, 0, 0, 0,
1721  HWND_MESSAGE, 0, hProxyDll, NULL);
1722  if (!hwnd)
1723  {
1724  ERR("CreateWindow failed with error %d\n", GetLastError());
1725  return HRESULT_FROM_WIN32(GetLastError());
1726  }
1728  /* someone beat us to it */
1730  }
1731 
1732  return S_OK;
1733 }
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:593
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define HWND_MESSAGE
Definition: winuser.h:1196
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4185
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
smooth NULL
Definition: ftsmooth.c:416
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:1684
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static const WCHAR wszAptWinClass[]
Definition: compobj.c:484

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

◆ apartment_find_mta()

static APARTMENT* apartment_find_mta ( void  )
static

Definition at line 729 of file compobj.c.

730 {
731  APARTMENT *apt;
732 
734 
735  if ((apt = MTA))
736  apartment_addref(apt);
737 
739 
740  return apt;
741 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:622
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static APARTMENT * MTA
Definition: compobj.c:79
static CRITICAL_SECTION csApartment
Definition: compobj.c:83
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by apartment_get_current_or_mta(), and CoGetApartmentType().

◆ apartment_findfromoxid()

APARTMENT* apartment_findfromoxid ( OXID  oxid,
BOOL  ref 
)

Definition at line 1279 of file compobj.c.

1280 {
1281  APARTMENT *result = NULL;
1282  struct list *cursor;
1283 
1286  {
1287  struct apartment *apt = LIST_ENTRY( cursor, struct apartment, entry );
1288  if (apt->oxid == oxid)
1289  {
1290  result = apt;
1291  if (ref) apartment_addref(result);
1292  break;
1293  }
1294  }
1296 
1297  return result;
1298 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:622
uint8_t entry
Definition: isohybrid.c:63
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
Definition: send.c:47
static struct list apts
Definition: compobj.c:81
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:416
static CRITICAL_SECTION csApartment
Definition: compobj.c:83
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

Referenced by ipid_to_ifstub(), std_release_marshal_data(), and std_unmarshal_interface().

◆ apartment_findfromtid()

APARTMENT* apartment_findfromtid ( DWORD  tid)

Definition at line 1303 of file compobj.c.

1304 {
1305  APARTMENT *result = NULL;
1306  struct list *cursor;
1307 
1310  {
1311  struct apartment *apt = LIST_ENTRY( cursor, struct apartment, entry );
1312  if (apt->tid == tid)
1313  {
1314  result = apt;
1316  break;
1317  }
1318  }
1320 
1321  return result;
1322 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:622
uint8_t entry
Definition: isohybrid.c:63
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static struct list apts
Definition: compobj.c:81
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:416
static CRITICAL_SECTION csApartment
Definition: compobj.c:83
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

Referenced by ipid_to_ifstub().

◆ apartment_findmain()

static APARTMENT* apartment_findmain ( void  )
static

Definition at line 1327 of file compobj.c.

1328 {
1329  APARTMENT *result;
1330 
1332 
1335 
1337 
1338  return result;
1339 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:622
static APARTMENT * MainApartment
Definition: compobj.c:80
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION csApartment
Definition: compobj.c:83
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
GLuint64EXT * result
Definition: glext.h:11304

Referenced by apartment_hostobject_in_hostapt().

◆ apartment_freeunusedlibraries()

static void apartment_freeunusedlibraries ( struct apartment apt,
DWORD  delay 
)
static

Definition at line 1135 of file compobj.c.

1136 {
1137  struct apartment_loaded_dll *entry, *next;
1138  EnterCriticalSection(&apt->cs);
1140  {
1141  if (entry->dll->DllCanUnloadNow && (entry->dll->DllCanUnloadNow() == S_OK))
1142  {
1143  DWORD real_delay = delay;
1144 
1145  if (real_delay == INFINITE)
1146  {
1147  /* DLLs that return multi-threaded objects aren't unloaded
1148  * straight away to cope for programs that have races between
1149  * last object destruction and threads in the DLLs that haven't
1150  * finished, despite DllCanUnloadNow returning S_OK */
1151  if (entry->multi_threaded)
1152  real_delay = 10 * 60 * 1000; /* 10 minutes */
1153  else
1154  real_delay = 0;
1155  }
1156 
1157  if (!real_delay || (entry->unload_time && ((int)(GetTickCount() - entry->unload_time) > 0)))
1158  {
1159  list_remove(&entry->entry);
1161  HeapFree(GetProcessHeap(), 0, entry);
1162  }
1163  else
1164  {
1165  entry->unload_time = GetTickCount() + real_delay;
1166  if (!entry->unload_time) entry->unload_time = 1;
1167  }
1168  }
1169  else if (entry->unload_time)
1170  entry->unload_time = 0;
1171  }
1172  LeaveCriticalSection(&apt->cs);
1173 }
#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)
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define GetProcessHeap()
Definition: compat.h:395
unsigned long DWORD
Definition: ntddk_ex.h:95
static void COMPOBJ_DllList_ReleaseRef(OpenDll *entry, BOOL free_entry)
Definition: compobj.c:586
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

Referenced by apartment_release(), and CoFreeUnusedLibrariesEx().

◆ apartment_get_current_or_mta()

APARTMENT* apartment_get_current_or_mta ( void  )

Definition at line 745 of file compobj.c.

746 {
747  APARTMENT *apt = COM_CurrentApt();
748  if (apt)
749  {
750  apartment_addref(apt);
751  return apt;
752  }
753  return apartment_find_mta();
754 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:622
static APARTMENT * COM_CurrentApt(void)
static APARTMENT * apartment_find_mta(void)
Definition: compobj.c:729

Referenced by ClientIdentity_QueryMultipleInterfaces(), ClientRpcChannelBuffer_SendReceive(), CoCreateInstanceEx(), CoDisconnectObject(), CoGetClassObject(), CoGetContextToken(), CoGetPSClsid(), CoLockObjectExternal(), CoRegisterClassObject(), CoRegisterPSClsid(), CoRevokeClassObject(), proxy_manager_get_remunknown(), std_unmarshal_interface(), and StdMarshalImpl_MarshalInterface().

◆ apartment_get_or_create()

static APARTMENT* apartment_get_or_create ( DWORD  model)
static

Definition at line 673 of file compobj.c.

674 {
675  APARTMENT *apt = COM_CurrentApt();
676 
677  if (!apt)
678  {
679  if (model & COINIT_APARTMENTTHREADED)
680  {
682 
683  apt = apartment_construct(model);
684  if (!MainApartment)
685  {
686  MainApartment = apt;
687  apt->main = TRUE;
688  TRACE("Created main-threaded apartment with OXID %s\n", wine_dbgstr_longlong(apt->oxid));
689  }
690 
692 
693  if (apt->main)
695  }
696  else
697  {
699 
700  /* The multi-threaded apartment (MTA) contains zero or more threads interacting
701  * with free threaded (ie thread safe) COM objects. There is only ever one MTA
702  * in a process */
703  if (MTA)
704  {
705  TRACE("entering the multithreaded apartment %s\n", wine_dbgstr_longlong(MTA->oxid));
707  }
708  else
709  MTA = apartment_construct(model);
710 
711  apt = MTA;
712 
714  }
715  COM_CurrentInfo()->apt = apt;
716  }
717 
718  return apt;
719 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:622
#define TRUE
Definition: types.h:120
HRESULT apartment_createwindowifneeded(struct apartment *apt)
Definition: compobj.c:1707
static APARTMENT * apartment_construct(DWORD model)
Definition: compobj.c:631
static APARTMENT * MainApartment
Definition: compobj.c:80
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static struct oletls * COM_CurrentInfo(void)
static APARTMENT * COM_CurrentApt(void)
static APARTMENT * MTA
Definition: compobj.c:79
#define TRACE(s)
Definition: solgame.cpp:4
static CRITICAL_SECTION csApartment
Definition: compobj.c:83
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by enter_apartment().

◆ apartment_getclassobject()

static HRESULT apartment_getclassobject ( struct apartment apt,
LPCWSTR  dllpath,
BOOL  apartment_threaded,
REFCLSID  rclsid,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1343 of file compobj.c.

1346 {
1347  static const WCHAR wszOle32[] = {'o','l','e','3','2','.','d','l','l',0};
1348  HRESULT hr = S_OK;
1349  BOOL found = FALSE;
1351 
1352  if (!strcmpiW(dllpath, wszOle32))
1353  {
1354  /* we don't need to control the lifetime of this dll, so use the local
1355  * implementation of DllGetClassObject directly */
1356  TRACE("calling ole32!DllGetClassObject\n");
1357  hr = DllGetClassObject(rclsid, riid, ppv);
1358 
1359  if (hr != S_OK)
1360  ERR("DllGetClassObject returned error 0x%08x for dll %s\n", hr, debugstr_w(dllpath));
1361 
1362  return hr;
1363  }
1364 
1365  EnterCriticalSection(&apt->cs);
1366 
1369  {
1370  TRACE("found %s already loaded\n", debugstr_w(dllpath));
1371  found = TRUE;
1372  break;
1373  }
1374 
1375  if (!found)
1376  {
1378  if (!apartment_loaded_dll)
1379  hr = E_OUTOFMEMORY;
1380  if (SUCCEEDED(hr))
1381  {
1385  if (FAILED(hr))
1387  }
1388  if (SUCCEEDED(hr))
1389  {
1390  TRACE("added new loaded dll %s\n", debugstr_w(dllpath));
1392  }
1393  }
1394 
1395  LeaveCriticalSection(&apt->cs);
1396 
1397  if (SUCCEEDED(hr))
1398  {
1399  /* one component being multi-threaded overrides any number of
1400  * apartment-threaded components */
1401  if (!apartment_threaded)
1403 
1404  TRACE("calling DllGetClassObject %p\n", apartment_loaded_dll->dll->DllGetClassObject);
1405  /* OK: get the ClassObject */
1407 
1408  if (hr != S_OK)
1409  ERR("DllGetClassObject returned error 0x%08x for dll %s\n", hr, debugstr_w(dllpath));
1410  }
1411 
1412  return hr;
1413 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
uint8_t entry
Definition: isohybrid.c:63
REFIID LPVOID * ppv
Definition: atlbase.h:39
static HRESULT COMPOBJ_DllList_Add(LPCWSTR library_name, OpenDll **ret)
Definition: compobj.c:511
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: shsvcs.c:38
__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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
WCHAR dllpath[MAX_PATH]
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
LPWSTR library_name
Definition: compobj.c:458
struct list entry
Definition: compobj.c:478
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:460

Referenced by apartment_hostobject(), and get_inproc_class_object().

◆ apartment_getwindow()

HWND apartment_getwindow ( const struct apartment apt)

Definition at line 1736 of file compobj.c.

1737 {
1738  assert(!apt->multi_threaded);
1739  return apt->win;
1740 }
BOOL multi_threaded
#define assert(x)
Definition: debug.h:53

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

◆ apartment_hostobject()

static HRESULT apartment_hostobject ( struct apartment apt,
const struct host_object_params params 
)
static

Definition at line 1471 of file compobj.c.

1473 {
1474  IUnknown *object;
1475  HRESULT hr;
1476  static const LARGE_INTEGER llZero;
1477  WCHAR dllpath[MAX_PATH+1];
1478 
1479  TRACE("clsid %s, iid %s\n", debugstr_guid(&params->clsid), debugstr_guid(&params->iid));
1480 
1482  {
1483  /* failure: CLSID is not found in registry */
1484  WARN("class %s not registered inproc\n", debugstr_guid(&params->clsid));
1485  return REGDB_E_CLASSNOTREG;
1486  }
1487 
1488  hr = apartment_getclassobject(apt, dllpath, params->apartment_threaded,
1489  &params->clsid, &params->iid, (void **)&object);
1490  if (FAILED(hr))
1491  return hr;
1492 
1493  hr = CoMarshalInterface(params->stream, &params->iid, object, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1494  if (FAILED(hr))
1495  IUnknown_Release(object);
1496  IStream_Seek(params->stream, llZero, STREAM_SEEK_SET, NULL);
1497 
1498  return hr;
1499 }
HRESULT hr
Definition: shlfolder.c:183
static BOOL get_object_dll_path(const struct class_reg_data *regdata, WCHAR *dst, DWORD dstlen)
Definition: compobj.c:1416
#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:1343
GLenum const GLfloat * params
Definition: glext.h:5645
smooth NULL
Definition: ftsmooth.c:416
static const LARGE_INTEGER llZero
Definition: moniker.c:1113
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR dllpath[MAX_PATH]
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
#define ARRAY_SIZE(a)
Definition: main.h:24
HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:1877
void * object
Definition: jmemsys.h:48

Referenced by apartment_hostobject_thread(), and apartment_wndproc().

◆ apartment_hostobject_in_hostapt()

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

1579 {
1580  struct host_object_params params;
1581  HWND apartment_hwnd = NULL;
1582  DWORD apartment_tid = 0;
1583  HRESULT hr;
1584 
1585  if (!multi_threaded && main_apartment)
1586  {
1587  APARTMENT *host_apt = apartment_findmain();
1588  if (host_apt)
1589  {
1590  apartment_hwnd = apartment_getwindow(host_apt);
1591  apartment_release(host_apt);
1592  }
1593  }
1594 
1595  if (!apartment_hwnd)
1596  {
1597  EnterCriticalSection(&apt->cs);
1598 
1599  if (!apt->host_apt_tid)
1600  {
1601  struct host_thread_params thread_params;
1602  HANDLE handles[2];
1603  DWORD wait_value;
1604 
1605  thread_params.threading_model = multi_threaded ? COINIT_MULTITHREADED : COINIT_APARTMENTTHREADED;
1606  handles[0] = thread_params.ready_event = CreateEventW(NULL, FALSE, FALSE, NULL);
1607  thread_params.apartment_hwnd = NULL;
1608  handles[1] = CreateThread(NULL, 0, apartment_hostobject_thread, &thread_params, 0, &apt->host_apt_tid);
1609  if (!handles[1])
1610  {
1611  CloseHandle(handles[0]);
1612  LeaveCriticalSection(&apt->cs);
1613  return E_OUTOFMEMORY;
1614  }
1615  wait_value = WaitForMultipleObjects(2, handles, FALSE, INFINITE);
1616  CloseHandle(handles[0]);
1617  CloseHandle(handles[1]);
1618  if (wait_value == WAIT_OBJECT_0)
1619  apt->host_apt_hwnd = thread_params.apartment_hwnd;
1620  else
1621  {
1622  LeaveCriticalSection(&apt->cs);
1623  return E_OUTOFMEMORY;
1624  }
1625  }
1626 
1627  if (multi_threaded || !main_apartment)
1628  {
1630  apartment_tid = apt->host_apt_tid;
1631  }
1632 
1633  LeaveCriticalSection(&apt->cs);
1634  }
1635 
1636  /* another thread may have become the main apartment in the time it took
1637  * us to create the thread for the host apartment */
1638  if (!apartment_hwnd && !multi_threaded && main_apartment)
1639  {
1640  APARTMENT *host_apt = apartment_findmain();
1641  if (host_apt)
1642  {
1643  apartment_hwnd = apartment_getwindow(host_apt);
1644  apartment_release(host_apt);
1645  }
1646  }
1647 
1648  params.regdata = *regdata;
1649  params.clsid = *rclsid;
1650  params.iid = *riid;
1651  hr = CreateStreamOnHGlobal(NULL, TRUE, &params.stream);
1652  if (FAILED(hr))
1653  return hr;
1654  params.apartment_threaded = !multi_threaded;
1655  if (multi_threaded)
1656  {
1657  params.hr = S_OK;
1658  params.event = CreateEventW(NULL, FALSE, FALSE, NULL);
1659  if (!PostThreadMessageW(apartment_tid, DM_HOSTOBJECT, 0, (LPARAM)&params))
1660  hr = E_OUTOFMEMORY;
1661  else
1662  {
1664  hr = params.hr;
1665  }
1666  CloseHandle(params.event);
1667  }
1668  else
1669  {
1670  if (!apartment_hwnd)
1671  {
1672  ERR("host apartment didn't create window\n");
1673  hr = E_OUTOFMEMORY;
1674  }
1675  else
1677  }
1678  if (SUCCEEDED(hr))
1679  hr = CoUnmarshalInterface(params.stream, riid, ppv);
1680  IStream_Release(params.stream);
1681  return hr;
1682 }
DWORD host_apt_tid
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1982
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1175
#define DM_HOSTOBJECT
REFIID LPVOID * ppv
Definition: atlbase.h:39
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
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
GLenum const GLfloat * params
Definition: glext.h:5645
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:112
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WAIT_OBJECT_0
Definition: winbase.h:387
static object_header_t ** handles
Definition: handle.c:46
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
HWND apartment_getwindow(const struct apartment *apt)
Definition: compobj.c:1736
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static DWORD CALLBACK apartment_hostobject_thread(LPVOID p)
Definition: compobj.c:1524
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:1327

Referenced by get_inproc_class_object().

◆ apartment_hostobject_thread()

static DWORD CALLBACK apartment_hostobject_thread ( LPVOID  p)
static

Definition at line 1524 of file compobj.c.

1525 {
1526  struct host_thread_params *params = p;
1527  MSG msg;
1528  HRESULT hr;
1529  struct apartment *apt;
1530 
1531  TRACE("\n");
1532 
1533  hr = CoInitializeEx(NULL, params->threading_model);
1534  if (FAILED(hr)) return hr;
1535 
1536  apt = COM_CurrentApt();
1537  if (params->threading_model == COINIT_APARTMENTTHREADED)
1538  {
1540  params->apartment_hwnd = apartment_getwindow(apt);
1541  }
1542  else
1543  params->apartment_hwnd = NULL;
1544 
1545  /* force the message queue to be created before signaling parent thread */
1547 
1548  SetEvent(params->ready_event);
1549  params = NULL; /* can't touch params after here as it may be invalid */
1550 
1551  while (GetMessageW(&msg, NULL, 0, 0))
1552  {
1553  if (!msg.hwnd && (msg.message == DM_HOSTOBJECT))
1554  {
1555  struct host_object_params *obj_params = (struct host_object_params *)msg.lParam;
1556  obj_params->hr = apartment_hostobject(apt, obj_params);
1557  SetEvent(obj_params->event);
1558  }
1559  else
1560  {
1563  }
1564  }
1565 
1566  TRACE("exiting\n");
1567 
1568  CoUninitialize();
1569 
1570  return S_OK;
1571 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
HRESULT apartment_createwindowifneeded(struct apartment *apt)
Definition: compobj.c:1707
HRESULT hr
Definition: shlfolder.c:183
#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
static APARTMENT * COM_CurrentApt(void)
#define PM_NOREMOVE
Definition: winuser.h:1181
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
GLenum const GLfloat * params
Definition: glext.h:5645
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HWND apartment_getwindow(const struct apartment *apt)
Definition: compobj.c:1736
#define WM_USER
Definition: winuser.h:1856
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
static HRESULT apartment_hostobject(struct apartment *apt, const struct host_object_params *params)
Definition: compobj.c:1471
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:1935
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

Referenced by apartment_hostobject_in_hostapt().

◆ apartment_is_model()

static BOOL apartment_is_model ( const APARTMENT apt,
DWORD  model 
)
inlinestatic

Definition at line 721 of file compobj.c.

722 {
723  return (apt->multi_threaded == !(model & COINIT_APARTMENTTHREADED));
724 }
BOOL multi_threaded

Referenced by enter_apartment().

◆ apartment_release()

DWORD apartment_release ( struct apartment apt)

Definition at line 1175 of file compobj.c.

1176 {
1177  DWORD ret;
1178 
1180 
1181  ret = InterlockedDecrement(&apt->refs);
1182  TRACE("%s: after = %d\n", wine_dbgstr_longlong(apt->oxid), ret);
1183 
1184  if (apt->being_destroyed)
1185  {
1187  return ret;
1188  }
1189 
1190  /* destruction stuff that needs to happen under csApartment CS */
1191  if (ret == 0)
1192  {
1193  apt->being_destroyed = TRUE;
1194  if (apt == MTA) MTA = NULL;
1195  else if (apt == MainApartment) MainApartment = NULL;
1196  list_remove(&apt->entry);
1197  }
1198 
1200 
1201  if (ret == 0)
1202  {
1203  struct list *cursor, *cursor2;
1204 
1205  TRACE("destroying apartment %p, oxid %s\n", apt, wine_dbgstr_longlong(apt->oxid));
1206 
1207  if(apt->local_server) {
1210 
1211  memset(&zero, 0, sizeof(zero));
1212  IStream_Seek(local_server->marshal_stream, zero, STREAM_SEEK_SET, NULL);
1213  CoReleaseMarshalData(local_server->marshal_stream);
1214  IStream_Release(local_server->marshal_stream);
1215  local_server->marshal_stream = NULL;
1216 
1217  apt->local_server = NULL;
1218  local_server->apt = NULL;
1219  IServiceProvider_Release(&local_server->IServiceProvider_iface);
1220  }
1221 
1222  /* Release the references to the registered class objects */
1223  COM_RevokeAllClasses(apt);
1224 
1225  /* no locking is needed for this apartment, because no other thread
1226  * can access it at this point */
1227 
1229 
1230  if (apt->win) DestroyWindow(apt->win);
1231  if (apt->host_apt_tid) PostThreadMessageW(apt->host_apt_tid, WM_QUIT, 0, 0);
1232 
1233  LIST_FOR_EACH_SAFE(cursor, cursor2, &apt->stubmgrs)
1234  {
1235  struct stub_manager *stubmgr = LIST_ENTRY(cursor, struct stub_manager, entry);
1236  /* release the implicit reference given by the fact that the
1237  * stub has external references (it must do since it is in the
1238  * stub manager list in the apartment and all non-apartment users
1239  * must have a ref on the apartment and so it cannot be destroyed).
1240  */
1241  stub_manager_int_release(stubmgr);
1242  }
1243 
1244  /* if this assert fires, then another thread took a reference to a
1245  * stub manager without taking a reference to the containing
1246  * apartment, which it must do. */
1248 
1249  if (apt->filter) IMessageFilter_Release(apt->filter);
1250 
1251  /* free as many unused libraries as possible... */
1253 
1254  /* ... and free the memory for the apartment loaded dll entry and
1255  * release the dll list reference without freeing the library for the
1256  * rest */
1257  while ((cursor = list_head(&apt->loaded_dlls)))
1258  {
1263  }
1264 
1266  DeleteCriticalSection(&apt->cs);
1267 
1268  HeapFree(GetProcessHeap(), 0, apt);
1269  }
1270 
1271  return ret;
1272 }
HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
Definition: marshal.c:2056
DWORD host_apt_tid
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
Definition: list.h:192
#define TRUE
Definition: types.h:120
static void apartment_freeunusedlibraries(struct apartment *apt, DWORD delay)
Definition: compobj.c:1135
ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN
Definition: stubmanager.c:311
uint8_t entry
Definition: isohybrid.c:63
APARTMENT * apt
static APARTMENT * MainApartment
Definition: compobj.c:80
#define WM_QUIT
Definition: winuser.h:1605
#define assert(x)
Definition: debug.h:53
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
BOOL WINAPI DestroyWindow(_In_ HWND)
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
#define DEBUG_CLEAR_CRITSEC_NAME(cs)
static APARTMENT * MTA
Definition: compobj.c:79
smooth NULL
Definition: ftsmooth.c:416
LocalServer * local_server
static void COM_RevokeAllClasses(const struct apartment *apt)
Definition: compobj.c:767
__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)
unsigned long DWORD
Definition: ntddk_ex.h:95
static double zero
Definition: j0_y0.c:96
int ret
static void COMPOBJ_DllList_ReleaseRef(OpenDll *entry, BOOL free_entry)
Definition: compobj.c:586
#define InterlockedDecrement
Definition: armddk.h:52
struct list loaded_dlls
static CRITICAL_SECTION csApartment
Definition: compobj.c:83
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:1227
const char cursor[]
Definition: icontest.c:13
struct list entry
LPMESSAGEFILTER filter
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
struct list stubmgrs
BOOL being_destroyed
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

Referenced by apartment_hostobject_in_hostapt(), ClientIdentity_QueryMultipleInterfaces(), ClientRpcChannelBuffer_GetBuffer(), ClientRpcChannelBuffer_SendReceive(), CoCreateInstanceEx(), CoDisconnectObject(), CoGetApartmentType(), CoGetClassObject(), CoGetContextToken(), CoGetPSClsid(), CoLockObjectExternal(), COM_TlsDestroy(), CoRegisterClassObject(), CoRegisterPSClsid(), CoRevokeClassObject(), dispatch_rpc(), ipid_to_ifstub(), leave_apartment(), proxy_manager_get_remunknown(), RemUnknown_RemAddRef(), RemUnknown_RemQueryInterface(), RemUnknown_RemRelease(), std_release_marshal_data(), std_unmarshal_interface(), and StdMarshalImpl_MarshalInterface().

◆ apartment_wndproc()

static LRESULT CALLBACK apartment_wndproc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1501 of file compobj.c.

1502 {
1503  switch (msg)
1504  {
1505  case DM_EXECUTERPC:
1507  return 0;
1508  case DM_HOSTOBJECT:
1509  return apartment_hostobject(COM_CurrentApt(), (const struct host_object_params *)lParam);
1510  default:
1511  return DefWindowProcW(hWnd, msg, wParam, lParam);
1512  }
1513 }
#define DM_HOSTOBJECT
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
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:1331
static HRESULT apartment_hostobject(struct apartment *apt, const struct host_object_params *params)
Definition: compobj.c:1471
#define msg(x)
Definition: auth_time.c:54
#define DM_EXECUTERPC
LPARAM lParam
Definition: combotst.c:139

Referenced by register_class().

◆ clsid_from_string_reg()

static HRESULT clsid_from_string_reg ( LPCOLESTR  progid,
CLSID clsid 
)
static

Definition at line 2199 of file compobj.c.

2200 {
2201  static const WCHAR clsidW[] = { '\\','C','L','S','I','D',0 };
2202  WCHAR buf2[CHARS_IN_GUID];
2203  LONG buf2len = sizeof(buf2);
2204  HKEY xhkey;
2205  WCHAR *buf;
2206 
2207  memset(clsid, 0, sizeof(*clsid));
2208  buf = HeapAlloc( GetProcessHeap(),0,(strlenW(progid)+8) * sizeof(WCHAR) );
2209  if (!buf) return E_OUTOFMEMORY;
2210  strcpyW( buf, progid );
2211  strcatW( buf, clsidW );
2213  {
2215  WARN("couldn't open key for ProgID %s\n", debugstr_w(progid));
2216  return CO_E_CLASSSTRING;
2217  }
2219 
2220  if (RegQueryValueW(xhkey,NULL,buf2,&buf2len))
2221  {
2222  RegCloseKey(xhkey);
2223  WARN("couldn't query clsid value for ProgID %s\n", debugstr_w(progid));
2224  return CO_E_CLASSSTRING;
2225  }
2226  RegCloseKey(xhkey);
2227  return guid_from_string(buf2, clsid) ? S_OK : CO_E_CLASSSTRING;
2228 }
#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:2147
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WARN(fmt,...)
Definition: debug.h:111
#define CHARS_IN_GUID
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:416
#define GetProcessHeap()
Definition: compat.h:395
static const WCHAR clsidW[]
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4272
REFCLSID clsid
Definition: msctf.c:84
#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:423
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

Referenced by CLSIDFromProgID(), and CLSIDFromString().

◆ CLSIDFromProgID()

HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID ( LPCOLESTR  progid,
LPCLSID  clsid 
)

Definition at line 2511 of file compobj.c.

2512 {
2513  ACTCTX_SECTION_KEYED_DATA data;
2514 
2515  if (!progid || !clsid)
2516  return E_INVALIDARG;
2517 
2518  data.cbSize = sizeof(data);
2519  if (FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION,
2520  progid, &data))
2521  {
2522  struct progidredirect_data *progiddata = (struct progidredirect_data*)data.lpData;
2523  CLSID *alias = (CLSID*)((BYTE*)data.lpSectionBase + progiddata->clsid_offset);
2524  *clsid = *alias;
2525  return S_OK;
2526  }
2527 
2529 }
static HRESULT clsid_from_string_reg(LPCOLESTR progid, CLSID *clsid)
Definition: compobj.c:2199
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:416
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
REFCLSID clsid
Definition: msctf.c:84
unsigned char BYTE
Definition: mem.h:68
const WCHAR * alias
Definition: main.c:67
#define S_OK
Definition: intsafe.h:59
#define progid(str)
Definition: exdisp.idl:31

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().

◆ CLSIDFromProgIDEx()

HRESULT WINAPI CLSIDFromProgIDEx ( LPCOLESTR  progid,
LPCLSID  clsid 
)

Definition at line 2534 of file compobj.c.

2535 {
2536  FIXME("%s,%p: semi-stub\n", debugstr_w(progid), clsid);
2537 
2538  return CLSIDFromProgID(progid, clsid);
2539 }
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2511
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
REFCLSID clsid
Definition: msctf.c:84
#define progid(str)
Definition: exdisp.idl:31

◆ CLSIDFromString()

HRESULT WINAPI CLSIDFromString ( LPCOLESTR  idstr,
LPCLSID  id 
)

Definition at line 2247 of file compobj.c.

2248 {
2250  CLSID tmp_id;
2251 
2252  if (!id)
2253  return E_INVALIDARG;
2254 
2255  if (guid_from_string(idstr, id))
2256  return S_OK;
2257 
2258  /* It appears a ProgID is also valid */
2259  ret = clsid_from_string_reg(idstr, &tmp_id);
2260  if(SUCCEEDED(ret))
2261  *id = tmp_id;
2262 
2263  return ret;
2264 }
static HRESULT clsid_from_string_reg(LPCOLESTR progid, CLSID *clsid)
Definition: compobj.c:2199
static BOOL guid_from_string(LPCWSTR s, GUID *id)
Definition: compobj.c:2147
#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

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(), 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(), string_to_guid(), test_CLSIDFromProgID(), test_CLSIDFromString(), test_devenum(), test_first_device(), UIINSERTOBJECTDLG_PopulateObjectTypes(), and wmain().

◆ CoAddRefServerProcess()

ULONG WINAPI CoAddRefServerProcess ( void  )

Definition at line 4071 of file compobj.c.

4072 {
4073  ULONG refs;
4074 
4075  TRACE("\n");
4076 
4080 
4081  TRACE("refs before: %d\n", refs - 1);
4082 
4083  return refs;
4084 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION csRegisteredClassList
Definition: compobj.c:231
#define TRACE(s)
Definition: solgame.cpp:4
static LONG s_COMServerProcessReferences
Definition: compobj.c:207
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by ATL::CAtlExeModuleT< T >::Lock(), and LockModuleOOP().

◆ CoAllowSetForegroundWindow()

HRESULT WINAPI CoAllowSetForegroundWindow ( IUnknown pUnk,
void pvReserved 
)

Definition at line 4143 of file compobj.c.

4144 {
4145  FIXME("(%p, %p): stub\n", pUnk, pvReserved);
4146  return S_OK;
4147 }
#define FIXME(fmt,...)
Definition: debug.h:110
static LPCSTR DWORD void * pvReserved
Definition: str.c:196
#define S_OK
Definition: intsafe.h:59
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

◆ CoBuildVersion()

DWORD WINAPI CoBuildVersion ( void  )

Definition at line 1767 of file compobj.c.

1768 {
1769  TRACE("Returning version %d, build %d.\n", rmm, rup);
1770  return (rmm<<16)+rup;
1771 }
#define rmm
Definition: ole2ver.h:41
#define rup
Definition: ole2ver.h:42
#define TRACE(s)
Definition: solgame.cpp:4

◆ CoCopyProxy()

HRESULT WINAPI CoCopyProxy ( IUnknown pProxy,
IUnknown **  ppCopy 
)

Definition at line 4255 of file compobj.c.

4256 {
4257  IClientSecurity *pCliSec;
4258  HRESULT hr;
4259 
4260  TRACE("%p\n", pProxy);
4261 
4262  hr = IUnknown_QueryInterface(pProxy, &IID_IClientSecurity, (void **)&pCliSec);
4263  if (SUCCEEDED(hr))
4264  {
4265  hr = IClientSecurity_CopyProxy(pCliSec, pProxy, ppCopy);
4266  IClientSecurity_Release(pCliSec);
4267  }
4268 
4269  if (FAILED(hr)) ERR("-- failed with 0x%08x\n", hr);
4270  return hr;
4271 }
HRESULT hr
Definition: shlfolder.c:183
#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

◆ CoCreateGuid()

HRESULT WINAPI CoCreateGuid ( GUID pguid)

Definition at line 2115 of file compobj.c.

2116 {
2117  DWORD status;
2118 
2119  if(!pguid) return E_INVALIDARG;
2120 
2121  status = UuidCreate(pguid);
2122  if (status == RPC_S_OK || status == RPC_S_UUID_LOCAL_ONLY) return S_OK;
2123  return HRESULT_FROM_WIN32( status );
2124 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define E_INVALIDARG
Definition: ddrawi.h:101
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:59
RPC_STATUS WINAPI UuidCreate(UUID *Uuid)
Definition: rpcrt4_main.c:306
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_UUID_LOCAL_ONLY
Definition: winerror.h:1131
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

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().

◆ CoCreateInstance()

HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance ( REFCLSID  rclsid,
LPUNKNOWN  pUnkOuter,
DWORD  dwClsContext,
REFIID  iid,
LPVOID ppv 
)

Definition at line 3234 of file compobj.c.

3240 {
3241  MULTI_QI multi_qi = { iid };
3242  HRESULT hres;
3243 
3244  TRACE("(rclsid=%s, pUnkOuter=%p, dwClsContext=%08x, riid=%s, ppv=%p)\n", debugstr_guid(rclsid),
3245  pUnkOuter, dwClsContext, debugstr_guid(iid), ppv);
3246 
3247  if (ppv==0)
3248  return E_POINTER;
3249 
3250  hres = CoCreateInstanceEx(rclsid, pUnkOuter, dwClsContext, NULL, 1, &multi_qi);
3251  *ppv = multi_qi.pItf;
3252  return hres;
3253 }
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
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:3296
#define E_POINTER
Definition: winerror.h:2365

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(), CNetConnectionManager_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_graph(), create_instance(), create_jscript(), create_lnk_(), create_mime_object(), create_mpeg_splitter(), create_path(), create_root_IDxDiagContainer(), create_script(), create_script_host(), create_server_xhr(), create_session(), create_system_ports_list(), create_test(), create_vbscript(), create_video_renderer(), create_xhr(), CreateAndInitXMLDOMDocument(), CreateCShellMenu(), CreateFilterInstanceAndLoadFile(), SIfacePtr< IShellLink >::CreateInstance(), CreateInternetShortcut(), CreateNotificationObject(), CInputPin::CreatePin(), COutputPin::CreatePin(), CreatePosPassThru(), CreateShellLink(), CreateShortcut(), D3DXGetImageInfoFromFileInMemory(), D3DXLoadSurfaceFromFileInMemory(), D3DXSaveSurfaceToFileInMemory(), DefaultHandler_Construct(), DefaultHandler_Run(), determine_patch_sequence(), DEVENUM_IMediaCatMoniker_BindToObject(), 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(), find_moniker(), get_class_support_data(), get_component_info(), get_mime_filter(), get_mlang(), get_tasks_root_folder(), 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(), implicit_mta_proc(), 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(), LoadAndInitialize(), CComCatCachedCategory::LoadFromComCatMgr(), CShellBrowser::LoadHistory(), CInputPin::LoadProxyPlugins(), COutputPin::LoadProxyPlugins(), CKsProxy::LoadProxyPlugins(), LoadShellLinkConsoleInfo(), locator_ConnectServer(), main_test(), 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_codec(), register_codecs(), register_filters(), RegisterComCat(), 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_basics(), test_CAccPropServices(), test_capture(), test_checklinkpath(), test_CoCreateInstance(), test_cocreateinstance_proxy(), test_codec(), 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_custom_source(), test_customize(), test_datalink(), test_decode_1bpp(), test_decode_24bpp(), test_decode_4bpp(), test_decode_adobe_cmyk(), test_decode_rle4(), test_decode_rle8(), test_decoder_info(), test_default_converter(), test_default_handler(), test_default_handler_run(), test_default_properties(), test_delegated_methods(), test_devenum(), test_directshow_filter(), 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_graph(), test_first_device(), test_fm2_enummatchingfilters(), test_FolderShortcut(), test_get_set(), test_GetCaps(), test_GetDefaultColumn(), test_GetDefaultSearchGUID(), 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_connect(), test_GroupOwner(), test_groups_cs(), test_groups_p2p(), test_hash_value(), test_host_migration(), test_HTMLLoadOptions(), test_IACLCustomMRU_Basics(), test_IACLCustomMRU_Continue(), test_IACLCustomMRU_ExtraChars(), test_IACLCustomMRU_UpdateOrder(), test_IClientSecurity(), test_ico_data_(), test_iconlocation(), test_IEnumVARIANT(), test_ifiltermapper_from_filtergraph(), test_imagingfactory_interfaces(), 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(), 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_midiout(), 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_as_attributes(), test_namespaces_change(), test_NetFwAuthorizedApplication(), test_newline_normalization(), test_newmenu(), 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_popup(), test_prefix_filtering(), test_preinitialization(), test_printers_folder(), test_propertystore(), test_QueryInterface(), test_queryreader(), test_reader_info(), test_Receive(), test_RegExp(), test_register_filter(), 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_StreamOnIStream(), test_StreamOnMemory(), test_StreamOnStreamRange(), test_supporterrorinfo(), test_timeline(), test_timelineobj_interfaces(), test_TreatAsClass(), test_try_xmldoc(), test_UninitializedUri(), test_Verbs(), test_vfw(), test_wavein(), test_waveout(), test_whitespace(), test_wshshell(), test_xmldoc(), test_xmlelem(), test_xmlelem_children(), test_xmlelem_collection(), test_XPath(), test_xsltemplate(), TestDescription(), TestGetUIObjectOf(), TestInitialize(), TestModuleInterfaces(), TestNotification(), TestUninitialized(), CHardErrorThread::ThreadProc(), TransformFilter_Init(), unregister_filters(), UnregisterComCat(), WICCreateColorTransform_Proxy(), write_filter_data(), and WshShortcut_Create().

◆ CoCreateInstanceEx()

HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx ( REFCLSID  rclsid,
LPUNKNOWN  pUnkOuter,
DWORD  dwClsContext,
COSERVERINFO pServerInfo,
ULONG  cmq,
MULTI_QI *  pResults 
)

Definition at line 3296 of file compobj.c.

3303 {
3304  IUnknown *unk = NULL;
3305  IClassFactory *cf;
3306  APARTMENT *apt;
3307  CLSID clsid;
3308  HRESULT hres;
3309 
3310  TRACE("(%s %p %x %p %u %p)\n", debugstr_guid(rclsid), pUnkOuter, dwClsContext, pServerInfo, cmq, pResults);
3311 
3312  if (!cmq || !pResults)
3313  return E_INVALIDARG;
3314 
3315  if (pServerInfo)
3316  FIXME("() non-NULL pServerInfo not supported!\n");
3317 
3318  init_multi_qi(cmq, pResults, E_NOINTERFACE);
3319 
3320  hres = CoGetTreatAsClass(rclsid, &clsid);
3321  if(FAILED(hres))
3322  clsid = *rclsid;
3323 
3324  if (!(apt = apartment_get_current_or_mta()))
3325  {
3326  ERR("apartment not initialised\n");
3327  return CO_E_NOTINITIALIZED;
3328  }
3329  apartment_release(apt);
3330 
3331  /*
3332  * The Standard Global Interface Table (GIT) object is a process-wide singleton.
3333  */
3335  {
3337  TRACE("Retrieving GIT\n");
3338  return return_multi_qi((IUnknown*)git, cmq, pResults, FALSE);
3339  }
3340 
3342  hres = ManualResetEvent_Construct(pUnkOuter, pResults[0].pIID, (void**)&unk);
3343  if (FAILED(hres))
3344  return hres;
3345  return return_multi_qi(unk, cmq, pResults, TRUE);
3346  }
3347 
3348  /*
3349  * Get a class factory to construct the object we want.
3350  */
3351  hres = CoGetClassObject(&clsid, dwClsContext, NULL, &IID_IClassFactory, (void**)&cf);
3352  if (FAILED(hres))
3353  return hres;
3354 
3355  /*
3356  * Create the object and don't forget to release the factory
3357  */
3358  hres = IClassFactory_CreateInstance(cf, pUnkOuter, pResults[0].pIID, (void**)&unk);
3359  IClassFactory_Release(cf);
3360  if (FAILED(hres))
3361  {
3362  if (hres == CLASS_E_NOAGGREGATION && pUnkOuter)
3363  FIXME("Class %s does not support aggregation\n", debugstr_guid(&clsid));
3364  else
3365  FIXME("no instance created for interface %s of class %s, hres is 0x%08x\n",
3366  debugstr_guid(pResults[0].pIID),
3368  return hres;
3369  }
3370 
3371  return return_multi_qi(unk, cmq, pResults, TRUE);
3372 }
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:3266
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1175
#define CO_E_NOTINITIALIZED
#define FIXME(fmt,...)
Definition: debug.h:110
static HRESULT ManualResetEvent_Construct(IUnknown *punkouter, REFIID iid, void **ppv)
Definition: compobj.c:928
#define E_INVALIDARG
Definition: ddrawi.h:101
IGlobalInterfaceTable * get_std_git(void) DECLSPEC_HIDDEN
Definition: git.c:362
smooth NULL
Definition: ftsmooth.c:416
#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:3012
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
const CLSID CLSID_StdGlobalInterfaceTable
REFCLSID clsid
Definition: msctf.c:84
APARTMENT * apartment_get_current_or_mta(void)
Definition: compobj.c:745
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define ERR(fmt,...)
Definition: debug.h:109
const CLSID CLSID_ManualResetEvent
const GUID IID_IClassFactory
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:91
static void init_multi_qi(DWORD count, MULTI_QI *mqi, HRESULT hr)
Definition: compobj.c:3255
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID clsidNew)
Definition: compobj.c:3868

Referenced by CoCreateInstance(), and test_CoCreateInstanceEx().

◆ CoDisconnectObject()

HRESULT WINAPI CoDisconnectObject ( LPUNKNOWN  lpUnk,
DWORD  reserved 
)

Definition at line 2058 of file compobj.c.

2059 {
2060  struct stub_manager *manager;
2061  HRESULT hr;
2062  IMarshal *marshal;
2063  APARTMENT *apt;
2064 
2065  TRACE("(%p, 0x%08x)\n", lpUnk, reserved);
2066 
2067  if (!lpUnk) return E_INVALIDARG;
2068 
2069  hr = IUnknown_QueryInterface(lpUnk, &IID_IMarshal, (void **)&marshal);
2070  if (hr == S_OK)
2071  {
2072  hr = IMarshal_DisconnectObject(marshal, reserved);
2073  IMarshal_Release(marshal);
2074  return hr;
2075  }
2076 
2077  if (!(apt = apartment_get_current_or_mta()))
2078  {
2079  ERR("apartment not initialised\n");
2080  return CO_E_NOTINITIALIZED;
2081  }
2082 
2083  manager = get_stub_manager_from_object(apt, lpUnk, FALSE);
2084  if (manager) {
2085  stub_manager_disconnect(manager);
2086  /* Release stub manager twice, to remove the apartment reference. */
2087  stub_manager_int_release(manager);
2088  stub_manager_int_release(manager);
2089  }
2090 
2091  /* Note: native is pretty broken here because it just silently
2092  * fails, without returning an appropriate error code if the object was
2093  * not found, making apps think that the object was disconnected, when
2094  * it actually wasn't */
2095 
2097  return S_OK;
2098 }
HRESULT hr
Definition: shlfolder.c:183
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1175
ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN
Definition: stubmanager.c:311
APARTMENT * apt
#define CO_E_NOTINITIALIZED
r reserved
Definition: btrfs.c:2655
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
APARTMENT * apartment_get_current_or_mta(void)
Definition: compobj.c:745
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
void stub_manager_disconnect(struct stub_manager *m) DECLSPEC_HIDDEN
Definition: stubmanager.c:244
struct stub_manager * get_stub_manager_from_object(APARTMENT *apt, IUnknown *object, BOOL alloc) DECLSPEC_HIDDEN
Definition: stubmanager.c:337

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

◆ CoFileTimeNow()

HRESULT WINAPI CoFileTimeNow ( FILETIME lpFileTime)

Definition at line 3626 of file compobj.c.

3627 {
3628  GetSystemTimeAsFileTime( lpFileTime );
3629  return S_OK;
3630 }
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
#define S_OK
Definition: intsafe.h:59

Referenced by RunningObjectTableImpl_Register().

◆ CoFreeAllLibraries()

void WINAPI CoFreeAllLibraries ( void  )

Definition at line 3564 of file compobj.c.

3565 {
3566  /* NOP */
3567 }

◆ CoFreeLibrary()

void WINAPI CoFreeLibrary ( HINSTANCE  hLibrary)

Definition at line 3547 of file compobj.c.

3548 {
3550 }
#define FreeLibrary(x)
Definition: compat.h:405
HMODULE hLibrary
Definition: odbccp32.c:12

◆ CoFreeUnusedLibraries()

void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries ( void  )

Definition at line 3610 of file compobj.c.

3611 {
3613 }
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved)
Definition: compobj.c:3586
#define INFINITE
Definition: serial.h:102

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

◆ CoFreeUnusedLibrariesEx()

void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibrariesEx ( DWORD  dwUnloadDelay,
DWORD  dwReserved 
)

Definition at line 3586 of file compobj.c.

3587 {
3588  struct apartment *apt = COM_CurrentApt();
3589  if (!apt)
3590  {
3591  ERR("apartment not initialised\n");
3592  return;
3593  }
3594 
3595  apartment_freeunusedlibraries(apt, dwUnloadDelay);
3596 }
static void apartment_freeunusedlibraries(struct apartment *apt, DWORD delay)
Definition: compobj.c:1135
static APARTMENT * COM_CurrentApt(void)
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by CoFreeUnusedLibraries().

◆ CoGetApartmentType()

HRESULT WINAPI CoGetApartmentType ( APTTYPE *  type,
APTTYPEQUALIFIER qualifier 
)

Definition at line 5111 of file compobj.c.

5112 {
5113  struct oletls *info = COM_CurrentInfo();
5114  APARTMENT *apt;
5115 
5116  TRACE("(%p, %p)\n", type, qualifier);
5117 
5118  if (!type || !qualifier)
5119  return E_INVALIDARG;
5120 
5121  if (!info)
5122  return E_OUTOFMEMORY;
5123 
5124  if (!info->apt)
5125  *type = APTTYPE_CURRENT;
5126  else if (info->apt->multi_threaded)
5127  *type = APTTYPE_MTA;
5128  else if (info->apt->main)
5129  *type = APTTYPE_MAINSTA;
5130  else
5131  *type = APTTYPE_STA;
5132 
5134 
5135  if (!info->apt && (apt = apartment_find_mta()))
5136  {
5138  *type = APTTYPE_MTA;
5140  }
5141 
5142  return info->apt ? S_OK : CO_E_NOTINITIALIZED;
5143 }
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1175
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
enum APTTYPE_MTA
static struct oletls * COM_CurrentInfo(void)
#define CO_E_NOTINITIALIZED
enum APTTYPE_MAINSTA
struct apartment * apt
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
static APTTYPEQUALIFIER * qualifier
Definition: compobj.c:74
#define TRACE(s)
Definition: solgame.cpp:4
static APARTMENT * apartment_find_mta(void)
Definition: compobj.c:729
#define S_OK
Definition: intsafe.h:59
enum APTTYPE_STA

Referenced by Context_CTI_GetCurrentApartmentType(), and Context_CTI_GetCurrentThreadType().

◆ CoGetCallContext()

HRESULT WINAPI CoGetCallContext ( REFIID  riid,
void **  ppv 
)

Definition at line 4288 of file compobj.c.

4289 {
4290  struct oletls *info = COM_CurrentInfo();
4291 
4292  TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
4293 
4294  if (!info)
4295  return E_OUTOFMEMORY;
4296 
4297  if (!info->call_state)
4298  return RPC_E_CALL_COMPLETE;
4299 
4300  return IUnknown_QueryInterface(info->call_state, riid, ppv);
4301 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static struct oletls * COM_CurrentInfo(void)
#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

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

◆ CoGetClassObject()

HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject ( REFCLSID  rclsid,
DWORD  dwClsContext,
COSERVERINFO pServerInfo,
REFIID  iid,
LPVOID ppv 
)

Definition at line 3012 of file compobj.c.

3015 {
3016  struct class_reg_data clsreg;
3017  IUnknown *regClassObject;
3019  APARTMENT *apt;
3020 
3021  TRACE("CLSID: %s,IID: %s\n", debugstr_guid(rclsid), debugstr_guid(iid));
3022 
3023  if (!ppv)
3024  return E_INVALIDARG;
3025 
3026  *ppv = NULL;
3027 
3028  if (!(apt = apartment_get_current_or_mta()))
3029  {
3030  ERR("apartment not initialised\n");
3031  return CO_E_NOTINITIALIZED;
3032  }
3033 
3034  if (pServerInfo) {
3035  FIXME("pServerInfo->name=%s pAuthInfo=%p\n",
3036  debugstr_w(pServerInfo->pwszName), pServerInfo->pAuthInfo);
3037  }
3038 
3039  if (CLSCTX_INPROC_SERVER & dwClsContext)
3040  {
3042  {
3043  apartment_release(apt);
3044  return FTMarshalCF_Create(iid, ppv);
3045  }
3046  if (IsEqualCLSID(rclsid, &CLSID_GlobalOptions))
3047  return IClassFactory_QueryInterface(&GlobalOptionsCF, iid, ppv);
3048  }
3049 
3050  if (CLSCTX_INPROC & dwClsContext)
3051  {
3052  ACTCTX_SECTION_KEYED_DATA data;
3053 
3054  data.cbSize = sizeof(data);
3055  /* search activation context first */
3056  if (FindActCtxSectionGuid(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL,
3057  ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION,
3058  rclsid, &data))
3059  {
3060  struct comclassredirect_data *comclass = (struct comclassredirect_data*)data.lpData;
3061 
3062  clsreg.u.actctx.hactctx = data.hActCtx;
3063  clsreg.u.actctx.data = data.lpData;
3064  clsreg.u.actctx.section = data.lpSectionBase;
3065  clsreg.hkey = FALSE;
3066 
3067  hres = get_inproc_class_object(apt, &clsreg, &comclass->clsid, iid, !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv);
3068  ReleaseActCtx(data.hActCtx);
3069  apartment_release(apt);
3070  return hres;
3071  }
3072  }
3073 
3074  /*
3075  * First, try and see if we can't match the class ID with one of the
3076  * registered classes.
3077  */
3078  if (S_OK == COM_GetRegisteredClassObject(apt, rclsid, dwClsContext,
3079  &regClassObject))
3080  {
3081  /* Get the required interface from the retrieved pointer. */
3082  hres = IUnknown_QueryInterface(regClassObject, iid, ppv);
3083 
3084  /*
3085  * Since QI got another reference on the pointer, we want to release the
3086  * one we already have. If QI was unsuccessful, this will release the object. This
3087  * is good since we are not returning it in the "out" parameter.
3088  */
3089  IUnknown_Release(regClassObject);
3090  apartment_release(apt);
3091  return hres;
3092  }
3093 
3094  /* First try in-process server */
3095  if (CLSCTX_INPROC_SERVER & dwClsContext)
3096  {
3097  static const WCHAR wszInprocServer32[] = {'I','n','p','r','o','c','S','e','r','v','e','r','3','2',0};
3098  HKEY hkey;
3099 
3100  hres = COM_OpenKeyForCLSID(rclsid, wszInprocServer32, KEY_READ, &hkey);
3101  if (FAILED(hres))
3102  {
3103  if (hres == REGDB_E_CLASSNOTREG)
3104  ERR("class %s not registered\n", debugstr_guid(rclsid));
3105  else if (hres == REGDB_E_KEYMISSING)
3106  {
3107  WARN("class %s not registered as in-proc server\n", debugstr_guid(rclsid));
3109  }
3110  }
3111 
3112  if (SUCCEEDED(hres))
3113  {
3114  clsreg.u.hkey = hkey;
3115  clsreg.hkey = TRUE;
3116 
3117  hres = get_inproc_class_object(apt, &clsreg, rclsid, iid, !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv);
3118  RegCloseKey(hkey);
3119  }
3120 
3121  /* return if we got a class, otherwise fall through to one of the
3122  * other types */
3123  if (SUCCEEDED(hres))
3124  {
3125  apartment_release(apt);
3126  return hres;
3127  }
3128  }
3129 
3130  /* Next try in-process handler */
3131  if (CLSCTX_INPROC_HANDLER & dwClsContext)
3132  {
3133  static const WCHAR wszInprocHandler32[] = {'I','n','p','r','o','c','H','a','n','d','l','e','r','3','2',0};
3134  HKEY hkey;
3135 
3136  hres = COM_OpenKeyForCLSID(rclsid, wszInprocHandler32, KEY_READ, &hkey);
3137  if (FAILED(hres))
3138  {
3139  if (hres == REGDB_E_CLASSNOTREG)
3140  ERR("class %s not registered\n", debugstr_guid(rclsid));
3141  else if (hres == REGDB_E_KEYMISSING)
3142  {
3143  WARN("class %s not registered in-proc handler\n", debugstr_guid(rclsid));
3145  }
3146  }
3147 
3148  if (SUCCEEDED(hres))
3149  {
3150  clsreg.u.hkey = hkey;
3151  clsreg.hkey = TRUE;
3152 
3153  hres = get_inproc_class_object(apt, &clsreg, rclsid, iid, !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv);
3154  RegCloseKey(hkey);
3155  }
3156 
3157  /* return if we got a class, otherwise fall through to one of the
3158  * other types */
3159  if (SUCCEEDED(hres))
3160  {
3161  apartment_release(apt);
3162  return hres;
3163  }
3164  }
3165  apartment_release(apt);
3166 
3167  /* Next try out of process */
3168  if (CLSCTX_LOCAL_SERVER & dwClsContext)
3169  {
3170  hres = RPC_GetLocalClassObject(rclsid,iid,ppv);
3171  if (SUCCEEDED(hres))
3172  return hres;
3173  }
3174 
3175  /* Finally try remote: this requires networked DCOM (a lot of work) */
3176  if (CLSCTX_REMOTE_SERVER & dwClsContext)
3177  {
3178  FIXME ("CLSCTX_REMOTE_SERVER not supported\n");
3180  }
3181 
3182  if (FAILED(hres))
3183  ERR("no class object %s could be created for context 0x%x\n",
3184  debugstr_guid(rclsid), dwClsContext);
3185  return hres;
3186 }
#define TRUE
Definition: types.h:120
#define KEY_READ
Definition: nt_native.h:1023
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1175
#define WARN(fmt,...)
Definition: debug.h:111
REFIID LPVOID * ppv
Definition: atlbase.h:39
const CLSID CLSID_InProcFreeMarshaler
#define REGDB_E_KEYMISSING
Definition: winerror.h:2694
#define CO_E_NOTINITIALIZED
static HRESULT COM_GetRegisteredClassObject(const struct apartment *apt, REFCLSID rclsid, DWORD dwClsContext, LPUNKNOWN *ppUnk)
Definition: compobj.c:2741
COAUTHINFO * pAuthInfo
Definition: objidl.idl:34
const CLSID CLSID_GlobalOptions
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#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:416
HRESULT RPC_GetLocalClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) DECLSPEC_HIDDEN
Definition: rpc.c:1808
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2357
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static LPVOID * ppv
Definition: compobj.c:69
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
APARTMENT * apartment_get_current_or_mta(void)
Definition: compobj.c:745
#define ERR(fmt,...)
Definition: debug.h:109
IClassFactory GlobalOptionsCF
Definition: oleproxy.c:162
#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:413
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:2935
#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

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(), implicit_mta_proc(), is_jscript_available(), register_protocols(), START_TEST(), test_about_protocol(), test_capture(), test_CoGetClassObject(), test_com_aggregation(), 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_marshal_channel_buffer(), test_mhtml_protocol(), test_mk_protocol(), test_OleCreateFontIndirect(), test_proxybuffer(), test_res_protocol(), test_stub(), and test_stubbuffer().

◆ CoGetContextToken()

HRESULT WINAPI CoGetContextToken ( ULONG_PTR token)

Definition at line 5023 of file compobj.c.

5024 {
5025  struct oletls *info = COM_CurrentInfo();
5026  APARTMENT *apt;
5027 
5028  TRACE("(%p)\n", token);
5029 
5030  if (!info)
5031  return E_OUTOFMEMORY;
5032 
5033  if (!(apt = apartment_get_current_or_mta()))
5034  {
5035  ERR("apartment not initialised\n");
5036  return CO_E_NOTINITIALIZED;
5037  }
5039 
5040  if (!token)
5041  return E_POINTER;
5042 
5043  if (!info->context_token)
5044  {
5045  Context *context;
5046 
5047  context = HeapAlloc(GetProcessHeap(), 0, sizeof(*context));
5048  if (!context)
5049  return E_OUTOFMEMORY;
5050 
5051  context->IComThreadingInfo_iface.lpVtbl = &Context_Threading_Vtbl;
5052  context->IContextCallback_iface.lpVtbl = &Context_Callback_Vtbl;
5053  context->IObjContext_iface.lpVtbl = &Context_Object_Vtbl;
5054  /* Context token does not take a reference, it's always zero until the
5055  interface is explicitly requested with CoGetObjectContext(). */
5056  context->refs = 0;
5057 
5058  info->context_token = &context->IObjContext_iface;
5059  }
5060 
5061  *token = (ULONG_PTR)info->context_token;
5062  TRACE("context_token=%p\n", info->context_token);
5063 
5064  return S_OK;
5065 }
Definition: http.c:6587
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1175
static struct oletls * COM_CurrentInfo(void)
#define CO_E_NOTINITIALIZED
struct apartment * apt
static const IObjContextVtbl Context_Object_Vtbl
Definition: compobj.c:4974
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static const IContextCallbackVtbl Context_Callback_Vtbl
Definition: compobj.c:4874
APARTMENT * apartment_get_current_or_mta(void)
Definition: compobj.c:745
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static ULONG_PTR
Definition: compobj.c:80
#define E_POINTER
Definition: winerror.h:2365
static const IComThreadingInfoVtbl Context_Threading_Vtbl
Definition: compobj.c:4836

Referenced by CoGetObjectContext(), and implicit_mta_proc().

◆ CoGetCurrentLogicalThreadId()

HRESULT WINAPI CoGetCurrentLogicalThreadId ( GUID id)

Definition at line 3921 of file compobj.c.

3922 {
3923  TRACE("(%p)\n", id);
3924 
3925  if (!id)
3926  return E_INVALIDARG;
3927 
3928  *id = COM_CurrentCausalityId();
3929  return S_OK;
3930 }
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

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

◆ CoGetCurrentProcess()

DWORD WINAPI CoGetCurrentProcess ( void  )

Definition at line 3913 of file compobj.c.

3914 {
3915  return GetCurrentProcessId();
3916 }
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1188

◆ CoGetDefaultContext()

HRESULT WINAPI CoGetDefaultContext ( APTTYPE  type,
REFIID  riid,
LPVOID ppv 
)

Definition at line 5070 of file compobj.c.

5071 {
5072  FIXME("%d %s %p stub\n", type, debugstr_guid(riid), ppv);
5073  return E_NOINTERFACE;
5074 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35

◆ CoGetInstanceFromFile()

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

3387 {
3388  IPersistFile *pf = NULL;
3389  IUnknown* unk = NULL;
3390  CLSID clsid;
3391  HRESULT hr;
3392 
3393  if (count == 0 || !results)
3394  return E_INVALIDARG;
3395 
3396  if (server_info)
3397  FIXME("() non-NULL server_info not supported\n");
3398 
3400 
3401  /* optionally get CLSID from a file */
3402  if (!rclsid)
3403  {
3405  if (FAILED(hr))
3406  {
3407  ERR("failed to get CLSID from a file\n");
3408  return hr;
3409  }
3410 
3411  rclsid = &clsid;
3412  }
3413 
3414  hr = CoCreateInstance(rclsid,
3415  outer,
3416  cls_context,
3417  &IID_IUnknown,
3418  (void**)&unk);
3419 
3420  if (hr != S_OK)
3421  {
3423  return hr;
3424  }
3425 
3426  /* init from file */
3427  hr = IUnknown_QueryInterface(unk, &IID_IPersistFile, (void**)&pf);
3428  if (FAILED(hr))
3429  {
3431  IUnknown_Release(unk);
3432  return hr;
3433  }
3434 
3435  hr = IPersistFile_Load(pf, filename, grfmode);
3436  IPersistFile_Release(pf);
3437  if (SUCCEEDED(hr))
3438  return return_multi_qi(unk, count, results, FALSE);
3439  else
3440  {
3442  IUnknown_Release(unk);
3443  return hr;
3444  }
3445 }
#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:3266
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI GetClassFile(LPCOLESTR filePathName, CLSID *pclsid)
Definition: moniker.c:1217
GLuint GLuint GLsizei count
Definition: gl.h:1545
const char * filename
Definition: ioapi.h:135
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
struct _test_info results[8]
Definition: SetCursorPos.c:29
REFCLSID clsid
Definition: msctf.c:84
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#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:3255
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by test_CoGetInstanceFromFile().

◆ CoGetInstanceFromIStorage()

HRESULT WINAPI CoGetInstanceFromIStorage ( COSERVERINFO server_info,
CLSID rclsid,
IUnknown outer,
DWORD  cls_context,
IStorage storage,
DWORD  count,
MULTI_QI *  results 
)

Definition at line 3450 of file compobj.c.

3459 {
3460  IPersistStorage *ps = NULL;
3461  IUnknown* unk = NULL;
3462  STATSTG stat;
3463  HRESULT hr;
3464 
3465  if (count == 0 || !results || !storage)
3466  return E_INVALIDARG;
3467 
3468  if (server_info)
3469  FIXME("() non-NULL server_info not supported\n");
3470 
3472 
3473  /* optionally get CLSID from a file */
3474  if (!rclsid)
3475  {
3476  memset(&stat.clsid, 0, sizeof(stat.clsid));
3477  hr = IStorage_Stat(storage, &stat, STATFLAG_NONAME);
3478  if (FAILED(hr))
3479  {
3480  ERR("failed to get CLSID from a file\n");
3481  return hr;
3482  }
3483 
3484  rclsid = &stat.clsid;
3485  }
3486 
3487  hr = CoCreateInstance(rclsid,
3488  outer,
3489  cls_context,
3490  &IID_IUnknown,
3491  (void**)&unk);
3492 
3493  if (hr != S_OK)
3494  return hr;
3495 
3496  /* init from IStorage */
3497  hr = IUnknown_QueryInterface(unk, &IID_IPersistStorage, (void**)&ps);
3498  if (FAILED(hr))
3499  ERR("failed to get IPersistStorage\n");
3500 
3501  if (ps)
3502  {
3503  IPersistStorage_Load(ps, storage);
3504  IPersistStorage_Release(ps);
3505  }
3506 
3507  return return_multi_qi(unk, count, results, FALSE);
3508 }
#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:3266
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GUID IID_IPersistStorage
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
struct _test_info results[8]
Definition: SetCursorPos.c:29
Definition: stat.h:55
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#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:3255

◆ CoGetObject()

HRESULT WINAPI CoGetObject ( LPCWSTR  pszName,
BIND_OPTS *  pBindOptions,
REFIID  riid,
void **  ppv 
)

Definition at line 4651 of file compobj.c.

4653 {
4654  IBindCtx *pbc;
4655  HRESULT hr;
4656 
4657  *ppv = NULL;
4658 
4659  hr = CreateBindCtx(0, &pbc);
4660  if (SUCCEEDED(hr))
4661  {
4662  if (pBindOptions)
4663  hr = IBindCtx_SetBindOptions(pbc, pBindOptions);
4664 
4665  if (SUCCEEDED(hr))
4666  {
4667  ULONG chEaten;
4668  IMoniker *pmk;
4669 
4670  hr = MkParseDisplayName(pbc, pszName, &chEaten, &pmk);
4671  if (SUCCEEDED(hr))
4672  {
4673  hr = IMoniker_BindToObject(pmk, pbc, NULL, riid, ppv);
4674  IMoniker_Release(pmk);
4675  }
4676  }
4677 
4678  IBindCtx_Release(pbc);
4679  }
4680  return hr;
4681 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, LPMONIKER *ppmk)
Definition: moniker.c:1133
unsigned int ULONG
Definition: retypes.h:1
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ CoGetObjectContext()

HRESULT WINAPI CoGetObjectContext ( REFIID  riid,
void **  ppv 
)

Definition at line 5005 of file compobj.c.

5006 {
5008  HRESULT hr;
5009 
5010  TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
5011 
5012  *ppv = NULL;
5014  if (FAILED(hr))
5015  return hr;
5016 
5017  return IObjContext_QueryInterface(context, riid, ppv);
5018 }
HRESULT hr
Definition: shlfolder.c:183
Definition: http.c:6587
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT WINAPI CoGetContextToken(ULONG_PTR *token)
Definition: compobj.c:5023
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77

Referenced by implicit_mta_proc().

◆ CoGetPSClsid()

HRESULT WINAPI CoGetPSClsid ( REFIID  riid,
CLSID pclsid 
)

Definition at line 2599 of file compobj.c.

2600 {
2601  static const WCHAR wszInterface[] = {'I','n','t','e','r','f','a','c','e','\\',0};
2602  static const WCHAR wszPSC[] = {'\\','P','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2',0};
2603  WCHAR path[ARRAY_SIZE(wszInterface) - 1 + CHARS_IN_GUID - 1 + ARRAY_SIZE(wszPSC)];
2604  APARTMENT *apt;
2606  ACTCTX_SECTION_KEYED_DATA data;
2607  HRESULT hr;
2608  REGSAM opposite = (sizeof(void*) > sizeof(int)) ? KEY_WOW64_32KEY : KEY_WOW64_64KEY;
2609  BOOL is_wow64;
2610 
2611  TRACE("() riid=%s, pclsid=%p\n", debugstr_guid(riid), pclsid);
2612 
2613  if (!(apt = apartment_get_current_or_mta()))
2614  {
2615  ERR("apartment not initialised\n");
2616  return CO_E_NOTINITIALIZED;
2617  }
2618  apartment_release(apt);
2619 
2620  if (!pclsid)
2621  return E_INVALIDARG;
2622 
2624 
2627  {
2628  *pclsid = registered_psclsid->clsid;
2630  return S_OK;
2631  }
2632 
2634 
2635  data.cbSize = sizeof(data);
2636  if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION,
2637  riid, &data))
2638  {
2639  struct ifacepsredirect_data *ifaceps = (struct ifacepsredirect_data*)data.lpData;
2640  *pclsid = ifaceps->iid;
2641  return S_OK;
2642  }
2643 
2644  /* Interface\\{string form of riid}\\ProxyStubClsid32 */
2645  strcpyW(path, wszInterface);
2646  StringFromGUID2(riid, path + ARRAY_SIZE(wszInterface) - 1, CHARS_IN_GUID);
2647  strcpyW(path + ARRAY_SIZE(wszInterface) - 1 + CHARS_IN_GUID - 1, wszPSC);
2648 
2649  hr = get_ps_clsid_from_registry(path, 0, pclsid);
2650  if (FAILED(hr) && (opposite == KEY_WOW64_32KEY ||
2652  hr = get_ps_clsid_from_registry(path, opposite, pclsid);
2653 
2654  if (hr == S_OK)
2655  TRACE ("() Returning CLSID=%s\n", debugstr_guid(pclsid));
2656  else
2657  WARN("No PSFactoryBuffer object is registered for IID %s\n", debugstr_guid(riid));
2658 
2659  return hr;
2660 }
static struct list registered_psclsid_list
Definition: compobj.c:175
static CRITICAL_SECTION cs_registered_psclsid_list
Definition: compobj.c:177
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1175
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
struct apartment * apt
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
unsigned int BOOL
Definition: ntddk_ex.h:94
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
BOOL WINAPI IsWow64Process(IN HANDLE hProcess, OUT PBOOL Wow64Process)
Definition: proc.c:2004
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
static BOOL is_wow64
Definition: loader.c:55
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
APARTMENT * apartment_get_current_or_mta(void)
Definition: compobj.c:745
#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
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: services.c:325
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:2541
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90

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

◆ CoGetState()

HRESULT WINAPI CoGetState ( IUnknown **  ppv)

Definition at line 3728 of file compobj.c.

3729 {
3730  struct oletls *info = COM_CurrentInfo();
3731  if (!info) return E_OUTOFMEMORY;
3732 
3733  *ppv = NULL;
3734 
3735  if (info->state)
3736  {
3737  IUnknown_AddRef(info->state);
3738  *ppv = info->state;
3739  TRACE("apt->state=%p\n", info->state);
3740  }
3741 
3742  return S_OK;
3743 }
REFIID LPVOID * ppv
Definition: atlbase.h:39
static struct oletls * COM_CurrentInfo(void)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ CoGetTreatAsClass()

HRESULT WINAPI CoGetTreatAsClass ( REFCLSID  clsidOld,
LPCLSID  clsidNew 
)

Definition at line 3868 of file compobj.c.

3869 {
3870  static const WCHAR wszTreatAs[] = {'T','r','e','a','t','A','s',0};
3871  HKEY hkey = NULL;
3872  WCHAR szClsidNew[CHARS_IN_GUID];
3873  HRESULT res = S_OK;
3874  LONG len = sizeof(szClsidNew);
3875 
3876  TRACE("(%s,%p)\n", debugstr_guid(clsidOld), clsidNew);
3877 
3878  if (!clsidOld || !clsidNew)
3879  return E_INVALIDARG;
3880 
3881  *clsidNew = *clsidOld; /* copy over old value */
3882 
3883  res = COM_OpenKeyForCLSID(clsidOld, wszTreatAs, KEY_READ, &hkey);
3884  if (FAILED(res))
3885  {
3886  res = S_FALSE;
3887  goto done;
3888  }
3889  if (RegQueryValueW(hkey, NULL, szClsidNew, &len))
3890  {
3891  res = S_FALSE;
3892  goto done;
3893  }
3894  res = CLSIDFromString(szClsidNew,clsidNew);
3895  if (FAILED(res))
3896  ERR("Failed CLSIDFromStringA(%s), hres 0x%08x\n", debugstr_w(szClsidNew), res);
3897 done:
3898  if (hkey) RegCloseKey(hkey);
3899  return res;
3900 }
#define KEY_READ
Definition: nt_native.h:1023
#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:416
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2357
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
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:2247

Referenced by CoCreateInstanceEx().

◆ CoImpersonateClient()

HRESULT WINAPI CoImpersonateClient ( void  )

Definition at line 4403 of file compobj.c.

4404 {
4405  IServerSecurity *pSrvSec;
4406  HRESULT hr;
4407 
4408  TRACE("\n");
4409 
4410  hr = CoGetCallContext(&IID_IServerSecurity, (void **)&pSrvSec);
4411  if (SUCCEEDED(hr))
4412  {
4413  hr = IServerSecurity_ImpersonateClient(pSrvSec);
4414  IServerSecurity_Release(pSrvSec);
4415  }
4416 
4417  return hr;
4418 }
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI CoGetCallContext(REFIID riid, void **ppv)
Definition: compobj.c:4288
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ CoInitialize()

HRESULT WINAPI CoInitialize ( LPVOID  lpReserved)

Definition at line 1897 of file compobj.c.

1898 {
1899  /*
1900  * Just delegate to the newer method.
1901  */
1902  return CoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED);
1903 }
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:1935

Referenced by _CmdWndProc(), CRecyclerDropTarget::_DoDeleteThreadProc(), CFSDropTarget::_DoDropThreadProc(), ACTION_CreateShortcuts(), AMovieDllRegisterServer2(), bsc_thread(), cache_across_threads_test(), cache_InstallAssembly(), cache_UninstallAssembly(), call_script(), CCoInit::CCoInit(), CGuidItemExtractIcon_CreateInstance(), ComInit::ComInit(), cowait_unmarshal_thread(), crash_couninitialize_proc(), CreateSecurityPage(), CreateShortcut(), CreateShortcuts(), DirectInput8Create(), DllMain(), DllRegisterServer(), get_global_interface_proc(), IEWinMain(), init_test(), initialize(), InitIconOverlays(), InitInstance(), InitXMLDOMParser(), LoadShellLinkConsoleInfo(), local_server_proc(), 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_controlevent(), test_DPA_LoadStream(), test_DPA_SaveStream(), test_externalui_message(), test_GetDefaultColumn(), test_GetDefaultSearchGUID(), test_GlobalOptions(), test_iface_ptr(), 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_StreamOnStreamRange(), test_top_level_action(), unregister_filters(), WinMain(), wmain(), and wWinMain().

◆ CoInitializeEx()

HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx ( LPVOID  lpReserved,
DWORD  dwCoInit 
)

Definition at line 1935 of file compobj.c.

1936 {
1937  struct oletls *info = COM_CurrentInfo();
1938  HRESULT hr;
1939 
1940  TRACE("(%p, %x)\n", lpReserved, (int)dwCoInit);
1941 
1942  if (lpReserved!=NULL)
1943  {
1944  ERR("(%p, %x) - Bad parameter passed-in %p, must be an old Windows Application\n", lpReserved, (int)dwCoInit, lpReserved);
1945  }
1946 
1947  /*
1948  * Check the lock count. If this is the first time going through the initialize
1949  * process, we have to initialize the libraries.
1950  *
1951  * And crank-up that lock count.
1952  */
1954  {
1955  /*
1956  * Initialize the various COM libraries and data structures.
1957  */
1958  TRACE("() - Initializing the COM libraries\n");
1959 
1960  /* we may need to defer this until after apartment initialisation */
1962  }
1963 
1964  if (info->spy)
1965  IInitializeSpy_PreInitialize(info->spy, dwCoInit, info->inits);
1966 
1968 
1969  if (info->spy)
1970  IInitializeSpy_PostInitialize(info->spy, hr, dwCoInit, info->inits);
1971 
1972  return hr;
1973 }
HRESULT hr
Definition: shlfolder.c:183
static DWORD dwCoInit
Definition: compobj.c:68
static struct oletls * COM_CurrentInfo(void)
smooth NULL
Definition: ftsmooth.c:416
#define InterlockedExchangeAdd
Definition: interlocked.h:181
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HRESULT enter_apartment(struct oletls *info, DWORD model)
Definition: compobj.c:1846
#define ERR(fmt,...)
Definition: debug.h:109
static LONG s_COMLockCount
Definition: compobj.c:205
HRESULT WINAPI RunningObjectTableImpl_Initialize(void) DECLSPEC_HIDDEN
Definition: moniker.c:983

Referenced by apartment_hostobject_thread(), ChooseFolder(), CoInitialize(), D3DXGetImageInfoFromFileInMemory(), D3DXLoadSurfaceFromFileInMemory(), D3DXSaveSurfaceToFileInMemory(), DllMain(), dummy_thread_proc(), FileExtractDialogWndProc(), host_object_proc(), implicit_mta_unmarshal_proc(), implicit_mta_use_proc(), ATL::CAtlExeModuleT< T >::InitializeCom(), InitializeSecurity(), is_firewall_enabled(), MCIQTZ_mciOpen(), ole_server(), OleInitialize(), parse_config_file(), PullPin_Thread_Main(), server(), set_firewall(), SHLWAPI_ThreadWrapper(), START_TEST(), StartCount(), CSysTray::SysTrayThreadProc(), test_CoWaitForMultipleHandles(), test_IInitializeSpy_register2(), test_IInitializeSpy_switch_apt(), test_implicit_mta(), test_render_with_multithread(), test_RtlQueryPackageIdentity(), test_shortcut(), test_stub(), test_WICCreateColorTransform_Proxy(), TestClasses(), TestThread(), union_tests(), and WICCreateColorTransform_Proxy().

◆ CoInitializeSecurity()

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

4036 {
4037  FIXME("(%p,%d,%p,%p,%d,%d,%p,%d,%p) - stub!\n", pSecDesc, cAuthSvc,
4038  asAuthSvc, pReserved1, dwAuthnLevel, dwImpLevel, pReserved2,
4039  dwCapabilities, pReserved3);
4040  return S_OK;
4041 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

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

◆ CoInitializeWOW()

HRESULT WINAPI CoInitializeWOW ( DWORD  x,
DWORD  y 
)

Definition at line 3702 of file compobj.c.

3703 {
3704  FIXME("(0x%08x,0x%08x),stub!\n",x,y);
3705  return 0;
3706 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define FIXME(fmt,...)
Definition: debug.h:110
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ CoIsHandlerConnected()

BOOL WINAPI CoIsHandlerConnected ( IUnknown pUnk)

Definition at line 4132 of file compobj.c.

4133 {
4134  FIXME("%p\n", pUnk);
4135 
4136  return TRUE;
4137 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:110
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30

◆ CoIsOle1Class()

BOOL WINAPI CoIsOle1Class ( REFCLSID  clsid)

Definition at line 4002 of file compobj.c.

4003 {
4004  FIXME("%s\n", debugstr_guid(clsid));
4005  return