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

Go to the source code of this file.

Classes

class  ClassMoniker
 

Macros

#define COBJMACROS
 
#define CHARS_IN_GUID   39
 

Typedefs

typedef struct ClassMoniker ClassMoniker
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static ClassMonikerimpl_from_IMoniker (IMoniker *iface)
 
static ClassMonikerimpl_from_IROTData (IROTData *iface)
 
static ClassMonikerunsafe_impl_from_IMoniker (IMoniker *iface)
 
static HRESULT WINAPI ClassMoniker_QueryInterface (IMoniker *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI ClassMoniker_AddRef (IMoniker *iface)
 
static ULONG WINAPI ClassMoniker_Release (IMoniker *iface)
 
static HRESULT WINAPI ClassMoniker_GetClassID (IMoniker *iface, CLSID *pClassID)
 
static HRESULT WINAPI ClassMoniker_IsDirty (IMoniker *iface)
 
static HRESULT WINAPI ClassMoniker_Load (IMoniker *iface, IStream *stream)
 
static HRESULT WINAPI ClassMoniker_Save (IMoniker *iface, IStream *stream, BOOL clear_dirty)
 
static HRESULT WINAPI ClassMoniker_GetSizeMax (IMoniker *iface, ULARGE_INTEGER *size)
 
static HRESULT WINAPI ClassMoniker_BindToObject (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riid, VOID **ppvResult)
 
static HRESULT WINAPI ClassMoniker_BindToStorage (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riid, VOID **ppvResult)
 
static HRESULT WINAPI ClassMoniker_Reduce (IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
 
static HRESULT WINAPI ClassMoniker_ComposeWith (IMoniker *iface, IMoniker *right, BOOL only_if_not_generic, IMoniker **result)
 
static HRESULT WINAPI ClassMoniker_Enum (IMoniker *iface, BOOL fForward, IEnumMoniker **ppenumMoniker)
 
static HRESULT WINAPI ClassMoniker_IsEqual (IMoniker *iface, IMoniker *other)
 
static HRESULT WINAPI ClassMoniker_Hash (IMoniker *iface, DWORD *hash)
 
static HRESULT WINAPI ClassMoniker_IsRunning (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, IMoniker *pmkNewlyRunning)
 
static HRESULT WINAPI ClassMoniker_GetTimeOfLastChange (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, FILETIME *pItemTime)
 
static HRESULT WINAPI ClassMoniker_Inverse (IMoniker *iface, IMoniker **ppmk)
 
static HRESULT WINAPI ClassMoniker_CommonPrefixWith (IMoniker *iface, IMoniker *other, IMoniker **prefix)
 
static HRESULT WINAPI ClassMoniker_RelativePathTo (IMoniker *iface, IMoniker *pmOther, IMoniker **ppmkRelPath)
 
static HRESULT WINAPI ClassMoniker_GetDisplayName (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *name)
 
static HRESULT WINAPI ClassMoniker_ParseDisplayName (IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR display_name, ULONG *eaten, IMoniker **result)
 
static HRESULT WINAPI ClassMoniker_IsSystemMoniker (IMoniker *iface, DWORD *pwdMksys)
 
static HRESULT WINAPI ClassMonikerROTData_QueryInterface (IROTData *iface, REFIID riid, VOID **ppvObject)
 
static ULONG WINAPI ClassMonikerROTData_AddRef (IROTData *iface)
 
static ULONG WINAPI ClassMonikerROTData_Release (IROTData *iface)
 
static HRESULT WINAPI ClassMonikerROTData_GetComparisonData (IROTData *iface, BYTE *pbData, ULONG cbMax, ULONG *pcbData)
 
static HRESULT create_class_moniker (const CLSID *clsid, const WCHAR *data, unsigned int data_len, IMoniker **moniker)
 
HRESULT WINAPI CreateClassMoniker (REFCLSID rclsid, IMoniker **moniker)
 
HRESULT ClassMoniker_CreateFromDisplayName (LPBC pbc, const WCHAR *display_name, DWORD *eaten, IMoniker **moniker)
 
HRESULT WINAPI ClassMoniker_CreateInstance (IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv)
 

Variables

static const IMonikerVtbl ClassMonikerVtbl
 
static const IROTDataVtbl ROTDataVtbl
 

Macro Definition Documentation

◆ CHARS_IN_GUID

#define CHARS_IN_GUID   39

Definition at line 38 of file classmoniker.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 26 of file classmoniker.c.

Typedef Documentation

◆ ClassMoniker

Function Documentation

◆ ClassMoniker_AddRef()

static ULONG WINAPI ClassMoniker_AddRef ( IMoniker iface)
static

Definition at line 121 of file classmoniker.c.

122{
124
125 TRACE("(%p)\n",This);
126
127 return InterlockedIncrement(&This->ref);
128}
#define InterlockedIncrement
Definition: armddk.h:53
static ClassMoniker * impl_from_IMoniker(IMoniker *iface)
Definition: classmoniker.c:57
#define TRACE(s)
Definition: solgame.cpp:4

◆ ClassMoniker_BindToObject()

static HRESULT WINAPI ClassMoniker_BindToObject ( IMoniker iface,
IBindCtx pbc,
IMoniker pmkToLeft,
REFIID  riid,
VOID **  ppvResult 
)
static

Definition at line 232 of file classmoniker.c.

237{
239 BIND_OPTS2 bindopts;
240 IClassActivator *pActivator;
241 HRESULT hr;
242
243 TRACE("(%p, %p, %s, %p)\n", pbc, pmkToLeft, debugstr_guid(riid), ppvResult);
244
245 bindopts.cbStruct = sizeof(bindopts);
246 IBindCtx_GetBindOptions(pbc, (BIND_OPTS *)&bindopts);
247
248 if (!pmkToLeft)
249 return CoGetClassObject(&moniker->header.clsid, bindopts.dwClassContext, NULL,
250 riid, ppvResult);
251 else
252 {
253 hr = IMoniker_BindToObject(pmkToLeft, pbc, NULL, &IID_IClassActivator,
254 (void **)&pActivator);
255 if (FAILED(hr)) return hr;
256
257 hr = IClassActivator_GetClassObject(pActivator, &moniker->header.clsid,
258 bindopts.dwClassContext,
259 bindopts.locale, riid, ppvResult);
260
261 IClassActivator_Release(pActivator);
262
263 return hr;
264 }
265}
#define NULL
Definition: types.h:112
HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(REFCLSID rclsid, DWORD clscontext, COSERVERINFO *server_info, REFIID riid, void **obj)
Definition: combase.c:1925
REFIID riid
Definition: atlbase.h:39
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
HRESULT hr
Definition: shlfolder.c:183
Definition: main.c:40

◆ ClassMoniker_BindToStorage()

static HRESULT WINAPI ClassMoniker_BindToStorage ( IMoniker iface,
IBindCtx pbc,
IMoniker pmkToLeft,
REFIID  riid,
VOID **  ppvResult 
)
static

Definition at line 270 of file classmoniker.c.

275{
276 TRACE("(%p, %p, %s, %p)\n", pbc, pmkToLeft, debugstr_guid(riid), ppvResult);
277 return IMoniker_BindToObject(iface, pbc, pmkToLeft, riid, ppvResult);
278}

◆ ClassMoniker_CommonPrefixWith()

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

Definition at line 395 of file classmoniker.c.

396{
397 ClassMoniker *moniker = impl_from_IMoniker(iface), *other_moniker;
398
399 TRACE("%p, %p, %p\n", iface, other, prefix);
400
401 *prefix = NULL;
402
403 other_moniker = unsafe_impl_from_IMoniker(other);
404
405 if (other_moniker)
406 {
407 if (!IsEqualGUID(&moniker->header.clsid, &other_moniker->header.clsid)) return MK_E_NOPREFIX;
408
409 *prefix = iface;
410 IMoniker_AddRef(iface);
411
412 return MK_S_US;
413 }
414
415 return MonikerCommonPrefixWith(iface, other, prefix);
416}
static ClassMoniker * unsafe_impl_from_IMoniker(IMoniker *iface)
Definition: classmoniker.c:69
HRESULT WINAPI MonikerCommonPrefixWith(IMoniker *pmkThis, IMoniker *pmkOther, IMoniker **ppmkCommon)
int other
Definition: msacm.c:1376
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
Character const *const prefix
Definition: tempnam.cpp:195
#define MK_E_NOPREFIX
Definition: winerror.h:3909
#define MK_S_US
Definition: winerror.h:3899

◆ ClassMoniker_ComposeWith()

static HRESULT WINAPI ClassMoniker_ComposeWith ( IMoniker iface,
IMoniker right,
BOOL  only_if_not_generic,
IMoniker **  result 
)
static

Definition at line 295 of file classmoniker.c.

297{
298 DWORD order;
299
300 TRACE("%p, %p, %d, %p.\n", iface, right, only_if_not_generic, result);
301
302 if (!result || !right)
303 return E_POINTER;
304
305 *result = NULL;
306
308 return S_OK;
309
310 return only_if_not_generic ? MK_E_NEEDGENERIC : CreateGenericComposite(iface, right, result);
311}
BOOL is_anti_moniker(IMoniker *iface, DWORD *order)
Definition: antimoniker.c:54
HRESULT WINAPI CreateGenericComposite(IMoniker *left, IMoniker *right, IMoniker **composite)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble GLdouble right
Definition: glext.h:10859
GLuint64EXT * result
Definition: glext.h:11304
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
#define S_OK
Definition: intsafe.h:52
#define MK_E_NEEDGENERIC
Definition: winerror.h:3893
#define E_POINTER
Definition: winerror.h:3480

◆ ClassMoniker_CreateFromDisplayName()

HRESULT ClassMoniker_CreateFromDisplayName ( LPBC  pbc,
const WCHAR display_name,
DWORD eaten,
IMoniker **  moniker 
)

Definition at line 634 of file classmoniker.c.

636{
637 const WCHAR *end, *s;
638 BOOL has_braces;
639 WCHAR uuid[37];
640 CLSID clsid;
641 HRESULT hr;
642 int len;
643
644 s = display_name;
645
646 /* Skip prefix */
647 if (wcsnicmp(s, L"clsid:", 6)) return MK_E_SYNTAX;
648 s += 6;
649
650 /* Terminating marker is optional */
651 if (!(end = wcschr(s, ':')))
652 end = s + lstrlenW(s);
653
654 len = end - s;
655 if (len < 36)
656 return MK_E_SYNTAX;
657
658 if ((has_braces = *s == '{')) s++;
659
660 memcpy(uuid, s, 36 * sizeof(WCHAR));
661 uuid[36] = 0;
662
664 {
665 WARN("Failed to parse clsid string.\n");
666 return MK_E_SYNTAX;
667 }
668
669 s += 36;
670 if (has_braces)
671 {
672 if (*s != '}') return MK_E_SYNTAX;
673 s++;
674 }
675
676 /* Consume terminal marker */
677 len = end - s;
678 if (*end == ':') end++;
679
681 if (SUCCEEDED(hr))
682 *eaten = end - display_name;
683 return hr;
684}
#define WARN(fmt,...)
Definition: precomp.h:61
static HRESULT create_class_moniker(const CLSID *clsid, const WCHAR *data, unsigned int data_len, IMoniker **moniker)
Definition: classmoniker.c:594
#define wcschr
Definition: compat.h:17
#define wcsnicmp
Definition: compat.h:14
#define lstrlenW
Definition: compat.h:750
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
GLdouble s
Definition: gl.h:2039
GLuint GLuint end
Definition: gl.h:1545
GLenum GLsizei len
Definition: glext.h:6722
Definition: msctf.idl:532
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
const CLSID * clsid
Definition: msctf.cpp:50
RPC_STATUS WINAPI UuidFromStringW(RPC_WSTR s, UUID *uuid)
Definition: rpcrt4_main.c:655
#define MK_E_SYNTAX
Definition: winerror.h:3896
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by MkParseDisplayName().

◆ ClassMoniker_CreateInstance()

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

Definition at line 686 of file classmoniker.c.

688{
689 HRESULT hr;
690 IMoniker *pmk;
691
692 TRACE("(%p, %s, %p)\n", pUnk, debugstr_guid(riid), ppv);
693
694 *ppv = NULL;
695
696 if (pUnk)
698
700 if (FAILED(hr)) return hr;
701
702 hr = IMoniker_QueryInterface(pmk, riid, ppv);
703 IMoniker_Release(pmk);
704
705 return hr;
706}
HRESULT WINAPI CreateClassMoniker(REFCLSID rclsid, IMoniker **moniker)
Definition: classmoniker.c:627
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define CLSID_NULL
Definition: guiddef.h:99
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771

◆ ClassMoniker_Enum()

static HRESULT WINAPI ClassMoniker_Enum ( IMoniker iface,
BOOL  fForward,
IEnumMoniker **  ppenumMoniker 
)
static

Definition at line 316 of file classmoniker.c.

317{
318 TRACE("(%p,%d,%p)\n",iface,fForward,ppenumMoniker);
319
320 if (ppenumMoniker == NULL)
321 return E_POINTER;
322
323 *ppenumMoniker = NULL;
324
325 return S_OK;
326}

◆ ClassMoniker_GetClassID()

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

Definition at line 150 of file classmoniker.c.

151{
152 TRACE("(%p, %p)\n", iface, pClassID);
153
154 if (pClassID==NULL)
155 return E_POINTER;
156
157 *pClassID = CLSID_ClassMoniker;
158
159 return S_OK;
160}

◆ ClassMoniker_GetDisplayName()

static HRESULT WINAPI ClassMoniker_GetDisplayName ( IMoniker iface,
IBindCtx pbc,
IMoniker pmkToLeft,
LPOLESTR name 
)
static

Definition at line 433 of file classmoniker.c.

435{
437 static const int name_len = CHARS_IN_GUID + 5 /* prefix */;
438 const GUID *guid = &moniker->header.clsid;
439
440 TRACE("%p, %p, %p, %p.\n", iface, pbc, pmkToLeft, name);
441
442 if (!name)
443 return E_POINTER;
444
445 if (pmkToLeft)
446 return E_INVALIDARG;
447
448 if (!(*name = CoTaskMemAlloc(name_len * sizeof(WCHAR) + moniker->header.data_len)))
449 return E_OUTOFMEMORY;
450
451 swprintf(*name, name_len, L"clsid:%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
452 guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], guid->Data4[2],
453 guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
454
455 if (moniker->header.data_len)
456 lstrcatW(*name, moniker->data);
457 lstrcatW(*name, L":");
458
459 TRACE("Returning %s\n", debugstr_w(*name));
460
461 return S_OK;
462}
#define CHARS_IN_GUID
Definition: classmoniker.c:38
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
GUID guid
Definition: version.c:147
#define swprintf
Definition: precomp.h:40
#define debugstr_w
Definition: kernel32.h:32
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
Definition: name.c:39

◆ ClassMoniker_GetSizeMax()

static HRESULT WINAPI ClassMoniker_GetSizeMax ( IMoniker iface,
ULARGE_INTEGER size 
)
static

Definition at line 218 of file classmoniker.c.

219{
221
222 TRACE("%p, %p\n", iface, size);
223
224 size->QuadPart = sizeof(moniker->header) + moniker->header.data_len;
225
226 return S_OK;
227}
GLsizeiptr size
Definition: glext.h:5919

◆ ClassMoniker_GetTimeOfLastChange()

static HRESULT WINAPI ClassMoniker_GetTimeOfLastChange ( IMoniker iface,
IBindCtx pbc,
IMoniker pmkToLeft,
FILETIME pItemTime 
)
static

Definition at line 372 of file classmoniker.c.

376{
377 TRACE("(%p, %p, %p)\n", pbc, pmkToLeft, pItemTime);
378
379 return MK_E_UNAVAILABLE;
380}
#define MK_E_UNAVAILABLE
Definition: winerror.h:3894

◆ ClassMoniker_Hash()

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

Definition at line 344 of file classmoniker.c.

345{
347
348 TRACE("%p, %p\n", iface, hash);
349
350 *hash = moniker->header.clsid.Data1;
351
352 return S_OK;
353}
Definition: _hash_fun.h:40

◆ ClassMoniker_Inverse()

static HRESULT WINAPI ClassMoniker_Inverse ( IMoniker iface,
IMoniker **  ppmk 
)
static

Definition at line 385 of file classmoniker.c.

386{
387 TRACE("(%p)\n",ppmk);
388
389 if (!ppmk)
390 return E_POINTER;
391
392 return CreateAntiMoniker(ppmk);
393}
HRESULT WINAPI CreateAntiMoniker(IMoniker **moniker)
Definition: antimoniker.c:626

◆ ClassMoniker_IsDirty()

static HRESULT WINAPI ClassMoniker_IsDirty ( IMoniker iface)
static

Definition at line 165 of file classmoniker.c.

166{
167 /* Note that the OLE-provided implementations of the IPersistStream::IsDirty
168 method in the OLE-provided moniker interfaces always return S_FALSE because
169 their internal state never changes. */
170
171 TRACE("(%p)\n",iface);
172
173 return S_FALSE;
174}
#define S_FALSE
Definition: winerror.h:3451

◆ ClassMoniker_IsEqual()

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

Definition at line 328 of file classmoniker.c.

329{
330 ClassMoniker *moniker = impl_from_IMoniker(iface), *other_moniker;
331
332 TRACE("%p, %p.\n", iface, other);
333
334 if (!other)
335 return E_INVALIDARG;
336
337 other_moniker = unsafe_impl_from_IMoniker(other);
338 if (!other_moniker)
339 return S_FALSE;
340
341 return IsEqualGUID(&moniker->header.clsid, &other_moniker->header.clsid) ? S_OK : S_FALSE;
342}

◆ ClassMoniker_IsRunning()

static HRESULT WINAPI ClassMoniker_IsRunning ( IMoniker iface,
IBindCtx pbc,
IMoniker pmkToLeft,
IMoniker pmkNewlyRunning 
)
static

Definition at line 358 of file classmoniker.c.

362{
363 TRACE("(%p, %p, %p)\n", pbc, pmkToLeft, pmkNewlyRunning);
364
365 /* as in native */
366 return E_NOTIMPL;
367}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ClassMoniker_IsSystemMoniker()

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

Definition at line 484 of file classmoniker.c.

485{
486 TRACE("(%p,%p)\n",iface,pwdMksys);
487
488 if (!pwdMksys)
489 return E_POINTER;
490
491 *pwdMksys = MKSYS_CLASSMONIKER;
492
493 return S_OK;
494}

◆ ClassMoniker_Load()

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

Definition at line 176 of file classmoniker.c.

177{
180 HRESULT hr;
181
182 TRACE("%p, %p\n", iface, stream);
183
184 hr = IStream_Read(stream, &moniker->header, sizeof(moniker->header), &length);
185 if (hr != S_OK || length != sizeof(moniker->header)) return STG_E_READFAULT;
186
187 if (moniker->header.data_len)
188 {
189 free(moniker->data);
190 if (!(moniker->data = malloc(moniker->header.data_len)))
191 {
192 WARN("Failed to allocate moniker data of size %lu.\n", moniker->header.data_len);
193 moniker->header.data_len = 0;
194 return E_OUTOFMEMORY;
195 }
196 hr = IStream_Read(stream, moniker->data, moniker->header.data_len, &length);
197 if (hr != S_OK || length != moniker->header.data_len) return STG_E_READFAULT;
198 }
199
200 return S_OK;
201}
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
Definition: parse.h:23
uint32_t ULONG
Definition: typedefs.h:59
#define STG_E_READFAULT
Definition: winerror.h:3671

◆ ClassMoniker_ParseDisplayName()

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

Definition at line 464 of file classmoniker.c.

466{
468 HRESULT hr;
469
470 TRACE("%p, %p, %p, %s, %p, %p\n", iface, pbc, pmkToLeft, debugstr_w(display_name), eaten, result);
471
472 if (SUCCEEDED(hr = IMoniker_BindToObject(iface, pbc, pmkToLeft, &IID_IParseDisplayName, (void **)&parser)))
473 {
474 hr = IParseDisplayName_ParseDisplayName(parser, pbc, display_name, eaten, result);
475 IParseDisplayName_Release(parser);
476 }
477
478 return hr;
479}
const GUID IID_IParseDisplayName
Definition: import.c:81

◆ ClassMoniker_QueryInterface()

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

Definition at line 79 of file classmoniker.c.

80{
82
83 TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), ppvObject);
84
85 if (!ppvObject)
86 return E_POINTER;
87
88 *ppvObject = 0;
89
93 IsEqualIID(&IID_IMoniker, riid) ||
94 IsEqualGUID(&CLSID_ClassMoniker, riid))
95 {
96 *ppvObject = iface;
97 }
98 else if (IsEqualIID(&IID_IROTData, riid))
99 *ppvObject = &This->IROTData_iface;
100 else if (IsEqualIID(&IID_IMarshal, riid))
101 {
102 HRESULT hr = S_OK;
103 if (!This->pMarshal)
104 hr = MonikerMarshal_Create(iface, &This->pMarshal);
105 if (hr != S_OK)
106 return hr;
107 return IUnknown_QueryInterface(This->pMarshal, riid, ppvObject);
108 }
109
110 if (!*ppvObject)
111 return E_NOINTERFACE;
112
113 IMoniker_AddRef(iface);
114
115 return S_OK;
116}
const GUID IID_IUnknown
HRESULT MonikerMarshal_Create(IMoniker *inner, IUnknown **outer)
Definition: moniker.c:1361
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

