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 HRESULT WINAPI
ItemMonikerImpl_QueryInterface(ItemMonikerImpl
* This
,REFIID riid
,void** ppvObject
);
27 ULONG WINAPI
ItemMonikerImpl_AddRef(ItemMonikerImpl
* This
);
28 ULONG WINAPI
ItemMonikerImpl_Release(ItemMonikerImpl
* This
);
29 HRESULT WINAPI
ItemMonikerImpl_GetClassID(ItemMonikerImpl
* This
, CLSID
*pClassID
);
30 HRESULT WINAPI
ItemMonikerImpl_IsDirty(ItemMonikerImpl
* This
);
31 HRESULT WINAPI
ItemMonikerImpl_Load(ItemMonikerImpl
* This
,LPCOLESTR32 pszItemName
,DWORD dwMode
);
32 HRESULT WINAPI
ItemMonikerImpl_Save(ItemMonikerImpl
* This
,LPCOLESTR32 pszItemName
,BOOL32 fRemember
);
33 HRESULT WINAPI
ItemMonikerImpl_GetSizeMax(ItemMonikerImpl
* This
,LPOLESTR32
*ppszItemName
);
34 HRESULT WINAPI
ItemMonikerImpl_Construct(ItemMonikerImpl
* This
, LPCOLESTR32 lpszDelim
,LPCOLESTR32 lpszItem
);
35 HRESULT WINAPI
ItemMonikerImpl_destroy(ItemMonikerImpl
* This
);
36 HRESULT WINAPI
ItemMonikerImpl_BindToObject(ItemMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, REFIID riid
, VOID
** ppvResult
);
37 HRESULT WINAPI
ItemMonikerImpl_BindToStorage(ItemMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, REFIID riid
, VOID
** ppvResult
);
38 HRESULT WINAPI
ItemMonikerImpl_Reduce(ItemMonikerImpl
* This
,IBindCtx
* pbc
, DWORD dwReduceHowFar
,IMoniker
** ppmkToLeft
, IMoniker
** ppmkReduced
);
39 HRESULT WINAPI
ItemMonikerImpl_ComposeWith(ItemMonikerImpl
* This
,IMoniker
* pmkRight
,BOOL32 fOnlyIfNotGeneric
, IMoniker
** ppmkComposite
);
40 HRESULT WINAPI
ItemMonikerImpl_Enum(ItemMonikerImpl
* This
,BOOL32 fForward
, IEnumMoniker
** ppenumMoniker
);
41 HRESULT WINAPI
ItemMonikerImpl_IsEqual(ItemMonikerImpl
* This
,IMoniker
* pmkOtherMoniker
);
42 HRESULT WINAPI
ItemMonikerImpl_Hash(ItemMonikerImpl
* This
,DWORD
* pdwHash
);
43 HRESULT WINAPI
ItemMonikerImpl_IsRunning(ItemMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, IMoniker
* pmkNewlyRunning
);
44 HRESULT WINAPI
ItemMonikerImpl_GetTimeOfLastChange(ItemMonikerImpl
* This
, IBindCtx
* pbc
, IMoniker
* pmkToLeft
, FILETIME
* pItemTime
);
45 HRESULT WINAPI
ItemMonikerImpl_Inverse(ItemMonikerImpl
* This
,IMoniker
** ppmk
);
46 HRESULT WINAPI
ItemMonikerImpl_CommonPrefixWith(ItemMonikerImpl
* This
,IMoniker
* pmkOther
, IMoniker
** ppmkPrefix
);
47 HRESULT WINAPI
ItemMonikerImpl_RelativePathTo(ItemMonikerImpl
* This
,IMoniker
* pmOther
, IMoniker
** ppmkRelPath
);
48 HRESULT WINAPI
ItemMonikerImpl_GetDisplayName(ItemMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, LPOLESTR32
*ppszDisplayName
);
49 HRESULT WINAPI
ItemMonikerImpl_ParseDisplayName(ItemMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, LPOLESTR32 pszDisplayName
, ULONG
* pchEaten
, IMoniker
** ppmkOut
);
50 HRESULT WINAPI
ItemMonikerImpl_IsSystemMoniker(ItemMonikerImpl
* This
,DWORD
* pwdMksys
);
51 HRESULT WINAPI
CreateItemMoniker16(LPCOLESTR16 lpszDelim
,LPCOLESTR32 lpszItem
,LPMONIKER
* ppmk
);
52 HRESULT WINAPI
CreateItemMoniker32(LPCOLESTR32 lpszDelim
,LPCOLESTR32 lpszItem
,LPMONIKER
* ppmk
);
54 #define VTABLE_FUNC(a) (void*)(a)
55 // Virtual function table for the ItemMonikerImpl class.
56 static ICOM_VTABLE(IMoniker
) VT_ItemMonikerImpl
=
61 VTABLE_FUNC(ItemMonikerImpl_QueryInterface
),
62 VTABLE_FUNC(ItemMonikerImpl_AddRef
),
63 VTABLE_FUNC(ItemMonikerImpl_Release
)
65 VTABLE_FUNC(ItemMonikerImpl_GetClassID
)
67 VTABLE_FUNC(ItemMonikerImpl_IsDirty
),
68 VTABLE_FUNC(ItemMonikerImpl_Load
),
69 VTABLE_FUNC(ItemMonikerImpl_Save
),
70 VTABLE_FUNC(ItemMonikerImpl_GetSizeMax
)
72 VTABLE_FUNC(ItemMonikerImpl_BindToObject
),
73 VTABLE_FUNC(ItemMonikerImpl_BindToStorage
),
74 VTABLE_FUNC(ItemMonikerImpl_Reduce
),
75 VTABLE_FUNC(ItemMonikerImpl_ComposeWith
),
76 VTABLE_FUNC(ItemMonikerImpl_Enum
),
77 VTABLE_FUNC(ItemMonikerImpl_IsEqual
),
78 VTABLE_FUNC(ItemMonikerImpl_Hash
),
79 VTABLE_FUNC(ItemMonikerImpl_IsRunning
),
80 VTABLE_FUNC(ItemMonikerImpl_GetTimeOfLastChange
),
81 VTABLE_FUNC(ItemMonikerImpl_Inverse
),
82 VTABLE_FUNC(ItemMonikerImpl_CommonPrefixWith
),
83 VTABLE_FUNC(ItemMonikerImpl_RelativePathTo
),
84 VTABLE_FUNC(ItemMonikerImpl_GetDisplayName
),
85 VTABLE_FUNC(ItemMonikerImpl_ParseDisplayName
),
86 VTABLE_FUNC(ItemMonikerImpl_IsSystemMoniker
)
89 /*******************************************************************************
90 * ItemMoniker_QueryInterface
91 *******************************************************************************/
92 HRESULT WINAPI
ItemMonikerImpl_QueryInterface(ItemMonikerImpl
* This
,REFIID riid
,void** ppvObject
){
94 TRACE(ole
,"(%p,%p,%p)\n",This
,riid
,ppvObject
);
96 // Perform a sanity check on the parameters.
97 if ( (This
==0) || (ppvObject
==0) ) return E_INVALIDARG
;
99 // Initialize the return parameter.
102 // Compare the riid with the interface IDs implemented by this object.
103 if (memcmp(&IID_IUnknown
, riid
, sizeof(IID_IUnknown
)) == 0)
104 *ppvObject
= (IMoniker
*)This
;
106 if (memcmp(&IID_IPersist
, riid
, sizeof(IID_IPersist
)) == 0)
107 *ppvObject
= (IMoniker
*)This
;
109 if (memcmp(&IID_IPersistStream
, riid
, sizeof(IID_IPersistStream
)) == 0)
110 *ppvObject
= (IMoniker
*)This
;
112 if (memcmp(&IID_IMoniker
, riid
, sizeof(IID_IMoniker
)) == 0)
113 *ppvObject
= (IMoniker
*)This
;
115 // Check that we obtained an interface.
116 if ((*ppvObject
)==0) return E_NOINTERFACE
;
118 // Query Interface always increases the reference count by one when it is successful
119 ItemMonikerImpl_AddRef(This
);
124 /******************************************************************************
126 ******************************************************************************/
127 ULONG WINAPI
ItemMonikerImpl_AddRef(ItemMonikerImpl
* This
){
129 TRACE(ole
,"(%p)\n",This
);
131 return ++(This
->ref
);
134 /******************************************************************************
135 * ItemMoniker_Release
136 ******************************************************************************/
137 ULONG WINAPI
ItemMonikerImpl_Release(ItemMonikerImpl
* This
){
139 TRACE(ole
,"(%p),stub!\n",This
);
144 ItemMonikerImpl_destroy(This
);
151 /******************************************************************************
152 * ItemMoniker_GetClassID
153 ******************************************************************************/
154 HRESULT WINAPI
ItemMonikerImpl_GetClassID(ItemMonikerImpl
* This
, CLSID
*pClassID
){//Pointer to CLSID of object
156 FIXME(ole
,"(%p),stub!\n",pClassID
);
160 /******************************************************************************
161 * ItemMoniker_IsDirty
162 ******************************************************************************/
163 HRESULT WINAPI
ItemMonikerImpl_IsDirty(ItemMonikerImpl
* This
)
165 FIXME(ole
,"(%p),stub!\n",This
);
169 /******************************************************************************
171 ******************************************************************************/
172 HRESULT WINAPI
ItemMonikerImpl_Load(
173 ItemMonikerImpl
* This
,
174 LPCOLESTR32 pszFileName
,//Pointer to absolute path of the file to open
175 DWORD dwMode
) //Specifies the access mode from the STGM enumeration
177 FIXME(ole
,"(%p,%ld),stub!\n",pszFileName
,dwMode
);
181 /******************************************************************************
183 ******************************************************************************/
184 HRESULT WINAPI
ItemMonikerImpl_Save(
185 ItemMonikerImpl
* This
,
186 LPCOLESTR32 pszFileName
, //Pointer to absolute path of the file where the object is saved
187 BOOL32 fRemember
) //Specifies whether the file is to be the current working file or not
189 FIXME(ole
,"(%p,%d),stub!\n",pszFileName
,fRemember
);
193 /******************************************************************************
194 * ItemMoniker_GetSizeMax
195 ******************************************************************************/
196 HRESULT WINAPI
ItemMonikerImpl_GetSizeMax(
197 ItemMonikerImpl
* This
,
198 LPOLESTR32
*ppszFileName
) //Pointer to the path for the current file or the default save prompt
200 FIXME(ole
,"(%p),stub!\n",ppszFileName
);
204 /******************************************************************************
205 * ItemMoniker_Constructor
206 *******************************************************************************/
207 HRESULT WINAPI
ItemMonikerImpl_Construct(ItemMonikerImpl
* This
, LPCOLESTR32 lpszDelim
,LPCOLESTR32 lpszItem
){
209 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,lpszDelim
,lpszItem
);
211 memset(This
, 0, sizeof(ItemMonikerImpl
));
213 //Initialize the virtual fgunction table.
214 This
->lpvtbl
= &VT_ItemMonikerImpl
;
218 /******************************************************************************
219 * ItemMoniker_destructor
220 *******************************************************************************/
221 HRESULT WINAPI
ItemMonikerImpl_destroy(ItemMonikerImpl
* This
){
223 FIXME(ole
,"(%p),stub!\n",This
);
229 /******************************************************************************
230 * ItemMoniker_BindToObject
231 ******************************************************************************/
232 HRESULT WINAPI
ItemMonikerImpl_BindToObject(ItemMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
233 REFIID riid
, VOID
** ppvResult
){
235 FIXME(ole
,"(%p,%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,riid
,ppvResult
);
239 /******************************************************************************
240 * ItemMoniker_BindToStorage
241 ******************************************************************************/
242 HRESULT WINAPI
ItemMonikerImpl_BindToStorage(ItemMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
243 REFIID riid
, VOID
** ppvResult
){
245 FIXME(ole
,"(%p,%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,riid
,ppvResult
);
249 /******************************************************************************
251 ******************************************************************************/
252 HRESULT WINAPI
ItemMonikerImpl_Reduce(ItemMonikerImpl
* This
,IBindCtx
* pbc
, DWORD dwReduceHowFar
,
253 IMoniker
** ppmkToLeft
, IMoniker
** ppmkReduced
){
255 FIXME(ole
,"(%p,%p,%ld,%p,%p),stub!\n",This
,pbc
,dwReduceHowFar
,ppmkToLeft
,ppmkReduced
);
259 /******************************************************************************
260 * ItemMoniker_ComposeWith
261 ******************************************************************************/
262 HRESULT WINAPI
ItemMonikerImpl_ComposeWith(ItemMonikerImpl
* This
,IMoniker
* pmkRight
,BOOL32 fOnlyIfNotGeneric
,
263 IMoniker
** ppmkComposite
){
265 FIXME(ole
,"(%p,%p,%d,%p),stub!\n",This
,pmkRight
,fOnlyIfNotGeneric
,ppmkComposite
);
269 /******************************************************************************
271 ******************************************************************************/
272 HRESULT WINAPI
ItemMonikerImpl_Enum(ItemMonikerImpl
* This
,BOOL32 fForward
, IEnumMoniker
** ppenumMoniker
){
274 FIXME(ole
,"(%p,%d,%p),stub!\n",This
,fForward
,ppenumMoniker
);
279 /******************************************************************************
280 * ItemMoniker_IsEqual
281 ******************************************************************************/
282 HRESULT WINAPI
ItemMonikerImpl_IsEqual(ItemMonikerImpl
* This
,IMoniker
* pmkOtherMoniker
){
284 FIXME(ole
,"(%p,%p),stub!\n",This
,pmkOtherMoniker
);
288 /******************************************************************************
290 ******************************************************************************/
291 HRESULT WINAPI
ItemMonikerImpl_Hash(ItemMonikerImpl
* This
,DWORD
* pdwHash
){
293 FIXME(ole
,"(%p,%p),stub!\n",This
,pdwHash
);
297 /******************************************************************************
298 * ItemMoniker_IsRunning
299 ******************************************************************************/
300 HRESULT WINAPI
ItemMonikerImpl_IsRunning(ItemMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
301 IMoniker
* pmkNewlyRunning
){
303 FIXME(ole
,"(%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,pmkNewlyRunning
);
307 /******************************************************************************
308 * ItemMoniker_GetTimeOfLastChange
309 ******************************************************************************/
310 HRESULT WINAPI
ItemMonikerImpl_GetTimeOfLastChange(ItemMonikerImpl
* This
, IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
311 FILETIME
* pFileTime
){
313 FIXME(ole
,"(%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,pFileTime
);
317 /******************************************************************************
318 * ItemMoniker_Inverse
319 ******************************************************************************/
320 HRESULT WINAPI
ItemMonikerImpl_Inverse(ItemMonikerImpl
* This
,IMoniker
** ppmk
){
322 FIXME(ole
,"(%p,%p),stub!\n",This
,ppmk
);
326 /******************************************************************************
327 * ItemMoniker_CommonPrefixWith
328 ******************************************************************************/
329 HRESULT WINAPI
ItemMonikerImpl_CommonPrefixWith(ItemMonikerImpl
* This
,IMoniker
* pmkOther
,
330 IMoniker
** ppmkPrefix
){
332 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pmkOther
,ppmkPrefix
);
336 /******************************************************************************
337 * ItemMoniker_RelativePathTo
338 ******************************************************************************/
339 HRESULT WINAPI
ItemMonikerImpl_RelativePathTo(ItemMonikerImpl
* This
,IMoniker
* pmOther
, IMoniker
** ppmkRelPath
){
341 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pmOther
,ppmkRelPath
);
345 /******************************************************************************
346 * ItemMoniker_GetDisplayName
347 ******************************************************************************/
348 HRESULT WINAPI
ItemMonikerImpl_GetDisplayName(ItemMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
349 LPOLESTR32
*ppszDisplayName
){
351 FIXME(ole
,"(%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,ppszDisplayName
);
355 /******************************************************************************
356 * ItemMoniker_ParseDisplayName
357 ******************************************************************************/
358 HRESULT WINAPI
ItemMonikerImpl_ParseDisplayName(ItemMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
359 LPOLESTR32 pszDisplayName
, ULONG
* pchEaten
, IMoniker
** ppmkOut
){
361 FIXME(ole
,"(%p,%p,%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,pszDisplayName
,pchEaten
,ppmkOut
);
365 /******************************************************************************
366 * ItemMoniker_IsSystemMonker
367 ******************************************************************************/
368 HRESULT WINAPI
ItemMonikerImpl_IsSystemMoniker(ItemMonikerImpl
* This
,DWORD
* pwdMksys
){
370 FIXME(ole
,"(%p,%p),stub!\n",This
,pwdMksys
);
374 /******************************************************************************
375 * CreateItemMoniker16 [OLE2.28]
376 ******************************************************************************/
377 HRESULT WINAPI
CreateItemMoniker16(LPCOLESTR16 lpszDelim
,LPCOLESTR32 lpszItem
,LPMONIKER
* ppmk
){// [in] pathname [out] new moniker object
379 FIXME(ole
,"(%s,%p),stub!\n",lpszDelim
,ppmk
);
384 /******************************************************************************
385 * CreateItemMoniker32 [OLE32.55]
386 ******************************************************************************/
387 HRESULT WINAPI
CreateItemMoniker32(LPCOLESTR32 lpszDelim
,LPCOLESTR32 lpszItem
, LPMONIKER
* ppmk
)
390 ItemMonikerImpl
* newItemMoniker
= 0;
393 TRACE(ole
,"(%p,%p,%p)\n",lpszDelim
,lpszItem
,ppmk
);
395 newItemMoniker
= HeapAlloc(GetProcessHeap(), 0, sizeof(ItemMonikerImpl
));
397 if (newItemMoniker
== 0)
398 return STG_E_INSUFFICIENTMEMORY
;
400 hr
= ItemMonikerImpl_Construct(newItemMoniker
,lpszDelim
,lpszItem
);
405 hr
= ItemMonikerImpl_QueryInterface(newItemMoniker
,&IID_IMoniker
,(void**)ppmk
);