ReactOS  0.4.14-dev-342-gdc047f9
moniker.c File Reference
#include <stdarg.h>
#include <string.h>
#include "winerror.h"
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winsvc.h"
#include "wtypes.h"
#include "ole2.h"
#include "wine/list.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "compobj_private.h"
#include "moniker.h"
#include "irot.h"
Include dependency graph for moniker.c:

Go to the source code of this file.

Classes

struct  rot_entry
 
struct  RunningObjectTableImpl
 
struct  EnumMonikerImpl
 
struct  MonikerMarshal
 

Macros

#define COBJMACROS
 
#define MAX_COMPARISON_DATA   2048
 

Typedefs

typedef struct RunningObjectTableImpl RunningObjectTableImpl
 
typedef struct EnumMonikerImpl EnumMonikerImpl
 
typedef struct MonikerMarshal MonikerMarshal
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static LONG WINAPI rpc_filter (EXCEPTION_POINTERS *eptr)
 
static RunningObjectTableImplimpl_from_IRunningObjectTable (IRunningObjectTable *iface)
 
static EnumMonikerImplimpl_from_IEnumMoniker (IEnumMoniker *iface)
 
static HRESULT EnumMonikerImpl_CreateEnumROTMoniker (InterfaceList *moniker_list, ULONG pos, IEnumMoniker **ppenumMoniker)
 
static IrotHandle get_irot_handle (void)
 
static BOOL start_rpcss (void)
 
static HRESULT create_stream_on_mip_ro (const InterfaceData *mip, IStream **stream)
 
static void rot_entry_delete (struct rot_entry *rot_entry)
 
static HRESULT get_moniker_comparison_data (IMoniker *pMoniker, MonikerComparisonData **moniker_data)
 
static HRESULT reduce_moniker (IMoniker *pmk, IBindCtx *pbc, IMoniker **pmkReduced)
 
static HRESULT WINAPI RunningObjectTableImpl_QueryInterface (IRunningObjectTable *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI RunningObjectTableImpl_AddRef (IRunningObjectTable *iface)
 
static HRESULT RunningObjectTableImpl_Destroy (void)
 
static ULONG WINAPI RunningObjectTableImpl_Release (IRunningObjectTable *iface)
 
static HRESULT WINAPI RunningObjectTableImpl_Register (IRunningObjectTable *iface, DWORD grfFlags, IUnknown *punkObject, IMoniker *pmkObjectName, DWORD *pdwRegister)
 
static HRESULT WINAPI RunningObjectTableImpl_Revoke (IRunningObjectTable *iface, DWORD dwRegister)
 
static HRESULT WINAPI RunningObjectTableImpl_IsRunning (IRunningObjectTable *iface, IMoniker *pmkObjectName)
 
static HRESULT WINAPI RunningObjectTableImpl_GetObject (IRunningObjectTable *iface, IMoniker *pmkObjectName, IUnknown **ppunkObject)
 
static HRESULT WINAPI RunningObjectTableImpl_NoteChangeTime (IRunningObjectTable *iface, DWORD dwRegister, FILETIME *pfiletime)
 
static HRESULT WINAPI RunningObjectTableImpl_GetTimeOfLastChange (IRunningObjectTable *iface, IMoniker *pmkObjectName, FILETIME *pfiletime)
 
static HRESULT WINAPI RunningObjectTableImpl_EnumRunning (IRunningObjectTable *iface, IEnumMoniker **ppenumMoniker)
 
HRESULT WINAPI RunningObjectTableImpl_Initialize (void)
 
HRESULT WINAPI RunningObjectTableImpl_UnInitialize (void)
 
HRESULT WINAPI GetRunningObjectTable (DWORD reserved, LPRUNNINGOBJECTTABLE *pprot)
 
static HRESULT get_moniker_for_progid_display_name (LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, LPMONIKER *ppmk)
 
HRESULT WINAPI MkParseDisplayName (LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, LPMONIKER *ppmk)
 
HRESULT WINAPI GetClassFile (LPCOLESTR filePathName, CLSID *pclsid)
 
static HRESULT WINAPI EnumMonikerImpl_QueryInterface (IEnumMoniker *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI EnumMonikerImpl_AddRef (IEnumMoniker *iface)
 
static ULONG WINAPI EnumMonikerImpl_Release (IEnumMoniker *iface)
 
static HRESULT WINAPI EnumMonikerImpl_Next (IEnumMoniker *iface, ULONG celt, IMoniker **rgelt, ULONG *pceltFetched)
 
static HRESULT WINAPI EnumMonikerImpl_Skip (IEnumMoniker *iface, ULONG celt)
 
static HRESULT WINAPI EnumMonikerImpl_Reset (IEnumMoniker *iface)
 
static HRESULT WINAPI EnumMonikerImpl_Clone (IEnumMoniker *iface, IEnumMoniker **ppenum)
 
static MonikerMarshalimpl_from_IUnknown (IUnknown *iface)
 
static MonikerMarshalimpl_from_IMarshal (IMarshal *iface)
 
static HRESULT WINAPI MonikerMarshalInner_QueryInterface (IUnknown *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI MonikerMarshalInner_AddRef (IUnknown *iface)
 
static ULONG WINAPI MonikerMarshalInner_Release (IUnknown *iface)
 
static HRESULT WINAPI MonikerMarshal_QueryInterface (IMarshal *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI MonikerMarshal_AddRef (IMarshal *iface)
 
static ULONG WINAPI MonikerMarshal_Release (IMarshal *iface)
 
static HRESULT WINAPI MonikerMarshal_GetUnmarshalClass (LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid)
 
static HRESULT WINAPI MonikerMarshal_GetMarshalSizeMax (LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *pSize)
 
static HRESULT WINAPI MonikerMarshal_MarshalInterface (LPMARSHAL iface, IStream *pStm, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags)
 
static HRESULT WINAPI MonikerMarshal_UnmarshalInterface (LPMARSHAL iface, IStream *pStm, REFIID riid, void **ppv)
 
static HRESULT WINAPI MonikerMarshal_ReleaseMarshalData (LPMARSHAL iface, IStream *pStm)
 
static HRESULT WINAPI MonikerMarshal_DisconnectObject (LPMARSHAL iface, DWORD dwReserved)
 
HRESULT MonikerMarshal_Create (IMoniker *inner, IUnknown **outer)
 
void *__RPC_USER MIDL_user_allocate (SIZE_T size)
 
void __RPC_USER MIDL_user_free (void *p)
 

Variables

static RunningObjectTableImplrunningObjectTableInstance = NULL
 
static IrotHandle irot_handle
 
static const IRunningObjectTableVtbl VT_RunningObjectTableImpl
 
static const IEnumMonikerVtbl VT_EnumMonikerImpl
 
static const IUnknownVtbl VT_MonikerMarshalInner
 
static const IMarshalVtbl VT_MonikerMarshal
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 27 of file moniker.c.

◆ MAX_COMPARISON_DATA

#define MAX_COMPARISON_DATA   2048

Definition at line 50 of file moniker.c.

Typedef Documentation

◆ EnumMonikerImpl

◆ MonikerMarshal

◆ RunningObjectTableImpl

Function Documentation

◆ create_stream_on_mip_ro()

static HRESULT create_stream_on_mip_ro ( const InterfaceData mip,
IStream **  stream 
)
static

Definition at line 179 of file moniker.c.

180 {
181  HGLOBAL hglobal = GlobalAlloc(0, mip->ulCntData);
182  void *pv = GlobalLock(hglobal);
183  memcpy(pv, mip->abData, mip->ulCntData);
184  GlobalUnlock(hglobal);
185  return CreateStreamOnHGlobal(hglobal, TRUE, stream);
186 }
#define TRUE
Definition: types.h:120
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
Definition: parse.h:22
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190

Referenced by EnumMonikerImpl_Next(), rot_entry_delete(), and RunningObjectTableImpl_GetObject().

◆ EnumMonikerImpl_AddRef()

static ULONG WINAPI EnumMonikerImpl_AddRef ( IEnumMoniker iface)
static

Definition at line 1333 of file moniker.c.

1334 {
1336 
1337  TRACE("(%p)\n",This);
1338 
1339  return InterlockedIncrement(&This->ref);
1340 }
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
static EnumMonikerImpl * impl_from_IEnumMoniker(IEnumMoniker *iface)
Definition: moniker.c:96

◆ EnumMonikerImpl_Clone()

static HRESULT WINAPI EnumMonikerImpl_Clone ( IEnumMoniker iface,
IEnumMoniker **  ppenum 
)
static

Definition at line 1438 of file moniker.c.

1439 {
1441  InterfaceList *moniker_list;
1442  ULONG i;
1443 
1444  TRACE("(%p)\n",This);
1445 
1446  *ppenum = NULL;
1447 
1448  moniker_list = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(InterfaceList, interfaces[This->moniker_list->size]));
1449  if (!moniker_list)
1450  return E_OUTOFMEMORY;
1451 
1452  moniker_list->size = This->moniker_list->size;
1453  for (i = 0; i < This->moniker_list->size; i++)
1454  {
1455  SIZE_T size = FIELD_OFFSET(InterfaceData, abData[This->moniker_list->interfaces[i]->ulCntData]);
1456  moniker_list->interfaces[i] = HeapAlloc(GetProcessHeap(), 0, size);
1457  if (!moniker_list->interfaces[i])
1458  {
1459  ULONG end = i;
1460  for (i = 0; i < end; i++)
1461  HeapFree(GetProcessHeap(), 0, moniker_list->interfaces[i]);
1462  HeapFree(GetProcessHeap(), 0, moniker_list);
1463  return E_OUTOFMEMORY;
1464  }
1465  memcpy(moniker_list->interfaces[i], This->moniker_list->interfaces[i], size);
1466  }
1467 
1468  /* copy the enum structure */
1469  return EnumMonikerImpl_CreateEnumROTMoniker(moniker_list, This->pos, ppenum);
1470 }
_In_ PUSBD_INTERFACE_LIST_ENTRY InterfaceList
Definition: usbdlib.h:168
GLuint GLuint end
Definition: gl.h:1545
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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
static HRESULT EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *moniker_list, ULONG pos, IEnumMoniker **ppenumMoniker)
Definition: moniker.c:1489
unsigned int ULONG
Definition: retypes.h:1
IN PVOID IN PVOID InterfaceData
Definition: pci.h:359
#define HeapFree(x, y, z)
Definition: compat.h:402
static EnumMonikerImpl * impl_from_IEnumMoniker(IEnumMoniker *iface)
Definition: moniker.c:96

◆ EnumMonikerImpl_CreateEnumROTMoniker()

static HRESULT EnumMonikerImpl_CreateEnumROTMoniker ( InterfaceList moniker_list,
ULONG  pos,
IEnumMoniker **  ppenumMoniker 
)
static

Definition at line 1489 of file moniker.c.

1492 {
1494 
1495  if (!ppenumMoniker)
1496  return E_INVALIDARG;
1497 
1498  This = HeapAlloc(GetProcessHeap(), 0, sizeof(EnumMonikerImpl));
1499  if (!This) return E_OUTOFMEMORY;
1500 
1501  TRACE("(%p)\n", This);
1502 
1503  /* initialize the virtual table function */
1504  This->IEnumMoniker_iface.lpVtbl = &VT_EnumMonikerImpl;
1505 
1506  /* the initial reference is set to "1" */
1507  This->ref = 1; /* set the ref count to one */
1508  This->pos = current_pos; /* Set the list start posn */
1509  This->moniker_list = moniker_list;
1510 
1511  *ppenumMoniker = &This->IEnumMoniker_iface;
1512 
1513  return S_OK;
1514 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
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)
static const IEnumMonikerVtbl VT_EnumMonikerImpl
Definition: moniker.c:1473
#define S_OK
Definition: intsafe.h:59

Referenced by EnumMonikerImpl_Clone(), and RunningObjectTableImpl_EnumRunning().

◆ EnumMonikerImpl_Next()

static HRESULT WINAPI EnumMonikerImpl_Next ( IEnumMoniker iface,
ULONG  celt,
IMoniker **  rgelt,
ULONG pceltFetched 
)
static

Definition at line 1372 of file moniker.c.

1373 {
1374  ULONG i;
1376  HRESULT hr = S_OK;
1377 
1378  TRACE("(%p) TabCurrentPos %d Tablastindx %d\n", This, This->pos, This->moniker_list->size);
1379 
1380  /* retrieve the requested number of moniker from the current position */
1381  for(i = 0; (This->pos < This->moniker_list->size) && (i < celt); i++)
1382  {
1383  IStream *stream;
1384  hr = create_stream_on_mip_ro(This->moniker_list->interfaces[This->pos++], &stream);
1385  if (hr != S_OK) break;
1386  hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void **)&rgelt[i]);
1387  IStream_Release(stream);
1388  if (hr != S_OK) break;
1389  }
1390 
1391  if (pceltFetched != NULL)
1392  *pceltFetched= i;
1393 
1394  if (hr != S_OK)
1395  return hr;
1396 
1397  if (i == celt)
1398  return S_OK;
1399  else
1400  return S_FALSE;
1401 
1402 }
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1981
HRESULT hr
Definition: shlfolder.c:183
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 S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1
static HRESULT create_stream_on_mip_ro(const InterfaceData *mip, IStream **stream)
Definition: moniker.c:179
static EnumMonikerImpl * impl_from_IEnumMoniker(IEnumMoniker *iface)
Definition: moniker.c:96

