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