Changeset 4258


Ignore:
Timestamp:
Sep 14, 2000, 4:57:01 PM (25 years ago)
Author:
davidr
Message:

BugFixes & Updates (CorelWine)

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:42 davidr Exp $ */
     1/* $Id: antimoniker.cpp,v 1.3 2000-09-14 14:57:00 davidr Exp $ */
    22/*
    33 * AntiMonikers functions.
    44 *
    5  * 20/9/99
    6  *
    7  * Copyright 1999 David J. Raison
     5 * Copyright 1999, 2000 David J. Raison
    86 *
    97 * Direct port of Wine Implementation
    108 *   Copyright 1999  Noomen Hamza
     9 *
     10 * Updates.
     11 *   14/09/2000 Updated from CorelWine
     12 *
    1113 */
    1214
     
    1416#include "debugtools.h"
    1517
    16 DEFAULT_DEBUG_CHANNEL(ole)
     18DEFAULT_DEBUG_CHANNEL(moniker)
    1719
    1820/* AntiMoniker data structure */
     
    196198HRESULT WINAPI AntiMonikerImpl_GetClassID(IMoniker* iface,CLSID *pClassID)
    197199{
    198     TRACE("(%p,%p),stub!\n",iface,pClassID);
     200    TRACE("(iface:%p ClassID:%p [CLSID_AntiMoniker])\n",iface,pClassID);
    199201
    200202    if (pClassID==NULL)
     
    252254
    253255/******************************************************************************
     256 *        AntiMonikerImpl_GetSizeToSave
     257 ******************************************************************************/
     258HRESULT 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/******************************************************************************
    254270 *        AntiMoniker_GetSizeMax
    255271 ******************************************************************************/
     
    259275    TRACE("(%p,%p)\n",iface,pcbSize);
    260276
    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
    274288
    275289/******************************************************************************
     
    434448
    435449    if (FAILED(res))
    436     return res;
     450        return res;
    437451
    438452    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 sandervl Exp $ */
     1/* $Id: bindctx.cpp,v 1.4 2000-09-14 14:57:00 davidr Exp $ */
    22/*
    33 * BindCtx implementation
     
    300300HRESULT WINAPI BindCtxImpl_SetBindOptions(IBindCtx* iface,LPBIND_OPTS2 pbindopts)
    301301{
     302    DWORD size = sizeof(BIND_OPTS2);
     303
    302304    ICOM_THIS(BindCtxImpl,iface);
    303305
     
    306308    if (pbindopts==NULL)
    307309        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);
    315316
    316317    return S_OK;
     
    322323HRESULT WINAPI BindCtxImpl_GetBindOptions(IBindCtx* iface,LPBIND_OPTS2 pbindopts)
    323324{
     325    DWORD size = sizeof(BIND_OPTS2);
     326
    324327    ICOM_THIS(BindCtxImpl,iface);
    325328
     
    329332        return E_POINTER;
    330333
    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);
    337339   
    338340    return S_OK;
  • TabularUnified trunk/src/ole32/compositemoniker.cpp

    r1033 r4258  
    1 /* $Id: compositemoniker.cpp,v 1.1 1999-09-24 21:49:42 davidr Exp $ */
     1/* $Id: compositemoniker.cpp,v 1.2 2000-09-14 14:57:01 davidr Exp $ */
    22/*
    33 * CompositeMonikers functions.
     
    1414#include "debugtools.h"
    1515
    16 DEFAULT_DEBUG_CHANNEL(ole)
     16DEFAULT_DEBUG_CHANNEL(moniker)
    1717
    1818#define  BLOCK_TAB_SIZE 5 /* represent the first size table and it's increment block size */
     
    4242typedef struct EnumMonikerImpl{
    4343
    44     ICOM_VTABLE(IEnumMoniker)*  lpvtbl;  /* VTable relative to the IEnumMoniker interface.*/
     44    ICOM_VFIELD(IEnumMoniker);  /* VTable relative to the IEnumMoniker interface.*/
    4545
    4646    ULONG ref; /* reference counter for this object */
     
    285285HRESULT WINAPI CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm)
    286286{
    287     HRESULT res;
    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;
    291291   
    292292    ICOM_THIS(CompositeMonikerImpl,iface);   
     
    296296    /* this function call OleLoadFromStream function for each moniker within this object */
    297297
    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    {
    305303#if 0
    306304        res=OleLoadFromStream(pStm,&IID_IMoniker,(void**)&This->tabMoniker[This->tabLastIndex]);
    307305#endif
    308306        res=ReadClassStm(pStm,&clsid);
    309         printf("res=%ld",res);
     307
    310308        if (FAILED(res))
    311             break;
    312 
    313         if (IsEqualIID(&clsid,&CLSID_FileMoniker)){
     309            return res;
     310
     311        if (IsEqualIID(&clsid,&CLSID_FileMoniker))
     312        {
    314313            res=CreateFileMoniker(string,&This->tabMoniker[This->tabLastIndex]);
    315314            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]);
    318320            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        {
    330325            CreateAntiMoniker(&This->tabMoniker[This->tabLastIndex]);
    331326            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
    338330            return E_FAIL;
    339331
    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;
    345335
    346336        /* resize the table if needed */
    347         if (++This->tabLastIndex==This->tabSize){
     337        if (This->tabLastIndex==This->tabSize){
    348338               
    349339            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));
    351342
    352343            if (This->tabMoniker==NULL)
    353             return E_OUTOFMEMORY;
     344                return E_OUTOFMEMORY;
    354345        }
    355346    }
     
    366357    IEnumMoniker *enumMk;
    367358    IMoniker *pmk;
    368     DWORD constant=3;
     359
     360    ICOM_THIS(CompositeMonikerImpl,iface);
    369361   
    370362    TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty);
     
    372364    /* this function call OleSaveToStream function for each moniker within this object */
    373365
    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);
    377368
    378369    IMoniker_Enum(iface,TRUE,&enumMk);
     
    410401    TRACE("(%p,%p)\n",iface,pcbSize);
    411402
    412     if (pcbSize!=NULL)
     403    if (pcbSize==NULL)
    413404        return E_POINTER;
    414405
    415     pcbSize->LowPart =0;
     406    pcbSize->LowPart =sizeof(DWORD) + 48;
    416407    pcbSize->HighPart=0;
    417408
     
    424415        IMoniker_Release(pmk);
    425416
    426         pcbSize->LowPart +=ptmpSize.LowPart;
     417        pcbSize->LowPart +=ptmpSize.LowPart;    // FIXME - 64bit Math
    427418        pcbSize->HighPart+=ptmpSize.HighPart;
    428419    }
     
    432423    return S_OK;
    433424}
     425
     426#if 0
     427/******************************************************************************
     428 *         CompositeMonikerImpl_GetSizeToSave (Local)
     429 *******************************************************************************/
     430HRESULT 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
    434459
    435460/******************************************************************************
     
    15091534{
    15101535    ICOM_THIS(EnumMonikerImpl,iface);
    1511     ULONG i
    1512         ;
    1513     TRACE("(%p)\n",This);
     1536
     1537    ULONG i;
    15141538
    15151539    This->ref--;
     
    16101634   
    16111635    /* Initialize the virtual function table. */
    1612     newEnumMoniker->lpvtbl      = &VT_EnumMonikerImpl;
    1613     newEnumMoniker->ref          = 0;
    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));
    16191643
    16201644    if (newEnumMoniker->tabMoniker==NULL)
Note: See TracChangeset for help on using the changeset viewer.