◆ EnumMonikerImpl_QueryInterface()

static HRESULT WINAPI EnumMonikerImpl_QueryInterface ( IEnumMoniker iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 1309 of file moniker.c.

1310 {
1312 
1313  TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppvObject);
1314 
1315  /* validate arguments */
1316  if (ppvObject == NULL)
1317  return E_INVALIDARG;
1318 
1319  *ppvObject = NULL;
1320 
1322  *ppvObject = &This->IEnumMoniker_iface;
1323  else
1324  return E_NOINTERFACE;
1325 
1326  IEnumMoniker_AddRef(iface);
1327  return S_OK;
1328 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const GUID IID_IEnumMoniker
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static EnumMonikerImpl * impl_from_IEnumMoniker(IEnumMoniker *iface)
Definition: moniker.c:96

◆ EnumMonikerImpl_Release()

static ULONG WINAPI EnumMonikerImpl_Release ( IEnumMoniker iface)
static

Definition at line 1345 of file moniker.c.

1346 {
1348  ULONG ref;
1349 
1350  TRACE("(%p)\n",This);
1351 
1352  ref = InterlockedDecrement(&This->ref);
1353 
1354  /* uninitialize ROT structure if there are no more references to it */
1355  if (ref == 0)
1356  {
1357  ULONG i;
1358 
1359  TRACE("(%p) Deleting\n",This);
1360 
1361  for (i = 0; i < This->moniker_list->size; i++)
1362  HeapFree(GetProcessHeap(), 0, This->moniker_list->interfaces[i]);
1363  HeapFree(GetProcessHeap(), 0, This->moniker_list);
1364  HeapFree(GetProcessHeap(), 0, This);
1365  }
1366 
1367  return ref;
1368 }
Definition: send.c:47
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
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402
static EnumMonikerImpl * impl_from_IEnumMoniker(IEnumMoniker *iface)
Definition: moniker.c:96

◆ EnumMonikerImpl_Reset()

static HRESULT WINAPI EnumMonikerImpl_Reset ( IEnumMoniker iface)
static

Definition at line 1424 of file moniker.c.

1425 {
1427 
1428  This->pos = 0; /* set back to start of list */
1429 
1430  TRACE("(%p)\n",This);
1431 
1432  return S_OK;
1433 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
static EnumMonikerImpl * impl_from_IEnumMoniker(IEnumMoniker *iface)
Definition: moniker.c:96

◆ EnumMonikerImpl_Skip()

static HRESULT WINAPI EnumMonikerImpl_Skip ( IEnumMoniker iface,
ULONG  celt 
)
static

Definition at line 1407 of file moniker.c.

1408 {
1410 
1411  TRACE("(%p)\n",This);
1412 
1413  if (This->pos + celt >= This->moniker_list->size)
1414  return S_FALSE;
1415 
1416  This->pos += celt;
1417 
1418  return S_OK;
1419 }
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
static EnumMonikerImpl * impl_from_IEnumMoniker(IEnumMoniker *iface)
Definition: moniker.c:96

◆ get_irot_handle()

static IrotHandle get_irot_handle ( void  )
static

Definition at line 105 of file moniker.c.

106 {
107  if (!irot_handle)
108  {
110  RPC_WSTR binding;
111  IrotHandle new_handle;
112  unsigned short ncacn_np[] = IROT_PROTSEQ;
113  unsigned short endpoint[] = IROT_ENDPOINT;
114  status = RpcStringBindingComposeW(NULL, ncacn_np, NULL, endpoint, NULL, &binding);
115  if (status == RPC_S_OK)
116  {
117  status = RpcBindingFromStringBindingW(binding, &new_handle);
118  RpcStringFreeW(&binding);
119  }
120  if (status != RPC_S_OK)
121  return NULL;
123  /* another thread beat us to it */
124  RpcBindingFree(&new_handle);
125  }
126  return irot_handle;
127 }
RPC_STATUS WINAPI RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:877
static IrotHandle irot_handle
Definition: moniker.c:79
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:784
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:177
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
RPC_STATUS WINAPI RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr, RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR *StringBinding)
Definition: rpc_binding.c:511
long RPC_STATUS
Definition: rpc.h:52
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
smooth NULL
Definition: ftsmooth.c:416
Definition: nis.h:10
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by rot_entry_delete(), RunningObjectTableImpl_EnumRunning(), RunningObjectTableImpl_GetObject(), RunningObjectTableImpl_GetTimeOfLastChange(), RunningObjectTableImpl_IsRunning(), RunningObjectTableImpl_NoteChangeTime(), and RunningObjectTableImpl_Register().

◆ get_moniker_comparison_data()

static HRESULT get_moniker_comparison_data ( IMoniker pMoniker,
MonikerComparisonData **  moniker_data 
)
static

Definition at line 234 of file moniker.c.

235 {
236  HRESULT hr;
237  IROTData *pROTData = NULL;
238  hr = IMoniker_QueryInterface(pMoniker, &IID_IROTData, (void *)&pROTData);
239  if (SUCCEEDED(hr))
240  {
242  *moniker_data = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(MonikerComparisonData, abData[size]));
243  if (!*moniker_data)
244  {
245  IROTData_Release(pROTData);
246  return E_OUTOFMEMORY;
247  }
248  hr = IROTData_GetComparisonData(pROTData, (*moniker_data)->abData, size, &size);
249  IROTData_Release(pROTData);
250  if (hr != S_OK)
251  {
252  ERR("Failed to copy comparison data into buffer, hr = 0x%08x\n", hr);
253  HeapFree(GetProcessHeap(), 0, *moniker_data);
254  return hr;
255  }
256  (*moniker_data)->ulCntData = size;
257  }
258  else
259  {
260  IBindCtx *pbc;
261  LPOLESTR pszDisplayName;
262  CLSID clsid;
263  int len;
264 
265  TRACE("generating comparison data from display name\n");
266 
267  hr = CreateBindCtx(0, &pbc);
268  if (FAILED(hr))
269  return hr;
270  hr = IMoniker_GetDisplayName(pMoniker, pbc, NULL, &pszDisplayName);
271  IBindCtx_Release(pbc);
272  if (FAILED(hr))
273  return hr;
274  hr = IMoniker_GetClassID(pMoniker, &clsid);
275  if (FAILED(hr))
276  {
277  CoTaskMemFree(pszDisplayName);
278  return hr;
279  }
280 
281  len = lstrlenW(pszDisplayName);
282  *moniker_data = HeapAlloc(GetProcessHeap(), 0,
283  FIELD_OFFSET(MonikerComparisonData, abData[sizeof(CLSID) + (len+1)*sizeof(WCHAR)]));
284  if (!*moniker_data)
285  {
286  CoTaskMemFree(pszDisplayName);
287  return E_OUTOFMEMORY;
288  }
289  (*moniker_data)->ulCntData = sizeof(CLSID) + (len+1)*sizeof(WCHAR);
290 
291  memcpy(&(*moniker_data)->abData[0], &clsid, sizeof(clsid));
292  memcpy(&(*moniker_data)->abData[sizeof(clsid)], pszDisplayName, (len+1)*sizeof(WCHAR));
293  CoTaskMemFree(pszDisplayName);
294  }
295  return S_OK;
296 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
#define MAX_COMPARISON_DATA
Definition: moniker.c:50
static LPOLESTR
Definition: stg_prop.c:27
#define lstrlenW
Definition: compat.h:415
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
IROT_ENDPOINT struct tagMonikerComparisonData MonikerComparisonData
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:82
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by RunningObjectTableImpl_GetObject(), RunningObjectTableImpl_GetTimeOfLastChange(), RunningObjectTableImpl_IsRunning(), and RunningObjectTableImpl_Register().

◆ get_moniker_for_progid_display_name()

static HRESULT get_moniker_for_progid_display_name ( LPBC  pbc,
LPCOLESTR  szDisplayName,
LPDWORD  pchEaten,
LPMONIKER ppmk 
)
static

Definition at line 1054 of file moniker.c.

1058 {
1059  CLSID clsid;
1060  HRESULT hr;
1061  LPWSTR progid;
1062  LPCWSTR start = szDisplayName;
1063  LPCWSTR end;
1064  int len;
1065  IMoniker *class_moniker;
1066 
1067  if (*start == '@')
1068  start++;
1069 
1070  /* find end delimiter */
1071  for (end = start; *end; end++)
1072  if (*end == ':')
1073  break;
1074 
1075  len = end - start;
1076 
1077  /* must start with '@' or have a ':' somewhere and mustn't be one character
1078  * long (since that looks like an absolute path) */
1079  if (((start == szDisplayName) && (*end == '\0')) || (len <= 1))
1080  return MK_E_SYNTAX;
1081 
1082  progid = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
1083  if (progid)
1084  {
1085  memcpy(progid, start, len * sizeof(WCHAR));
1086  progid[len] = '\0';
1087  }
1090  if (FAILED(hr))
1091  return MK_E_SYNTAX;
1092 
1093  hr = CreateClassMoniker(&clsid, &class_moniker);
1094  if (SUCCEEDED(hr))
1095  {
1096  IParseDisplayName *pdn;
1097  hr = IMoniker_BindToObject(class_moniker, pbc, NULL,
1098  &IID_IParseDisplayName, (void **)&pdn);
1099  /* fallback to using IClassFactory to get IParseDisplayName -
1100  * adsldp.dll depends on this */
1101  if (FAILED(hr))
1102  {
1103  IClassFactory *pcf;
1104  hr = IMoniker_BindToObject(class_moniker, pbc, NULL,
1105  &IID_IClassFactory, (void **)&pcf);
1106  if (SUCCEEDED(hr))
1107  {
1108  hr = IClassFactory_CreateInstance(pcf, NULL,
1110  (void **)&pdn);
1111  IClassFactory_Release(pcf);
1112  }
1113  }
1114  IMoniker_Release(class_moniker);
1115  if (SUCCEEDED(hr))
1116  {
1117  hr = IParseDisplayName_ParseDisplayName(pdn, pbc,
1118  (LPOLESTR)szDisplayName,
1119  pchEaten, ppmk);
1120  IParseDisplayName_Release(pdn);
1121  }
1122  }
1123  return hr;
1124 }
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
GLuint GLuint end
Definition: gl.h:1545
static LPOLESTR
Definition: stg_prop.c:27
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2602
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IParseDisplayName
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:82
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
GLuint start
Definition: gl.h:1545
#define progid(str)
Definition: exdisp.idl:31
#define MK_E_SYNTAX
Definition: winerror.h:2785
WCHAR * LPWSTR
Definition: xmlstorage.h:184
HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, IMoniker **ppmk)
Definition: classmoniker.c:701
const GUID IID_IClassFactory
#define HeapFree(x, y, z)
Definition: compat.h:402
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by MkParseDisplayName().

