ReactOS  0.4.11-dev-433-g473ca91
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
 
#define ARRAYSIZE(array)   (sizeof(array)/sizeof((array)[0]))
 

Typedefs

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

Enumerations

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

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static enum comclass_miscfields dvaspect_to_miscfields (DWORD aspect)
 
BOOL actctx_get_miscstatus (const CLSID *clsid, DWORD aspect, DWORD *status)
 
static NTSTATUS create_key (HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr)
 
static HKEY create_classes_root_hkey (DWORD access)
 
static HKEY get_classes_root_hkey (HKEY hkey, REGSAM access)
 
LSTATUS create_classes_key (HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey)
 
LSTATUS open_classes_key (HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey)
 
static OpenDllCOMPOBJ_DllList_Get (LPCWSTR library_name)
 
static HRESULT COMPOBJ_DllList_Add (LPCWSTR library_name, OpenDll **ret)
 
static void COMPOBJ_DllList_ReleaseRef (OpenDll *entry, BOOL free_entry)
 
static void COMPOBJ_DllList_Free (void)
 
static DWORD apartment_addref (struct apartment *apt)
 
static APARTMENTapartment_construct (DWORD model)
 
static APARTMENTapartment_get_or_create (DWORD model)
 
static BOOL apartment_is_model (const APARTMENT *apt, DWORD model)
 
static 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 DWORD COM_RegReadPath (const struct class_reg_data *regdata, WCHAR *dst, DWORD dstlen)
 
static HRESULT apartment_hostobject (struct apartment *apt, const struct host_object_params *params)
 
static LRESULT CALLBACK apartment_wndproc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static DWORD CALLBACK apartment_hostobject_thread (LPVOID p)
 
static HRESULT apartment_hostobject_in_hostapt (struct apartment *apt, BOOL multi_threaded, BOOL main_apartment, const struct class_reg_data *regdata, REFCLSID rclsid, REFIID riid, void **ppv)
 
static BOOL WINAPI register_class (INIT_ONCE *once, void *param, void **context)
 
HRESULT apartment_createwindowifneeded (struct apartment *apt)
 
HWND apartment_getwindow (const struct apartment *apt)
 
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 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

#define COBJMACROS

Definition at line 46 of file compobj.c.

#define NONAMELESSUNION

Definition at line 47 of file compobj.c.

#define USE_COM_CONTEXT_DEF

Definition at line 56 of file compobj.c.

#define WIN32_NO_STATUS

Definition at line 50 of file compobj.c.

Typedef Documentation

typedef HRESULT(WINAPI * DllCanUnloadNowFunc)(void)

Definition at line 455 of file compobj.c.

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

Definition at line 454 of file compobj.c.

Enumeration Type Documentation

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

Definition at line 103 of file compobj.c.

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

Definition at line 94 of file compobj.c.

Function Documentation

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

Definition at line 259 of file compobj.c.

Referenced by OleRegGetMiscStatus().

260 {
261  ACTCTX_SECTION_KEYED_DATA data;
262 
263  data.cbSize = sizeof(data);
264  if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION,
265  clsid, &data))
266  {
267  struct comclassredirect_data *comclass = (struct comclassredirect_data*)data.lpData;
268  enum comclass_miscfields misc = dvaspect_to_miscfields(aspect);
269 
270  if (!(comclass->miscmask & misc))
271  {
272  if (!(comclass->miscmask & MiscStatus))
273  {
274  *status = 0;
275  return TRUE;
276  }
277  misc = MiscStatus;
278  }
279 
280  switch (misc)
281  {
282  case MiscStatus:
283  *status = comclass->miscstatus;
284  break;
285  case MiscStatusIcon:
286  *status = comclass->miscstatusicon;
287  break;
288  case MiscStatusContent:
289  *status = comclass->miscstatuscontent;
290  break;
291  case MiscStatusThumbnail:
292  *status = comclass->miscstatusthumbnail;
293  break;
294  case MiscStatusDocPrint:
295  *status = comclass->miscstatusdocprint;
296  break;
297  default:
298  ;
299  };
300 
301  return TRUE;
302  }
303  else
304  return FALSE;
305 }
#define TRUE
Definition: types.h:120
comclass_miscfields
Definition: compobj.c:103
DWORD miscstatusdocprint
Definition: compobj.c:133
#define FALSE
Definition: types.h:117
static enum comclass_miscfields dvaspect_to_miscfields(DWORD aspect)
Definition: compobj.c:242
smooth NULL
Definition: ftsmooth.c:416
DWORD miscstatusthumbnail
Definition: compobj.c:131
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, const GUID *lpSearchGuid, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:183
Definition: ps.c:97
static DWORD apartment_addref ( struct apartment apt)
static

Definition at line 622 of file compobj.c.

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

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

Definition at line 631 of file compobj.c.

Referenced by apartment_get_or_create().

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
#define FALSE
Definition: types.h:117
static struct list apts
Definition: compobj.c:83
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
struct list proxies
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:444
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct list loaded_dlls
struct list entry
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
struct list stubmgrs
const XML_Char XML_Content * model
Definition: expat.h:151
CRITICAL_SECTION cs
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1215
BOOL remunk_exported
HRESULT apartment_createwindowifneeded ( struct apartment apt)

Definition at line 1710 of file compobj.c.

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

1711 {
1712  static INIT_ONCE class_init_once = INIT_ONCE_STATIC_INIT;
1713 
1714  if (apt->multi_threaded)
1715  return S_OK;
1716 
1717  if (!apt->win)
1718  {
1719  HWND hwnd;
1720 
1721  InitOnceExecuteOnce( &class_init_once, register_class, NULL, NULL );
1722 
1723  hwnd = CreateWindowW(wszAptWinClass, NULL, 0, 0, 0, 0, 0,
1724  HWND_MESSAGE, 0, hProxyDll, NULL);
1725  if (!hwnd)
1726  {
1727  ERR("CreateWindow failed with error %d\n", GetLastError());
1728  return HRESULT_FROM_WIN32(GetLastError());
1729  }
1730  if (InterlockedCompareExchangePointer((PVOID *)&apt->win, hwnd, NULL))
1731  /* someone beat us to it */
1732  DestroyWindow(hwnd);
1733  }
1734 
1735  return S_OK;
1736 }
DWORD *typedef PVOID
Definition: winlogon.h:61
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
HANDLE HWND
Definition: compat.h:13
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:1687
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static const WCHAR wszAptWinClass[]
Definition: compobj.c:486
static APARTMENT* apartment_find_mta ( void  )
static

Definition at line 729 of file compobj.c.

Referenced by apartment_get_current_or_mta(), and CoGetApartmentType().

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:81
static CRITICAL_SECTION csApartment
Definition: compobj.c:85
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
APARTMENT* apartment_findfromoxid ( OXID  oxid,
BOOL  ref 
)

Definition at line 1279 of file compobj.c.

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

