Changeset 8620 for trunk/src/ole32/filemoniker.c
- Timestamp:
- Jun 9, 2002, 6:37:22 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ole32/filemoniker.c
r8441 r8620 40 40 ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/ 41 41 42 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 42 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 43 43 * two monikers are equal. That's whay IROTData interface is implemented by monikers. 44 44 */ … … 150 150 { 151 151 ICOM_THIS(FileMonikerImpl,iface); 152 152 153 153 TRACE("(%p,%p,%p)\n",This,riid,ppvObject); 154 154 … … 156 156 if ( (This==0) || (ppvObject==0) ) 157 157 return E_INVALIDARG; 158 158 159 159 /* Initialize the return parameter */ 160 160 *ppvObject = 0; … … 167 167 ) 168 168 *ppvObject = iface; 169 169 170 170 else if (IsEqualIID(&IID_IROTData, riid)) 171 171 *ppvObject = (IROTData*)&(This->lpvtbl2); … … 174 174 if ((*ppvObject)==0) 175 175 return E_NOINTERFACE; 176 176 177 177 /* Query Interface always increases the reference count by one when it is successful */ 178 178 FileMonikerImpl_AddRef(iface); … … 211 211 return 0; 212 212 } 213 return This->ref; ;213 return This->ref; 214 214 } 215 215 … … 226 226 227 227 *pClassID = CLSID_FileMoniker; 228 228 229 229 return S_OK; 230 230 } … … 266 266 if (bread!=sizeof(WORD) || wbuffer!=0) 267 267 return E_FAIL; 268 268 269 269 /* read filePath string length (plus one) */ 270 270 res=IStream_Read(pStm,&length,sizeof(DWORD),&bread); … … 282 282 if (bread != sizeof(DWORD) || dwbuffer != 0xDEADFFFF) 283 283 return E_FAIL; 284 284 285 285 length--; 286 286 287 287 for(i=0;i<10;i++){ 288 288 res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread); … … 290 290 return E_FAIL; 291 291 } 292 292 293 293 if (length>8) 294 294 length=0; 295 295 296 296 doubleLenHex=doubleLenDec=2*length; 297 297 if (length > 5) … … 304 304 if (length==0) 305 305 return res; 306 306 307 307 res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),&bread); 308 308 if (bread!=sizeof(DWORD) || dwbuffer!=doubleLenHex) … … 325 325 326 326 HeapFree(GetProcessHeap(),0,filePathA); 327 327 328 328 return res; 329 329 } … … 336 336 BOOL fClearDirty)/* Specifies whether to clear the dirty flag */ 337 337 { 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 343 343 * its logic ! 344 344 * I guessed data which must be written on stream is: … … 348 348 * 4) DWORD constant : 0xDEADFFFF 349 349 * 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 351 351 * included) 352 352 * 7) WORD constant: 0x3 … … 355 355 */ 356 356 357 ICOM_THIS(FileMonikerImpl,iface); 357 ICOM_THIS(FileMonikerImpl,iface); 358 358 359 359 HRESULT res; … … 390 390 /* write a DWORD set to 0xDEADFFFF: constant */ 391 391 res=IStream_Write(pStm,&constant1,sizeof(DWORD),NULL); 392 392 393 393 len--; 394 394 /* write 10 times a DWORD set to 0 : constants */ 395 395 for(i=0;i<10;i++) 396 396 res=IStream_Write(pStm,&zero,sizeof(WORD),NULL); 397 397 398 398 if (len>8) 399 399 len=0; 400 400 401 401 doubleLenHex=doubleLenDec=2*len; 402 402 if (len > 5) … … 437 437 438 438 /* for more details see FileMonikerImpl_Save coments */ 439 439 440 440 sizeMAx = sizeof(WORD) + /* first WORD is 0 */ 441 441 sizeof(DWORD)+ /* length of filePath including "\0" in the end of the string */ … … 447 447 if (len==0 || len > 8) 448 448 return S_OK; 449 449 450 450 sizeMAx += sizeof(DWORD)+ /* size of the unicode filePath: "\0" not included */ 451 451 sizeof(WORD)+ /* constant : 0x3 */ 452 452 len*sizeof(WCHAR); /* unicde filePath string */ 453 453 454 454 pcbSize->s.LowPart=sizeMAx; 455 455 pcbSize->s.HighPart=0; … … 469 469 WCHAR bkSlash[]={'\\',0}; 470 470 BYTE addBkSlash; 471 471 472 472 TRACE("(%p,%p)\n",This,lpszPathName); 473 473 … … 514 514 515 515 *This->filePathName=0; 516 516 517 517 for(i=0;tabStr[i]!=NULL;i++) 518 518 strcatW(This->filePathName,tabStr[i]); 519 519 520 520 if (addBkSlash) 521 521 strcatW(This->filePathName,bkSlash); … … 560 560 IClassFactory *pcf=0; 561 561 IClassActivator *pca=0; 562 563 ICOM_THIS(FileMonikerImpl,iface); 562 563 ICOM_THIS(FileMonikerImpl,iface); 564 564 565 565 *ppvResult=0; … … 568 568 569 569 if(pmkToLeft==NULL){ 570 570 571 571 res=IBindCtx_GetRunningObjectTable(pbc,&prot); 572 572 … … 600 600 601 601 res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IClassActivator,(void**)&pca); 602 602 603 603 if (res==E_NOINTERFACE) 604 604 return MK_E_INTERMEDIATEINTERFACENOTSUPPORTED; … … 619 619 620 620 FIXME("()\n"); 621 621 622 622 /*res=GetClassFile(This->filePathName,&clsID); 623 623 … … 655 655 if (pcf!=NULL) 656 656 IClassFactory_Release(pcf); 657 657 658 658 return res; 659 659 } … … 761 761 762 762 *ppmkComposite=0; 763 763 764 764 IMoniker_IsSystemMoniker(pmkRight,&mkSys); 765 765 … … 790 790 /* the length of the composed path string is raised by the sum of the two paths lengths */ 791 791 newStr=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(lstrlenW(str1)+lstrlenW(str2)+1)); 792 792 793 793 if (newStr==NULL) 794 794 return E_OUTOFMEMORY; … … 800 800 if ((strDec2[i]==NULL && lastIdx1>-1 && lastIdx2>-1) || lstrcmpW(strDec2[i],bkSlash)!=0) 801 801 strcatW(newStr,bkSlash); 802 802 803 803 for(j=i;j<=lastIdx2;j++) 804 804 strcatW(newStr,strDec2[j]); 805 805 806 806 /* create a new moniker with the new string */ 807 807 res=CreateFileMoniker(newStr,ppmkComposite); … … 879 879 880 880 IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&filePath); 881 881 882 882 if (lstrcmpiW(filePath, 883 883 This->filePathName)!=0) 884 884 885 885 return S_FALSE; 886 886 887 887 return S_OK; 888 888 } … … 901 901 if (pdwHash==NULL) 902 902 return E_POINTER; 903 903 904 904 val = This->filePathName; 905 905 len = lstrlenW(val); … … 985 985 if (!GetFileAttributesExW(This->filePathName,GetFileExInfoStandard,&info)) 986 986 return MK_E_NOOBJECT; 987 987 988 988 *pFileTime=info.ftLastWriteTime; 989 989 } … … 1020 1020 if (pmkOther==NULL) 1021 1021 return E_INVALIDARG; 1022 1022 1023 1023 *ppmkPrefix=0; 1024 1024 1025 1025 /* check if we have the same type of moniker */ 1026 1026 IMoniker_IsSystemMoniker(pmkOther,&mkSys); … … 1044 1044 1045 1045 *commonPath=0; 1046 1046 1047 1047 for(sameIdx=0; ( (stringTable1[sameIdx]!=NULL) && 1048 1048 (stringTable2[sameIdx]!=NULL) && … … 1063 1063 if (machimeNameCase && *stringTable1[sameIdx-1]=='\\') 1064 1064 sameIdx--; 1065 1065 1066 1066 if (machimeNameCase && (sameIdx<=3) && (nb1 > 3 || nb2 > 3) ) 1067 1067 return MK_E_NOPREFIX; … … 1069 1069 for(i=0;i<sameIdx;i++) 1070 1070 strcatW(commonPath,stringTable1[i]); 1071 1071 1072 1072 for(i=0;i<nb1;i++) 1073 1073 CoTaskMemFree(stringTable1[i]); … … 1081 1081 1082 1082 HeapFree(GetProcessHeap(),0,commonPath); 1083 1083 1084 1084 return CreateFileMoniker(commonPath,ppmkPrefix); 1085 1085 } … … 1101 1101 1102 1102 strgtable =CoTaskMemAlloc(len*sizeof(LPOLESTR)); 1103 1103 1104 1104 if (strgtable==NULL) 1105 1105 return E_OUTOFMEMORY; 1106 1106 1107 1107 while(str[i]!=0){ 1108 1108 … … 1135 1135 } 1136 1136 strgtable[tabIndex]=NULL; 1137 1137 1138 1138 *stringTable=strgtable; 1139 1139 1140 1140 return tabIndex; 1141 1141 } … … 1151 1151 DWORD len1=0,len2=0,sameIdx=0,j=0; 1152 1152 WCHAR back[] ={'.','.','\\',0}; 1153 1153 1154 1154 TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath); 1155 1155 … … 1159 1159 if (pmOther==NULL) 1160 1160 return E_INVALIDARG; 1161 1161 1162 1162 res=CreateBindCtx(0,&bind); 1163 1163 if (FAILED(res)) … … 1176 1176 if (FAILED(len1) || FAILED(len2)) 1177 1177 return E_OUTOFMEMORY; 1178 1178 1179 1179 /* count the number of similar items from the begin of the two paths */ 1180 1180 for(sameIdx=0; ( (tabStr1[sameIdx]!=NULL) && … … 1197 1197 for(j=sameIdx;tabStr2[j]!=NULL;j++) 1198 1198 strcatW(relPath,tabStr2[j]); 1199 1199 1200 1200 res=CreateFileMoniker(relPath,ppmkRelPath); 1201 1201 1202 1202 for(j=0; tabStr1[j]!=NULL;j++) 1203 1203 CoTaskMemFree(tabStr1[j]); … … 1241 1241 1242 1242 strcpyW(*ppszDisplayName,This->filePathName); 1243 1243 1244 1244 return S_OK; 1245 1245 } … … 1268 1268 if (!pwdMksys) 1269 1269 return E_POINTER; 1270 1270 1271 1271 (*pwdMksys)=MKSYS_FILEMONIKER; 1272 1272 … … 1305 1305 { 1306 1306 ICOM_THIS_From_IROTData(IMoniker, iface); 1307 1307 1308 1308 TRACE("(%p)\n",This); 1309 1309 … … 1349 1349 if(lpszPathName==NULL) 1350 1350 return MK_E_SYNTAX; 1351 1351 1352 1352 *ppmk=0; 1353 1353 1354 1354 newFileMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(FileMonikerImpl)); 1355 1355
Note:
See TracChangeset
for help on using the changeset viewer.