◆ GetClassFile()

HRESULT WINAPI GetClassFile ( LPCOLESTR  filePathName,
CLSID pclsid 
)

Definition at line 1213 of file moniker.c.

1214 {
1215  IStorage *pstg=0;
1216  HRESULT res;
1217  int nbElm, length, i;
1218  LONG sizeProgId, ret;
1219  LPOLESTR *pathDec=0,absFile=0,progId=0;
1220  LPWSTR extension;
1221  static const WCHAR bkslashW[] = {'\\',0};
1222  static const WCHAR dotW[] = {'.',0};
1223 
1224  TRACE("%s, %p\n", debugstr_w(filePathName), pclsid);
1225 
1226  /* if the file contain a storage object the return the CLSID written by IStorage_SetClass method*/
1227  if((StgIsStorageFile(filePathName))==S_OK){
1228 
1229  res=StgOpenStorage(filePathName,NULL,STGM_READ | STGM_SHARE_DENY_WRITE,NULL,0,&pstg);
1230 
1231  if (SUCCEEDED(res)) {
1232  res=ReadClassStg(pstg,pclsid);
1233  IStorage_Release(pstg);
1234  }
1235 
1236  return res;
1237  }
1238  /* If the file is not a storage object then attempt to match various bits in the file against a
1239  pattern in the registry. This case is not frequently used, so I present only the pseudocode for
1240  this case.
1241 
1242  for(i=0;i<nFileTypes;i++)
1243 
1244  for(i=0;j<nPatternsForType;j++){
1245 
1246  PATTERN pat;
1247  HANDLE hFile;
1248 
1249  pat=ReadPatternFromRegistry(i,j);
1250  hFile=CreateFileW(filePathName,,,,,,hFile);
1251  SetFilePosition(hFile,pat.offset);
1252  ReadFile(hFile,buf,pat.size,&r,NULL);
1253  if (memcmp(buf&pat.mask,pat.pattern.pat.size)==0){
1254 
1255  *pclsid=ReadCLSIDFromRegistry(i);
1256  return S_OK;
1257  }
1258  }
1259  */
1260 
1261  /* if the above strategies fail then search for the extension key in the registry */
1262 
1263  /* get the last element (absolute file) in the path name */
1264  nbElm=FileMonikerImpl_DecomposePath(filePathName,&pathDec);
1265  absFile=pathDec[nbElm-1];
1266 
1267  /* failed if the path represents a directory and not an absolute file name*/
1268  if (!wcscmp(absFile, bkslashW)) {
1269  CoTaskMemFree(pathDec);
1270  return MK_E_INVALIDEXTENSION;
1271  }
1272 
1273  /* get the extension of the file */
1274  extension = NULL;
1275  length=lstrlenW(absFile);
1276  for(i = length-1; (i >= 0) && *(extension = &absFile[i]) != '.'; i--)
1277  /* nothing */;
1278 
1279  if (!extension || !wcscmp(extension, dotW)) {
1280  CoTaskMemFree(pathDec);
1281  return MK_E_INVALIDEXTENSION;
1282  }
1283 
1284  ret = RegQueryValueW(HKEY_CLASSES_ROOT, extension, NULL, &sizeProgId);
1285  if (!ret) {
1286  /* get the progId associated to the extension */
1287  progId = CoTaskMemAlloc(sizeProgId);
1288  ret = RegQueryValueW(HKEY_CLASSES_ROOT, extension, progId, &sizeProgId);
1289  if (!ret)
1290  /* return the clsid associated to the progId */
1291  res = CLSIDFromProgID(progId, pclsid);
1292  else
1294  CoTaskMemFree(progId);
1295  }
1296  else
1298 
1299  for(i=0; pathDec[i]!=NULL;i++)
1300  CoTaskMemFree(pathDec[i]);
1301  CoTaskMemFree(pathDec);
1302 
1303  return res != S_OK ? MK_E_INVALIDEXTENSION : res;
1304 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
static LPOLESTR
Definition: stg_prop.c:27
#define lstrlenW
Definition: compat.h:415
HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid)
Definition: compobj.c:2602
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
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define STGM_READ
Definition: objbase.h:916
#define MK_E_INVALIDEXTENSION
Definition: winerror.h:2787
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
HRESULT WINAPI StgOpenStorage(const OLECHAR *pwcsName, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstgOpen)
Definition: storage32.c:8755
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4254
int FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR **stringTable)
Definition: filemoniker.c:1023
int ret
HRESULT WINAPI StgIsStorageFile(LPCOLESTR fn)
Definition: storage32.c:9475
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI ReadClassStg(IStorage *pstg, CLSID *pclsid)
Definition: storage32.c:9103
GLuint res
Definition: glext.h:9613
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define STGM_SHARE_DENY_WRITE
Definition: objbase.h:921
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
static const WCHAR dotW[]
Definition: directory.c:80
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CoGetInstanceFromFile(), FileMonikerImpl_BindToObject(), and UIINSERTOBJECTDLG_OnOpen().

◆ GetRunningObjectTable()

HRESULT WINAPI GetRunningObjectTable ( DWORD  reserved,
LPRUNNINGOBJECTTABLE pprot 
)

Definition at line 1035 of file moniker.c.

1036 {
1037  IID riid=IID_IRunningObjectTable;
1038  HRESULT res;
1039 
1040  TRACE("()\n");
1041 
1042  if (reserved!=0)
1043  return E_UNEXPECTED;
1044 
1046  return CO_E_NOTINITIALIZED;
1047 
1048  res = IRunningObjectTable_QueryInterface(&runningObjectTableInstance->IRunningObjectTable_iface,
1049  &riid,(void**)pprot);
1050 
1051  return res;
1052 }
static RunningObjectTableImpl * runningObjectTableInstance
Definition: moniker.c:78
REFIID riid
Definition: precomp.h:44
#define CO_E_NOTINITIALIZED
r reserved
Definition: btrfs.c:2865
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define E_UNEXPECTED
Definition: winerror.h:2456
GLuint res
Definition: glext.h:9613
IRunningObjectTable IRunningObjectTable_iface
Definition: moniker.c:71

Referenced by BindCtxImpl_GetRunningObjectTable(), GetActiveObject(), IHlinkBC_GetObject(), IHlinkBC_Register(), IHlinkBC_Revoke(), RegisterActiveObject(), RevokeActiveObject(), test_ROT(), and test_ROT_multiple_entries().

◆ impl_from_IEnumMoniker()

static EnumMonikerImpl* impl_from_IEnumMoniker ( IEnumMoniker iface)
inlinestatic

Definition at line 96 of file moniker.c.

