-Fixed MESSAGE functions that were thunking down to 16 bits implementation.
[wine/dcerpc.git] / ole / filemoniker.c
blobfae183343586b60bab0e889f089c2d213a6a1490
1 /***************************************************************************************
2 * FileMonikers implementation
4 * Copyright 1999 Noomen Hamza
5 ***************************************************************************************/
7 #include <ctype.h>
8 #include <stdlib.h>
9 #include <string.h>
10 #include <assert.h>
11 #include "winerror.h"
12 #include "wine/obj_base.h"
13 #include "wine/obj_storage.h"
14 #include "wine/obj_moniker.h"
15 #include "debug.h"
16 #include "heap.h"
18 typedef struct FileMonikerImpl{
20 ICOM_VTABLE(IMoniker)* lpvtbl;
22 ULONG ref;
24 } FileMonikerImpl;
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.
101 *ppvObject = 0;
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;
106 else
107 if (memcmp(&IID_IPersist, riid, sizeof(IID_IPersist)) == 0)
108 *ppvObject = (IMoniker*)This;
109 else
110 if (memcmp(&IID_IPersistStream, riid, sizeof(IID_IPersistStream)) == 0)
111 *ppvObject = (IMoniker*)This;
112 else
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);
122 return S_OK;;
125 /******************************************************************************
126 * FileMoniker_AddRef
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);
142 This->ref--;
144 if (This->ref==0){
145 FileMonikerImpl_destroy(This);
146 return 0;
148 return This->ref;;
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);
158 return E_NOTIMPL;
161 /******************************************************************************
162 * FileMoniker_IsDirty
163 ******************************************************************************/
164 HRESULT WINAPI FileMonikerImpl_IsDirty(FileMonikerImpl* This)
166 FIXME(ole,"(%p),stub!\n",This);
168 return E_NOTIMPL;
171 /******************************************************************************
172 * FileMoniker_Load
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);
181 return E_NOTIMPL;
184 /******************************************************************************
185 * FileMoniker_save
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);
194 return E_NOTIMPL;
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);
206 return E_NOTIMPL;
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;
220 return S_OK;
223 /******************************************************************************
224 * FileMoniker_destructor
225 *******************************************************************************/
226 HRESULT WINAPI FileMonikerImpl_destroy(FileMonikerImpl* This){
228 FIXME(ole,"(%p),stub!\n",This);
230 SEGPTR_FREE(This);
231 return S_OK;
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);
242 return E_NOTIMPL;
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);
253 return E_NOTIMPL;
256 /******************************************************************************
257 * FileMoniker_Reduce
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);
264 return E_NOTIMPL;
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);
275 return E_NOTIMPL;
278 /******************************************************************************
279 * FileMoniker_Enum
280 ******************************************************************************/
281 HRESULT WINAPI FileMonikerImpl_Enum(FileMonikerImpl* This,BOOL32 fForward, IEnumMoniker** ppenumMoniker){
283 FIXME(ole,"(%p,%d,%p),stub!\n",This,fForward,ppenumMoniker);
285 return E_NOTIMPL;
289 /******************************************************************************
290 * FileMoniker_IsEqual
291 ******************************************************************************/
292 HRESULT WINAPI FileMonikerImpl_IsEqual(FileMonikerImpl* This,IMoniker* pmkOtherMoniker){
294 FIXME(ole,"(%p,%p),stub!\n",This,pmkOtherMoniker);
296 return E_NOTIMPL;
299 /******************************************************************************
300 * FileMoniker_Hash
301 ******************************************************************************/
302 HRESULT WINAPI FileMonikerImpl_Hash(FileMonikerImpl* This,DWORD* pdwHash){
304 FIXME(ole,"(%p,%p),stub!\n",This,pdwHash);
306 return E_NOTIMPL;
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);
317 return E_NOTIMPL;
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);
328 return E_NOTIMPL;
331 /******************************************************************************
332 * FileMoniker_Inverse
333 ******************************************************************************/
334 HRESULT WINAPI FileMonikerImpl_Inverse(FileMonikerImpl* This,IMoniker** ppmk){
336 FIXME(ole,"(%p,%p),stub!\n",This,ppmk);
338 return E_NOTIMPL;
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);
349 return E_NOTIMPL;
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);
359 return E_NOTIMPL;
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);
370 return E_NOTIMPL;
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);
381 return E_NOTIMPL;
384 /******************************************************************************
385 * FileMoniker_IsSystemMonker
386 ******************************************************************************/
387 HRESULT WINAPI FileMonikerImpl_IsSystemMoniker(FileMonikerImpl* This,DWORD* pwdMksys){
389 FIXME(ole,"(%p,%p),stub!\n",This,pwdMksys);
391 return E_NOTIMPL;
394 /******************************************************************************
395 * CreateFileMoniker16
396 ******************************************************************************/
397 HRESULT WINAPI CreateFileMoniker16(LPCOLESTR16 lpszPathName,LPMONIKER* ppmk){
399 FIXME(ole,"(%s,%p),stub!\n",lpszPathName,ppmk);
401 return E_NOTIMPL;
404 /******************************************************************************
405 * CreateFileMoniker32
406 ******************************************************************************/
407 HRESULT WINAPI CreateFileMoniker32(LPCOLESTR32 lpszPathName, LPMONIKER * ppmk)
409 FileMonikerImpl* newFileMoniker = 0;
410 HRESULT hr = S_OK;
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);
421 if (FAILED(hr))
422 return hr;
424 hr = FileMonikerImpl_QueryInterface(newFileMoniker,&IID_IMoniker,(void**)ppmk);
426 return hr;