1 /***************************************************************************************
2 * FileMonikers 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 FileMonikerImpl
{
20 ICOM_VTABLE(IMoniker
)* lpvtbl
;
26 HRESULT WINAPI
FileMonikerImpl_QueryInterface(FileMonikerImpl
* This
,REFIID riid
,void** ppvObject
);
27 ULONG WINAPI
FileMonikerImpl_AddRef(FileMonikerImpl
* This
);
28 ULONG WINAPI
FileMonikerImpl_Release(FileMonikerImpl
* This
);
29 HRESULT WINAPI
FileMonikerImpl_GetClassID(FileMonikerImpl
* This
, CLSID
*pClassID
);
30 HRESULT WINAPI
FileMonikerImpl_IsDirty(FileMonikerImpl
* This
);
31 HRESULT WINAPI
FileMonikerImpl_Load(FileMonikerImpl
* This
,LPCOLESTR32 pszFileName
,DWORD dwMode
);
32 HRESULT WINAPI
FileMonikerImpl_Save(FileMonikerImpl
* This
,LPCOLESTR32 pszFileName
,BOOL32 fRemember
);
33 HRESULT WINAPI
FileMonikerImpl_GetSizeMax(FileMonikerImpl
* This
,LPOLESTR32
*ppszFileName
);
34 HRESULT WINAPI
FileMonikerImpl_Construct(FileMonikerImpl
* This
, LPCOLESTR32 lpszPathName
);
35 HRESULT WINAPI
FileMonikerImpl_destroy(FileMonikerImpl
* This
);
36 HRESULT WINAPI
FileMonikerImpl_BindToObject(FileMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, REFIID riid
, VOID
** ppvResult
);
37 HRESULT WINAPI
FileMonikerImpl_BindToStorage(FileMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, REFIID riid
, VOID
** ppvResult
);
38 HRESULT WINAPI
FileMonikerImpl_Reduce(FileMonikerImpl
* This
,IBindCtx
* pbc
, DWORD dwReduceHowFar
,IMoniker
** ppmkToLeft
, IMoniker
** ppmkReduced
);
39 HRESULT WINAPI
FileMonikerImpl_ComposeWith(FileMonikerImpl
* This
,IMoniker
* pmkRight
,BOOL32 fOnlyIfNotGeneric
, IMoniker
** ppmkComposite
);
40 HRESULT WINAPI
FileMonikerImpl_Enum(FileMonikerImpl
* This
,BOOL32 fForward
, IEnumMoniker
** ppenumMoniker
);
41 HRESULT WINAPI
FileMonikerImpl_IsEqual(FileMonikerImpl
* This
,IMoniker
* pmkOtherMoniker
);
42 HRESULT WINAPI
FileMonikerImpl_Hash(FileMonikerImpl
* This
,DWORD
* pdwHash
);
43 HRESULT WINAPI
FileMonikerImpl_IsRunning(FileMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, IMoniker
* pmkNewlyRunning
);
44 HRESULT WINAPI
FileMonikerImpl_GetTimeOfLastChange(FileMonikerImpl
* This
, IBindCtx
* pbc
, IMoniker
* pmkToLeft
, FILETIME
* pFileTime
);
45 HRESULT WINAPI
FileMonikerImpl_Inverse(FileMonikerImpl
* This
,IMoniker
** ppmk
);
46 HRESULT WINAPI
FileMonikerImpl_CommonPrefixWith(FileMonikerImpl
* This
,IMoniker
* pmkOther
, IMoniker
** ppmkPrefix
);
47 HRESULT WINAPI
FileMonikerImpl_RelativePathTo(FileMonikerImpl
* This
,IMoniker
* pmOther
, IMoniker
** ppmkRelPath
);
48 HRESULT WINAPI
FileMonikerImpl_GetDisplayName(FileMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, LPOLESTR32
*ppszDisplayName
);
49 HRESULT WINAPI
FileMonikerImpl_ParseDisplayName(FileMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
, LPOLESTR32 pszDisplayName
, ULONG
* pchEaten
, IMoniker
** ppmkOut
);
50 HRESULT WINAPI
FileMonikerImpl_IsSystemMoniker(FileMonikerImpl
* This
,DWORD
* pwdMksys
);
51 HRESULT WINAPI
CreateFileMoniker16(LPCOLESTR16 lpszPathName
,LPMONIKER
* ppmk
);
52 HRESULT WINAPI
CreateFileMoniker32( LPCOLESTR32 lpszPathName
, LPMONIKER
* ppmk
);
54 #define VTABLE_FUNC(a) (void*)(a)
56 // Virtual function table for the FileMonikerImpl class.
57 static ICOM_VTABLE(IMoniker
) VT_FileMonikerImpl
=
62 VTABLE_FUNC(FileMonikerImpl_QueryInterface
),
63 VTABLE_FUNC(FileMonikerImpl_AddRef
),
64 VTABLE_FUNC(FileMonikerImpl_Release
)
66 VTABLE_FUNC(FileMonikerImpl_GetClassID
)
68 VTABLE_FUNC(FileMonikerImpl_IsDirty
),
69 VTABLE_FUNC(FileMonikerImpl_Load
),
70 VTABLE_FUNC(FileMonikerImpl_Save
),
71 VTABLE_FUNC(FileMonikerImpl_GetSizeMax
)
73 VTABLE_FUNC(FileMonikerImpl_BindToObject
),
74 VTABLE_FUNC(FileMonikerImpl_BindToStorage
),
75 VTABLE_FUNC(FileMonikerImpl_Reduce
),
76 VTABLE_FUNC(FileMonikerImpl_ComposeWith
),
77 VTABLE_FUNC(FileMonikerImpl_Enum
),
78 VTABLE_FUNC(FileMonikerImpl_IsEqual
),
79 VTABLE_FUNC(FileMonikerImpl_Hash
),
80 VTABLE_FUNC(FileMonikerImpl_IsRunning
),
81 VTABLE_FUNC(FileMonikerImpl_GetTimeOfLastChange
),
82 VTABLE_FUNC(FileMonikerImpl_Inverse
),
83 VTABLE_FUNC(FileMonikerImpl_CommonPrefixWith
),
84 VTABLE_FUNC(FileMonikerImpl_RelativePathTo
),
85 VTABLE_FUNC(FileMonikerImpl_GetDisplayName
),
86 VTABLE_FUNC(FileMonikerImpl_ParseDisplayName
),
87 VTABLE_FUNC(FileMonikerImpl_IsSystemMoniker
)
90 /*******************************************************************************
91 * FileMoniker_QueryInterface
92 *******************************************************************************/
93 HRESULT WINAPI
FileMonikerImpl_QueryInterface(FileMonikerImpl
* This
,REFIID riid
,void** ppvObject
){
95 TRACE(ole
,"(%p,%p,%p)\n",This
,riid
,ppvObject
);
97 // Perform a sanity check on the parameters.
98 if ( (This
==0) || (ppvObject
==0) ) return E_INVALIDARG
;
100 // Initialize the return parameter.
103 // Compare the riid with the interface IDs implemented by this object.
104 if (memcmp(&IID_IUnknown
, riid
, sizeof(IID_IUnknown
)) == 0)
105 *ppvObject
= (IMoniker
*)This
;
107 if (memcmp(&IID_IPersist
, riid
, sizeof(IID_IPersist
)) == 0)
108 *ppvObject
= (IMoniker
*)This
;
110 if (memcmp(&IID_IPersistStream
, riid
, sizeof(IID_IPersistStream
)) == 0)
111 *ppvObject
= (IMoniker
*)This
;
113 if (memcmp(&IID_IMoniker
, riid
, sizeof(IID_IMoniker
)) == 0)
114 *ppvObject
= (IMoniker
*)This
;
116 // Check that we obtained an interface.
117 if ((*ppvObject
)==0) return E_NOINTERFACE
;
119 // Query Interface always increases the reference count by one when it is successful
120 FileMonikerImpl_AddRef(This
);
125 /******************************************************************************
127 ******************************************************************************/
128 ULONG WINAPI
FileMonikerImpl_AddRef(FileMonikerImpl
* This
){
130 TRACE(ole
,"(%p)\n",This
);
132 return ++(This
->ref
);
135 /******************************************************************************
136 * FileMoniker_Release
137 ******************************************************************************/
138 ULONG WINAPI
FileMonikerImpl_Release(FileMonikerImpl
* This
){
140 TRACE(ole
,"(%p)\n",This
);
145 FileMonikerImpl_destroy(This
);
151 /******************************************************************************
152 * FileMoniker_GetClassID
153 ******************************************************************************/
154 HRESULT WINAPI
FileMonikerImpl_GetClassID(FileMonikerImpl
* This
, CLSID
*pClassID
){//Pointer to CLSID of object
156 FIXME(ole
,"(%p,%p),stub!\n",This
,pClassID
);
161 /******************************************************************************
162 * FileMoniker_IsDirty
163 ******************************************************************************/
164 HRESULT WINAPI
FileMonikerImpl_IsDirty(FileMonikerImpl
* This
)
166 FIXME(ole
,"(%p),stub!\n",This
);
171 /******************************************************************************
173 ******************************************************************************/
174 HRESULT WINAPI
FileMonikerImpl_Load(
175 FileMonikerImpl
* This
,
176 LPCOLESTR32 pszFileName
,//Pointer to absolute path of the file to open
177 DWORD dwMode
) //Specifies the access mode from the STGM enumeration
179 FIXME(ole
,"(%p,%p,%ld),stub!\n",This
,pszFileName
,dwMode
);
184 /******************************************************************************
186 ******************************************************************************/
187 HRESULT WINAPI
FileMonikerImpl_Save(
188 FileMonikerImpl
* This
,
189 LPCOLESTR32 pszFileName
, //Pointer to absolute path of the file where the object is saved
190 BOOL32 fRemember
) //Specifies whether the file is to be the current working file or not
192 FIXME(ole
,"(%p,%p,%d),stub!\n",This
,pszFileName
,fRemember
);
197 /******************************************************************************
198 * FileMoniker_GetSizeMax
199 ******************************************************************************/
200 HRESULT WINAPI
FileMonikerImpl_GetSizeMax(
201 FileMonikerImpl
* This
,
202 LPOLESTR32
*ppszFileName
) //Pointer to the path for the current file or the default save prompt
204 FIXME(ole
,"(%p,%p),stub!\n",This
,ppszFileName
);
209 /******************************************************************************
210 * FileMoniker_Constructor
211 *******************************************************************************/
212 HRESULT WINAPI
FileMonikerImpl_Construct(FileMonikerImpl
* This
, LPCOLESTR32 lpszPathName
){
214 FIXME(ole
,"(%p,%p),stub!\n",This
,lpszPathName
);
216 memset(This
, 0, sizeof(FileMonikerImpl
));
218 //Initialize the virtual fgunction table.
219 This
->lpvtbl
= &VT_FileMonikerImpl
;
223 /******************************************************************************
224 * FileMoniker_destructor
225 *******************************************************************************/
226 HRESULT WINAPI
FileMonikerImpl_destroy(FileMonikerImpl
* This
){
228 FIXME(ole
,"(%p),stub!\n",This
);
234 /******************************************************************************
235 * FileMoniker_BindToObject
236 ******************************************************************************/
237 HRESULT WINAPI
FileMonikerImpl_BindToObject(FileMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
238 REFIID riid
, VOID
** ppvResult
){
240 FIXME(ole
,"(%p,%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,riid
,ppvResult
);
245 /******************************************************************************
246 * FileMoniker_BindToStorage
247 ******************************************************************************/
248 HRESULT WINAPI
FileMonikerImpl_BindToStorage(FileMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
249 REFIID riid
, VOID
** ppvResult
){
251 FIXME(ole
,"(%p,%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,riid
,ppvResult
);
256 /******************************************************************************
258 ******************************************************************************/
259 HRESULT WINAPI
FileMonikerImpl_Reduce(FileMonikerImpl
* This
,IBindCtx
* pbc
, DWORD dwReduceHowFar
,
260 IMoniker
** ppmkToLeft
, IMoniker
** ppmkReduced
){
262 FIXME(ole
,"(%p,%p,%ld,%p,%p),stub!\n",This
,pbc
,dwReduceHowFar
,ppmkToLeft
,ppmkReduced
);
267 /******************************************************************************
268 * FileMoniker_ComposeWith
269 ******************************************************************************/
270 HRESULT WINAPI
FileMonikerImpl_ComposeWith(FileMonikerImpl
* This
,IMoniker
* pmkRight
,BOOL32 fOnlyIfNotGeneric
,
271 IMoniker
** ppmkComposite
){
273 FIXME(ole
,"(%p,%p,%d,%p),stub!\n",This
,pmkRight
,fOnlyIfNotGeneric
,ppmkComposite
);
278 /******************************************************************************
280 ******************************************************************************/
281 HRESULT WINAPI
FileMonikerImpl_Enum(FileMonikerImpl
* This
,BOOL32 fForward
, IEnumMoniker
** ppenumMoniker
){
283 FIXME(ole
,"(%p,%d,%p),stub!\n",This
,fForward
,ppenumMoniker
);
289 /******************************************************************************
290 * FileMoniker_IsEqual
291 ******************************************************************************/
292 HRESULT WINAPI
FileMonikerImpl_IsEqual(FileMonikerImpl
* This
,IMoniker
* pmkOtherMoniker
){
294 FIXME(ole
,"(%p,%p),stub!\n",This
,pmkOtherMoniker
);
299 /******************************************************************************
301 ******************************************************************************/
302 HRESULT WINAPI
FileMonikerImpl_Hash(FileMonikerImpl
* This
,DWORD
* pdwHash
){
304 FIXME(ole
,"(%p,%p),stub!\n",This
,pdwHash
);
309 /******************************************************************************
310 * FileMoniker_IsRunning
311 ******************************************************************************/
312 HRESULT WINAPI
FileMonikerImpl_IsRunning(FileMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
313 IMoniker
* pmkNewlyRunning
){
315 FIXME(ole
,"(%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,pmkNewlyRunning
);
320 /******************************************************************************
321 * FileMoniker_GetTimeOfLastChange
322 ******************************************************************************/
323 HRESULT WINAPI
FileMonikerImpl_GetTimeOfLastChange(FileMonikerImpl
* This
, IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
324 FILETIME
* pFileTime
){
326 FIXME(ole
,"(%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,pFileTime
);
331 /******************************************************************************
332 * FileMoniker_Inverse
333 ******************************************************************************/
334 HRESULT WINAPI
FileMonikerImpl_Inverse(FileMonikerImpl
* This
,IMoniker
** ppmk
){
336 FIXME(ole
,"(%p,%p),stub!\n",This
,ppmk
);
341 /******************************************************************************
342 * FileMoniker_CommonPrefixWith
343 ******************************************************************************/
344 HRESULT WINAPI
FileMonikerImpl_CommonPrefixWith(FileMonikerImpl
* This
,IMoniker
* pmkOther
,
345 IMoniker
** ppmkPrefix
){
347 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pmkOther
,ppmkPrefix
);
352 /******************************************************************************
353 * FileMoniker_RelativePathTo
354 ******************************************************************************/
355 HRESULT WINAPI
FileMonikerImpl_RelativePathTo(FileMonikerImpl
* This
,IMoniker
* pmOther
, IMoniker
** ppmkRelPath
){
357 FIXME(ole
,"(%p,%p,%p),stub!\n",This
,pmOther
,ppmkRelPath
);
362 /******************************************************************************
363 * FileMoniker_GetDisplayName
364 ******************************************************************************/
365 HRESULT WINAPI
FileMonikerImpl_GetDisplayName(FileMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
366 LPOLESTR32
*ppszDisplayName
){
368 FIXME(ole
,"(%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,ppszDisplayName
);
373 /******************************************************************************
374 * FileMoniker_ParseDisplayName
375 ******************************************************************************/
376 HRESULT WINAPI
FileMonikerImpl_ParseDisplayName(FileMonikerImpl
* This
,IBindCtx
* pbc
, IMoniker
* pmkToLeft
,
377 LPOLESTR32 pszDisplayName
, ULONG
* pchEaten
, IMoniker
** ppmkOut
){
379 FIXME(ole
,"(%p,%p,%p,%p,%p,%p),stub!\n",This
,pbc
,pmkToLeft
,pszDisplayName
,pchEaten
,ppmkOut
);
384 /******************************************************************************
385 * FileMoniker_IsSystemMonker
386 ******************************************************************************/
387 HRESULT WINAPI
FileMonikerImpl_IsSystemMoniker(FileMonikerImpl
* This
,DWORD
* pwdMksys
){
389 FIXME(ole
,"(%p,%p),stub!\n",This
,pwdMksys
);
394 /******************************************************************************
395 * CreateFileMoniker16
396 ******************************************************************************/
397 HRESULT WINAPI
CreateFileMoniker16(LPCOLESTR16 lpszPathName
,LPMONIKER
* ppmk
){
399 FIXME(ole
,"(%s,%p),stub!\n",lpszPathName
,ppmk
);
404 /******************************************************************************
405 * CreateFileMoniker32
406 ******************************************************************************/
407 HRESULT WINAPI
CreateFileMoniker32(LPCOLESTR32 lpszPathName
, LPMONIKER
* ppmk
)
409 FileMonikerImpl
* newFileMoniker
= 0;
412 TRACE(ole
,"(%p,%p)\n",lpszPathName
,ppmk
);
414 newFileMoniker
= HeapAlloc(GetProcessHeap(), 0, sizeof(FileMonikerImpl
));
416 if (newFileMoniker
== 0)
417 return STG_E_INSUFFICIENTMEMORY
;
419 hr
= FileMonikerImpl_Construct(newFileMoniker
,lpszPathName
);
424 hr
= FileMonikerImpl_QueryInterface(newFileMoniker
,&IID_IMoniker
,(void**)ppmk
);