97 {
98  return CONTAINING_RECORD(iface, EnumMonikerImpl, IEnumMoniker_iface);
99 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by EnumMonikerImpl_AddRef(), EnumMonikerImpl_Clone(), EnumMonikerImpl_Next(), EnumMonikerImpl_QueryInterface(), EnumMonikerImpl_Release(), EnumMonikerImpl_Reset(), and EnumMonikerImpl_Skip().

◆ impl_from_IMarshal()

static MonikerMarshal* impl_from_IMarshal ( IMarshal iface)
inlinestatic

Definition at line 1534 of file moniker.c.

1535 {
1536  return CONTAINING_RECORD(iface, MonikerMarshal, IMarshal_iface);
1537 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by MonikerMarshal_AddRef(), MonikerMarshal_GetMarshalSizeMax(), MonikerMarshal_GetUnmarshalClass(), MonikerMarshal_MarshalInterface(), MonikerMarshal_QueryInterface(), MonikerMarshal_Release(), and MonikerMarshal_UnmarshalInterface().

◆ impl_from_IRunningObjectTable()

static RunningObjectTableImpl* impl_from_IRunningObjectTable ( IRunningObjectTable iface)
inlinestatic

Definition at line 91 of file moniker.c.

92 {
93  return CONTAINING_RECORD(iface, RunningObjectTableImpl, IRunningObjectTable_iface);
94 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by RunningObjectTableImpl_AddRef(), RunningObjectTableImpl_EnumRunning(), RunningObjectTableImpl_GetObject(), RunningObjectTableImpl_GetTimeOfLastChange(), RunningObjectTableImpl_IsRunning(), RunningObjectTableImpl_NoteChangeTime(), RunningObjectTableImpl_QueryInterface(), RunningObjectTableImpl_Register(), RunningObjectTableImpl_Release(), and RunningObjectTableImpl_Revoke().

◆ impl_from_IUnknown()

static MonikerMarshal* impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 1529 of file moniker.c.

1530 {
1531  return CONTAINING_RECORD(iface, MonikerMarshal, IUnknown_iface);
1532 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by MonikerMarshalInner_AddRef(), MonikerMarshalInner_QueryInterface(), and MonikerMarshalInner_Release().

◆ MIDL_user_allocate()

void* __RPC_USER MIDL_user_allocate ( SIZE_T  size)

Definition at line 1691 of file moniker.c.

1692 {
1693  return HeapAlloc(GetProcessHeap(), 0, size);
1694 }
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)

◆ MIDL_user_free()

void __RPC_USER MIDL_user_free ( void p)

Definition at line 1696 of file moniker.c.

1697 {
1698  HeapFree(GetProcessHeap(), 0, p);
1699 }
#define GetProcessHeap()
Definition: compat.h:403
GLfloat GLfloat p
Definition: glext.h:8902
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by rot_entry_delete().

◆ MkParseDisplayName()

HRESULT WINAPI MkParseDisplayName ( LPBC  pbc,
LPCOLESTR  szDisplayName,
LPDWORD  pchEaten,
LPMONIKER ppmk 
)

Definition at line 1129 of file moniker.c.

1131 {
1133  static const WCHAR wszClsidColon[] = {'c','l','s','i','d',':'};
1134  IMoniker *moniker;
1135  DWORD chEaten;
1136 
1137  TRACE("(%p, %s, %p, %p)\n", pbc, debugstr_w(szDisplayName), pchEaten, ppmk);
1138 
1139  if (!pbc || !IsValidInterface((LPUNKNOWN) pbc))
1140  return E_INVALIDARG;
1141 
1142  if (!szDisplayName || !*szDisplayName)
1143  return E_INVALIDARG;
1144 
1145  if (!pchEaten || !ppmk)
1146  return E_INVALIDARG;
1147 
1148  *pchEaten = 0;
1149  *ppmk = NULL;
1150 
1151  if (!_wcsnicmp(szDisplayName, wszClsidColon, ARRAY_SIZE(wszClsidColon)))
1152  {
1153  hr = ClassMoniker_CreateFromDisplayName(pbc, szDisplayName, &chEaten, &moniker);
1154  if (FAILED(hr) && (hr != MK_E_SYNTAX))
1155  return hr;
1156  }
1157  else
1158  {
1159  hr = get_moniker_for_progid_display_name(pbc, szDisplayName, &chEaten, &moniker);
1160  if (FAILED(hr) && (hr != MK_E_SYNTAX))
1161  return hr;
1162  }
1163 
1164  if (FAILED(hr))
1165  {
1166  hr = FileMoniker_CreateFromDisplayName(pbc, szDisplayName, &chEaten, &moniker);
1167  if (FAILED(hr) && (hr != MK_E_SYNTAX))
1168  return hr;
1169  }
1170 
1171  if (SUCCEEDED(hr))
1172  {
1173  while (TRUE)
1174  {
1175  IMoniker *next_moniker;
1176  *pchEaten += chEaten;
1177  szDisplayName += chEaten;
1178  if (!*szDisplayName)
1179  {
1180  *ppmk = moniker;
1181  return S_OK;
1182  }
1183  chEaten = 0;
1184  hr = IMoniker_ParseDisplayName(moniker, pbc, NULL,
1185  (LPOLESTR)szDisplayName, &chEaten,
1186  &next_moniker);
1187  IMoniker_Release(moniker);
1188  if (FAILED(hr))
1189  {
1190  *pchEaten = 0;
1191  break;
1192  }
1193  moniker = next_moniker;
1194  }
1195  }
1196 
1197  return hr;
1198 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
static LPOLESTR
Definition: stg_prop.c:27
static LPUNKNOWN
Definition: ndr_ole.c:49
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
HRESULT ClassMoniker_CreateFromDisplayName(LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, IMoniker **ppmk)
Definition: classmoniker.c:725
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
BOOL WINAPI IsValidInterface(LPUNKNOWN punk)
Definition: ifs.c:533
unsigned long DWORD
Definition: ntddk_ex.h:95
static HRESULT get_moniker_for_progid_display_name(LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, LPMONIKER *ppmk)
Definition: moniker.c:1054
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: main.c:41
HRESULT FileMoniker_CreateFromDisplayName(LPBC pbc, LPCOLESTR szDisplayName, LPDWORD pchEaten, IMoniker **ppmk)
Definition: filemoniker.c:1452
#define MK_E_SYNTAX
Definition: winerror.h:2785
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CoGetObject(), Global_GetObject(), HlinkParseDisplayName(), IHlink_fnSetStringReference(), MkParseDisplayNameEx(), and test_MkParseDisplayName().

◆ MonikerMarshal_AddRef()

static ULONG WINAPI MonikerMarshal_AddRef ( IMarshal iface)
static

Definition at line 1582 of file moniker.c.

1583 {
1585  return IMoniker_AddRef(This->moniker);
1586 }
static MonikerMarshal * impl_from_IMarshal(IMarshal *iface)
Definition: moniker.c:1534

◆ MonikerMarshal_Create()

HRESULT MonikerMarshal_Create ( IMoniker inner,
IUnknown **  outer 
)

Definition at line 1677 of file moniker.c.

1678 {
1679  MonikerMarshal *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
1680  if (!This) return E_OUTOFMEMORY;
1681 
1682  This->IUnknown_iface.lpVtbl = &VT_MonikerMarshalInner;
1683  This->IMarshal_iface.lpVtbl = &VT_MonikerMarshal;
1684  This->ref = 1;
1685  This->moniker = inner;
1686 
1687  *outer = &This->IUnknown_iface;
1688  return S_OK;
1689 }
static const IMarshalVtbl VT_MonikerMarshal
Definition: moniker.c:1664
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const IUnknownVtbl VT_MonikerMarshalInner
Definition: moniker.c:1569
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define S_OK
Definition: intsafe.h:59

Referenced by AntiMonikerImpl_QueryInterface(), ClassMoniker_QueryInterface(), FileMonikerImpl_QueryInterface(), and ItemMonikerImpl_QueryInterface().

◆ MonikerMarshal_DisconnectObject()

static HRESULT WINAPI MonikerMarshal_DisconnectObject ( LPMARSHAL  iface,
DWORD  dwReserved 
)
static

Definition at line 1656 of file moniker.c.

1657 {
1658  TRACE("()\n");
1659  /* can't disconnect a state-based marshal as nothing on server side to
1660  * disconnect from */
1661  return S_OK;
1662 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ MonikerMarshal_GetMarshalSizeMax()

static HRESULT WINAPI MonikerMarshal_GetMarshalSizeMax ( LPMARSHAL  iface,
REFIID  riid,
void pv,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlflags,
DWORD pSize 
)
static

Definition at line 1606 of file moniker.c.

1609 {
1611  HRESULT hr;
1613 
1614  TRACE("(%s, %p, %x, %p, %x, %p)\n", debugstr_guid(riid), pv,
1615  dwDestContext, pvDestContext, mshlflags, pSize);
1616 
1617  hr = IMoniker_GetSizeMax(This->moniker, &size);
1618  if (hr == S_OK)
1619  *pSize = (DWORD)size.QuadPart;
1620  return hr;
1621 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
#define DWORD
Definition: nt_native.h:44
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:77
static MonikerMarshal * impl_from_IMarshal(IMarshal *iface)
Definition: moniker.c:1534
#define S_OK
Definition: intsafe.h:59

◆ MonikerMarshal_GetUnmarshalClass()

static HRESULT WINAPI MonikerMarshal_GetUnmarshalClass ( LPMARSHAL  iface,
REFIID  riid,
void pv,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlflags,
CLSID pCid 
)
static

Definition at line 1594 of file moniker.c.

1597 {
1599 
1600  TRACE("(%s, %p, %x, %p, %x, %p)\n", debugstr_guid(riid), pv,
1601  dwDestContext, pvDestContext, mshlflags, pCid);
1602 
1603  return IMoniker_GetClassID(This->moniker, pCid);
1604 }
REFIID riid
Definition: precomp.h:44
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static MonikerMarshal * impl_from_IMarshal(IMarshal *iface)
Definition: moniker.c:1534

◆ MonikerMarshal_MarshalInterface()

static HRESULT WINAPI MonikerMarshal_MarshalInterface ( LPMARSHAL  iface,
IStream pStm,
REFIID  riid,
void pv,
DWORD  dwDestContext,
void pvDestContext,
DWORD  mshlflags 
)
static

Definition at line 1623 of file moniker.c.

1626 {
1628 
1629  TRACE("(%p, %s, %p, %x, %p, %x)\n", pStm, debugstr_guid(riid), pv,
1630  dwDestContext, pvDestContext, mshlflags);
1631 
1632  return IMoniker_Save(This->moniker, pStm, FALSE);
1633 }
REFIID riid
Definition: precomp.h:44
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static MonikerMarshal * impl_from_IMarshal(IMarshal *iface)
Definition: moniker.c:1534

◆ MonikerMarshal_QueryInterface()

static HRESULT WINAPI MonikerMarshal_QueryInterface ( IMarshal iface,
REFIID  riid,
LPVOID ppv 
)
static

Definition at line 1576 of file moniker.c.

1577 {
1579  return IMoniker_QueryInterface(This->moniker, riid, ppv);
1580 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static MonikerMarshal * impl_from_IMarshal(IMarshal *iface)
Definition: moniker.c:1534

◆ MonikerMarshal_Release()

static ULONG WINAPI MonikerMarshal_Release ( IMarshal iface)
static

Definition at line 1588 of file moniker.c.

1589 {
1591  return IMoniker_Release(This->moniker);
1592 }
static MonikerMarshal * impl_from_IMarshal(IMarshal *iface)
Definition: moniker.c:1534

◆ MonikerMarshal_ReleaseMarshalData()

static HRESULT WINAPI MonikerMarshal_ReleaseMarshalData ( LPMARSHAL  iface,
IStream pStm 
)
static

Definition at line 1648 of file moniker.c.

1649 {
1650  TRACE("()\n");
1651  /* can't release a state-based marshal as nothing on server side to
1652  * release */
1653  return S_OK;
1654 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ MonikerMarshal_UnmarshalInterface()

static HRESULT WINAPI MonikerMarshal_UnmarshalInterface ( LPMARSHAL  iface,
IStream pStm,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1635 of file moniker.c.

1636 {
1638  HRESULT hr;
1639 
1640  TRACE("(%p, %s, %p)\n", pStm, debugstr_guid(riid), ppv);
1641 
1642  hr = IMoniker_Load(This->moniker, pStm);
1643  if (hr == S_OK)
1644  hr = IMoniker_QueryInterface(This->moniker, riid, ppv);
1645  return hr;
1646 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
static MonikerMarshal * impl_from_IMarshal(IMarshal *iface)
Definition: moniker.c:1534
#define S_OK
Definition: intsafe.h:59

◆ MonikerMarshalInner_AddRef()

static ULONG WINAPI MonikerMarshalInner_AddRef ( IUnknown iface)
static

Definition at line 1554 of file moniker.c.

1555 {
1557  return InterlockedIncrement(&This->ref);
1558 }
static MonikerMarshal * impl_from_IUnknown(IUnknown *iface)
Definition: moniker.c:1529
#define InterlockedIncrement
Definition: armddk.h:53

◆ MonikerMarshalInner_QueryInterface()

static HRESULT WINAPI MonikerMarshalInner_QueryInterface ( IUnknown iface,
REFIID  riid,
LPVOID ppv 
)
static

Definition at line 1539 of file moniker.c.

1540 {
1542  TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
1543  *ppv = NULL;
1544  if (IsEqualIID(&IID_IUnknown, riid) || IsEqualIID(&IID_IMarshal, riid))
1545  {
1546  *ppv = &This->IMarshal_iface;
1547  IMarshal_AddRef(&This->IMarshal_iface);
1548  return S_OK;
1549  }
1550  FIXME("No interface for %s\n", debugstr_guid(riid));
1551  return E_NOINTERFACE;
1552 }
#define E_NOINTERFACE
Definition: winerror.h:2364
static MonikerMarshal * impl_from_IUnknown(IUnknown *iface)
Definition: moniker.c:1529
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ MonikerMarshalInner_Release()

static ULONG WINAPI MonikerMarshalInner_Release ( IUnknown iface)
static

Definition at line 1560 of file moniker.c.

1561 {
1564 
1565  if (!ref) HeapFree(GetProcessHeap(), 0, This);
1566  return ref;
1567 }
static MonikerMarshal * impl_from_IUnknown(IUnknown *iface)
Definition: moniker.c:1529
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ reduce_moniker()

static HRESULT reduce_moniker ( IMoniker pmk,
IBindCtx pbc,
IMoniker **  pmkReduced 
)
static

Definition at line 298 of file moniker.c.

299 {
300  IBindCtx *pbcNew = NULL;
301  HRESULT hr;
302  if (!pbc)
303  {
304  hr = CreateBindCtx(0, &pbcNew);
305  if (FAILED(hr))
306  return hr;
307  pbc = pbcNew;
308  }
309  hr = IMoniker_Reduce(pmk, pbc, MKRREDUCE_ALL, NULL, pmkReduced);
310  if (FAILED(hr))
311  ERR("reducing moniker failed with error 0x%08x\n", hr);
312  if (pbcNew) IBindCtx_Release(pbcNew);
313  return hr;
314 }
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556
LONG HRESULT
Definition: typedefs.h:77
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by RunningObjectTableImpl_GetObject(), RunningObjectTableImpl_GetTimeOfLastChange(), RunningObjectTableImpl_IsRunning(), and RunningObjectTableImpl_Register().

◆ rot_entry_delete()

static void rot_entry_delete ( struct rot_entry rot_entry)
static

Definition at line 188 of file moniker.c.

189 {
190  if (rot_entry->cookie)
191  {
192  InterfaceData *object = NULL;
194  __TRY
195  {
197  &rot_entry->ctxt_handle, &object, &moniker);
198  }
200  {
201  }
202  __ENDTRY
203  MIDL_user_free(object);
204  if (moniker)
205  {
206  IStream *stream;
207  HRESULT hr;
209  if (hr == S_OK)
210  {
212  IStream_Release(stream);
213  }
214  }
216  }
217  if (rot_entry->object)
218  {
219  IStream *stream;
220  HRESULT hr;
222  if (hr == S_OK)
223  {
225  IStream_Release(stream);
226  }
227  }
231 }
HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
Definition: marshal.c:2055
#define __EXCEPT(func)
Definition: exception.h:58
MonikerComparisonData * moniker_data
Definition: irotp.c:41
HRESULT hr
Definition: shlfolder.c:183
IrotContextHandle ctxt_handle
Definition: moniker.c:65
static IrotHandle get_irot_handle(void)
Definition: moniker.c:105
void __RPC_USER MIDL_user_free(void *p)
Definition: moniker.c:1696
smooth NULL
Definition: ftsmooth.c:416
#define __TRY
Definition: compat.h:70
Definition: irotp.c:36
HRESULT __cdecl IrotRevoke(IrotHandle h, IrotCookie cookie, IrotContextHandle *ctxt_handle, PInterfaceData *obj, PInterfaceData *mk)
Definition: irotp.c:151
#define GetProcessHeap()
Definition: compat.h:403
static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr)
Definition: moniker.c:52
LONG HRESULT
Definition: typedefs.h:77
#define __ENDTRY
Definition: compat.h:72
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define S_OK
Definition: intsafe.h:59
DWORD cookie
Definition: irotp.c:42
Definition: main.c:41
IN PVOID IN PVOID InterfaceData
Definition: pci.h:359
InterfaceData * object
Definition: irotp.c:39
static HRESULT create_stream_on_mip_ro(const InterfaceData *mip, IStream **stream)
Definition: moniker.c:179
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by RunningObjectTableImpl_Destroy(), RunningObjectTableImpl_Register(), RunningObjectTableImpl_Release(), and RunningObjectTableImpl_Revoke().

◆ rpc_filter()

◆ RunningObjectTableImpl_AddRef()

static ULONG WINAPI RunningObjectTableImpl_AddRef ( IRunningObjectTable iface)
static

Definition at line 350 of file moniker.c.

351 {
353 
354  TRACE("(%p)\n",This);
355 
356  return InterlockedIncrement(&This->ref);
357 }
static RunningObjectTableImpl * impl_from_IRunningObjectTable(IRunningObjectTable *iface)
Definition: moniker.c:91
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53

◆ RunningObjectTableImpl_Destroy()

static HRESULT RunningObjectTableImpl_Destroy ( void  )
static

Definition at line 363 of file moniker.c.

364 {
365  struct list *cursor, *cursor2;
366  IrotHandle old_handle;
367 
368  TRACE("()\n");
369 
371  return E_INVALIDARG;
372 
373  /* free the ROT table memory */
375  {
376  struct rot_entry *rot_entry = LIST_ENTRY(cursor, struct rot_entry, entry);
379  }
380 
383 
384  /* free the ROT structure memory */
387 
388  old_handle = irot_handle;
389  irot_handle = NULL;
390  if (old_handle)
391  RpcBindingFree(&old_handle);
392 
393  return S_OK;
394 }
static RunningObjectTableImpl * runningObjectTableInstance
Definition: moniker.c:78
static IrotHandle irot_handle
Definition: moniker.c:79
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:784
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
Definition: list.h:192
struct list rot
Definition: moniker.c:74
CRITICAL_SECTION lock
Definition: moniker.c:75
#define DEBUG_CLEAR_CRITSEC_NAME(cs)
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
Definition: irotp.c:36
__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
static void rot_entry_delete(struct rot_entry *rot_entry)
Definition: moniker.c:188
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
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
struct list entry
Definition: irotp.c:38
#define LIST_ENTRY(type)
Definition: queue.h:175
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by RunningObjectTableImpl_UnInitialize().

◆ RunningObjectTableImpl_EnumRunning()

static HRESULT WINAPI RunningObjectTableImpl_EnumRunning ( IRunningObjectTable iface,
IEnumMoniker **  ppenumMoniker 
)
static

Definition at line 924 of file moniker.c.

926 {
929  HRESULT hr;
930 
931  TRACE("(%p, %p)\n", This, ppenumMoniker);
932 
933  *ppenumMoniker = NULL;
934 
935  while (TRUE)
936  {
937  __TRY
938  {
940  }
942  {
944  }
945  __ENDTRY
947  {
948  if (start_rpcss())
949  continue;
950  }
951  break;
952  }
953 
954  if (SUCCEEDED(hr))
956  0, ppenumMoniker);
957 
958  return hr;
959 }
#define __EXCEPT(func)
Definition: exception.h:58
#define TRUE
Definition: types.h:120
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
_In_ PUSBD_INTERFACE_LIST_ENTRY InterfaceList
Definition: usbdlib.h:168
static struct regsvr_interface const interface_list[]
Definition: regsvr.c:477
static IrotHandle get_irot_handle(void)
Definition: moniker.c:105
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
static BOOL start_rpcss(void)
Definition: moniker.c:129
smooth NULL
Definition: ftsmooth.c:416
HRESULT __cdecl IrotEnumRunning(IrotHandle h, PInterfaceList *list)
Definition: irotp.c:317
static RunningObjectTableImpl * impl_from_IRunningObjectTable(IRunningObjectTable *iface)
Definition: moniker.c:91
#define __TRY
Definition: compat.h:70
#define GetExceptionCode()
Definition: exception.h:65
#define TRACE(s)
Definition: solgame.cpp:4
static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr)
Definition: moniker.c:52
LONG HRESULT
Definition: typedefs.h:77
#define __ENDTRY
Definition: compat.h:72
static HRESULT EnumMonikerImpl_CreateEnumROTMoniker(InterfaceList *moniker_list, ULONG pos, IEnumMoniker **ppenumMoniker)
Definition: moniker.c:1489
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ RunningObjectTableImpl_GetObject()

static HRESULT WINAPI RunningObjectTableImpl_GetObject ( IRunningObjectTable iface,
IMoniker pmkObjectName,
IUnknown **  ppunkObject 
)
static

Definition at line 705 of file moniker.c.

707 {
710  InterfaceData *object = NULL;
711  IrotCookie cookie;
712  HRESULT hr;
713  struct rot_entry *rot_entry;
714 
715  TRACE("(%p,%p,%p)\n",This,pmkObjectName,ppunkObject);
716 
717  if (ppunkObject == NULL)
718  return E_POINTER;
719 
720  *ppunkObject = NULL;
721 
722  hr = reduce_moniker(pmkObjectName, NULL, &pmkObjectName);
723  if (FAILED(hr))
724  return hr;
725  hr = get_moniker_comparison_data(pmkObjectName, &moniker_data);
726  IMoniker_Release(pmkObjectName);
727  if (hr != S_OK)
728  return hr;
729 
730  EnterCriticalSection(&This->lock);
732  {
733  if ((rot_entry->moniker_data->ulCntData == moniker_data->ulCntData) &&
734  !memcmp(moniker_data->abData, rot_entry->moniker_data->abData, moniker_data->ulCntData))
735  {
736  IStream *pStream;
738  if (hr == S_OK)
739  {
740  hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)ppunkObject);
741  IStream_Release(pStream);
742  }
743 
744  LeaveCriticalSection(&This->lock);
746 
747  return hr;
748  }
749  }
750  LeaveCriticalSection(&This->lock);
751 
752  TRACE("moniker unavailable locally, calling SCM\n");
753 
754  while (TRUE)
755  {
756  __TRY
757  {
759  }
761  {
763  }
764  __ENDTRY
766  {
767  if (start_rpcss())
768  continue;
769  }
770  break;
771  }
772 
773  if (SUCCEEDED(hr))
774  {
775  IStream *pStream;
776  hr = create_stream_on_mip_ro(object, &pStream);
777  if (hr == S_OK)
778  {
779  hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)ppunkObject);
780  IStream_Release(pStream);
781  }
782  }
783  else
784  WARN("Moniker unavailable, IrotGetObject returned 0x%08x\n", hr);
785 
787 
788  return hr;
789 }
#define __EXCEPT(func)
Definition: exception.h:58
MonikerComparisonData * moniker_data
Definition: irotp.c:41
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1981
#define TRUE
Definition: types.h:120
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:111
static IrotHandle get_irot_handle(void)
Definition: moniker.c:105
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
static BOOL start_rpcss(void)
Definition: moniker.c:129
static HRESULT get_moniker_comparison_data(IMoniker *pMoniker, MonikerComparisonData **moniker_data)
Definition: moniker.c:234
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static HRESULT reduce_moniker(IMoniker *pmk, IBindCtx *pbc, IMoniker **pmkReduced)
Definition: moniker.c:298
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
smooth NULL
Definition: ftsmooth.c:416
static RunningObjectTableImpl * impl_from_IRunningObjectTable(IRunningObjectTable *iface)
Definition: moniker.c:91
#define __TRY
Definition: compat.h:70
#define GetExceptionCode()
Definition: exception.h:65
Definition: irotp.c:36
IROT_ENDPOINT struct tagMonikerComparisonData MonikerComparisonData
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
HRESULT __cdecl IrotGetObject(IrotHandle h, const MonikerComparisonData *moniker_data, PInterfaceData *obj, IrotCookie *cookie)
Definition: irotp.c:223
static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr)
Definition: moniker.c:52
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
#define __ENDTRY
Definition: compat.h:72
uint32_t entry
Definition: isohybrid.c:63
#define S_OK
Definition: intsafe.h:59
DWORD cookie
Definition: irotp.c:42
IN PVOID IN PVOID InterfaceData
Definition: pci.h:359
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define E_POINTER
Definition: winerror.h:2365
InterfaceData * object
Definition: irotp.c:39
static HRESULT create_stream_on_mip_ro(const InterfaceData *mip, IStream **stream)
Definition: moniker.c:179
#define HeapFree(x, y, z)
Definition: compat.h:402
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ RunningObjectTableImpl_GetTimeOfLastChange()

static HRESULT WINAPI RunningObjectTableImpl_GetTimeOfLastChange ( IRunningObjectTable iface,
IMoniker pmkObjectName,
FILETIME pfiletime 
)
static

Definition at line 853 of file moniker.c.

855 {
859  const struct rot_entry *rot_entry;
860 
861  TRACE("(%p,%p,%p)\n",This,pmkObjectName,pfiletime);
862 
863  if (pmkObjectName==NULL || pfiletime==NULL)
864  return E_INVALIDARG;
865 
866  hr = reduce_moniker(pmkObjectName, NULL, &pmkObjectName);
867  if (FAILED(hr))
868  return hr;
869  hr = get_moniker_comparison_data(pmkObjectName, &moniker_data);
870  IMoniker_Release(pmkObjectName);
871  if (hr != S_OK)
872  return hr;
873 
875 
876  EnterCriticalSection(&This->lock);
877  LIST_FOR_EACH_ENTRY(rot_entry, &This->rot, const struct rot_entry, entry)
878  {
879  if ((rot_entry->moniker_data->ulCntData == moniker_data->ulCntData) &&
880  !memcmp(moniker_data->abData, rot_entry->moniker_data->abData, moniker_data->ulCntData))
881  {
882  *pfiletime = rot_entry->last_modified;
883  hr = S_OK;
884  break;
885  }
886  }
887  LeaveCriticalSection(&This->lock);
888 
889  if (hr != S_OK)
890  {
891  while (TRUE)
892  {
893  __TRY
894  {
896  }
898  {
900  }
901  __ENDTRY
903  {
904  if (start_rpcss())
905  continue;
906  }
907  break;
908  }
909  }
910 
912 
913  TRACE("-- 0x%08x\n", hr);
914  return hr;
915 }
#define __EXCEPT(func)
Definition: exception.h:58
MonikerComparisonData * moniker_data
Definition: irotp.c:41
#define TRUE
Definition: types.h:120
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HRESULT hr
Definition: shlfolder.c:183
static IrotHandle get_irot_handle(void)
Definition: moniker.c:105
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
static BOOL start_rpcss(void)
Definition: moniker.c:129
static HRESULT get_moniker_comparison_data(IMoniker *pMoniker, MonikerComparisonData **moniker_data)
Definition: moniker.c:234
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static HRESULT reduce_moniker(IMoniker *pmk, IBindCtx *pbc, IMoniker **pmkReduced)
Definition: moniker.c:298
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static RunningObjectTableImpl * impl_from_IRunningObjectTable(IRunningObjectTable *iface)
Definition: moniker.c:91
#define __TRY
Definition: compat.h:70
#define GetExceptionCode()
Definition: exception.h:65
Definition: irotp.c:36
IROT_ENDPOINT struct tagMonikerComparisonData MonikerComparisonData
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr)
Definition: moniker.c:52
LONG HRESULT
Definition: typedefs.h:77
#define __ENDTRY
Definition: compat.h:72
uint32_t entry
Definition: isohybrid.c:63
#define S_OK
Definition: intsafe.h:59
HRESULT __cdecl IrotGetTimeOfLastChange(IrotHandle h, const MonikerComparisonData *moniker_data, FILETIME *time)
Definition: irotp.c:289
#define MK_E_UNAVAILABLE
Definition: winerror.h:2784
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
FILETIME last_modified
Definition: irotp.c:43
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ 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_IsRunning()