◆ ClassMoniker_Reduce()

static HRESULT WINAPI ClassMoniker_Reduce ( IMoniker iface,
IBindCtx pbc,
DWORD  dwReduceHowFar,
IMoniker **  ppmkToLeft,
IMoniker **  ppmkReduced 
)
static

Definition at line 280 of file classmoniker.c.

282{
283 TRACE("%p, %p, %ld, %p, %p.\n", iface, pbc, dwReduceHowFar, ppmkToLeft, ppmkReduced);
284
285 if (!ppmkReduced)
286 return E_POINTER;
287
288 IMoniker_AddRef(iface);
289
290 *ppmkReduced = iface;
291
293}
#define MK_S_REDUCED_TO_SELF
Definition: winerror.h:3892

◆ ClassMoniker_RelativePathTo()

static HRESULT WINAPI ClassMoniker_RelativePathTo ( IMoniker iface,
IMoniker pmOther,
IMoniker **  ppmkRelPath 
)
static

Definition at line 421 of file classmoniker.c.

422{
423 TRACE("(%p, %p)\n",pmOther,ppmkRelPath);
424
425 if (!ppmkRelPath)
426 return E_POINTER;
427
428 *ppmkRelPath = NULL;
429
430 return MK_E_NOTBINDABLE;
431}
#define MK_E_NOTBINDABLE
Definition: winerror.h:3903

