Changeset 6711 for trunk/src/ole32/compositemoniker.c
- Timestamp:
- Sep 15, 2001, 11:32:00 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ole32/compositemoniker.c
r6648 r6711 1 /* $Id: compositemoniker.c,v 1.2 2001-09-05 13:17:08 bird Exp $ */2 1 /*************************************************************************************** 3 * 2 * CompositeMonikers implementation 4 3 * 5 4 * Copyright 1999 Noomen Hamza … … 18 17 #include "ole2.h" 19 18 19 #ifdef __WIN32OS2__ 20 #undef FIXME 21 #undef TRACE 22 #ifdef DEBUG 23 #define TRACE WriteLog("OLE32: %s", __FUNCTION__); WriteLog 24 #define FIXME WriteLog("FIXME OLE32: %s", __FUNCTION__); WriteLog 25 #else 26 #define TRACE 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL) 27 #define FIXME 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL) 28 #endif 29 #endif 30 20 31 DEFAULT_DEBUG_CHANNEL(ole); 21 32 … … 27 38 ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/ 28 39 29 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 40 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 30 41 * two monikers are equal. That's whay IROTData interface is implemented by monikers. 31 42 */ … … 187 198 { 188 199 ICOM_THIS(CompositeMonikerImpl,iface); 189 200 190 201 TRACE("(%p,%p,%p)\n",This,riid,ppvObject); 191 202 192 203 /* Perform a sanity check on the parameters.*/ 193 204 if ( (This==0) || (ppvObject==0) ) 194 195 205 return E_INVALIDARG; 206 196 207 /* Initialize the return parameter */ 197 208 *ppvObject = 0; … … 236 247 ICOM_THIS(CompositeMonikerImpl,iface); 237 248 ULONG i; 238 249 239 250 TRACE("(%p)\n",This); 240 251 … … 247 258 for (i=0;i<This->tabLastIndex;i++) 248 259 IMoniker_Release(This->tabMoniker[i]); 249 260 250 261 CompositeMonikerImpl_Destroy(This); 251 262 … … 264 275 if (pClassID==NULL) 265 276 return E_POINTER; 266 277 267 278 *pClassID = CLSID_CompositeMoniker; 268 279 269 280 return S_OK; 270 281 } … … 293 304 CLSID clsid; 294 305 WCHAR string[1]={0}; 295 296 ICOM_THIS(CompositeMonikerImpl,iface); 306 307 ICOM_THIS(CompositeMonikerImpl,iface); 297 308 298 309 TRACE("(%p,%p)\n",iface,pStm); … … 350 361 /* resize the table if needed */ 351 362 if (++This->tabLastIndex==This->tabSize){ 352 363 353 364 This->tabSize+=BLOCK_TAB_SIZE; 354 365 This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); … … 371 382 IMoniker *pmk; 372 383 DWORD constant=3; 373 384 374 385 TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty); 375 386 … … 446 457 IMoniker *tempMk; 447 458 HRESULT res; 448 459 449 460 TRACE("(%p,%p,%p)\n",This,pmkFirst,pmkRest); 450 461 … … 472 483 473 484 IMoniker_Enum(pmkFirst,TRUE,&enumMoniker); 474 485 475 486 while(IEnumMoniker_Next(enumMoniker,1,&This->tabMoniker[This->tabLastIndex],NULL)==S_OK){ 476 487 477 488 478 489 if (++This->tabLastIndex==This->tabSize){ 479 490 480 491 This->tabSize+=BLOCK_TAB_SIZE; 481 492 This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); … … 492 503 493 504 IMoniker_IsSystemMoniker(pmkRest,&mkSys); 494 505 495 506 if (mkSys!=MKSYS_GENERICCOMPOSITE){ 496 507 … … 499 510 res=IMoniker_ComposeWith(This->tabMoniker[This->tabLastIndex-1],pmkRest,TRUE,&tempMk); 500 511 501 if (res==MK_E_NEEDGENERIC){ 512 if (res==MK_E_NEEDGENERIC){ 502 513 503 514 /* there's no simplification in this case */ … … 508 519 IMoniker_AddRef(pmkRest); 509 520 } 510 else if (tempMk==NULL){ 521 else if (tempMk==NULL){ 511 522 512 523 /* we have an antimoniker after a simple moniker so we can make a simplification in this case */ … … 526 537 /* resize tabMoniker if needed */ 527 538 if (This->tabLastIndex==This->tabSize){ 528 539 529 540 This->tabSize+=BLOCK_TAB_SIZE; 530 541 … … 563 574 564 575 if (This->tabLastIndex==This->tabSize){ 565 576 566 577 This->tabSize+=BLOCK_TAB_SIZE; 567 578 … … 606 617 IMoniker *tempMk,*antiMk,*mostRigthMk; 607 618 IEnumMoniker *enumMoniker; 608 619 609 620 TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult); 610 621 611 622 if (ppvResult==NULL) 612 623 return E_POINTER; 613 624 614 625 *ppvResult=0; 615 626 /* If pmkToLeft is NULL, this method looks for the moniker in the ROT, and if found, queries the retrieved */ … … 635 646 IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); 636 647 IEnumMoniker_Release(enumMoniker); 637 648 638 649 res=CreateAntiMoniker(&antiMk); 639 650 res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); 640 651 IMoniker_Release(antiMk); 641 652 642 653 res=CompositeMonikerImpl_BindToObject(mostRigthMk,pbc,tempMk,riid,ppvResult); 643 654 … … 670 681 671 682 if (pmkToLeft!=NULL){ 672 683 673 684 IMoniker_Enum(iface,FALSE,&enumMoniker); 674 685 IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); 675 686 IEnumMoniker_Release(enumMoniker); 676 687 677 688 res=CreateAntiMoniker(&antiMk); 678 689 res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); 679 690 IMoniker_Release(antiMk); 680 691 681 692 res=CompositeMonikerImpl_BindToStorage(mostRigthMk,pbc,tempMk,riid,ppvResult); 682 693 … … 716 727 IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); 717 728 IEnumMoniker_Release(enumMoniker); 718 729 719 730 res=CreateAntiMoniker(&antiMk); 720 731 res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); … … 733 744 IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); 734 745 IEnumMoniker_Release(enumMoniker); 735 746 736 747 res=CreateAntiMoniker(&antiMk); 737 748 res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); … … 769 780 770 781 if ((ppmkComposite==NULL)||(pmkRight==NULL)) 771 782 return E_POINTER; 772 783 773 784 *ppmkComposite=0; … … 776 787 /* otherwise, the method returns the result of combining the two monikers by calling the */ 777 788 /* CreateGenericComposite function */ 778 789 779 790 if (fOnlyIfNotGeneric) 780 791 return MK_E_NEEDGENERIC; 781 792 782 793 return CreateGenericComposite(iface,pmkRight,ppmkComposite); 783 794 } … … 794 805 if (ppenumMoniker == NULL) 795 806 return E_POINTER; 796 807 797 808 return EnumMonikerImpl_CreateEnumMoniker(This->tabMoniker,This->tabLastIndex,0,fForward,ppenumMoniker); 798 809 } … … 806 817 IMoniker *tempMk1,*tempMk2; 807 818 HRESULT res1,res2,res; 808 819 809 820 TRACE("(%p,%p)\n",iface,pmkOtherMoniker); 810 821 … … 818 829 if (enumMoniker1==NULL) 819 830 return S_FALSE; 820 831 821 832 IMoniker_Enum(iface,TRUE,&enumMoniker2); 822 833 … … 825 836 res1=IEnumMoniker_Next(enumMoniker1,1,&tempMk1,NULL); 826 837 res2=IEnumMoniker_Next(enumMoniker2,1,&tempMk2,NULL); 827 838 828 839 if((res1==S_OK)&&(res2==S_OK)){ 829 840 … … 895 906 /* If pmkToLeft is NULL, this method returns S_OK if pmkNewlyRunning is non-NULL and is equal */ 896 907 /* to this moniker */ 897 908 898 909 if (pmkNewlyRunning!=NULL) 899 910 … … 913 924 /* IMoniker::IsRunning on the rightmost component of the composite, passing the remainder of */ 914 925 /* the composite as the pmkToLeft parameter for that call. */ 915 926 916 927 res=IBindCtx_GetRunningObjectTable(pbc,&rot); 917 928 … … 957 968 IMoniker *tempMk,*antiMk,*mostRigthMk; 958 969 IEnumMoniker *enumMoniker; 959 970 960 971 TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pCompositeTime); 961 972 … … 1054 1065 IEnumMoniker *enumMoniker1,*enumMoniker2; 1055 1066 ULONG i,nbCommonMk=0; 1056 1067 1057 1068 /* If the other moniker is a composite, this method compares the components of each composite from left */ 1058 1069 /* to right. The returned common prefix moniker might also be a composite moniker, depending on how many */ … … 1061 1072 if (ppmkPrefix==NULL) 1062 1073 return E_POINTER; 1063 1074 1064 1075 *ppmkPrefix=0; 1065 1076 1066 1077 if (pmkOther==NULL) 1067 1078 return MK_E_NOPREFIX; 1068 1079 1069 1080 IMoniker_IsSystemMoniker(pmkOther,&mkSys); 1070 1081 … … 1130 1141 IMoniker_Release(tempMk1); 1131 1142 IMoniker_Release(tempMk2); 1132 1143 1133 1144 /* compose all common monikers in a composite moniker */ 1134 1145 for(i=0;i<nbCommonMk;i++){ … … 1141 1152 1142 1153 IMoniker_Release(tempMk1); 1143 1154 1144 1155 *ppmkPrefix=tempMk2; 1145 1156 } … … 1182 1193 DWORD mkSys; 1183 1194 HRESULT res1,res2; 1184 1195 1185 1196 *restMk=0; 1186 1197 … … 1280 1291 1281 1292 /* finds the common prefix of the two monikers */ 1282 res=IMoniker_CommonPrefixWith(iface,pmkOther,&commonMk); 1293 res=IMoniker_CommonPrefixWith(iface,pmkOther,&commonMk); 1283 1294 1284 1295 /* if there's no common prefix or the two moniker are equal the relative is the other moniker */ … … 1337 1348 if (ppszDisplayName==NULL) 1338 1349 return E_POINTER; 1339 1350 1340 1351 *ppszDisplayName=CoTaskMemAlloc(sizeof(WCHAR)); 1341 1352 … … 1349 1360 1350 1361 IMoniker_Enum(iface,TRUE,&enumMoniker); 1351 1362 1352 1363 while(IEnumMoniker_Next(enumMoniker,1,&tempMk,NULL)==S_OK){ 1353 1364 … … 1409 1420 if (!pwdMksys) 1410 1421 return E_POINTER; 1411 1422 1412 1423 (*pwdMksys)=MKSYS_GENERICCOMPOSITE; 1413 1424 … … 1446 1457 { 1447 1458 ICOM_THIS_From_IROTData(IMoniker, iface); 1448 1459 1449 1460 TRACE("(%p)\n",iface); 1450 1461 … … 1470 1481 { 1471 1482 ICOM_THIS(EnumMonikerImpl,iface); 1472 1483 1473 1484 TRACE("(%p,%p,%p)\n",This,riid,ppvObject); 1474 1485 1475 1486 /* Perform a sanity check on the parameters.*/ 1476 1487 if ( (This==0) || (ppvObject==0) ) 1477 1478 1488 return E_INVALIDARG; 1489 1479 1490 /* Initialize the return parameter */ 1480 1491 *ppvObject = 0; … … 1521 1532 /* destroy the object if there's no more reference on it */ 1522 1533 if (This->ref==0){ 1523 1534 1524 1535 for(i=0;i<This->tabSize;i++) 1525 1536 IMoniker_Release(This->tabMoniker[i]); … … 1548 1559 if (pceltFethed!=NULL) 1549 1560 *pceltFethed= i; 1550 1561 1551 1562 if (i==celt) 1552 1563 return S_OK; … … 1566 1577 1567 1578 This->currentPos+=celt; 1568 1579 1569 1580 return S_OK; 1570 1581 } … … 1612 1623 if (currentPos > tabSize) 1613 1624 return E_INVALIDARG; 1614 1625 1615 1626 /* Initialize the virtual function table. */ 1616 1627 ICOM_VTBL(newEnumMoniker) = &VT_EnumMonikerImpl; … … 1644 1655 1645 1656 /****************************************************************************** 1646 * CreateGenericComposite 1657 * CreateGenericComposite [OLE.55] 1647 1658 ******************************************************************************/ 1648 1659 HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite) … … 1655 1666 if (ppmkComposite==NULL) 1656 1667 return E_POINTER; 1657 1668 1658 1669 *ppmkComposite=0; 1659 1670 … … 1693 1704 1694 1705 /****************************************************************************** 1695 * MonikerCommonPrefixWith 1706 * MonikerCommonPrefixWith [OLE.55] 1696 1707 ******************************************************************************/ 1697 1708 HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon)
Note:
See TracChangeset
for help on using the changeset viewer.