ReactOS 0.4.16-dev-2354-g16de117
compositemoniker.c File Reference
#include <assert.h>
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winerror.h"
#include "ole2.h"
#include "moniker.h"
#include "wine/debug.h"
Include dependency graph for compositemoniker.c:

Go to the source code of this file.

Classes

struct  CompositeMonikerImpl
 
struct  EnumMonikerImpl
 
struct  comp_node
 

Macros

#define COBJMACROS
 

Typedefs

typedef struct CompositeMonikerImpl CompositeMonikerImpl
 
typedef struct EnumMonikerImpl EnumMonikerImpl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static CompositeMonikerImplimpl_from_IMoniker (IMoniker *iface)
 
static CompositeMonikerImplunsafe_impl_from_IMoniker (IMoniker *iface)
 
static CompositeMonikerImplimpl_from_IROTData (IROTData *iface)
 
static CompositeMonikerImplimpl_from_IMarshal (IMarshal *iface)
 
static EnumMonikerImplimpl_from_IEnumMoniker (IEnumMoniker *iface)
 
static HRESULT create_enumerator (IMoniker **components, unsigned int count, BOOL forward, IEnumMoniker **ret)
 
static HRESULT composite_get_rightmost (CompositeMonikerImpl *composite, IMoniker **left, IMoniker **rightmost)
 
static HRESULT composite_get_leftmost (CompositeMonikerImpl *composite, IMoniker **leftmost)
 
static HRESULT WINAPI CompositeMonikerImpl_QueryInterface (IMoniker *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI CompositeMonikerImpl_AddRef (IMoniker *iface)
 
static ULONG WINAPI CompositeMonikerImpl_Release (IMoniker *iface)
 
static HRESULT WINAPI CompositeMonikerImpl_GetClassID (IMoniker *iface, CLSID *pClassID)
 
static HRESULT WINAPI CompositeMonikerImpl_IsDirty (IMoniker *iface)
 
static HRESULT WINAPI CompositeMonikerImpl_Load (IMoniker *iface, IStream *stream)
 
static HRESULT composite_save_components (IMoniker *moniker, IStream *stream)
 
static HRESULT WINAPI CompositeMonikerImpl_Save (IMoniker *iface, IStream *stream, BOOL clear_dirty)
 
static HRESULT WINAPI CompositeMonikerImpl_GetSizeMax (IMoniker *iface, ULARGE_INTEGER *pcbSize)
 
static HRESULT compose_with (IMoniker *left, IMoniker *right, IMoniker **c)
 
static HRESULT WINAPI CompositeMonikerImpl_BindToObject (IMoniker *iface, IBindCtx *pbc, IMoniker *toleft, REFIID riid, void **result)
 
static HRESULT WINAPI CompositeMonikerImpl_BindToStorage (IMoniker *iface, IBindCtx *pbc, IMoniker *toleft, REFIID riid, void **result)
 
static HRESULT WINAPI CompositeMonikerImpl_Reduce (IMoniker *iface, IBindCtx *pbc, DWORD howfar, IMoniker **toleft, IMoniker **reduced)
 
static HRESULT WINAPI CompositeMonikerImpl_ComposeWith (IMoniker *iface, IMoniker *right, BOOL only_if_not_generic, IMoniker **composite)
 
static void composite_get_components (IMoniker *moniker, IMoniker **components, unsigned int *index)
 
static HRESULT composite_get_components_alloc (IMoniker *iface, unsigned int *count, IMoniker ***components)
 
static HRESULT WINAPI CompositeMonikerImpl_Enum (IMoniker *iface, BOOL forward, IEnumMoniker **ret_enum)
 
static HRESULT WINAPI CompositeMonikerImpl_IsEqual (IMoniker *iface, IMoniker *other)
 
static HRESULT WINAPI CompositeMonikerImpl_Hash (IMoniker *iface, DWORD *hash)
 
static HRESULT WINAPI CompositeMonikerImpl_IsRunning (IMoniker *iface, IBindCtx *pbc, IMoniker *toleft, IMoniker *newly_running)
 
static HRESULT WINAPI CompositeMonikerImpl_GetTimeOfLastChange (IMoniker *iface, IBindCtx *pbc, IMoniker *toleft, FILETIME *changetime)
 
static HRESULT WINAPI CompositeMonikerImpl_Inverse (IMoniker *iface, IMoniker **inverse)
 
static HRESULT WINAPI CompositeMonikerImpl_CommonPrefixWith (IMoniker *iface, IMoniker *other, IMoniker **prefix)
 
static HRESULT composite_compose_components (IMoniker **comp, unsigned int count, IMoniker **ret)
 
static HRESULT WINAPI CompositeMonikerImpl_RelativePathTo (IMoniker *iface, IMoniker *other, IMoniker **relpath)
 
static HRESULT WINAPI CompositeMonikerImpl_GetDisplayName (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *displayname)
 
static HRESULT WINAPI CompositeMonikerImpl_ParseDisplayName (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR name, ULONG *eaten, IMoniker **result)
 
static HRESULT WINAPI CompositeMonikerImpl_IsSystemMoniker (IMoniker *iface, DWORD *pwdMksys)
 
static HRESULT WINAPI CompositeMonikerROTDataImpl_QueryInterface (IROTData *iface, REFIID riid, VOID **ppvObject)
 
static ULONG WINAPI CompositeMonikerROTDataImpl_AddRef (IROTData *iface)
 
static ULONG WINAPI CompositeMonikerROTDataImpl_Release (IROTData *iface)
 
static HRESULT composite_get_moniker_comparison_data (IMoniker *moniker, BYTE *data, ULONG max_len, ULONG *ret_len)
 
static HRESULT WINAPI CompositeMonikerROTDataImpl_GetComparisonData (IROTData *iface, BYTE *data, ULONG max_len, ULONG *ret_len)
 
static HRESULT WINAPI CompositeMonikerMarshalImpl_QueryInterface (IMarshal *iface, REFIID riid, LPVOID *ppv)
 
static ULONG WINAPI CompositeMonikerMarshalImpl_AddRef (IMarshal *iface)
 
static ULONG WINAPI CompositeMonikerMarshalImpl_Release (IMarshal *iface)
 
static HRESULT WINAPI CompositeMonikerMarshalImpl_GetUnmarshalClass (IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid)
 
static HRESULT WINAPI CompositeMonikerMarshalImpl_GetMarshalSizeMax (IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *pSize)
 
static HRESULT WINAPI CompositeMonikerMarshalImpl_MarshalInterface (IMarshal *iface, IStream *stream, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD flags)
 
static HRESULT WINAPI CompositeMonikerMarshalImpl_UnmarshalInterface (IMarshal *iface, IStream *stream, REFIID riid, void **ppv)
 
static HRESULT WINAPI CompositeMonikerMarshalImpl_ReleaseMarshalData (IMarshal *iface, IStream *pStm)
 
static HRESULT WINAPI CompositeMonikerMarshalImpl_DisconnectObject (IMarshal *iface, DWORD dwReserved)
 
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 count, IMoniker **m, ULONG *fetched)
 
static HRESULT WINAPI EnumMonikerImpl_Skip (IEnumMoniker *iface, ULONG count)
 
static HRESULT WINAPI EnumMonikerImpl_Reset (IEnumMoniker *iface)
 
static HRESULT WINAPI EnumMonikerImpl_Clone (IEnumMoniker *iface, IEnumMoniker **ret)
 
static HRESULT moniker_get_tree_representation (IMoniker *moniker, struct comp_node *parent, struct comp_node **ret)
 
static struct comp_nodemoniker_tree_get_rightmost (struct comp_node *root)
 
static struct comp_nodemoniker_tree_get_leftmost (struct comp_node *root)
 
static void moniker_tree_node_release (struct comp_node *node)
 
static void moniker_tree_release (struct comp_node *node)
 
static void moniker_tree_replace_node (struct comp_node *node, struct comp_node *replace_with)
 
static void moniker_tree_discard (struct comp_node *node, BOOL left)
 
static HRESULT moniker_create_from_tree (const struct comp_node *root, unsigned int *count, IMoniker **moniker)
 
static void moniker_get_tree_comp_count (const struct comp_node *root, unsigned int *count)
 
static HRESULT moniker_simplify_composition (IMoniker *left, IMoniker *right, unsigned int *count, IMoniker **new_left, IMoniker **new_right)
 
static HRESULT create_composite (IMoniker *left, IMoniker *right, IMoniker **moniker)
 
HRESULT WINAPI CreateGenericComposite (IMoniker *left, IMoniker *right, IMoniker **composite)
 
HRESULT WINAPI MonikerCommonPrefixWith (IMoniker *pmkThis, IMoniker *pmkOther, IMoniker **ppmkCommon)
 
HRESULT WINAPI CompositeMoniker_CreateInstance (IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv)
 

Variables

static const IMonikerVtbl VT_CompositeMonikerImpl
 
static const IEnumMonikerVtbl VT_EnumMonikerImpl
 
static const IROTDataVtbl VT_ROTDataImpl
 
static const IMarshalVtbl VT_MarshalImpl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file compositemoniker.c.

Typedef Documentation

◆ CompositeMonikerImpl

◆ EnumMonikerImpl

Function Documentation

◆ compose_with()

static HRESULT compose_with ( IMoniker left,
IMoniker right,
IMoniker **  c 
)
static

Definition at line 317 of file compositemoniker.c.

318{
319 HRESULT hr = IMoniker_ComposeWith(left, right, TRUE, c);
320 if (FAILED(hr) && hr != MK_E_NEEDGENERIC) return hr;
322}
HRESULT WINAPI CreateGenericComposite(IMoniker *left, IMoniker *right, IMoniker **composite)
#define TRUE
Definition: types.h:120
const GLubyte * c
Definition: glext.h:8905
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
#define MK_E_NEEDGENERIC
Definition: winerror.h:3893

Referenced by CompositeMonikerImpl_BindToObject(), CompositeMonikerImpl_BindToStorage(), and CompositeMonikerImpl_GetTimeOfLastChange().

◆ composite_compose_components()

static HRESULT composite_compose_components ( IMoniker **  comp,
unsigned int  count,
IMoniker **  ret 
)
static

