ReactOS  0.4.14-dev-614-gbfd8a84
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  init_spy
 
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 303 of file compobj_private.h.

◆ DEBUG_CLEAR_CRITSEC_NAME

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

Definition at line 301 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 300 of file compobj_private.h.

◆ DM_EXECUTERPC

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

Definition at line 263 of file compobj_private.h.

◆ DM_HOSTOBJECT

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

Definition at line 264 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 305 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 254 of file compobj.c.

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

1705 {
1706  static INIT_ONCE class_init_once = INIT_ONCE_STATIC_INIT;
1707 
1708  if (apt->multi_threaded)
1709  return S_OK;
1710 
1711  if (!apt->win)
1712  {
1713  HWND hwnd;
1714 
1715  InitOnceExecuteOnce( &class_init_once, register_class, NULL, NULL );
1716 
1717  hwnd = CreateWindowW(wszAptWinClass, NULL, 0, 0, 0, 0, 0,
1718  HWND_MESSAGE, 0, hProxyDll, NULL);
1719  if (!hwnd)
1720  {
1721  ERR("CreateWindow failed with error %d\n", GetLastError());
1722  return HRESULT_FROM_WIN32(GetLastError());
1723  }
1725  /* someone beat us to it */
1727  }
1728 
1729  return S_OK;
1730 }
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:4291
#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:1681
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static const WCHAR wszAptWinClass[]
Definition: compobj.c:481

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

◆ apartment_disconnectproxies()

HRESULT apartment_disconnectproxies ( struct apartment apt)

Definition at line 1226 of file marshal.c.

1227 {
1228  struct list * cursor;
1229 
1230  LIST_FOR_EACH(cursor, &apt->proxies)
1231  {
1232  struct proxy_manager * proxy = LIST_ENTRY(cursor, struct proxy_manager, entry);
1234  }
1235 
1236  return S_OK;
1237 }
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:1060
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by apartment_release().

◆ apartment_findfromoxid()

APARTMENT* apartment_findfromoxid ( OXID  oxid,
BOOL  ref 
)

Definition at line 1276 of file compobj.c.

