Ignore:
Timestamp:
Jun 9, 2002, 6:37:22 PM (23 years ago)
Author:
sandervl
Message:

Resync with latest Wine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ole32/filemoniker.c

    r8441 r8620  
    4040    ICOM_VTABLE(IMoniker)*  lpvtbl1;  /* VTable relative to the IMoniker interface.*/
    4141
    42     /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 
     42    /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether
    4343     * two monikers are equal. That's whay IROTData interface is implemented by monikers.
    4444     */
     
    150150{
    151151    ICOM_THIS(FileMonikerImpl,iface);
    152  
     152
    153153  TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
    154154
     
    156156    if ( (This==0) || (ppvObject==0) )
    157157        return E_INVALIDARG;
    158  
     158
    159159    /* Initialize the return parameter */
    160160  *ppvObject = 0;
     
    167167       )
    168168        *ppvObject = iface;
    169    
     169
    170170    else if (IsEqualIID(&IID_IROTData, riid))
    171171        *ppvObject = (IROTData*)&(This->lpvtbl2);
     
    174174    if ((*ppvObject)==0)
    175175        return E_NOINTERFACE;
    176  
     176
    177177    /* Query Interface always increases the reference count by one when it is successful */
    178178  FileMonikerImpl_AddRef(iface);
     
    211211        return 0;
    212212    }
    213     return This->ref;;
     213    return This->ref;
    214214}
    215215
     
    226226
    227227    *pClassID = CLSID_FileMoniker;
    228        
     228
    229229    return S_OK;
    230230}
     
    266266    if (bread!=sizeof(WORD) || wbuffer!=0)
    267267        return E_FAIL;
    268    
     268
    269269    /* read filePath string length (plus one) */
    270270    res=IStream_Read(pStm,&length,sizeof(DWORD),&bread);
     
    282282    if (bread != sizeof(DWORD) || dwbuffer != 0xDEADFFFF)
    283283        return E_FAIL;
    284        
     284
    285285    length--;
    286        
     286
    287287    for(i=0;i<10;i++){
    288288        res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread);
     
    290290            return E_FAIL;
    291291    }
    292    
     292
    293293    if (length>8)
    294294        length=0;
    295        
     295
    296296    doubleLenHex=doubleLenDec=2*length;
    297297    if (length > 5)
     
    304304    if (length==0)
    305305        return res;
    306        
     306
    307307    res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),&bread);
    308308    if (bread!=sizeof(DWORD) || dwbuffer!=doubleLenHex)
     
    325325
    326326    HeapFree(GetProcessHeap(),0,filePathA);
    327    
     327
    328328    return res;
    329329}
     
    336336                                    BOOL fClearDirty)/* Specifies whether to clear the dirty flag */
    337337{
    338     /* this function saves data of this object. In the beginning I thougth 
    339      * that I have just to write the filePath string on Stream. But, when I 
    340      * tested this function whith windows programs samples, I noticed that it 
    341      * was not the case. So I analysed data written by this function on 
    342      * Windows and what this did function exactly ! But I have no idea about 
     338    /* this function saves data of this object. In the beginning I thougth
     339     * that I have just to write the filePath string on Stream. But, when I
     340     * tested this function whith windows programs samples, I noticed that it
     341     * was not the case. So I analysed data written by this function on
     342     * Windows and what this did function exactly ! But I have no idea about
    343343     * its logic !
    344344     * I guessed data which must be written on stream is:
     
    348348     * 4) DWORD constant : 0xDEADFFFF
    349349     * 5) ten WORD constant: zero
    350      * 6) DWORD: double-length of the the path string type W ("\0" not 
     350     * 6) DWORD: double-length of the the path string type W ("\0" not
    351351     *    included)
    352352     * 7) WORD constant: 0x3
     
    355355     */
    356356
    357     ICOM_THIS(FileMonikerImpl,iface);       
     357    ICOM_THIS(FileMonikerImpl,iface);
    358358
    359359    HRESULT res;
     
    390390    /* write a DWORD set to 0xDEADFFFF: constant */
    391391    res=IStream_Write(pStm,&constant1,sizeof(DWORD),NULL);
    392        
     392
    393393    len--;
    394394    /* write 10 times a DWORD set to 0 : constants */
    395395    for(i=0;i<10;i++)
    396396        res=IStream_Write(pStm,&zero,sizeof(WORD),NULL);
    397        
     397
    398398    if (len>8)
    399399        len=0;
    400        
     400
    401401    doubleLenHex=doubleLenDec=2*len;
    402402    if (len > 5)
     
    437437
    438438    /* for more details see FileMonikerImpl_Save coments */
    439    
     439
    440440    sizeMAx =  sizeof(WORD) +           /* first WORD is 0 */
    441441               sizeof(DWORD)+           /* length of filePath including "\0" in the end of the string */
     
    447447    if (len==0 || len > 8)
    448448        return S_OK;
    449    
     449
    450450    sizeMAx += sizeof(DWORD)+           /* size of the unicode filePath: "\0" not included */
    451451               sizeof(WORD)+            /* constant : 0x3 */
    452452               len*sizeof(WCHAR);       /* unicde filePath string */
    453    
     453
    454454    pcbSize->s.LowPart=sizeMAx;
    455455    pcbSize->s.HighPart=0;
     
    469469    WCHAR bkSlash[]={'\\',0};
    470470    BYTE addBkSlash;
    471    
     471
    472472    TRACE("(%p,%p)\n",This,lpszPathName);
    473473
     
    514514
    515515        *This->filePathName=0;
    516    
     516
    517517        for(i=0;tabStr[i]!=NULL;i++)
    518518            strcatW(This->filePathName,tabStr[i]);
    519    
     519
    520520        if (addBkSlash)
    521521            strcatW(This->filePathName,bkSlash);
     
    560560    IClassFactory *pcf=0;
    561561    IClassActivator *pca=0;
    562    
    563     ICOM_THIS(FileMonikerImpl,iface);   
     562
     563    ICOM_THIS(FileMonikerImpl,iface);
    564564
    565565    *ppvResult=0;
     
    568568
    569569    if(pmkToLeft==NULL){
    570        
     570
    571571        res=IBindCtx_GetRunningObjectTable(pbc,&prot);
    572572
     
    600600
    601601            res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IClassActivator,(void**)&pca);
    602        
     602
    603603            if (res==E_NOINTERFACE)
    604604                return MK_E_INTERMEDIATEINTERFACENOTSUPPORTED;
     
    619619
    620620            FIXME("()\n");
    621            
     621
    622622            /*res=GetClassFile(This->filePathName,&clsID);
    623623
     
    655655    if (pcf!=NULL)
    656656        IClassFactory_Release(pcf);
    657    
     657
    658658    return res;
    659659}
     
    761761
    762762    *ppmkComposite=0;
    763    
     763
    764764    IMoniker_IsSystemMoniker(pmkRight,&mkSys);
    765765
     
    790790        /* the length of the composed path string  is raised by the sum of the two paths lengths  */
    791791        newStr=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(lstrlenW(str1)+lstrlenW(str2)+1));
    792        
     792
    793793          if (newStr==NULL)
    794794                return E_OUTOFMEMORY;
     
    800800        if ((strDec2[i]==NULL && lastIdx1>-1 && lastIdx2>-1) || lstrcmpW(strDec2[i],bkSlash)!=0)
    801801            strcatW(newStr,bkSlash);
    802            
     802
    803803        for(j=i;j<=lastIdx2;j++)
    804804            strcatW(newStr,strDec2[j]);
    805        
     805
    806806        /* create a new moniker with the new string */
    807807        res=CreateFileMoniker(newStr,ppmkComposite);
     
    879879
    880880    IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&filePath);
    881    
     881
    882882    if (lstrcmpiW(filePath,
    883883                  This->filePathName)!=0)
    884884
    885885        return S_FALSE;
    886    
     886
    887887    return S_OK;
    888888}
     
    901901    if (pdwHash==NULL)
    902902        return E_POINTER;
    903    
     903
    904904    val =  This->filePathName;
    905905    len = lstrlenW(val);
     
    985985        if (!GetFileAttributesExW(This->filePathName,GetFileExInfoStandard,&info))
    986986            return MK_E_NOOBJECT;
    987        
     987
    988988        *pFileTime=info.ftLastWriteTime;
    989989    }
     
    10201020    if (pmkOther==NULL)
    10211021        return E_INVALIDARG;
    1022    
     1022
    10231023    *ppmkPrefix=0;
    1024    
     1024
    10251025    /* check if we have the same type of moniker */
    10261026    IMoniker_IsSystemMoniker(pmkOther,&mkSys);
     
    10441044
    10451045        *commonPath=0;
    1046        
     1046
    10471047        for(sameIdx=0; ( (stringTable1[sameIdx]!=NULL) &&
    10481048                         (stringTable2[sameIdx]!=NULL) &&
     
    10631063        if (machimeNameCase && *stringTable1[sameIdx-1]=='\\')
    10641064            sameIdx--;
    1065        
     1065
    10661066        if (machimeNameCase && (sameIdx<=3) && (nb1 > 3 || nb2 > 3) )
    10671067            return MK_E_NOPREFIX;
     
    10691069        for(i=0;i<sameIdx;i++)
    10701070            strcatW(commonPath,stringTable1[i]);
    1071        
     1071
    10721072        for(i=0;i<nb1;i++)
    10731073            CoTaskMemFree(stringTable1[i]);
     
    10811081
    10821082        HeapFree(GetProcessHeap(),0,commonPath);
    1083        
     1083
    10841084        return CreateFileMoniker(commonPath,ppmkPrefix);
    10851085    }
     
    11011101
    11021102    strgtable =CoTaskMemAlloc(len*sizeof(LPOLESTR));
    1103    
     1103
    11041104    if (strgtable==NULL)
    11051105        return E_OUTOFMEMORY;
    1106    
     1106
    11071107    while(str[i]!=0){
    11081108
     
    11351135    }
    11361136    strgtable[tabIndex]=NULL;
    1137    
     1137
    11381138    *stringTable=strgtable;
    1139    
     1139
    11401140    return tabIndex;
    11411141}
     
    11511151    DWORD len1=0,len2=0,sameIdx=0,j=0;
    11521152    WCHAR back[] ={'.','.','\\',0};
    1153    
     1153
    11541154    TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath);
    11551155
     
    11591159    if (pmOther==NULL)
    11601160        return E_INVALIDARG;
    1161    
     1161
    11621162    res=CreateBindCtx(0,&bind);
    11631163    if (FAILED(res))
     
    11761176    if (FAILED(len1) || FAILED(len2))
    11771177        return E_OUTOFMEMORY;
    1178        
     1178
    11791179    /* count the number of similar items from the begin of the two paths */
    11801180    for(sameIdx=0; ( (tabStr1[sameIdx]!=NULL) &&
     
    11971197    for(j=sameIdx;tabStr2[j]!=NULL;j++)
    11981198        strcatW(relPath,tabStr2[j]);
    1199    
     1199
    12001200    res=CreateFileMoniker(relPath,ppmkRelPath);
    1201    
     1201
    12021202    for(j=0; tabStr1[j]!=NULL;j++)
    12031203        CoTaskMemFree(tabStr1[j]);
     
    12411241
    12421242    strcpyW(*ppszDisplayName,This->filePathName);
    1243    
     1243
    12441244    return S_OK;
    12451245}
     
    12681268    if (!pwdMksys)
    12691269        return E_POINTER;
    1270    
     1270
    12711271    (*pwdMksys)=MKSYS_FILEMONIKER;
    12721272
     
    13051305{
    13061306    ICOM_THIS_From_IROTData(IMoniker, iface);
    1307    
     1307
    13081308    TRACE("(%p)\n",This);
    13091309
     
    13491349    if(lpszPathName==NULL)
    13501350        return MK_E_SYNTAX;
    1351            
     1351
    13521352    *ppmk=0;
    1353        
     1353
    13541354    newFileMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(FileMonikerImpl));
    13551355
Note: See TracChangeset for help on using the changeset viewer.