Changeset 6648 for trunk/src/ole32/compositemoniker.c
- Timestamp:
- Sep 5, 2001, 3:19:02 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ole32/compositemoniker.c
r5602 r6648 1 /* $Id: compositemoniker.c,v 1.2 2001-09-05 13:17:08 bird Exp $ */ 1 2 /*************************************************************************************** 2 * 3 * CompositeMonikers implementation 3 4 * 4 5 * Copyright 1999 Noomen Hamza … … 26 27 ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/ 27 28 28 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 29 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 29 30 * two monikers are equal. That's whay IROTData interface is implemented by monikers. 30 31 */ … … 186 187 { 187 188 ICOM_THIS(CompositeMonikerImpl,iface); 188 189 189 190 TRACE("(%p,%p,%p)\n",This,riid,ppvObject); 190 191 191 192 /* Perform a sanity check on the parameters.*/ 192 193 if ( (This==0) || (ppvObject==0) ) 193 194 194 return E_INVALIDARG; 195 195 196 /* Initialize the return parameter */ 196 197 *ppvObject = 0; … … 235 236 ICOM_THIS(CompositeMonikerImpl,iface); 236 237 ULONG i; 237 238 238 239 TRACE("(%p)\n",This); 239 240 … … 246 247 for (i=0;i<This->tabLastIndex;i++) 247 248 IMoniker_Release(This->tabMoniker[i]); 248 249 249 250 CompositeMonikerImpl_Destroy(This); 250 251 … … 263 264 if (pClassID==NULL) 264 265 return E_POINTER; 265 266 266 267 *pClassID = CLSID_CompositeMoniker; 267 268 268 269 return S_OK; 269 270 } … … 292 293 CLSID clsid; 293 294 WCHAR string[1]={0}; 294 295 ICOM_THIS(CompositeMonikerImpl,iface); 295 296 ICOM_THIS(CompositeMonikerImpl,iface); 296 297 297 298 TRACE("(%p,%p)\n",iface,pStm); … … 349 350 /* resize the table if needed */ 350 351 if (++This->tabLastIndex==This->tabSize){ 351 352 352 353 This->tabSize+=BLOCK_TAB_SIZE; 353 354 This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); … … 370 371 IMoniker *pmk; 371 372 DWORD constant=3; 372 373 373 374 TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty); 374 375 … … 445 446 IMoniker *tempMk; 446 447 HRESULT res; 447 448 448 449 TRACE("(%p,%p,%p)\n",This,pmkFirst,pmkRest); 449 450 … … 471 472 472 473 IMoniker_Enum(pmkFirst,TRUE,&enumMoniker); 473 474 474 475 while(IEnumMoniker_Next(enumMoniker,1,&This->tabMoniker[This->tabLastIndex],NULL)==S_OK){ 475 476 476 477 477 478 if (++This->tabLastIndex==This->tabSize){ 478 479 479 480 This->tabSize+=BLOCK_TAB_SIZE; 480 481 This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); … … 491 492 492 493 IMoniker_IsSystemMoniker(pmkRest,&mkSys); 493 494 494 495 if (mkSys!=MKSYS_GENERICCOMPOSITE){ 495 496 … … 498 499 res=IMoniker_ComposeWith(This->tabMoniker[This->tabLastIndex-1],pmkRest,TRUE,&tempMk); 499 500 500 if (res==MK_E_NEEDGENERIC){ 501 if (res==MK_E_NEEDGENERIC){ 501 502 502 503 /* there's no simplification in this case */ … … 507 508 IMoniker_AddRef(pmkRest); 508 509 } 509 else if (tempMk==NULL){ 510 else if (tempMk==NULL){ 510 511 511 512 /* we have an antimoniker after a simple moniker so we can make a simplification in this case */ … … 525 526 /* resize tabMoniker if needed */ 526 527 if (This->tabLastIndex==This->tabSize){ 527 528 528 529 This->tabSize+=BLOCK_TAB_SIZE; 529 530 … … 562 563 563 564 if (This->tabLastIndex==This->tabSize){ 564 565 565 566 This->tabSize+=BLOCK_TAB_SIZE; 566 567 … … 605 606 IMoniker *tempMk,*antiMk,*mostRigthMk; 606 607 IEnumMoniker *enumMoniker; 607 608 608 609 TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult); 609 610 610 611 if (ppvResult==NULL) 611 612 return E_POINTER; 612 613 613 614 *ppvResult=0; 614 615 /* If pmkToLeft is NULL, this method looks for the moniker in the ROT, and if found, queries the retrieved */ … … 634 635 IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); 635 636 IEnumMoniker_Release(enumMoniker); 636 637 637 638 res=CreateAntiMoniker(&antiMk); 638 639 res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); 639 640 IMoniker_Release(antiMk); 640 641 641 642 res=CompositeMonikerImpl_BindToObject(mostRigthMk,pbc,tempMk,riid,ppvResult); 642 643 … … 669 670 670 671 if (pmkToLeft!=NULL){ 671 672 672 673 IMoniker_Enum(iface,FALSE,&enumMoniker); 673 674 IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); 674 675 IEnumMoniker_Release(enumMoniker); 675 676 676 677 res=CreateAntiMoniker(&antiMk); 677 678 res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); 678 679 IMoniker_Release(antiMk); 679 680 680 681 res=CompositeMonikerImpl_BindToStorage(mostRigthMk,pbc,tempMk,riid,ppvResult); 681 682 … … 715 716 IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); 716 717 IEnumMoniker_Release(enumMoniker); 717 718 718 719 res=CreateAntiMoniker(&antiMk); 719 720 res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); … … 732 733 IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); 733 734 IEnumMoniker_Release(enumMoniker); 734 735 735 736 res=CreateAntiMoniker(&antiMk); 736 737 res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); … … 768 769 769 770 if ((ppmkComposite==NULL)||(pmkRight==NULL)) 770 771 return E_POINTER; 771 772 772 773 *ppmkComposite=0; … … 775 776 /* otherwise, the method returns the result of combining the two monikers by calling the */ 776 777 /* CreateGenericComposite function */ 777 778 778 779 if (fOnlyIfNotGeneric) 779 780 return MK_E_NEEDGENERIC; 780 781 781 782 return CreateGenericComposite(iface,pmkRight,ppmkComposite); 782 783 } … … 793 794 if (ppenumMoniker == NULL) 794 795 return E_POINTER; 795 796 796 797 return EnumMonikerImpl_CreateEnumMoniker(This->tabMoniker,This->tabLastIndex,0,fForward,ppenumMoniker); 797 798 } … … 805 806 IMoniker *tempMk1,*tempMk2; 806 807 HRESULT res1,res2,res; 807 808 808 809 TRACE("(%p,%p)\n",iface,pmkOtherMoniker); 809 810 … … 817 818 if (enumMoniker1==NULL) 818 819 return S_FALSE; 819 820 820 821 IMoniker_Enum(iface,TRUE,&enumMoniker2); 821 822 … … 824 825 res1=IEnumMoniker_Next(enumMoniker1,1,&tempMk1,NULL); 825 826 res2=IEnumMoniker_Next(enumMoniker2,1,&tempMk2,NULL); 826 827 827 828 if((res1==S_OK)&&(res2==S_OK)){ 828 829 … … 894 895 /* If pmkToLeft is NULL, this method returns S_OK if pmkNewlyRunning is non-NULL and is equal */ 895 896 /* to this moniker */ 896 897 897 898 if (pmkNewlyRunning!=NULL) 898 899 … … 912 913 /* IMoniker::IsRunning on the rightmost component of the composite, passing the remainder of */ 913 914 /* the composite as the pmkToLeft parameter for that call. */ 914 915 915 916 res=IBindCtx_GetRunningObjectTable(pbc,&rot); 916 917 … … 956 957 IMoniker *tempMk,*antiMk,*mostRigthMk; 957 958 IEnumMoniker *enumMoniker; 958 959 959 960 TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pCompositeTime); 960 961 … … 1053 1054 IEnumMoniker *enumMoniker1,*enumMoniker2; 1054 1055 ULONG i,nbCommonMk=0; 1055 1056 1056 1057 /* If the other moniker is a composite, this method compares the components of each composite from left */ 1057 1058 /* to right. The returned common prefix moniker might also be a composite moniker, depending on how many */ … … 1060 1061 if (ppmkPrefix==NULL) 1061 1062 return E_POINTER; 1062 1063 1063 1064 *ppmkPrefix=0; 1064 1065 1065 1066 if (pmkOther==NULL) 1066 1067 return MK_E_NOPREFIX; 1067 1068 1068 1069 IMoniker_IsSystemMoniker(pmkOther,&mkSys); 1069 1070 … … 1129 1130 IMoniker_Release(tempMk1); 1130 1131 IMoniker_Release(tempMk2); 1131 1132 1132 1133 /* compose all common monikers in a composite moniker */ 1133 1134 for(i=0;i<nbCommonMk;i++){ … … 1140 1141 1141 1142 IMoniker_Release(tempMk1); 1142 1143 1143 1144 *ppmkPrefix=tempMk2; 1144 1145 } … … 1181 1182 DWORD mkSys; 1182 1183 HRESULT res1,res2; 1183 1184 1184 1185 *restMk=0; 1185 1186 … … 1279 1280 1280 1281 /* finds the common prefix of the two monikers */ 1281 res=IMoniker_CommonPrefixWith(iface,pmkOther,&commonMk); 1282 res=IMoniker_CommonPrefixWith(iface,pmkOther,&commonMk); 1282 1283 1283 1284 /* if there's no common prefix or the two moniker are equal the relative is the other moniker */ … … 1336 1337 if (ppszDisplayName==NULL) 1337 1338 return E_POINTER; 1338 1339 1339 1340 *ppszDisplayName=CoTaskMemAlloc(sizeof(WCHAR)); 1340 1341 … … 1348 1349 1349 1350 IMoniker_Enum(iface,TRUE,&enumMoniker); 1350 1351 1351 1352 while(IEnumMoniker_Next(enumMoniker,1,&tempMk,NULL)==S_OK){ 1352 1353 … … 1408 1409 if (!pwdMksys) 1409 1410 return E_POINTER; 1410 1411 1411 1412 (*pwdMksys)=MKSYS_GENERICCOMPOSITE; 1412 1413 … … 1445 1446 { 1446 1447 ICOM_THIS_From_IROTData(IMoniker, iface); 1447 1448 1448 1449 TRACE("(%p)\n",iface); 1449 1450 … … 1469 1470 { 1470 1471 ICOM_THIS(EnumMonikerImpl,iface); 1471 1472 1472 1473 TRACE("(%p,%p,%p)\n",This,riid,ppvObject); 1473 1474 1474 1475 /* Perform a sanity check on the parameters.*/ 1475 1476 if ( (This==0) || (ppvObject==0) ) 1476 1477 1477 return E_INVALIDARG; 1478 1478 1479 /* Initialize the return parameter */ 1479 1480 *ppvObject = 0; … … 1520 1521 /* destroy the object if there's no more reference on it */ 1521 1522 if (This->ref==0){ 1522 1523 1523 1524 for(i=0;i<This->tabSize;i++) 1524 1525 IMoniker_Release(This->tabMoniker[i]); … … 1547 1548 if (pceltFethed!=NULL) 1548 1549 *pceltFethed= i; 1549 1550 1550 1551 if (i==celt) 1551 1552 return S_OK; … … 1565 1566 1566 1567 This->currentPos+=celt; 1567 1568 1568 1569 return S_OK; 1569 1570 } … … 1611 1612 if (currentPos > tabSize) 1612 1613 return E_INVALIDARG; 1613 1614 1614 1615 /* Initialize the virtual function table. */ 1615 1616 ICOM_VTBL(newEnumMoniker) = &VT_EnumMonikerImpl; … … 1643 1644 1644 1645 /****************************************************************************** 1645 * CreateGenericComposite 1646 * CreateGenericComposite [OLE.55] 1646 1647 ******************************************************************************/ 1647 1648 HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite) … … 1654 1655 if (ppmkComposite==NULL) 1655 1656 return E_POINTER; 1656 1657 1657 1658 *ppmkComposite=0; 1658 1659 … … 1692 1693 1693 1694 /****************************************************************************** 1694 * MonikerCommonPrefixWith 1695 * MonikerCommonPrefixWith [OLE.55] 1695 1696 ******************************************************************************/ 1696 1697 HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon)
Note:
See TracChangeset
for help on using the changeset viewer.