1277 {
1278  APARTMENT *result = NULL;
1279  struct list *cursor;
1280 
1283  {
1284  struct apartment *apt = LIST_ENTRY( cursor, struct apartment, entry );
1285  if (apt->oxid == oxid)
1286  {
1287  result = apt;
1288  if (ref) apartment_addref(result);
1289  break;
1290  }
1291  }
1293 
1294  return result;
1295 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:619
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
Definition: send.c:47
static struct list apts
Definition: compobj.c:78
#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:80
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 1300 of file compobj.c.

1301 {
1302  APARTMENT *result = NULL;
1303  struct list *cursor;
1304 
1307  {
1308  struct apartment *apt = LIST_ENTRY( cursor, struct apartment, entry );
1309  if (apt->tid == tid)
1310  {
1311  result = apt;
1313  break;
1314  }
1315  }
1317 
1318  return result;
1319 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:619
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static struct list apts
Definition: compobj.c:78
#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:80
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 742 of file compobj.c.

743 {
744  APARTMENT *apt = COM_CurrentApt();
745  if (apt)
746  {
747  apartment_addref(apt);
748  return apt;
749  }
750  return apartment_find_mta();
751 }
static DWORD apartment_addref(struct apartment *apt)
Definition: compobj.c:619
static APARTMENT * COM_CurrentApt(void)
static APARTMENT * apartment_find_mta(void)
Definition: compobj.c:726

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 251 of file compobj_private.h.

252 {
253  *oxid = apt->oxid;
254  return S_OK;
255 }
#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 1733 of file compobj.c.

1734 {
1735  assert(!apt->multi_threaded);
1736  return apt->win;
1737 }
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 1172 of file compobj.c.

1173 {
1174  DWORD ret;
1175 
1177 
1178  ret = InterlockedDecrement(&apt->refs);
1179  TRACE("%s: after = %d\n", wine_dbgstr_longlong(apt->oxid), ret);
1180 
1181  if (apt->being_destroyed)
1182  {
1184  return ret;
1185  }
1186 
1187  /* destruction stuff that needs to happen under csApartment CS */
1188  if (ret == 0)
1189  {
1190  apt->being_destroyed = TRUE;
1191  if (apt == MTA) MTA = NULL;
1192  else if (apt == MainApartment) MainApartment = NULL;
1193  list_remove(&apt->entry);
1194  }
1195 
1197 
1198  if (ret == 0)
1199  {
1200  struct list *cursor, *cursor2;
1201 
1202  TRACE("destroying apartment %p, oxid %s\n", apt, wine_dbgstr_longlong(apt->oxid));
1203 
1204  if(apt->local_server) {
1207 
1208  memset(&zero, 0, sizeof(zero));
1209  IStream_Seek(local_server->marshal_stream, zero, STREAM_SEEK_SET, NULL);
1210  CoReleaseMarshalData(local_server->marshal_stream);
1211  IStream_Release(local_server->marshal_stream);
1212  local_server->marshal_stream = NULL;
1213 
1214  apt->local_server = NULL;
1215  local_server->apt = NULL;
1216  IServiceProvider_Release(&local_server->IServiceProvider_iface);
1217  }
1218 
1219  /* Release the references to the registered class objects */
1220  COM_RevokeAllClasses(apt);
1221 
1222  /* no locking is needed for this apartment, because no other thread
1223  * can access it at this point */
1224 
1226 
1227  if (apt->win) DestroyWindow(apt->win);
1228  if (apt->host_apt_tid) PostThreadMessageW(apt->host_apt_tid, WM_QUIT, 0, 0);
1229 
1230  LIST_FOR_EACH_SAFE(cursor, cursor2, &apt->stubmgrs)
1231  {
1232  struct stub_manager *stubmgr = LIST_ENTRY(cursor, struct stub_manager, entry);
1233  /* release the implicit reference given by the fact that the
1234  * stub has external references (it must do since it is in the
1235  * stub manager list in the apartment and all non-apartment users
1236  * must have a ref on the apartment and so it cannot be destroyed).
1237  */
1238  stub_manager_int_release(stubmgr);
1239  }
1240 
1241  /* if this assert fires, then another thread took a reference to a
1242  * stub manager without taking a reference to the containing
1243  * apartment, which it must do. */
1245 
1246  if (apt->filter) IMessageFilter_Release(apt->filter);
1247 
1248  /* free as many unused libraries as possible... */
1250 
1251  /* ... and free the memory for the apartment loaded dll entry and
1252  * release the dll list reference without freeing the library for the
1253  * rest */
1254  while ((cursor = list_head(&apt->loaded_dlls)))
1255  {
1260  }
1261 
1263  DeleteCriticalSection(&apt->cs);
1264 
1265  HeapFree(GetProcessHeap(), 0, apt);
1266  }
1267 
1268  return ret;
1269 }
HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
Definition: marshal.c:2055
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:1132
ULONG stub_manager_int_release(struct stub_manager *This) DECLSPEC_HIDDEN
Definition: stubmanager.c:311
APARTMENT * apt
static APARTMENT * MainApartment
Definition: compobj.c:77
#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:76
smooth NULL
Definition: ftsmooth.c:416
LocalServer * local_server
static void COM_RevokeAllClasses(const struct apartment *apt)
Definition: compobj.c:764
__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:403
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:583
#define InterlockedDecrement
Definition: armddk.h:52
struct list loaded_dlls
uint32_t entry
Definition: isohybrid.c:63
static CRITICAL_SECTION csApartment
Definition: compobj.c:80
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:1226
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:402

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 289 of file compobj_private.h.

290 {
291  struct oletls *info = COM_CurrentInfo();
292  if (!info)
293  return GUID_NULL;
294  if (IsEqualGUID(&info->causality_id, &GUID_NULL))
295  CoCreateGuid(&info->causality_id);
296  return info->causality_id;
297 }
static struct oletls * COM_CurrentInfo(void)
HRESULT WINAPI CoCreateGuid(GUID *pguid)
Definition: compobj.c:2206
#define GUID_NULL
Definition: ks.h:106
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

Referenced by ClientRpcChannelBuffer_GetBuffer(), and CoGetCurrentLogicalThreadId().

◆ COM_CurrentInfo()

static struct oletls* COM_CurrentInfo ( void  )
inlinestatic

Definition at line 271 of file compobj_private.h.

272 {
273  if (!NtCurrentTeb()->ReservedForOle)
274  {
275  struct oletls *oletls = heap_alloc_zero(sizeof(*oletls));
276  if (oletls)
278  NtCurrentTeb()->ReservedForOle = oletls;
279  }
280 
281  return NtCurrentTeb()->ReservedForOle;
282 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
struct list spies

Referenced by apartment_get_or_create(), ClientRpcChannelBuffer_SendReceive(), CoGetApartmentType(), CoGetCallContext(), CoGetContextToken(), CoGetState(), CoInitializeEx(), COM_CurrentApt(), COM_CurrentCausalityId(), CoRegisterInitializeSpy(), CoRevokeInitializeSpy(), CoSetState(), CoSwitchCallContext(), CoUninitialize(), CoWaitForMultipleHandles(), dispatch_rpc(), get_ole_clipbrd(), GetErrorInfo(), OleInitialize(), OleUninitialize(), RPC_ExecuteCall(), and SetErrorInfo().

◆ COM_OpenKeyForAppIdFromCLSID()

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

Definition at line 2480 of file compobj.c.

2481 {
2482  static const WCHAR szAppId[] = { 'A','p','p','I','d',0 };
2483  static const WCHAR szAppIdKey[] = { 'A','p','p','I','d','\\',0 };
2484  DWORD res;
2486  WCHAR keyname[ARRAY_SIZE(szAppIdKey) + CHARS_IN_GUID];
2487  DWORD size;
2488  HKEY hkey;
2489  DWORD type;
2490  HRESULT hr;
2491 
2492  /* read the AppID value under the class's key */
2494  if (FAILED(hr))
2495  return hr;
2496 
2497  size = sizeof(buf);
2498  res = RegQueryValueExW(hkey, szAppId, NULL, &type, (LPBYTE)buf, &size);
2499  RegCloseKey(hkey);
2500  if (res == ERROR_FILE_NOT_FOUND)
2501  return REGDB_E_KEYMISSING;
2502  else if (res != ERROR_SUCCESS || type!=REG_SZ)
2503  return REGDB_E_READREGDB;
2504 
2505  lstrcpyW(keyname, szAppIdKey);
2506  lstrcatW(keyname, buf);
2507  res = open_classes_key(HKEY_CLASSES_ROOT, keyname, access, subkey);
2508  if (res == ERROR_FILE_NOT_FOUND)
2509  return REGDB_E_KEYMISSING;
2510  else if (res != ERROR_SUCCESS)
2511  return REGDB_E_READREGDB;
2512 
2513  return S_OK;
2514 }
#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:2448
#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:82
#define S_OK
Definition: intsafe.h:59
#define lstrcpyW
Definition: compat.h:414
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:420
GLuint res
Definition: glext.h:9613
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#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 2448 of file compobj.c.

2449 {
2450  static const WCHAR wszCLSIDSlash[] = {'C','L','S','I','D','\\',0};
2451  WCHAR path[CHARS_IN_GUID + ARRAY_SIZE(wszCLSIDSlash) - 1];
2452  LONG res;
2453  HKEY key;
2454 
2455  lstrcpyW(path, wszCLSIDSlash);
2456  StringFromGUID2(clsid, path + lstrlenW(wszCLSIDSlash), CHARS_IN_GUID);
2458  if (res == ERROR_FILE_NOT_FOUND)
2459  return REGDB_E_CLASSNOTREG;
2460  else if (res != ERROR_SUCCESS)
2461  return REGDB_E_READREGDB;
2462 
2463  if (!keyname)
2464  {
2465  *subkey = key;
2466  return S_OK;
2467  }
2468 
2469  res = open_classes_key(key, keyname, access, subkey);
2470  RegCloseKey(key);
2471  if (res == ERROR_FILE_NOT_FOUND)
2472  return REGDB_E_KEYMISSING;
2473  else if (res != ERROR_SUCCESS)
2474  return REGDB_E_READREGDB;
2475 
2476  return S_OK;
2477 }
#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
#define lstrlenW
Definition: compat.h:415
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:2434
REFCLSID clsid
Definition: msctf.c:82
HKEY key
Definition: reg.c:42
#define S_OK
Definition: intsafe.h:59
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
#define lstrcpyW
Definition: compat.h:414
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:420
GLuint res
Definition: glext.h:9613
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
Definition: path.c:41

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 343 of file compobj_private.h.

344 {
345  *dst = *src;
346  if (src->ptd)
347  {
348  dst->ptd = CoTaskMemAlloc( src->ptd->tdSize );
349  if (!dst->ptd) return E_OUTOFMEMORY;
350  memcpy( dst->ptd, src->ptd, src->ptd->tdSize );
351  }
352  return S_OK;
353 }
#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:404

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

403 {
406 
407  if (!(hkey = get_classes_root_hkey( hkey, access ))) return ERROR_INVALID_HANDLE;
408 
409  attr.Length = sizeof(attr);
410  attr.RootDirectory = hkey;
411  attr.ObjectName = &nameW;
412  attr.Attributes = 0;
413  attr.SecurityDescriptor = NULL;
414  attr.SecurityQualityOfService = NULL;
416 
417  return RtlNtStatusToDosError( create_key( retkey, access, &attr ) );
418 }
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
static HKEY get_classes_root_hkey(HKEY hkey, REGSAM access)
Definition: compobj.c:381
static NTSTATUS create_key(HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr)
Definition: compobj.c:303
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR nameW[]
Definition: main.c:46
Definition: cookie.c:201
__u8 attr
Definition: mkdosfs.c:359
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
Definition: name.c:38
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 806 of file oleobj.c.

807 {
809  DWORD index;
810  HRESULT hr = S_OK;
811 
812  for(index = 0; index < This->maxCons; index++)
813  {
814  if(This->connections[index].pAdvSink != NULL)
815  {
816  hr = IDataObject_DAdvise(pDelegate, &This->connections[index].formatetc,
817  This->connections[index].advf,
818  This->connections[index].pAdvSink,
819  &This->remote_connections[index]);
820  if (FAILED(hr)) break;
821  This->connections[index].advf |= WINE_ADVF_REMOTE;
822  }
823  }
824  This->delegate = pDelegate;
825  return hr;
826 }
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:544
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:546

Referenced by DefaultHandler_DAdvise(), and DefaultHandler_Run().

◆ DataAdviseHolder_OnDisconnect()

void DataAdviseHolder_OnDisconnect ( IDataAdviseHolder iface)

Definition at line 828 of file oleobj.c.

829 {
831  DWORD index;
832 
833  for(index = 0; index < This->maxCons; index++)
834  {
835  if((This->connections[index].pAdvSink != NULL) &&
836  (This->connections[index].advf & WINE_ADVF_REMOTE))
837  {
838  IDataObject_DUnadvise(This->delegate, This->remote_connections[index]);
839  This->remote_connections[index] = 0;
840  This->connections[index].advf &= ~WINE_ADVF_REMOTE;
841  }
842  }
843  This->delegate = NULL;
844 }
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define WINE_ADVF_REMOTE
Definition: oleobj.c:544
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:546

Referenced by DefaultHandler_Stop().

◆ debugstr_formatetc()

const char* debugstr_formatetc ( const FORMATETC *  formatetc)

Definition at line 216 of file datacache.c.

217 {
218  return wine_dbg_sprintf("{ cfFormat = 0x%x, ptd = %p, dwAspect = %d, lindex = %d, tymed = %d }",
219  formatetc->cfFormat, formatetc->ptd, formatetc->dwAspect,
220  formatetc->lindex, formatetc->tymed);
221 }
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 1913 of file compobj.c.

1914 {
1915  HRESULT hr = S_OK;
1916 
1917  if (!info->apt)
1918  {
1919  if (!apartment_get_or_create( model ))
1920  return E_OUTOFMEMORY;
1921  }
1922  else if (!apartment_is_model( info->apt, model ))
1923  {
1924  WARN( "Attempt to change threading model of this apartment from %s to %s\n",
1925  info->apt->multi_threaded ? "multi-threaded" : "apartment threaded",
1926  model & COINIT_APARTMENTTHREADED ? "apartment threaded" : "multi-threaded" );
1927  return RPC_E_CHANGED_MODE;
1928  }
1929  else
1930  hr = S_FALSE;
1931 
1932  info->inits++;
1933 
1934  return hr;
1935 }
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:718
#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:670
#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 197 of file oleobj.c.

199 {
200  EnumSTATDATA *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
201  DWORD i, count;
202 
203  if (!This) return E_OUTOFMEMORY;
204 
205  This->IEnumSTATDATA_iface.lpVtbl = &EnumSTATDATA_VTable;
206  This->ref = 1;
207  This->index = index;
208 
209  if (copy)
210  {
211  This->statdata = HeapAlloc(GetProcessHeap(), 0, array_len * sizeof(*This->statdata));
212  if(!This->statdata)
213  {
215  return E_OUTOFMEMORY;
216  }
217 
218  for(i = 0, count = 0; i < array_len; i++)
219  {
220  if(data[i].pAdvSink)
221  {
222  copy_statdata(This->statdata + count, data + i);
223  count++;
224  }
225  }
226  }
227  else
228  {
229  This->statdata = data;
230  count = array_len;
231  }
232 
233  This->num_of_elems = count;
234  This->holder = holder;
235  if (holder) IUnknown_AddRef(holder);
236  *ppenum = &This->IEnumSTATDATA_iface;
237  return S_OK;
238 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
static HRESULT copy_statdata(STATDATA *dst, const STATDATA *src)
Definition: oleobj.c:54
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:186
#define GetProcessHeap()
Definition: compat.h:403
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:402

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

◆ FTMarshalCF_Create()

HRESULT FTMarshalCF_Create ( REFIID  riid,
LPVOID ppv 
)

Definition at line 411 of file ftmarshal.c.

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

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:403
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:402

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

5352 {
5354  HRESULT hres;
5355 
5356  TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
5357 
5358  if (outer)
5359  return E_INVALIDARG;
5360 
5362  if (!global_options)
5363  return E_OUTOFMEMORY;
5364  global_options->IGlobalOptions_iface.lpVtbl = &GlobalOptionsVtbl;
5365  global_options->ref = 1;
5366 
5367  hres = IGlobalOptions_QueryInterface(&global_options->IGlobalOptions_iface, riid, ppv);
5368  IGlobalOptions_Release(&global_options->IGlobalOptions_iface);
5369  return hres;
5370 }
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:5343

◆ Handler_DllGetClassObject()

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

Definition at line 5167 of file compobj.c.

5168 {
5169  static const WCHAR wszInprocHandler32[] = {'I','n','p','r','o','c','H','a','n','d','l','e','r','3','2',0};
5170  HKEY hkey;
5171  HRESULT hres;
5172 
5173  hres = COM_OpenKeyForCLSID(rclsid, wszInprocHandler32, KEY_READ, &hkey);
5174  if (SUCCEEDED(hres))
5175  {
5176  struct class_reg_data regdata;
5177  WCHAR dllpath[MAX_PATH+1];
5178 
5179  regdata.u.hkey = hkey;
5180  regdata.hkey = TRUE;
5181 
5182  if (get_object_dll_path(&regdata, dllpath, ARRAY_SIZE(dllpath)))
5183  {
5184  static const WCHAR wszOle32[] = {'o','l','e','3','2','.','d','l','l',0};
5185  if (!wcsicmp(dllpath, wszOle32))
5186  {
5187  RegCloseKey(hkey);
5188  return HandlerCF_Create(rclsid, riid, ppv);
5189  }
5190  }
5191  else
5192  WARN("not creating object for inproc handler path %s\n", debugstr_w(dllpath));
5193  RegCloseKey(hkey);
5194  }
5195 
5197 }
#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:1413
#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:2448
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
#define wcsicmp
Definition: string.h:1152
HRESULT HandlerCF_Create(REFCLSID rclsid, REFIID riid, LPVOID *ppv) DECLSPEC_HIDDEN
#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 2358 of file defaulthandler.c.

2359 {
2360  HRESULT hr;
2361  HandlerCF *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
2362  if (!This) return E_OUTOFMEMORY;
2363  This->IClassFactory_iface.lpVtbl = &HandlerClassFactoryVtbl;
2364  This->refs = 0;
2365  This->clsid = *rclsid;
2366 
2367  hr = IClassFactory_QueryInterface(&This->IClassFactory_iface, riid, ppv);
2368  if (FAILED(hr))
2369  HeapFree(GetProcessHeap(), 0, This);
2370 
2371  return hr;
2372 }
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:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
#define HeapFree(x, y, z)
Definition: compat.h:402

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

1938 {
1939  if (!--info->inits)
1940  {
1941  if (info->ole_inits)
1942  WARN( "Uninitializing apartment while Ole is still initialized\n" );
1943  apartment_release( info->apt );
1944  info->apt = NULL;
1945  }
1946 }
DWORD apartment_release(struct apartment *apt)
Definition: compobj.c:1172
#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 2205 of file marshal.c.

2206 {
2207  *ppv = &StdMarshalCF;
2208  return S_OK;
2209 }
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const IClassFactoryVtbl * StdMarshalCF
Definition: marshal.c:2203
#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 121 of file marshal.c.

123 {
124  struct stub_manager *manager;
125  struct ifstub *ifstub;
126  BOOL tablemarshal;
127  HRESULT hr;
128 
129  hr = apartment_getoxid(apt, &stdobjref->oxid);
130  if (hr != S_OK)
131  return hr;
132 
134  if (hr != S_OK)
135  return hr;
136 
137  if (!(manager = get_stub_manager_from_object(apt, object, TRUE)))
138  return E_OUTOFMEMORY;
139 
140  stdobjref->flags = SORF_NULL;
141  if (mshlflags & MSHLFLAGS_TABLEWEAK)
142  stdobjref->flags |= SORFP_TABLEWEAK;
143  if (mshlflags & MSHLFLAGS_NOPING)
144  stdobjref->flags |= SORF_NOPING;
145  stdobjref->oid = manager->oid;
146 
147  tablemarshal = ((mshlflags & MSHLFLAGS_TABLESTRONG) || (mshlflags & MSHLFLAGS_TABLEWEAK));
148 
149  /* make sure ifstub that we are creating is unique */
150  ifstub = stub_manager_find_ifstub(manager, riid, mshlflags);
151  if (!ifstub) {
153 
154  /* IUnknown doesn't require a stub buffer, because it never goes out on
155  * the wire */
156  if (!IsEqualIID(riid, &IID_IUnknown))
157  {
158  IPSFactoryBuffer *psfb;
159 
160  hr = get_facbuf_for_iid(riid, &psfb);
161  if (hr == S_OK) {
162  hr = IPSFactoryBuffer_CreateStub(psfb, riid, manager->object, &stub);
163  IPSFactoryBuffer_Release(psfb);
164  if (hr != S_OK)
165  ERR("Failed to create an IRpcStubBuffer from IPSFactory for %s with error 0x%08x\n",
166  debugstr_guid(riid), hr);
167  }else {
168  ERR("couldn't get IPSFactory buffer for interface %s\n", debugstr_guid(riid));
169  hr = E_NOINTERFACE;
170  }
171 
172  }
173 
174  if (hr == S_OK) {
175  ifstub = stub_manager_new_ifstub(manager, stub, riid, dest_context, dest_context_data, mshlflags);
176  if (!ifstub)
177  hr = E_OUTOFMEMORY;
178  }
179  if (stub) IRpcStubBuffer_Release(stub);
180 
181  if (hr != S_OK) {
182  stub_manager_int_release(manager);
183  /* destroy the stub manager if it has no ifstubs by releasing
184  * zero external references */
185  stub_manager_ext_release(manager, 0, FALSE, TRUE);
186  return hr;
187  }
188  }
189 
190  if (!tablemarshal)
191  {
192  stdobjref->cPublicRefs = NORMALEXTREFS;
193  stub_manager_ext_addref(manager, stdobjref->cPublicRefs, FALSE);
194  }
195  else
196  {
197  stdobjref->cPublicRefs = 0;
198  if (mshlflags & MSHLFLAGS_TABLESTRONG)
199  stub_manager_ext_addref(manager, 1, FALSE);
200  else
201  stub_manager_ext_addref(manager, 0, TRUE);
202  }
203 
204  /* FIXME: check return value */
206 
207  stdobjref->ipid = ifstub->ipid;
208 
209  stub_manager_int_release(manager);
210  return S_OK;
211 }
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:1704
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:1530
#define NORMALEXTREFS
Definition: marshal.c:43
#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:108
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:47

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

421 {
424 
425  if (!(hkey = get_classes_root_hkey( hkey, access ))) return ERROR_INVALID_HANDLE;
426 
427  attr.Length = sizeof(attr);
428  attr.RootDirectory = hkey;
429  attr.ObjectName = &nameW;
430  attr.Attributes = 0;
431  attr.SecurityDescriptor = NULL;
432  attr.SecurityQualityOfService = NULL;
434 
435  return RtlNtStatusToDosError( NtOpenKey( (HANDLE *)retkey, access, &attr ) );
436 }
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
static HKEY get_classes_root_hkey(HKEY hkey, REGSAM access)
Definition: compobj.c:381
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR nameW[]
Definition: main.c:46
Definition: cookie.c:201
__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:38
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:2055
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:403
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:402
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 1095 of file rpc.c.

1099 {
1101  WCHAR endpoint[200];
1104  LPWSTR string_binding;
1105 
1106  /* FIXME: get the endpoint from oxid_info->psa instead */
1107  get_rpc_endpoint(endpoint, oxid);
1108 
1109  TRACE("proxy pipe: connecting to endpoint: %s\n", debugstr_w(endpoint));
1110 
1112  NULL,
1114  NULL,
1115  endpoint,
1116  NULL,
1117  &string_binding);
1118 
1119  if (status == RPC_S_OK)
1120  {
1121  status = RpcBindingFromStringBindingW(string_binding, &bind);
1122 
1123  if (status == RPC_S_OK)
1124  {
1125  IPID ipid2 = *ipid; /* why can't RpcBindingSetObject take a const? */
1126  status = RpcBindingSetObject(bind, &ipid2);
1127  if (status != RPC_S_OK)
1128  RpcBindingFree(&bind);
1129  }
1130 
1131  RpcStringFreeW(&string_binding);
1132  }
1133 
1134  if (status != RPC_S_OK)
1135  {
1136  ERR("Couldn't get binding for endpoint %s, status = %d\n", debugstr_w(endpoint), status);
1137  return HRESULT_FROM_WIN32(status);
1138  }
1139 
1140  This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
1141  if (!This)
1142  {
1143  RpcBindingFree(&bind);
1144  return E_OUTOFMEMORY;
1145  }
1146 
1147  This->super.IRpcChannelBuffer_iface.lpVtbl = &ClientRpcChannelBufferVtbl;
1148  This->super.refs = 1;
1149  This->super.dest_context = dest_context;
1150  This->super.dest_context_data = dest_context_data;
1151  This->bind = bind;
1152  apartment_getoxid(apt, &This->oxid);
1153  This->server_pid = oxid_info->dwPid;
1154  This->event = NULL;
1155  This->iid = *iid;
1156 
1157  *chan = &This->super.IRpcChannelBuffer_iface;
1158 
1159  return S_OK;
1160 }
RPC_STATUS WINAPI RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:876
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:783
#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:174
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:510
long RPC_STATUS
Definition: rpc.h:52
static void get_rpc_endpoint(LPWSTR endpoint, const OXID *oxid)
Definition: rpc.c:84
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:403
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:824
#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:1070
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:73
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 1162 of file rpc.c.

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

Referenced by stub_manager_new_ifstub().

◆ RPC_ExecuteCall()

void RPC_ExecuteCall ( struct dispatch_params params)

Definition at line 1327 of file rpc.c.

1328 {
1329  struct message_state *message_state = NULL;
1330  RPC_MESSAGE *msg = (RPC_MESSAGE *)params->msg;
1331  char *original_buffer = msg->Buffer;
1332  ORPCTHIS orpcthis;
1333  ORPC_EXTENT_ARRAY orpc_ext_array;
1334  WIRE_ORPC_EXTENT *first_wire_orpc_extent;
1335  GUID old_causality_id;
1336 
1337  /* handle ORPCTHIS and server extensions */
1338 
1339  params->hr = unmarshal_ORPCTHIS(msg, &orpcthis, &orpc_ext_array, &first_wire_orpc_extent);
1340  if (params->hr != S_OK)
1341  {
1342  msg->Buffer = original_buffer;
1343  goto exit;
1344  }
1345 
1347  if (!message_state)
1348  {
1349  params->hr = E_OUTOFMEMORY;
1350  msg->Buffer = original_buffer;
1351  goto exit;
1352  }
1353 
1354  message_state->prefix_data_len = (char *)msg->Buffer - original_buffer;
1355  message_state->binding_handle = msg->Handle;
1356  message_state->bypass_rpcrt = params->bypass_rpcrt;
1357 
1360  message_state->channel_hook_info.uCausality = orpcthis.cid;
1362  message_state->channel_hook_info.iMethod = msg->ProcNum;
1363  message_state->channel_hook_info.pObject = params->iface;
1364 
1365  if (orpcthis.extensions && first_wire_orpc_extent &&
1366  orpcthis.extensions->size)
1367  ChannelHooks_ServerNotify(&message_state->channel_hook_info, msg->DataRepresentation, first_wire_orpc_extent, orpcthis.extensions->size);
1368 
1369  msg->Handle = message_state;
1370  msg->BufferLength -= message_state->prefix_data_len;
1371 
1372  /* call message filter */
1373 
1374  if (COM_CurrentApt()->filter)
1375  {
1376  DWORD handlecall;
1377  INTERFACEINFO interface_info;
1378  CALLTYPE calltype;
1379 
1380  interface_info.pUnk = params->iface;
1381  interface_info.iid = params->iid;
1382  interface_info.wMethod = msg->ProcNum;
1383 
1384  if (IsEqualGUID(&orpcthis.cid, &COM_CurrentInfo()->causality_id))
1385  calltype = CALLTYPE_NESTED;
1386  else if (COM_CurrentInfo()->pending_call_count_server == 0)
1387  calltype = CALLTYPE_TOPLEVEL;
1388  else
1389  calltype = CALLTYPE_TOPLEVEL_CALLPENDING;
1390 
1391  handlecall = IMessageFilter_HandleInComingCall(COM_CurrentApt()->filter,
1392  calltype,
1394  0 /* FIXME */,
1395  &interface_info);
1396  TRACE("IMessageFilter_HandleInComingCall returned %d\n", handlecall);
1397  switch (handlecall)
1398  {
1399  case SERVERCALL_REJECTED:
1401  goto exit_reset_state;
1402  case SERVERCALL_RETRYLATER:
1403 #if 0 /* FIXME: handle retries on the client side before enabling this code */
1404  params->hr = RPC_E_RETRY;
1405  goto exit_reset_state;
1406 #else
1407  FIXME("retry call later not implemented\n");
1408  break;
1409 #endif
1410  case SERVERCALL_ISHANDLED:
1411  default:
1412  break;
1413  }
1414  }
1415 
1416  /* invoke the method */
1417 
1418  /* save the old causality ID - note: any calls executed while processing
1419  * messages received during the SendReceive will appear to originate from
1420  * this call - this should be checked with what Windows does */
1421  old_causality_id = COM_CurrentInfo()->causality_id;
1422  COM_CurrentInfo()->causality_id = orpcthis.cid;
1423  COM_CurrentInfo()->pending_call_count_server++;
1424  params->hr = IRpcStubBuffer_Invoke(params->stub, params->msg, params->chan);
1425  COM_CurrentInfo()->pending_call_count_server--;
1426  COM_CurrentInfo()->causality_id = old_causality_id;
1427 
1428  /* the invoke allocated a new buffer, so free the old one */
1429  if (message_state->bypass_rpcrt && original_buffer != msg->Buffer)
1430  HeapFree(GetProcessHeap(), 0, original_buffer);
1431 
1432 exit_reset_state:
1433  message_state = msg->Handle;
1434  msg->Handle = message_state->binding_handle;
1435  msg->Buffer = (char *)msg->Buffer - message_state->prefix_data_len;
1436  msg->BufferLength += message_state->prefix_data_len;
1437 
1438 exit:
1440  if (params->handle) SetEvent(params->handle);
1441 }
static void ChannelHooks_ServerNotify(SChannelHookCallInfo *info, DWORD lDataRep, WIRE_ORPC_EXTENT *first_wire_orpc_extent, ULONG extension_count)
Definition: rpc.c:274
RPC_BINDING_HANDLE binding_handle
Definition: rpc.c:126
SChannelHookCallInfo channel_hook_info
Definition: rpc.c:128
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:129
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
ULONG prefix_data_len
Definition: rpc.c:127
#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:1233
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#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:402
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 1804 of file rpc.c.

1805 {
1806  HRESULT hres;
1807  HANDLE hPipe;
1808  WCHAR pipefn[100];
1809  DWORD res, bufferlen;
1810  char marshalbuffer[200];
1811  IStream *pStm;
1813  ULARGE_INTEGER newpos;
1814  int tries = 0;
1816 
1817  static const int MAXTRIES = 30; /* 30 seconds */
1818 
1819  TRACE("rclsid=%s, iid=%s\n", debugstr_guid(rclsid), debugstr_guid(iid));
1820 
1821  get_localserver_pipe_name(pipefn, rclsid);
1822 
1823  while (tries++ < MAXTRIES) {
1824  TRACE("waiting for %s\n", debugstr_w(pipefn));
1825 
1827  hPipe = CreateFileW(pipefn, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
1828  if (hPipe == INVALID_HANDLE_VALUE) {
1829  DWORD index;
1830  DWORD start_ticks;
1831  HANDLE process = 0;
1832  if (tries == 1) {
1833  if ( (hres = create_local_service(rclsid)) &&
1834  (hres = create_server(rclsid, &process)) )
1835  return hres;
1836  } else {
1837  WARN("Connecting to %s, no response yet, retrying: le is %u\n", debugstr_w(pipefn), GetLastError());
1838  }
1839  /* wait for one second, even if messages arrive */
1840  start_ticks = GetTickCount();
1841  do {
1842  if (SUCCEEDED(CoWaitForMultipleHandles(0, 1000, (process != 0),
1843  &process, &index)) && process && !index)
1844  {
1845  WARN( "server for %s failed to start\n", debugstr_guid(rclsid) );
1846  CloseHandle( hPipe );
1847  CloseHandle( process );
1848  return E_NOINTERFACE;
1849  }
1850  } while (GetTickCount() - start_ticks < 1000);
1851  if (process) CloseHandle( process );
1852  continue;
1853  }
1854  bufferlen = 0;
1855  if (!ReadFile(hPipe,marshalbuffer,sizeof(marshalbuffer),&bufferlen,NULL)) {
1856  FIXME("Failed to read marshal id from classfactory of %s.\n",debugstr_guid(rclsid));
1857  CloseHandle(hPipe);
1858  Sleep(1000);
1859  continue;
1860  }
1861  TRACE("read marshal id from pipe\n");
1862  CloseHandle(hPipe);
1863  break;
1864  }
1865 
1866  if (tries >= MAXTRIES)
1867  return E_NOINTERFACE;
1868 
1869  hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
1870  if (hres != S_OK) return hres;
1871  hres = IStream_Write(pStm,marshalbuffer,bufferlen,&res);
1872  if (hres != S_OK) goto out;
1873  seekto.u.LowPart = 0;seekto.u.HighPart = 0;
1874  hres = IStream_Seek(pStm,seekto,STREAM_SEEK_SET,&newpos);
1875 
1876  TRACE("unmarshalling local server\n");
1877  hres = CoUnmarshalInterface(pStm, &IID_IServiceProvider, (void**)&local_server);
1878  if(SUCCEEDED(hres))
1879  hres = IServiceProvider_QueryService(local_server, rclsid, iid, ppv);
1880  IServiceProvider_Release(local_server);
1881 out:
1882  IStream_Release(pStm);
1883  return hres;
1884 }
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1981
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
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:455
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
static LONG bufferlen
Definition: sync.c:1601
static HRESULT create_server(REFCLSID rclsid, HANDLE *process)
Definition: rpc.c:1653
static LPSTR local_server
Definition: info.c:87
#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:434
HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags, DWORD dwTimeout, ULONG cHandles, LPHANDLE pHandles, LPDWORD lpdwindex)
Definition: compobj.c:4578
#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:1741
#define CreateFileW
Definition: compat.h:408
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:1796

Referenced by CoGetClassObject().

◆ RPC_RegisterChannelHook()

HRESULT RPC_RegisterChannelHook ( REFGUID  rguid,
IChannelHook hook 
)

Definition at line 424 of file rpc.c.

425 {
426  struct channel_hook_entry *entry;
427 
428  TRACE("(%s, %p)\n", debugstr_guid(rguid), hook);
429 
430  entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry));
431  if (!entry)
432  return E_OUTOFMEMORY;
433 
434  entry->id = *rguid;
435  entry->hook = hook;
436  IChannelHook_AddRef(hook);
437 
439  list_add_tail(&channel_hooks, &entry->entry);
441 
442  return S_OK;
443 }
static CRITICAL_SECTION csChannelHook
Definition: rpc.c:64
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static struct list channel_hooks
Definition: rpc.c:63
__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:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Definition: rpc.c:167
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 1530 of file rpc.c.

1531 {
1532  struct registered_if *rif;
1533  BOOL found = FALSE;
1534  HRESULT hr = S_OK;
1535 
1536  TRACE("(%s)\n", debugstr_guid(riid));
1537 
1540  {
1542  {
1543  rif->refs++;
1544  found = TRUE;
1545  break;
1546  }
1547  }
1548  if (!found)
1549  {
1550  TRACE("Creating new interface\n");
1551 
1552  rif = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*rif));
1553  if (rif)
1554  {
1556 
1557  rif->refs = 1;
1558  rif->If.Length = sizeof(RPC_SERVER_INTERFACE);
1559  /* RPC interface ID = COM interface ID */
1560  rif->If.InterfaceId.SyntaxGUID = *riid;
1561  rif->If.DispatchTable = &rpc_dispatch;
1562  /* all other fields are 0, including the version asCOM objects
1563  * always have a version of 0.0 */
1565  (RPC_IF_HANDLE)&rif->If,
1566  NULL, NULL,
1569  NULL);
1570  if (status == RPC_S_OK)
1572  else
1573  {
1574  ERR("RpcServerRegisterIfEx failed with error %d\n", status);
1575  HeapFree(GetProcessHeap(), 0, rif);
1577  }
1578  }
1579  else
1580  hr = E_OUTOFMEMORY;
1581  }
1583  return hr;
1584 }
#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:78
DWORD refs
Definition: rpc.c:79
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define RPC_IF_AUTOLISTEN
Definition: rpcdce.h:313
static CRITICAL_SECTION csRegIf
Definition: rpc.c:54
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:1125
__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:51
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
RPC_SERVER_INTERFACE If
Definition: rpc.c:80
struct _RPC_SERVER_INTERFACE RPC_SERVER_INTERFACE
uint32_t entry
Definition: isohybrid.c:63
static struct list registered_interfaces
Definition: rpc.c:53
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#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:402
#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 1609 of file rpc.c.

