ReactOS  0.4.14-dev-41-g31d7680
compobj_private.h File Reference
#include <stdarg.h>
#include "wine/list.h"
#include "wine/heap.h"
#include "windef.h"
#include "winbase.h"
#include "wtypes.h"
#include "dcom.h"
#include "winreg.h"
#include "winternl.h"
Include dependency graph for compobj_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ifstub
 
struct  stub_manager
 
struct  ifproxy
 
struct  apartment
 
struct  oletls
 

Macros

#define MSHLFLAGSP_REMUNKNOWN   0x80000000
 
#define DM_EXECUTERPC   (WM_USER + 0) /* WPARAM = 0, LPARAM = (struct dispatch_params *) */
 
#define DM_HOSTOBJECT   (WM_USER + 1) /* WPARAM = 0, LPARAM = (struct host_object_params *) */
 
#define DEBUG_SET_CRITSEC_NAME(cs, name)   (cs)->DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": " name)
 
#define DEBUG_CLEAR_CRITSEC_NAME(cs)   (cs)->DebugInfo->Spare[0] = 0
 
#define CHARS_IN_GUID   39 /* including NULL */
 
#define WINE_CLSCTX_DONT_HOST   0x80000000
 

Typedefs

typedef struct apartment APARTMENT
 
typedef struct LocalServer LocalServer
 
typedef enum ifstub_state STUB_STATE
 

Enumerations

enum  ifstub_state {
  STUBSTATE_NORMAL_MARSHALED, STUBSTATE_NORMAL_UNMARSHALED, STUBSTATE_TABLE_WEAK_MARSHALED, STUBSTATE_TABLE_WEAK_UNMARSHALED,
  STUBSTATE_TABLE_STRONG
}
 

Functions

 DEFINE_OLEGUID (CLSID_DfMarshal, 0x0000030b, 0, 0)
 
IGlobalInterfaceTableget_std_git (void) DECLSPEC_HIDDEN
 
void release_std_git (void) DECLSPEC_HIDDEN
 
HRESULT StdGlobalInterfaceTable_GetFactory (LPVOID *ppv) DECLSPEC_HIDDEN
 
HRESULT COM_OpenKeyForCLSID (REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *key) DECLSPEC_HIDDEN
 
HRESULT COM_OpenKeyForAppIdFromCLSID (REFCLSID clsid, REGSAM access, HKEY *subkey) DECLSPEC_HIDDEN
 
HRESULT MARSHAL_GetStandardMarshalCF (LPVOID *ppv) DECLSPEC_HIDDEN
 
HRESULT FTMarshalCF_Create (REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN
 
ULONG stub_manager_int_release (struct stub_manager *This) DECLSPEC_HIDDEN
 
ULONG stub_manager_ext_addref (struct stub_manager *m, ULONG refs, BOOL tableweak) DECLSPEC_HIDDEN
 
ULONG stub_manager_ext_release (struct stub_manager *m, ULONG refs, BOOL tableweak, BOOL last_unlock_releases) DECLSPEC_HIDDEN
 
struct ifstubstub_manager_new_ifstub (struct stub_manager *m, IRpcStubBuffer *sb, REFIID iid, DWORD dest_context, void *dest_context_data, MSHLFLAGS flags) DECLSPEC_HIDDEN
 
struct ifstubstub_manager_find_ifstub (struct stub_manager *m, REFIID iid, MSHLFLAGS flags) DECLSPEC_HIDDEN
 
struct stub_managerget_stub_manager (APARTMENT *apt, OID oid) DECLSPEC_HIDDEN
 
struct stub_managerget_stub_manager_from_object (APARTMENT *apt, IUnknown *object, BOOL alloc) DECLSPEC_HIDDEN
 
BOOL stub_manager_notify_unmarshal (struct stub_manager *m, const IPID *ipid) DECLSPEC_HIDDEN
 
BOOL stub_manager_is_table_marshaled (struct stub_manager *m, const IPID *ipid) DECLSPEC_HIDDEN
 
void stub_manager_release_marshal_data (struct stub_manager *m, ULONG refs, const IPID *ipid, BOOL tableweak) DECLSPEC_HIDDEN
 
void stub_manager_disconnect (struct stub_manager *m) DECLSPEC_HIDDEN
 
HRESULT ipid_get_dispatch_params (const IPID *ipid, APARTMENT **stub_apt, struct stub_manager **manager, IRpcStubBuffer **stub, IRpcChannelBuffer **chan, IID *iid, IUnknown **iface) DECLSPEC_HIDDEN
 
HRESULT start_apartment_remote_unknown (APARTMENT *apt) DECLSPEC_HIDDEN
 
HRESULT marshal_object (APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *obj, DWORD dest_context, void *dest_context_data, MSHLFLAGS mshlflags) DECLSPEC_HIDDEN
 
void RPC_StartRemoting (struct apartment *apt) DECLSPEC_HIDDEN
 
HRESULT RPC_CreateClientChannel (const OXID *oxid, const IPID *ipid, const OXID_INFO *oxid_info, const IID *iid, DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan, APARTMENT *apt) DECLSPEC_HIDDEN
 
HRESULT RPC_CreateServerChannel (DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan) DECLSPEC_HIDDEN
 
void RPC_ExecuteCall (struct dispatch_params *params) DECLSPEC_HIDDEN
 
HRESULT RPC_RegisterInterface (REFIID riid) DECLSPEC_HIDDEN
 
void RPC_UnregisterInterface (REFIID riid, BOOL wait) DECLSPEC_HIDDEN
 
HRESULT RPC_StartLocalServer (REFCLSID clsid, IStream *stream, BOOL multi_use, void **registration) DECLSPEC_HIDDEN
 
void RPC_StopLocalServer (void *registration) DECLSPEC_HIDDEN
 
HRESULT RPC_GetLocalClassObject (REFCLSID rclsid, REFIID iid, LPVOID *ppv) DECLSPEC_HIDDEN
 
HRESULT RPC_RegisterChannelHook (REFGUID rguid, IChannelHook *hook) DECLSPEC_HIDDEN
 
void RPC_UnregisterAllChannelHooks (void) DECLSPEC_HIDDEN
 
HRESULT RPC_ResolveOxid (OXID oxid, OXID_INFO *oxid_info) DECLSPEC_HIDDEN
 
HRESULT WINAPI RunningObjectTableImpl_Initialize (void) DECLSPEC_HIDDEN
 
HRESULT WINAPI RunningObjectTableImpl_UnInitialize (void) DECLSPEC_HIDDEN
 
void OLEDD_UnInitialize (void) DECLSPEC_HIDDEN
 
APARTMENTapartment_findfromoxid (OXID oxid, BOOL ref) DECLSPEC_HIDDEN
 
APARTMENTapartment_findfromtid (DWORD tid) DECLSPEC_HIDDEN
 
DWORD apartment_release (struct apartment *apt) DECLSPEC_HIDDEN
 
HRESULT apartment_disconnectproxies (struct apartment *apt) DECLSPEC_HIDDEN
 
static HRESULT apartment_getoxid (const struct apartment *apt, OXID *oxid)
 
HRESULT apartment_createwindowifneeded (struct apartment *apt) DECLSPEC_HIDDEN
 
HWND apartment_getwindow (const struct apartment *apt) DECLSPEC_HIDDEN
 
HRESULT enter_apartment (struct oletls *info, DWORD model) DECLSPEC_HIDDEN
 
void leave_apartment (struct oletls *info) DECLSPEC_HIDDEN
 
APARTMENTapartment_get_current_or_mta (void) DECLSPEC_HIDDEN
 
static struct oletlsCOM_CurrentInfo (void)
 
static APARTMENTCOM_CurrentApt (void)
 
static GUID COM_CurrentCausalityId (void)
 
HRESULT WINAPI OLE32_DllGetClassObject (REFCLSID rclsid, REFIID iid, LPVOID *ppv) DECLSPEC_HIDDEN
 
HRESULT WINAPI OLE32_DllRegisterServer (void) DECLSPEC_HIDDEN
 
HRESULT WINAPI OLE32_DllUnregisterServer (void) DECLSPEC_HIDDEN
 
HRESULT Handler_DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN
 
HRESULT HandlerCF_Create (REFCLSID rclsid, REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN
 
HRESULT WINAPI GlobalOptions_CreateInstance (IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv) DECLSPEC_HIDDEN
 
HRESULT DataAdviseHolder_OnConnect (IDataAdviseHolder *iface, IDataObject *pDelegate) DECLSPEC_HIDDEN
 
void DataAdviseHolder_OnDisconnect (IDataAdviseHolder *iface) DECLSPEC_HIDDEN
 
LSTATUS create_classes_key (HKEY, const WCHAR *, REGSAM, HKEY *) DECLSPEC_HIDDEN
 
LSTATUS open_classes_key (HKEY, const WCHAR *, REGSAM, HKEY *) DECLSPEC_HIDDEN
 
BOOL actctx_get_miscstatus (const CLSID *, DWORD, DWORD *) DECLSPEC_HIDDEN
 
const chardebugstr_formatetc (const FORMATETC *formatetc) DECLSPEC_HIDDEN
 
static HRESULT copy_formatetc (FORMATETC *dst, const FORMATETC *src)
 
HRESULT EnumSTATDATA_Construct (IUnknown *holder, ULONG index, DWORD array_len, STATDATA *data, BOOL copy, IEnumSTATDATA **ppenum) DECLSPEC_HIDDEN
 

Variables

HINSTANCE hProxyDll DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ CHARS_IN_GUID

#define CHARS_IN_GUID   39 /* including NULL */

Definition at line 289 of file compobj_private.h.

◆ DEBUG_CLEAR_CRITSEC_NAME

#define DEBUG_CLEAR_CRITSEC_NAME (   cs)    (cs)->DebugInfo->Spare[0] = 0

Definition at line 287 of file compobj_private.h.

◆ DEBUG_SET_CRITSEC_NAME

#define DEBUG_SET_CRITSEC_NAME (   cs,
  name 
)    (cs)->DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": " name)

Definition at line 286 of file compobj_private.h.

◆ DM_EXECUTERPC

#define DM_EXECUTERPC   (WM_USER + 0) /* WPARAM = 0, LPARAM = (struct dispatch_params *) */

Definition at line 254 of file compobj_private.h.

◆ DM_HOSTOBJECT

#define DM_HOSTOBJECT   (WM_USER + 1) /* WPARAM = 0, LPARAM = (struct host_object_params *) */

Definition at line 255 of file compobj_private.h.

◆ MSHLFLAGSP_REMUNKNOWN

#define MSHLFLAGSP_REMUNKNOWN   0x80000000

Definition at line 49 of file compobj_private.h.

◆ WINE_CLSCTX_DONT_HOST

#define WINE_CLSCTX_DONT_HOST   0x80000000

Definition at line 291 of file compobj_private.h.

Typedef Documentation

◆ APARTMENT

Definition at line 43 of file compobj_private.h.

◆ LocalServer

Definition at line 44 of file compobj_private.h.

◆ STUB_STATE

Enumeration Type Documentation

◆ ifstub_state

Enumerator
STUBSTATE_NORMAL_MARSHALED 
STUBSTATE_NORMAL_UNMARSHALED 
STUBSTATE_TABLE_WEAK_MARSHALED 
STUBSTATE_TABLE_WEAK_UNMARSHALED 
STUBSTATE_TABLE_STRONG 

Definition at line 64 of file compobj_private.h.

Function Documentation

◆ actctx_get_miscstatus()

BOOL actctx_get_miscstatus ( const CLSID ,
DWORD  ,
DWORD  
)

Definition at line 257 of file compobj.c.

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

Referenced by OleRegGetMiscStatus().

◆ apartment_createwindowifneeded()