◆ ClassMoniker_Release()

static ULONG WINAPI ClassMoniker_Release ( IMoniker iface)
static

Definition at line 130 of file classmoniker.c.

131{
134
135 TRACE("%p, refcount %lu.\n", iface, ref);
136
137 if (!ref)
138 {
139 if (moniker->pMarshal) IUnknown_Release(moniker->pMarshal);
140 free(moniker->data);
141 free(moniker);
142 }
143
144 return ref;
145}
#define InterlockedDecrement
Definition: armddk.h:52
Definition: send.c:48

◆ ClassMoniker_Save()

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

Definition at line 203 of file classmoniker.c.

204{
206 HRESULT hr;
207
208 TRACE("%p, %p, %d\n", iface, stream, clear_dirty);
209
210 hr = IStream_Write(stream, &moniker->header, sizeof(moniker->header), NULL);
211
212 if (SUCCEEDED(hr) && moniker->header.data_len)
213 hr = IStream_Write(stream, moniker->data, moniker->header.data_len, NULL);
214
215 return hr;
216}

◆ ClassMonikerROTData_AddRef()

static ULONG WINAPI ClassMonikerROTData_AddRef ( IROTData iface)
static

Definition at line 512 of file classmoniker.c.

513{
515
516 TRACE("(%p)\n",iface);
517
518 return IMoniker_AddRef(&This->IMoniker_iface);
519}
static ClassMoniker * impl_from_IROTData(IROTData *iface)
Definition: classmoniker.c:62

