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