HRESULT apartment_createwindowifneeded ( struct apartment apt)

Definition at line 1707 of file compobj.c.

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

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

◆ apartment_disconnectproxies()

HRESULT apartment_disconnectproxies ( struct apartment apt)

Definition at line 1227 of file marshal.c.

1228 {
1229  struct list * cursor;
1230 
1231  LIST_FOR_EACH(cursor, &apt->proxies)
1232  {
1233  struct proxy_manager * proxy = LIST_ENTRY(cursor, struct proxy_manager, entry);
1235  }
1236 
1237  return S_OK;
1238 }
int proxy
Definition: main.c:67
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
struct list proxies
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
#define S_OK
Definition: intsafe.h:59
const char cursor[]
Definition: icontest.c:13
static void proxy_manager_disconnect(struct proxy_manager *This)
Definition: marshal.c:1061
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by apartment_release().

◆ apartment_findfromoxid()

APARTMENT* apartment_findfromoxid ( OXID  oxid,
BOOL  ref 
)

Definition at line 1279 of file compobj.c.

1280 {
1281  APARTMENT *result = NULL;
1282  struct list *cursor;
1283 
1286  {
1287  struct apartment *apt = LIST_ENTRY( cursor, struct apartment, entry );
1288  if (apt->oxid == oxid)
1289  {
1290  result = apt;
1291  if (ref) apartment_addref(result);
1292  break;
1293  }
1294  }
1296 
1297  return result;
1298 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:622
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
Definition: send.c:47
static struct list apts
Definition: compobj.c:81
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:416
uint32_t entry
Definition: isohybrid.c:63
static CRITICAL_SECTION csApartment
Definition: compobj.c:83
Definition: _list.h:228
const char cursor[]
Definition: icontest.c:13
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
GLuint64EXT * result
Definition: glext.h:11304

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

◆ apartment_findfromtid()

APARTMENT* apartment_findfromtid ( DWORD  tid)

Definition at line 1303 of file compobj.c.

1304 {
1305  APARTMENT *result = NULL;
1306  struct list *cursor;
1307 
1310  {
1311  struct apartment *apt = LIST_ENTRY( cursor, struct apartment, entry );
1312  if (apt->tid == tid)
1313  {
1314  result = apt;
1316  break;
1317  }
1318  }
1320 
1321  return result;
1322 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:622
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static struct list apts
Definition: compobj.c:81
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:416
uint32_t entry
Definition: isohybrid.c:63
static CRITICAL_SECTION csApartment
Definition: compobj.c:83
Definition: _list.h:228
const char cursor[]
Definition: icontest.c:13
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
GLuint64EXT * result
Definition: glext.h:11304
static TfClientId tid

Referenced by ipid_to_ifstub().

◆ apartment_get_current_or_mta()

APARTMENT* apartment_get_current_or_mta ( void  )

Definition at line 745 of file compobj.c.

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

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

◆ apartment_getoxid()

static HRESULT apartment_getoxid ( const struct apartment apt,
OXID oxid 
)
inlinestatic

Definition at line 242 of file compobj_private.h.

243 {
244  *oxid = apt->oxid;
245  return S_OK;
246 }
#define S_OK
Definition: intsafe.h:59

Referenced by ClientRpcChannelBuffer_IsCorrectApartment(), marshal_object(), RPC_CreateClientChannel(), and std_unmarshal_interface().

◆ apartment_getwindow()

HWND apartment_getwindow ( const struct apartment apt)

Definition at line 1736 of file compobj.c.

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

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

◆ apartment_release()

DWORD apartment_release ( struct apartment apt)

Definition at line 1175 of file compobj.c.

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

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

◆ COM_CurrentApt()

◆ COM_CurrentCausalityId()

static GUID COM_CurrentCausalityId ( void  )
inlinestatic

Definition at line 275 of file compobj_private.h.

276 {
277  struct oletls *info = COM_CurrentInfo();
278  if (!info)
279  return GUID_NULL;
280  if (IsEqualGUID(&info->causality_id, &GUID_NULL))
281  CoCreateGuid(&info->causality_id);
282  return info->causality_id;
283 }
static struct oletls * COM_CurrentInfo(void)
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2115
#define GUID_NULL
Definition: ks.h:106
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

Referenced by ClientRpcChannelBuffer_GetBuffer(), and CoGetCurrentLogicalThreadId().

◆ COM_CurrentInfo()

◆ COM_OpenKeyForAppIdFromCLSID()

HRESULT COM_OpenKeyForAppIdFromCLSID ( REFCLSID  clsid,
REGSAM  access,
HKEY subkey 
)

Definition at line 2389 of file compobj.c.

2390 {
2391  static const WCHAR szAppId[] = { 'A','p','p','I','d',0 };
2392  static const WCHAR szAppIdKey[] = { 'A','p','p','I','d','\\',0 };
2393  DWORD res;
2395  WCHAR keyname[ARRAY_SIZE(szAppIdKey) + CHARS_IN_GUID];
2396  DWORD size;
2397  HKEY hkey;
2398  DWORD type;
2399  HRESULT hr;
2400 
2401  /* read the AppID value under the class's key */
2403  if (FAILED(hr))
2404  return hr;
2405 
2406  size = sizeof(buf);
2407  res = RegQueryValueExW(hkey, szAppId, NULL, &type, (LPBYTE)buf, &size);
2408  RegCloseKey(hkey);
2409  if (res == ERROR_FILE_NOT_FOUND)
2410  return REGDB_E_KEYMISSING;
2411  else if (res != ERROR_SUCCESS || type!=REG_SZ)
2412  return REGDB_E_READREGDB;
2413 
2414  strcpyW(keyname, szAppIdKey);
2415  strcatW(keyname, buf);
2416  res = open_classes_key(HKEY_CLASSES_ROOT, keyname, access, subkey);
2417  if (res == ERROR_FILE_NOT_FOUND)
2418  return REGDB_E_KEYMISSING;
2419  else if (res != ERROR_SUCCESS)
2420  return REGDB_E_READREGDB;
2421 
2422  return S_OK;
2423 }
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define KEY_READ
Definition: nt_native.h:1023
#define REGDB_E_READREGDB
Definition: winerror.h:2692
#define CHARS_IN_GUID
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define REGDB_E_KEYMISSING
Definition: winerror.h:2694
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2357
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
GLsizeiptr size
Definition: glext.h:5919
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
REFCLSID clsid
Definition: msctf.c:84
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define ARRAY_SIZE(a)
Definition: main.h:24
LSTATUS open_classes_key(HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey)
Definition: compobj.c:423
WINE_UNICODE_INLINE WCHAR * strcatW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:242
GLuint res
Definition: glext.h:9613
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define REG_SZ
Definition: layer.c:22

Referenced by create_local_service().

◆ COM_OpenKeyForCLSID()

HRESULT COM_OpenKeyForCLSID ( REFCLSID  clsid,
LPCWSTR  keyname,
REGSAM  access,
HKEY key 
)

Definition at line 2357 of file compobj.c.

2358 {
2359  static const WCHAR wszCLSIDSlash[] = {'C','L','S','I','D','\\',0};
2360  WCHAR path[CHARS_IN_GUID + ARRAY_SIZE(wszCLSIDSlash) - 1];
2361  LONG res;
2362  HKEY key;
2363 
2364  strcpyW(path, wszCLSIDSlash);
2365  StringFromGUID2(clsid, path + strlenW(wszCLSIDSlash), CHARS_IN_GUID);
2367  if (res == ERROR_FILE_NOT_FOUND)
2368  return REGDB_E_CLASSNOTREG;
2369  else if (res != ERROR_SUCCESS)
2370  return REGDB_E_READREGDB;
2371 
2372  if (!keyname)
2373  {
2374  *subkey = key;
2375  return S_OK;
2376  }
2377 
2378  res = open_classes_key(key, keyname, access, subkey);
2379  RegCloseKey(key);
2380  if (res == ERROR_FILE_NOT_FOUND)
2381  return REGDB_E_KEYMISSING;
2382  else if (res != ERROR_SUCCESS)
2383  return REGDB_E_READREGDB;
2384 
2385  return S_OK;
2386 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define REGDB_E_READREGDB
Definition: winerror.h:2692
#define CHARS_IN_GUID
#define REGDB_E_KEYMISSING
Definition: winerror.h:2694
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2343
REFCLSID clsid
Definition: msctf.c:84
HKEY key
Definition: reg.c:42
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define ARRAY_SIZE(a)
Definition: main.h:24
LSTATUS open_classes_key(HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey)
Definition: compobj.c:423
Definition: services.c:325
GLuint res
Definition: glext.h:9613
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
Definition: path.c:42

Referenced by CoGetClassObject(), CoGetTreatAsClass(), COM_OpenKeyForAppIdFromCLSID(), CoTreatAsClass(), create_server(), Handler_DllGetClassObject(), OleGetAutoConvert(), OleRegEnumVerbs(), OleRegGetMiscStatus(), OleRegGetUserType(), OleSetAutoConvert(), and ProgIDFromCLSID().

◆ copy_formatetc()

static HRESULT copy_formatetc ( FORMATETC *  dst,
const FORMATETC *  src 
)
inlinestatic

Definition at line 329 of file compobj_private.h.

330 {
331  *dst = *src;
332  if (src->ptd)
333  {
334  dst->ptd = CoTaskMemAlloc( src->ptd->tdSize );
335  if (!dst->ptd) return E_OUTOFMEMORY;
336  memcpy( dst->ptd, src->ptd, src->ptd->tdSize );
337  }
338  return S_OK;
339 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:59
GLenum GLenum dst
Definition: glext.h:6340
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

Referenced by copy_statdata(), DataCache_EnumCache(), init_cache_entry(), and OLEClipbrd_IEnumFORMATETC_Next().

◆ create_classes_key()

LSTATUS create_classes_key ( HKEY  ,
const WCHAR ,
REGSAM  ,
HKEY  
)

Definition at line 405 of file compobj.c.

406 {
409 
410  if (!(hkey = get_classes_root_hkey( hkey, access ))) return ERROR_INVALID_HANDLE;
411 
412  attr.Length = sizeof(attr);
413  attr.RootDirectory = hkey;
414  attr.ObjectName = &nameW;
415  attr.Attributes = 0;
416  attr.SecurityDescriptor = NULL;
417  attr.SecurityQualityOfService = NULL;
419 
420  return RtlNtStatusToDosError( create_key( retkey, access, &attr ) );
421 }
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
static HKEY get_classes_root_hkey(HKEY hkey, REGSAM access)
Definition: compobj.c:384
static NTSTATUS create_key(HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr)
Definition: compobj.c:306
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR nameW[]
Definition: main.c:46
Definition: cookie.c:170
__u8 attr
Definition: mkdosfs.c:359
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
Definition: name.c:36
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by COMCAT_ICatRegister_RegisterCategories(), COMCAT_RegisterClassCategories(), and get_classes_root_hkey().

◆ DataAdviseHolder_OnConnect()

HRESULT DataAdviseHolder_OnConnect ( IDataAdviseHolder iface,
IDataObject pDelegate 
)

Definition at line 809 of file oleobj.c.

810 {
812  DWORD index;
813  HRESULT hr = S_OK;
814 
815  for(index = 0; index < This->maxCons; index++)
816  {
817  if(This->connections[index].pAdvSink != NULL)
818  {
819  hr = IDataObject_DAdvise(pDelegate, &This->connections[index].formatetc,
820  This->connections[index].advf,
821  This->connections[index].pAdvSink,
822  &This->remote_connections[index]);
823  if (FAILED(hr)) break;
824  This->connections[index].advf |= WINE_ADVF_REMOTE;
825  }
826  }
827  This->delegate = pDelegate;
828  return hr;
829 }
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define WINE_ADVF_REMOTE
Definition: oleobj.c:547
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
#define S_OK
Definition: intsafe.h:59
static DataAdviseHolder * impl_from_IDataAdviseHolder(IDataAdviseHolder *iface)
Definition: oleobj.c:549

Referenced by DefaultHandler_DAdvise(), and DefaultHandler_Run().

◆ DataAdviseHolder_OnDisconnect()

void DataAdviseHolder_OnDisconnect ( IDataAdviseHolder iface)

Definition at line 831 of file oleobj.c.

832 {
834  DWORD index;
835 
836  for(index = 0; index < This->maxCons; index++)
837  {
838  if((This->connections[index].pAdvSink != NULL) &&
839  (This->connections[index].advf & WINE_ADVF_REMOTE))
840  {
841  IDataObject_DUnadvise(This->delegate, This->remote_connections[index]);
842  This->remote_connections[index] = 0;
843  This->connections[index].advf &= ~WINE_ADVF_REMOTE;
844  }
845  }
846  This->delegate = NULL;
847 }
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define WINE_ADVF_REMOTE
Definition: oleobj.c:547
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
static DataAdviseHolder * impl_from_IDataAdviseHolder(IDataAdviseHolder *iface)
Definition: oleobj.c:549

Referenced by DefaultHandler_Stop().

◆ debugstr_formatetc()

const char* debugstr_formatetc ( const FORMATETC *  formatetc)

Definition at line 217 of file datacache.c.

218 {
219  return wine_dbg_sprintf("{ cfFormat = 0x%x, ptd = %p, dwAspect = %d, lindex = %d, tymed = %d }",
220  formatetc->cfFormat, formatetc->ptd, formatetc->dwAspect,
221  formatetc->lindex, formatetc->tymed);
222 }
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271

Referenced by add_cache_entry(), DataCache_Cache(), DataCache_GetData(), DataCache_IOleCache2_SetData(), DataCache_OnDataChange(), DataCache_QueryGetData(), DataCacheEntry_Save(), and OleCreateFromFileEx().

◆ DEFINE_OLEGUID()

DEFINE_OLEGUID ( CLSID_DfMarshal  ,
0x0000030b  ,
,
 
)

◆ enter_apartment()

HRESULT enter_apartment ( struct oletls info,
DWORD  model 
)

Definition at line 1846 of file compobj.c.

1847 {
1848  HRESULT hr = S_OK;
1849 
1850  if (!info->apt)
1851  {
1852  if (!apartment_get_or_create( model ))
1853  return E_OUTOFMEMORY;
1854  }
1855  else if (!apartment_is_model( info->apt, model ))
1856  {
1857  WARN( "Attempt to change threading model of this apartment from %s to %s\n",
1858  info->apt->multi_threaded ? "multi-threaded" : "apartment threaded",
1859  model & COINIT_APARTMENTTHREADED ? "apartment threaded" : "multi-threaded" );
1860  return RPC_E_CHANGED_MODE;
1861  }
1862  else
1863  hr = S_FALSE;
1864 
1865  info->inits++;
1866 
1867  return hr;
1868 }
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
static BOOL apartment_is_model(const APARTMENT *apt, DWORD model)
Definition: compobj.c:721
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_FALSE
Definition: winerror.h:2357
LONG HRESULT
Definition: typedefs.h:77
#define RPC_E_CHANGED_MODE
Definition: winerror.h:2482
static APARTMENT * apartment_get_or_create(DWORD model)
Definition: compobj.c:673
#define S_OK
Definition: intsafe.h:59

Referenced by CoInitializeEx(), and dispatch_rpc().

◆ EnumSTATDATA_Construct()

HRESULT EnumSTATDATA_Construct ( IUnknown holder,
ULONG  index,
DWORD  array_len,
STATDATA *  data,
BOOL  copy,
IEnumSTATDATA **  ppenum 
)

Definition at line 200 of file oleobj.c.

202 {
203  EnumSTATDATA *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
204  DWORD i, count;
205 
206  if (!This) return E_OUTOFMEMORY;
207 
208  This->IEnumSTATDATA_iface.lpVtbl = &EnumSTATDATA_VTable;
209  This->ref = 1;
210  This->index = index;
211 
212  if (copy)
213  {
214  This->statdata = HeapAlloc(GetProcessHeap(), 0, array_len * sizeof(*This->statdata));
215  if(!This->statdata)
216  {
218  return E_OUTOFMEMORY;
219  }
220 
221  for(i = 0, count = 0; i < array_len; i++)
222  {
223  if(data[i].pAdvSink)
224  {
225  copy_statdata(This->statdata + count, data + i);
226  count++;
227  }
228  }
229  }
230  else
231  {
232  This->statdata = data;
233  count = array_len;
234  }
235 
236  This->num_of_elems = count;
237  This->holder = holder;
238  if (holder) IUnknown_AddRef(holder);
239  *ppenum = &This->IEnumSTATDATA_iface;
240  return S_OK;
241 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
static HRESULT copy_statdata(STATDATA *dst, const STATDATA *src)
Definition: oleobj.c:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const IEnumSTATDATAVtbl EnumSTATDATA_VTable
Definition: oleobj.c:189
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define index(s, c)
Definition: various.h:29
#define S_OK
Definition: intsafe.h:59
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by DataAdviseHolder_EnumAdvise(), DataCache_EnumCache(), EnumSTATDATA_Clone(), and OleAdviseHolderImpl_EnumAdvise().

◆ FTMarshalCF_Create()

HRESULT FTMarshalCF_Create ( REFIID  riid,
LPVOID ppv 
)

Definition at line 413 of file ftmarshal.c.

414 {
415  return IClassFactory_QueryInterface((IClassFactory *)&FTMarshalCF, riid, ppv);
416 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const IClassFactoryVtbl * FTMarshalCF
Definition: ftmarshal.c:411

Referenced by CoGetClassObject().

◆ get_std_git()

IGlobalInterfaceTable* get_std_git ( void  )

Definition at line 362 of file git.c.

363 {
364  if (!std_git)
365  {
367 
368  newGIT = HeapAlloc(GetProcessHeap(), 0, sizeof(StdGlobalInterfaceTableImpl));
369  if (!newGIT) return NULL;
370 
372  list_init(&newGIT->list);
373  newGIT->nextCookie = 0xf100; /* that's where windows starts, so that's where we start */
374 
376  {
377  HeapFree(GetProcessHeap(), 0, newGIT);
378  }
379  else
380  TRACE("Created the GIT at %p\n", newGIT);
381  }
382 
383  return std_git;
384 }
static IGlobalInterfaceTable * std_git
Definition: git.c:72
IGlobalInterfaceTable IGlobalInterfaceTable_iface
Definition: git.c:65
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct list list
Definition: git.c:67
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
static const IGlobalInterfaceTableVtbl StdGlobalInterfaceTableImpl_Vtbl
Definition: git.c:352
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by CoCreateInstanceEx(), and GITCF_CreateInstance().

◆ get_stub_manager()

struct stub_manager* get_stub_manager ( APARTMENT apt,
OID  oid 
)

Definition at line 380 of file stubmanager.c.

381 {
382  struct stub_manager *result = NULL;
383  struct list *cursor;
384 
385  EnterCriticalSection(&apt->cs);
386  LIST_FOR_EACH( cursor, &apt->stubmgrs )
387  {
388  struct stub_manager *m = LIST_ENTRY( cursor, struct stub_manager, entry );
389 
390  if (m->oid == oid)
391  {
392  result = m;
394  break;
395  }
396  }
398 
399  if (result)
400  TRACE("found %p for oid %s\n", result, wine_dbgstr_longlong(oid));
401  else
402  TRACE("not found for oid %s\n", wine_dbgstr_longlong(oid));
403 
404  return result;
405 }
APARTMENT * apt
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
const GLfloat * m
Definition: glext.h:10848
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
static ULONG stub_manager_int_addref(struct stub_manager *This)
Definition: stubmanager.c:297
const char cursor[]
Definition: icontest.c:13
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
struct list stubmgrs
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
CRITICAL_SECTION cs
GLuint64EXT * result
Definition: glext.h:11304

Referenced by std_release_marshal_data(), and std_unmarshal_interface().

◆ get_stub_manager_from_object()

struct stub_manager* get_stub_manager_from_object ( APARTMENT apt,
IUnknown object,
BOOL  alloc 
)

Definition at line 337 of file stubmanager.c.

338 {
339  struct stub_manager *result = NULL;
340  struct list *cursor;
341  IUnknown *object;
342  HRESULT hres;
343 
344  hres = IUnknown_QueryInterface(obj, &IID_IUnknown, (void**)&object);
345  if (FAILED(hres)) {
346  ERR("QueryInterface(IID_IUnknown failed): %08x\n", hres);
347  return NULL;
348  }
349 
350  EnterCriticalSection(&apt->cs);
351  LIST_FOR_EACH( cursor, &apt->stubmgrs )
352  {
353  struct stub_manager *m = LIST_ENTRY( cursor, struct stub_manager, entry );
354 
355  if (m->object == object)
356  {
357  result = m;
359  break;
360  }
361  }
363 
364  if (result) {
365  TRACE("found %p for object %p\n", result, object);
366  }else if (alloc) {
367  TRACE("not found, creating new stub manager...\n");
368  result = new_stub_manager(apt, object);
369  }else {
370  TRACE("not found for object %p\n", object);
371  }
372 
373  IUnknown_Release(object);
374  return result;
375 }
APARTMENT * apt
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
const GLfloat * m
Definition: glext.h:10848
static struct stub_manager * new_stub_manager(APARTMENT *apt, IUnknown *object)
Definition: stubmanager.c:180
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
#define ERR(fmt,...)
Definition: debug.h:109
static ULONG stub_manager_int_addref(struct stub_manager *This)
Definition: stubmanager.c:297
const char cursor[]
Definition: icontest.c:13
#define alloc
Definition: rosglue.h:13
struct list stubmgrs
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define LIST_ENTRY(type)
Definition: queue.h:175
CRITICAL_SECTION cs
GLuint64EXT * result
Definition: glext.h:11304
void * object
Definition: jmemsys.h:48

Referenced by CoDisconnectObject(), CoLockObjectExternal(), and marshal_object().

◆ GlobalOptions_CreateInstance()

HRESULT WINAPI GlobalOptions_CreateInstance ( IClassFactory iface,
IUnknown pUnk,
REFIID  riid,
void **  ppv 
)

Definition at line 5240 of file compobj.c.

5241 {
5243  HRESULT hres;
5244 
5245  TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
5246 
5247  if (outer)
5248  return E_INVALIDARG;
5249 
5251  if (!global_options)
5252  return E_OUTOFMEMORY;
5253  global_options->IGlobalOptions_iface.lpVtbl = &GlobalOptionsVtbl;
5254  global_options->ref = 1;
5255 
5256  hres = IGlobalOptions_QueryInterface(&global_options->IGlobalOptions_iface, riid, ppv);
5257  IGlobalOptions_Release(&global_options->IGlobalOptions_iface);
5258  return hres;
5259 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#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
static const struct optioninfo global_options[]
Definition: adh-opts.c:43
static const IGlobalOptionsVtbl GlobalOptionsVtbl
Definition: compobj.c:5232

◆ Handler_DllGetClassObject()

HRESULT Handler_DllGetClassObject ( REFCLSID  rclsid,
REFIID  riid,
LPVOID ppv 
)

Definition at line 5076 of file compobj.c.

5077 {
5078  static const WCHAR wszInprocHandler32[] = {'I','n','p','r','o','c','H','a','n','d','l','e','r','3','2',0};
5079  HKEY hkey;
5080  HRESULT hres;
5081 
5082  hres = COM_OpenKeyForCLSID(rclsid, wszInprocHandler32, KEY_READ, &hkey);
5083  if (SUCCEEDED(hres))
5084  {
5085  struct class_reg_data regdata;
5086  WCHAR dllpath[MAX_PATH+1];
5087 
5088  regdata.u.hkey = hkey;
5089  regdata.hkey = TRUE;
5090 
5091  if (get_object_dll_path(&regdata, dllpath, ARRAY_SIZE(dllpath)))
5092  {
5093  static const WCHAR wszOle32[] = {'o','l','e','3','2','.','d','l','l',0};
5094  if (!strcmpiW(dllpath, wszOle32))
5095  {
5096  RegCloseKey(hkey);
5097  return HandlerCF_Create(rclsid, riid, ppv);
5098  }
5099  }
5100  else
5101  WARN("not creating object for inproc handler path %s\n", debugstr_w(dllpath));
5102  RegCloseKey(hkey);
5103  }
5104 
5106 }
#define TRUE
Definition: types.h:120
#define KEY_READ
Definition: nt_native.h:1023
REFIID riid
Definition: precomp.h:44
static BOOL get_object_dll_path(const struct class_reg_data *regdata, WCHAR *dst, DWORD dstlen)
Definition: compobj.c:1416
#define WARN(fmt,...)
Definition: debug.h:111
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define debugstr_w
Definition: kernel32.h:32
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2357
HRESULT hres
Definition: protocol.c:465
WCHAR dllpath[MAX_PATH]
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
HRESULT HandlerCF_Create(REFCLSID rclsid, REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define ARRAY_SIZE(a)
Definition: main.h:24
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by DllGetClassObject().

◆ HandlerCF_Create()

HRESULT HandlerCF_Create ( REFCLSID  rclsid,
REFIID  riid,
LPVOID ppv 
)

Definition at line 2359 of file defaulthandler.c.

2360 {
2361  HRESULT hr;
2362  HandlerCF *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
2363  if (!This) return E_OUTOFMEMORY;
2364  This->IClassFactory_iface.lpVtbl = &HandlerClassFactoryVtbl;
2365  This->refs = 0;
2366  This->clsid = *rclsid;
2367 
2368  hr = IClassFactory_QueryInterface(&This->IClassFactory_iface, riid, ppv);
2369  if (FAILED(hr))
2370  HeapFree(GetProcessHeap(), 0, This);
2371 
2372  return hr;
2373 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const IClassFactoryVtbl HandlerClassFactoryVtbl
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by Handler_DllGetClassObject().

◆ ipid_get_dispatch_params()

HRESULT ipid_get_dispatch_params ( const IPID ipid,
APARTMENT **  stub_apt,
struct stub_manager **  manager,
IRpcStubBuffer **  stub,
IRpcChannelBuffer **  chan,
IID iid,
IUnknown **  iface 
)

Definition at line 533 of file stubmanager.c.

537 {
538  struct stub_manager *stubmgr;
539  struct ifstub *ifstub;
540  APARTMENT *apt;
541  HRESULT hr;
542 
543  hr = ipid_to_ifstub(ipid, &apt, &stubmgr, &ifstub);
544  if (hr != S_OK) return RPC_E_DISCONNECTED;
545 
546  *stub = ifstub->stubbuffer;
547  IRpcStubBuffer_AddRef(*stub);
548  *chan = ifstub->chan;
549  IRpcChannelBuffer_AddRef(*chan);
550  *stub_apt = apt;
551  *iid = ifstub->iid;
552  *iface = ifstub->iface;
553 
554  if (manager)
555  *manager = stubmgr;
556  else
557  stub_manager_int_release(stubmgr);
558  return S_OK;
559 }
HRESULT hr
Definition: shlfolder.c:183
IUnknown * iface
Definition: stubgen.c:11
IRpcChannelBuffer * chan
IRpcStubBuffer * stubbuffer
LONG HRESULT
Definition: typedefs.h:77
#define RPC_E_DISCONNECTED
Definition: winerror.h:2484
static HRESULT ipid_to_ifstub(const IPID *ipid, APARTMENT **stub_apt, struct stub_manager **stubmgr_ret, struct ifstub **ifstub)
Definition: stubmanager.c:501
#define S_OK
Definition: intsafe.h:59
ULONG stub_manager_int_release(struct stub_manager *This)
Definition: stubmanager.c:311

Referenced by ClientRpcChannelBuffer_GetBuffer(), and dispatch_rpc().

◆ leave_apartment()

void leave_apartment ( struct oletls info)

Definition at line 1870 of file compobj.c.

1871 {
1872  if (!--info->inits)
1873  {
1874  if (info->ole_inits)
1875  WARN( "Uninitializing apartment while Ole is still initialized\n" );
1876  apartment_release( info->apt );
1877  info->apt = NULL;
1878  }
1879 }
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1175
#define WARN(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416

Referenced by CoUninitialize(), and dispatch_rpc().

◆ MARSHAL_GetStandardMarshalCF()

HRESULT MARSHAL_GetStandardMarshalCF ( LPVOID ppv)

Definition at line 2206 of file marshal.c.

2207 {
2208  *ppv = &StdMarshalCF;
2209  return S_OK;
2210 }
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const IClassFactoryVtbl * StdMarshalCF
Definition: marshal.c:2204
#define S_OK
Definition: intsafe.h:59

Referenced by DllGetClassObject().

◆ marshal_object()

HRESULT marshal_object ( APARTMENT apt,
STDOBJREF stdobjref,
REFIID  riid,
IUnknown obj,
DWORD  dest_context,
void dest_context_data,
MSHLFLAGS  mshlflags 
)

Definition at line 122 of file marshal.c.

124 {
125  struct stub_manager *manager;
126  struct ifstub *ifstub;
127  BOOL tablemarshal;
128  HRESULT hr;
129 
130  hr = apartment_getoxid(apt, &stdobjref->oxid);
131  if (hr != S_OK)
132  return hr;
133 
135  if (hr != S_OK)
136  return hr;
137 
138  if (!(manager = get_stub_manager_from_object(apt, object, TRUE)))
139  return E_OUTOFMEMORY;
140 
141  stdobjref->flags = SORF_NULL;
142  if (mshlflags & MSHLFLAGS_TABLEWEAK)
143  stdobjref->flags |= SORFP_TABLEWEAK;
144  if (mshlflags & MSHLFLAGS_NOPING)
145  stdobjref->flags |= SORF_NOPING;
146  stdobjref->oid = manager->oid;
147 
148  tablemarshal = ((mshlflags & MSHLFLAGS_TABLESTRONG) || (mshlflags & MSHLFLAGS_TABLEWEAK));
149 
150  /* make sure ifstub that we are creating is unique */
151  ifstub = stub_manager_find_ifstub(manager, riid, mshlflags);
152  if (!ifstub) {
154 
155  /* IUnknown doesn't require a stub buffer, because it never goes out on
156  * the wire */
157  if (!IsEqualIID(riid, &IID_IUnknown))
158  {
159  IPSFactoryBuffer *psfb;
160 
161  hr = get_facbuf_for_iid(riid, &psfb);
162  if (hr == S_OK) {
163  hr = IPSFactoryBuffer_CreateStub(psfb, riid, manager->object, &stub);
164  IPSFactoryBuffer_Release(psfb);
165  if (hr != S_OK)
166  ERR("Failed to create an IRpcStubBuffer from IPSFactory for %s with error 0x%08x\n",
167  debugstr_guid(riid), hr);
168  }else {
169  ERR("couldn't get IPSFactory buffer for interface %s\n", debugstr_guid(riid));
170  hr = E_NOINTERFACE;
171  }
172 
173  }
174 
175  if (hr == S_OK) {
176  ifstub = stub_manager_new_ifstub(manager, stub, riid, dest_context, dest_context_data, mshlflags);
177  if (!ifstub)
178  hr = E_OUTOFMEMORY;
179  }
180  if (stub) IRpcStubBuffer_Release(stub);
181 
182  if (hr != S_OK) {
183  stub_manager_int_release(manager);
184  /* destroy the stub manager if it has no ifstubs by releasing
185  * zero external references */
186  stub_manager_ext_release(manager, 0, FALSE, TRUE);
187  return hr;
188  }
189  }
190 
191  if (!tablemarshal)
192  {
193  stdobjref->cPublicRefs = NORMALEXTREFS;
194  stub_manager_ext_addref(manager, stdobjref->cPublicRefs, FALSE);
195  }
196  else
197  {
198  stdobjref->cPublicRefs = 0;
199  if (mshlflags & MSHLFLAGS_TABLESTRONG)
200  stub_manager_ext_addref(manager, 1, FALSE);
201  else
202  stub_manager_ext_addref(manager, 0, TRUE);
203  }
204 
205  /* FIXME: check return value */
207 
208  stdobjref->ipid = ifstub->ipid;
209 
210  stub_manager_int_release(manager);
211  return S_OK;
212 }
struct ifstub * stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *sb, REFIID iid, DWORD dest_context, void *dest_context_data, MSHLFLAGS flags) DECLSPEC_HIDDEN
Definition: stubmanager.c:70
struct ifstub * stub_manager_find_ifstub(struct stub_manager *m, REFIID iid, MSHLFLAGS flags) DECLSPEC_HIDDEN
Definition: stubmanager.c:158
ULONG flags
Definition: marshal.c:92
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT apartment_createwindowifneeded(struct apartment *apt)
Definition: compobj.c:1707
IPID ipid
Definition: marshal.c:96
HRESULT hr
Definition: shlfolder.c:183
static HRESULT apartment_getoxid(const struct apartment *apt, OXID *oxid)
REFIID riid
Definition: precomp.h:44
ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN
Definition: stubmanager.c:311
Definition: stubgen.c:11
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
ULONG stub_manager_ext_addref(struct stub_manager *m, ULONG refs, BOOL tableweak) DECLSPEC_HIDDEN
Definition: stubmanager.c:408
#define debugstr_guid
Definition: kernel32.h:35
OXID oxid
Definition: marshal.c:94
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
HRESULT RPC_RegisterInterface(REFIID riid) DECLSPEC_HIDDEN
Definition: rpc.c:1534
#define NORMALEXTREFS
Definition: marshal.c:44
#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
IUnknown * object
static HRESULT get_facbuf_for_iid(REFIID riid, IPSFactoryBuffer **facbuf)
Definition: marshal.c:109
ULONG cPublicRefs
Definition: marshal.c:93
struct stub_manager * get_stub_manager_from_object(APARTMENT *apt, IUnknown *object, BOOL alloc) DECLSPEC_HIDDEN
Definition: stubmanager.c:337
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define SORFP_TABLEWEAK
Definition: marshal.c:48

Referenced by RemUnknown_RemQueryInterface(), start_apartment_remote_unknown(), and StdMarshalImpl_MarshalInterface().

◆ OLE32_DllGetClassObject()

HRESULT WINAPI OLE32_DllGetClassObject ( REFCLSID  rclsid,
REFIID  iid,
LPVOID ppv 
)

Referenced by DllGetClassObject().

◆ OLE32_DllRegisterServer()

HRESULT WINAPI OLE32_DllRegisterServer ( void  )

Referenced by DllRegisterServer().

◆ OLE32_DllUnregisterServer()

HRESULT WINAPI OLE32_DllUnregisterServer ( void  )

Referenced by DllUnregisterServer().

◆ OLEDD_UnInitialize()

void OLEDD_UnInitialize ( void  )

◆ open_classes_key()

LSTATUS open_classes_key ( HKEY  ,
const WCHAR ,
REGSAM  ,
HKEY  
)

Definition at line 423 of file compobj.c.

424 {
427 
428  if (!(hkey = get_classes_root_hkey( hkey, access ))) return ERROR_INVALID_HANDLE;
429 
430  attr.Length = sizeof(attr);
431  attr.RootDirectory = hkey;
432  attr.ObjectName = &nameW;
433  attr.Attributes = 0;
434  attr.SecurityDescriptor = NULL;
435  attr.SecurityQualityOfService = NULL;
437 
438  return RtlNtStatusToDosError( NtOpenKey( (HANDLE *)retkey, access, &attr ) );
439 }
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
static HKEY get_classes_root_hkey(HKEY hkey, REGSAM access)
Definition: compobj.c:384
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR nameW[]
Definition: main.c:46
Definition: cookie.c:170
__u8 attr
Definition: mkdosfs.c:359
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
Definition: name.c:36
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by CATIDEnumGUID_Clone(), CATIDEnumGUID_Construct(), clsid_from_string_reg(), CLSIDEnumGUID_Clone(), CLSIDEnumGUID_Construct(), CLSIDEnumGUID_Next(), COM_OpenKeyForAppIdFromCLSID(), COM_OpenKeyForCLSID(), COMCAT_ICatInformation_GetCategoryDesc(), COMCAT_ICatInformation_IsClassOfCategories(), COMCAT_ICatRegister_UnRegisterCategories(), COMCAT_IEnumCATEGORYINFO_Clone(), COMCAT_IEnumCATEGORYINFO_Next(), COMCAT_IsClassOfCategories(), COMCAT_UnRegisterClassCategories(), EnumCATEGORYINFO_Construct(), get_ps_clsid_from_registry(), OLECONVERT_CreateCompObjStream(), and OleRegGetMiscStatus().

◆ release_std_git()

void release_std_git ( void  )

Definition at line 386 of file git.c.

387 {
389  StdGITEntry *entry, *entry2;
390 
391  if (!std_git) return;
392 
395  {
396  list_remove(&entry->entry);
397 
398  CoReleaseMarshalData(entry->stream);
399  IStream_Release(entry->stream);
401  }
402 
403  HeapFree(GetProcessHeap(), 0, git);
404 }
HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
Definition: marshal.c:2056
static IGlobalInterfaceTable * std_git
Definition: git.c:72
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define GetProcessHeap()
Definition: compat.h:395
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
struct list list
Definition: git.c:67
#define HeapFree(x, y, z)
Definition: compat.h:394
static StdGlobalInterfaceTableImpl * impl_from_IGlobalInterfaceTable(IGlobalInterfaceTable *iface)
Definition: git.c:84

Referenced by DllMain().

◆ RPC_CreateClientChannel()

HRESULT RPC_CreateClientChannel ( const OXID oxid,
const IPID ipid,
const OXID_INFO *  oxid_info,
const IID iid,
DWORD  dest_context,
void dest_context_data,
IRpcChannelBuffer **  chan,
APARTMENT apt 
)

Definition at line 1099 of file rpc.c.

1103 {
1105  WCHAR endpoint[200];
1108  LPWSTR string_binding;
1109 
1110  /* FIXME: get the endpoint from oxid_info->psa instead */
1111  get_rpc_endpoint(endpoint, oxid);
1112 
1113  TRACE("proxy pipe: connecting to endpoint: %s\n", debugstr_w(endpoint));
1114 
1116  NULL,
1118  NULL,
1119  endpoint,
1120  NULL,
1121  &string_binding);
1122 
1123  if (status == RPC_S_OK)
1124  {
1125  status = RpcBindingFromStringBindingW(string_binding, &bind);
1126 
1127  if (status == RPC_S_OK)
1128  {
1129  IPID ipid2 = *ipid; /* why can't RpcBindingSetObject take a const? */
1130  status = RpcBindingSetObject(bind, &ipid2);
1131  if (status != RPC_S_OK)
1132  RpcBindingFree(&bind);
1133  }
1134 
1135  RpcStringFreeW(&string_binding);
1136  }
1137 
1138  if (status != RPC_S_OK)
1139  {
1140  ERR("Couldn't get binding for endpoint %s, status = %d\n", debugstr_w(endpoint), status);
1141  return HRESULT_FROM_WIN32(status);
1142  }
1143 
1144  This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
1145  if (!This)
1146  {
1147  RpcBindingFree(&bind);
1148  return E_OUTOFMEMORY;
1149  }
1150 
1151  This->super.IRpcChannelBuffer_iface.lpVtbl = &ClientRpcChannelBufferVtbl;
1152  This->super.refs = 1;
1153  This->super.dest_context = dest_context;
1154  This->super.dest_context_data = dest_context_data;
1155  This->bind = bind;
1156  apartment_getoxid(apt, &This->oxid);
1157  This->server_pid = oxid_info->dwPid;
1158  This->event = NULL;
1159  This->iid = *iid;
1160 
1161  *chan = &This->super.IRpcChannelBuffer_iface;
1162 
1163  return S_OK;
1164 }
RPC_STATUS WINAPI RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:877
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:784
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
static HRESULT apartment_getoxid(const struct apartment *apt, OXID *oxid)
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:177
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
RPC_STATUS WINAPI RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr, RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR *StringBinding)
Definition: rpc_binding.c:511
long RPC_STATUS
Definition: rpc.h:52
static void get_rpc_endpoint(LPWSTR endpoint, const OXID *oxid)
Definition: rpc.c:88
IRpcChannelBuffer * chan
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
RPC_STATUS WINAPI RpcBindingSetObject(RPC_BINDING_HANDLE Binding, UUID *ObjectUuid)
Definition: rpc_binding.c:825
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
Definition: nis.h:10
static const IRpcChannelBufferVtbl ClientRpcChannelBufferVtbl
Definition: rpc.c:1074
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
static WCHAR wszRpcTransport[]
Definition: rpc.c:77
Definition: ps.c:97

Referenced by unmarshal_object().

◆ RPC_CreateServerChannel()

HRESULT RPC_CreateServerChannel ( DWORD  dest_context,
void dest_context_data,
IRpcChannelBuffer **  chan 
)

Definition at line 1166 of file rpc.c.

1167 {
1168  RpcChannelBuffer *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
1169  if (!This)
1170  return E_OUTOFMEMORY;
1171 
1172  This->IRpcChannelBuffer_iface.lpVtbl = &ServerRpcChannelBufferVtbl;
1173  This->refs = 1;
1174  This->dest_context = dest_context;
1175  This->dest_context_data = dest_context_data;
1176 
1177  *chan = &This->IRpcChannelBuffer_iface;
1178 
1179  return S_OK;
1180 }
IRpcChannelBuffer * chan
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define S_OK
Definition: intsafe.h:59
static const IRpcChannelBufferVtbl ServerRpcChannelBufferVtbl
Definition: rpc.c:1086

Referenced by stub_manager_new_ifstub().

◆ RPC_ExecuteCall()

void RPC_ExecuteCall ( struct dispatch_params params)

Definition at line 1331 of file rpc.c.

1332 {
1333  struct message_state *message_state = NULL;
1334  RPC_MESSAGE *msg = (RPC_MESSAGE *)params->msg;
1335  char *original_buffer = msg->Buffer;
1336  ORPCTHIS orpcthis;
1337  ORPC_EXTENT_ARRAY orpc_ext_array;
1338  WIRE_ORPC_EXTENT *first_wire_orpc_extent;
1339  GUID old_causality_id;
1340 
1341  /* handle ORPCTHIS and server extensions */
1342 
1343  params->hr = unmarshal_ORPCTHIS(msg, &orpcthis, &orpc_ext_array, &first_wire_orpc_extent);
1344  if (params->hr != S_OK)
1345  {
1346  msg->Buffer = original_buffer;
1347  goto exit;
1348  }
1349 
1351  if (!message_state)
1352  {
1353  params->hr = E_OUTOFMEMORY;
1354  msg->Buffer = original_buffer;
1355  goto exit;
1356  }
1357 
1358  message_state->prefix_data_len = (char *)msg->Buffer - original_buffer;
1359  message_state->binding_handle = msg->Handle;
1360  message_state->bypass_rpcrt = params->bypass_rpcrt;
1361 
1364  message_state->channel_hook_info.uCausality = orpcthis.cid;
1366  message_state->channel_hook_info.iMethod = msg->ProcNum;
1367  message_state->channel_hook_info.pObject = params->iface;
1368 
1369  if (orpcthis.extensions && first_wire_orpc_extent &&
1370  orpcthis.extensions->size)
1371  ChannelHooks_ServerNotify(&message_state->channel_hook_info, msg->DataRepresentation, first_wire_orpc_extent, orpcthis.extensions->size);
1372 
1373  msg->Handle = message_state;
1374  msg->BufferLength -= message_state->prefix_data_len;
1375 
1376  /* call message filter */
1377 
1378  if (COM_CurrentApt()->filter)
1379  {
1380  DWORD handlecall;
1381  INTERFACEINFO interface_info;
1382  CALLTYPE calltype;
1383 
1384  interface_info.pUnk = params->iface;
1385  interface_info.iid = params->iid;
1386  interface_info.wMethod = msg->ProcNum;
1387 
1388  if (IsEqualGUID(&orpcthis.cid, &COM_CurrentInfo()->causality_id))
1389  calltype = CALLTYPE_NESTED;
1390  else if (COM_CurrentInfo()->pending_call_count_server == 0)
1391  calltype = CALLTYPE_TOPLEVEL;
1392  else
1393  calltype = CALLTYPE_TOPLEVEL_CALLPENDING;
1394 
1395  handlecall = IMessageFilter_HandleInComingCall(COM_CurrentApt()->filter,
1396  calltype,
1398  0 /* FIXME */,
1399  &interface_info);
1400  TRACE("IMessageFilter_HandleInComingCall returned %d\n", handlecall);
1401  switch (handlecall)
1402  {
1403  case SERVERCALL_REJECTED:
1405  goto exit_reset_state;
1406  case SERVERCALL_RETRYLATER:
1407 #if 0 /* FIXME: handle retries on the client side before enabling this code */
1408  params->hr = RPC_E_RETRY;
1409  goto exit_reset_state;
1410 #else
1411  FIXME("retry call later not implemented\n");
1412  break;
1413 #endif
1414  case SERVERCALL_ISHANDLED:
1415  default:
1416  break;
1417  }
1418  }
1419 
1420  /* invoke the method */
1421 
1422  /* save the old causality ID - note: any calls executed while processing
1423  * messages received during the SendReceive will appear to originate from
1424  * this call - this should be checked with what Windows does */
1425  old_causality_id = COM_CurrentInfo()->causality_id;
1426  COM_CurrentInfo()->causality_id = orpcthis.cid;
1427  COM_CurrentInfo()->pending_call_count_server++;
1428  params->hr = IRpcStubBuffer_Invoke(params->stub, params->msg, params->chan);
1429  COM_CurrentInfo()->pending_call_count_server--;
1430  COM_CurrentInfo()->causality_id = old_causality_id;
1431 
1432  /* the invoke allocated a new buffer, so free the old one */
1433  if (message_state->bypass_rpcrt && original_buffer != msg->Buffer)
1434  HeapFree(GetProcessHeap(), 0, original_buffer);
1435 
1436 exit_reset_state:
1437  message_state = msg->Handle;
1438  msg->Handle = message_state->binding_handle;
1439  msg->Buffer = (char *)msg->Buffer - message_state->prefix_data_len;
1440  msg->BufferLength += message_state->prefix_data_len;
1441 
1442 exit:
1444  if (params->handle) SetEvent(params->handle);
1445 }
static void ChannelHooks_ServerNotify(SChannelHookCallInfo *info, DWORD lDataRep, WIRE_ORPC_EXTENT *first_wire_orpc_extent, ULONG extension_count)
Definition: rpc.c:278
RPC_BINDING_HANDLE binding_handle
Definition: rpc.c:130
SChannelHookCallInfo channel_hook_info
Definition: rpc.c:132
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
static struct oletls * COM_CurrentInfo(void)
static APARTMENT * COM_CurrentApt(void)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLenum const GLfloat * params
Definition: glext.h:5645
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
BOOL bypass_rpcrt
Definition: rpc.c:133
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
ULONG prefix_data_len
Definition: rpc.c:131
#define UlongToHandle(ul)
Definition: basetsd.h:97
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RPC_E_CALL_REJECTED
Definition: winerror.h:2458
#define S_OK
Definition: intsafe.h:59
static HRESULT unmarshal_ORPCTHIS(RPC_MESSAGE *msg, ORPCTHIS *orpcthis, ORPC_EXTENT_ARRAY *orpc_ext_array, WIRE_ORPC_EXTENT **first_wire_orpc_extent)
Definition: rpc.c:1237
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define RPC_E_RETRY
Definition: winerror.h:2485
#define msg(x)
Definition: auth_time.c:54
void exit(int exitcode)
Definition: _exit.c:33
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define HeapFree(x, y, z)
Definition: compat.h:394
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158

Referenced by apartment_wndproc(), and dispatch_rpc().

◆ RPC_GetLocalClassObject()

HRESULT RPC_GetLocalClassObject ( REFCLSID  rclsid,
REFIID  iid,
LPVOID ppv 
)

Definition at line 1808 of file rpc.c.

1809 {
1810  HRESULT hres;
1811  HANDLE hPipe;
1812  WCHAR pipefn[100];
1813  DWORD res, bufferlen;
1814  char marshalbuffer[200];
1815  IStream *pStm;
1817  ULARGE_INTEGER newpos;
1818  int tries = 0;
1820 
1821  static const int MAXTRIES = 30; /* 30 seconds */
1822 
1823  TRACE("rclsid=%s, iid=%s\n", debugstr_guid(rclsid), debugstr_guid(iid));
1824 
1825  get_localserver_pipe_name(pipefn, rclsid);
1826 
1827  while (tries++ < MAXTRIES) {
1828  TRACE("waiting for %s\n", debugstr_w(pipefn));
1829 
1831  hPipe = CreateFileW(pipefn, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
1832  if (hPipe == INVALID_HANDLE_VALUE) {
1833  DWORD index;
1834  DWORD start_ticks;
1835  HANDLE process = 0;
1836  if (tries == 1) {
1837  if ( (hres = create_local_service(rclsid)) &&
1838  (hres = create_server(rclsid, &process)) )
1839  return hres;
1840  } else {
1841  WARN("Connecting to %s, no response yet, retrying: le is %u\n", debugstr_w(pipefn), GetLastError());
1842  }
1843  /* wait for one second, even if messages arrive */
1844  start_ticks = GetTickCount();
1845  do {
1846  if (SUCCEEDED(CoWaitForMultipleHandles(0, 1000, (process != 0),
1847  &process, &index)) && process && !index)
1848  {
1849  WARN( "server for %s failed to start\n", debugstr_guid(rclsid) );
1850  CloseHandle( hPipe );
1851  CloseHandle( process );
1852  return E_NOINTERFACE;
1853  }
1854  } while (GetTickCount() - start_ticks < 1000);
1855  if (process) CloseHandle( process );
1856  continue;
1857  }
1858  bufferlen = 0;
1859  if (!ReadFile(hPipe,marshalbuffer,sizeof(marshalbuffer),&bufferlen,NULL)) {
1860  FIXME("Failed to read marshal id from classfactory of %s.\n",debugstr_guid(rclsid));
1861  CloseHandle(hPipe);
1862  Sleep(1000);
1863  continue;
1864  }
1865  TRACE("read marshal id from pipe\n");
1866  CloseHandle(hPipe);
1867  break;
1868  }
1869 
1870  if (tries >= MAXTRIES)
1871  return E_NOINTERFACE;
1872 
1873  hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
1874  if (hres != S_OK) return hres;
1875  hres = IStream_Write(pStm,marshalbuffer,bufferlen,&res);
1876  if (hres != S_OK) goto out;
1877  seekto.u.LowPart = 0;seekto.u.HighPart = 0;
1878  hres = IStream_Seek(pStm,seekto,STREAM_SEEK_SET,&newpos);
1879 
1880  TRACE("unmarshalling local server\n");
1881  hres = CoUnmarshalInterface(pStm, &IID_IServiceProvider, (void**)&local_server);
1882  if(SUCCEEDED(hres))
1883  hres = IServiceProvider_QueryService(local_server, rclsid, iid, ppv);
1884  IServiceProvider_Release(local_server);
1885 out:
1886  IStream_Release(pStm);
1887  return hres;
1888 }
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1982
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define E_NOINTERFACE
Definition: winerror.h:2364
#define WARN(fmt,...)
Definition: debug.h:111
BOOL WINAPI WaitNamedPipeW(LPCWSTR lpNamedPipeName, DWORD nTimeOut)
Definition: npipe.c:458
REFIID LPVOID * ppv
Definition: atlbase.h:39
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
static LONG bufferlen
Definition: sync.c:1600
static HRESULT create_server(REFCLSID rclsid, HANDLE *process)
Definition: rpc.c:1657
static LPSTR local_server
Definition: info.c:89
#define GENERIC_WRITE
Definition: nt_native.h:90
#define debugstr_w
Definition: kernel32.h:32
#define NMPWAIT_WAIT_FOREVER
Definition: winbase.h:133
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define debugstr_guid
Definition: kernel32.h:35
#define OPEN_EXISTING
Definition: compat.h:426
HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags, DWORD dwTimeout, ULONG cHandles, LPHANDLE pHandles, LPDWORD lpdwindex)
Definition: compobj.c:4487
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
#define seekto(pos, errstr)
Definition: mkdosfs.c:1613
#define GENERIC_READ
Definition: compat.h:124
#define S_OK
Definition: intsafe.h:59
static HRESULT create_local_service(REFCLSID rclsid)
Definition: rpc.c:1745
#define CreateFileW
Definition: compat.h:400
GLuint res
Definition: glext.h:9613
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static void get_localserver_pipe_name(WCHAR *pipefn, REFCLSID rclsid)
Definition: rpc.c:1800

Referenced by CoGetClassObject().

◆ RPC_RegisterChannelHook()

HRESULT RPC_RegisterChannelHook ( REFGUID  rguid,
IChannelHook hook 
)

Definition at line 428 of file rpc.c.

429 {
430  struct channel_hook_entry *entry;
431 
432  TRACE("(%s, %p)\n", debugstr_guid(rguid), hook);
433 
434  entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry));
435  if (!entry)
436  return E_OUTOFMEMORY;
437 
438  entry->id = *rguid;
439  entry->hook = hook;
440  IChannelHook_AddRef(hook);
441 
443  list_add_tail(&channel_hooks, &entry->entry);
445 
446  return S_OK;
447 }
static CRITICAL_SECTION csChannelHook
Definition: rpc.c:68
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static struct list channel_hooks
Definition: rpc.c:67
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_guid
Definition: kernel32.h:35
Definition: msg.h:42
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Definition: rpc.c:171
uint32_t entry
Definition: isohybrid.c:63
#define S_OK
Definition: intsafe.h:59
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by CoRegisterChannelHook().

◆ RPC_RegisterInterface()

HRESULT RPC_RegisterInterface ( REFIID  riid)

Definition at line 1534 of file rpc.c.

1535 {
1536  struct registered_if *rif;
1537  BOOL found = FALSE;
1538  HRESULT hr = S_OK;
1539 
1540  TRACE("(%s)\n", debugstr_guid(riid));
1541 
1544  {
1546  {
1547  rif->refs++;
1548  found = TRUE;
1549  break;
1550  }
1551  }
1552  if (!found)
1553  {
1554  TRACE("Creating new interface\n");
1555 
1556  rif = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*rif));
1557  if (rif)
1558  {
1560 
1561  rif->refs = 1;
1562  rif->If.Length = sizeof(RPC_SERVER_INTERFACE);
1563  /* RPC interface ID = COM interface ID */
1564  rif->If.InterfaceId.SyntaxGUID = *riid;
1565  rif->If.DispatchTable = &rpc_dispatch;
1566  /* all other fields are 0, including the version asCOM objects
1567  * always have a version of 0.0 */
1569  (RPC_IF_HANDLE)&rif->If,
1570  NULL, NULL,
1573  NULL);
1574  if (status == RPC_S_OK)
1576  else
1577  {
1578  ERR("RpcServerRegisterIfEx failed with error %d\n", status);
1579  HeapFree(GetProcessHeap(), 0, rif);
1581  }
1582  }
1583  else
1584  hr = E_OUTOFMEMORY;
1585  }
1587  return hr;
1588 }
#define TRUE
Definition: types.h:120
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
PRPC_DISPATCH_TABLE DispatchTable
Definition: rpcdcep.h:106
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
#define RPC_IF_OLE
Definition: rpcdce.h:314
struct list entry
Definition: rpc.c:82
DWORD refs
Definition: rpc.c:83
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define RPC_IF_AUTOLISTEN
Definition: rpcdce.h:313
static CRITICAL_SECTION csRegIf
Definition: rpc.c:58
RPC_STATUS WINAPI RpcServerRegisterIfEx(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv, UINT Flags, UINT MaxCalls, RPC_IF_CALLBACK_FN *IfCallbackFn)
Definition: rpc_server.c:1132
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
RPC_SYNTAX_IDENTIFIER InterfaceId
Definition: rpcdcep.h:104
long RPC_STATUS
Definition: rpc.h:52
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int BOOL
Definition: ntddk_ex.h:94
#define RPC_C_LISTEN_MAX_CALLS_DEFAULT
Definition: rpcdce.h:122
smooth NULL
Definition: ftsmooth.c:416
unsigned int Length
Definition: rpcdcep.h:103
#define debugstr_guid
Definition: kernel32.h:35
static RPC_DISPATCH_TABLE rpc_dispatch
Definition: rpc.c:55
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
RPC_SERVER_INTERFACE If
Definition: rpc.c:84
struct _RPC_SERVER_INTERFACE RPC_SERVER_INTERFACE
uint32_t entry
Definition: isohybrid.c:63
static struct list registered_interfaces
Definition: rpc.c:57
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:394
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by marshal_object().

◆ RPC_ResolveOxid()

HRESULT RPC_ResolveOxid ( OXID  oxid,
OXID_INFO *  oxid_info 
)

Definition at line 1613 of file rpc.c.

1614 {
1615  TRACE("%s\n", wine_dbgstr_longlong(oxid));
1616 
1617  oxid_info->dwTid = 0;
1618  oxid_info->dwPid = 0;
1619  oxid_info->dwAuthnHint = RPC_C_AUTHN_LEVEL_NONE;
1620  /* FIXME: this is a hack around not having an OXID resolver yet -
1621  * this function should contact the machine's OXID resolver and then it
1622  * should give us the IPID of the IRemUnknown interface */
1623  oxid_info->ipidRemUnknown.Data1 = 0xffffffff;
1624  oxid_info->ipidRemUnknown.Data2 = 0xffff;
1625  oxid_info->ipidRemUnknown.Data3 = 0xffff;
1626  memcpy(oxid_info->ipidRemUnknown.Data4, &oxid, sizeof(OXID));
1627  oxid_info->psa = NULL /* FIXME */;
1628 
1629  return S_OK;
1630 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
UINT64 OXID
Definition: marshal.c:87
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
#define RPC_C_AUTHN_LEVEL_NONE
Definition: rpcdce.h:146

Referenced by proxy_manager_construct().

◆ RPC_StartLocalServer()

HRESULT RPC_StartLocalServer ( REFCLSID  clsid,
IStream stream,
BOOL  multi_use,
void **  registration 
)

Definition at line 2000 of file rpc.c.

2001 {
2002  DWORD tid, err;
2003  struct local_server_params *lsp;
2004  WCHAR pipefn[100];
2005 
2006  lsp = HeapAlloc(GetProcessHeap(), 0, sizeof(*lsp));
2007  if (!lsp)
2008  return E_OUTOFMEMORY;
2009 
2010  lsp->clsid = *clsid;
2011  lsp->stream = stream;
2012  IStream_AddRef(stream);
2014  if (!lsp->stop_event)
2015  {
2016  HeapFree(GetProcessHeap(), 0, lsp);
2017  return HRESULT_FROM_WIN32(GetLastError());
2018  }
2019  lsp->multi_use = multi_use;
2020 
2021  get_localserver_pipe_name(pipefn, &lsp->clsid);
2024  4096, 4096, 500 /* 0.5 second timeout */, NULL);
2025  if (lsp->pipe == INVALID_HANDLE_VALUE)
2026  {
2027  err = GetLastError();
2028  FIXME("pipe creation failed for %s, le is %u\n", debugstr_w(pipefn), GetLastError());
2029  CloseHandle(lsp->stop_event);
2030  HeapFree(GetProcessHeap(), 0, lsp);
2031  return HRESULT_FROM_WIN32(err);
2032  }
2033 
2034  lsp->thread = CreateThread(NULL, 0, local_server_thread, lsp, 0, &tid);
2035  if (!lsp->thread)
2036  {
2037  CloseHandle(lsp->pipe);
2038  CloseHandle(lsp->stop_event);
2039  HeapFree(GetProcessHeap(), 0, lsp);
2040  return HRESULT_FROM_WIN32(GetLastError());
2041  }
2042 
2043  *registration = lsp;
2044  return S_OK;
2045 }
#define PIPE_UNLIMITED_INSTANCES
Definition: winbase.h:175
#define CloseHandle
Definition: compat.h:398
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define PIPE_WAIT
Definition: winbase.h:171
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
HANDLE stop_event
Definition: rpc.c:1896
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define PIPE_TYPE_BYTE
Definition: winbase.h:167
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:136
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PIPE_ACCESS_DUPLEX
Definition: winbase.h:164
unsigned long DWORD
Definition: ntddk_ex.h:95
IStream * stream
Definition: rpc.c:1894
REFCLSID clsid
Definition: msctf.c:84
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
static DWORD WINAPI local_server_thread(LPVOID param)
Definition: rpc.c:1902
#define err(...)
#define S_OK
Definition: intsafe.h:59
HANDLE thread
Definition: rpc.c:1897
HANDLE WINAPI CreateNamedPipeW(LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: npipe.c:246
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
static TfClientId tid
#define HeapFree(x, y, z)
Definition: compat.h:394
static void get_localserver_pipe_name(WCHAR *pipefn, REFCLSID rclsid)
Definition: rpc.c:1800

Referenced by CoRegisterClassObject().

◆ RPC_StartRemoting()

void RPC_StartRemoting ( struct apartment apt)

Definition at line 1634 of file rpc.c.

1635 {
1637  {
1638  WCHAR endpoint[200];
1640 
1641  get_rpc_endpoint(endpoint, &apt->oxid);
1642 
1646  endpoint,
1647  NULL);
1648  if (status != RPC_S_OK)
1649  ERR("Couldn't register endpoint %s\n", debugstr_w(endpoint));
1650 
1651  /* FIXME: move remote unknown exporting into this function */
1652  }
1654 }
#define TRUE
Definition: types.h:120
long RPC_STATUS
Definition: rpc.h:52
static void get_rpc_endpoint(LPWSTR endpoint, const OXID *oxid)
Definition: rpc.c:88
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
LONG remoting_started
__wchar_t WCHAR
Definition: xmlstorage.h:180
HRESULT start_apartment_remote_unknown(APARTMENT *apt) DECLSPEC_HIDDEN
Definition: stubmanager.c:818
#define InterlockedExchange
Definition: armddk.h:54
RPC_STATUS WINAPI RpcServerUseProtseqEpW(RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor)
Definition: rpc_server.c:934
#define ERR(fmt,...)
Definition: debug.h:109
Definition: nis.h:10
#define RPC_C_PROTSEQ_MAX_REQS_DEFAULT
Definition: rpcdce.h:123
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
static WCHAR wszRpcTransport[]
Definition: rpc.c:77
Definition: ps.c:97

Referenced by StdMarshalImpl_MarshalInterface().

◆ RPC_StopLocalServer()

void RPC_StopLocalServer ( void registration)

Definition at line 2048 of file rpc.c.

2049 {
2050  struct local_server_params *lsp = registration;
2051 
2052  /* signal local_server_thread to stop */
2053  SetEvent(lsp->stop_event);
2054  /* wait for it to exit */
2056 
2057  IStream_Release(lsp->stream);
2058  CloseHandle(lsp->stop_event);
2059  CloseHandle(lsp->thread);
2060  HeapFree(GetProcessHeap(), 0, lsp);
2061 }
#define CloseHandle
Definition: compat.h:398
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE stop_event
Definition: rpc.c:1896
#define GetProcessHeap()
Definition: compat.h:395
IStream * stream
Definition: rpc.c:1894
HANDLE thread
Definition: rpc.c:1897
#define INFINITE
Definition: serial.h:102
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by COM_RevokeRegisteredClassObject().

◆ RPC_UnregisterAllChannelHooks()

void RPC_UnregisterAllChannelHooks ( void  )

Definition at line 449 of file rpc.c.

450 {
451  struct channel_hook_entry *cursor;
452  struct channel_hook_entry *cursor2;
453 
460 }
static CRITICAL_SECTION csChannelHook
Definition: rpc.c:68
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static struct list channel_hooks
Definition: rpc.c:67
static CRITICAL_SECTION csRegIf
Definition: rpc.c:58
#define GetProcessHeap()
Definition: compat.h:395
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
Definition: rpc.c:171
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
const char cursor[]
Definition: icontest.c:13
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by DllMain().

◆ RPC_UnregisterInterface()

void RPC_UnregisterInterface ( REFIID  riid,
BOOL  wait 
)

Definition at line 1591 of file rpc.c.

1592 {
1593  struct registered_if *rif;
1596  {
1598  {
1599  if (!--rif->refs)
1600  {
1601  RpcServerUnregisterIf((RPC_IF_HANDLE)&rif->If, NULL, wait);
1602  list_remove(&rif->entry);
1603  HeapFree(GetProcessHeap(), 0, rif);
1604  }
1605  break;
1606  }
1607  }
1609 }
REFIID riid
Definition: precomp.h:44
struct list entry
Definition: rpc.c:82
DWORD refs
Definition: rpc.c:83
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
RPC_STATUS WINAPI RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, UINT WaitForCallsToComplete)
Definition: rpc_server.c:1209
static CRITICAL_SECTION csRegIf
Definition: rpc.c:58
RPC_SYNTAX_IDENTIFIER InterfaceId
Definition: rpcdcep.h:104
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
smooth NULL
Definition: ftsmooth.c:416
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define GetProcessHeap()
Definition: compat.h:395
RPC_SERVER_INTERFACE If
Definition: rpc.c:84
uint32_t entry
Definition: isohybrid.c:63
static struct list registered_interfaces
Definition: rpc.c:57
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by stub_manager_delete_ifstub(), and stub_manager_disconnect().