◆ ClassMonikerROTData_GetComparisonData()

static HRESULT WINAPI ClassMonikerROTData_GetComparisonData ( IROTData iface,
BYTE pbData,
ULONG  cbMax,
ULONG pcbData 
)
static

Definition at line 536 of file classmoniker.c.

540{
542
543 TRACE("%p, %p, %lu, %p.\n", iface, pbData, cbMax, pcbData);
544
545 *pcbData = 2*sizeof(CLSID);
546 if (cbMax < *pcbData)
547 return E_OUTOFMEMORY;
548
549 /* write CLSID of the moniker */
550 memcpy(pbData, &CLSID_ClassMoniker, sizeof(CLSID));
551 /* write CLSID the moniker represents */
552 memcpy(pbData+sizeof(CLSID), &This->header.clsid, sizeof(CLSID));
553
554 return S_OK;
555}
IID CLSID
Definition: mstsclib_i.c:62
_In_ _Out_writes_opt_ pcchValueName _Inout_opt_ LPDWORD _Out_opt_ _Out_writes_bytes_to_opt_ pcbData _Inout_opt_ LPDWORD pcbData
Definition: shlwapi.h:757

◆ ClassMonikerROTData_QueryInterface()

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

Definition at line 499 of file classmoniker.c.

500{
501
503
504 TRACE("(%p, %s, %p)\n", iface, debugstr_guid(riid), ppvObject);
505
506 return IMoniker_QueryInterface(&This->IMoniker_iface, riid, ppvObject);
507}

