Changeset 4258 for trunk/src/ole32/compositemoniker.cpp
- Timestamp:
- Sep 14, 2000, 4:57:01 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ole32/compositemoniker.cpp
r1033 r4258 1 /* $Id: compositemoniker.cpp,v 1. 1 1999-09-24 21:49:42davidr Exp $ */1 /* $Id: compositemoniker.cpp,v 1.2 2000-09-14 14:57:01 davidr Exp $ */ 2 2 /* 3 3 * CompositeMonikers functions. … … 14 14 #include "debugtools.h" 15 15 16 DEFAULT_DEBUG_CHANNEL( ole)16 DEFAULT_DEBUG_CHANNEL(moniker) 17 17 18 18 #define BLOCK_TAB_SIZE 5 /* represent the first size table and it's increment block size */ … … 42 42 typedef struct EnumMonikerImpl{ 43 43 44 ICOM_V TABLE(IEnumMoniker)* lpvtbl; /* VTable relative to the IEnumMoniker interface.*/44 ICOM_VFIELD(IEnumMoniker); /* VTable relative to the IEnumMoniker interface.*/ 45 45 46 46 ULONG ref; /* reference counter for this object */ … … 285 285 HRESULT WINAPI CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm) 286 286 { 287 HRESULT 288 DWORD constant;289 CLSID clsid;290 WCHAR string[1]={0};287 HRESULT res; 288 CLSID clsid; 289 WCHAR string[1]={0}; 290 ULONG countMoniker; 291 291 292 292 ICOM_THIS(CompositeMonikerImpl,iface); … … 296 296 /* this function call OleLoadFromStream function for each moniker within this object */ 297 297 298 /* read the a constant writen by CompositeMonikerImpl_Save (see CompositeMonikerImpl_Save for more details)*/ 299 res=IStream_Read(pStm,&constant,sizeof(DWORD),NULL); 300 301 if (SUCCEEDED(res)&& constant!=3) 302 return E_FAIL; 303 304 while(1){ 298 /* read the number of monikers within the composite moniker*/ 299 res=IStream_Read(pStm,&countMoniker,sizeof(countMoniker),NULL); 300 301 for(This->tabLastIndex=0; This->tabLastIndex < countMoniker; This->tabLastIndex++) 302 { 305 303 #if 0 306 304 res=OleLoadFromStream(pStm,&IID_IMoniker,(void**)&This->tabMoniker[This->tabLastIndex]); 307 305 #endif 308 306 res=ReadClassStm(pStm,&clsid); 309 printf("res=%ld",res); 307 310 308 if (FAILED(res)) 311 break; 312 313 if (IsEqualIID(&clsid,&CLSID_FileMoniker)){ 309 return res; 310 311 if (IsEqualIID(&clsid,&CLSID_FileMoniker)) 312 { 314 313 res=CreateFileMoniker(string,&This->tabMoniker[This->tabLastIndex]); 315 314 if (FAILED(res)) 316 break; 317 res=IMoniker_Load(This->tabMoniker[This->tabLastIndex],pStm); 315 return res; 316 } 317 else if (IsEqualIID(&clsid,&CLSID_ItemMoniker)) 318 { 319 CreateItemMoniker(string,string,&This->tabMoniker[This->tabLastIndex]); 318 320 if (FAILED(res)) 319 break; 320 } 321 else if (IsEqualIID(&clsid,&CLSID_ItemMoniker)){ 322 CreateItemMoniker(string,string,&This->tabMoniker[This->tabLastIndex]); 323 if (res!=S_OK) 324 break; 325 IMoniker_Load(This->tabMoniker[This->tabLastIndex],pStm); 326 if (FAILED(res)) 327 break; 328 } 329 else if (IsEqualIID(&clsid,&CLSID_AntiMoniker)){ 321 return res; 322 } 323 else if (IsEqualIID(&clsid,&CLSID_AntiMoniker)) 324 { 330 325 CreateAntiMoniker(&This->tabMoniker[This->tabLastIndex]); 331 326 if (FAILED(res)) 332 break; 333 IMoniker_Load(This->tabMoniker[This->tabLastIndex],pStm); 334 if (FAILED(res)) 335 break; 336 } 337 else if (IsEqualIID(&clsid,&CLSID_CompositeMoniker)) 327 return res; 328 } 329 else 338 330 return E_FAIL; 339 331 340 else{ 341 FIXME("()"); 342 break; 343 return E_NOTIMPL; 344 } 332 res=IMoniker_Load(This->tabMoniker[This->tabLastIndex],pStm); 333 if (FAILED(res)) 334 return res; 345 335 346 336 /* resize the table if needed */ 347 if ( ++This->tabLastIndex==This->tabSize){337 if (This->tabLastIndex==This->tabSize){ 348 338 349 339 This->tabSize+=BLOCK_TAB_SIZE; 350 This->tabMoniker=(IMoniker**)HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); 340 This->tabMoniker=(IMoniker**)HeapReAlloc( 341 GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); 351 342 352 343 if (This->tabMoniker==NULL) 353 344 return E_OUTOFMEMORY; 354 345 } 355 346 } … … 366 357 IEnumMoniker *enumMk; 367 358 IMoniker *pmk; 368 DWORD constant=3; 359 360 ICOM_THIS(CompositeMonikerImpl,iface); 369 361 370 362 TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty); … … 372 364 /* this function call OleSaveToStream function for each moniker within this object */ 373 365 374 /* when I tested this function in windows system ! I usually found this constant in the begining of */ 375 /* the stream I dont known why (there's no indication in specification) ! */ 376 res=IStream_Write(pStm,&constant,sizeof(constant),NULL); 366 /* write the number of monikers within the composite moniker*/ 367 res=IStream_Write(pStm,&(This->tabLastIndex),sizeof(This->tabLastIndex),NULL); 377 368 378 369 IMoniker_Enum(iface,TRUE,&enumMk); … … 410 401 TRACE("(%p,%p)\n",iface,pcbSize); 411 402 412 if (pcbSize !=NULL)403 if (pcbSize==NULL) 413 404 return E_POINTER; 414 405 415 pcbSize->LowPart = 0;406 pcbSize->LowPart =sizeof(DWORD) + 48; 416 407 pcbSize->HighPart=0; 417 408 … … 424 415 IMoniker_Release(pmk); 425 416 426 pcbSize->LowPart +=ptmpSize.LowPart; 417 pcbSize->LowPart +=ptmpSize.LowPart; // FIXME - 64bit Math 427 418 pcbSize->HighPart+=ptmpSize.HighPart; 428 419 } … … 432 423 return S_OK; 433 424 } 425 426 #if 0 427 /****************************************************************************** 428 * CompositeMonikerImpl_GetSizeToSave (Local) 429 *******************************************************************************/ 430 HRESULT CompositeMonikerImpl_GetSizeToSave(IMoniker* iface,ULARGE_INTEGER* pcbSize) 431 { 432 IEnumMoniker *enumMk; 433 IMoniker *pmk; 434 HRESULT hRes; 435 ULARGE_INTEGER ptmpSize; 436 437 if (pcbSize==NULL) 438 return E_POINTER; 439 440 pcbSize->LowPart = sizeof(DWORD); 441 pcbSize->HighPart=0; 442 443 IMoniker_Enum(iface,TRUE,&enumMk); 444 445 while((hRes = IEnumMoniker_Next(enumMk,1,&pmk,NULL))==S_OK){ 446 447 GetSizeToSaveMoniker(pmk,&ptmpSize); 448 IMoniker_Release(pmk); 449 450 pcbSize->LowPart +=ptmpSize.LowPart; // FIXME - 64bit math 451 pcbSize->HighPart+=ptmpSize.HighPart; 452 } 453 IEnumMoniker_Release(enumMk); 454 455 return S_OK; 456 } 457 #endif 458 434 459 435 460 /****************************************************************************** … … 1509 1534 { 1510 1535 ICOM_THIS(EnumMonikerImpl,iface); 1511 ULONG i 1512 ; 1513 TRACE("(%p)\n",This); 1536 1537 ULONG i; 1514 1538 1515 1539 This->ref--; … … 1610 1634 1611 1635 /* Initialize the virtual function table. */ 1612 newEnumMoniker->lpvtbl= &VT_EnumMonikerImpl;1613 newEnumMoniker->ref 1614 1615 newEnumMoniker->tabSize =tabSize;1616 newEnumMoniker->currentPos =currentPos;1617 1618 newEnumMoniker->tabMoniker =(IMoniker**)HeapAlloc(GetProcessHeap(),0,tabSize*sizeof(IMoniker));1636 ICOM_VTBL(newEnumMoniker) = &VT_EnumMonikerImpl; 1637 newEnumMoniker->ref = 0; 1638 1639 newEnumMoniker->tabSize = tabSize; 1640 newEnumMoniker->currentPos = currentPos; 1641 1642 newEnumMoniker->tabMoniker =(IMoniker**)HeapAlloc(GetProcessHeap(),0,tabSize*sizeof(IMoniker)); 1619 1643 1620 1644 if (newEnumMoniker->tabMoniker==NULL)
Note:
See TracChangeset
for help on using the changeset viewer.