1 /***************************************************************************************
2 * ItemMonikers implementation
4 * Copyright 1999 Noomen Hamza
5 ***************************************************************************************/
12 #include "wine/obj_moniker.h"
16 typedef struct ItemMonikerImpl
{
18 ICOM_VTABLE(IMoniker
)* lpvtbl
;
24 static HRESULT WINAPI
ItemMonikerImpl_QueryInterface(IMoniker
* iface
,REFIID riid
,void** ppvObject
);
25 static ULONG WINAPI
ItemMonikerImpl_AddRef(IMoniker
* iface
);
26 static ULONG WINAPI
ItemMonikerImpl_Release(IMoniker
* iface
);
27 static HRESULT WINAPI
ItemMonikerImpl_GetClassID(const IMoniker
* iface
, CLSID
*pClassID
);
28 static HRESULT WINAPI
ItemMonikerImpl_IsDirty(IMoniker
* iface
);
29 static HRESULT WINAPI
ItemMonikerImpl_Load(IMoniker
* iface
, IStream
* pStm
);
30 static HRESULT WINAPI
ItemMonikerImpl_Save(IMoniker
* iface
, IStream
* pStm
, BOOL fClearDirty
);
31 static HRESULT WINAPI
ItemMonikerImpl_GetSizeMax(IMoniker
* iface
, ULARGE_INTEGER
* pcbSize
);
32 static HRESULT WINAPI
ItemMonikerImpl_BindToObject(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, REFIID riid
, VOID
** ppvResult
);
33 static HRESULT WINAPI
ItemMonikerImpl_BindToStorage(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, REFIID riid
, VOID
** ppvResult
);
34 static HRESULT WINAPI
ItemMonikerImpl_Reduce(IMoniker
* iface
,IBindCtx
* pbc
, DWORD dwReduceHowFar
,IMoniker
** ppmkToLeft
, IMoniker
** ppmkReduced
);
35 static HRESULT WINAPI
ItemMonikerImpl_ComposeWith(IMoniker
* iface
,IMoniker
* pmkRight
,BOOL fOnlyIfNotGeneric
, IMoniker
** ppmkComposite
);
36 static HRESULT WINAPI
ItemMonikerImpl_Enum(IMoniker
* iface
,BOOL fForward
, IEnumMoniker
** ppenumMoniker
);
37 static HRESULT WINAPI
ItemMonikerImpl_IsEqual(IMoniker
* iface
,IMoniker
* pmkOtherMoniker
);
38 static HRESULT WINAPI
ItemMonikerImpl_Hash(IMoniker
* iface
,DWORD
* pdwHash
);
39 static HRESULT WINAPI
ItemMonikerImpl_IsRunning(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, IMoniker
* pmkNewlyRunning
);
40 static HRESULT WINAPI
ItemMonikerImpl_GetTimeOfLastChange(IMoniker
* iface
, IBindCtx
* pbc
, IMoniker
* pmkToLeft
, FILETIME
* pItemTime
);
41 static HRESULT WINAPI
ItemMonikerImpl_Inverse(IMoniker
* iface
,IMoniker
** ppmk
);
42 static HRESULT WINAPI
ItemMonikerImpl_CommonPrefixWith(IMoniker
* iface
,IMoniker
* pmkOther
, IMoniker
** ppmkPrefix
);
43 static HRESULT WINAPI
ItemMonikerImpl_RelativePathTo(IMoniker
* iface
,IMoniker
* pmOther
, IMoniker
** ppmkRelPath
);
44 static HRESULT WINAPI
ItemMonikerImpl_GetDisplayName(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, LPOLESTR
*ppszDisplayName
);
45 static HRESULT WINAPI
ItemMonikerImpl_ParseDisplayName(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, LPOLESTR pszDisplayName
, ULONG
* pchEaten
, IMoniker
** ppmkOut
);
46 static HRESULT WINAPI
ItemMonikerImpl_IsSystemMoniker(IMoniker
* iface
,DWORD
* pwdMksys
);
48 static HRESULT WINAPI
ItemMonikerImpl_Construct(ItemMonikerImpl
* iface
, LPCOLESTR lpszDelim
,LPCOLESTR lpszItem
);
49 static HRESULT WINAPI
ItemMonikerImpl_Destroy(ItemMonikerImpl
* iface
);
51 // Virtual function table for the ItemMonikerImpl class.
52 static ICOM_VTABLE(IMoniker
) VT_ItemMonikerImpl
=
54 ItemMonikerImpl_QueryInterface
,
55 ItemMonikerImpl_AddRef
,
56 ItemMonikerImpl_Release
,
57 ItemMonikerImpl_GetClassID
,
58 ItemMonikerImpl_IsDirty
,
61 ItemMonikerImpl_GetSizeMax
,
62 ItemMonikerImpl_BindToObject
,
63 ItemMonikerImpl_BindToStorage
,
64 ItemMonikerImpl_Reduce
,
65 ItemMonikerImpl_ComposeWith
,
67 ItemMonikerImpl_IsEqual
,
69 ItemMonikerImpl_IsRunning
,
70 ItemMonikerImpl_GetTimeOfLastChange
,
71 ItemMonikerImpl_Inverse
,
72 ItemMonikerImpl_CommonPrefixWith
,
73 ItemMonikerImpl_RelativePathTo
,
74 ItemMonikerImpl_GetDisplayName
,
75 ItemMonikerImpl_ParseDisplayName
,
76 ItemMonikerImpl_IsSystemMoniker
79 /*******************************************************************************
80 * ItemMoniker_QueryInterface
81 *******************************************************************************/
82 HRESULT WINAPI
ItemMonikerImpl_QueryInterface(IMoniker
* iface
,REFIID riid
,void** ppvObject
)
84 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
86 TRACE(ole
,"(%p,%p,%p)\n",This
,riid
,ppvObject
);
88 // Perform a sanity check on the parameters.
89 if ( (This
==0) || (ppvObject
==0) ) return E_INVALIDARG
;
91 // Initialize the return parameter.
94 // Compare the riid with the interface IDs implemented by this object.
95 if (memcmp(&IID_IUnknown
, riid
, sizeof(IID_IUnknown
)) == 0)
96 *ppvObject
= (IMoniker
*)This
;
98 if (memcmp(&IID_IPersist
, riid
, sizeof(IID_IPersist
)) == 0)
99 *ppvObject
= (IMoniker
*)This
;
101 if (memcmp(&IID_IPersistStream
, riid
, sizeof(IID_IPersistStream
)) == 0)
102 *ppvObject
= (IMoniker
*)This
;
104 if (memcmp(&IID_IMoniker
, riid
, sizeof(IID_IMoniker
)) == 0)
105 *ppvObject
= (IMoniker
*)This
;
107 // Check that we obtained an interface.
108 if ((*ppvObject
)==0) return E_NOINTERFACE
;
110 // Query Interface always increases the reference count by one when it is successful
111 ItemMonikerImpl_AddRef(iface
);
116 /******************************************************************************
118 ******************************************************************************/
119 ULONG WINAPI
ItemMonikerImpl_AddRef(IMoniker
* iface
)
121 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
123 TRACE(ole
,"(%p)\n",This
);
125 return ++(This
->ref
);
128 /******************************************************************************
129 * ItemMoniker_Release
130 ******************************************************************************/
131 ULONG WINAPI
ItemMonikerImpl_Release(IMoniker
* iface
)
133 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
135 TRACE(ole
,"(%p),stub!\n",This
);
140 ItemMonikerImpl_Destroy(This
);
147 /******************************************************************************
148 * ItemMoniker_GetClassID
149 ******************************************************************************/
150 HRESULT WINAPI
ItemMonikerImpl_GetClassID(const IMoniker
* iface
, CLSID
*pClassID
)//Pointer to CLSID of object
152 FIXME(ole
,"(%p),stub!\n",pClassID
);
156 /******************************************************************************
157 * ItemMoniker_IsDirty
158 ******************************************************************************/
159 HRESULT WINAPI
ItemMonikerImpl_IsDirty(IMoniker
* iface
)
161 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
163 FIXME(ole
,"(%p),stub!\n",This
);
167 /******************************************************************************
169 ******************************************************************************/
170 HRESULT WINAPI
ItemMonikerImpl_Load(
174 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
176 FIXME(ole
,"(%p,%p),stub!\n",This
,pStm
);
180 /******************************************************************************
182 ******************************************************************************/
183 HRESULT WINAPI
ItemMonikerImpl_Save(
188 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
190 FIXME(ole
,"(%p,%p,%d),stub!\n",This
,pStm
,fClearDirty
);
194 /******************************************************************************
195 * ItemMoniker_GetSizeMax
196 ******************************************************************************/
197 HRESULT WINAPI
ItemMonikerImpl_GetSizeMax(
199 ULARGE_INTEGER
* pcbSize
)
201 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
203 FIXME(ole
,"(%p,%p),stub!\n",This
,pcbSize
);
207 /******************************************************************************
208 * ItemMoniker_Construct
209 *******************************************************************************/
210 HRESULT WINAPI
ItemMonikerImpl_Construct(ItemMonikerImpl
* This
, LPCOLESTR lpszDelim
,LPCOLESTR lpszItem
){
212 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,lpszDelim
,lpszItem
);
214 memset(This
, 0, sizeof(ItemMonikerImpl
));
216 //Initialize the virtual fgunction table.
217 This
->lpvtbl
= &VT_ItemMonikerImpl
;
221 /******************************************************************************
222 * ItemMoniker_Destroy
223 *******************************************************************************/
224 HRESULT WINAPI
ItemMonikerImpl_Destroy(ItemMonikerImpl
* This
){
226 FIXME(ole
,"(%p),stub!\n",This
);
232 /******************************************************************************
233 * ItemMoniker_BindToObject
234 ******************************************************************************/
235 HRESULT WINAPI
ItemMonikerImpl_BindToObject(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
236 REFIID riid
, VOID
** ppvResult
)
238 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
240 FIXME(ole
,"(%p,%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,riid
,ppvResult
);
244 /******************************************************************************
245 * ItemMoniker_BindToStorage
246 ******************************************************************************/
247 HRESULT WINAPI
ItemMonikerImpl_BindToStorage(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
248 REFIID riid
, VOID
** ppvResult
)
250 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
252 FIXME(ole
,"(%p,%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,riid
,ppvResult
);
256 /******************************************************************************
258 ******************************************************************************/
259 HRESULT WINAPI
ItemMonikerImpl_Reduce(IMoniker
* iface
,IBindCtx
* pbc
, DWORD dwReduceHowFar
,
260 IMoniker
** ppmkToLeft
, IMoniker
** ppmkReduced
)
262 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
264 FIXME(ole
,"(%p,%p,%ld,%p,%p),stub!\n",This
,pbc
,dwReduceHowFar
,ppmkToLeft
,ppmkReduced
);
268 /******************************************************************************
269 * ItemMoniker_ComposeWith
270 ******************************************************************************/
271 HRESULT WINAPI
ItemMonikerImpl_ComposeWith(IMoniker
* iface
,IMoniker
* pmkRight
,BOOL fOnlyIfNotGeneric
,
272 IMoniker
** ppmkComposite
)
274 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
276 FIXME(ole
,"(%p,%p,%d,%p),stub!\n",This
,pmkRight
,fOnlyIfNotGeneric
,ppmkComposite
);
280 /******************************************************************************
282 ******************************************************************************/
283 HRESULT WINAPI
ItemMonikerImpl_Enum(IMoniker
* iface
,BOOL fForward
, IEnumMoniker
** ppenumMoniker
)
285 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
287 FIXME(ole
,"(%p,%d,%p),stub!\n",This
,fForward
,ppenumMoniker
);
292 /******************************************************************************
293 * ItemMoniker_IsEqual
294 ******************************************************************************/
295 HRESULT WINAPI
ItemMonikerImpl_IsEqual(IMoniker
* iface
,IMoniker
* pmkOtherMoniker
)
297 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
299 FIXME(ole
,"(%p,%p),stub!\n",This
,pmkOtherMoniker
);
303 /******************************************************************************
305 ******************************************************************************/
306 HRESULT WINAPI
ItemMonikerImpl_Hash(IMoniker
* iface
,DWORD
* pdwHash
)
308 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
310 FIXME(ole
,"(%p,%p),stub!\n",This
,pdwHash
);
314 /******************************************************************************
315 * ItemMoniker_IsRunning
316 ******************************************************************************/
317 HRESULT WINAPI
ItemMonikerImpl_IsRunning(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
318 IMoniker
* pmkNewlyRunning
)
320 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
322 FIXME(ole
,"(%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,pmkNewlyRunning
);
326 /******************************************************************************
327 * ItemMoniker_GetTimeOfLastChange
328 ******************************************************************************/
329 HRESULT WINAPI
ItemMonikerImpl_GetTimeOfLastChange(IMoniker
* iface
, IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
332 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
334 FIXME(ole
,"(%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,pFileTime
);
338 /******************************************************************************
339 * ItemMoniker_Inverse
340 ******************************************************************************/
341 HRESULT WINAPI
ItemMonikerImpl_Inverse(IMoniker
* iface
,IMoniker
** ppmk
)
343 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
345 FIXME(ole
,"(%p,%p),stub!\n",This
,ppmk
);
349 /******************************************************************************
350 * ItemMoniker_CommonPrefixWith
351 ******************************************************************************/
352 HRESULT WINAPI
ItemMonikerImpl_CommonPrefixWith(IMoniker
* iface
,IMoniker
* pmkOther
,
353 IMoniker
** ppmkPrefix
)
355 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
357 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pmkOther
,ppmkPrefix
);
361 /******************************************************************************
362 * ItemMoniker_RelativePathTo
363 ******************************************************************************/
364 HRESULT WINAPI
ItemMonikerImpl_RelativePathTo(IMoniker
* iface
,IMoniker
* pmOther
, IMoniker
** ppmkRelPath
)
366 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
368 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pmOther
,ppmkRelPath
);
372 /******************************************************************************
373 * ItemMoniker_GetDisplayName
374 ******************************************************************************/
375 HRESULT WINAPI
ItemMonikerImpl_GetDisplayName(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
376 LPOLESTR
*ppszDisplayName
)
378 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
380 FIXME(ole
,"(%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,ppszDisplayName
);
384 /******************************************************************************
385 * ItemMoniker_ParseDisplayName
386 ******************************************************************************/
387 HRESULT WINAPI
ItemMonikerImpl_ParseDisplayName(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
388 LPOLESTR pszDisplayName
, ULONG
* pchEaten
, IMoniker
** ppmkOut
)
390 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
392 FIXME(ole
,"(%p,%p,%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,pszDisplayName
,pchEaten
,ppmkOut
);
396 /******************************************************************************
397 * ItemMoniker_IsSystemMonker
398 ******************************************************************************/
399 HRESULT WINAPI
ItemMonikerImpl_IsSystemMoniker(IMoniker
* iface
,DWORD
* pwdMksys
)
401 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
403 FIXME(ole
,"(%p,%p),stub!\n",This
,pwdMksys
);
407 /******************************************************************************
408 * CreateItemMoniker16 [OLE2.28]
409 ******************************************************************************/
410 HRESULT WINAPI
CreateItemMoniker16(LPCOLESTR16 lpszDelim
,LPCOLESTR lpszItem
,LPMONIKER
* ppmk
){// [in] pathname [out] new moniker object
412 FIXME(ole
,"(%s,%p),stub!\n",lpszDelim
,ppmk
);
417 /******************************************************************************
418 * CreateItemMoniker32 [OLE32.55]
419 ******************************************************************************/
420 HRESULT WINAPI
CreateItemMoniker(LPCOLESTR lpszDelim
,LPCOLESTR lpszItem
, LPMONIKER
* ppmk
)
423 ItemMonikerImpl
* newItemMoniker
= 0;
426 TRACE(ole
,"(%p,%p,%p)\n",lpszDelim
,lpszItem
,ppmk
);
428 newItemMoniker
= HeapAlloc(GetProcessHeap(), 0, sizeof(ItemMonikerImpl
));
430 if (newItemMoniker
== 0)
431 return STG_E_INSUFFICIENTMEMORY
;
433 hr
= ItemMonikerImpl_Construct(newItemMoniker
,lpszDelim
,lpszItem
);
438 hr
= ItemMonikerImpl_QueryInterface((IMoniker
*)newItemMoniker
,&IID_IMoniker
,(void**)ppmk
);