Definition at line 800 of file compositemoniker.c.

801{
802 IMoniker *last, *c;
803 HRESULT hr = S_OK;
804 unsigned int i;
805
806 last = comp[0];
807 IMoniker_AddRef(last);
808
809 for (i = 1; i < count; ++i)
810 {
811 hr = CreateGenericComposite(last, comp[i], &c);
812 IMoniker_Release(last);
813 if (FAILED(hr)) break;
814 last = c;
815 }
816
817 *ret = SUCCEEDED(hr) ? last : NULL;
818
819 return hr;
820}
#define NULL
Definition: types.h:112
return ret
Definition: mutex.c:146
GLuint GLuint GLsizei count
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 S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define c
Definition: ke_i.h:80
static UINT UINT last
Definition: font.c:45

Referenced by CompositeMonikerImpl_RelativePathTo().

◆ composite_get_components()

static void composite_get_components ( IMoniker moniker,
IMoniker **  components,
unsigned int index 
)
static

Definition at line 459 of file compositemoniker.c.

460{
461 CompositeMonikerImpl *comp_moniker;
462
463 if ((comp_moniker = unsafe_impl_from_IMoniker(moniker)))
464 {
467 }
468 else
469 {
471 (*index)++;
472 }
473}
#define index(s, c)
Definition: various.h:29
static CompositeMonikerImpl * unsafe_impl_from_IMoniker(IMoniker *iface)
static void composite_get_components(IMoniker *moniker, IMoniker **components, unsigned int *index)
GLenum GLenum GLuint components
Definition: glext.h:9620
GLuint index
Definition: glext.h:6031
Definition: main.c:40

Referenced by composite_get_components(), and composite_get_components_alloc().

◆ composite_get_components_alloc()

static HRESULT composite_get_components_alloc ( IMoniker iface,
unsigned int count,
IMoniker ***  components 
)
static

Definition at line 475 of file compositemoniker.c.

476{
478 unsigned int index;
479
480 if ((moniker = unsafe_impl_from_IMoniker(iface)))
481 *count = moniker->comp_count;
482 else
483 *count = 1;
484
485 if (!(*components = malloc(*count * sizeof(**components))))
486 return E_OUTOFMEMORY;
487
488 index = 0;
490
491 return S_OK;
492}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define malloc
Definition: debug_ros.c:4

Referenced by CompositeMonikerImpl_CommonPrefixWith(), CompositeMonikerImpl_Enum(), CompositeMonikerImpl_IsEqual(), and CompositeMonikerImpl_RelativePathTo().

◆ composite_get_leftmost()

static HRESULT composite_get_leftmost ( CompositeMonikerImpl composite,
IMoniker **  leftmost 
)
static

Definition at line 1648 of file compositemoniker.c.

1649{
1650 struct comp_node *root, *node;
1651 HRESULT hr;
1652
1653 if (!unsafe_impl_from_IMoniker(composite->left))
1654 {
1655 *leftmost = composite->left;
1656 IMoniker_AddRef(*leftmost);
1657 return S_OK;
1658 }
1659
1661 return hr;
1662
1664 {
1665 WARN("Couldn't get left most component.\n");
1667 return E_FAIL;
1668 }
1669
1670 *leftmost = node->moniker;
1671 IMoniker_AddRef(*leftmost);
1672
1674
1675 return S_OK;
1676}
#define WARN(fmt,...)
Definition: precomp.h:61
struct _root root
static HRESULT moniker_get_tree_representation(IMoniker *moniker, struct comp_node *parent, struct comp_node **ret)
static struct comp_node * moniker_tree_get_leftmost(struct comp_node *root)
static void moniker_tree_release(struct comp_node *node)
#define E_FAIL
Definition: ddrawi.h:102
Definition: dlist.c:348

Referenced by CompositeMonikerImpl_CommonPrefixWith().

◆ composite_get_moniker_comparison_data()

static HRESULT composite_get_moniker_comparison_data ( IMoniker moniker,
BYTE data,
ULONG  max_len,
ULONG ret_len 
)
static

Definition at line 1019 of file compositemoniker.c.

1021{
1022 IROTData *rot_data;
1023 HRESULT hr;
1024
1025 if (FAILED(hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rot_data)))
1026 {
1027 WARN("Failed to get IROTData for component moniker, hr %#lx.\n", hr);
1028 return hr;
1029 }
1030
1031 hr = IROTData_GetComparisonData(rot_data, data, max_len, ret_len);
1032 IROTData_Release(rot_data);
1033
1034 return hr;
1035}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static JOBOBJECTINFOCLASS LPVOID DWORD LPDWORD ret_len
Definition: process.c:81

Referenced by CompositeMonikerROTDataImpl_GetComparisonData().

◆ composite_get_rightmost()

static HRESULT composite_get_rightmost ( CompositeMonikerImpl composite,
IMoniker **  left,
IMoniker **  rightmost 
)
static

Definition at line 1605 of file compositemoniker.c.

1606{
1607 struct comp_node *root, *node;
1608 unsigned int count;
1609 HRESULT hr;
1610
1611 /* Shortcut for trivial case when right component is non-composite */
1612 if (!unsafe_impl_from_IMoniker(composite->right))
1613 {
1614 *left = composite->left;
1615 IMoniker_AddRef(*left);
1616 *rightmost = composite->right;
1617 IMoniker_AddRef(*rightmost);
1618 return S_OK;
1619 }
1620
1621 *left = *rightmost = NULL;
1622
1624 return hr;
1625
1627 {
1628 WARN("Couldn't get right most component.\n");
1630 return E_FAIL;
1631 }
1632
1633 *rightmost = node->moniker;
1634 IMoniker_AddRef(*rightmost);
1636
1639 if (FAILED(hr))
1640 {
1641 IMoniker_Release(*rightmost);
1642 *rightmost = NULL;
1643 }
1644
1645 return hr;
1646}
static void moniker_tree_discard(struct comp_node *node, BOOL left)
static struct comp_node * moniker_tree_get_rightmost(struct comp_node *root)
static HRESULT moniker_create_from_tree(const struct comp_node *root, unsigned int *count, IMoniker **moniker)

Referenced by CompositeMonikerImpl_BindToObject(), CompositeMonikerImpl_BindToStorage(), CompositeMonikerImpl_GetTimeOfLastChange(), CompositeMonikerImpl_IsRunning(), and CompositeMonikerImpl_ParseDisplayName().

◆ composite_save_components()

static HRESULT composite_save_components ( IMoniker moniker,
IStream stream 
)
static

Definition at line 248 of file compositemoniker.c.

249{
250 CompositeMonikerImpl *comp_moniker;
251 HRESULT hr;
252
253 if ((comp_moniker = unsafe_impl_from_IMoniker(moniker)))
254 {
255 if (SUCCEEDED(hr = composite_save_components(comp_moniker->left, stream)))
256 hr = composite_save_components(comp_moniker->right, stream);
257 }
258 else
260
261 return hr;
262}
static HRESULT composite_save_components(IMoniker *moniker, IStream *stream)
HRESULT WINAPI OleSaveToStream(IPersistStream *pPStm, IStream *pStm)
Definition: storage32.c:9036
Definition: parse.h:23

Referenced by composite_save_components(), and CompositeMonikerImpl_Save().

◆ CompositeMoniker_CreateInstance()

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

Definition at line 1826 of file compositemoniker.c.

1828{
1829 IMoniker* pMoniker;
1830 HRESULT hr;
1831
1832 TRACE("(%p, %s, %p)\n", pUnk, debugstr_guid(riid), ppv);
1833
1834 *ppv = NULL;
1835
1836 if (pUnk)
1837 return CLASS_E_NOAGGREGATION;
1838
1839 hr = create_composite(NULL, NULL, &pMoniker);
1840
1841 if (SUCCEEDED(hr))
1842 {
1843 hr = IMoniker_QueryInterface(pMoniker, riid, ppv);
1844 IMoniker_Release(pMoniker);
1845 }
1846
1847 return hr;
1848}
static HRESULT create_composite(IMoniker *left, IMoniker *right, IMoniker **moniker)
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771

◆ CompositeMonikerImpl_AddRef()

static ULONG WINAPI CompositeMonikerImpl_AddRef ( IMoniker iface)
static

Definition at line 135 of file compositemoniker.c.

136{
138
139 TRACE("(%p)\n",This);
140
141 return InterlockedIncrement(&This->ref);
142}
#define InterlockedIncrement
Definition: armddk.h:53
static CompositeMonikerImpl * impl_from_IMoniker(IMoniker *iface)

Referenced by CompositeMonikerMarshalImpl_AddRef().

◆ CompositeMonikerImpl_BindToObject()

static HRESULT WINAPI CompositeMonikerImpl_BindToObject ( IMoniker iface,
IBindCtx pbc,
IMoniker toleft,
REFIID  riid,
void **  result 
)
static

Definition at line 324 of file compositemoniker.c.

326{
328 IMoniker *left, *rightmost, *c;
331 HRESULT hr;
332
333 TRACE("%p, %p, %p, %s, %p.\n", iface, pbc, toleft, debugstr_guid(riid), result);
334
335 if (!result)
336 return E_POINTER;
337
338 *result = NULL;
339
340 if (!toleft)
341 {
342 hr = IBindCtx_GetRunningObjectTable(pbc, &rot);
343 if (SUCCEEDED(hr))
344 {
345 hr = IRunningObjectTable_GetObject(rot, iface, &object);
346 IRunningObjectTable_Release(rot);
347 if (FAILED(hr)) return E_INVALIDARG;
348
349 hr = IUnknown_QueryInterface(object, riid, result);
350 IUnknown_Release(object);
351 }
352
353 return hr;
354 }
355
356 /* Try to bind rightmost component with (toleft, composite->left) composite at its left side */
357 if (FAILED(hr = composite_get_rightmost(moniker, &left, &rightmost)))
358 return hr;
359
360 hr = compose_with(toleft, left, &c);
361 IMoniker_Release(left);
362
363 if (SUCCEEDED(hr))
364 {
365 hr = IMoniker_BindToObject(rightmost, pbc, c, riid, result);
366 IMoniker_Release(c);
367 }
368
369 IMoniker_Release(rightmost);
370
371 return hr;
372}
GLfloat rot
Definition: 3dtext.c:36
static HRESULT compose_with(IMoniker *left, IMoniker *right, IMoniker **c)
static HRESULT composite_get_rightmost(CompositeMonikerImpl *composite, IMoniker **left, IMoniker **rightmost)
#define E_INVALIDARG
Definition: ddrawi.h:101
GLuint64EXT * result
Definition: glext.h:11304
#define E_POINTER
Definition: winerror.h:3480

