Changeset 6711 for trunk/src/ole32/itemmoniker.c
- Timestamp:
- Sep 15, 2001, 11:32:00 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ole32/itemmoniker.c
r6648 r6711 1 /* $Id: itemmoniker.c,v 1.2 2001-09-05 13:17:10 bird Exp $ */2 1 /*************************************************************************************** 3 * 2 * ItemMonikers implementation 4 3 * 5 4 * Copyright 1999 Noomen Hamza … … 26 25 ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/ 27 26 28 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 27 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 29 28 * two monikers are equal. That's whay IROTData interface is implemented by monikers. 30 29 */ … … 36 35 37 36 LPOLESTR itemDelimiter; /* Delimiter string */ 38 37 39 38 } ItemMonikerImpl; 40 39 … … 141 140 /* Perform a sanity check on the parameters.*/ 142 141 if ( (This==0) || (ppvObject==0) ) 143 144 142 return E_INVALIDARG; 143 145 144 /* Initialize the return parameter */ 146 145 *ppvObject = 0; … … 153 152 ) 154 153 *ppvObject = iface; 155 154 156 155 else if (IsEqualIID(&IID_IROTData, riid)) 157 156 *ppvObject = (IROTData*)&(This->lpvtbl2); … … 160 159 if ((*ppvObject)==0) 161 160 return E_NOINTERFACE; 162 161 163 162 /* Query Interface always increases the reference count by one when it is successful */ 164 163 ItemMonikerImpl_AddRef(iface); … … 209 208 if (pClassID==NULL) 210 209 return E_POINTER; 211 210 212 211 *pClassID = CLSID_ItemMoniker; 213 212 214 213 return S_OK; 215 214 } … … 343 342 344 343 /* for more details see ItemMonikerImpl_Save coments */ 345 344 346 345 pcbSize->s.LowPart = sizeof(DWORD) + /* DWORD which contains delimiter length */ 347 346 delimiterLength + /* item delimiter string */ … … 363 362 int sizeStr1=lstrlenW(lpszItem), sizeStr2; 364 363 static const OLECHAR emptystr[1]; 365 LPCOLESTR 364 LPCOLESTR delim; 366 365 367 366 TRACE("(%p,%p)\n",This,lpszItem); … … 374 373 This->itemName=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(sizeStr1+1)); 375 374 if (!This->itemName) 376 375 return E_OUTOFMEMORY; 377 376 strcpyW(This->itemName,lpszItem); 378 377 379 378 if (!lpszDelim) 380 379 FIXME("lpszDelim is NULL. Using empty string which is possibly wrong.\n"); 381 380 382 381 delim = lpszDelim ? lpszDelim : emptystr; … … 385 384 This->itemDelimiter=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(sizeStr2+1)); 386 385 if (!This->itemDelimiter) { 387 388 386 HeapFree(GetProcessHeap(),0,This->itemName); 387 return E_OUTOFMEMORY; 389 388 } 390 389 strcpyW(This->itemDelimiter,delim); … … 420 419 { 421 420 ICOM_THIS(ItemMonikerImpl,iface); 422 421 423 422 HRESULT res; 424 423 IID refid=IID_IOleItemContainer; … … 467 466 if(pmkToLeft==NULL) 468 467 return E_INVALIDARG; 469 468 470 469 res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic); 471 470 … … 497 496 498 497 *ppmkReduced=iface; 499 498 500 499 return MK_S_REDUCED_TO_SELF; 501 500 } … … 517 516 518 517 if ((ppmkComposite==NULL)||(pmkRight==NULL)) 519 518 return E_POINTER; 520 519 521 520 *ppmkComposite=0; 522 521 523 522 IMoniker_IsSystemMoniker(pmkRight,&mkSys); 524 523 … … 530 529 /* if pmkRight is a composite whose leftmost component is an anti-moniker, */ 531 530 /* the returned moniker is the composite after the leftmost anti-moniker is removed. */ 532 531 533 532 if(mkSys==MKSYS_GENERICCOMPOSITE){ 534 533 … … 548 547 tempMkComposite=iface; 549 548 IMoniker_AddRef(iface); 550 549 551 550 while(IEnumMoniker_Next(penumMk,1,&pmostLeftMk,NULL)==S_OK){ 552 551 … … 605 604 if (pmkOtherMoniker==NULL) 606 605 return S_FALSE; 607 606 608 607 /* This method returns S_OK if both monikers are item monikers and their display names are */ 609 608 /* identical (using a case-insensitive comparison); otherwise, the method returns S_FALSE. */ … … 620 619 IMoniker_GetDisplayName(iface,bind,NULL,&dispName1); 621 620 IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&dispName2); 622 621 623 622 if (lstrcmpW(dispName1,dispName2)!=0) 624 623 return S_FALSE; 625 624 626 625 return S_OK; 627 626 } … … 640 639 if (pdwHash==NULL) 641 640 return E_POINTER; 642 641 643 642 val = This->itemName; 644 643 len = lstrlenW(val); … … 650 649 } else { 651 650 /* only sample some characters */ 652 653 651 skip = len / 8; 652 for (i = len ; i > 0; i -= skip, off += skip) { 654 653 h = (h * 39) + val[off]; 655 654 } 656 655 } 657 656 … … 699 698 /* requesting an IOleItemContainer interface pointer. The method then calls IOleItemContainer::IsRunning,*/ 700 699 /* passing the string contained within this moniker. */ 701 700 702 701 res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic); 703 702 … … 780 779 781 780 *ppmkPrefix=iface; 782 781 783 782 IMoniker_AddRef(iface); 784 783 785 784 return MK_S_US; 786 785 } … … 802 801 803 802 *ppmkRelPath=0; 804 803 805 804 return MK_E_NOTBINDABLE; 806 805 } … … 832 831 strcpyW(*ppszDisplayName,This->itemDelimiter); 833 832 strcatW(*ppszDisplayName,This->itemName); 834 833 835 834 return S_OK; 836 835 } … … 886 885 if (!pwdMksys) 887 886 return E_POINTER; 888 887 889 888 (*pwdMksys)=MKSYS_ITEMMONIKER; 890 889 … … 923 922 { 924 923 ICOM_THIS_From_IROTData(IMoniker, iface); 925 924 926 925 TRACE("(%p)\n",iface); 927 926 … … 942 941 943 942 /****************************************************************************** 944 * CreateItemMoniker16 943 * CreateItemMoniker16 [OLE2.28] 945 944 ******************************************************************************/ 946 945 HRESULT WINAPI CreateItemMoniker16(LPCOLESTR16 lpszDelim,LPCOLESTR lpszItem,LPMONIKER* ppmk) … … 953 952 954 953 /****************************************************************************** 955 * CreateItemMoniker 954 * CreateItemMoniker [OLE.55] 956 955 ******************************************************************************/ 957 956 HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim,LPCOLESTR lpszItem, LPMONIKER * ppmk)
Note:
See TracChangeset
for help on using the changeset viewer.