1610 {
1611  TRACE("%s\n", wine_dbgstr_longlong(oxid));
1612 
1613  oxid_info->dwTid = 0;
1614  oxid_info->dwPid = 0;
1615  oxid_info->dwAuthnHint = RPC_C_AUTHN_LEVEL_NONE;
1616  /* FIXME: this is a hack around not having an OXID resolver yet -
1617  * this function should contact the machine's OXID resolver and then it
1618  * should give us the IPID of the IRemUnknown interface */
1619  oxid_info->ipidRemUnknown.Data1 = 0xffffffff;
1620  oxid_info->ipidRemUnknown.Data2 = 0xffff;
1621  oxid_info->ipidRemUnknown.Data3 = 0xffff;
1622  memcpy(oxid_info->ipidRemUnknown.Data4, &oxid, sizeof(OXID));
1623  oxid_info->psa = NULL /* FIXME */;
1624 
1625  return S_OK;
1626 }
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 1996 of file rpc.c.

1997 {
1998  DWORD tid, err;
1999  struct local_server_params *lsp;
2000  WCHAR pipefn[100];
2001 
2002  lsp = HeapAlloc(GetProcessHeap(), 0, sizeof(*lsp));
2003  if (!lsp)
2004  return E_OUTOFMEMORY;
2005 
2006  lsp->clsid = *clsid;
2007  lsp->stream = stream;
2008  IStream_AddRef(stream);
2010  if (!lsp->stop_event)
2011  {
2012  HeapFree(GetProcessHeap(), 0, lsp);
2013  return HRESULT_FROM_WIN32(GetLastError());
2014  }
2015  lsp->multi_use = multi_use;
2016 
2017  get_localserver_pipe_name(pipefn, &lsp->clsid);
2020  4096, 4096, 500 /* 0.5 second timeout */, NULL);
2021  if (lsp->pipe == INVALID_HANDLE_VALUE)
2022  {
2023  err = GetLastError();
2024  FIXME("pipe creation failed for %s, le is %u\n", debugstr_w(pipefn), GetLastError());
2025  CloseHandle(lsp->stop_event);
2026  HeapFree(GetProcessHeap(), 0, lsp);
2027  return HRESULT_FROM_WIN32(err);
2028  }
2029 
2030  lsp->thread = CreateThread(NULL, 0, local_server_thread, lsp, 0, &tid);
2031  if (!lsp->thread)
2032  {
2033  CloseHandle(lsp->pipe);
2034  CloseHandle(lsp->stop_event);
2035  HeapFree(GetProcessHeap(), 0, lsp);
2036  return HRESULT_FROM_WIN32(GetLastError());
2037  }
2038 
2039  *registration = lsp;
2040  return S_OK;
2041 }
#define PIPE_UNLIMITED_INSTANCES
Definition: winbase.h:175
#define CloseHandle
Definition: compat.h:406
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define PIPE_WAIT
Definition: winbase.h:171
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
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:1892
#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:403
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:1890
REFCLSID clsid
Definition: msctf.c:82
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
static DWORD WINAPI local_server_thread(LPVOID param)
Definition: rpc.c:1898
#define err(...)
#define S_OK
Definition: intsafe.h:59
HANDLE thread
Definition: rpc.c:1893
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:402
static void get_localserver_pipe_name(WCHAR *pipefn, REFCLSID rclsid)
Definition: rpc.c:1796