static HRESULT WINAPI RunningObjectTableImpl_IsRunning ( IRunningObjectTable iface,
IMoniker pmkObjectName 
)
static

Definition at line 640 of file moniker.c.

641 {
644  HRESULT hr;
645  const struct rot_entry *rot_entry;
646 
647  TRACE("(%p,%p)\n",This,pmkObjectName);
648 
649  hr = reduce_moniker(pmkObjectName, NULL, &pmkObjectName);
650  if (FAILED(hr))
651  return hr;
652  hr = get_moniker_comparison_data(pmkObjectName, &moniker_data);
653  IMoniker_Release(pmkObjectName);
654  if (hr != S_OK)
655  return hr;
656 
657  hr = S_FALSE;
658  EnterCriticalSection(&This->lock);
659  LIST_FOR_EACH_ENTRY(rot_entry, &This->rot, const struct rot_entry, entry)
660  {
661  if ((rot_entry->moniker_data->ulCntData == moniker_data->ulCntData) &&
662  !memcmp(moniker_data->abData, rot_entry->moniker_data->abData, moniker_data->ulCntData))
663  {
664  hr = S_OK;
665  break;
666  }
667  }
668  LeaveCriticalSection(&This->lock);
669 
670  if (hr == S_FALSE)
671  {
672  while (TRUE)
673  {
674  __TRY
675  {
677  }
679  {
681  }
682  __ENDTRY
684  {
685  if (start_rpcss())
686  continue;
687  }
688  break;
689  }
690  }
691 
693 
694  return hr;
695 }
#define __EXCEPT(func)
Definition: exception.h:58
MonikerComparisonData * moniker_data
Definition: irotp.c:41
#define TRUE
Definition: types.h:120
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HRESULT hr
Definition: shlfolder.c:183
static IrotHandle get_irot_handle(void)
Definition: moniker.c:105
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
static BOOL start_rpcss(void)
Definition: moniker.c:129
static HRESULT get_moniker_comparison_data(IMoniker *pMoniker, MonikerComparisonData **moniker_data)
Definition: moniker.c:234
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static HRESULT reduce_moniker(IMoniker *pmk, IBindCtx *pbc, IMoniker **pmkReduced)
Definition: moniker.c:298
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
static RunningObjectTableImpl * impl_from_IRunningObjectTable(IRunningObjectTable *iface)
Definition: moniker.c:91
#define __TRY
Definition: compat.h:70
#define GetExceptionCode()
Definition: exception.h:65
Definition: irotp.c:36
IROT_ENDPOINT struct tagMonikerComparisonData MonikerComparisonData
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr)
Definition: moniker.c:52
LONG HRESULT
Definition: typedefs.h:77
#define __ENDTRY
Definition: compat.h:72
uint32_t entry
Definition: isohybrid.c:63
#define S_OK
Definition: intsafe.h:59
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:402
HRESULT __cdecl IrotIsRunning(IrotHandle h, const MonikerComparisonData *data)
Definition: irotp.c:198