◆ CompositeMonikerImpl_BindToStorage()

static HRESULT WINAPI CompositeMonikerImpl_BindToStorage ( IMoniker iface,
IBindCtx pbc,
IMoniker toleft,
REFIID  riid,
void **  result 
)
static

Definition at line 374 of file compositemoniker.c.

376{
378 IMoniker *left, *rightmost, *composed_left;
379 HRESULT hr;
380
381 TRACE("%p, %p, %p, %s, %p.\n", iface, pbc, toleft, debugstr_guid(riid), result);
382
383 *result = NULL;
384
385 if (FAILED(hr = composite_get_rightmost(moniker, &left, &rightmost)))
386 return hr;
387
388 if (toleft)
389 {
390 hr = compose_with(toleft, left, &composed_left);
391 }
392 else
393 {
394 composed_left = left;
395 IMoniker_AddRef(composed_left);
396 }
397
398 if (SUCCEEDED(hr))
399 {
400 hr = IMoniker_BindToStorage(rightmost, pbc, composed_left, riid, result);
401 IMoniker_Release(composed_left);
402 }
403
404 IMoniker_Release(rightmost);
405 IMoniker_Release(left);
406
407 return hr;
408}

◆ CompositeMonikerImpl_CommonPrefixWith()

static HRESULT WINAPI CompositeMonikerImpl_CommonPrefixWith ( IMoniker iface,
IMoniker other,
IMoniker **  prefix 
)
static

Definition at line 698 of file compositemoniker.c.

700{
701 CompositeMonikerImpl *moniker = impl_from_IMoniker(iface), *other_moniker;
702 unsigned int i, count, prefix_len = 0;
703 IMoniker *leftmost;
704 HRESULT hr;
705
706 TRACE("%p, %p, %p.\n", iface, other, prefix);
707
708 /* If the other moniker is a composite, this method compares the components of each composite from left */
709 /* to right. The returned common prefix moniker might also be a composite moniker, depending on how many */
710 /* of the leftmost components were common to both monikers. */
711
712 if (prefix)
713 *prefix = NULL;
714
715 if (!other || !prefix)
716 return E_INVALIDARG;
717
718 if ((other_moniker = unsafe_impl_from_IMoniker(other)))
719 {
720 IMoniker **components, **other_components, **prefix_components;
721 IMoniker *last, *c;
722
723 if (FAILED(hr = composite_get_components_alloc(iface, &count, &components))) return hr;
724 if (FAILED(hr = composite_get_components_alloc(other, &count, &other_components)))
725 {
727 return hr;
728 }
729
730 count = min(moniker->comp_count, other_moniker->comp_count);
731 if (!(prefix_components = calloc(count, sizeof(*prefix_components))))
732 {
734 free(other_components);
735 return E_OUTOFMEMORY;
736 }
737
738 /* Collect prefix components */
739 for (i = 0; i < count; ++i)
740 {
741 IMoniker *p;
742
743 if (FAILED(hr = IMoniker_CommonPrefixWith(components[i], other_components[i], &p)))
744 break;
745 prefix_components[prefix_len++] = p;
746 /* S_OK means that prefix was found and is neither of tested monikers */
747 if (hr == S_OK) break;
748 }
749
751 free(other_components);
752
753 if (!prefix_len)
754 {
755 free(prefix_components);
756 return MK_E_NOPREFIX;
757 }
758
759 last = prefix_components[0];
760 for (i = 1; i < prefix_len; ++i)
761 {
762 hr = CreateGenericComposite(last, prefix_components[i], &c);
763 IMoniker_Release(last);
764 IMoniker_Release(prefix_components[i]);
765 if (FAILED(hr)) break;
766 last = c;
767 }
768 free(prefix_components);
769
770 if (SUCCEEDED(hr))
771 {
772 *prefix = last;
773 if (IMoniker_IsEqual(iface, *prefix) == S_OK)
774 hr = MK_S_US;
775 else if (prefix_len < count)
776 hr = S_OK;
777 else
778 hr = prefix_len == moniker->comp_count ? MK_S_ME : MK_S_HIM;
779 }
780
781 return hr;
782 }
783
784 /* For non-composite, compare to leftmost component */
785 if (SUCCEEDED(hr = composite_get_leftmost(moniker, &leftmost)))
786 {
787 if ((hr = IMoniker_IsEqual(leftmost, other)) == S_OK)
788 {
789 *prefix = leftmost;
790 IMoniker_AddRef(*prefix);
791 }
792
794 IMoniker_Release(leftmost);
795 }
796
797 return hr;
798}
static HRESULT composite_get_leftmost(CompositeMonikerImpl *composite, IMoniker **leftmost)
static HRESULT composite_get_components_alloc(IMoniker *iface, unsigned int *count, IMoniker ***components)
#define free
Definition: debug_ros.c:5
GLfloat GLfloat p
Definition: glext.h:8902
#define min(a, b)
Definition: monoChain.cc:55
int other
Definition: msacm.c:1376
#define calloc
Definition: rosglue.h:14
Character const *const prefix
Definition: tempnam.cpp:195
#define MK_E_NOPREFIX
Definition: winerror.h:3909
#define MK_S_ME
Definition: winerror.h:3895
#define MK_S_HIM
Definition: winerror.h:3897
#define MK_S_US
Definition: winerror.h:3899

◆ CompositeMonikerImpl_ComposeWith()

static HRESULT WINAPI CompositeMonikerImpl_ComposeWith ( IMoniker iface,
IMoniker right,
BOOL  only_if_not_generic,
IMoniker **  composite 
)
static

Definition at line 449 of file compositemoniker.c.

451{
452 TRACE("%p, %p, %d, %p.\n", iface, right, only_if_not_generic, composite);
453
454 *composite = NULL;
455
456 return only_if_not_generic ? MK_E_NEEDGENERIC : CreateGenericComposite(iface, right, composite);
457}

◆ CompositeMonikerImpl_Enum()

static HRESULT WINAPI CompositeMonikerImpl_Enum ( IMoniker iface,
BOOL  forward,
IEnumMoniker **  ret_enum 
)
static

Definition at line 494 of file compositemoniker.c.

495{
496 IMoniker **monikers;
497 unsigned int count;
498 HRESULT hr;
499
500 TRACE("%p, %d, %p\n", iface, forward, ret_enum);
501
502 if (!ret_enum)
503 return E_INVALIDARG;
504
505 if (FAILED(hr = composite_get_components_alloc(iface, &count, &monikers)))
506 return hr;
507
508 hr = create_enumerator(monikers, count, forward, ret_enum);
509 free(monikers);
510
511 return hr;
512}
static HRESULT create_enumerator(IMoniker **components, unsigned int count, BOOL forward, IEnumMoniker **ret)

◆ CompositeMonikerImpl_GetClassID()

static HRESULT WINAPI CompositeMonikerImpl_GetClassID ( IMoniker iface,
CLSID pClassID 
)
static

Definition at line 165 of file compositemoniker.c.

166{
167 TRACE("(%p,%p)\n",iface,pClassID);
168
169 if (pClassID==NULL)
170 return E_POINTER;
171
172 *pClassID = CLSID_CompositeMoniker;
173
174 return S_OK;
175}

◆ CompositeMonikerImpl_GetDisplayName()

static HRESULT WINAPI CompositeMonikerImpl_GetDisplayName ( IMoniker iface,
IBindCtx pbc,
IMoniker pmkToLeft,
LPOLESTR displayname 
)
static

Definition at line 905 of file compositemoniker.c.

907{
909 WCHAR *left_name = NULL, *right_name = NULL;
910 HRESULT hr;
911
912 TRACE("%p, %p, %p, %p\n", iface, pbc, pmkToLeft, displayname);
913
914 if (!pbc || !displayname || !moniker->comp_count)
915 return E_INVALIDARG;
916
917 if (FAILED(hr = IMoniker_GetDisplayName(moniker->left, pbc, NULL, &left_name))) return hr;
918 if (FAILED(hr = IMoniker_GetDisplayName(moniker->right, pbc, NULL, &right_name)))
919 {
920 CoTaskMemFree(left_name);
921 return hr;
922 }
923
924 if (!(*displayname = CoTaskMemAlloc((lstrlenW(left_name) + lstrlenW(right_name) + 1) * sizeof(WCHAR))))
925 {
926 CoTaskMemFree(left_name);
927 CoTaskMemFree(right_name);
928 return E_OUTOFMEMORY;
929 }
930
931 lstrcpyW(*displayname, left_name);
932 lstrcatW(*displayname, right_name);
933
934 CoTaskMemFree(left_name);
935 CoTaskMemFree(right_name);
936
937 return S_OK;
938}
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ CompositeMonikerImpl_GetSizeMax()

static HRESULT WINAPI CompositeMonikerImpl_GetSizeMax ( IMoniker iface,
ULARGE_INTEGER pcbSize 
)
static

Definition at line 284 of file compositemoniker.c.

285{
286 IEnumMoniker *enumMk;
287 IMoniker *pmk;
288 ULARGE_INTEGER ptmpSize;
289
290 /* The sizeMax of this object is calculated by calling GetSizeMax on
291 * each moniker within this object then summing all returned values
292 */
293
294 TRACE("(%p,%p)\n",iface,pcbSize);
295
296 if (!pcbSize)
297 return E_POINTER;
298
299 pcbSize->QuadPart = sizeof(DWORD);
300
301 IMoniker_Enum(iface,TRUE,&enumMk);
302
303 while(IEnumMoniker_Next(enumMk,1,&pmk,NULL)==S_OK){
304
305 IMoniker_GetSizeMax(pmk,&ptmpSize);
306
307 IMoniker_Release(pmk);
308
309 pcbSize->QuadPart += ptmpSize.QuadPart + sizeof(CLSID);
310 }
311
312 IEnumMoniker_Release(enumMk);
313
314 return S_OK;
315}
IID CLSID
Definition: mstsclib_i.c:62
#define DWORD
Definition: nt_native.h:44
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185