Referenced by CoRegisterClassObject().

◆ RPC_StartRemoting()

void RPC_StartRemoting ( struct apartment apt)

Definition at line 1630 of file rpc.c.

1631 {
1633  {
1634  WCHAR endpoint[200];
1636 
1637  get_rpc_endpoint(endpoint, &apt->oxid);
1638 
1642  endpoint,
1643  NULL);
1644  if (status != RPC_S_OK)
1645  ERR("Couldn't register endpoint %s\n", debugstr_w(endpoint));
1646 
1647  /* FIXME: move remote unknown exporting into this function */
1648  }
1650 }
#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:84
#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:927
#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:73
Definition: ps.c:97

Referenced by StdMarshalImpl_MarshalInterface().

◆ RPC_StopLocalServer()

void RPC_StopLocalServer ( void registration)

Definition at line 2044 of file rpc.c.

2045 {
2046  struct local_server_params *lsp = registration;
2047 
2048  /* signal local_server_thread to stop */
2049  SetEvent(lsp->stop_event);
2050  /* wait for it to exit */
2052 
2053  IStream_Release(lsp->stream);
2054  CloseHandle(lsp->stop_event);
2055  CloseHandle(lsp->thread);
2056  HeapFree(GetProcessHeap(), 0, lsp);
2057 }
#define CloseHandle
Definition: compat.h:406
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:1892
#define GetProcessHeap()
Definition: compat.h:403
IStream * stream
Definition: rpc.c:1890
HANDLE thread
Definition: rpc.c:1893
#define INFINITE
Definition: serial.h:102
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by COM_RevokeRegisteredClassObject().