◆ RunningObjectTableImpl_Initialize()

HRESULT WINAPI RunningObjectTableImpl_Initialize ( void  )

Definition at line 983 of file moniker.c.

984 {
985  TRACE("\n");
986 
987  /* create the unique instance of the RunningObjectTableImpl structure */
989 
991  return E_OUTOFMEMORY;
992 
993  /* initialize the virtual table function */
995 
996  /* the initial reference is set to "1" so that it isn't destroyed after its
997  * first use until the process is destroyed, as the running object table is
998  * a process-wide cache of a global table */
1000 
1003  DEBUG_SET_CRITSEC_NAME(&runningObjectTableInstance->lock, "RunningObjectTableImpl.lock");
1004 
1005  return S_OK;
1006 }
static RunningObjectTableImpl * runningObjectTableInstance
Definition: moniker.c:82
struct list rot
Definition: moniker.c:78
#define DEBUG_SET_CRITSEC_NAME(cs, name)
static const IRunningObjectTableVtbl VT_RunningObjectTableImpl
Definition: moniker.c:966
CRITICAL_SECTION lock
Definition: moniker.c:79
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define S_OK
Definition: intsafe.h:59
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
IRunningObjectTable IRunningObjectTable_iface
Definition: moniker.c:75

Referenced by CoInitializeEx().

