Ignore:
Timestamp:
Sep 15, 2001, 11:32:00 AM (24 years ago)
Author:
sandervl
Message:

restored old version + wine update

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 $ */
    21/***************************************************************************************
    3  *                        CompositeMonikers implementation
     2 *                            CompositeMonikers implementation
    43 *
    54 *               Copyright 1999  Noomen Hamza
     
    1817#include "ole2.h"
    1918
     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
    2031DEFAULT_DEBUG_CHANNEL(ole);
    2132
     
    2738    ICOM_VTABLE(IMoniker)*  lpvtbl1;  /* VTable relative to the IMoniker interface.*/
    2839
    29     /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether
     40    /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 
    3041     * two monikers are equal. That's whay IROTData interface is implemented by monikers.
    3142     */
     
    187198{
    188199    ICOM_THIS(CompositeMonikerImpl,iface);
    189 
     200 
    190201    TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
    191202
    192203    /* Perform a sanity check on the parameters.*/
    193204    if ( (This==0) || (ppvObject==0) )
    194     return E_INVALIDARG;
    195 
     205        return E_INVALIDARG;
     206 
    196207    /* Initialize the return parameter */
    197208    *ppvObject = 0;
     
    236247    ICOM_THIS(CompositeMonikerImpl,iface);
    237248    ULONG i;
    238 
     249   
    239250    TRACE("(%p)\n",This);
    240251
     
    247258        for (i=0;i<This->tabLastIndex;i++)
    248259            IMoniker_Release(This->tabMoniker[i]);
    249 
     260       
    250261        CompositeMonikerImpl_Destroy(This);
    251262
     
    264275    if (pClassID==NULL)
    265276        return E_POINTER;
    266 
     277           
    267278    *pClassID = CLSID_CompositeMoniker;
    268 
     279       
    269280    return S_OK;
    270281}
     
    293304    CLSID clsid;
    294305    WCHAR string[1]={0};
    295 
    296     ICOM_THIS(CompositeMonikerImpl,iface);
     306   
     307    ICOM_THIS(CompositeMonikerImpl,iface);   
    297308
    298309    TRACE("(%p,%p)\n",iface,pStm);
     
    350361        /* resize the table if needed */
    351362        if (++This->tabLastIndex==This->tabSize){
    352 
     363               
    353364            This->tabSize+=BLOCK_TAB_SIZE;
    354365            This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker));
     
    371382    IMoniker *pmk;
    372383    DWORD constant=3;
    373 
     384   
    374385    TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty);
    375386
     
    446457    IMoniker *tempMk;
    447458    HRESULT res;
    448 
     459   
    449460    TRACE("(%p,%p,%p)\n",This,pmkFirst,pmkRest);
    450461
     
    472483
    473484        IMoniker_Enum(pmkFirst,TRUE,&enumMoniker);
    474 
     485       
    475486        while(IEnumMoniker_Next(enumMoniker,1,&This->tabMoniker[This->tabLastIndex],NULL)==S_OK){
    476487
    477488
    478489            if (++This->tabLastIndex==This->tabSize){
    479 
     490               
    480491                This->tabSize+=BLOCK_TAB_SIZE;
    481492                This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker));
     
    492503
    493504    IMoniker_IsSystemMoniker(pmkRest,&mkSys);
    494 
     505   
    495506    if (mkSys!=MKSYS_GENERICCOMPOSITE){
    496507
     
    499510        res=IMoniker_ComposeWith(This->tabMoniker[This->tabLastIndex-1],pmkRest,TRUE,&tempMk);
    500511
    501         if (res==MK_E_NEEDGENERIC){
     512        if (res==MK_E_NEEDGENERIC){ 
    502513
    503514            /* there's no simplification in this case */
     
    508519            IMoniker_AddRef(pmkRest);
    509520        }
    510         else if (tempMk==NULL){
     521        else if (tempMk==NULL){ 
    511522
    512523            /* we have an antimoniker after a simple moniker so we can make a simplification in this case */
     
    526537        /* resize tabMoniker if needed */
    527538        if (This->tabLastIndex==This->tabSize){
    528 
     539               
    529540            This->tabSize+=BLOCK_TAB_SIZE;
    530541
     
    563574
    564575            if (This->tabLastIndex==This->tabSize){
    565 
     576               
    566577                This->tabSize+=BLOCK_TAB_SIZE;
    567578
     
    606617    IMoniker *tempMk,*antiMk,*mostRigthMk;
    607618    IEnumMoniker *enumMoniker;
    608 
     619   
    609620    TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
    610621
    611622    if (ppvResult==NULL)
    612623        return E_POINTER;
    613 
     624   
    614625    *ppvResult=0;
    615626    /* If pmkToLeft is NULL, this method looks for the moniker in the ROT, and if found, queries the retrieved */
     
    635646        IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
    636647        IEnumMoniker_Release(enumMoniker);
    637 
     648       
    638649        res=CreateAntiMoniker(&antiMk);
    639650        res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
    640651        IMoniker_Release(antiMk);
    641 
     652       
    642653        res=CompositeMonikerImpl_BindToObject(mostRigthMk,pbc,tempMk,riid,ppvResult);
    643654
     
    670681
    671682    if (pmkToLeft!=NULL){
    672 
     683       
    673684        IMoniker_Enum(iface,FALSE,&enumMoniker);
    674685        IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
    675686        IEnumMoniker_Release(enumMoniker);
    676 
     687       
    677688        res=CreateAntiMoniker(&antiMk);
    678689        res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
    679690        IMoniker_Release(antiMk);
    680 
     691       
    681692        res=CompositeMonikerImpl_BindToStorage(mostRigthMk,pbc,tempMk,riid,ppvResult);
    682693
     
    716727        IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
    717728        IEnumMoniker_Release(enumMoniker);
    718 
     729       
    719730        res=CreateAntiMoniker(&antiMk);
    720731        res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
     
    733744        IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
    734745        IEnumMoniker_Release(enumMoniker);
    735 
     746       
    736747        res=CreateAntiMoniker(&antiMk);
    737748        res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
     
    769780
    770781    if ((ppmkComposite==NULL)||(pmkRight==NULL))
    771     return E_POINTER;
     782        return E_POINTER;
    772783
    773784    *ppmkComposite=0;
     
    776787    /* otherwise, the method returns the result of combining the two monikers by calling the */
    777788    /* CreateGenericComposite function */
    778 
     789   
    779790    if (fOnlyIfNotGeneric)
    780791        return MK_E_NEEDGENERIC;
    781 
     792   
    782793    return CreateGenericComposite(iface,pmkRight,ppmkComposite);
    783794}
     
    794805    if (ppenumMoniker == NULL)
    795806        return E_POINTER;
    796 
     807   
    797808    return EnumMonikerImpl_CreateEnumMoniker(This->tabMoniker,This->tabLastIndex,0,fForward,ppenumMoniker);
    798809}
     
    806817    IMoniker *tempMk1,*tempMk2;
    807818    HRESULT res1,res2,res;
    808 
     819   
    809820    TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
    810821
     
    818829    if (enumMoniker1==NULL)
    819830        return S_FALSE;
    820 
     831   
    821832    IMoniker_Enum(iface,TRUE,&enumMoniker2);
    822833
     
    825836        res1=IEnumMoniker_Next(enumMoniker1,1,&tempMk1,NULL);
    826837        res2=IEnumMoniker_Next(enumMoniker2,1,&tempMk2,NULL);
    827 
     838       
    828839        if((res1==S_OK)&&(res2==S_OK)){
    829840
     
    895906        /* If pmkToLeft is NULL, this method returns S_OK if pmkNewlyRunning is non-NULL and is equal */
    896907        /* to this moniker */
    897 
     908       
    898909        if (pmkNewlyRunning!=NULL)
    899910
     
    913924            /* IMoniker::IsRunning on the rightmost component of the composite, passing the remainder of */
    914925            /* the composite as the pmkToLeft parameter for that call.                                   */
    915 
     926           
    916927             res=IBindCtx_GetRunningObjectTable(pbc,&rot);
    917928
     
    957968    IMoniker *tempMk,*antiMk,*mostRigthMk;
    958969    IEnumMoniker *enumMoniker;
    959 
     970   
    960971    TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pCompositeTime);
    961972
     
    10541065    IEnumMoniker *enumMoniker1,*enumMoniker2;
    10551066    ULONG i,nbCommonMk=0;
    1056 
     1067   
    10571068    /* If the other moniker is a composite, this method compares the components of each composite from left  */
    10581069    /* to right. The returned common prefix moniker might also be a composite moniker, depending on how many */
     
    10611072    if (ppmkPrefix==NULL)
    10621073        return E_POINTER;
    1063 
     1074   
    10641075    *ppmkPrefix=0;
    10651076
    10661077    if (pmkOther==NULL)
    10671078        return MK_E_NOPREFIX;
    1068 
     1079   
    10691080    IMoniker_IsSystemMoniker(pmkOther,&mkSys);
    10701081
     
    11301141            IMoniker_Release(tempMk1);
    11311142            IMoniker_Release(tempMk2);
    1132 
     1143           
    11331144            /* compose all common monikers in a composite moniker */
    11341145            for(i=0;i<nbCommonMk;i++){
     
    11411152
    11421153                IMoniker_Release(tempMk1);
    1143 
     1154               
    11441155                *ppmkPrefix=tempMk2;
    11451156            }
     
    11821193    DWORD mkSys;
    11831194    HRESULT res1,res2;
    1184 
     1195   
    11851196    *restMk=0;
    11861197
     
    12801291
    12811292    /* finds the common prefix of the two monikers */
    1282     res=IMoniker_CommonPrefixWith(iface,pmkOther,&commonMk);
     1293    res=IMoniker_CommonPrefixWith(iface,pmkOther,&commonMk);   
    12831294
    12841295    /* if there's no common prefix or the two moniker are equal the relative is the other moniker */
     
    13371348    if (ppszDisplayName==NULL)
    13381349        return E_POINTER;
    1339 
     1350   
    13401351    *ppszDisplayName=CoTaskMemAlloc(sizeof(WCHAR));
    13411352
     
    13491360
    13501361    IMoniker_Enum(iface,TRUE,&enumMoniker);
    1351 
     1362   
    13521363    while(IEnumMoniker_Next(enumMoniker,1,&tempMk,NULL)==S_OK){
    13531364
     
    14091420    if (!pwdMksys)
    14101421        return E_POINTER;
    1411 
     1422   
    14121423    (*pwdMksys)=MKSYS_GENERICCOMPOSITE;
    14131424
     
    14461457{
    14471458    ICOM_THIS_From_IROTData(IMoniker, iface);
    1448 
     1459   
    14491460    TRACE("(%p)\n",iface);
    14501461
     
    14701481{
    14711482    ICOM_THIS(EnumMonikerImpl,iface);
    1472 
     1483 
    14731484    TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
    14741485
    14751486    /* Perform a sanity check on the parameters.*/
    14761487    if ( (This==0) || (ppvObject==0) )
    1477     return E_INVALIDARG;
    1478 
     1488        return E_INVALIDARG;
     1489 
    14791490    /* Initialize the return parameter */
    14801491    *ppvObject = 0;
     
    15211532    /* destroy the object if there's no more reference on it */
    15221533    if (This->ref==0){
    1523 
     1534       
    15241535        for(i=0;i<This->tabSize;i++)
    15251536            IMoniker_Release(This->tabMoniker[i]);
     
    15481559    if (pceltFethed!=NULL)
    15491560        *pceltFethed= i;
    1550 
     1561   
    15511562    if (i==celt)
    15521563        return S_OK;
     
    15661577
    15671578    This->currentPos+=celt;
    1568 
     1579   
    15691580    return S_OK;
    15701581}
     
    16121623    if (currentPos > tabSize)
    16131624        return E_INVALIDARG;
    1614 
     1625   
    16151626    /* Initialize the virtual function table. */
    16161627    ICOM_VTBL(newEnumMoniker)    = &VT_EnumMonikerImpl;
     
    16441655
    16451656/******************************************************************************
    1646  *        CreateGenericComposite    [OLE.55]
     1657 *        CreateGenericComposite        [OLE.55]
    16471658 ******************************************************************************/
    16481659HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite)
     
    16551666    if (ppmkComposite==NULL)
    16561667        return E_POINTER;
    1657 
     1668   
    16581669    *ppmkComposite=0;
    16591670
     
    16931704
    16941705/******************************************************************************
    1695  *        MonikerCommonPrefixWith   [OLE.55]
     1706 *        MonikerCommonPrefixWith       [OLE.55]
    16961707 ******************************************************************************/
    16971708HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon)
Note: See TracChangeset for help on using the changeset viewer.