◆ RPC_UnregisterAllChannelHooks()

void RPC_UnregisterAllChannelHooks ( void  )

Definition at line 445 of file rpc.c.

446 {
447  struct channel_hook_entry *cursor;
448  struct channel_hook_entry *cursor2;
449 
456 }
static CRITICAL_SECTION csChannelHook
Definition: rpc.c:64
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static struct list channel_hooks
Definition: rpc.c:63
static CRITICAL_SECTION csRegIf
Definition: rpc.c:54
#define GetProcessHeap()
Definition: compat.h:403
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
Definition: rpc.c:167
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:402

Referenced by DllMain().

◆ RPC_UnregisterInterface()

void RPC_UnregisterInterface ( REFIID  riid,
BOOL  wait 
)

Definition at line 1587 of file rpc.c.

1588 {
1589  struct registered_if *rif;
1592  {
1594  {
1595  if (!--rif->refs)
1596  {
1597  RpcServerUnregisterIf((RPC_IF_HANDLE)&rif->If, NULL, wait);
1598  list_remove(&rif->entry);
1599  HeapFree(GetProcessHeap(), 0, rif);
1600  }
1601  break;
1602  }
1603  }
1605 }
REFIID riid
Definition: precomp.h:44
struct list entry
Definition: rpc.c:78
DWORD refs
Definition: rpc.c:79
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
RPC_STATUS WINAPI RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, UINT WaitForCallsToComplete)
Definition: rpc_server.c:1202
static CRITICAL_SECTION csRegIf
Definition: rpc.c:54
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:403
RPC_SERVER_INTERFACE If
Definition: rpc.c:80
uint32_t entry
Definition: isohybrid.c:63
static struct list registered_interfaces
Definition: rpc.c:53
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by stub_manager_delete_ifstub(), and stub_manager_disconnect().