◆ RunningObjectTableImpl_UnInitialize()

HRESULT WINAPI RunningObjectTableImpl_UnInitialize ( void  )

Definition at line 1011 of file moniker.c.

1012 {
1013  TRACE("\n");
1014 
1016  return E_POINTER;
1017 
1019 
1021 
1022  return S_OK;
1023 }
static RunningObjectTableImpl * runningObjectTableInstance
Definition: moniker.c:82
static HRESULT RunningObjectTableImpl_Destroy(void)
Definition: moniker.c:367
static ULONG WINAPI RunningObjectTableImpl_Release(IRunningObjectTable *iface)
Definition: moniker.c:404
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
IRunningObjectTable IRunningObjectTable_iface
Definition: moniker.c:75
#define E_POINTER
Definition: winerror.h:2365

Referenced by CoUninitialize().

◆ start_apartment_remote_unknown()

HRESULT start_apartment_remote_unknown ( APARTMENT apt)

Definition at line 818 of file stubmanager.c.

819 {
820  IRemUnknown *pRemUnknown;
821  HRESULT hr = S_OK;
822 
823  EnterCriticalSection(&apt->cs);
824  if (!apt->remunk_exported)
825  {
826  /* create the IRemUnknown object */
827  hr = RemUnknown_Construct(&pRemUnknown);
828  if (hr == S_OK)
829  {
830  STDOBJREF stdobjref; /* dummy - not used */
831  /* register it with the stub manager */
832  hr = marshal_object(apt, &stdobjref, &IID_IRemUnknown, (IUnknown *)pRemUnknown, MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL|MSHLFLAGSP_REMUNKNOWN);
833  /* release our reference to the object as the stub manager will manage the life cycle for us */
834  IRemUnknown_Release(pRemUnknown);
835  if (hr == S_OK)
836  apt->remunk_exported = TRUE;
837  }
838  }
839  LeaveCriticalSection(&apt->cs);
840  return hr;
841 }
#define MSHLFLAGSP_REMUNKNOWN
static HRESULT RemUnknown_Construct(IRemUnknown **ppRemUnknown)
Definition: stubmanager.c:643
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
static const IID IID_IRemUnknown
Definition: marshal.c:130
HRESULT marshal_object(APARTMENT *apt, STDOBJREF *stdobjref, REFIID riid, IUnknown *obj, DWORD dest_context, void *dest_context_data, MSHLFLAGS mshlflags) DECLSPEC_HIDDEN
Definition: marshal.c:122
#define S_OK
Definition: intsafe.h:59
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
CRITICAL_SECTION cs
BOOL remunk_exported