◆ CompositeMonikerImpl_GetTimeOfLastChange()

static HRESULT WINAPI CompositeMonikerImpl_GetTimeOfLastChange ( IMoniker iface,
IBindCtx pbc,
IMoniker toleft,
FILETIME changetime 
)
static

Definition at line 620 of file compositemoniker.c.

622{
624 IMoniker *left, *rightmost, *composed_left = NULL, *running = NULL;
626 HRESULT hr;
627
628 TRACE("%p, %p, %p, %p.\n", iface, pbc, toleft, changetime);
629
630 if (!changetime || !pbc)
631 return E_INVALIDARG;
632
633 if (FAILED(hr = composite_get_rightmost(moniker, &left, &rightmost)))
634 return hr;
635
636 if (toleft)
637 {
638 /* Compose (toleft, left) and check that against rightmost */
639 if (SUCCEEDED(hr = compose_with(toleft, left, &composed_left)) && composed_left)
640 hr = compose_with(composed_left, rightmost, &running);
641 }
642 else
643 {
644 composed_left = left;
645 IMoniker_AddRef(composed_left);
646 running = iface;
647 IMoniker_AddRef(running);
648 }
649
650 if (SUCCEEDED(hr))
651 {
652 if (SUCCEEDED(hr = IBindCtx_GetRunningObjectTable(pbc, &rot)))
653 {
654 if (IRunningObjectTable_GetTimeOfLastChange(rot, running, changetime) != S_OK)
655 hr = IMoniker_GetTimeOfLastChange(rightmost, pbc, composed_left, changetime);
656 IRunningObjectTable_Release(rot);
657 }
658 }
659
660 if (composed_left)
661 IMoniker_Release(composed_left);
662 if (running)
663 IMoniker_Release(running);
664 IMoniker_Release(rightmost);
665 IMoniker_Release(left);
666
667 return hr;
668}

◆ CompositeMonikerImpl_Hash()

static HRESULT WINAPI CompositeMonikerImpl_Hash ( IMoniker iface,
DWORD hash 
)
static

Definition at line 551 of file compositemoniker.c.

552{
554 DWORD left_hash, right_hash;
555 HRESULT hr;
556
557 TRACE("%p, %p\n", iface, hash);
558
559 if (!hash)
560 return E_POINTER;
561
562 if (!moniker->comp_count)
563 return E_UNEXPECTED;
564
565 *hash = 0;
566
567 if (FAILED(hr = IMoniker_Hash(moniker->left, &left_hash))) return hr;
568 if (FAILED(hr = IMoniker_Hash(moniker->right, &right_hash))) return hr;
569
570 *hash = left_hash ^ right_hash;
571
572 return hr;
573}
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: _hash_fun.h:40
#define E_UNEXPECTED
Definition: winerror.h:3528

◆ CompositeMonikerImpl_Inverse()

static HRESULT WINAPI CompositeMonikerImpl_Inverse ( IMoniker iface,
IMoniker **  inverse 
)
static

Definition at line 670 of file compositemoniker.c.

671{
673 IMoniker *right_inverted, *left_inverted;
674 HRESULT hr;
675
676 TRACE("%p, %p.\n", iface, inverse);
677
678 if (!inverse)
679 return E_INVALIDARG;
680
681 *inverse = NULL;
682
683 if (FAILED(hr = IMoniker_Inverse(moniker->right, &right_inverted))) return hr;
684 if (FAILED(hr = IMoniker_Inverse(moniker->left, &left_inverted)))
685 {
686 IMoniker_Release(right_inverted);
687 return hr;
688 }
689
690 hr = CreateGenericComposite(right_inverted, left_inverted, inverse);
691
692 IMoniker_Release(left_inverted);
693 IMoniker_Release(right_inverted);
694
695 return hr;
696}

◆ CompositeMonikerImpl_IsDirty()

static HRESULT WINAPI CompositeMonikerImpl_IsDirty ( IMoniker iface)
static

Definition at line 181 of file compositemoniker.c.

182{
183 /* Note that the OLE-provided implementations of the IPersistStream::IsDirty
184 method in the OLE-provided moniker interfaces always return S_FALSE because
185 their internal state never changes. */
186
187 TRACE("(%p)\n",iface);
188
189 return S_FALSE;
190}
#define S_FALSE
Definition: winerror.h:3451

◆ CompositeMonikerImpl_IsEqual()

static HRESULT WINAPI CompositeMonikerImpl_IsEqual ( IMoniker iface,
IMoniker other 
)
static

Definition at line 514 of file compositemoniker.c.

515{
516 CompositeMonikerImpl *moniker = impl_from_IMoniker(iface), *other_moniker;
517 IMoniker **components, **other_components;
518 unsigned int i, count;
519 HRESULT hr;
520
521 TRACE("%p, %p.\n", iface, other);
522
523 if (!other)
524 return E_INVALIDARG;
525
526 if (!(other_moniker = unsafe_impl_from_IMoniker(other)))
527 return S_FALSE;
528
529 if (moniker->comp_count != other_moniker->comp_count)
530 return S_FALSE;
531
532 if (FAILED(hr = composite_get_components_alloc(iface, &count, &components))) return hr;
533 if (FAILED(hr = composite_get_components_alloc(other, &count, &other_components)))
534 {
536 return hr;
537 }
538
539 for (i = 0; i < moniker->comp_count; ++i)
540 {
541 if ((hr = IMoniker_IsEqual(components[i], other_components[i]) != S_OK))
542 break;
543 }
544
545 free(other_components);
547
548 return hr;
549}

◆ CompositeMonikerImpl_IsRunning()

static HRESULT WINAPI CompositeMonikerImpl_IsRunning ( IMoniker iface,
IBindCtx pbc,
IMoniker toleft,
IMoniker newly_running 
)
static

Definition at line 575 of file compositemoniker.c.

577{
579 IMoniker *c, *left, *rightmost;
581 HRESULT hr;
582
583 TRACE("%p, %p, %p, %p.\n", iface, pbc, toleft, newly_running);
584
585 if (!pbc)
586 return E_INVALIDARG;
587
588 if (toleft)
589 {
590 if (SUCCEEDED(hr = CreateGenericComposite(toleft, iface, &c)))
591 {
592 hr = IMoniker_IsRunning(c, pbc, NULL, newly_running);
593 IMoniker_Release(c);
594 }
595
596 return hr;
597 }
598
599 if (newly_running)
600 return IMoniker_IsEqual(iface, newly_running);
601
602 if (FAILED(hr = IBindCtx_GetRunningObjectTable(pbc, &rot)))
603 return hr;
604
605 hr = IRunningObjectTable_IsRunning(rot, iface);
606 IRunningObjectTable_Release(rot);
607 if (hr == S_OK) return S_OK;
608
609 if (FAILED(hr = composite_get_rightmost(moniker, &left, &rightmost)))
610 return hr;
611
612 hr = IMoniker_IsRunning(rightmost, pbc, left, NULL);
613
614 IMoniker_Release(left);
615 IMoniker_Release(rightmost);
616
617 return hr;
618}

◆ CompositeMonikerImpl_IsSystemMoniker()

static HRESULT WINAPI CompositeMonikerImpl_IsSystemMoniker ( IMoniker iface,
DWORD pwdMksys 
)
static

Definition at line 968 of file compositemoniker.c.

969{
970 TRACE("(%p,%p)\n",iface,pwdMksys);
971
972 if (!pwdMksys)
973 return E_POINTER;
974
975 (*pwdMksys)=MKSYS_GENERICCOMPOSITE;
976
977 return S_OK;
978}

◆ CompositeMonikerImpl_Load()

static HRESULT WINAPI CompositeMonikerImpl_Load ( IMoniker iface,
IStream stream 
)
static

Definition at line 192 of file compositemoniker.c.

193{
195 IMoniker *last, *m, *c;
196 DWORD i, count;
197 HRESULT hr;
198
199 TRACE("%p, %p\n", iface, stream);
200
201 if (moniker->comp_count)
202 return E_UNEXPECTED;
203
204 hr = IStream_Read(stream, &count, sizeof(DWORD), NULL);
205 if (hr != S_OK)
206 {
207 WARN("Failed to read component count, hr %#lx.\n", hr);
208 return hr;
209 }
210
211 if (count < 2)
212 {
213 WARN("Unexpected component count %lu.\n", count);
214 return E_UNEXPECTED;
215 }
216
217 if (FAILED(hr = OleLoadFromStream(stream, &IID_IMoniker, (void **)&last)))
218 return hr;
219
220 for (i = 1; i < count - 1; ++i)
221 {
222 if (FAILED(hr = OleLoadFromStream(stream, &IID_IMoniker, (void **)&m)))
223 {
224 WARN("Failed to initialize component %lu, hr %#lx.\n", i, hr);
225 IMoniker_Release(last);
226 return hr;
227 }
229 IMoniker_Release(last);
230 IMoniker_Release(m);
231 if (FAILED(hr)) return hr;
232 last = c;
233 }
234
235 if (FAILED(hr = OleLoadFromStream(stream, &IID_IMoniker, (void **)&m)))
236 {
237 IMoniker_Release(last);
238 return hr;
239 }
240
241 moniker->left = last;
242 moniker->right = m;
243 moniker->comp_count = count;
244
245 return hr;
246}
HRESULT WINAPI OleLoadFromStream(IStream *pStm, REFIID iidInterface, void **ppvObj)
Definition: storage32.c:9001
const GLfloat * m
Definition: glext.h:10848

◆ CompositeMonikerImpl_ParseDisplayName()

static HRESULT WINAPI CompositeMonikerImpl_ParseDisplayName ( IMoniker iface,
IBindCtx pbc,
IMoniker pmkToLeft,
LPOLESTR  name,
ULONG eaten,
IMoniker **  result 
)
static