◆ RunningObjectTableImpl_NoteChangeTime()

static HRESULT WINAPI RunningObjectTableImpl_NoteChangeTime ( IRunningObjectTable iface,
DWORD  dwRegister,
FILETIME pfiletime 
)
static

Definition at line 799 of file moniker.c.

801 {
803  struct rot_entry *rot_entry;
805 
806  TRACE("(%p,%d,%p)\n",This,dwRegister,pfiletime);
807 
808  EnterCriticalSection(&This->lock);
810  {
811  if (rot_entry->cookie == dwRegister)
812  {
813  rot_entry->last_modified = *pfiletime;
814  LeaveCriticalSection(&This->lock);
815 
816  while (TRUE)
817  {
818  __TRY
819  {
820  hr = IrotNoteChangeTime(get_irot_handle(), dwRegister, pfiletime);
821  }
823  {
825  }
826  __ENDTRY
828  {
829  if (start_rpcss())
830  continue;
831  }
832  break;
833  }
834 
835  goto done;
836  }
837  }
838  LeaveCriticalSection(&This->lock);
839 
840 done:
841  TRACE("-- 0x08%x\n", hr);
842  return hr;
843 }
HRESULT __cdecl IrotNoteChangeTime(IrotHandle h, IrotCookie cookie, const FILETIME *last_modified_time)
Definition: irotp.c:265
#define __EXCEPT(func)
Definition: exception.h:58
#define TRUE
Definition: types.h:120
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
static IrotHandle get_irot_handle(void)
Definition: moniker.c:105
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
static BOOL start_rpcss(void)
Definition: moniker.c:129
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define E_INVALIDARG
Definition: ddrawi.h:101
static RunningObjectTableImpl * impl_from_IRunningObjectTable(IRunningObjectTable *iface)
Definition: moniker.c:91
#define __TRY
Definition: compat.h:70
#define GetExceptionCode()
Definition: exception.h:65
Definition: irotp.c:36
#define TRACE(s)
Definition: solgame.cpp:4
static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr)
Definition: moniker.c:52
LONG HRESULT
Definition: typedefs.h:77
#define __ENDTRY
Definition: compat.h:72
uint32_t entry
Definition: isohybrid.c:63
DWORD cookie
Definition: irotp.c:42
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
FILETIME last_modified
Definition: irotp.c:43