Referenced by RPC_StartRemoting().

◆ StdGlobalInterfaceTable_GetFactory()

HRESULT StdGlobalInterfaceTable_GetFactory ( LPVOID ppv)

Definition at line 344 of file git.c.

345 {
346  *ppv = &git_classfactory;
347  TRACE("Returning GIT classfactory\n");
348  return S_OK;
349 }
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
static IClassFactory git_classfactory
Definition: git.c:342

Referenced by DllGetClassObject().

◆ stub_manager_disconnect()

void stub_manager_disconnect ( struct stub_manager m)

Definition at line 244 of file stubmanager.c.

245 {
246  struct ifstub *ifstub;
247 
248  EnterCriticalSection(&m->lock);
249  if (!m->disconnected)
250  {
251  LIST_FOR_EACH_ENTRY(ifstub, &m->ifstubs, struct ifstub, entry)
253 
254  m->disconnected = TRUE;
255  }
256  LeaveCriticalSection(&m->lock);
257 }
#define TRUE
Definition: types.h:120
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
const GLfloat * m
Definition: glext.h:10848
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
void RPC_UnregisterInterface(REFIID riid, BOOL wait) DECLSPEC_HIDDEN
Definition: rpc.c:1591
uint32_t entry
Definition: isohybrid.c:63
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by CoDisconnectObject().