Definition at line 940 of file compositemoniker.c.

942{
944 IMoniker *left, *rightmost;
945 HRESULT hr;
946
947 TRACE("%p, %p, %p, %s, %p, %p.\n", iface, pbc, pmkToLeft, debugstr_w(name), eaten, result);
948
949 if (!pbc)
950 return E_INVALIDARG;
951
952 if (FAILED(hr = composite_get_rightmost(moniker, &left, &rightmost)))
953 return hr;
954
955 /* Let rightmost component parse the name, using what's left of the composite as a left side. */
956 hr = IMoniker_ParseDisplayName(rightmost, pbc, left, name, eaten, result);
957
958 IMoniker_Release(left);
959 IMoniker_Release(rightmost);
960
961 return hr;
962}
#define debugstr_w
Definition: kernel32.h:32
Definition: name.c:39

◆ CompositeMonikerImpl_QueryInterface()

static HRESULT WINAPI CompositeMonikerImpl_QueryInterface ( IMoniker iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 96 of file compositemoniker.c.

97{
99
100 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppvObject);
101
102 /* Perform a sanity check on the parameters.*/
103 if ( ppvObject==0 )
104 return E_INVALIDARG;
105
106 /* Initialize the return parameter */
107 *ppvObject = 0;
108
109 /* Compare the riid with the interface IDs implemented by this object.*/
113 IsEqualIID(&IID_IMoniker, riid)
114 )
115 *ppvObject = iface;
116 else if (IsEqualIID(&IID_IROTData, riid))
117 *ppvObject = &This->IROTData_iface;
118 else if (IsEqualIID(&IID_IMarshal, riid))
119 *ppvObject = &This->IMarshal_iface;
120
121 /* Check that we obtained an interface.*/
122 if ((*ppvObject)==0)
123 return E_NOINTERFACE;
124
125 /* Query Interface always increases the reference count by one when it is successful */
126 IMoniker_AddRef(iface);
127
128 return S_OK;
129}
const GUID IID_IUnknown
const GUID IID_IPersist
Definition: proxy.cpp:14
const GUID IID_IPersistStream
Definition: proxy.cpp:13
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:3479

Referenced by CompositeMonikerMarshalImpl_QueryInterface(), and CompositeMonikerROTDataImpl_QueryInterface().

◆ CompositeMonikerImpl_Reduce()

static HRESULT WINAPI CompositeMonikerImpl_Reduce ( IMoniker iface,
IBindCtx pbc,
DWORD  howfar,
IMoniker **  toleft,
IMoniker **  reduced 
)
static

Definition at line 410 of file compositemoniker.c.

412{
414 IMoniker *m, *reduced_left, *reduced_right;
415 BOOL was_reduced;
416 HRESULT hr;
417
418 TRACE("%p, %p, %ld, %p, %p.\n", iface, pbc, howfar, toleft, reduced);
419
420 if (!pbc || !reduced)
421 return E_INVALIDARG;
422
423 if (FAILED(hr = IMoniker_Reduce(moniker->left, pbc, howfar, NULL, &reduced_left)))
424 return hr;
425
426 m = moniker->left;
427 if (FAILED(hr = IMoniker_Reduce(moniker->right, pbc, howfar, &m, &reduced_right)))
428 {
429 IMoniker_Release(reduced_left);
430 return hr;
431 }
432
433 if ((was_reduced = (reduced_left != moniker->left || reduced_right != moniker->right)))
434 {
435 hr = CreateGenericComposite(reduced_left, reduced_right, reduced);
436 }
437 else
438 {
439 *reduced = iface;
440 IMoniker_AddRef(*reduced);
441 }
442
443 IMoniker_Release(reduced_left);
444 IMoniker_Release(reduced_right);
445
446 return was_reduced ? hr : MK_S_REDUCED_TO_SELF;
447}
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MK_S_REDUCED_TO_SELF
Definition: winerror.h:3892

◆ CompositeMonikerImpl_RelativePathTo()

static HRESULT WINAPI CompositeMonikerImpl_RelativePathTo ( IMoniker iface,
IMoniker other,
IMoniker **  relpath 
)
static

Definition at line 822 of file compositemoniker.c.

824{
825 unsigned int count, this_count, other_count, prefix_len = 0;
826 IMoniker *inv, *tail = NULL, *other_tail = NULL, *rel = NULL;
827 IMoniker **components, **other_components;
828 unsigned int start = 0, other_start = 0;
829 HRESULT hr;
830
831 TRACE("%p, %p, %p.\n", iface, other, relpath);
832
833 if (!relpath)
834 return E_INVALIDARG;
835
836 *relpath = NULL;
837
838 if (FAILED(hr = composite_get_components_alloc(iface, &this_count, &components))) return hr;
839 if (FAILED(hr = composite_get_components_alloc(other, &other_count, &other_components)))
840 {
842 return hr;
843 }
844
845 /* Skip common prefix of equal components */
846 count = min(other_count, this_count);
847 while (IMoniker_IsEqual(components[prefix_len], other_components[prefix_len]) == S_OK)
848 {
849 if (++prefix_len == count) break;
850 }
851
852 if (prefix_len)
853 {
854 this_count -= prefix_len;
855 other_count -= prefix_len;
856 other_start += prefix_len;
857 start += prefix_len;
858 }
859 else
860 {
861 /* Replace first component of the other tail with relative path */
862 if (SUCCEEDED(hr = IMoniker_RelativePathTo(*components, *other_components, &rel)))
863 *other_components = rel;
864
865 this_count--;
866 start++;
867 }
868
869 /* Invert left side tail */
870 if (this_count && SUCCEEDED(hr))
871 {
873 {
874 hr = IMoniker_Inverse(tail, &inv);
875 IMoniker_Release(tail);
876 tail = inv;
877 }
878 }
879
880 if (other_count && SUCCEEDED(hr))
881 hr = composite_compose_components(&other_components[other_start], other_count, &other_tail);
882
883 if (tail || other_tail)
884 hr = CreateGenericComposite(tail, other_tail, relpath);
885 else if (SUCCEEDED(hr))
886 {
887 *relpath = other;
888 IMoniker_AddRef(*relpath);
889 hr = MK_S_HIM;
890 }
891
892 if (rel)
893 IMoniker_Release(rel);
894 if (tail)
895 IMoniker_Release(tail);
896 if (other_tail)
897 IMoniker_Release(other_tail);
898
899 free(other_components);
901
902 return hr;
903}
struct outqueuenode * tail
Definition: adnsresfilter.c:66
static HRESULT composite_compose_components(IMoniker **comp, unsigned int count, IMoniker **ret)
GLuint start
Definition: gl.h:1545

◆ CompositeMonikerImpl_Release()

static ULONG WINAPI CompositeMonikerImpl_Release ( IMoniker iface)
static

Definition at line 144 of file compositemoniker.c.

145{
147 ULONG refcount = InterlockedDecrement(&moniker->ref);
148
149 TRACE("%p, refcount %lu\n", iface, refcount);
150
151 if (!refcount)
152 {
153 if (moniker->left) IMoniker_Release(moniker->left);
154 if (moniker->right) IMoniker_Release(moniker->right);
155 free(moniker);
156 }
157
158 return refcount;
159}
#define InterlockedDecrement
Definition: armddk.h:52
uint32_t ULONG
Definition: typedefs.h:59

Referenced by CompositeMonikerMarshalImpl_Release().

◆ CompositeMonikerImpl_Save()

static HRESULT WINAPI CompositeMonikerImpl_Save ( IMoniker iface,
IStream stream,
BOOL  clear_dirty 
)
static

Definition at line 264 of file compositemoniker.c.

265{
267 HRESULT hr;
268
269 TRACE("%p, %p, %d\n", iface, stream, clear_dirty);
270
271 if (!moniker->comp_count)
272 return E_UNEXPECTED;
273
274 hr = IStream_Write(stream, &moniker->comp_count, sizeof(moniker->comp_count), NULL);
275 if (FAILED(hr)) return hr;
276
277 return composite_save_components(iface, stream);
278}

◆ CompositeMonikerMarshalImpl_AddRef()

static ULONG WINAPI CompositeMonikerMarshalImpl_AddRef ( IMarshal iface)
static

Definition at line 1103 of file compositemoniker.c.

1104{
1106
1107 TRACE("(%p)\n",iface);
1108
1109 return CompositeMonikerImpl_AddRef(&This->IMoniker_iface);
1110}
static CompositeMonikerImpl * impl_from_IMarshal(IMarshal *iface)
static ULONG WINAPI CompositeMonikerImpl_AddRef(IMoniker *iface)

◆ CompositeMonikerMarshalImpl_DisconnectObject()

static HRESULT WINAPI CompositeMonikerMarshalImpl_DisconnectObject ( IMarshal iface,
DWORD  dwReserved 
)
static

Definition at line 1232 of file compositemoniker.c.

1234{
1235 TRACE("%#lx\n", dwReserved);
1236 /* can't disconnect a state-based marshal as nothing on server side to
1237 * disconnect from */
1238 return S_OK;
1239}
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95

◆ CompositeMonikerMarshalImpl_GetMarshalSizeMax()

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

Definition at line 1133 of file compositemoniker.c.