1280 {
1281  APARTMENT *result = NULL;
1282  struct list *cursor;
1283 
1285  LIST_FOR_EACH( cursor, &apts )
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:83
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:416
static CRITICAL_SECTION csApartment
Definition: compobj.c:85
Definition: _list.h:228
const char cursor[]
Definition: icontest.c:13
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
GLuint64EXT * result
Definition: glext.h:11304
APARTMENT* apartment_findfromtid ( DWORD  tid)

Definition at line 1303 of file compobj.c.

Referenced by ipid_to_ifstub().

1304 {
1305  APARTMENT *result = NULL;
1306  struct list *cursor;
1307 
1309  LIST_FOR_EACH( cursor, &apts )
1310  {
1311  struct apartment *apt = LIST_ENTRY( cursor, struct apartment, entry );
1312  if (apt->tid == tid)
1313  {
1314  result = apt;
1315  apartment_addref(result);
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:83
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:416
static CRITICAL_SECTION csApartment
Definition: compobj.c:85
Definition: _list.h:228
const char cursor[]
Definition: icontest.c:13
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
GLuint64EXT * result
Definition: glext.h:11304
static TfClientId tid
static APARTMENT* apartment_findmain ( void  )
static

Definition at line 1327 of file compobj.c.

Referenced by apartment_hostobject_in_hostapt().

1328 {
1329  APARTMENT *result;
1330 
1332 
1333  result = MainApartment;
1334  if (result) apartment_addref(result);
1335 
1337 
1338  return result;
1339 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:622
static APARTMENT * MainApartment
Definition: compobj.c:82
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION csApartment
Definition: compobj.c:85
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
GLuint64EXT * result
Definition: glext.h:11304
static void apartment_freeunusedlibraries ( struct apartment apt,
DWORD  delay 
)
static

Definition at line 1135 of file compobj.c.

Referenced by apartment_release(), and CoFreeUnusedLibrariesEx().

1136 {
1137  struct apartment_loaded_dll *entry, *next;
1138  EnterCriticalSection(&apt->cs);
1139  LIST_FOR_EACH_ENTRY_SAFE(entry, next, &apt->loaded_dlls, struct apartment_loaded_dll, entry)
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)
DllCanUnloadNowFunc DllCanUnloadNow
Definition: compobj.c:463
DWORD DWORD
Definition: winlogon.h:84
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define GetProcessHeap()
Definition: compat.h:395
struct list entry
Definition: compobj.c:480
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
APARTMENT* apartment_get_current_or_mta ( void  )

Definition at line 745 of file compobj.c.

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

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
static APARTMENT* apartment_get_or_create ( DWORD  model)
static

Definition at line 673 of file compobj.c.

Referenced by enter_apartment().

674 {
675  APARTMENT *apt = COM_CurrentApt();
676 
677  if (!apt)
678  {
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
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:1710
static APARTMENT * apartment_construct(DWORD model)
Definition: compobj.c:631
static APARTMENT * MainApartment
Definition: compobj.c:82
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static struct oletls * COM_CurrentInfo(void)
static APARTMENT * COM_CurrentApt(void)
static APARTMENT * MTA
Definition: compobj.c:81
#define TRACE(s)
Definition: solgame.cpp:4
static CRITICAL_SECTION csApartment
Definition: compobj.c:85
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
const XML_Char XML_Content * model
Definition: expat.h:151
static HRESULT apartment_getclassobject ( struct apartment apt,
LPCWSTR  dllpath,
BOOL  apartment_threaded,
REFCLSID  rclsid,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1343 of file compobj.c.

Referenced by apartment_hostobject(), and get_inproc_class_object().

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 
1367  LIST_FOR_EACH_ENTRY(apartment_loaded_dll, &apt->loaded_dlls, struct apartment_loaded_dll, entry)
1368  if (!strcmpiW(dllpath, apartment_loaded_dll->dll->library_name))
1369  {
1370  TRACE("found %s already loaded\n", debugstr_w(dllpath));
1371  found = TRUE;
1372  break;
1373  }
1374 
1375  if (!found)
1376  {
1377  apartment_loaded_dll = HeapAlloc(GetProcessHeap(), 0, sizeof(*apartment_loaded_dll));
1378  if (!apartment_loaded_dll)
1379  hr = E_OUTOFMEMORY;
1380  if (SUCCEEDED(hr))
1381  {
1382  apartment_loaded_dll->unload_time = 0;
1383  apartment_loaded_dll->multi_threaded = FALSE;
1384  hr = COMPOBJ_DllList_Add( dllpath, &apartment_loaded_dll->dll );
1385  if (FAILED(hr))
1386  HeapFree(GetProcessHeap(), 0, apartment_loaded_dll);
1387  }
1388  if (SUCCEEDED(hr))
1389  {
1390  TRACE("added new loaded dll %s\n", debugstr_w(dllpath));
1391  list_add_tail(&apt->loaded_dlls, &apartment_loaded_dll->entry);
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)
1402  apartment_loaded_dll->multi_threaded = TRUE;
1403 
1404  TRACE("calling DllGetClassObject %p\n", apartment_loaded_dll->dll->DllGetClassObject);
1405  /* OK: get the ClassObject */
1406  hr = apartment_loaded_dll->dll->DllGetClassObject(rclsid, riid, ppv);
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
REFIID riid
Definition: precomp.h:44
uint8_t entry
Definition: isohybrid.c:63
static HRESULT COMPOBJ_DllList_Add(LPCWSTR library_name, OpenDll **ret)
Definition: compobj.c:511
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: shsvcs.c:38
static HMODULE dll
Definition: str.c:188
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
WCHAR dllpath[MAX_PATH]
if(!(yy_init))
Definition: macro.lex.yy.c:717
LONG HRESULT
Definition: typedefs.h:77
struct list entry
Definition: compobj.c:480
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:462
HWND apartment_getwindow ( const struct apartment apt)

Definition at line 1739 of file compobj.c.

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

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

Definition at line 1474 of file compobj.c.

Referenced by apartment_hostobject_thread(), and apartment_wndproc().

1476 {
1477  IUnknown *object;
1478  HRESULT hr;
1479  static const LARGE_INTEGER llZero;
1480  WCHAR dllpath[MAX_PATH+1];
1481 
1482  TRACE("clsid %s, iid %s\n", debugstr_guid(&params->clsid), debugstr_guid(&params->iid));
1483 
1484  if (COM_RegReadPath(&params->regdata, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS)
1485  {
1486  /* failure: CLSID is not found in registry */
1487  WARN("class %s not registered inproc\n", debugstr_guid(&params->clsid));
1488  return REGDB_E_CLASSNOTREG;
1489  }
1490 
1491  hr = apartment_getclassobject(apt, dllpath, params->apartment_threaded,
1492  &params->clsid, &params->iid, (void **)&object);
1493  if (FAILED(hr))
1494  return hr;
1495 
1496  hr = CoMarshalInterface(params->stream, &params->iid, object, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
1497  if (FAILED(hr))
1498  IUnknown_Release(object);
1499  IStream_Seek(params->stream, llZero, STREAM_SEEK_SET, NULL);
1500 
1501  return hr;
1502 }
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WARN(fmt,...)
Definition: debug.h:111
static HRESULT apartment_getclassobject(struct apartment *apt, LPCWSTR dllpath, BOOL apartment_threaded, REFCLSID rclsid, REFIID riid, void **ppv)
Definition: compobj.c:1343
static DWORD COM_RegReadPath(const struct class_reg_data *regdata, WCHAR *dst, DWORD dstlen)
Definition: compobj.c:1420
smooth NULL
Definition: ftsmooth.c:416
static const LARGE_INTEGER llZero
Definition: moniker.c:1113
#define debugstr_guid
Definition: kernel32.h:35
BOOL apartment_threaded
Definition: compobj.c:1471
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR dllpath[MAX_PATH]
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
#define ARRAYSIZE(array)
Definition: compobj.c:75
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
struct class_reg_data regdata
Definition: compobj.c:1465
HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:1724
void * object
Definition: jmemsys.h:48
IStream * stream
Definition: compobj.c:1470
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 1579 of file compobj.c.

Referenced by get_inproc_class_object().

1582 {
1583  struct host_object_params params;
1584  HWND apartment_hwnd = NULL;
1585  DWORD apartment_tid = 0;
1586  HRESULT hr;
1587 
1588  if (!multi_threaded && main_apartment)
1589  {
1590  APARTMENT *host_apt = apartment_findmain();
1591  if (host_apt)
1592  {
1593  apartment_hwnd = apartment_getwindow(host_apt);
1594  apartment_release(host_apt);
1595  }
1596  }
1597 
1598  if (!apartment_hwnd)
1599  {
1600  EnterCriticalSection(&apt->cs);
1601 
1602  if (!apt->host_apt_tid)
1603  {
1604  struct host_thread_params thread_params;
1605  HANDLE handles[2];
1606  DWORD wait_value;
1607 
1608  thread_params.threading_model = multi_threaded ? COINIT_MULTITHREADED : COINIT_APARTMENTTHREADED;
1609  handles[0] = thread_params.ready_event = CreateEventW(NULL, FALSE, FALSE, NULL);
1610  thread_params.apartment_hwnd = NULL;
1611  handles[1] = CreateThread(NULL, 0, apartment_hostobject_thread, &thread_params, 0, &apt->host_apt_tid);
1612  if (!handles[1])
1613  {
1614  CloseHandle(handles[0]);
1615  LeaveCriticalSection(&apt->cs);
1616  return E_OUTOFMEMORY;
1617  }
1618  wait_value = WaitForMultipleObjects(2, handles, FALSE, INFINITE);
1619  CloseHandle(handles[0]);
1620  CloseHandle(handles[1]);
1621  if (wait_value == WAIT_OBJECT_0)
1622  apt->host_apt_hwnd = thread_params.apartment_hwnd;
1623  else
1624  {
1625  LeaveCriticalSection(&apt->cs);
1626  return E_OUTOFMEMORY;
1627  }
1628  }
1629 
1630  if (multi_threaded || !main_apartment)
1631  {
1632  apartment_hwnd = apt->host_apt_hwnd;
1633  apartment_tid = apt->host_apt_tid;
1634  }
1635 
1636  LeaveCriticalSection(&apt->cs);
1637  }
1638 
1639  /* another thread may have become the main apartment in the time it took
1640  * us to create the thread for the host apartment */
1641  if (!apartment_hwnd && !multi_threaded && main_apartment)
1642  {
1643  APARTMENT *host_apt = apartment_findmain();
1644  if (host_apt)
1645  {
1646  apartment_hwnd = apartment_getwindow(host_apt);
1647  apartment_release(host_apt);
1648  }
1649  }
1650 
1651  params.regdata = *regdata;
1652  params.clsid = *rclsid;
1653  params.iid = *riid;
1654  hr = CreateStreamOnHGlobal(NULL, TRUE, &params.stream);
1655  if (FAILED(hr))
1656  return hr;
1657  params.apartment_threaded = !multi_threaded;
1658  if (multi_threaded)
1659  {
1660  params.hr = S_OK;
1661  params.event = CreateEventW(NULL, FALSE, FALSE, NULL);
1662  if (!PostThreadMessageW(apartment_tid, DM_HOSTOBJECT, 0, (LPARAM)&params))
1663  hr = E_OUTOFMEMORY;
1664  else
1665  {
1666  WaitForSingleObject(params.event, INFINITE);
1667  hr = params.hr;
1668  }
1669  CloseHandle(params.event);
1670  }
1671  else
1672  {
1673  if (!apartment_hwnd)
1674  {
1675  ERR("host apartment didn't create window\n");
1676  hr = E_OUTOFMEMORY;
1677  }
1678  else
1679  hr = SendMessageW(apartment_hwnd, DM_HOSTOBJECT, 0, (LPARAM)&params);
1680  }
1681  if (SUCCEEDED(hr))
1682  hr = CoUnmarshalInterface(params.stream, riid, ppv);
1683  IStream_Release(params.stream);
1684  return hr;
1685 }
DWORD host_apt_tid
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1838
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
REFIID riid
Definition: precomp.h:44
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1175
#define DM_HOSTOBJECT
HANDLE HWND
Definition: compat.h:13
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
Definition: synch.c:151
DWORD DWORD
Definition: winlogon.h:84
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HWND host_apt_hwnd
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FALSE
Definition: types.h:117
GLenum const GLfloat * params
Definition: glext.h:5645
LONG_PTR LPARAM
Definition: windef.h:208
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:135
smooth NULL
Definition: ftsmooth.c:416
#define WAIT_OBJECT_0
Definition: winbase.h:387
static object_header_t ** handles
Definition: handle.c:46
LONG HRESULT
Definition: typedefs.h:77
HWND apartment_getwindow(const struct apartment *apt)
Definition: compobj.c:1739
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
DWORD *typedef HANDLE
Definition: winlogon.h:61
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static DWORD CALLBACK apartment_hostobject_thread(LPVOID p)
Definition: compobj.c:1527
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
static DWORD CALLBACK apartment_hostobject_thread ( LPVOID  p)
static

Definition at line 1527 of file compobj.c.

Referenced by apartment_hostobject_in_hostapt().

1528 {
1529  struct host_thread_params *params = p;
1530  MSG msg;
1531  HRESULT hr;
1532  struct apartment *apt;
1533 
1534  TRACE("\n");
1535 
1536  hr = CoInitializeEx(NULL, params->threading_model);
1537  if (FAILED(hr)) return hr;
1538 
1539  apt = COM_CurrentApt();
1541  {
1543  params->apartment_hwnd = apartment_getwindow(apt);
1544  }
1545  else
1546  params->apartment_hwnd = NULL;
1547 
1548  /* force the message queue to be created before signaling parent thread */
1550 
1551  SetEvent(params->ready_event);
1552  params = NULL; /* can't touch params after here as it may be invalid */
1553 
1554  while (GetMessageW(&msg, NULL, 0, 0))
1555  {
1556  if (!msg.hwnd && (msg.message == DM_HOSTOBJECT))
1557  {
1558  struct host_object_params *obj_params = (struct host_object_params *)msg.lParam;
1559  obj_params->hr = apartment_hostobject(apt, obj_params);
1560  SetEvent(obj_params->event);
1561  }
1562  else
1563  {
1564  TranslateMessage(&msg);
1565  DispatchMessageW(&msg);
1566  }
1567  }
1568 
1569  TRACE("exiting\n");
1570 
1571  CoUninitialize();
1572 
1573  return S_OK;
1574 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
HRESULT apartment_createwindowifneeded(struct apartment *apt)
Definition: compobj.c:1710
#define DM_HOSTOBJECT
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
COINIT threading_model
Definition: compobj.c:1520
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:1739
HANDLE ready_event
Definition: compobj.c:1521
#define WM_USER
Definition: winuser.h:1856
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
static HRESULT apartment_hostobject(struct apartment *apt, const struct host_object_params *params)
Definition: compobj.c:1474
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:1938
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
GLfloat GLfloat p
Definition: glext.h:8902
static BOOL apartment_is_model ( const APARTMENT apt,
DWORD  model 
)
inlinestatic

Definition at line 721 of file compobj.c.

Referenced by enter_apartment().

722 {
723  return (apt->multi_threaded == !(model & COINIT_APARTMENTTHREADED));
724 }
BOOL multi_threaded
const XML_Char XML_Content * model
Definition: expat.h:151
DWORD apartment_release ( struct apartment apt)

Definition at line 1175 of file compobj.c.

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(), StdMarshalImpl_MarshalInterface(), StdMarshalImpl_ReleaseMarshalData(), and StdMarshalImpl_UnmarshalInterface().

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. */
1247  assert(list_empty(&apt->stubmgrs));
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  {
1259  struct apartment_loaded_dll *apartment_loaded_dll = LIST_ENTRY(cursor, struct apartment_loaded_dll, entry);
1260  COMPOBJ_DllList_ReleaseRef(apartment_loaded_dll->dll, FALSE);
1261  list_remove(cursor);
1262  HeapFree(GetProcessHeap(), 0, apartment_loaded_dll);
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:1907
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
IStream * marshal_stream
Definition: compobj.c:199
ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN
Definition: stubmanager.c:311
uint8_t entry
Definition: isohybrid.c:63
static APARTMENT * MainApartment
Definition: compobj.c:82
#define WM_QUIT
Definition: winuser.h:1605
#define assert(x)
Definition: debug.h:53
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
BOOL WINAPI DestroyWindow(_In_ HWND)
DWORD DWORD
Definition: winlogon.h:84
IServiceProvider IServiceProvider_iface
Definition: compobj.c:196
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
#define FALSE
Definition: types.h:117
#define DEBUG_CLEAR_CRITSEC_NAME(cs)
static APARTMENT * MTA
Definition: compobj.c:81
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)
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:85
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:1144
const char cursor[]
Definition: icontest.c:13
struct list entry
APARTMENT * apt
Definition: compobj.c:198
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
static LRESULT CALLBACK apartment_wndproc ( HWND  hWnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1504 of file compobj.c.

Referenced by register_class().

1505 {
1506  switch (msg)
1507  {
1508  case DM_EXECUTERPC:
1510  return 0;
1511  case DM_HOSTOBJECT:
1512  return apartment_hostobject(COM_CurrentApt(), (const struct host_object_params *)lParam);
1513  default:
1514  return DefWindowProcW(hWnd, msg, wParam, lParam);
1515  }
1516 }
#define DM_HOSTOBJECT
HWND hWnd
Definition: settings.c:17
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static APARTMENT * COM_CurrentApt(void)
void RPC_ExecuteCall(struct dispatch_params *params) DECLSPEC_HIDDEN
Definition: rpc.c:1329
UINT WPARAM wParam
Definition: precomp.h:45
static HRESULT apartment_hostobject(struct apartment *apt, const struct host_object_params *params)
Definition: compobj.c:1474
UINT WPARAM LPARAM lParam
Definition: precomp.h:45
UINT msg
Definition: msvc.h:92
#define DM_EXECUTERPC
static HRESULT clsid_from_string_reg ( LPCOLESTR  progid,
CLSID clsid 
)
static

Definition at line 2202 of file compobj.c.

Referenced by CLSIDFromProgID(), and CLSIDFromString().

2203 {
2204  static const WCHAR clsidW[] = { '\\','C','L','S','I','D',0 };
2205  WCHAR buf2[CHARS_IN_GUID];
2206  LONG buf2len = sizeof(buf2);
2207  HKEY xhkey;
2208  WCHAR *buf;
2209 
2210  memset(clsid, 0, sizeof(*clsid));
2211  buf = HeapAlloc( GetProcessHeap(),0,(strlenW(progid)+8) * sizeof(WCHAR) );
2212  if (!buf) return E_OUTOFMEMORY;
2213  strcpyW( buf, progid );
2214  strcatW( buf, clsidW );
2216  {
2217  HeapFree(GetProcessHeap(),0,buf);
2218  WARN("couldn't open key for ProgID %s\n", debugstr_w(progid));
2219  return CO_E_CLASSSTRING;
2220  }
2221  HeapFree(GetProcessHeap(),0,buf);
2222 
2223  if (RegQueryValueW(xhkey,NULL,buf2,&buf2len))
2224  {
2225  RegCloseKey(xhkey);
2226  WARN("couldn't query clsid value for ProgID %s\n", debugstr_w(progid));
2227  return CO_E_CLASSSTRING;
2228  }
2229  RegCloseKey(xhkey);
2230  return guid_from_string(buf2, clsid) ? S_OK : CO_E_CLASSSTRING;
2231 }
#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:2150
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
__wchar_t WCHAR
Definition: xmlstorage.h:180
#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)
HANDLE HKEY
Definition: registry.h:24
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4272
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
LSTATUS open_classes_key(HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey)
Definition: compobj.c:425
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
#define progid(str)
Definition: exdisp.idl:31
#define CO_E_CLASSSTRING
Definition: winerror.h:2806
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:394
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID ( LPCOLESTR  progid,
LPCLSID  clsid 
)

Definition at line 2514 of file compobj.c.

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

2515 {
2516  ACTCTX_SECTION_KEYED_DATA data;
2517 
2518  if (!progid || !clsid)
2519  return E_INVALIDARG;
2520 
2521  data.cbSize = sizeof(data);
2522  if (FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION,
2523  progid, &data))
2524  {
2525  struct progidredirect_data *progiddata = (struct progidredirect_data*)data.lpData;
2526  CLSID *alias = (CLSID*)((BYTE*)data.lpSectionBase + progiddata->clsid_offset);
2527  *clsid = *alias;
2528  return S_OK;
2529  }
2530 
2531  return clsid_from_string_reg(progid, clsid);
2532 }
static HRESULT clsid_from_string_reg(LPCOLESTR progid, CLSID *clsid)
Definition: compobj.c:2202
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
const WCHAR * alias
Definition: main.c:67
unsigned char BYTE
Definition: ntddk_ex.h:96
#define S_OK
Definition: intsafe.h:59
#define progid(str)
Definition: exdisp.idl:31
HRESULT WINAPI CLSIDFromProgIDEx ( LPCOLESTR  progid,
LPCLSID  clsid 
)

Definition at line 2537 of file compobj.c.

2538 {
2539  FIXME("%s,%p: semi-stub\n", debugstr_w(progid), clsid);
2540 
2541  return CLSIDFromProgID(progid, clsid);
2542 }
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2514
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define progid(str)
Definition: exdisp.idl:31
HRESULT WINAPI CLSIDFromString ( LPCOLESTR  idstr,
LPCLSID  id 
)

Definition at line 2250 of file compobj.c.

Referenced by ACTION_MsiPublishAssemblies(), ACTION_PublishFeatures(), build_directshowfilters_tree(), CategoryMgr_FindClosestCategory(), CATIDEnumGUID_Next(), CLSIDEnumGUID_Next(), CLSIDFromStringWrap(), CoGetTreatAsClass(), COMCAT_IEnumCATEGORYINFO_Next(), ComponentInfo_GetGuidList(), ComponentInfo_GetGUIDValue(), CoTreatAsClass(), CreateComponentEnumerator(), CreateNotificationObject(), DEVENUM_IMediaCatMoniker_BindToObject(), DEVENUM_IParseDisplayName_ParseDisplayName(), DEVENUM_ReadPinTypes(), 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().

2251 {
2253  CLSID tmp_id;
2254 
2255  if (!id)
2256  return E_INVALIDARG;
2257 
2258  if (guid_from_string(idstr, id))
2259  return S_OK;
2260 
2261  /* It appears a ProgID is also valid */
2262  ret = clsid_from_string_reg(idstr, &tmp_id);
2263  if(SUCCEEDED(ret))
2264  *id = tmp_id;
2265 
2266  return ret;
2267 }
static HRESULT clsid_from_string_reg(LPCOLESTR progid, CLSID *clsid)
Definition: compobj.c:2202
static BOOL guid_from_string(LPCWSTR s, GUID *id)
Definition: compobj.c:2150
#define E_INVALIDARG
Definition: ddrawi.h:101
LONG HRESULT
Definition: typedefs.h:77
int ret
#define S_OK
Definition: intsafe.h:59
#define CO_E_CLASSSTRING
Definition: winerror.h:2806
#define SUCCEEDED(hr)
Definition: intsafe.h:57
ULONG WINAPI CoAddRefServerProcess ( void  )

Definition at line 4074 of file compobj.c.

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

4075 {
4076  ULONG refs;
4077 
4078  TRACE("\n");
4079 
4083 
4084  TRACE("refs before: %d\n", refs - 1);
4085 
4086  return refs;
4087 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION csRegisteredClassList
Definition: compobj.c:233
#define TRACE(s)
Definition: solgame.cpp:4
static LONG s_COMServerProcessReferences
Definition: compobj.c:209
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
HRESULT WINAPI CoAllowSetForegroundWindow ( IUnknown pUnk,
void pvReserved 
)

Definition at line 4146 of file compobj.c.

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

Definition at line 1770 of file compobj.c.

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

Definition at line 4258 of file compobj.c.

4259 {
4260  IClientSecurity *pCliSec;
4261  HRESULT hr;
4262 
4263  TRACE("%p\n", pProxy);
4264 
4265  hr = IUnknown_QueryInterface(pProxy, &IID_IClientSecurity, (void **)&pCliSec);
4266  if (SUCCEEDED(hr))
4267  {
4268  hr = IClientSecurity_CopyProxy(pCliSec, pProxy, ppCopy);
4269  IClientSecurity_Release(pCliSec);
4270  }
4271 
4272  if (FAILED(hr)) ERR("-- failed with 0x%08x\n", hr);
4273  return hr;
4274 }
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define ERR(fmt,...)
Definition: debug.h:109
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HRESULT WINAPI CoCreateGuid ( GUID pguid)

Definition at line 2118 of file compobj.c.

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

2119 {
2120  DWORD status;
2121 
2122  if(!pguid) return E_INVALIDARG;
2123 
2124  status = UuidCreate(pguid);
2125  if (status == RPC_S_OK || status == RPC_S_UUID_LOCAL_ONLY) return S_OK;
2126  return HRESULT_FROM_WIN32( status );
2127 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
DWORD DWORD
Definition: winlogon.h:84
#define E_INVALIDARG
Definition: ddrawi.h:101
#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
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance ( REFCLSID  rclsid,
LPUNKNOWN  pUnkOuter,
DWORD  dwClsContext,
REFIID  iid,
LPVOID ppv 
)

Definition at line 3237 of file compobj.c.

Referenced by _CBandSite_CreateInstance(), _CBandSiteMenu_CreateInstance(), _create_object(), _CStartMenu_CreateInstance(), activate_given_ts(), add_favs_to_menu(), AMovieDllRegisterServer2(), AtlAxCreateControlLicEx(), AtlRegisterClassCategoriesHelper(), ATL::AtlRegisterClassCategoriesHelper(), AVIFileOpenW(), AVIMakeCompressedStream(), AVIStreamCreate(), BaseOutputPinImpl_InitAllocator(), build_directshowfilters_tree(), cache_InstallAssembly(), cache_UninstallAssembly(), CAddressBand_CreateInstance(), CAddressEditBox_CreateInstance(), call_script(), CBandProxy_CreateInstance(), CBrandBand_CreateInstance(), CExplorerBand_CreateInstance(), check_bits20(), check_bits25(), check_ie(), check_jscript(), check_lnk_(), check_tiff_format(), check_vbscript(), CInternetToolbar_CreateInstance(), CMenuBand_CreateInstance(), CMergedFolder_CreateInstance(), CNetworkConnections::CNetworkConnections(), CoGetInstanceFromFile(), CoGetInstanceFromIStorage(), CommitDecommitTest(), confirm_safety(), cp_from_charset_string(), create_ammultimediastream(), create_audio_data(), create_avisplitter(), create_configuration(), create_doc_from_url(), create_document(), create_dsound_renderer(), create_engine(), create_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_bad_icondirentry_size(), 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_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_iconlocation(), test_IEnumVARIANT(), test_ifiltermapper_from_filtergraph(), test_init(), test_Initialize(), test_InitializeConnection(), test_inmemorystore(), test_inproc_handler(), test_instantiation(), test_interfaces(), test_invalid_init(), test_IObjectSafety(), test_IPersistStream(), test_IProgressDialog_QueryInterface(), test_IQueryAssociations_GetString(), test_IQueryAssociations_Init(), test_IQueryAssociations_QueryInterface(), test_IReferenceClock_SystemClock(), test_Item(), test_items(), test_IWbemLocator(), test_IWinHttpRequest(), test_IWinHttpRequest_Invoke(), test_Keys(), test_knownFolders(), test_legacy_filter(), 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_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_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_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().

3243 {
3244  MULTI_QI multi_qi = { iid };
3245  HRESULT hres;
3246 
3247  TRACE("(rclsid=%s, pUnkOuter=%p, dwClsContext=%08x, riid=%s, ppv=%p)\n", debugstr_guid(rclsid),
3248  pUnkOuter, dwClsContext, debugstr_guid(iid), ppv);
3249 
3250  if (ppv==0)
3251  return E_POINTER;
3252 
3253  hres = CoCreateInstanceEx(rclsid, pUnkOuter, dwClsContext, NULL, 1, &multi_qi);
3254  *ppv = multi_qi.pItf;
3255  return hres;
3256 }
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:3299
#define E_POINTER
Definition: winerror.h:2365
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx ( REFCLSID  rclsid,
LPUNKNOWN  pUnkOuter,
DWORD  dwClsContext,
COSERVERINFO pServerInfo,
ULONG  cmq,
MULTI_QI *  pResults 
)

Definition at line 3299 of file compobj.c.

Referenced by CoCreateInstance(), and test_CoCreateInstanceEx().

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

Definition at line 2061 of file compobj.c.

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

2062 {
2063  struct stub_manager *manager;
2064  HRESULT hr;
2065  IMarshal *marshal;
2066  APARTMENT *apt;
2067 
2068  TRACE("(%p, 0x%08x)\n", lpUnk, reserved);
2069 
2070  if (!lpUnk) return E_INVALIDARG;
2071 
2072  hr = IUnknown_QueryInterface(lpUnk, &IID_IMarshal, (void **)&marshal);
2073  if (hr == S_OK)
2074  {
2075  hr = IMarshal_DisconnectObject(marshal, reserved);
2076  IMarshal_Release(marshal);
2077  return hr;
2078  }
2079 
2080  if (!(apt = apartment_get_current_or_mta()))
2081  {
2082  ERR("apartment not initialised\n");
2083  return CO_E_NOTINITIALIZED;
2084  }
2085 
2086  manager = get_stub_manager_from_object(apt, lpUnk, FALSE);
2087  if (manager) {
2088  stub_manager_disconnect(manager);
2089  /* Release stub manager twice, to remove the apartment reference. */
2090  stub_manager_int_release(manager);
2091  stub_manager_int_release(manager);
2092  }
2093 
2094  /* Note: native is pretty broken here because it just silently
2095  * fails, without returning an appropriate error code if the object was
2096  * not found, making apps think that the object was disconnected, when
2097  * it actually wasn't */
2098 
2099  apartment_release(apt);
2100  return S_OK;
2101 }
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
#define FALSE
Definition: types.h:117
r reserved
Definition: btrfs.c:2640
#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
HRESULT WINAPI CoFileTimeNow ( FILETIME lpFileTime)

Definition at line 3629 of file compobj.c.

Referenced by RunningObjectTableImpl_Register().

3630 {
3631  GetSystemTimeAsFileTime( lpFileTime );
3632  return S_OK;
3633 }
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
#define S_OK
Definition: intsafe.h:59
void WINAPI CoFreeAllLibraries ( void  )

Definition at line 3567 of file compobj.c.

3568 {
3569  /* NOP */
3570 }
void WINAPI CoFreeLibrary ( HINSTANCE  hLibrary)

Definition at line 3550 of file compobj.c.

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

Definition at line 3613 of file compobj.c.

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

3614 {
3616 }
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved)
Definition: compobj.c:3589
#define INFINITE
Definition: serial.h:102
void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibrariesEx ( DWORD  dwUnloadDelay,
DWORD  dwReserved 
)

Definition at line 3589 of file compobj.c.

Referenced by CoFreeUnusedLibraries().

3590 {
3591  struct apartment *apt = COM_CurrentApt();
3592  if (!apt)
3593  {
3594  ERR("apartment not initialised\n");
3595  return;
3596  }
3597 
3598  apartment_freeunusedlibraries(apt, dwUnloadDelay);
3599 }
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
HRESULT WINAPI CoGetApartmentType ( APTTYPE *  type,
APTTYPEQUALIFIER qualifier 
)

Definition at line 5114 of file compobj.c.

Referenced by Context_CTI_GetCurrentApartmentType(), and Context_CTI_GetCurrentThreadType().

5115 {
5116  struct oletls *info = COM_CurrentInfo();
5117  APARTMENT *apt;
5118 
5119  TRACE("(%p, %p)\n", type, qualifier);
5120 
5121  if (!type || !qualifier)
5122  return E_INVALIDARG;
5123 
5124  if (!info)
5125  return E_OUTOFMEMORY;
5126 
5127  if (!info->apt)
5128  *type = APTTYPE_CURRENT;
5129  else if (info->apt->multi_threaded)
5130  *type = APTTYPE_MTA;
5131  else if (info->apt->main)
5132  *type = APTTYPE_MAINSTA;
5133  else
5134  *type = APTTYPE_STA;
5135 
5137 
5138  if (!info->apt && (apt = apartment_find_mta()))
5139  {
5140  apartment_release(apt);
5141  *type = APTTYPE_MTA;
5143  }
5144 
5145  return info->apt ? S_OK : CO_E_NOTINITIALIZED;
5146 }
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:80
#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
HRESULT WINAPI CoGetCallContext ( REFIID  riid,
void **  ppv 
)

Definition at line 4291 of file compobj.c.

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

4292 {
4293  struct oletls *info = COM_CurrentInfo();
4294 
4295  TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
4296 
4297  if (!info)
4298  return E_OUTOFMEMORY;
4299 
4300  if (!info->call_state)
4301  return RPC_E_CALL_COMPLETE;
4302 
4303  return IUnknown_QueryInterface(info->call_state, riid, ppv);
4304 }
REFIID riid
Definition: precomp.h:44
static struct oletls * COM_CurrentInfo(void)
IUnknown * call_state
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define RPC_E_CALL_COMPLETE
Definition: winerror.h:2499
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject ( REFCLSID  rclsid,
DWORD  dwClsContext,
COSERVERINFO pServerInfo,
REFIID  iid,
LPVOID ppv 
)

Definition at line 3015 of file compobj.c.

Referenced by ClassMoniker_BindToObject(), CoCreateInstanceEx(), create_activex_object(), create_object(), get_class_object(), get_class_object_proxy_thread(), get_facbuf_for_iid(), get_protocol_cf(), IDirectSound8_tests(), IDirectSound_tests(), 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().

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

Definition at line 5026 of file compobj.c.

Referenced by CoGetObjectContext(), and implicit_mta_proc().

5027 {
5028  struct oletls *info = COM_CurrentInfo();
5029  APARTMENT *apt;
5030 
5031  TRACE("(%p)\n", token);
5032 
5033  if (!info)
5034  return E_OUTOFMEMORY;
5035 
5036  if (!(apt = apartment_get_current_or_mta()))
5037  {
5038  ERR("apartment not initialised\n");
5039  return CO_E_NOTINITIALIZED;
5040  }
5041  apartment_release(apt);
5042 
5043  if (!token)
5044  return E_POINTER;
5045 
5046  if (!info->context_token)
5047  {
5048  Context *context;
5049 
5050  context = HeapAlloc(GetProcessHeap(), 0, sizeof(*context));
5051  if (!context)
5052  return E_OUTOFMEMORY;
5053 
5055  context->IContextCallback_iface.lpVtbl = &Context_Callback_Vtbl;
5056  context->IObjContext_iface.lpVtbl = &Context_Object_Vtbl;
5057  /* Context token does not take a reference, it's always zero until the
5058  interface is explicitly requested with CoGetObjectContext(). */
5059  context->refs = 0;
5060 
5061  info->context_token = &context->IObjContext_iface;
5062  }
5063 
5064  *token = (ULONG_PTR)info->context_token;
5065  TRACE("context_token=%p\n", info->context_token);
5066 
5067  return S_OK;
5068 }
IObjContext * context_token
LONG refs
Definition: compobj.c:4711
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1175
static struct oletls * COM_CurrentInfo(void)
#define CO_E_NOTINITIALIZED
IObjContext IObjContext_iface
Definition: compobj.c:4710
struct apartment * apt
static const IObjContextVtbl Context_Object_Vtbl
Definition: compobj.c:4977
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
int token
Definition: lex.c:71
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
IContextCallback IContextCallback_iface
Definition: compobj.c:4709
static const IContextCallbackVtbl Context_Callback_Vtbl
Definition: compobj.c:4877
IComThreadingInfo IComThreadingInfo_iface
Definition: compobj.c:4708
APARTMENT * apartment_get_current_or_mta(void)
Definition: compobj.c:745
const XML_Char * context
Definition: expat.h:434
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static ULONG_PTR
Definition: compobj.c:86
#define E_POINTER
Definition: winerror.h:2365
static const IComThreadingInfoVtbl Context_Threading_Vtbl
Definition: compobj.c:4839
HRESULT WINAPI CoGetCurrentLogicalThreadId ( GUID id)

Definition at line 3924 of file compobj.c.

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

3925 {
3926  TRACE("(%p)\n", id);
3927 
3928  if (!id)
3929  return E_INVALIDARG;
3930 
3931  *id = COM_CurrentCausalityId();
3932  return S_OK;
3933 }
static GUID COM_CurrentCausalityId(void)
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
DWORD WINAPI CoGetCurrentProcess ( void  )

Definition at line 3916 of file compobj.c.

3917 {
3918  return GetCurrentProcessId();
3919 }
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1215
HRESULT WINAPI CoGetDefaultContext ( APTTYPE  type,
REFIID  riid,
LPVOID ppv 
)

Definition at line 5073 of file compobj.c.

5074 {
5075  FIXME("%d %s %p stub\n", type, debugstr_guid(riid), ppv);
5076  return E_NOINTERFACE;
5077 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetInstanceFromFile ( COSERVERINFO server_info,
CLSID rclsid,
IUnknown outer,
DWORD  cls_context,
DWORD  grfmode,
OLECHAR filename,
DWORD  count,
MULTI_QI *  results 
)

Definition at line 3380 of file compobj.c.

Referenced by test_CoGetInstanceFromFile().

3390 {
3391  IPersistFile *pf = NULL;
3392  IUnknown* unk = NULL;
3393  CLSID clsid;
3394  HRESULT hr;
3395 
3396  if (count == 0 || !results)
3397  return E_INVALIDARG;
3398 
3399  if (server_info)
3400  FIXME("() non-NULL server_info not supported\n");
3401 
3403 
3404  /* optionally get CLSID from a file */
3405  if (!rclsid)
3406  {
3407  hr = GetClassFile(filename, &clsid);
3408  if (FAILED(hr))
3409  {
3410  ERR("failed to get CLSID from a file\n");
3411  return hr;
3412  }
3413 
3414  rclsid = &clsid;
3415  }
3416 
3417  hr = CoCreateInstance(rclsid,
3418  outer,
3419  cls_context,
3420  &IID_IUnknown,
3421  (void**)&unk);
3422 
3423  if (hr != S_OK)
3424  {
3425  init_multi_qi(count, results, hr);
3426  return hr;
3427  }
3428 
3429  /* init from file */
3430  hr = IUnknown_QueryInterface(unk, &IID_IPersistFile, (void**)&pf);
3431  if (FAILED(hr))
3432  {
3433  init_multi_qi(count, results, hr);
3434  IUnknown_Release(unk);
3435  return hr;
3436  }
3437 
3438  hr = IPersistFile_Load(pf, filename, grfmode);
3439  IPersistFile_Release(pf);
3440  if (SUCCEEDED(hr))
3441  return return_multi_qi(unk, count, results, FALSE);
3442  else
3443  {
3444  init_multi_qi(count, results, hr);
3445  IUnknown_Release(unk);
3446  return hr;
3447  }
3448 }
#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:3269
const GUID IID_IUnknown
HRESULT WINAPI GetClassFile(LPCOLESTR filePathName, CLSID *pclsid)
Definition: moniker.c:1217
const char * filename
Definition: ioapi.h:135
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
GLuint GLuint GLsizei count
Definition: gl.h:1545
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:3237
#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:3258
#define SUCCEEDED(hr)
Definition: intsafe.h:57
HRESULT WINAPI CoGetInstanceFromIStorage ( COSERVERINFO server_info,
CLSID rclsid,
IUnknown outer,
DWORD  cls_context,
IStorage storage,
DWORD  count,
MULTI_QI *  results 
)

Definition at line 3453 of file compobj.c.

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

Definition at line 4654 of file compobj.c.

4656 {
4657  IBindCtx *pbc;
4658  HRESULT hr;
4659 
4660  *ppv = NULL;
4661 
4662  hr = CreateBindCtx(0, &pbc);
4663  if (SUCCEEDED(hr))
4664  {
4665  if (pBindOptions)
4666  hr = IBindCtx_SetBindOptions(pbc, pBindOptions);
4667 
4668  if (SUCCEEDED(hr))
4669  {
4670  ULONG chEaten;
4671  IMoniker *pmk;
4672 
4673  hr = MkParseDisplayName(pbc, pszName, &chEaten, &pmk);
4674  if (SUCCEEDED(hr))
4675  {
4676  hr = IMoniker_BindToObject(pmk, pbc, NULL, riid, ppv);
4677  IMoniker_Release(pmk);
4678  }
4679  }
4680 
4681  IBindCtx_Release(pbc);
4682  }
4683  return hr;
4684 }
REFIID riid
Definition: precomp.h:44
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
HRESULT WINAPI CoGetObjectContext ( REFIID  riid,
void **  ppv 
)

Definition at line 5008 of file compobj.c.

Referenced by implicit_mta_proc().

5009 {
5011  HRESULT hr;
5012 
5013  TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
5014 
5015  *ppv = NULL;
5016  hr = CoGetContextToken((ULONG_PTR*)&context);
5017  if (FAILED(hr))
5018  return hr;
5019 
5020  return IObjContext_QueryInterface(context, riid, ppv);
5021 }
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI CoGetContextToken(ULONG_PTR *token)
Definition: compobj.c:5026
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
const XML_Char * context
Definition: expat.h:434
HRESULT WINAPI CoGetPSClsid ( REFIID  riid,
CLSID pclsid 
)

Definition at line 2602 of file compobj.c.

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

2603 {
2604  static const WCHAR wszInterface[] = {'I','n','t','e','r','f','a','c','e','\\',0};
2605  static const WCHAR wszPSC[] = {'\\','P','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2',0};
2606  WCHAR path[ARRAYSIZE(wszInterface) - 1 + CHARS_IN_GUID - 1 + ARRAYSIZE(wszPSC)];
2607  APARTMENT *apt;
2609  ACTCTX_SECTION_KEYED_DATA data;
2610  HRESULT hr;
2611  REGSAM opposite = (sizeof(void*) > sizeof(int)) ? KEY_WOW64_32KEY : KEY_WOW64_64KEY;
2612  BOOL is_wow64;
2613 
2614  TRACE("() riid=%s, pclsid=%p\n", debugstr_guid(riid), pclsid);
2615 
2616  if (!(apt = apartment_get_current_or_mta()))
2617  {
2618  ERR("apartment not initialised\n");
2619  return CO_E_NOTINITIALIZED;
2620  }
2621  apartment_release(apt);
2622 
2623  if (!pclsid)
2624  return E_INVALIDARG;
2625 
2627 
2628  LIST_FOR_EACH_ENTRY(registered_psclsid, &registered_psclsid_list, struct registered_psclsid, entry)
2629  if (IsEqualIID(&registered_psclsid->iid, riid))
2630  {
2631  *pclsid = registered_psclsid->clsid;
2633  return S_OK;
2634  }
2635 
2637 
2638  data.cbSize = sizeof(data);
2639  if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION,
2640  riid, &data))
2641  {
2642  struct ifacepsredirect_data *ifaceps = (struct ifacepsredirect_data*)data.lpData;
2643  *pclsid = ifaceps->iid;
2644  return S_OK;
2645  }
2646 
2647  /* Interface\\{string form of riid}\\ProxyStubClsid32 */
2648  strcpyW(path, wszInterface);
2649  StringFromGUID2(riid, path + ARRAYSIZE(wszInterface) - 1, CHARS_IN_GUID);
2650  strcpyW(path + ARRAYSIZE(wszInterface) - 1 + CHARS_IN_GUID - 1, wszPSC);
2651 
2652  hr = get_ps_clsid_from_registry(path, 0, pclsid);
2653  if (FAILED(hr) && (opposite == KEY_WOW64_32KEY ||
2654  (IsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64)))
2655  hr = get_ps_clsid_from_registry(path, opposite, pclsid);
2656 
2657  if (hr == S_OK)
2658  TRACE ("() Returning CLSID=%s\n", debugstr_guid(pclsid));
2659  else
2660  WARN("No PSFactoryBuffer object is registered for IID %s\n", debugstr_guid(riid));
2661 
2662  return hr;
2663 }
static struct list registered_psclsid_list
Definition: compobj.c:177
static CRITICAL_SECTION cs_registered_psclsid_list
Definition: compobj.c:179
__wchar_t WCHAR
Definition: xmlstorage.h:180
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
#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:2031
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
if(!(yy_init))
Definition: macro.lex.yy.c:717
LONG HRESULT
Definition: typedefs.h:77
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1195
static BOOL is_wow64
Definition: loader.c:55
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2346
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 ARRAYSIZE(array)
Definition: compobj.c:75
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
Definition: services.c: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:2544
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
HRESULT WINAPI CoGetState ( IUnknown **  ppv)

Definition at line 3731 of file compobj.c.

3732 {
3733  struct oletls *info = COM_CurrentInfo();
3734  if (!info) return E_OUTOFMEMORY;
3735 
3736  *ppv = NULL;
3737 
3738  if (info->state)
3739  {
3740  IUnknown_AddRef(info->state);
3741  *ppv = info->state;
3742  TRACE("apt->state=%p\n", info->state);
3743  }
3744 
3745  return S_OK;
3746 }
IUnknown * state
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
HRESULT WINAPI CoGetTreatAsClass ( REFCLSID  clsidOld,
LPCLSID  clsidNew 
)

Definition at line 3871 of file compobj.c.

Referenced by CoCreateInstanceEx().

3872 {
3873  static const WCHAR wszTreatAs[] = {'T','r','e','a','t','A','s',0};
3874  HKEY hkey = NULL;
3875  WCHAR szClsidNew[CHARS_IN_GUID];
3876  HRESULT res = S_OK;
3877  LONG len = sizeof(szClsidNew);
3878 
3879  TRACE("(%s,%p)\n", debugstr_guid(clsidOld), clsidNew);
3880 
3881  if (!clsidOld || !clsidNew)
3882  return E_INVALIDARG;
3883 
3884  *clsidNew = *clsidOld; /* copy over old value */
3885 
3886  res = COM_OpenKeyForCLSID(clsidOld, wszTreatAs, KEY_READ, &hkey);
3887  if (FAILED(res))
3888  {
3889  res = S_FALSE;
3890  goto done;
3891  }
3892  if (RegQueryValueW(hkey, NULL, szClsidNew, &len))
3893  {
3894  res = S_FALSE;
3895  goto done;
3896  }
3897  res = CLSIDFromString(szClsidNew,clsidNew);
3898  if (FAILED(res))
3899  ERR("Failed CLSIDFromStringA(%s), hres 0x%08x\n", debugstr_w(szClsidNew), res);
3900 done:
3901  if (hkey) RegCloseKey(hkey);
3902  return res;
3903 }
#define KEY_READ
Definition: nt_native.h:1023
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CHARS_IN_GUID
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2360
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
HANDLE HKEY
Definition: registry.h:24
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4272
GLenum GLsizei len
Definition: glext.h:6722
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2250
HRESULT WINAPI CoImpersonateClient ( void  )

Definition at line 4406 of file compobj.c.

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

Definition at line 1900 of file compobj.c.

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(), 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_IWinHttpRequest(), test_IWinHttpRequest_Invoke(), test_knownFolders(), test_MsiSetComponentState(), test_OleInitialize_InitCounting(), test_packagecoltypes(), test_printers_folder(), test_PSRefreshPropertySchema(), test_selection(), test_set_clipboard(), test_StreamOnMemory(), test_StreamOnStreamRange(), test_top_level_action(), unregister_filters(), WinMain(), wmain(), and wWinMain().

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

Definition at line 1938 of file compobj.c.

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

1939 {
1940  struct oletls *info = COM_CurrentInfo();
1941  HRESULT hr;
1942 
1943  TRACE("(%p, %x)\n", lpReserved, (int)dwCoInit);
1944 
1945  if (lpReserved!=NULL)
1946  {
1947  ERR("(%p, %x) - Bad parameter passed-in %p, must be an old Windows Application\n", lpReserved, (int)dwCoInit, lpReserved);
1948  }
1949 
1950  /*
1951  * Check the lock count. If this is the first time going through the initialize
1952  * process, we have to initialize the libraries.
1953  *
1954  * And crank-up that lock count.
1955  */
1957  {
1958  /*
1959  * Initialize the various COM libraries and data structures.
1960  */
1961  TRACE("() - Initializing the COM libraries\n");
1962 
1963  /* we may need to defer this until after apartment initialisation */
1965  }
1966 
1967  if (info->spy)
1968  IInitializeSpy_PreInitialize(info->spy, dwCoInit, info->inits);
1969 
1970  hr = enter_apartment( info, dwCoInit );
1971 
1972  if (info->spy)
1973  IInitializeSpy_PostInitialize(info->spy, hr, dwCoInit, info->inits);
1974 
1975  return hr;
1976 }
IInitializeSpy * spy
static DWORD dwCoInit
Definition: compobj.c:74
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:1849
DWORD inits
#define ERR(fmt,...)
Definition: debug.h:109
static LONG s_COMLockCount
Definition: compobj.c:207
HRESULT WINAPI RunningObjectTableImpl_Initialize(void) DECLSPEC_HIDDEN
Definition: moniker.c:983
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 4034 of file compobj.c.

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

4039 {
4040  FIXME("(%p,%d,%p,%p,%d,%d,%p,%d,%p) - stub!\n", pSecDesc, cAuthSvc,
4041  asAuthSvc, pReserved1, dwAuthnLevel, dwImpLevel, pReserved2,
4042  dwCapabilities, pReserved3);
4043  return S_OK;
4044 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI CoInitializeWOW ( DWORD  x,
DWORD  y 
)

Definition at line 3705 of file compobj.c.

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

Definition at line 4135 of file compobj.c.

4136 {
4137  FIXME("%p\n", pUnk);
4138 
4139  return TRUE;
4140 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:110
BOOL WINAPI CoIsOle1Class ( REFCLSID  clsid)

Definition at line 4005 of file compobj.c.

4006 {
4007  FIXME("%s\n", debugstr_guid(clsid));
4008  return FALSE;
4009 }
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
REFCLSID clsid
Definition: msctf.c:84
HINSTANCE WINAPI CoLoadLibrary ( LPOLESTR  lpszLibName,
BOOL  bAutoFree 
)

Definition at line 3529 of file compobj.c.

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

Definition at line 3655 of file compobj.c.

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

3659 {
3660  struct stub_manager *stubmgr;
3661  struct apartment *apt;
3662 
3663  TRACE("pUnk=%p, fLock=%s, fLastUnlockReleases=%s\n",
3664  pUnk, fLock ? "TRUE" : "FALSE", fLastUnlockReleases ? "TRUE" : "FALSE");
3665 
3666  if (!(apt = apartment_get_current_or_mta()))
3667  {
3668  ERR("apartment not initialised\n");
3669  return CO_E_NOTINITIALIZED;
3670  }
3671 
3672  stubmgr = get_stub_manager_from_object(apt, pUnk, fLock);
3673  if (!stubmgr)
3674  {
3675  WARN("stub object not found %p\n", pUnk);
3676  /* Note: native is pretty broken here because it just silently
3677  * fails, without returning an appropriate error code, making apps
3678  * think that the object was disconnected, when it actually wasn't */
3679  apartment_release(apt);
3680  return S_OK;
3681  }
3682 
3683  if (fLock)
3684  stub_manager_ext_addref(stubmgr, 1, FALSE);
3685  else
3686  stub_manager_ext_release(stubmgr, 1, FALSE, fLastUnlockReleases);
3687 
3688  stub_manager_int_release(stubmgr);
3689  apartment_release(apt);
3690  return S_OK;
3691 }
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
#define WARN(fmt,...)
Definition: debug.h:111
#define CO_E_NOTINITIALIZED
#define FALSE
Definition: types.h:117
ULONG stub_manager_ext_addref(struct stub_manager *m, ULONG refs, BOOL tableweak) DECLSPEC_HIDDEN
Definition: stubmanager.c:408
#define TRACE(s)
Definition: solgame.cpp:4
APARTMENT * apartment_get_current_or_mta(void)
Definition: compobj.c:745
#define ERR(fmt,...)
Definition: debug.h:109
ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL tableweak, BOOL last_unlock_releases) DECLSPEC_HIDDEN
Definition: stubmanager.c:439
#define S_OK
Definition: intsafe.h:59
struct stub_manager * get_stub_manager_from_object(APARTMENT *apt, IUnknown *object, BOOL alloc) DECLSPEC_HIDDEN
Definition: stubmanager.c:337
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
static HRESULT COM_GetRegisteredClassObject ( const struct apartment apt,
REFCLSID  rclsid,
DWORD  dwClsContext,
LPUNKNOWN ppUnk 
)
static

Definition at line 2744 of file compobj.c.

Referenced by CoGetClassObject(), and CoRegisterClassObject().

2746 {
2747  HRESULT hr = S_FALSE;
2748  RegisteredClass *curClass;
2749 
2751 
2753  {
2754  /*
2755  * Check if we have a match on the class ID and context.
2756  */
2757  if ((apt->oxid == curClass->apartment_id) &&
2758  (dwClsContext & curClass->runContext) &&
2759  IsEqualGUID(&(curClass->classIdentifier), rclsid))
2760  {
2761  /*
2762  * We have a match, return the pointer to the class object.
2763  */
2764  *ppUnk = curClass->classObject;
2765 
2766  IUnknown_AddRef(curClass->classObject);
2767 
2768  hr = S_OK;
2769  break;
2770  }
2771  }
2772 
2774 
2775  return hr;
2776 }
uint8_t entry
Definition: isohybrid.c:63
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define S_FALSE
Definition: winerror.h:2357
LPUNKNOWN classObject
Definition: compobj.c:224
static CRITICAL_SECTION csRegisteredClassList
Definition: compobj.c:233
CLSID classIdentifier
Definition: compobj.c:222
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4024
static struct list RegisteredClassList
Definition: compobj.c:231
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
HRESULT COM_OpenKeyForAppIdFromCLSID ( REFCLSID  clsid,
REGSAM  access,
HKEY subkey 
)

Definition at line 2392 of file compobj.c.

Referenced by create_local_service().

2393 {
2394  static const WCHAR szAppId[] = { 'A','p','p','I','d',0 };
2395  static const WCHAR szAppIdKey[] = { 'A','p','p','I','d','\\',0 };
2396  DWORD res;
2398  WCHAR keyname[ARRAYSIZE(szAppIdKey) + CHARS_IN_GUID];
2399  DWORD size;
2400  HKEY hkey;
2401  DWORD type;
2402  HRESULT hr;
2403 
<