◆ ClassMonikerROTData_Release()

static ULONG WINAPI ClassMonikerROTData_Release ( IROTData iface)
static

Definition at line 524 of file classmoniker.c.

525{
527
528 TRACE("(%p)\n",iface);
529
530 return IMoniker_Release(&This->IMoniker_iface);
531}

◆ create_class_moniker()

static HRESULT create_class_moniker ( const CLSID clsid,
const WCHAR data,
unsigned int  data_len,
IMoniker **  moniker 
)
static

Definition at line 594 of file classmoniker.c.

596{
598
599 if (!(object = calloc(1, sizeof(*object))))
600 return E_OUTOFMEMORY;
601
602 object->IMoniker_iface.lpVtbl = &ClassMonikerVtbl;
603 object->IROTData_iface.lpVtbl = &ROTDataVtbl;
604 object->ref = 1;
605 object->header.clsid = *clsid;
606 if (data_len)
607 {
608 object->header.data_len = (data_len + 1) * sizeof(WCHAR);
609
610 if (!(object->data = malloc(object->header.data_len)))
611 {
612 IMoniker_Release(&object->IMoniker_iface);
613 return E_OUTOFMEMORY;
614 }
615 memcpy(object->data, data, data_len * sizeof(WCHAR));
616 object->data[data_len] = 0;
617 }
618
619 *moniker = &object->IMoniker_iface;
620
621 return S_OK;
622}
static const IROTDataVtbl ROTDataVtbl
Definition: classmoniker.c:586
static const IMonikerVtbl ClassMonikerVtbl
Definition: classmoniker.c:67
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define calloc
Definition: rosglue.h:14
IMoniker IMoniker_iface
Definition: main.c:41