1136{
1138 HRESULT hr;
1139 ULONG size;
1140
1141 TRACE("%s, %p, %lx, %p, %lx, %p.\n", debugstr_guid(riid), pv,
1142 dwDestContext, pvDestContext, mshlflags, pSize);
1143
1144 if (!moniker->comp_count)
1145 return E_UNEXPECTED;
1146
1147 *pSize = 0x10; /* to match native */
1148
1149 if (FAILED(hr = CoGetMarshalSizeMax(&size, &IID_IMoniker, (IUnknown *)moniker->left, dwDestContext,
1150 pvDestContext, mshlflags)))
1151 {
1152 return hr;
1153 }
1154 *pSize += size;
1155
1156 if (FAILED(hr = CoGetMarshalSizeMax(&size, &IID_IMoniker, (IUnknown *)moniker->right, dwDestContext,
1157 pvDestContext, mshlflags)))
1158 {
1159 return hr;
1160 }
1161 *pSize += size;
1162
1163 return hr;
1164}
HRESULT WINAPI CoGetMarshalSizeMax(ULONG *size, REFIID riid, IUnknown *unk, DWORD dest_context, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:440
GLsizeiptr size
Definition: glext.h:5919

◆ CompositeMonikerMarshalImpl_GetUnmarshalClass()

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

Definition at line 1121 of file compositemoniker.c.

1124{
1126
1127 TRACE("%s, %p, %lx, %p, %lx, %p.\n", debugstr_guid(riid), pv,
1128 dwDestContext, pvDestContext, mshlflags, pCid);
1129
1130 return IMoniker_GetClassID(&This->IMoniker_iface, pCid);
1131}

◆ CompositeMonikerMarshalImpl_MarshalInterface()

static HRESULT WINAPI CompositeMonikerMarshalImpl_MarshalInterface ( IMarshal iface,
IStream stream,
REFIID  riid,
void pv,
DWORD  dwDestContext,
void pvDestContext,
DWORD  flags 
)
static

Definition at line 1166 of file compositemoniker.c.

1168{
1170 HRESULT hr;
1171
1172 TRACE("%p, %p, %s, %p, %lx, %p, %#lx\n", iface, stream, debugstr_guid(riid), pv, dwDestContext, pvDestContext, flags);
1173
1174 if (!moniker->comp_count)
1175 return E_UNEXPECTED;
1176
1177 if (FAILED(hr = CoMarshalInterface(stream, &IID_IMoniker, (IUnknown *)moniker->left, dwDestContext, pvDestContext, flags)))
1178 {
1179 WARN("Failed to marshal left component, hr %#lx.\n", hr);
1180 return hr;
1181 }
1182
1183 if (FAILED(hr = CoMarshalInterface(stream, &IID_IMoniker, (IUnknown *)moniker->right, dwDestContext, pvDestContext, flags)))
1184 WARN("Failed to marshal right component, hr %#lx.\n", hr);
1185
1186 return hr;
1187}
HRESULT WINAPI CoMarshalInterface(IStream *stream, REFIID riid, IUnknown *unk, DWORD dest_context, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:483
GLbitfield flags
Definition: glext.h:7161

◆ CompositeMonikerMarshalImpl_QueryInterface()

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

Definition at line 1094 of file compositemoniker.c.

1095{
1097
1098 TRACE("(%p,%s,%p)\n",iface,debugstr_guid(riid),ppv);
1099
1100 return CompositeMonikerImpl_QueryInterface(&This->IMoniker_iface, riid, ppv);
1101}
static HRESULT WINAPI CompositeMonikerImpl_QueryInterface(IMoniker *iface, REFIID riid, void **ppvObject)

◆ CompositeMonikerMarshalImpl_Release()

static ULONG WINAPI CompositeMonikerMarshalImpl_Release ( IMarshal iface)
static

Definition at line 1112 of file compositemoniker.c.

1113{
1115
1116 TRACE("(%p)\n",iface);
1117
1118 return CompositeMonikerImpl_Release(&This->IMoniker_iface);
1119}
static ULONG WINAPI CompositeMonikerImpl_Release(IMoniker *iface)

◆ CompositeMonikerMarshalImpl_ReleaseMarshalData()

static HRESULT WINAPI CompositeMonikerMarshalImpl_ReleaseMarshalData ( IMarshal iface,
IStream pStm 
)
static

Definition at line 1224 of file compositemoniker.c.

1225{
1226 TRACE("(%p)\n", pStm);
1227 /* can't release a state-based marshal as nothing on server side to
1228 * release */
1229 return S_OK;
1230}

◆ CompositeMonikerMarshalImpl_UnmarshalInterface()

static HRESULT WINAPI CompositeMonikerMarshalImpl_UnmarshalInterface ( IMarshal iface,
IStream stream,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1189 of file compositemoniker.c.

1191{
1193 HRESULT hr;
1194
1195 TRACE("%p, %p, %s, %p\n", iface, stream, debugstr_guid(riid), ppv);
1196
1197 if (moniker->left)
1198 {
1199 IMoniker_Release(moniker->left);
1200 moniker->left = NULL;
1201 }
1202
1203 if (moniker->right)
1204 {
1205 IMoniker_Release(moniker->right);
1206 moniker->right = NULL;
1207 }
1208
1209 if (FAILED(hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void **)&moniker->left)))
1210 {
1211 WARN("Failed to unmarshal left moniker, hr %#lx.\n", hr);
1212 return hr;
1213 }
1214
1215 if (FAILED(hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void **)&moniker->right)))
1216 {
1217 WARN("Failed to unmarshal right moniker, hr %#lx.\n", hr);
1218 return hr;
1219 }
1220
1221 return IMoniker_QueryInterface(&moniker->IMoniker_iface, riid, ppv);
1222}
HRESULT WINAPI CoUnmarshalInterface(IStream *stream, REFIID riid, void **ppv)
Definition: marshal.c:793
IMoniker IMoniker_iface
Definition: main.c:41

◆ CompositeMonikerROTDataImpl_AddRef()

static ULONG WINAPI CompositeMonikerROTDataImpl_AddRef ( IROTData iface)
static

Definition at line 998 of file compositemoniker.c.

999{
1001
1002 TRACE("(%p)\n",iface);
1003
1004 return IMoniker_AddRef(&This->IMoniker_iface);
1005}
static CompositeMonikerImpl * impl_from_IROTData(IROTData *iface)

◆ CompositeMonikerROTDataImpl_GetComparisonData()

static HRESULT WINAPI CompositeMonikerROTDataImpl_GetComparisonData ( IROTData iface,
BYTE data,
ULONG  max_len,
ULONG ret_len 
)
static

Definition at line 1037 of file compositemoniker.c.

1039{
1041 HRESULT hr;
1042 ULONG len;
1043
1044 TRACE("%p, %p, %lu, %p\n", iface, data, max_len, ret_len);
1045
1046 if (!moniker->comp_count)
1047 return E_UNEXPECTED;
1048
1049 /* Get required size first */
1050 *ret_len = sizeof(CLSID);
1051
1052 len = 0;
1054 if (SUCCEEDED(hr) || hr == E_OUTOFMEMORY)
1055 *ret_len += len;
1056 else
1057 {
1058 WARN("Failed to get comparison data length for left component, hr %#lx.\n", hr);
1059 return hr;
1060 }
1061
1062 len = 0;
1064 if (SUCCEEDED(hr) || hr == E_OUTOFMEMORY)
1065 *ret_len += len;
1066 else
1067 {
1068 WARN("Failed to get comparison data length for right component, hr %#lx.\n", hr);
1069 return hr;
1070 }
1071
1072 if (max_len < *ret_len)
1073 return E_OUTOFMEMORY;
1074
1075 memcpy(data, &CLSID_CompositeMoniker, sizeof(CLSID));
1076 data += sizeof(CLSID);
1077 max_len -= sizeof(CLSID);
1079 {
1080 WARN("Failed to get comparison data for left component, hr %#lx.\n", hr);
1081 return hr;
1082 }
1083 data += len;
1084 max_len -= len;
1086 {
1087 WARN("Failed to get comparison data for right component, hr %#lx.\n", hr);
1088 return hr;
1089 }
1090
1091 return S_OK;
1092}
static HRESULT composite_get_moniker_comparison_data(IMoniker *moniker, BYTE *data, ULONG max_len, ULONG *ret_len)
GLenum GLsizei len
Definition: glext.h:6722
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ CompositeMonikerROTDataImpl_QueryInterface()

static HRESULT WINAPI CompositeMonikerROTDataImpl_QueryInterface ( IROTData iface,
REFIID  riid,
VOID **  ppvObject 
)
static

Definition at line 984 of file compositemoniker.c.

986{
988
989 TRACE("(%p,%s,%p)\n",iface,debugstr_guid(riid),ppvObject);
990
991 return CompositeMonikerImpl_QueryInterface(&This->IMoniker_iface, riid, ppvObject);
992}

◆ CompositeMonikerROTDataImpl_Release()

static ULONG WINAPI CompositeMonikerROTDataImpl_Release ( IROTData iface)
static

Definition at line 1010 of file compositemoniker.c.

1011{
1013
1014 TRACE("(%p)\n",iface);
1015
1016 return IMoniker_Release(&This->IMoniker_iface);
1017}

◆ create_composite()

static HRESULT create_composite ( IMoniker left,
IMoniker right,
IMoniker **  moniker 
)
static

Definition at line 1744 of file compositemoniker.c.

1745{
1746 IMoniker *new_left, *new_right;
1748 HRESULT hr;
1749
1750 *moniker = NULL;
1751
1752 if (!(object = calloc(1, sizeof(*object))))
1753 return E_OUTOFMEMORY;
1754
1755 object->IMoniker_iface.lpVtbl = &VT_CompositeMonikerImpl;
1756 object->IROTData_iface.lpVtbl = &VT_ROTDataImpl;
1757 object->IMarshal_iface.lpVtbl = &VT_MarshalImpl;
1758 object->ref = 1;
1759
1760 /* Uninitialized moniker created by object activation */
1761 if (!left && !right)
1762 {
1763 *moniker = &object->IMoniker_iface;
1764 return S_OK;
1765 }
1766
1767 if (FAILED(hr = moniker_simplify_composition(left, right, &object->comp_count, &new_left, &new_right)))
1768 {
1769 IMoniker_Release(&object->IMoniker_iface);
1770 return hr;
1771 }
1772
1773 if (!new_left || !new_right)
1774 {
1775 *moniker = new_left ? new_left : new_right;
1776 IMoniker_Release(&object->IMoniker_iface);
1777 return S_OK;
1778 }
1779
1780 object->left = new_left;
1781 object->right = new_right;
1782
1783 *moniker = &object->IMoniker_iface;
1784
1785 return S_OK;
1786}
static const IMarshalVtbl VT_MarshalImpl
static const IMonikerVtbl VT_CompositeMonikerImpl
static const IROTDataVtbl VT_ROTDataImpl
static HRESULT moniker_simplify_composition(IMoniker *left, IMoniker *right, unsigned int *count, IMoniker **new_left, IMoniker **new_right)

