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