◆ stub_manager_ext_addref()

ULONG stub_manager_ext_addref ( struct stub_manager m,
ULONG  refs,
BOOL  tableweak 
)

Definition at line 408 of file stubmanager.c.

409 {
410  BOOL first_extern_ref;
411  ULONG rc;
412 
413  EnterCriticalSection(&m->lock);
414 
415  first_extern_ref = refs && !m->extrefs;
416 
417  /* make sure we don't overflow extrefs */
418  refs = min(refs, (ULONG_MAX-1 - m->extrefs));
419  rc = (m->extrefs += refs);
420 
421  if (tableweak)
422  rc += ++m->weakrefs;
423 
424  LeaveCriticalSection(&m->lock);
425 
426  TRACE("added %u refs to %p (oid %s), rc is now %u\n", refs, m, wine_dbgstr_longlong(m->oid), rc);
427 
428  /*
429  * NOTE: According to tests, creating a stub causes two AddConnection calls followed by
430  * one ReleaseConnection call (with fLastReleaseCloses=FALSE).
431  */
432  if(first_extern_ref && m->extern_conn)
433  IExternalConnection_AddConnection(m->extern_conn, EXTCONN_STRONG, 0);
434 
435  return rc;
436 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
const GLfloat * m
Definition: glext.h:10848
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define ULONG_MAX
Definition: limits.h:44

Referenced by CoLockObjectExternal(), marshal_object(), and RemUnknown_RemAddRef().

◆ stub_manager_ext_release()

ULONG stub_manager_ext_release ( struct stub_manager m,
ULONG  refs,
BOOL  tableweak,
BOOL  last_unlock_releases 
)

Definition at line 439 of file stubmanager.c.

440 {
441  BOOL last_extern_ref;
442  ULONG rc;
443 
444  EnterCriticalSection(&m->lock);
445 
446  /* make sure we don't underflow extrefs */
447  refs = min(refs, m->extrefs);
448  rc = (m->extrefs -= refs);
449 
450  if (tableweak)
451  --m->weakrefs;
452  if (!last_unlock_releases)
453  rc += m->weakrefs;
454 
455  last_extern_ref = refs && !m->extrefs;
456 
457  LeaveCriticalSection(&m->lock);
458 
459  TRACE("removed %u refs from %p (oid %s), rc is now %u\n", refs, m, wine_dbgstr_longlong(m->oid), rc);
460 
461  if (last_extern_ref && m->extern_conn)
462  IExternalConnection_ReleaseConnection(m->extern_conn, EXTCONN_STRONG, 0, last_unlock_releases);
463 
464  if (rc == 0)
465  if (!(m->extern_conn && last_unlock_releases && m->weakrefs))
467 
468  return rc;
469 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
const GLfloat * m
Definition: glext.h:10848
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
ULONG stub_manager_int_release(struct stub_manager *This)
Definition: stubmanager.c:311

Referenced by CoLockObjectExternal(), marshal_object(), RemUnknown_RemRelease(), std_unmarshal_interface(), and stub_manager_release_marshal_data().

◆ stub_manager_find_ifstub()

struct ifstub* stub_manager_find_ifstub ( struct stub_manager m,
REFIID  iid,
MSHLFLAGS  flags 
)

Definition at line 158 of file stubmanager.c.

159 {
160  struct ifstub *result = NULL;
161  struct ifstub *ifstub;
162 
163  EnterCriticalSection(&m->lock);
164  LIST_FOR_EACH_ENTRY( ifstub, &m->ifstubs, struct ifstub, entry )
165  {
166  if (IsEqualIID(iid, &ifstub->iid) && (ifstub->flags == flags))
167  {
168  result = ifstub;
169  break;
170  }
171  }
172  LeaveCriticalSection(&m->lock);
173 
174  return result;
175 }
MSHLFLAGS flags
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
const GLfloat * m
Definition: glext.h:10848
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
smooth NULL
Definition: ftsmooth.c:416
GLbitfield flags
Definition: glext.h:7161
uint32_t entry
Definition: isohybrid.c:63
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
GLuint64EXT * result
Definition: glext.h:11304
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

Referenced by marshal_object().

◆ stub_manager_int_release()

ULONG stub_manager_int_release ( struct stub_manager This)

Definition at line 311 of file stubmanager.c.

312 {
313  ULONG refs;
314  APARTMENT *apt = This->apt;
315 
316  EnterCriticalSection(&apt->cs);
317  refs = --This->refs;
318 
319  TRACE("after %d\n", refs);
320 
321  /* remove from apartment so no other thread can access it... */
322  if (!refs)
323  list_remove(&This->entry);
324 
325  LeaveCriticalSection(&apt->cs);
326 
327  /* ... so now we can delete it without being inside the apartment critsec */
328  if (!refs)
330 
331  return refs;
332 }
static void stub_manager_delete(struct stub_manager *m)
Definition: stubmanager.c:260
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
CRITICAL_SECTION cs

Referenced by apartment_release(), CoDisconnectObject(), CoLockObjectExternal(), dispatch_rpc(), ipid_get_dispatch_params(), marshal_object(), RemUnknown_RemAddRef(), RemUnknown_RemQueryInterface(), RemUnknown_RemRelease(), std_release_marshal_data(), std_unmarshal_interface(), and stub_manager_ext_release().

◆ stub_manager_is_table_marshaled()

BOOL stub_manager_is_table_marshaled ( struct stub_manager m,
const IPID ipid 
)

Definition at line 609 of file stubmanager.c.

610 {
612 
613  assert( ifstub );
614 
615  return ifstub->flags & (MSHLFLAGS_TABLESTRONG | MSHLFLAGS_TABLEWEAK);
616 }
MSHLFLAGS flags
#define assert(x)
Definition: debug.h:53
const GLfloat * m
Definition: glext.h:10848
static struct ifstub * stub_manager_ipid_to_ifstub(struct stub_manager *m, const IPID *ipid)
Definition: stubmanager.c:137

Referenced by std_unmarshal_interface().

◆ stub_manager_new_ifstub()

struct ifstub* stub_manager_new_ifstub ( struct stub_manager m,
IRpcStubBuffer sb,
REFIID  iid,
DWORD  dest_context,
void dest_context_data,
MSHLFLAGS  flags 
)

Definition at line 70 of file stubmanager.c.

72 {
73  struct ifstub *stub;
74  HRESULT hr;
75 
76  TRACE("oid=%s, stubbuffer=%p, iid=%s, dest_context=%x\n", wine_dbgstr_longlong(m->oid), sb,
77  debugstr_guid(iid), dest_context);
78 
79  stub = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct ifstub));
80  if (!stub) return NULL;
81 
82  hr = IUnknown_QueryInterface(m->object, iid, (void **)&stub->iface);
83  if (hr != S_OK)
84  {
86  return NULL;
87  }
88 
89  hr = RPC_CreateServerChannel(dest_context, dest_context_data, &stub->chan);
90  if (hr != S_OK)
91  {
92  IUnknown_Release(stub->iface);
94  return NULL;
95  }
96 
97  stub->stubbuffer = sb;
98  if (sb) IRpcStubBuffer_AddRef(sb);
99 
100  stub->flags = flags;
101  stub->iid = *iid;
102 
103  /* FIXME: find a cleaner way of identifying that we are creating an ifstub
104  * for the remunknown interface */
106  stub->ipid = m->oxid_info.ipidRemUnknown;
107  else
108  generate_ipid(m, &stub->ipid);
109 
110  EnterCriticalSection(&m->lock);
111  list_add_head(&m->ifstubs, &stub->entry);
112  /* every normal marshal is counted so we don't allow more than we should */
113  if (flags & MSHLFLAGS_NORMAL) m->norm_refs++;
114  LeaveCriticalSection(&m->lock);
115 
116  TRACE("ifstub %p created with ipid %s\n", stub, debugstr_guid(&stub->ipid));
117 
118  return stub;
119 }
#define MSHLFLAGSP_REMUNKNOWN
HRESULT hr
Definition: shlfolder.c:183
superblock * sb
Definition: btrfs.c:4162
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
Definition: stubgen.c:11
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
const GLfloat * m
Definition: glext.h:10848
struct _stub stub
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static HRESULT generate_ipid(struct stub_manager *m, IPID *ipid)
Definition: stubmanager.c:52
LONG HRESULT
Definition: typedefs.h:77
HRESULT RPC_CreateServerChannel(DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan) DECLSPEC_HIDDEN
Definition: rpc.c:1166
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:59
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by marshal_object().

