1 | /***************************************************************************************
|
---|
2 | * AntiMonikers implementation
|
---|
3 | *
|
---|
4 | * Copyright 1999 Noomen Hamza
|
---|
5 | ***************************************************************************************/
|
---|
6 | #include <assert.h>
|
---|
7 | #include <string.h>
|
---|
8 | #include "winbase.h"
|
---|
9 | #include "winerror.h"
|
---|
10 | #include "wine/unicode.h"
|
---|
11 | #include "wine/obj_base.h"
|
---|
12 | #include "wine/obj_misc.h"
|
---|
13 | #include "wine/obj_storage.h"
|
---|
14 | #include "wine/obj_moniker.h"
|
---|
15 | #include "debugtools.h"
|
---|
16 |
|
---|
17 | #ifdef __WIN32OS2__
|
---|
18 | #undef FIXME
|
---|
19 | #undef TRACE
|
---|
20 | #ifdef DEBUG
|
---|
21 | // PH 2001-11-30
|
---|
22 | // this macro definition causes the control leave the scope of a
|
---|
23 | // non-curly-braced preceeding if statement. Therefore,
|
---|
24 | // if (p!=NULL)
|
---|
25 | // TRACE("p->a=%d", p->a)
|
---|
26 | // crashes.
|
---|
27 | //
|
---|
28 | // !!! ENSURE TRACES AND FIXMES WITH PRECEEDING IF STATEMENT
|
---|
29 | // !!! ARE PUT INTO CURLY BRACES
|
---|
30 | #define TRACE WriteLog("OLE32: %s", __FUNCTION__); WriteLog
|
---|
31 | #define FIXME WriteLog("FIXME OLE32: %s", __FUNCTION__); WriteLog
|
---|
32 | #else
|
---|
33 | #define TRACE 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
|
---|
34 | #define FIXME 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
|
---|
35 | #endif
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | DEFAULT_DEBUG_CHANNEL(ole);
|
---|
39 |
|
---|
40 | /* AntiMoniker data structure */
|
---|
41 | typedef struct AntiMonikerImpl{
|
---|
42 |
|
---|
43 | ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/
|
---|
44 |
|
---|
45 | /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether
|
---|
46 | * two monikers are equal. That's whay IROTData interface is implemented by monikers.
|
---|
47 | */
|
---|
48 | ICOM_VTABLE(IROTData)* lpvtbl2; /* VTable relative to the IROTData interface.*/
|
---|
49 |
|
---|
50 | ULONG ref; /* reference counter for this object */
|
---|
51 |
|
---|
52 | } AntiMonikerImpl;
|
---|
53 |
|
---|
54 | /********************************************************************************/
|
---|
55 | /* AntiMoniker prototype functions : */
|
---|
56 |
|
---|
57 | /* IUnknown prototype functions */
|
---|
58 | static HRESULT WINAPI AntiMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject);
|
---|
59 | static ULONG WINAPI AntiMonikerImpl_AddRef(IMoniker* iface);
|
---|
60 | static ULONG WINAPI AntiMonikerImpl_Release(IMoniker* iface);
|
---|
61 |
|
---|
62 | /* IPersist prototype functions */
|
---|
63 | static HRESULT WINAPI AntiMonikerImpl_GetClassID(IMoniker* iface, CLSID *pClassID);
|
---|
64 |
|
---|
65 | /* IPersistStream prototype functions */
|
---|
66 | static HRESULT WINAPI AntiMonikerImpl_IsDirty(IMoniker* iface);
|
---|
67 | static HRESULT WINAPI AntiMonikerImpl_Load(IMoniker* iface, IStream* pStm);
|
---|
68 | static HRESULT WINAPI AntiMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty);
|
---|
69 | static HRESULT WINAPI AntiMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize);
|
---|
70 |
|
---|
71 | /* IMoniker prototype functions */
|
---|
72 | static HRESULT WINAPI AntiMonikerImpl_BindToObject(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
|
---|
73 | static HRESULT WINAPI AntiMonikerImpl_BindToStorage(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult);
|
---|
74 | static HRESULT WINAPI AntiMonikerImpl_Reduce(IMoniker* iface,IBindCtx* pbc, DWORD dwReduceHowFar,IMoniker** ppmkToLeft, IMoniker** ppmkReduced);
|
---|
75 | static HRESULT WINAPI AntiMonikerImpl_ComposeWith(IMoniker* iface,IMoniker* pmkRight,BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite);
|
---|
76 | static HRESULT WINAPI AntiMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker);
|
---|
77 | static HRESULT WINAPI AntiMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker);
|
---|
78 | static HRESULT WINAPI AntiMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash);
|
---|
79 | static HRESULT WINAPI AntiMonikerImpl_IsRunning(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, IMoniker* pmkNewlyRunning);
|
---|
80 | static HRESULT WINAPI AntiMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft, FILETIME* pAntiTime);
|
---|
81 | static HRESULT WINAPI AntiMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk);
|
---|
82 | static HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther, IMoniker** ppmkPrefix);
|
---|
83 | static HRESULT WINAPI AntiMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath);
|
---|
84 | static HRESULT WINAPI AntiMonikerImpl_GetDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR *ppszDisplayName);
|
---|
85 | static HRESULT WINAPI AntiMonikerImpl_ParseDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR pszDisplayName, ULONG* pchEaten, IMoniker** ppmkOut);
|
---|
86 | static HRESULT WINAPI AntiMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys);
|
---|
87 |
|
---|
88 | /********************************************************************************/
|
---|
89 | /* IROTData prototype functions */
|
---|
90 |
|
---|
91 | /* IUnknown prototype functions */
|
---|
92 | static HRESULT WINAPI AntiMonikerROTDataImpl_QueryInterface(IROTData* iface,REFIID riid,VOID** ppvObject);
|
---|
93 | static ULONG WINAPI AntiMonikerROTDataImpl_AddRef(IROTData* iface);
|
---|
94 | static ULONG WINAPI AntiMonikerROTDataImpl_Release(IROTData* iface);
|
---|
95 |
|
---|
96 | /* IROTData prototype function */
|
---|
97 | static HRESULT WINAPI AntiMonikerROTDataImpl_GetComparaisonData(IROTData* iface,BYTE* pbData,ULONG cbMax,ULONG* pcbData);
|
---|
98 |
|
---|
99 | /* Local function used by AntiMoniker implementation */
|
---|
100 | HRESULT WINAPI AntiMonikerImpl_Construct(AntiMonikerImpl* iface);
|
---|
101 | HRESULT WINAPI AntiMonikerImpl_Destroy(AntiMonikerImpl* iface);
|
---|
102 |
|
---|
103 | /********************************************************************************/
|
---|
104 | /* Virtual function table for the AntiMonikerImpl class which include IPersist,*/
|
---|
105 | /* IPersistStream and IMoniker functions. */
|
---|
106 | static ICOM_VTABLE(IMoniker) VT_AntiMonikerImpl =
|
---|
107 | {
|
---|
108 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
---|
109 | AntiMonikerImpl_QueryInterface,
|
---|
110 | AntiMonikerImpl_AddRef,
|
---|
111 | AntiMonikerImpl_Release,
|
---|
112 | AntiMonikerImpl_GetClassID,
|
---|
113 | AntiMonikerImpl_IsDirty,
|
---|
114 | AntiMonikerImpl_Load,
|
---|
115 | AntiMonikerImpl_Save,
|
---|
116 | AntiMonikerImpl_GetSizeMax,
|
---|
117 | AntiMonikerImpl_BindToObject,
|
---|
118 | AntiMonikerImpl_BindToStorage,
|
---|
119 | AntiMonikerImpl_Reduce,
|
---|
120 | AntiMonikerImpl_ComposeWith,
|
---|
121 | AntiMonikerImpl_Enum,
|
---|
122 | AntiMonikerImpl_IsEqual,
|
---|
123 | AntiMonikerImpl_Hash,
|
---|
124 | AntiMonikerImpl_IsRunning,
|
---|
125 | AntiMonikerImpl_GetTimeOfLastChange,
|
---|
126 | AntiMonikerImpl_Inverse,
|
---|
127 | AntiMonikerImpl_CommonPrefixWith,
|
---|
128 | AntiMonikerImpl_RelativePathTo,
|
---|
129 | AntiMonikerImpl_GetDisplayName,
|
---|
130 | AntiMonikerImpl_ParseDisplayName,
|
---|
131 | AntiMonikerImpl_IsSystemMoniker
|
---|
132 | };
|
---|
133 |
|
---|
134 | /********************************************************************************/
|
---|
135 | /* Virtual function table for the IROTData class. */
|
---|
136 | static ICOM_VTABLE(IROTData) VT_ROTDataImpl =
|
---|
137 | {
|
---|
138 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
---|
139 | AntiMonikerROTDataImpl_QueryInterface,
|
---|
140 | AntiMonikerROTDataImpl_AddRef,
|
---|
141 | AntiMonikerROTDataImpl_Release,
|
---|
142 | AntiMonikerROTDataImpl_GetComparaisonData
|
---|
143 | };
|
---|
144 |
|
---|
145 | /*******************************************************************************
|
---|
146 | * AntiMoniker_QueryInterface
|
---|
147 | *******************************************************************************/
|
---|
148 | HRESULT WINAPI AntiMonikerImpl_QueryInterface(IMoniker* iface,REFIID riid,void** ppvObject)
|
---|
149 | {
|
---|
150 | ICOM_THIS(AntiMonikerImpl,iface);
|
---|
151 |
|
---|
152 | TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
|
---|
153 |
|
---|
154 | /* Perform a sanity check on the parameters.*/
|
---|
155 | if ( (This==0) || (ppvObject==0) )
|
---|
156 | return E_INVALIDARG;
|
---|
157 |
|
---|
158 | /* Initialize the return parameter */
|
---|
159 | *ppvObject = 0;
|
---|
160 |
|
---|
161 | /* Compare the riid with the interface IDs implemented by this object.*/
|
---|
162 | if (IsEqualIID(&IID_IUnknown, riid) ||
|
---|
163 | IsEqualIID(&IID_IPersist, riid) ||
|
---|
164 | IsEqualIID(&IID_IPersistStream, riid) ||
|
---|
165 | IsEqualIID(&IID_IMoniker, riid)
|
---|
166 | )
|
---|
167 | *ppvObject = iface;
|
---|
168 | else if (IsEqualIID(&IID_IROTData, riid))
|
---|
169 | *ppvObject = (IROTData*)&(This->lpvtbl2);
|
---|
170 |
|
---|
171 | /* Check that we obtained an interface.*/
|
---|
172 | if ((*ppvObject)==0)
|
---|
173 | return E_NOINTERFACE;
|
---|
174 |
|
---|
175 | /* Query Interface always increases the reference count by one when it is successful */
|
---|
176 | AntiMonikerImpl_AddRef(iface);
|
---|
177 |
|
---|
178 | return S_OK;
|
---|
179 | }
|
---|
180 |
|
---|
181 | /******************************************************************************
|
---|
182 | * AntiMoniker_AddRef
|
---|
183 | ******************************************************************************/
|
---|
184 | ULONG WINAPI AntiMonikerImpl_AddRef(IMoniker* iface)
|
---|
185 | {
|
---|
186 | ICOM_THIS(AntiMonikerImpl,iface);
|
---|
187 |
|
---|
188 | TRACE("(%p)\n",This);
|
---|
189 |
|
---|
190 | return ++(This->ref);
|
---|
191 | }
|
---|
192 |
|
---|
193 | /******************************************************************************
|
---|
194 | * AntiMoniker_Release
|
---|
195 | ******************************************************************************/
|
---|
196 | ULONG WINAPI AntiMonikerImpl_Release(IMoniker* iface)
|
---|
197 | {
|
---|
198 | ICOM_THIS(AntiMonikerImpl,iface);
|
---|
199 |
|
---|
200 | TRACE("(%p)\n",This);
|
---|
201 |
|
---|
202 | This->ref--;
|
---|
203 |
|
---|
204 | /* destroy the object if there's no more reference on it */
|
---|
205 | if (This->ref==0){
|
---|
206 |
|
---|
207 | AntiMonikerImpl_Destroy(This);
|
---|
208 |
|
---|
209 | return 0;
|
---|
210 | }
|
---|
211 | return This->ref;;
|
---|
212 | }
|
---|
213 |
|
---|
214 | /******************************************************************************
|
---|
215 | * AntiMoniker_GetClassID
|
---|
216 | ******************************************************************************/
|
---|
217 | HRESULT WINAPI AntiMonikerImpl_GetClassID(IMoniker* iface,CLSID *pClassID)
|
---|
218 | {
|
---|
219 | TRACE("(%p,%p),stub!\n",iface,pClassID);
|
---|
220 |
|
---|
221 | if (pClassID==NULL)
|
---|
222 | return E_POINTER;
|
---|
223 |
|
---|
224 | *pClassID = CLSID_AntiMoniker;
|
---|
225 |
|
---|
226 | return S_OK;
|
---|
227 | }
|
---|
228 |
|
---|
229 | /******************************************************************************
|
---|
230 | * AntiMoniker_IsDirty
|
---|
231 | ******************************************************************************/
|
---|
232 | HRESULT WINAPI AntiMonikerImpl_IsDirty(IMoniker* iface)
|
---|
233 | {
|
---|
234 | /* Note that the OLE-provided implementations of the IPersistStream::IsDirty
|
---|
235 | method in the OLE-provided moniker interfaces always return S_FALSE because
|
---|
236 | their internal state never changes. */
|
---|
237 |
|
---|
238 | TRACE("(%p)\n",iface);
|
---|
239 |
|
---|
240 | return S_FALSE;
|
---|
241 | }
|
---|
242 |
|
---|
243 | /******************************************************************************
|
---|
244 | * AntiMoniker_Load
|
---|
245 | ******************************************************************************/
|
---|
246 | HRESULT WINAPI AntiMonikerImpl_Load(IMoniker* iface,IStream* pStm)
|
---|
247 | {
|
---|
248 | DWORD constant=1,dwbuffer;
|
---|
249 | HRESULT res;
|
---|
250 |
|
---|
251 | /* data read by this function is only a DWORD constant (must be 1) ! */
|
---|
252 | res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),NULL);
|
---|
253 |
|
---|
254 | if (SUCCEEDED(res)&& dwbuffer!=constant)
|
---|
255 | return E_FAIL;
|
---|
256 |
|
---|
257 | return res;
|
---|
258 | }
|
---|
259 |
|
---|
260 | /******************************************************************************
|
---|
261 | * AntiMoniker_Save
|
---|
262 | ******************************************************************************/
|
---|
263 | HRESULT WINAPI AntiMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty)
|
---|
264 | {
|
---|
265 | DWORD constant=1;
|
---|
266 | HRESULT res;
|
---|
267 |
|
---|
268 | /* data writen by this function is only a DWORD constant seted to 1 ! */
|
---|
269 | res=IStream_Write(pStm,&constant,sizeof(constant),NULL);
|
---|
270 |
|
---|
271 | return res;
|
---|
272 | }
|
---|
273 |
|
---|
274 | /******************************************************************************
|
---|
275 | * AntiMoniker_GetSizeMax
|
---|
276 | ******************************************************************************/
|
---|
277 | HRESULT WINAPI AntiMonikerImpl_GetSizeMax(IMoniker* iface,
|
---|
278 | ULARGE_INTEGER* pcbSize)/* Pointer to size of stream needed to save object */
|
---|
279 | {
|
---|
280 | TRACE("(%p,%p)\n",iface,pcbSize);
|
---|
281 |
|
---|
282 | if (pcbSize!=NULL)
|
---|
283 | return E_POINTER;
|
---|
284 |
|
---|
285 | /* for more details see AntiMonikerImpl_Save coments */
|
---|
286 |
|
---|
287 | /* Normaly the sizemax must be the size of DWORD ! but I tested this function it ususlly return 16 bytes */
|
---|
288 | /* more than the number of bytes used by AntiMoniker::Save function */
|
---|
289 | pcbSize->s.LowPart = sizeof(DWORD)+16;
|
---|
290 |
|
---|
291 | pcbSize->s.HighPart=0;
|
---|
292 |
|
---|
293 | return S_OK;
|
---|
294 | }
|
---|
295 |
|
---|
296 | /******************************************************************************
|
---|
297 | * AntiMoniker_Construct (local function)
|
---|
298 | *******************************************************************************/
|
---|
299 | HRESULT WINAPI AntiMonikerImpl_Construct(AntiMonikerImpl* This)
|
---|
300 | {
|
---|
301 |
|
---|
302 | TRACE("(%p)\n",This);
|
---|
303 |
|
---|
304 | /* Initialize the virtual fgunction table. */
|
---|
305 | This->lpvtbl1 = &VT_AntiMonikerImpl;
|
---|
306 | This->lpvtbl2 = &VT_ROTDataImpl;
|
---|
307 | This->ref = 0;
|
---|
308 |
|
---|
309 | return S_OK;
|
---|
310 | }
|
---|
311 |
|
---|
312 | /******************************************************************************
|
---|
313 | * AntiMoniker_Destroy (local function)
|
---|
314 | *******************************************************************************/
|
---|
315 | HRESULT WINAPI AntiMonikerImpl_Destroy(AntiMonikerImpl* This)
|
---|
316 | {
|
---|
317 | TRACE("(%p)\n",This);
|
---|
318 |
|
---|
319 | return HeapFree(GetProcessHeap(),0,This);
|
---|
320 | }
|
---|
321 |
|
---|
322 | /******************************************************************************
|
---|
323 | * AntiMoniker_BindToObject
|
---|
324 | ******************************************************************************/
|
---|
325 | HRESULT WINAPI AntiMonikerImpl_BindToObject(IMoniker* iface,
|
---|
326 | IBindCtx* pbc,
|
---|
327 | IMoniker* pmkToLeft,
|
---|
328 | REFIID riid,
|
---|
329 | VOID** ppvResult)
|
---|
330 | {
|
---|
331 | TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
|
---|
332 | return E_NOTIMPL;
|
---|
333 | }
|
---|
334 |
|
---|
335 | /******************************************************************************
|
---|
336 | * AntiMoniker_BindToStorage
|
---|
337 | ******************************************************************************/
|
---|
338 | HRESULT WINAPI AntiMonikerImpl_BindToStorage(IMoniker* iface,
|
---|
339 | IBindCtx* pbc,
|
---|
340 | IMoniker* pmkToLeft,
|
---|
341 | REFIID riid,
|
---|
342 | VOID** ppvResult)
|
---|
343 | {
|
---|
344 | TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
|
---|
345 | return E_NOTIMPL;
|
---|
346 | }
|
---|
347 |
|
---|
348 | /******************************************************************************
|
---|
349 | * AntiMoniker_Reduce
|
---|
350 | ******************************************************************************/
|
---|
351 | HRESULT WINAPI AntiMonikerImpl_Reduce(IMoniker* iface,
|
---|
352 | IBindCtx* pbc,
|
---|
353 | DWORD dwReduceHowFar,
|
---|
354 | IMoniker** ppmkToLeft,
|
---|
355 | IMoniker** ppmkReduced)
|
---|
356 | {
|
---|
357 | TRACE("(%p,%p,%ld,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced);
|
---|
358 |
|
---|
359 | if (ppmkReduced==NULL)
|
---|
360 | return E_POINTER;
|
---|
361 |
|
---|
362 | AntiMonikerImpl_AddRef(iface);
|
---|
363 |
|
---|
364 | *ppmkReduced=iface;
|
---|
365 |
|
---|
366 | return MK_S_REDUCED_TO_SELF;
|
---|
367 | }
|
---|
368 | /******************************************************************************
|
---|
369 | * AntiMoniker_ComposeWith
|
---|
370 | ******************************************************************************/
|
---|
371 | HRESULT WINAPI AntiMonikerImpl_ComposeWith(IMoniker* iface,
|
---|
372 | IMoniker* pmkRight,
|
---|
373 | BOOL fOnlyIfNotGeneric,
|
---|
374 | IMoniker** ppmkComposite)
|
---|
375 | {
|
---|
376 |
|
---|
377 | TRACE("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite);
|
---|
378 |
|
---|
379 | if ((ppmkComposite==NULL)||(pmkRight==NULL))
|
---|
380 | return E_POINTER;
|
---|
381 |
|
---|
382 | *ppmkComposite=0;
|
---|
383 |
|
---|
384 | if (fOnlyIfNotGeneric)
|
---|
385 | return MK_E_NEEDGENERIC;
|
---|
386 | else
|
---|
387 | return CreateGenericComposite(iface,pmkRight,ppmkComposite);
|
---|
388 | }
|
---|
389 |
|
---|
390 | /******************************************************************************
|
---|
391 | * AntiMoniker_Enum
|
---|
392 | ******************************************************************************/
|
---|
393 | HRESULT WINAPI AntiMonikerImpl_Enum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker)
|
---|
394 | {
|
---|
395 | TRACE("(%p,%d,%p)\n",iface,fForward,ppenumMoniker);
|
---|
396 |
|
---|
397 | if (ppenumMoniker == NULL)
|
---|
398 | return E_POINTER;
|
---|
399 |
|
---|
400 | *ppenumMoniker = NULL;
|
---|
401 |
|
---|
402 | return S_OK;
|
---|
403 | }
|
---|
404 |
|
---|
405 | /******************************************************************************
|
---|
406 | * AntiMoniker_IsEqual
|
---|
407 | ******************************************************************************/
|
---|
408 | HRESULT WINAPI AntiMonikerImpl_IsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker)
|
---|
409 | {
|
---|
410 | DWORD mkSys;
|
---|
411 |
|
---|
412 | TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
|
---|
413 |
|
---|
414 | if (pmkOtherMoniker==NULL)
|
---|
415 | return S_FALSE;
|
---|
416 |
|
---|
417 | IMoniker_IsSystemMoniker(pmkOtherMoniker,&mkSys);
|
---|
418 |
|
---|
419 | if (mkSys==MKSYS_ANTIMONIKER)
|
---|
420 | return S_OK;
|
---|
421 | else
|
---|
422 | return S_FALSE;
|
---|
423 | }
|
---|
424 |
|
---|
425 | /******************************************************************************
|
---|
426 | * AntiMoniker_Hash
|
---|
427 | ******************************************************************************/
|
---|
428 | HRESULT WINAPI AntiMonikerImpl_Hash(IMoniker* iface,DWORD* pdwHash)
|
---|
429 | {
|
---|
430 | if (pdwHash==NULL)
|
---|
431 | return E_POINTER;
|
---|
432 |
|
---|
433 | *pdwHash=0;
|
---|
434 |
|
---|
435 | return S_OK;
|
---|
436 | }
|
---|
437 |
|
---|
438 | /******************************************************************************
|
---|
439 | * AntiMoniker_IsRunning
|
---|
440 | ******************************************************************************/
|
---|
441 | HRESULT WINAPI AntiMonikerImpl_IsRunning(IMoniker* iface,
|
---|
442 | IBindCtx* pbc,
|
---|
443 | IMoniker* pmkToLeft,
|
---|
444 | IMoniker* pmkNewlyRunning)
|
---|
445 | {
|
---|
446 | IRunningObjectTable* rot;
|
---|
447 | HRESULT res;
|
---|
448 |
|
---|
449 | TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning);
|
---|
450 |
|
---|
451 | if (pbc==NULL)
|
---|
452 | return E_INVALIDARG;
|
---|
453 |
|
---|
454 | res=IBindCtx_GetRunningObjectTable(pbc,&rot);
|
---|
455 |
|
---|
456 | if (FAILED(res))
|
---|
457 | return res;
|
---|
458 |
|
---|
459 | res = IRunningObjectTable_IsRunning(rot,iface);
|
---|
460 |
|
---|
461 | IRunningObjectTable_Release(rot);
|
---|
462 |
|
---|
463 | return res;
|
---|
464 | }
|
---|
465 |
|
---|
466 | /******************************************************************************
|
---|
467 | * AntiMoniker_GetTimeOfLastChange
|
---|
468 | ******************************************************************************/
|
---|
469 | HRESULT WINAPI AntiMonikerImpl_GetTimeOfLastChange(IMoniker* iface,
|
---|
470 | IBindCtx* pbc,
|
---|
471 | IMoniker* pmkToLeft,
|
---|
472 | FILETIME* pAntiTime)
|
---|
473 | {
|
---|
474 | TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pAntiTime);
|
---|
475 | return E_NOTIMPL;
|
---|
476 | }
|
---|
477 |
|
---|
478 | /******************************************************************************
|
---|
479 | * AntiMoniker_Inverse
|
---|
480 | ******************************************************************************/
|
---|
481 | HRESULT WINAPI AntiMonikerImpl_Inverse(IMoniker* iface,IMoniker** ppmk)
|
---|
482 | {
|
---|
483 | TRACE("(%p,%p)\n",iface,ppmk);
|
---|
484 |
|
---|
485 | if (ppmk==NULL)
|
---|
486 | return E_POINTER;
|
---|
487 |
|
---|
488 | *ppmk=0;
|
---|
489 |
|
---|
490 | return MK_E_NOINVERSE;
|
---|
491 | }
|
---|
492 |
|
---|
493 | /******************************************************************************
|
---|
494 | * AntiMoniker_CommonPrefixWith
|
---|
495 | ******************************************************************************/
|
---|
496 | HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix)
|
---|
497 | {
|
---|
498 | DWORD mkSys;
|
---|
499 |
|
---|
500 | IMoniker_IsSystemMoniker(pmkOther,&mkSys);
|
---|
501 |
|
---|
502 | if(mkSys==MKSYS_ITEMMONIKER){
|
---|
503 |
|
---|
504 | IMoniker_AddRef(iface);
|
---|
505 |
|
---|
506 | *ppmkPrefix=iface;
|
---|
507 |
|
---|
508 | IMoniker_AddRef(iface);
|
---|
509 |
|
---|
510 | return MK_S_US;
|
---|
511 | }
|
---|
512 | else
|
---|
513 | return MonikerCommonPrefixWith(iface,pmkOther,ppmkPrefix);
|
---|
514 | }
|
---|
515 |
|
---|
516 | /******************************************************************************
|
---|
517 | * AntiMoniker_RelativePathTo
|
---|
518 | ******************************************************************************/
|
---|
519 | HRESULT WINAPI AntiMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
|
---|
520 | {
|
---|
521 | TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath);
|
---|
522 |
|
---|
523 | if (ppmkRelPath==NULL)
|
---|
524 | return E_POINTER;
|
---|
525 |
|
---|
526 | IMoniker_AddRef(pmOther);
|
---|
527 |
|
---|
528 | *ppmkRelPath=pmOther;
|
---|
529 |
|
---|
530 | return MK_S_HIM;
|
---|
531 | }
|
---|
532 |
|
---|
533 | /******************************************************************************
|
---|
534 | * AntiMoniker_GetDisplayName
|
---|
535 | ******************************************************************************/
|
---|
536 | HRESULT WINAPI AntiMonikerImpl_GetDisplayName(IMoniker* iface,
|
---|
537 | IBindCtx* pbc,
|
---|
538 | IMoniker* pmkToLeft,
|
---|
539 | LPOLESTR *ppszDisplayName)
|
---|
540 | {
|
---|
541 | WCHAR back[]={'\\','.','.',0};
|
---|
542 |
|
---|
543 | TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName);
|
---|
544 |
|
---|
545 | if (ppszDisplayName==NULL)
|
---|
546 | return E_POINTER;
|
---|
547 |
|
---|
548 | if (pmkToLeft!=NULL){
|
---|
549 | FIXME("() pmkToLeft!=NULL not implemented \n");
|
---|
550 | return E_NOTIMPL;
|
---|
551 | }
|
---|
552 |
|
---|
553 | *ppszDisplayName=CoTaskMemAlloc(sizeof(back));
|
---|
554 |
|
---|
555 | if (*ppszDisplayName==NULL)
|
---|
556 | return E_OUTOFMEMORY;
|
---|
557 |
|
---|
558 | strcpyW(*ppszDisplayName,back);
|
---|
559 |
|
---|
560 | return S_OK;
|
---|
561 | }
|
---|
562 |
|
---|
563 | /******************************************************************************
|
---|
564 | * AntiMoniker_ParseDisplayName
|
---|
565 | ******************************************************************************/
|
---|
566 | HRESULT WINAPI AntiMonikerImpl_ParseDisplayName(IMoniker* iface,
|
---|
567 | IBindCtx* pbc,
|
---|
568 | IMoniker* pmkToLeft,
|
---|
569 | LPOLESTR pszDisplayName,
|
---|
570 | ULONG* pchEaten,
|
---|
571 | IMoniker** ppmkOut)
|
---|
572 | {
|
---|
573 | TRACE("(%p,%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut);
|
---|
574 | return E_NOTIMPL;
|
---|
575 | }
|
---|
576 |
|
---|
577 | /******************************************************************************
|
---|
578 | * AntiMoniker_IsSystemMoniker
|
---|
579 | ******************************************************************************/
|
---|
580 | HRESULT WINAPI AntiMonikerImpl_IsSystemMoniker(IMoniker* iface,DWORD* pwdMksys)
|
---|
581 | {
|
---|
582 | TRACE("(%p,%p)\n",iface,pwdMksys);
|
---|
583 |
|
---|
584 | if (!pwdMksys)
|
---|
585 | return E_POINTER;
|
---|
586 |
|
---|
587 | (*pwdMksys)=MKSYS_ANTIMONIKER;
|
---|
588 |
|
---|
589 | return S_OK;
|
---|
590 | }
|
---|
591 |
|
---|
592 | /*******************************************************************************
|
---|
593 | * AntiMonikerIROTData_QueryInterface
|
---|
594 | *******************************************************************************/
|
---|
595 | HRESULT WINAPI AntiMonikerROTDataImpl_QueryInterface(IROTData *iface,REFIID riid,VOID** ppvObject)
|
---|
596 | {
|
---|
597 |
|
---|
598 | ICOM_THIS_From_IROTData(IMoniker, iface);
|
---|
599 |
|
---|
600 | TRACE("(%p,%p,%p)\n",iface,riid,ppvObject);
|
---|
601 |
|
---|
602 | return AntiMonikerImpl_QueryInterface(This, riid, ppvObject);
|
---|
603 | }
|
---|
604 |
|
---|
605 | /***********************************************************************
|
---|
606 | * AntiMonikerIROTData_AddRef
|
---|
607 | */
|
---|
608 | ULONG WINAPI AntiMonikerROTDataImpl_AddRef(IROTData *iface)
|
---|
609 | {
|
---|
610 | ICOM_THIS_From_IROTData(IMoniker, iface);
|
---|
611 |
|
---|
612 | TRACE("(%p)\n",iface);
|
---|
613 |
|
---|
614 | return AntiMonikerImpl_AddRef(This);
|
---|
615 | }
|
---|
616 |
|
---|
617 | /***********************************************************************
|
---|
618 | * AntiMonikerIROTData_Release
|
---|
619 | */
|
---|
620 | ULONG WINAPI AntiMonikerROTDataImpl_Release(IROTData* iface)
|
---|
621 | {
|
---|
622 | ICOM_THIS_From_IROTData(IMoniker, iface);
|
---|
623 |
|
---|
624 | TRACE("(%p)\n",iface);
|
---|
625 |
|
---|
626 | return AntiMonikerImpl_Release(This);
|
---|
627 | }
|
---|
628 |
|
---|
629 | /******************************************************************************
|
---|
630 | * AntiMonikerIROTData_GetComparaisonData
|
---|
631 | ******************************************************************************/
|
---|
632 | HRESULT WINAPI AntiMonikerROTDataImpl_GetComparaisonData(IROTData* iface,
|
---|
633 | BYTE* pbData,
|
---|
634 | ULONG cbMax,
|
---|
635 | ULONG* pcbData)
|
---|
636 | {
|
---|
637 | FIXME("(),stub!\n");
|
---|
638 | return E_NOTIMPL;
|
---|
639 | }
|
---|
640 |
|
---|
641 | /******************************************************************************
|
---|
642 | * CreateAntiMoniker [OLE.55]
|
---|
643 | ******************************************************************************/
|
---|
644 | HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk)
|
---|
645 | {
|
---|
646 | AntiMonikerImpl* newAntiMoniker = 0;
|
---|
647 | HRESULT hr = S_OK;
|
---|
648 | IID riid=IID_IMoniker;
|
---|
649 |
|
---|
650 | TRACE("(%p)\n",ppmk);
|
---|
651 |
|
---|
652 | newAntiMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(AntiMonikerImpl));
|
---|
653 |
|
---|
654 | if (newAntiMoniker == 0)
|
---|
655 | return STG_E_INSUFFICIENTMEMORY;
|
---|
656 |
|
---|
657 | hr = AntiMonikerImpl_Construct(newAntiMoniker);
|
---|
658 |
|
---|
659 | if (FAILED(hr)){
|
---|
660 |
|
---|
661 | HeapFree(GetProcessHeap(),0,newAntiMoniker);
|
---|
662 | return hr;
|
---|
663 | }
|
---|
664 |
|
---|
665 | hr = AntiMonikerImpl_QueryInterface((IMoniker*)newAntiMoniker,&riid,(void**)ppmk);
|
---|
666 |
|
---|
667 | return hr;
|
---|
668 | }
|
---|