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