◆ RunningObjectTableImpl_QueryInterface()

static HRESULT WINAPI RunningObjectTableImpl_QueryInterface ( IRunningObjectTable iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 320 of file moniker.c.

322 {
324 
325  TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppvObject);
326 
327  /* validate arguments */
328 
329  if (ppvObject==0)
330  return E_INVALIDARG;
331 
332  *ppvObject = 0;
333 
334  if (IsEqualIID(&IID_IUnknown, riid) ||
335  IsEqualIID(&IID_IRunningObjectTable, riid))
336  *ppvObject = &This->IRunningObjectTable_iface;
337 
338  if ((*ppvObject)==0)
339  return E_NOINTERFACE;
340 
341  IRunningObjectTable_AddRef(iface);
342 
343  return S_OK;
344 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define E_INVALIDARG
Definition: ddrawi.h:101
static RunningObjectTableImpl * impl_from_IRunningObjectTable(IRunningObjectTable *iface)
Definition: moniker.c:91
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ RunningObjectTableImpl_Register()

static HRESULT WINAPI RunningObjectTableImpl_Register ( IRunningObjectTable iface,
DWORD  grfFlags,
IUnknown punkObject,
IMoniker pmkObjectName,
DWORD pdwRegister 
)
static

Definition at line 437 of file moniker.c.

439 {
441  struct rot_entry *rot_entry;
442  HRESULT hr = S_OK;
443  IStream *pStream = NULL;
444  DWORD mshlflags;
445  IBindCtx *pbc;
447 
448  TRACE("(%p,%d,%p,%p,%p)\n",This,grfFlags,punkObject,pmkObjectName,pdwRegister);
449 
450  if (grfFlags & ~(ROTFLAGS_REGISTRATIONKEEPSALIVE|ROTFLAGS_ALLOWANYCLIENT))
451  {
452  ERR("Invalid grfFlags: 0x%08x\n", grfFlags & ~(ROTFLAGS_REGISTRATIONKEEPSALIVE|ROTFLAGS_ALLOWANYCLIENT));
453  return E_INVALIDARG;
454  }
455 
456  if (punkObject==NULL || pmkObjectName==NULL || pdwRegister==NULL)
457  return E_INVALIDARG;
458 
460  if (!rot_entry)
461  return E_OUTOFMEMORY;
462 
463  /* marshal object */
464  hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
465  if (hr != S_OK)
466  {
468  return hr;
469  }
470  mshlflags = (grfFlags & ROTFLAGS_REGISTRATIONKEEPSALIVE) ? MSHLFLAGS_TABLESTRONG : MSHLFLAGS_TABLEWEAK;
471  hr = CoMarshalInterface(pStream, &IID_IUnknown, punkObject, MSHCTX_LOCAL | MSHCTX_NOSHAREDMEM, NULL, mshlflags);
472  /* FIXME: a cleaner way would be to create an IStream class that writes
473  * directly to an MInterfacePointer */
474  if (hr == S_OK)
475  {
476  HGLOBAL hglobal;
477  hr = GetHGlobalFromStream(pStream, &hglobal);
478  if (hr == S_OK)
479  {
480  SIZE_T size = GlobalSize(hglobal);
481  const void *pv = GlobalLock(hglobal);
482  rot_entry->object = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(MInterfacePointer, abData[size]));
483  rot_entry->object->ulCntData = size;
484  memcpy(rot_entry->object->abData, pv, size);
485  GlobalUnlock(hglobal);
486  }
487  }
488  IStream_Release(pStream);
489  if (hr != S_OK)
490  {
492  return hr;
493  }
494 
495  hr = CreateBindCtx(0, &pbc);
496  if (FAILED(hr))
497  {
499  return hr;
500  }
501 
502  hr = reduce_moniker(pmkObjectName, pbc, &pmkObjectName);
503  if (FAILED(hr))
504  {
506  IBindCtx_Release(pbc);
507  return hr;
508  }
509 
510  hr = IMoniker_GetTimeOfLastChange(pmkObjectName, pbc, NULL,
512  IBindCtx_Release(pbc);
513  if (FAILED(hr))
514  {
516  hr = S_OK;
517  }
518 
519  hr = get_moniker_comparison_data(pmkObjectName,
521  if (hr != S_OK)
522  {
524  IMoniker_Release(pmkObjectName);
525  return hr;
526  }
527 
528  hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
529  if (hr != S_OK)
530  {
532  IMoniker_Release(pmkObjectName);
533  return hr;
534  }
535  /* marshal moniker */
536  hr = CoMarshalInterface(pStream, &IID_IMoniker, (IUnknown *)pmkObjectName,
537  MSHCTX_LOCAL | MSHCTX_NOSHAREDMEM, NULL, MSHLFLAGS_TABLESTRONG);
538  /* FIXME: a cleaner way would be to create an IStream class that writes
539  * directly to an MInterfacePointer */
540  if (hr == S_OK)
541  {
542  HGLOBAL hglobal;
543  hr = GetHGlobalFromStream(pStream, &hglobal);
544  if (hr == S_OK)
545  {
546  SIZE_T size = GlobalSize(hglobal);
547  const void *pv = GlobalLock(hglobal);
549  moniker->ulCntData = size;
550  memcpy(moniker->abData, pv, size);
551  GlobalUnlock(hglobal);
552  }
553  }
554  IStream_Release(pStream);
555  IMoniker_Release(pmkObjectName);
556  if (hr != S_OK)
557  {
560  return hr;
561  }
562 
563 
564  while (TRUE)
565  {
566  __TRY
567  {
570  &rot_entry->last_modified, grfFlags,
572  }
574  {
576  }
577  __ENDTRY
579  {
580  if (start_rpcss())
581  continue;
582  }
583  break;
584  }
586  if (FAILED(hr))
587  {
589  return hr;
590  }
591 
592  /* gives a registration identifier to the registered object*/
593  *pdwRegister = rot_entry->cookie;
594 
595  EnterCriticalSection(&This->lock);
596  list_add_tail(&This->rot, &rot_entry->entry);
597  LeaveCriticalSection(&This->lock);
598 
599  return hr;
600 }
#define __EXCEPT(func)
Definition: exception.h:58
MonikerComparisonData * moniker_data
Definition: irotp.c:41
#define TRUE
Definition: types.h:120
HRESULT WINAPI GetHGlobalFromStream(IStream *pstm, HGLOBAL *phglobal)
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
IrotContextHandle ctxt_handle
Definition: moniker.c:65
static IrotHandle get_irot_handle(void)
Definition: moniker.c:105
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
static BOOL start_rpcss(void)
Definition: moniker.c:129
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
static HRESULT get_moniker_comparison_data(IMoniker *pMoniker, MonikerComparisonData **moniker_data)
Definition: moniker.c:234
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static HRESULT reduce_moniker(IMoniker *pmk, IBindCtx *pbc, IMoniker **pmkReduced)
Definition: moniker.c:298
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
__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 E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static RunningObjectTableImpl * impl_from_IRunningObjectTable(IRunningObjectTable *iface)
Definition: moniker.c:91
#define __TRY
Definition: compat.h:70
#define GetExceptionCode()
Definition: exception.h:65
Definition: irotp.c:36
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556
static void rot_entry_delete(struct rot_entry *rot_entry)
Definition: moniker.c:188
static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr)
Definition: moniker.c:52
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT __cdecl IrotRegister(IrotHandle h, const MonikerComparisonData *data, const InterfaceData *obj, const InterfaceData *mk, const FILETIME *time, DWORD grfFlags, IrotCookie *cookie, IrotContextHandle *ctxt_handle)
Definition: irotp.c:71
#define __ENDTRY
Definition: compat.h:72
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HRESULT WINAPI CoFileTimeNow(FILETIME *lpFileTime)
Definition: compobj.c:3717
#define ERR(fmt,...)
Definition: debug.h:109
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
DWORD cookie
Definition: irotp.c:42
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
Definition: main.c:41
IN PVOID IN PVOID InterfaceData
Definition: pci.h:359
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
struct list entry
Definition: irotp.c:38
HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:1876
FILETIME last_modified
Definition: irotp.c:43
InterfaceData * object
Definition: irotp.c:39
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ RunningObjectTableImpl_Release()

static ULONG WINAPI RunningObjectTableImpl_Release ( IRunningObjectTable iface)
static

Definition at line 400 of file moniker.c.

401 {
403  ULONG ref;
404 
405  TRACE("(%p)\n",This);
406 
407  ref = InterlockedDecrement(&This->ref);
408 
409  /* uninitialize ROT structure if there are no more references to it */
410  if (ref == 0)
411  {
412  struct list *cursor, *cursor2;
413  LIST_FOR_EACH_SAFE(cursor, cursor2, &This->rot)
414  {
415  struct rot_entry *rot_entry = LIST_ENTRY(cursor, struct rot_entry, entry);
418  }
419  /* RunningObjectTable data structure will be not destroyed here ! the destruction will be done only
420  * when RunningObjectTableImpl_UnInitialize function is called
421  */
422  }
423 
424  return ref;
425 }
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
Definition: list.h:192
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
static RunningObjectTableImpl * impl_from_IRunningObjectTable(IRunningObjectTable *iface)
Definition: moniker.c:91
Definition: irotp.c:36
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
static void rot_entry_delete(struct rot_entry *rot_entry)
Definition: moniker.c:188
#define InterlockedDecrement
Definition: armddk.h:52
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
const char cursor[]
Definition: icontest.c:13
unsigned int ULONG
Definition: retypes.h:1
struct list entry
Definition: irotp.c:38
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by RunningObjectTableImpl_UnInitialize().

◆ RunningObjectTableImpl_Revoke()

static HRESULT WINAPI RunningObjectTableImpl_Revoke ( IRunningObjectTable iface,
DWORD  dwRegister 
)
static

Definition at line 609 of file moniker.c.

610 {
612  struct rot_entry *rot_entry;
613 
614  TRACE("(%p,%d)\n",This,dwRegister);
615 
616  EnterCriticalSection(&This->lock);
618  {
619  if (rot_entry->cookie == dwRegister)
620  {
622  LeaveCriticalSection(&This->lock);
623 
625  return S_OK;
626  }
627  }
628  LeaveCriticalSection(&This->lock);
629 
630  return E_INVALIDARG;
631 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define E_INVALIDARG
Definition: ddrawi.h:101
static RunningObjectTableImpl * impl_from_IRunningObjectTable(IRunningObjectTable *iface)
Definition: moniker.c:91
Definition: irotp.c:36
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
static void rot_entry_delete(struct rot_entry *rot_entry)
Definition: moniker.c:188
uint32_t entry
Definition: isohybrid.c:63
#define S_OK
Definition: intsafe.h:59
DWORD cookie
Definition: irotp.c:42
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
struct list entry
Definition: irotp.c:38

◆ 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_rpcss()

static BOOL start_rpcss ( void  )
static

Definition at line 129 of file moniker.c.

130 {
131  static const WCHAR rpcssW[] = {'R','p','c','S','s',0};
132  SC_HANDLE scm, service;
134  BOOL ret = FALSE;
135 
136  TRACE("\n");
137 
138  if (!(scm = OpenSCManagerW( NULL, NULL, 0 )))
139  {
140  ERR( "failed to open service manager\n" );
141  return FALSE;
142  }
143  if (!(service = OpenServiceW( scm, rpcssW, SERVICE_START | SERVICE_QUERY_STATUS )))
144  {
145  ERR( "failed to open RpcSs service\n" );
146  CloseServiceHandle( scm );
147  return FALSE;
148  }
150  {
151  ULONGLONG start_time = GetTickCount64();
152  do
153  {
154  DWORD dummy;
155 
157  (BYTE *)&status, sizeof(status), &dummy ))
158  break;
159  if (status.dwCurrentState == SERVICE_RUNNING)
160  {
161  ret = TRUE;
162  break;
163  }
164  if (GetTickCount64() - start_time > 30000) break;
165  Sleep( 100 );
166 
167  } while (status.dwCurrentState == SERVICE_START_PENDING);
168 
169  if (status.dwCurrentState != SERVICE_RUNNING)
170  WARN( "RpcSs failed to start %u\n", status.dwCurrentState );
171  }
172  else ERR( "failed to start RpcSs service\n" );
173 
174  CloseServiceHandle( service );
175  CloseServiceHandle( scm );
176  return ret;
177 }
#define TRUE
Definition: types.h:120
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define WARN(fmt,...)
Definition: debug.h:111
static WCHAR rpcssW[]
Definition: rpcss_main.c:36
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define SERVICE_START_PENDING
Definition: winsvc.h:22
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2830
ULONGLONG WINAPI GetTickCount64(VOID)
Definition: GetTickCount64.c:9
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SERVICE_RUNNING
Definition: winsvc.h:24
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2103
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
smooth NULL
Definition: ftsmooth.c:416
#define SERVICE_QUERY_STATUS
Definition: winsvc.h:55
BOOL WINAPI StartServiceW(SC_HANDLE hService, DWORD dwNumServiceArgs, LPCWSTR *lpServiceArgVectors)
Definition: scm.c:2923
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint64_t ULONGLONG
Definition: typedefs.h:65
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2011
unsigned char BYTE
Definition: mem.h:68
#define SERVICE_START
Definition: winsvc.h:57
#define ERR(fmt,...)
Definition: debug.h:109
unsigned char dummy
Definition: maze.c:118
#define ERROR_SERVICE_ALREADY_RUNNING
Definition: winerror.h:607
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by RunningObjectTableImpl_EnumRunning(), RunningObjectTableImpl_GetObject(), RunningObjectTableImpl_GetTimeOfLastChange(), RunningObjectTableImpl_IsRunning(), RunningObjectTableImpl_NoteChangeTime(), and RunningObjectTableImpl_Register().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

