Changeset 4258
- Timestamp:
- Sep 14, 2000, 4:57:01 PM (25 years ago)
- Location:
- trunk/src/ole32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/ole32/antimoniker.cpp ¶
r1033 r4258 1 /* $Id: antimoniker.cpp,v 1. 2 1999-09-24 21:49:42davidr Exp $ */1 /* $Id: antimoniker.cpp,v 1.3 2000-09-14 14:57:00 davidr Exp $ */ 2 2 /* 3 3 * AntiMonikers functions. 4 4 * 5 * 20/9/99 6 * 7 * Copyright 1999 David J. Raison 5 * Copyright 1999, 2000 David J. Raison 8 6 * 9 7 * Direct port of Wine Implementation 10 8 * Copyright 1999 Noomen Hamza 9 * 10 * Updates. 11 * 14/09/2000 Updated from CorelWine 12 * 11 13 */ 12 14 … … 14 16 #include "debugtools.h" 15 17 16 DEFAULT_DEBUG_CHANNEL( ole)18 DEFAULT_DEBUG_CHANNEL(moniker) 17 19 18 20 /* AntiMoniker data structure */ … … 196 198 HRESULT WINAPI AntiMonikerImpl_GetClassID(IMoniker* iface,CLSID *pClassID) 197 199 { 198 TRACE("( %p,%p),stub!\n",iface,pClassID);200 TRACE("(iface:%p ClassID:%p [CLSID_AntiMoniker])\n",iface,pClassID); 199 201 200 202 if (pClassID==NULL) … … 252 254 253 255 /****************************************************************************** 256 * AntiMonikerImpl_GetSizeToSave 257 ******************************************************************************/ 258 HRESULT AntiMonikerImpl_GetSizeToSave(IMoniker* iface,ULARGE_INTEGER* pcbSize) 259 { 260 if (pcbSize==NULL) 261 return E_POINTER; 262 263 pcbSize->LowPart = sizeof(DWORD); 264 pcbSize->HighPart = 0; 265 266 return S_OK; 267 } 268 269 /****************************************************************************** 254 270 * AntiMoniker_GetSizeMax 255 271 ******************************************************************************/ … … 259 275 TRACE("(%p,%p)\n",iface,pcbSize); 260 276 261 if (pcbSize!=NULL) 262 return E_POINTER; 263 264 /* for more details see AntiMonikerImpl_Save coments */ 265 266 /* Normaly the sizemax must be the size of DWORD ! but I tested this function it ususlly return 16 bytes */ 267 /* more than the number of bytes used by AntiMoniker::Save function */ 268 pcbSize->LowPart = sizeof(DWORD)+16; 269 270 pcbSize->HighPart=0; 271 272 return S_OK; 273 } 277 if (pcbSize == NULL) 278 return E_POINTER; 279 280 /* GetSizeMax = SizeToSave + 16 */ 281 AntiMonikerImpl_GetSizeToSave(iface,pcbSize); 282 pcbSize->LowPart += 16; //FIXME - 64bit math 283 // pcbSize->HighPart = 0; 284 285 return S_OK; 286 } 287 274 288 275 289 /****************************************************************************** … … 434 448 435 449 if (FAILED(res)) 436 450 return res; 437 451 438 452 res = IRunningObjectTable_IsRunning(rot,iface); -
TabularUnified trunk/src/ole32/bindctx.cpp ¶
r3497 r4258 1 /* $Id: bindctx.cpp,v 1. 3 2000-05-05 18:21:36 sandervlExp $ */1 /* $Id: bindctx.cpp,v 1.4 2000-09-14 14:57:00 davidr Exp $ */ 2 2 /* 3 3 * BindCtx implementation … … 300 300 HRESULT WINAPI BindCtxImpl_SetBindOptions(IBindCtx* iface,LPBIND_OPTS2 pbindopts) 301 301 { 302 DWORD size = sizeof(BIND_OPTS2); 303 302 304 ICOM_THIS(BindCtxImpl,iface); 303 305 … … 306 308 if (pbindopts==NULL) 307 309 return E_POINTER; 308 309 if (pbindopts->cbStruct > sizeof(BIND_OPTS2)) 310 { 311 WARN("invalid size"); 312 return E_INVALIDARG; /* FIXME : not verified */ 313 } 314 memcpy(&This->bindOption2, pbindopts, pbindopts->cbStruct); 310 311 /* make sure we don't copy more bytes than we can */ 312 if (pbindopts->cbStruct < size) 313 size = pbindopts->cbStruct; 314 315 memcpy(&This->bindOption2, pbindopts, size); 315 316 316 317 return S_OK; … … 322 323 HRESULT WINAPI BindCtxImpl_GetBindOptions(IBindCtx* iface,LPBIND_OPTS2 pbindopts) 323 324 { 325 DWORD size = sizeof(BIND_OPTS2); 326 324 327 ICOM_THIS(BindCtxImpl,iface); 325 328 … … 329 332 return E_POINTER; 330 333 331 if (pbindopts->cbStruct > sizeof(BIND_OPTS2)) 332 { 333 WARN("invalid size"); 334 return E_INVALIDARG; /* FIXME : not verified */ 335 } 336 memcpy(pbindopts, &This->bindOption2, pbindopts->cbStruct); 334 /* make sure we don't copy more bytes than we can */ 335 if (pbindopts->cbStruct < size) 336 size = pbindopts->cbStruct; 337 338 memcpy(pbindopts, &This->bindOption2, size); 337 339 338 340 return S_OK; -
TabularUnified 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.