◆ RunningObjectTableImpl_Initialize()

HRESULT WINAPI RunningObjectTableImpl_Initialize ( void  )

Definition at line 979 of file moniker.c.

980 {
981  TRACE("\n");
982 
983  /* create the unique instance of the RunningObjectTableImpl structure */
985 
987  return E_OUTOFMEMORY;
988 
989  /* initialize the virtual table function */
991 
992  /* the initial reference is set to "1" so that it isn't destroyed after its
993  * first use until the process is destroyed, as the running object table is
994  * a process-wide cache of a global table */
996 
999  DEBUG_SET_CRITSEC_NAME(&runningObjectTableInstance->lock, "RunningObjectTableImpl.lock");
1000 
1001  return S_OK;
1002 }
static RunningObjectTableImpl * runningObjectTableInstance
Definition: moniker.c:78
struct list rot
Definition: moniker.c:74
#define DEBUG_SET_CRITSEC_NAME(cs, name)
static const IRunningObjectTableVtbl VT_RunningObjectTableImpl
Definition: moniker.c:962
CRITICAL_SECTION lock
Definition: moniker.c:75
#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:403
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:71

Referenced by CoInitializeEx().

◆ RunningObjectTableImpl_UnInitialize()

HRESULT WINAPI RunningObjectTableImpl_UnInitialize ( void  )

Definition at line 1007 of file moniker.c.

1008 {
1009  TRACE("\n");
1010 
1012  return E_POINTER;
1013 
1015 
1017 
1018  return S_OK;
1019 }
static RunningObjectTableImpl * runningObjectTableInstance
Definition: moniker.c:78
static HRESULT RunningObjectTableImpl_Destroy(void)
Definition: moniker.c:363
static ULONG WINAPI RunningObjectTableImpl_Release(IRunningObjectTable *iface)
Definition: moniker.c:400
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:71
#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:121
#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:1587
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:4137
__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:403
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:1162
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:402

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 318 of file compobj_private.h.