◆ stub_manager_notify_unmarshal()

BOOL stub_manager_notify_unmarshal ( struct stub_manager m,
const IPID ipid 
)

Definition at line 562 of file stubmanager.c.

563 {
564  BOOL ret = TRUE;
565  struct ifstub *ifstub;
566 
568  {
569  ERR("attempted unmarshal of unknown IPID %s\n", debugstr_guid(ipid));
570  return FALSE;
571  }
572 
573  EnterCriticalSection(&m->lock);
574 
575  /* track normal marshals so we can enforce rules whilst in-process */
576  if (ifstub->flags & MSHLFLAGS_NORMAL)
577  {
578  if (m->norm_refs)
579  m->norm_refs--;
580  else
581  {
582  ERR("attempted invalid normal unmarshal, norm_refs is zero\n");
583  ret = FALSE;
584  }
585  }
586 
587  LeaveCriticalSection(&m->lock);
588 
589  return ret;
590 }
#define TRUE
Definition: types.h:120
MSHLFLAGS flags
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
const GLfloat * m
Definition: glext.h:10848
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_guid
Definition: kernel32.h:35
int ret
static struct ifstub * stub_manager_ipid_to_ifstub(struct stub_manager *m, const IPID *ipid)
Definition: stubmanager.c:137
#define ERR(fmt,...)
Definition: debug.h:109
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by std_unmarshal_interface().

◆ stub_manager_release_marshal_data()

void stub_manager_release_marshal_data ( struct stub_manager m,
ULONG  refs,
const IPID ipid,
BOOL  tableweak 
)

Definition at line 593 of file stubmanager.c.

594 {
595  struct ifstub *ifstub;
596 
598  return;
599 
600  if (ifstub->flags & MSHLFLAGS_TABLEWEAK)
601  refs = 0;
602  else if (ifstub->flags & MSHLFLAGS_TABLESTRONG)
603  refs = 1;
604 
605  stub_manager_ext_release(m, refs, tableweak, !tableweak);
606 }
ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL tableweak, BOOL last_unlock_releases)
Definition: stubmanager.c:439
MSHLFLAGS flags
const GLfloat * m
Definition: glext.h:10848
static struct ifstub * stub_manager_ipid_to_ifstub(struct stub_manager *m, const IPID *ipid)
Definition: stubmanager.c:137

Referenced by std_release_marshal_data().

Variable Documentation

◆ DECLSPEC_HIDDEN

Definition at line 304 of file compobj_private.h.