Referenced by CompositeMoniker_CreateInstance(), and CreateGenericComposite().

◆ create_enumerator()

static HRESULT create_enumerator ( IMoniker **  components,
unsigned int  count,
BOOL  forward,
IEnumMoniker **  ret 
)
static

Definition at line 1382 of file compositemoniker.c.

1383{
1385 unsigned int i;
1386
1387 if (!(object = calloc(1, sizeof(*object))))
1388 return E_OUTOFMEMORY;
1389
1390 object->IEnumMoniker_iface.lpVtbl = &VT_EnumMonikerImpl;
1391 object->ref = 1;
1392 object->count = count;
1393
1394 if (!(object->monikers = calloc(count, sizeof(*object->monikers))))
1395 {
1396 free(object);
1397 return E_OUTOFMEMORY;
1398 }
1399
1400 for (i = 0; i < count; ++i)
1401 {
1402 object->monikers[i] = forward ? components[i] : components[count - i - 1];
1403 IMoniker_AddRef(object->monikers[i]);
1404 }
1405
1406 *ret = &object->IEnumMoniker_iface;
1407
1408 return S_OK;
1409}
static const IEnumMonikerVtbl VT_EnumMonikerImpl

Referenced by CompositeMonikerImpl_Enum().

◆ CreateGenericComposite()

HRESULT WINAPI CreateGenericComposite ( IMoniker left,
IMoniker right,
IMoniker **  composite 
)

◆ EnumMonikerImpl_AddRef()

static ULONG WINAPI EnumMonikerImpl_AddRef ( IEnumMoniker iface)
static

Definition at line 1276 of file compositemoniker.c.

1277{
1279
1280 TRACE("(%p)\n",This);
1281
1282 return InterlockedIncrement(&This->ref);
1283
1284}
static EnumMonikerImpl * impl_from_IEnumMoniker(IEnumMoniker *iface)

◆ EnumMonikerImpl_Clone()

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

Definition at line 1359 of file compositemoniker.c.

1360{
1361 TRACE("%p, %p.\n", iface, ret);
1362
1363 if (!ret)
1364 return E_INVALIDARG;
1365
1366 *ret = NULL;
1367
1368 return E_NOTIMPL;
1369}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ EnumMonikerImpl_Next()

static HRESULT WINAPI EnumMonikerImpl_Next ( IEnumMoniker iface,
ULONG  count,
IMoniker **  m,
ULONG fetched 
)
static

Definition at line 1305 of file compositemoniker.c.

1307{
1309 unsigned int i;
1310
1311 TRACE("%p, %lu, %p, %p.\n", iface, count, m, fetched);
1312
1313 if (!m)
1314 return E_INVALIDARG;
1315
1316 *m = NULL;
1317
1318 /* retrieve the requested number of moniker from the current position */
1319 for (i = 0; (e->pos < e->count) && (i < count); ++i)
1320 {
1321 m[i] = e->monikers[e->pos++];
1322 IMoniker_AddRef(m[i]);
1323 }
1324
1325 if (fetched)
1326 *fetched = i;
1327
1328 return i == count ? S_OK : S_FALSE;
1329}
#define e
Definition: ke_i.h:82

◆ EnumMonikerImpl_QueryInterface()

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

Definition at line 1245 of file compositemoniker.c.

1246{
1248
1249 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppvObject);
1250
1251 /* Perform a sanity check on the parameters.*/
1252 if ( ppvObject==0 )
1253 return E_INVALIDARG;
1254
1255 /* Initialize the return parameter */
1256 *ppvObject = 0;
1257
1258 /* Compare the riid with the interface IDs implemented by this object.*/
1260 *ppvObject = iface;
1261
1262 /* Check that we obtained an interface.*/
1263 if ((*ppvObject)==0)
1264 return E_NOINTERFACE;
1265
1266 /* Query Interface always increases the reference count by one when it is successful */
1267 IEnumMoniker_AddRef(iface);
1268
1269 return S_OK;
1270}
const GUID IID_IEnumMoniker

◆ EnumMonikerImpl_Release()

static ULONG WINAPI EnumMonikerImpl_Release ( IEnumMoniker iface)
static

Definition at line 1286 of file compositemoniker.c.

1287{
1289 ULONG refcount = InterlockedDecrement(&e->ref);
1290 unsigned int i;
1291
1292 TRACE("%p, refcount %lu.\n", iface, refcount);
1293
1294 if (!refcount)
1295 {
1296 for (i = 0; i < e->count; ++i)
1297 IMoniker_Release(e->monikers[i]);
1298 free(e->monikers);
1299 free(e);
1300 }
1301
1302 return refcount;
1303}

◆ EnumMonikerImpl_Reset()

static HRESULT WINAPI EnumMonikerImpl_Reset ( IEnumMoniker iface)
static

Definition at line 1348 of file compositemoniker.c.

1349{
1351
1352 TRACE("%p.\n", iface);
1353
1354 e->pos = 0;
1355
1356 return S_OK;
1357}

◆ EnumMonikerImpl_Skip()

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

Definition at line 1331 of file compositemoniker.c.

1332{
1334
1335 TRACE("%p, %lu.\n", iface, count);
1336
1337 if (!count)
1338 return S_OK;
1339
1340 if ((e->pos + count) >= e->count)
1341 return S_FALSE;
1342
1343 e->pos += count;
1344
1345 return S_OK;
1346}

◆ impl_from_IEnumMoniker()

static EnumMonikerImpl * impl_from_IEnumMoniker ( IEnumMoniker iface)
inlinestatic

Definition at line 83 of file compositemoniker.c.

84{
85 return CONTAINING_RECORD(iface, EnumMonikerImpl, IEnumMoniker_iface);
86}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

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

◆ impl_from_IMarshal()

◆ impl_from_IMoniker()

◆ impl_from_IROTData()

◆ moniker_create_from_tree()

static HRESULT moniker_create_from_tree ( const struct comp_node root,
unsigned int count,
IMoniker **  moniker 
)
static

Definition at line 1564 of file compositemoniker.c.

1565{
1566 IMoniker *left_moniker, *right_moniker;
1567 HRESULT hr;
1568
1569 *moniker = NULL;
1570
1571 /* Non-composite node */
1572 if (!root->left && !root->right)
1573 {
1574 (*count)++;
1575 *moniker = root->moniker;
1576 if (*moniker) IMoniker_AddRef(*moniker);
1577 return S_OK;
1578 }
1579
1580 if (FAILED(hr = moniker_create_from_tree(root->left, count, &left_moniker))) return hr;
1581 if (FAILED(hr = moniker_create_from_tree(root->right, count, &right_moniker)))
1582 {
1583 IMoniker_Release(left_moniker);
1584 return hr;
1585 }
1586
1587 hr = CreateGenericComposite(left_moniker, right_moniker, moniker);
1588 IMoniker_Release(left_moniker);
1589 IMoniker_Release(right_moniker);
1590 return hr;
1591}

Referenced by composite_get_rightmost(), moniker_create_from_tree(), and moniker_simplify_composition().

◆ moniker_get_tree_comp_count()

static void moniker_get_tree_comp_count ( const struct comp_node root,
unsigned int count 
)
static

Definition at line 1593 of file compositemoniker.c.

1594{
1595 if (!root->left && !root->right)
1596 {
1597 (*count)++;
1598 return;
1599 }
1600
1603}
static void moniker_get_tree_comp_count(const struct comp_node *root, unsigned int *count)

Referenced by moniker_get_tree_comp_count(), and moniker_simplify_composition().

◆ moniker_get_tree_representation()

static HRESULT moniker_get_tree_representation ( IMoniker moniker,
struct comp_node parent,
struct comp_node **  ret 
)
static

Definition at line 1469 of file compositemoniker.c.

1471{
1472 CompositeMonikerImpl *comp_moniker;
1473 struct comp_node *node;
1474
1475 if (!(node = calloc(1, sizeof(*node))))
1476 return E_OUTOFMEMORY;
1477 node->parent = parent;
1478
1479 if ((comp_moniker = unsafe_impl_from_IMoniker(moniker)))
1480 {
1481 moniker_get_tree_representation(comp_moniker->left, node, &node->left);
1482 moniker_get_tree_representation(comp_moniker->right, node, &node->right);
1483 }
1484 else
1485 {
1486 node->moniker = moniker;
1487 IMoniker_AddRef(node->moniker);
1488 }
1489
1490 *ret = node;
1491
1492 return S_OK;
1493}
r parent
Definition: btrfs.c:3010
IMoniker * moniker

Referenced by composite_get_leftmost(), composite_get_rightmost(), moniker_get_tree_representation(), and moniker_simplify_composition().

◆ moniker_simplify_composition()

static HRESULT moniker_simplify_composition ( IMoniker left,
IMoniker right,
unsigned int count,
IMoniker **  new_left,
IMoniker **  new_right 
)
static

Definition at line 1678 of file compositemoniker.c.

1680{
1681 struct comp_node *left_tree, *right_tree;
1682 unsigned int modified = 0;
1683 HRESULT hr = S_OK;
1684 IMoniker *c;
1685
1686 *count = 0;
1687
1690
1691 /* Simplify by composing trees together, in a non-generic way. */
1692 for (;;)
1693 {
1694 struct comp_node *l, *r;
1695
1696 if (!(l = moniker_tree_get_rightmost(left_tree))) break;
1697 if (!(r = moniker_tree_get_leftmost(right_tree))) break;
1698
1699 c = NULL;
1700 if (FAILED(IMoniker_ComposeWith(l->moniker, r->moniker, TRUE, &c))) break;
1701 modified++;
1702
1703 if (c)
1704 {
1705 /* Replace with composed moniker on the left side */
1706 IMoniker_Release(l->moniker);
1707 l->moniker = c;
1708 }
1709 else
1712 }
1713
1714 if (!modified)
1715 {
1716 *new_left = left;
1717 IMoniker_AddRef(*new_left);
1718 *new_right = right;
1719 IMoniker_AddRef(*new_right);
1720
1723 }
1724 else
1725 {
1726 hr = moniker_create_from_tree(left_tree, count, new_left);
1727 if (SUCCEEDED(hr))
1728 hr = moniker_create_from_tree(right_tree, count, new_right);
1729 }
1730
1731 moniker_tree_release(left_tree);
1732 moniker_tree_release(right_tree);
1733
1734 if (FAILED(hr))
1735 {
1736 if (*new_left) IMoniker_Release(*new_left);
1737 if (*new_right) IMoniker_Release(*new_right);
1738 *new_left = *new_right = NULL;
1739 }
1740
1741 return hr;
1742}
r l[0]
Definition: byte_order.h:168
#define FALSE
Definition: types.h:117
GLdouble GLdouble GLdouble r
Definition: gl.h:2055