Referenced by ClassMoniker_CreateFromDisplayName(), and CreateClassMoniker().

◆ CreateClassMoniker()

HRESULT WINAPI CreateClassMoniker ( REFCLSID  rclsid,
IMoniker **  moniker 
)

◆ impl_from_IMoniker()

◆ impl_from_IROTData()

static ClassMoniker * impl_from_IROTData ( IROTData iface)
inlinestatic

◆ unsafe_impl_from_IMoniker()

static ClassMoniker * unsafe_impl_from_IMoniker ( IMoniker iface)
static

Definition at line 69 of file classmoniker.c.

70{
71 if (iface->lpVtbl != &ClassMonikerVtbl)
72 return NULL;
73 return CONTAINING_RECORD(iface, ClassMoniker, IMoniker_iface);
74}

Referenced by ClassMoniker_CommonPrefixWith(), and ClassMoniker_IsEqual().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

Variable Documentation

◆ ClassMonikerVtbl

static const IMonikerVtbl ClassMonikerVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI ClassMoniker_Enum(IMoniker *iface, BOOL fForward, IEnumMoniker **ppenumMoniker)
Definition: classmoniker.c:316
static HRESULT WINAPI ClassMoniker_Save(IMoniker *iface, IStream *stream, BOOL clear_dirty)
Definition: classmoniker.c:203
static HRESULT WINAPI ClassMoniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppvObject)
Definition: classmoniker.c:79
static ULONG WINAPI ClassMoniker_AddRef(IMoniker *iface)
Definition: classmoniker.c:121
static HRESULT WINAPI ClassMoniker_BindToObject(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riid, VOID **ppvResult)
Definition: classmoniker.c:232
static HRESULT WINAPI ClassMoniker_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riid, VOID **ppvResult)
Definition: classmoniker.c:270
static HRESULT WINAPI ClassMoniker_Hash(IMoniker *iface, DWORD *hash)
Definition: classmoniker.c:344
static ULONG WINAPI ClassMoniker_Release(IMoniker *iface)
Definition: classmoniker.c:130
static HRESULT WINAPI ClassMoniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *name)
Definition: classmoniker.c:433
static HRESULT WINAPI ClassMoniker_IsSystemMoniker(IMoniker *iface, DWORD *pwdMksys)
Definition: classmoniker.c:484
static HRESULT WINAPI ClassMoniker_IsDirty(IMoniker *iface)
Definition: classmoniker.c:165
static HRESULT WINAPI ClassMoniker_GetSizeMax(IMoniker *iface, ULARGE_INTEGER *size)
Definition: classmoniker.c:218
static HRESULT WINAPI ClassMoniker_IsEqual(IMoniker *iface, IMoniker *other)
Definition: classmoniker.c:328
static HRESULT WINAPI ClassMoniker_ComposeWith(IMoniker *iface, IMoniker *right, BOOL only_if_not_generic, IMoniker **result)
Definition: classmoniker.c:295
static HRESULT WINAPI ClassMoniker_GetClassID(IMoniker *iface, CLSID *pClassID)
Definition: classmoniker.c:150
static HRESULT WINAPI ClassMoniker_IsRunning(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, IMoniker *pmkNewlyRunning)
Definition: classmoniker.c:358
static HRESULT WINAPI ClassMoniker_Inverse(IMoniker *iface, IMoniker **ppmk)
Definition: classmoniker.c:385
static HRESULT WINAPI ClassMoniker_RelativePathTo(IMoniker *iface, IMoniker *pmOther, IMoniker **ppmkRelPath)
Definition: classmoniker.c:421
static HRESULT WINAPI ClassMoniker_CommonPrefixWith(IMoniker *iface, IMoniker *other, IMoniker **prefix)
Definition: classmoniker.c:395
static HRESULT WINAPI ClassMoniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR display_name, ULONG *eaten, IMoniker **result)
Definition: classmoniker.c:464
static HRESULT WINAPI ClassMoniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced)
Definition: classmoniker.c:280
static HRESULT WINAPI ClassMoniker_Load(IMoniker *iface, IStream *stream)
Definition: classmoniker.c:176
static HRESULT WINAPI ClassMoniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, FILETIME *pItemTime)
Definition: classmoniker.c:372

Definition at line 67 of file classmoniker.c.

Referenced by create_class_moniker(), and unsafe_impl_from_IMoniker().

◆ ROTDataVtbl

const IROTDataVtbl ROTDataVtbl
static
Initial value:
=
{
}
static ULONG WINAPI ClassMonikerROTData_Release(IROTData *iface)
Definition: classmoniker.c:524
static HRESULT WINAPI ClassMonikerROTData_GetComparisonData(IROTData *iface, BYTE *pbData, ULONG cbMax, ULONG *pcbData)
Definition: classmoniker.c:536
static HRESULT WINAPI ClassMonikerROTData_QueryInterface(IROTData *iface, REFIID riid, VOID **ppvObject)
Definition: classmoniker.c:499
static ULONG WINAPI ClassMonikerROTData_AddRef(IROTData *iface)
Definition: classmoniker.c:512

Definition at line 586 of file classmoniker.c.

Referenced by create_class_moniker().