Variable Documentation

◆ irot_handle

IrotHandle irot_handle
static

Definition at line 79 of file moniker.c.

Referenced by get_irot_handle(), and RunningObjectTableImpl_Destroy().

◆ runningObjectTableInstance

◆ VT_EnumMonikerImpl

const IEnumMonikerVtbl VT_EnumMonikerImpl
static
Initial value:
=
{
}
static HRESULT WINAPI EnumMonikerImpl_Clone(IEnumMoniker *iface, IEnumMoniker **ppenum)
Definition: moniker.c:1438
static HRESULT WINAPI EnumMonikerImpl_QueryInterface(IEnumMoniker *iface, REFIID riid, void **ppvObject)
Definition: moniker.c:1309
static ULONG WINAPI EnumMonikerImpl_Release(IEnumMoniker *iface)
Definition: moniker.c:1345
static HRESULT WINAPI EnumMonikerImpl_Skip(IEnumMoniker *iface, ULONG celt)
Definition: moniker.c:1407
static HRESULT WINAPI EnumMonikerImpl_Reset(IEnumMoniker *iface)
Definition: moniker.c:1424
static HRESULT WINAPI EnumMonikerImpl_Next(IEnumMoniker *iface, ULONG celt, IMoniker **rgelt, ULONG *pceltFetched)
Definition: moniker.c:1372
static ULONG WINAPI EnumMonikerImpl_AddRef(IEnumMoniker *iface)
Definition: moniker.c:1333

Definition at line 1473 of file moniker.c.

Referenced by EnumMonikerImpl_CreateEnumROTMoniker().

◆ VT_MonikerMarshal

const IMarshalVtbl VT_MonikerMarshal
static
Initial value:
=
{
}
static HRESULT WINAPI MonikerMarshal_DisconnectObject(LPMARSHAL iface, DWORD dwReserved)
Definition: moniker.c:1656
static HRESULT WINAPI MonikerMarshal_ReleaseMarshalData(LPMARSHAL iface, IStream *pStm)
Definition: moniker.c:1648
static HRESULT WINAPI MonikerMarshal_GetMarshalSizeMax(LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *pSize)
Definition: moniker.c:1606
static HRESULT WINAPI MonikerMarshal_UnmarshalInterface(LPMARSHAL iface, IStream *pStm, REFIID riid, void **ppv)
Definition: moniker.c:1635
static ULONG WINAPI MonikerMarshal_AddRef(IMarshal *iface)
Definition: moniker.c:1582
static ULONG WINAPI MonikerMarshal_Release(IMarshal *iface)
Definition: moniker.c:1588
static HRESULT WINAPI MonikerMarshal_QueryInterface(IMarshal *iface, REFIID riid, LPVOID *ppv)
Definition: moniker.c:1576
static HRESULT WINAPI MonikerMarshal_GetUnmarshalClass(LPMARSHAL iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid)
Definition: moniker.c:1594
static HRESULT WINAPI MonikerMarshal_MarshalInterface(LPMARSHAL iface, IStream *pStm, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags)
Definition: moniker.c:1623

Definition at line 1664 of file moniker.c.

Referenced by MonikerMarshal_Create().

◆ VT_MonikerMarshalInner

const IUnknownVtbl VT_MonikerMarshalInner
static
Initial value:
=
{
}
static HRESULT WINAPI MonikerMarshalInner_QueryInterface(IUnknown *iface, REFIID riid, LPVOID *ppv)
Definition: moniker.c:1539
static ULONG WINAPI MonikerMarshalInner_AddRef(IUnknown *iface)
Definition: moniker.c:1554
static ULONG WINAPI MonikerMarshalInner_Release(IUnknown *iface)
Definition: moniker.c:1560

Definition at line 1569 of file moniker.c.

Referenced by MonikerMarshal_Create().

◆ VT_RunningObjectTableImpl

const IRunningObjectTableVtbl VT_RunningObjectTableImpl
static
Initial value:
=
{
}
static HRESULT WINAPI RunningObjectTableImpl_QueryInterface(IRunningObjectTable *iface, REFIID riid, void **ppvObject)
Definition: moniker.c:320
static ULONG WINAPI RunningObjectTableImpl_AddRef(IRunningObjectTable *iface)
Definition: moniker.c:350
static ULONG WINAPI RunningObjectTableImpl_Release(IRunningObjectTable *iface)
Definition: moniker.c:400
static HRESULT WINAPI RunningObjectTableImpl_NoteChangeTime(IRunningObjectTable *iface, DWORD dwRegister, FILETIME *pfiletime)
Definition: moniker.c:799
static HRESULT WINAPI RunningObjectTableImpl_Revoke(IRunningObjectTable *iface, DWORD dwRegister)
Definition: moniker.c:609
static HRESULT WINAPI RunningObjectTableImpl_GetTimeOfLastChange(IRunningObjectTable *iface, IMoniker *pmkObjectName, FILETIME *pfiletime)
Definition: moniker.c:853
static HRESULT WINAPI RunningObjectTableImpl_EnumRunning(IRunningObjectTable *iface, IEnumMoniker **ppenumMoniker)
Definition: moniker.c:924
static HRESULT WINAPI RunningObjectTableImpl_IsRunning(IRunningObjectTable *iface, IMoniker *pmkObjectName)
Definition: moniker.c:640
static HRESULT WINAPI RunningObjectTableImpl_GetObject(IRunningObjectTable *iface, IMoniker *pmkObjectName, IUnknown **ppunkObject)
Definition: moniker.c:705
static HRESULT WINAPI RunningObjectTableImpl_Register(IRunningObjectTable *iface, DWORD grfFlags, IUnknown *punkObject, IMoniker *pmkObjectName, DWORD *pdwRegister)
Definition: moniker.c:437

Definition at line 962 of file moniker.c.

Referenced by RunningObjectTableImpl_Initialize().