1 /***************************************************************************************
2 * ItemMonikers implementation
4 * Copyright 1999 Noomen Hamza
5 ***************************************************************************************/
12 #include "wine/obj_base.h"
13 #include "wine/obj_storage.h"
14 #include "wine/obj_moniker.h"
18 typedef struct ItemMonikerImpl
{
20 ICOM_VTABLE(IMoniker
)* lpvtbl
;
26 static HRESULT WINAPI
ItemMonikerImpl_QueryInterface(IMoniker
* iface
,REFIID riid
,void** ppvObject
);
27 static ULONG WINAPI
ItemMonikerImpl_AddRef(IMoniker
* iface
);
28 static ULONG WINAPI
ItemMonikerImpl_Release(IMoniker
* iface
);
29 static HRESULT WINAPI
ItemMonikerImpl_GetClassID(const IMoniker
* iface
, CLSID
*pClassID
);
30 static HRESULT WINAPI
ItemMonikerImpl_IsDirty(IMoniker
* iface
);
31 static HRESULT WINAPI
ItemMonikerImpl_Load(IMoniker
* iface
, IStream32
* pStm
);
32 static HRESULT WINAPI
ItemMonikerImpl_Save(IMoniker
* iface
, IStream32
* pStm
, BOOL32 fClearDirty
);
33 static HRESULT WINAPI
ItemMonikerImpl_GetSizeMax(IMoniker
* iface
, ULARGE_INTEGER
* pcbSize
);
34 static HRESULT WINAPI
ItemMonikerImpl_BindToObject(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, REFIID riid
, VOID
** ppvResult
);
35 static HRESULT WINAPI
ItemMonikerImpl_BindToStorage(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, REFIID riid
, VOID
** ppvResult
);
36 static HRESULT WINAPI
ItemMonikerImpl_Reduce(IMoniker
* iface
,IBindCtx
* pbc
, DWORD dwReduceHowFar
,IMoniker
** ppmkToLeft
, IMoniker
** ppmkReduced
);
37 static HRESULT WINAPI
ItemMonikerImpl_ComposeWith(IMoniker
* iface
,IMoniker
* pmkRight
,BOOL32 fOnlyIfNotGeneric
, IMoniker
** ppmkComposite
);
38 static HRESULT WINAPI
ItemMonikerImpl_Enum(IMoniker
* iface
,BOOL32 fForward
, IEnumMoniker
** ppenumMoniker
);
39 static HRESULT WINAPI
ItemMonikerImpl_IsEqual(IMoniker
* iface
,IMoniker
* pmkOtherMoniker
);
40 static HRESULT WINAPI
ItemMonikerImpl_Hash(IMoniker
* iface
,DWORD
* pdwHash
);
41 static HRESULT WINAPI
ItemMonikerImpl_IsRunning(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, IMoniker
* pmkNewlyRunning
);
42 static HRESULT WINAPI
ItemMonikerImpl_GetTimeOfLastChange(IMoniker
* iface
, IBindCtx
* pbc
, IMoniker
* pmkToLeft
, FILETIME
* pItemTime
);
43 static HRESULT WINAPI
ItemMonikerImpl_Inverse(IMoniker
* iface
,IMoniker
** ppmk
);
44 static HRESULT WINAPI
ItemMonikerImpl_CommonPrefixWith(IMoniker
* iface
,IMoniker
* pmkOther
, IMoniker
** ppmkPrefix
);
45 static HRESULT WINAPI
ItemMonikerImpl_RelativePathTo(IMoniker
* iface
,IMoniker
* pmOther
, IMoniker
** ppmkRelPath
);
46 static HRESULT WINAPI
ItemMonikerImpl_GetDisplayName(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, LPOLESTR32
*ppszDisplayName
);
47 static HRESULT WINAPI
ItemMonikerImpl_ParseDisplayName(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, LPOLESTR32 pszDisplayName
, ULONG
* pchEaten
, IMoniker
** ppmkOut
);
48 static HRESULT WINAPI
ItemMonikerImpl_IsSystemMoniker(IMoniker
* iface
,DWORD
* pwdMksys
);
50 static HRESULT WINAPI
ItemMonikerImpl_Construct(ItemMonikerImpl
* iface
, LPCOLESTR32 lpszDelim
,LPCOLESTR32 lpszItem
);
51 static HRESULT WINAPI
ItemMonikerImpl_Destroy(ItemMonikerImpl
* iface
);
53 // Virtual function table for the ItemMonikerImpl class.
54 static ICOM_VTABLE(IMoniker
) VT_ItemMonikerImpl
=
56 ItemMonikerImpl_QueryInterface
,
57 ItemMonikerImpl_AddRef
,
58 ItemMonikerImpl_Release
,
59 ItemMonikerImpl_GetClassID
,
60 ItemMonikerImpl_IsDirty
,
63 ItemMonikerImpl_GetSizeMax
,
64 ItemMonikerImpl_BindToObject
,
65 ItemMonikerImpl_BindToStorage
,
66 ItemMonikerImpl_Reduce
,
67 ItemMonikerImpl_ComposeWith
,
69 ItemMonikerImpl_IsEqual
,
71 ItemMonikerImpl_IsRunning
,
72 ItemMonikerImpl_GetTimeOfLastChange
,
73 ItemMonikerImpl_Inverse
,
74 ItemMonikerImpl_CommonPrefixWith
,
75 ItemMonikerImpl_RelativePathTo
,
76 ItemMonikerImpl_GetDisplayName
,
77 ItemMonikerImpl_ParseDisplayName
,
78 ItemMonikerImpl_IsSystemMoniker
81 /*******************************************************************************
82 * ItemMoniker_QueryInterface
83 *******************************************************************************/
84 HRESULT WINAPI
ItemMonikerImpl_QueryInterface(IMoniker
* iface
,REFIID riid
,void** ppvObject
)
86 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
88 TRACE(ole
,"(%p,%p,%p)\n",This
,riid
,ppvObject
);
90 // Perform a sanity check on the parameters.
91 if ( (This
==0) || (ppvObject
==0) ) return E_INVALIDARG
;
93 // Initialize the return parameter.
96 // Compare the riid with the interface IDs implemented by this object.
97 if (memcmp(&IID_IUnknown
, riid
, sizeof(IID_IUnknown
)) == 0)
98 *ppvObject
= (IMoniker
*)This
;
100 if (memcmp(&IID_IPersist
, riid
, sizeof(IID_IPersist
)) == 0)
101 *ppvObject
= (IMoniker
*)This
;
103 if (memcmp(&IID_IPersistStream
, riid
, sizeof(IID_IPersistStream
)) == 0)
104 *ppvObject
= (IMoniker
*)This
;
106 if (memcmp(&IID_IMoniker
, riid
, sizeof(IID_IMoniker
)) == 0)
107 *ppvObject
= (IMoniker
*)This
;
109 // Check that we obtained an interface.
110 if ((*ppvObject
)==0) return E_NOINTERFACE
;
112 // Query Interface always increases the reference count by one when it is successful
113 ItemMonikerImpl_AddRef(iface
);
118 /******************************************************************************
120 ******************************************************************************/
121 ULONG WINAPI
ItemMonikerImpl_AddRef(IMoniker
* iface
)
123 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
125 TRACE(ole
,"(%p)\n",This
);
127 return ++(This
->ref
);
130 /******************************************************************************
131 * ItemMoniker_Release
132 ******************************************************************************/
133 ULONG WINAPI
ItemMonikerImpl_Release(IMoniker
* iface
)
135 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
137 TRACE(ole
,"(%p),stub!\n",This
);
142 ItemMonikerImpl_Destroy(This
);
149 /******************************************************************************
150 * ItemMoniker_GetClassID
151 ******************************************************************************/
152 HRESULT WINAPI
ItemMonikerImpl_GetClassID(const IMoniker
* iface
, CLSID
*pClassID
)//Pointer to CLSID of object
154 FIXME(ole
,"(%p),stub!\n",pClassID
);
158 /******************************************************************************
159 * ItemMoniker_IsDirty
160 ******************************************************************************/
161 HRESULT WINAPI
ItemMonikerImpl_IsDirty(IMoniker
* iface
)
163 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
165 FIXME(ole
,"(%p),stub!\n",This
);
169 /******************************************************************************
171 ******************************************************************************/
172 HRESULT WINAPI
ItemMonikerImpl_Load(
176 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
178 FIXME(ole
,"(%p,%p),stub!\n",This
,pStm
);
182 /******************************************************************************
184 ******************************************************************************/
185 HRESULT WINAPI
ItemMonikerImpl_Save(
190 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
192 FIXME(ole
,"(%p,%p,%d),stub!\n",This
,pStm
,fClearDirty
);
196 /******************************************************************************
197 * ItemMoniker_GetSizeMax
198 ******************************************************************************/
199 HRESULT WINAPI
ItemMonikerImpl_GetSizeMax(
201 ULARGE_INTEGER
* pcbSize
)
203 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
205 FIXME(ole
,"(%p,%p),stub!\n",This
,pcbSize
);
209 /******************************************************************************
210 * ItemMoniker_Construct
211 *******************************************************************************/
212 HRESULT WINAPI
ItemMonikerImpl_Construct(ItemMonikerImpl
* This
, LPCOLESTR32 lpszDelim
,LPCOLESTR32 lpszItem
){
214 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,lpszDelim
,lpszItem
);
216 memset(This
, 0, sizeof(ItemMonikerImpl
));
218 //Initialize the virtual fgunction table.
219 This
->lpvtbl
= &VT_ItemMonikerImpl
;
223 /******************************************************************************
224 * ItemMoniker_Destroy
225 *******************************************************************************/
226 HRESULT WINAPI
ItemMonikerImpl_Destroy(ItemMonikerImpl
* This
){
228 FIXME(ole
,"(%p),stub!\n",This
);
234 /******************************************************************************
235 * ItemMoniker_BindToObject
236 ******************************************************************************/
237 HRESULT WINAPI
ItemMonikerImpl_BindToObject(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
238 REFIID riid
, VOID
** ppvResult
)
240 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
242 FIXME(ole
,"(%p,%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,riid
,ppvResult
);
246 /******************************************************************************
247 * ItemMoniker_BindToStorage
248 ******************************************************************************/
249 HRESULT WINAPI
ItemMonikerImpl_BindToStorage(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
250 REFIID riid
, VOID
** ppvResult
)
252 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
254 FIXME(ole
,"(%p,%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,riid
,ppvResult
);
258 /******************************************************************************
260 ******************************************************************************/
261 HRESULT WINAPI
ItemMonikerImpl_Reduce(IMoniker
* iface
,IBindCtx
* pbc
, DWORD dwReduceHowFar
,
262 IMoniker
** ppmkToLeft
, IMoniker
** ppmkReduced
)
264 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
266 FIXME(ole
,"(%p,%p,%ld,%p,%p),stub!\n",This
,pbc
,dwReduceHowFar
,ppmkToLeft
,ppmkReduced
);
270 /******************************************************************************
271 * ItemMoniker_ComposeWith
272 ******************************************************************************/
273 HRESULT WINAPI
ItemMonikerImpl_ComposeWith(IMoniker
* iface
,IMoniker
* pmkRight
,BOOL32 fOnlyIfNotGeneric
,
274 IMoniker
** ppmkComposite
)
276 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
278 FIXME(ole
,"(%p,%p,%d,%p),stub!\n",This
,pmkRight
,fOnlyIfNotGeneric
,ppmkComposite
);
282 /******************************************************************************
284 ******************************************************************************/
285 HRESULT WINAPI
ItemMonikerImpl_Enum(IMoniker
* iface
,BOOL32 fForward
, IEnumMoniker
** ppenumMoniker
)
287 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
289 FIXME(ole
,"(%p,%d,%p),stub!\n",This
,fForward
,ppenumMoniker
);
294 /******************************************************************************
295 * ItemMoniker_IsEqual
296 ******************************************************************************/
297 HRESULT WINAPI
ItemMonikerImpl_IsEqual(IMoniker
* iface
,IMoniker
* pmkOtherMoniker
)
299 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
301 FIXME(ole
,"(%p,%p),stub!\n",This
,pmkOtherMoniker
);
305 /******************************************************************************
307 ******************************************************************************/
308 HRESULT WINAPI
ItemMonikerImpl_Hash(IMoniker
* iface
,DWORD
* pdwHash
)
310 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
312 FIXME(ole
,"(%p,%p),stub!\n",This
,pdwHash
);
316 /******************************************************************************
317 * ItemMoniker_IsRunning
318 ******************************************************************************/
319 HRESULT WINAPI
ItemMonikerImpl_IsRunning(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
320 IMoniker
* pmkNewlyRunning
)
322 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
324 FIXME(ole
,"(%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,pmkNewlyRunning
);
328 /******************************************************************************
329 * ItemMoniker_GetTimeOfLastChange
330 ******************************************************************************/
331 HRESULT WINAPI
ItemMonikerImpl_GetTimeOfLastChange(IMoniker
* iface
, IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
334 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
336 FIXME(ole
,"(%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,pFileTime
);
340 /******************************************************************************
341 * ItemMoniker_Inverse
342 ******************************************************************************/
343 HRESULT WINAPI
ItemMonikerImpl_Inverse(IMoniker
* iface
,IMoniker
** ppmk
)
345 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
347 FIXME(ole
,"(%p,%p),stub!\n",This
,ppmk
);
351 /******************************************************************************
352 * ItemMoniker_CommonPrefixWith
353 ******************************************************************************/
354 HRESULT WINAPI
ItemMonikerImpl_CommonPrefixWith(IMoniker
* iface
,IMoniker
* pmkOther
,
355 IMoniker
** ppmkPrefix
)
357 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
359 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pmkOther
,ppmkPrefix
);
363 /******************************************************************************
364 * ItemMoniker_RelativePathTo
365 ******************************************************************************/
366 HRESULT WINAPI
ItemMonikerImpl_RelativePathTo(IMoniker
* iface
,IMoniker
* pmOther
, IMoniker
** ppmkRelPath
)
368 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
370 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pmOther
,ppmkRelPath
);
374 /******************************************************************************
375 * ItemMoniker_GetDisplayName
376 ******************************************************************************/
377 HRESULT WINAPI
ItemMonikerImpl_GetDisplayName(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
378 LPOLESTR32
*ppszDisplayName
)
380 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
382 FIXME(ole
,"(%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,ppszDisplayName
);
386 /******************************************************************************
387 * ItemMoniker_ParseDisplayName
388 ******************************************************************************/
389 HRESULT WINAPI
ItemMonikerImpl_ParseDisplayName(IMoniker
* iface
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
390 LPOLESTR32 pszDisplayName
, ULONG
* pchEaten
, IMoniker
** ppmkOut
)
392 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
394 FIXME(ole
,"(%p,%p,%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,pszDisplayName
,pchEaten
,ppmkOut
);
398 /******************************************************************************
399 * ItemMoniker_IsSystemMonker
400 ******************************************************************************/
401 HRESULT WINAPI
ItemMonikerImpl_IsSystemMoniker(IMoniker
* iface
,DWORD
* pwdMksys
)
403 ItemMonikerImpl
* This
=(ItemMonikerImpl
*)iface
;
405 FIXME(ole
,"(%p,%p),stub!\n",This
,pwdMksys
);
409 /******************************************************************************
410 * CreateItemMoniker16 [OLE2.28]
411 ******************************************************************************/
412 HRESULT WINAPI
CreateItemMoniker16(LPCOLESTR16 lpszDelim
,LPCOLESTR32 lpszItem
,LPMONIKER
* ppmk
){// [in] pathname [out] new moniker object
414 FIXME(ole
,"(%s,%p),stub!\n",lpszDelim
,ppmk
);
419 /******************************************************************************
420 * CreateItemMoniker32 [OLE32.55]
421 ******************************************************************************/
422 HRESULT WINAPI
CreateItemMoniker32(LPCOLESTR32 lpszDelim
,LPCOLESTR32 lpszItem
, LPMONIKER
* ppmk
)
425 ItemMonikerImpl
* newItemMoniker
= 0;
428 TRACE(ole
,"(%p,%p,%p)\n",lpszDelim
,lpszItem
,ppmk
);
430 newItemMoniker
= HeapAlloc(GetProcessHeap(), 0, sizeof(ItemMonikerImpl
));
432 if (newItemMoniker
== 0)
433 return STG_E_INSUFFICIENTMEMORY
;
435 hr
= ItemMonikerImpl_Construct(newItemMoniker
,lpszDelim
,lpszItem
);
440 hr
= ItemMonikerImpl_QueryInterface((IMoniker
*)newItemMoniker
,&IID_IMoniker
,(void**)ppmk
);