Referenced by create_composite().

◆ moniker_tree_discard()

static void moniker_tree_discard ( struct comp_node node,
BOOL  left 
)
static

Definition at line 1550 of file compositemoniker.c.

1551{
1552 if (node->parent)
1553 {
1554 moniker_tree_replace_node(node->parent, left ? node->parent->left : node->parent->right);
1556 }
1557 else
1558 {
1559 IMoniker_Release(node->moniker);
1560 node->moniker = NULL;
1561 }
1562}
static void moniker_tree_replace_node(struct comp_node *node, struct comp_node *replace_with)
static void moniker_tree_node_release(struct comp_node *node)

Referenced by composite_get_rightmost(), and moniker_simplify_composition().

◆ moniker_tree_get_leftmost()

static struct comp_node * moniker_tree_get_leftmost ( struct comp_node root)
static

Definition at line 1502 of file compositemoniker.c.

1503{
1504 if (!root->left && !root->right) return root->moniker ? root : NULL;
1505 while (root->left) root = root->left;
1506 return root;
1507}

Referenced by composite_get_leftmost(), and moniker_simplify_composition().

◆ moniker_tree_get_rightmost()

static struct comp_node * moniker_tree_get_rightmost ( struct comp_node root)
static

Definition at line 1495 of file compositemoniker.c.

1496{
1497 if (!root->left && !root->right) return root->moniker ? root : NULL;
1498 while (root->right) root = root->right;
1499 return root;
1500}

Referenced by composite_get_rightmost(), and moniker_simplify_composition().

◆ moniker_tree_node_release()

static void moniker_tree_node_release ( struct comp_node node)
static

Definition at line 1509 of file compositemoniker.c.

1510{
1511 if (node->moniker)
1512 IMoniker_Release(node->moniker);
1513 free(node);
1514}

Referenced by moniker_tree_discard(), moniker_tree_release(), and moniker_tree_replace_node().

◆ moniker_tree_release()

static void moniker_tree_release ( struct comp_node node)
static

Definition at line 1516 of file compositemoniker.c.

1517{
1518 if (node->left)
1520 if (node->right)
1523}

Referenced by composite_get_leftmost(), composite_get_rightmost(), and moniker_simplify_composition().

◆ moniker_tree_replace_node()

static void moniker_tree_replace_node ( struct comp_node node,
struct comp_node replace_with 
)
static

Definition at line 1525 of file compositemoniker.c.

1526{
1527 if (node->parent)
1528 {
1529 if (node->parent->left == node) node->parent->left = replace_with;
1530 else node->parent->right = replace_with;
1531 replace_with->parent = node->parent;
1532 }
1533 else if (replace_with->moniker)
1534 {
1535 /* Replacing root with non-composite */
1536 node->moniker = replace_with->moniker;
1537 IMoniker_AddRef(node->moniker);
1538 node->left = node->right = NULL;
1539 moniker_tree_node_release(replace_with);
1540 }
1541 else
1542 {
1543 /* Attaching composite branches to the root */
1544 node->left = replace_with->left;
1545 node->right = replace_with->right;
1546 moniker_tree_node_release(replace_with);
1547 }
1548}
struct comp_node * parent
struct comp_node * left
struct comp_node * right

Referenced by moniker_tree_discard().

◆ MonikerCommonPrefixWith()

HRESULT WINAPI MonikerCommonPrefixWith ( IMoniker pmkThis,
IMoniker pmkOther,
IMoniker **  ppmkCommon 
)

◆ unsafe_impl_from_IMoniker()

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

Variable Documentation

◆ VT_CompositeMonikerImpl

static const IMonikerVtbl VT_CompositeMonikerImpl
static
Initial value:
=
{
}
static HRESULT WINAPI CompositeMonikerImpl_CommonPrefixWith(IMoniker *iface, IMoniker *other, IMoniker **prefix)
static HRESULT WINAPI CompositeMonikerImpl_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc, IMoniker *toleft, FILETIME *changetime)
static HRESULT WINAPI CompositeMonikerImpl_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *pcbSize)
static HRESULT WINAPI CompositeMonikerImpl_IsSystemMoniker(IMoniker *iface, DWORD *pwdMksys)
static HRESULT WINAPI CompositeMonikerImpl_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD howfar, IMoniker **toleft, IMoniker **reduced)
static HRESULT WINAPI CompositeMonikerImpl_ParseDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR name, ULONG *eaten, IMoniker **result)
static HRESULT WINAPI CompositeMonikerImpl_Enum(IMoniker *iface, BOOL forward, IEnumMoniker **ret_enum)
static HRESULT WINAPI CompositeMonikerImpl_BindToObject(IMoniker *iface, IBindCtx *pbc, IMoniker *toleft, REFIID riid, void **result)
static HRESULT WINAPI CompositeMonikerImpl_Inverse(IMoniker *iface, IMoniker **inverse)
static HRESULT WINAPI CompositeMonikerImpl_GetClassID(IMoniker *iface, CLSID *pClassID)
static HRESULT WINAPI CompositeMonikerImpl_IsEqual(IMoniker *iface, IMoniker *other)
static HRESULT WINAPI CompositeMonikerImpl_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *toleft, IMoniker *newly_running)
static HRESULT WINAPI CompositeMonikerImpl_IsDirty(IMoniker *iface)
static HRESULT WINAPI CompositeMonikerImpl_Hash(IMoniker *iface, DWORD *hash)
static HRESULT WINAPI CompositeMonikerImpl_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *toleft, REFIID riid, void **result)
static HRESULT WINAPI CompositeMonikerImpl_GetDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *displayname)
static HRESULT WINAPI CompositeMonikerImpl_Load(IMoniker *iface, IStream *stream)
static HRESULT WINAPI CompositeMonikerImpl_RelativePathTo(IMoniker *iface, IMoniker *other, IMoniker **relpath)
static HRESULT WINAPI CompositeMonikerImpl_ComposeWith(IMoniker *iface, IMoniker *right, BOOL only_if_not_generic, IMoniker **composite)
static HRESULT WINAPI CompositeMonikerImpl_Save(IMoniker *iface, IStream *stream, BOOL clear_dirty)

Definition at line 55 of file compositemoniker.c.

Referenced by create_composite(), and unsafe_impl_from_IMoniker().

◆ VT_EnumMonikerImpl

const IEnumMonikerVtbl VT_EnumMonikerImpl
static
Initial value:
=
{
}
static HRESULT WINAPI EnumMonikerImpl_Skip(IEnumMoniker *iface, ULONG count)
static HRESULT WINAPI EnumMonikerImpl_Reset(IEnumMoniker *iface)
static ULONG WINAPI EnumMonikerImpl_Release(IEnumMoniker *iface)
static HRESULT WINAPI EnumMonikerImpl_Clone(IEnumMoniker *iface, IEnumMoniker **ret)
static HRESULT WINAPI EnumMonikerImpl_Next(IEnumMoniker *iface, ULONG count, IMoniker **m, ULONG *fetched)
static ULONG WINAPI EnumMonikerImpl_AddRef(IEnumMoniker *iface)
static HRESULT WINAPI EnumMonikerImpl_QueryInterface(IEnumMoniker *iface, REFIID riid, void **ppvObject)

Definition at line 1371 of file compositemoniker.c.

Referenced by create_enumerator().

◆ VT_MarshalImpl

const IMarshalVtbl VT_MarshalImpl
static
Initial value:
=
{
}
static HRESULT WINAPI CompositeMonikerMarshalImpl_DisconnectObject(IMarshal *iface, DWORD dwReserved)
static HRESULT WINAPI CompositeMonikerMarshalImpl_UnmarshalInterface(IMarshal *iface, IStream *stream, REFIID riid, void **ppv)
static HRESULT WINAPI CompositeMonikerMarshalImpl_MarshalInterface(IMarshal *iface, IStream *stream, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD flags)
static ULONG WINAPI CompositeMonikerMarshalImpl_AddRef(IMarshal *iface)
static HRESULT WINAPI CompositeMonikerMarshalImpl_QueryInterface(IMarshal *iface, REFIID riid, LPVOID *ppv)
static ULONG WINAPI CompositeMonikerMarshalImpl_Release(IMarshal *iface)
static HRESULT WINAPI CompositeMonikerMarshalImpl_GetUnmarshalClass(IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, CLSID *pCid)
static HRESULT WINAPI CompositeMonikerMarshalImpl_GetMarshalSizeMax(IMarshal *iface, REFIID riid, void *pv, DWORD dwDestContext, void *pvDestContext, DWORD mshlflags, DWORD *pSize)
static HRESULT WINAPI CompositeMonikerMarshalImpl_ReleaseMarshalData(IMarshal *iface, IStream *pStm)

Definition at line 1448 of file compositemoniker.c.

Referenced by create_composite().

◆ VT_ROTDataImpl

const IROTDataVtbl VT_ROTDataImpl
static
Initial value:
=
{
}
static HRESULT WINAPI CompositeMonikerROTDataImpl_QueryInterface(IROTData *iface, REFIID riid, VOID **ppvObject)
static ULONG WINAPI CompositeMonikerROTDataImpl_AddRef(IROTData *iface)
static HRESULT WINAPI CompositeMonikerROTDataImpl_GetComparisonData(IROTData *iface, BYTE *data, ULONG max_len, ULONG *ret_len)
static ULONG WINAPI CompositeMonikerROTDataImpl_Release(IROTData *iface)

Definition at line 1440 of file compositemoniker.c.

Referenced by create_composite().