Changeset 6648 for trunk/src/ole32


Ignore:
Timestamp:
Sep 5, 2001, 3:19:02 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

Location:
trunk/src/ole32
Files:
24 edited

Legend:

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

    r5602 r6648  
     1/* $Id: antimoniker.c,v 1.2 2001-09-05 13:17:07 bird Exp $ */
    12/***************************************************************************************
    2  *                            AntiMonikers implementation
     3 *                        AntiMonikers implementation
    34 *
    45 *               Copyright 1999  Noomen Hamza
     
    2223    ICOM_VTABLE(IMoniker)*  lpvtbl1;  /* VTable relative to the IMoniker interface.*/
    2324
    24     /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 
     25    /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether
    2526     * two monikers are equal. That's whay IROTData interface is implemented by monikers.
    2627     */
     
    128129{
    129130    ICOM_THIS(AntiMonikerImpl,iface);
    130  
     131
    131132  TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
    132133
    133134  /* Perform a sanity check on the parameters.*/
    134135    if ( (This==0) || (ppvObject==0) )
    135         return E_INVALIDARG;
    136  
     136    return E_INVALIDARG;
     137
    137138  /* Initialize the return parameter */
    138139  *ppvObject = 0;
     
    151152    if ((*ppvObject)==0)
    152153        return E_NOINTERFACE;
    153  
     154
    154155   /* Query Interface always increases the reference count by one when it is successful */
    155156  AntiMonikerImpl_AddRef(iface);
     
    200201    if (pClassID==NULL)
    201202        return E_POINTER;
    202            
     203
    203204    *pClassID = CLSID_AntiMoniker;
    204        
     205
    205206    return S_OK;
    206207}
     
    244245    DWORD constant=1;
    245246    HRESULT res;
    246    
     247
    247248    /* data writen by this function is only a DWORD constant seted to 1 ! */
    248249    res=IStream_Write(pStm,&constant,sizeof(constant),NULL);
     
    263264
    264265    /* for more details see AntiMonikerImpl_Save coments */
    265    
     266
    266267    /* Normaly the sizemax must be the  size of DWORD ! but I tested this function it ususlly return 16 bytes */
    267268    /* more than the number of bytes used by AntiMoniker::Save function */
     
    342343
    343344    *ppmkReduced=iface;
    344    
     345
    345346    return MK_S_REDUCED_TO_SELF;
    346347}
     
    357358
    358359    if ((ppmkComposite==NULL)||(pmkRight==NULL))
    359         return E_POINTER;
     360    return E_POINTER;
    360361
    361362    *ppmkComposite=0;
    362    
     363
    363364    if (fOnlyIfNotGeneric)
    364365        return MK_E_NEEDGENERIC;
     
    376377    if (ppenumMoniker == NULL)
    377378        return E_POINTER;
    378    
     379
    379380    *ppenumMoniker = NULL;
    380381
     
    388389{
    389390    DWORD mkSys;
    390    
     391
    391392    TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
    392393
    393394    if (pmkOtherMoniker==NULL)
    394395        return S_FALSE;
    395    
     396
    396397    IMoniker_IsSystemMoniker(pmkOtherMoniker,&mkSys);
    397398
     
    476477{
    477478    DWORD mkSys;
    478    
     479
    479480    IMoniker_IsSystemMoniker(pmkOther,&mkSys);
    480481
     
    486487
    487488        IMoniker_AddRef(iface);
    488        
     489
    489490        return MK_S_US;
    490491    }
     
    519520{
    520521    WCHAR back[]={'\\','.','.',0};
    521    
     522
    522523    TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName);
    523524
     
    536537
    537538    strcpyW(*ppszDisplayName,back);
    538    
     539
    539540    return S_OK;
    540541}
     
    563564    if (!pwdMksys)
    564565        return E_POINTER;
    565    
     566
    566567    (*pwdMksys)=MKSYS_ANTIMONIKER;
    567568
     
    600601{
    601602    ICOM_THIS_From_IROTData(IMoniker, iface);
    602    
     603
    603604    TRACE("(%p)\n",iface);
    604605
     
    619620
    620621/******************************************************************************
    621  *        CreateAntiMoniker     [OLE.55]
     622 *        CreateAntiMoniker [OLE.55]
    622623 ******************************************************************************/
    623624HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk)
     
    626627    HRESULT        hr = S_OK;
    627628    IID riid=IID_IMoniker;
    628    
     629
    629630    TRACE("(%p)\n",ppmk);
    630631
  • trunk/src/ole32/bindctx.c

    r5602 r6648  
     1/* $Id: bindctx.c,v 1.2 2001-09-05 13:17:07 bird Exp $ */
    12/***************************************************************************************
    2  *                            BindCtx implementation
     3 *                        BindCtx implementation
    34 *
    45 *  Copyright 1999  Noomen Hamza
     
    2021
    2122/* represent the first size table and it's increment block size */
    22 #define  BLOCK_TAB_SIZE 10 
     23#define  BLOCK_TAB_SIZE 10
    2324#define  MAX_TAB_SIZE   0xFFFFFFFF
    2425
     
    3839
    3940    ICOM_VFIELD(IBindCtx); /* VTable relative to the IBindCtx interface.*/
    40                                      
     41
    4142    ULONG ref; /* reference counter for this object */
    4243
     
    102103  if ( (This==0) || (ppvObject==0) )
    103104      return E_INVALIDARG;
    104  
     105
    105106  /* Initialize the return parameter.*/
    106107  *ppvObject = 0;
     
    116117  if ((*ppvObject)==0)
    117118      return E_NOINTERFACE;
    118  
     119
    119120   /* Query Interface always increases the reference count by one when it is successful */
    120121  BindCtxImpl_AddRef(iface);
     
    223224    if (punk==NULL)
    224225        return E_POINTER;
    225    
     226
    226227    IUnknown_AddRef(punk);
    227    
     228
    228229    /* put the object in the first free element in the table */
    229230    This->bindCtxTable[lastIndex].pObj = punk;
     
    263264    /* check if the object was registred or not */
    264265    if (BindCtxImpl_GetObjectIndex(This,punk,NULL,&index)==S_FALSE)
    265        
     266
    266267        return MK_E_NOTBOUND;
    267268
    268269    IUnknown_Release(This->bindCtxTable[index].pObj);
    269    
     270
    270271    /* left-shift all elements in the right side of the current revoked object */
    271272    for(j=index; j<This->bindCtxTableLastIndex-1; j++)
    272273        This->bindCtxTable[j]= This->bindCtxTable[j+1];
    273    
     274
    274275    This->bindCtxTableLastIndex--;
    275276
     
    307308    if (pbindopts==NULL)
    308309        return E_POINTER;
    309    
     310
    310311    if (pbindopts->cbStruct > sizeof(BIND_OPTS2))
    311312    {
     
    351352    if (pprot==NULL)
    352353        return E_POINTER;
    353    
     354
    354355    res=GetRunningObjectTable(0, pprot);
    355356
     
    368369    if (punk==NULL)
    369370        return E_INVALIDARG;
    370    
     371
    371372    IUnknown_AddRef(punk);
    372373
     
    389390
    390391    This->bindCtxTableLastIndex++;
    391    
     392
    392393    if (This->bindCtxTableLastIndex == This->bindCtxTableSize){ /* table is full ! must be resized */
    393394
     
    419420
    420421    *punk=0;
    421    
     422
    422423    if (BindCtxImpl_GetObjectIndex(This,NULL,pszkey,&index)==S_FALSE)
    423424        return E_FAIL;
    424425
    425426    IUnknown_AddRef(This->bindCtxTable[index].pObj);
    426    
     427
    427428    *punk = This->bindCtxTable[index].pObj;
    428429
     
    446447    /* release the object if it's found */
    447448    IUnknown_Release(This->bindCtxTable[index].pObj);
    448    
     449
    449450    /* remove the object from the table with a left-shifting of all objects in the right side */
    450451    for(j=index; j<This->bindCtxTableLastIndex-1; j++)
    451452        This->bindCtxTable[j]= This->bindCtxTable[j+1];
    452    
     453
    453454    This->bindCtxTableLastIndex--;
    454455
     
    476477    DWORD i;
    477478    BYTE found=0;
    478    
     479
    479480    TRACE("(%p,%p,%p,%p)\n",This,punk,pszkey,index);
    480481
  • trunk/src/ole32/clipboard.c

    r5602 r6648  
     1/* $Id: clipboard.c,v 1.2 2001-09-05 13:17:07 bird Exp $ */
    12/*
    23 *  OLE 2 clipboard support
     
    8182
    8283  /*
    83    * The hidden OLE clipboard window. This window is used as the bridge between the 
     84   * The hidden OLE clipboard window. This window is used as the bridge between the
    8485   * the OLE and windows clipboard API. (Windows creates one such window per process)
    8586   */
     
    114115*   DO NOT add any members before the VTables declaration!
    115116*/
    116 typedef struct 
     117typedef struct
    117118{
    118119  /* IEnumFORMATETC VTable */
    119120  ICOM_VFIELD(IEnumFORMATETC);
    120  
     121
    121122  /* IEnumFORMATETC fields */
    122123  UINT                         posFmt;    /* current enumerator position */
     
    133134   */
    134135  IUnknown*                    pUnkDataObj;
    135  
     136
    136137} IEnumFORMATETCImpl;
    137138
     
    172173            REFIID           riid,
    173174            void**           ppvObject);
    174 static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( 
     175static ULONG WINAPI OLEClipbrd_IDataObject_AddRef(
    175176            IDataObject*     iface);
    176 static ULONG WINAPI OLEClipbrd_IDataObject_Release( 
     177static ULONG WINAPI OLEClipbrd_IDataObject_Release(
    177178            IDataObject*     iface);
    178179static HRESULT WINAPI OLEClipbrd_IDataObject_GetData(
    179             IDataObject*     iface,
    180             LPFORMATETC      pformatetcIn,
    181             STGMEDIUM*       pmedium);
     180        IDataObject*     iface,
     181        LPFORMATETC      pformatetcIn,
     182        STGMEDIUM*       pmedium);
    182183static HRESULT WINAPI OLEClipbrd_IDataObject_GetDataHere(
    183             IDataObject*     iface,
    184             LPFORMATETC      pformatetc,
    185             STGMEDIUM*       pmedium);
     184        IDataObject*     iface,
     185        LPFORMATETC      pformatetc,
     186        STGMEDIUM*       pmedium);
    186187static HRESULT WINAPI OLEClipbrd_IDataObject_QueryGetData(
    187             IDataObject*     iface,
    188             LPFORMATETC      pformatetc);
     188        IDataObject*     iface,
     189        LPFORMATETC      pformatetc);
    189190static HRESULT WINAPI OLEClipbrd_IDataObject_GetCanonicalFormatEtc(
    190             IDataObject*     iface,
    191             LPFORMATETC      pformatectIn,
    192             LPFORMATETC      pformatetcOut);
     191        IDataObject*     iface,
     192        LPFORMATETC      pformatectIn,
     193        LPFORMATETC      pformatetcOut);
    193194static HRESULT WINAPI OLEClipbrd_IDataObject_SetData(
    194             IDataObject*     iface,
    195             LPFORMATETC      pformatetc,
    196             STGMEDIUM*       pmedium,
    197             BOOL             fRelease);
     195        IDataObject*     iface,
     196        LPFORMATETC      pformatetc,
     197        STGMEDIUM*       pmedium,
     198        BOOL             fRelease);
    198199static HRESULT WINAPI OLEClipbrd_IDataObject_EnumFormatEtc(
    199             IDataObject*     iface,       
    200             DWORD            dwDirection,
    201             IEnumFORMATETC** ppenumFormatEtc);
     200        IDataObject*     iface,
     201        DWORD            dwDirection,
     202        IEnumFORMATETC** ppenumFormatEtc);
    202203static HRESULT WINAPI OLEClipbrd_IDataObject_DAdvise(
    203             IDataObject*     iface,
    204             FORMATETC*       pformatetc,
    205             DWORD            advf,
    206             IAdviseSink*     pAdvSink,
    207             DWORD*           pdwConnection);
     204        IDataObject*     iface,
     205        FORMATETC*       pformatetc,
     206        DWORD            advf,
     207        IAdviseSink*     pAdvSink,
     208        DWORD*           pdwConnection);
    208209static HRESULT WINAPI OLEClipbrd_IDataObject_DUnadvise(
    209             IDataObject*     iface,
    210             DWORD            dwConnection);
     210        IDataObject*     iface,
     211        DWORD            dwConnection);
    211212static HRESULT WINAPI OLEClipbrd_IDataObject_EnumDAdvise(
    212             IDataObject*     iface,
    213             IEnumSTATDATA**  ppenumAdvise);
     213        IDataObject*     iface,
     214        IEnumSTATDATA**  ppenumAdvise);
    214215
    215216/*
     
    265266
    266267/*
    267  * Name of our registered OLE clipboard window class 
     268 * Name of our registered OLE clipboard window class
    268269 */
    269270CHAR OLEClipbrd_WNDCLASS[] = "CLIPBRDWNDCLASS";
     
    279280
    280281/*---------------------------------------------------------------------*
    281  *           Win32 OLE clipboard API 
     282 *           Win32 OLE clipboard API
    282283 *---------------------------------------------------------------------*/
    283284
     
    290291 *
    291292 *    S_OK                  IDataObject pointer placed on the clipboard
    292  *    CLIPBRD_E_CANT_OPEN   OpenClipboard failed 
    293  *    CLIPBRD_E_CANT_EMPTY  EmptyClipboard failed 
     293 *    CLIPBRD_E_CANT_OPEN   OpenClipboard failed
     294 *    CLIPBRD_E_CANT_EMPTY  EmptyClipboard failed
    294295 *    CLIPBRD_E_CANT_CLOSE  CloseClipboard failed
    295296 *    CLIPBRD_E_CANT_SET    SetClipboard failed
     
    306307  OLEClipbrd **ppDataObject;
    307308*/
    308  
     309
    309310  TRACE("(%p)\n", pDataObj);
    310  
     311
    311312  /*
    312313   * Make sure we have a clipboard object
     
    331332  /*
    332333   * Empty the current clipboard and make our window the clipboard owner
    333    * NOTE: This will trigger a WM_DESTROYCLIPBOARD message 
     334   * NOTE: This will trigger a WM_DESTROYCLIPBOARD message
    334335   */
    335336  if ( !EmptyClipboard() )
     
    356357
    357358  /*
    358    * Enumerate all HGLOBAL formats supported by the source and make 
     359   * Enumerate all HGLOBAL formats supported by the source and make
    359360   * those formats available using delayed rendering using SetClipboardData.
    360    * Only global memory based data items may be made available to non-OLE 
    361    * applications via the standard Windows clipboard API. Data based on other 
     361   * Only global memory based data items may be made available to non-OLE
     362   * applications via the standard Windows clipboard API. Data based on other
    362363   * mediums(non TYMED_HGLOBAL) can only be accessed via the Ole Clipboard API.
    363364   *
     
    373374      HANDLE_ERROR( hr );
    374375    }
    375      
     376
    376377    while ( S_OK == IEnumFORMATETC_Next(penumFormatetc, 1, &rgelt, NULL) )
    377378    {
     
    382383              GetClipboardFormatNameA(rgelt.cfFormat, szFmtName, sizeof(szFmtName)-1)
    383384                ? szFmtName : "");
    384  
     385
    385386        SetClipboardData( rgelt.cfFormat, (HANDLE)NULL);
    386387      }
     
    391392  /*
    392393   * Windows additionally creates a new "DataObject" clipboard format
    393    * and stores in on the clipboard. We could possibly store a pointer 
     394   * and stores in on the clipboard. We could possibly store a pointer
    394395   * to our internal IDataObject interface on the clipboard. I'm not
    395396   * sure what the use of this is though.
     
    402403   if (hDataObject==0)
    403404     HANDLE_ERROR( E_OUTOFMEMORY );
    404    
     405
    405406   ppDataObject = (OLEClipbrd**)GlobalLock(hDataObject);
    406407   *ppDataObject = theOleClipboard;
     
    410411     HANDLE_ERROR( CLIPBRD_E_CANT_SET );
    411412*/
    412  
     413
    413414  hr = S_OK;
    414415
     
    439440/***********************************************************************
    440441 * OleGetClipboard [OLE32.105]
    441  * Returns a pointer to our internal IDataObject which represents the conceptual 
    442  * state of the Windows clipboard. If the current clipboard already contains 
     442 * Returns a pointer to our internal IDataObject which represents the conceptual
     443 * state of the Windows clipboard. If the current clipboard already contains
    443444 * an IDataObject, our internal IDataObject will delegate to this object.
    444445 */
     
    447448  HRESULT hr = S_OK;
    448449  TRACE("()\n");
    449    
     450
    450451  /*
    451452   * Make sure we have a clipboard object
     
    488489  BOOL bClipboardOpen = FALSE;
    489490  IDataObject* pIDataObjectSrc = NULL;
    490  
     491
    491492  TRACE("()\n");
    492493
     
    508509  pIDataObjectSrc = theOleClipboard->pIDataObjectSrc;
    509510  IDataObject_AddRef(pIDataObjectSrc);
    510  
     511
    511512  /*
    512513   * Open the Windows clipboard
     
    548549    }
    549550  }
    550  
     551
    551552  IEnumFORMATETC_Release(penumFormatetc);
    552  
     553
    553554  /*
    554555   * Release the source data object we are holding on to
     
    571572 *           OleIsCurrentClipboard [OLE32.110]
    572573 */
    573 HRESULT WINAPI OleIsCurrentClipboard (  IDataObject *pDataObject) 
     574HRESULT WINAPI OleIsCurrentClipboard (  IDataObject *pDataObject)
    574575{
    575576  TRACE("()\n");
     
    587588
    588589/*---------------------------------------------------------------------*
    589  *           Internal implementation methods for the OLE clipboard 
     590 *           Internal implementation methods for the OLE clipboard
    590591 *---------------------------------------------------------------------*/
    591592
    592593/***********************************************************************
    593594 * OLEClipbrd_Initialize()
    594  * Initializes the OLE clipboard. 
     595 * Initializes the OLE clipboard.
    595596 */
    596597void OLEClipbrd_Initialize()
    597598{
    598599  /*
    599    * Create the clipboard if necessary 
     600   * Create the clipboard if necessary
    600601   */
    601602  if ( !theOleClipboard )
     
    609610/***********************************************************************
    610611 * OLEClipbrd_UnInitialize()
    611  * Un-Initializes the OLE clipboard 
     612 * Un-Initializes the OLE clipboard
    612613 */
    613614void OLEClipbrd_UnInitialize()
     
    636637  OLEClipbrd* newObject = NULL;
    637638  HGLOBAL hNewObject = 0;
    638  
     639
    639640  /*
    640641   * Allocate space for the object. We use GlobalAlloc since we need
     
    650651   */
    651652  newObject = GlobalLock(hNewObject);
    652  
     653
    653654  /*
    654655   * Initialize the virtual function table.
     
    657658
    658659  /*
    659    * Start with one reference count. The caller of this function 
     660   * Start with one reference count. The caller of this function
    660661   * must release the interface pointer when it is done.
    661662   */
     
    663664
    664665  newObject->hSelf = hNewObject;
    665  
     666
    666667  /*
    667668   * The Ole clipboard is a singleton - save the global handle and pointer
     
    676677{
    677678  TRACE("()\n");
    678    
     679
    679680  if ( !ptrToDestroy )
    680681    return;
    681682
    682683  /*
    683    * Destroy the Ole clipboard window 
     684   * Destroy the Ole clipboard window
    684685   */
    685686  if ( ptrToDestroy->hWndClipboard )
     
    703704/***********************************************************************
    704705 * OLEClipbrd_CreateWindow()
    705  * Create the clipboard window 
     706 * Create the clipboard window
    706707 */
    707708static HWND OLEClipbrd_CreateWindow()
     
    710711  WNDCLASSEXA wcex;
    711712
    712   /* 
    713    * Register the clipboard window class if necessary 
     713  /*
     714   * Register the clipboard window class if necessary
    714715   */
    715716    ZeroMemory( &wcex, sizeof(WNDCLASSEXA));
     
    727728
    728729  /*
    729    * Create a hidden window to receive OLE clipboard messages 
     730   * Create a hidden window to receive OLE clipboard messages
    730731   */
    731732
     
    737738 */
    738739
    739   hwnd = CreateWindowA(OLEClipbrd_WNDCLASS, 
    740                                     "ClipboardWindow",
    741                                     WS_POPUP | WS_CLIPSIBLINGS | WS_OVERLAPPED,
    742                                     CW_USEDEFAULT, CW_USEDEFAULT,
    743                                     CW_USEDEFAULT, CW_USEDEFAULT,
    744                                     0,
    745                                     0,
    746                                     0,
    747                                     0 /*(LPVOID)&clipboardInfo */);
     740  hwnd = CreateWindowA(OLEClipbrd_WNDCLASS,
     741                    "ClipboardWindow",
     742                    WS_POPUP | WS_CLIPSIBLINGS | WS_OVERLAPPED,
     743                    CW_USEDEFAULT, CW_USEDEFAULT,
     744                    CW_USEDEFAULT, CW_USEDEFAULT,
     745                    0,
     746                    0,
     747                    0,
     748                    0 /*(LPVOID)&clipboardInfo */);
    748749
    749750  return hwnd;
     
    756757static void OLEClipbrd_DestroyWindow(HWND hwnd)
    757758{
    758   /* 
    759    * Destroy clipboard window and unregister its WNDCLASS 
     759  /*
     760   * Destroy clipboard window and unregister its WNDCLASS
    760761   */
    761762  DestroyWindow(hwnd);
     
    765766/***********************************************************************
    766767 * OLEClipbrd_WndProc(HWND, unsigned, WORD, LONG)
    767  * Processes messages sent to the OLE clipboard window. 
    768  * Note that we will intercept messages in our WndProc only when data 
    769  * has been placed in the clipboard via OleSetClipboard(). 
     768 * Processes messages sent to the OLE clipboard window.
     769 * Note that we will intercept messages in our WndProc only when data
     770 * has been placed in the clipboard via OleSetClipboard().
    770771 * i.e. Only when OLE owns the windows clipboard.
    771772 */
     
    773774  (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    774775{
    775   switch (message) 
     776  switch (message)
    776777  {
    777778    /*
    778      * WM_RENDERFORMAT 
     779     * WM_RENDERFORMAT
    779780     * We receive this message to allow us to handle delayed rendering of
    780      * a specific clipboard format when an application requests data in 
     781     * a specific clipboard format when an application requests data in
    781782     * that format by calling GetClipboardData.
    782      * (Recall that in OleSetClipboard, we used SetClipboardData to 
     783     * (Recall that in OleSetClipboard, we used SetClipboardData to
    783784     * make all HGLOBAL formats supported by the source IDataObject
    784785     * available using delayed rendering)
    785      * On receiving this mesage we must actually render the data in the 
    786      * specified format and place it on the clipboard by calling the 
    787      * SetClipboardData function. 
     786     * On receiving this mesage we must actually render the data in the
     787     * specified format and place it on the clipboard by calling the
     788     * SetClipboardData function.
    788789     */
    789790    case WM_RENDERFORMAT:
    790791    {
    791792      FORMATETC rgelt;
    792        
     793
    793794      ZeroMemory( &rgelt, sizeof(FORMATETC));
    794795
     
    802803
    803804      TRACE("(): WM_RENDERFORMAT(cfFormat=%d)\n", rgelt.cfFormat);
    804      
     805
    805806      /*
    806807       * Render the clipboard data.
     
    826827      IEnumFORMATETC* penumFormatetc = NULL;
    827828      FORMATETC rgelt;
    828      
     829
    829830      TRACE("(): WM_RENDERALLFORMATS\n");
    830      
     831
    831832      /*
    832833       * Render all HGLOBAL formats supported by the source into
     
    845846        {
    846847          /*
    847            * Render the clipboard data. 
     848           * Render the clipboard data.
    848849           */
    849850          if ( FAILED(OLEClipbrd_RenderFormat( (IDataObject*)&(theOleClipboard->lpvtbl1), &rgelt )) )
    850851            continue;
    851        
     852
    852853          TRACE("(): WM_RENDERALLFORMATS(cfFormat=%d)\n", rgelt.cfFormat);
    853854        }
    854855      }
    855      
     856
    856857      IEnumFORMATETC_Release(penumFormatetc);
    857858
     
    992993
    993994        HeapFree(GetProcessHeap(), 0, mfBits);
    994  
     995
    995996        GlobalUnlock(std2.u.hMetaFilePict);
    996997
     
    10201021   *  Put a copy of the rendered data back on the clipboard
    10211022   */
    1022  
     1023
    10231024  if ( !(hDup = OLEClipbrd_GlobalDupMem(hStorage)) )
    10241025    HANDLE_ERROR( E_OUTOFMEMORY );
    1025        
     1026
    10261027  if ( !SetClipboardData( pFormatetc->cfFormat, hDup ) )
    10271028  {
     
    10311032
    10321033CLEANUP:
    1033  
     1034
    10341035  ReleaseStgMedium(&std);
    1035  
     1036
    10361037  return hr;
    10371038}
     
    10471048    PVOID pGlobalSrc, pGlobalDest;
    10481049    DWORD cBytes;
    1049    
     1050
    10501051    if ( !hGlobalSrc )
    10511052      return 0;
     
    10541055    if ( 0 == cBytes )
    10551056      return 0;
    1056        
     1057
    10571058    hGlobalDest = GlobalAlloc( GMEM_DDESHARE|GMEM_MOVEABLE,
    10581059                               cBytes );
    10591060    if ( !hGlobalDest )
    10601061      return 0;
    1061    
     1062
    10621063    pGlobalSrc = GlobalLock(hGlobalSrc);
    10631064    pGlobalDest = GlobalLock(hGlobalDest);
     
    10661067
    10671068    memcpy(pGlobalDest, pGlobalSrc, cBytes);
    1068        
     1069
    10691070    GlobalUnlock(hGlobalSrc);
    10701071    GlobalUnlock(hGlobalDest);
     
    10751076
    10761077/*---------------------------------------------------------------------*
    1077  *  Implementation of the internal IDataObject interface exposed by 
     1078 *  Implementation of the internal IDataObject interface exposed by
    10781079 *  the OLE clipboard.
    10791080 *---------------------------------------------------------------------*/
     
    10901091            void**           ppvObject)
    10911092{
    1092   /* 
    1093    * Declare "This" pointer 
     1093  /*
     1094   * Declare "This" pointer
    10941095   */
    10951096  ICOM_THIS(OLEClipbrd, iface);
    10961097  TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObject);
    1097  
     1098
    10981099  /*
    10991100   * Perform a sanity check on the parameters.
     
    11011102  if ( (This==0) || (ppvObject==0) )
    11021103    return E_INVALIDARG;
    1103  
     1104
    11041105  /*
    11051106   * Initialize the return parameter.
     
    11101111   * Compare the riid with the interface IDs implemented by this object.
    11111112   */
    1112   if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 
     1113  if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
    11131114  {
    11141115    *ppvObject = iface;
    11151116  }
    1116   else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) 
     1117  else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0)
    11171118  {
    11181119    *ppvObject = (IDataObject*)&(This->lpvtbl1);
     
    11231124    return E_NOINTERFACE;
    11241125  }
    1125  
     1126
    11261127  /*
    11271128   * Query Interface always increases the reference count by one when it is
    1128    * successful. 
     1129   * successful.
    11291130   */
    11301131  IUnknown_AddRef((IUnknown*)*ppvObject);
     
    11381139 * See Windows documentation for more details on IUnknown methods.
    11391140 */
    1140 static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( 
     1141static ULONG WINAPI OLEClipbrd_IDataObject_AddRef(
    11411142            IDataObject*     iface)
    11421143{
    1143   /* 
    1144    * Declare "This" pointer 
     1144  /*
     1145   * Declare "This" pointer
    11451146   */
    11461147  ICOM_THIS(OLEClipbrd, iface);
    11471148
    11481149  TRACE("(%p)->(count=%lu)\n",This, This->ref);
    1149  
     1150
    11501151  This->ref++;
    11511152
     
    11581159 * See Windows documentation for more details on IUnknown methods.
    11591160 */
    1160 static ULONG WINAPI OLEClipbrd_IDataObject_Release( 
     1161static ULONG WINAPI OLEClipbrd_IDataObject_Release(
    11611162            IDataObject*     iface)
    11621163{
    1163   /* 
    1164    * Declare "This" pointer 
     1164  /*
     1165   * Declare "This" pointer
    11651166   */
    11661167  ICOM_THIS(OLEClipbrd, iface);
    11671168
    11681169  TRACE("(%p)->(count=%lu)\n",This, This->ref);
    1169  
     1170
    11701171  /*
    11711172   * Decrease the reference count on this object.
     
    11801181    OLEClipbrd_Destroy(This);
    11811182  }
    1182  
     1183
    11831184  return This->ref;
    11841185}
    11851186
    1186  
     1187
    11871188/************************************************************************
    11881189 * OLEClipbrd_IDataObject_GetData (IDataObject)
    11891190 *
    1190  * The OLE Clipboard's implementation of this method delegates to 
     1191 * The OLE Clipboard's implementation of this method delegates to
    11911192 * a data source if there is one or wraps around the windows clipboard
    11921193 *
     
    11941195 */
    11951196static HRESULT WINAPI OLEClipbrd_IDataObject_GetData(
    1196             IDataObject*     iface,
    1197             LPFORMATETC      pformatetcIn,
    1198             STGMEDIUM*       pmedium)
     1197        IDataObject*     iface,
     1198        LPFORMATETC      pformatetcIn,
     1199        STGMEDIUM*       pmedium)
    11991200{
    12001201  HANDLE      hData = 0;
     
    12031204
    12041205  /*
    1205    * Declare "This" pointer 
     1206   * Declare "This" pointer
    12061207   */
    12071208  ICOM_THIS(OLEClipbrd, iface);
    1208  
     1209
    12091210  TRACE("(%p,%p,%p)\n", iface, pformatetcIn, pmedium);
    12101211
     
    12321233*/
    12331234
    1234   /* 
     1235  /*
    12351236   * Otherwise, get the data from the windows clipboard using GetClipboardData
    12361237   */
     
    12401241  hData = GetClipboardData(pformatetcIn->cfFormat);
    12411242
    1242   /* 
     1243  /*
    12431244   * Return the clipboard data in the storage medium structure
    12441245   */
     
    12461247  pmedium->u.hGlobal = (HGLOBAL)hData;
    12471248  pmedium->pUnkForRelease = NULL;
    1248  
     1249
    12491250  hr = S_OK;
    1250  
     1251
    12511252CLEANUP:
    12521253  /*
     
    12621263
    12631264static HRESULT WINAPI OLEClipbrd_IDataObject_GetDataHere(
    1264             IDataObject*     iface,
    1265             LPFORMATETC      pformatetc,
    1266             STGMEDIUM*       pmedium)
     1265        IDataObject*     iface,
     1266        LPFORMATETC      pformatetc,
     1267        STGMEDIUM*       pmedium)
    12671268{
    12681269  FIXME(": Stub\n");
     
    12731274 * OLEClipbrd_IDataObject_QueryGetData (IDataObject)
    12741275 *
    1275  * The OLE Clipboard's implementation of this method delegates to 
     1276 * The OLE Clipboard's implementation of this method delegates to
    12761277 * a data source if there is one or wraps around the windows clipboard
    12771278 * function IsClipboardFormatAvailable() otherwise.
     
    12801281 */
    12811282static HRESULT WINAPI OLEClipbrd_IDataObject_QueryGetData(
    1282             IDataObject*     iface,
    1283             LPFORMATETC      pformatetc)
    1284 {
    1285   /* 
    1286    * Declare "This" pointer 
     1283        IDataObject*     iface,
     1284        LPFORMATETC      pformatetc)
     1285{
     1286  /*
     1287   * Declare "This" pointer
    12871288   */
    12881289  ICOM_THIS(OLEClipbrd, iface);
     
    13141315  if ( pformatetc->tymed != TYMED_HGLOBAL )
    13151316    return DV_E_TYMED;
    1316          
     1317
    13171318  /*
    13181319   * Delegate to the Windows clipboard function IsClipboardFormatAvailable
     
    13271328 */
    13281329static HRESULT WINAPI OLEClipbrd_IDataObject_GetCanonicalFormatEtc(
    1329             IDataObject*     iface,
    1330             LPFORMATETC      pformatectIn,
    1331             LPFORMATETC      pformatetcOut)
     1330        IDataObject*     iface,
     1331        LPFORMATETC      pformatectIn,
     1332        LPFORMATETC      pformatetcOut)
    13321333{
    13331334  TRACE("(%p, %p, %p)\n", iface, pformatectIn, pformatetcOut);
     
    13431344 * OLEClipbrd_IDataObject_SetData (IDataObject)
    13441345 *
    1345  * The OLE Clipboard's does not implement this method 
     1346 * The OLE Clipboard's does not implement this method
    13461347 *
    13471348 * See Windows documentation for more details on IDataObject methods.
    13481349 */
    13491350static HRESULT WINAPI OLEClipbrd_IDataObject_SetData(
    1350             IDataObject*     iface,
    1351             LPFORMATETC      pformatetc,
    1352             STGMEDIUM*       pmedium,
    1353             BOOL             fRelease)
     1351        IDataObject*     iface,
     1352        LPFORMATETC      pformatetc,
     1353        STGMEDIUM*       pmedium,
     1354        BOOL             fRelease)
    13541355{
    13551356  TRACE("\n");
     
    13631364 */
    13641365static HRESULT WINAPI OLEClipbrd_IDataObject_EnumFormatEtc(
    1365             IDataObject*     iface,
    1366             DWORD            dwDirection,
    1367             IEnumFORMATETC** ppenumFormatEtc)
     1366        IDataObject*     iface,
     1367        DWORD            dwDirection,
     1368        IEnumFORMATETC** ppenumFormatEtc)
    13681369{
    13691370  HRESULT hr = S_OK;
     
    13721373  UINT format;
    13731374  BOOL bClipboardOpen;
    1374  
    1375   /* 
    1376    * Declare "This" pointer 
     1375
     1376  /*
     1377   * Declare "This" pointer
    13771378   */
    13781379  ICOM_THIS(OLEClipbrd, iface);
     
    14271428      HANDLE_ERROR( E_FAIL );
    14281429    }
    1429    
     1430
    14301431    /* Init the FORMATETC struct */
    14311432    afmt[i].cfFormat = format;
     
    14461447  if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenumFormatEtc)))
    14471448    HANDLE_ERROR( hr );
    1448      
     1449
    14491450  hr = S_OK;
    1450  
     1451
    14511452CLEANUP:
    14521453  /*
     
    14551456  if (afmt)
    14561457    HeapFree(GetProcessHeap(), 0, afmt);
    1457  
     1458
    14581459  /*
    14591460   * Close Windows clipboard
     
    14681469 * OLEClipbrd_IDataObject_DAdvise (IDataObject)
    14691470 *
    1470  * The OLE Clipboard's does not implement this method 
     1471 * The OLE Clipboard's does not implement this method
    14711472 *
    14721473 * See Windows documentation for more details on IDataObject methods.
    14731474 */
    14741475static HRESULT WINAPI OLEClipbrd_IDataObject_DAdvise(
    1475             IDataObject*     iface,
    1476             FORMATETC*       pformatetc,
    1477             DWORD            advf,
    1478             IAdviseSink*     pAdvSink,
    1479             DWORD*           pdwConnection)
     1476        IDataObject*     iface,
     1477        FORMATETC*       pformatetc,
     1478        DWORD            advf,
     1479        IAdviseSink*     pAdvSink,
     1480        DWORD*           pdwConnection)
    14801481{
    14811482  TRACE("\n");
     
    14861487 * OLEClipbrd_IDataObject_DUnadvise (IDataObject)
    14871488 *
    1488  * The OLE Clipboard's does not implement this method 
     1489 * The OLE Clipboard's does not implement this method
    14891490 *
    14901491 * See Windows documentation for more details on IDataObject methods.
    14911492 */
    14921493static HRESULT WINAPI OLEClipbrd_IDataObject_DUnadvise(
    1493             IDataObject*     iface,
    1494             DWORD            dwConnection)
     1494        IDataObject*     iface,
     1495        DWORD            dwConnection)
    14951496{
    14961497  TRACE("\n");
     
    15061507 */
    15071508static HRESULT WINAPI OLEClipbrd_IDataObject_EnumDAdvise(
    1508             IDataObject*     iface,
    1509             IEnumSTATDATA**  ppenumAdvise)
     1509        IDataObject*     iface,
     1510        IEnumSTATDATA**  ppenumAdvise)
    15101511{
    15111512  TRACE("\n");
     
    15331534  DWORD size=cfmt * sizeof(FORMATETC);
    15341535  LPMALLOC pIMalloc;
    1535  
     1536
    15361537  ef = (IEnumFORMATETCImpl*)HeapAlloc(GetProcessHeap(),
    15371538                                      HEAP_ZERO_MEMORY,
     
    15391540  if (!ef)
    15401541    return NULL;
    1541  
     1542
    15421543  ef->ref = 0;
    15431544  ICOM_VTBL(ef) = &efvt;
    15441545  ef->pUnkDataObj = pUnkDataObj;
    1545  
     1546
    15461547  ef->posFmt = 0;
    15471548  ef->countFmt = cfmt;
     
    15501551  ef->pFmt = (LPFORMATETC)IMalloc_Alloc(pIMalloc, size);
    15511552  IMalloc_Release(pIMalloc);
    1552  
     1553
    15531554  if (ef->pFmt)
    15541555    memcpy(ef->pFmt, afmt, size);
    1555  
     1556
    15561557  TRACE("(%p)->()\n",ef);
    15571558  return (LPENUMFORMATETC)ef;
     
    15751576   * we only need to support the IUnknown and IEnumFORMATETC interfaces
    15761577   */
    1577  
     1578
    15781579  *ppvObj = NULL;
    1579  
     1580
    15801581  if(IsEqualIID(riid, &IID_IUnknown))
    15811582  {
     
    15851586  {
    15861587    *ppvObj = (IDataObject*)This;
    1587   }   
    1588  
     1588  }
     1589
    15891590  if(*ppvObj)
    15901591  {
     
    15931594    return S_OK;
    15941595  }
    1595  
     1596
    15961597  TRACE("-- Interface: E_NOINTERFACE\n");
    15971598  return E_NOINTERFACE;
     
    16141615  if (This->pUnkDataObj)
    16151616    IUnknown_AddRef(This->pUnkDataObj);
    1616  
     1617
    16171618  return ++(This->ref);
    16181619}
     
    16321633  if (This->pUnkDataObj)
    16331634    IUnknown_Release(This->pUnkDataObj);  /* Release parent data object */
    1634  
    1635   if (!--(This->ref)) 
     1635
     1636  if (!--(This->ref))
    16361637  {
    16371638    TRACE("() - destroying IEnumFORMATETC(%p)\n",This);
     
    16411642      IMalloc_Release(pIMalloc);
    16421643    }
    1643      
     1644
    16441645    HeapFree(GetProcessHeap(),0,This);
    16451646    return 0;
     
    16601661  UINT cfetch;
    16611662  HRESULT hres = S_FALSE;
    1662  
     1663
    16631664  TRACE("(%p)->(pos=%u)\n", This, This->posFmt);
    1664  
     1665
    16651666  if (This->posFmt < This->countFmt)
    16661667  {
     
    16711672      hres = S_OK;
    16721673    }
    1673    
     1674
    16741675    memcpy(rgelt, &This->pFmt[This->posFmt], cfetch * sizeof(FORMATETC));
    16751676    This->posFmt += cfetch;
     
    16791680    cfetch = 0;
    16801681  }
    1681  
     1682
    16821683  if (pceltFethed)
    16831684  {
    16841685    *pceltFethed = cfetch;
    16851686  }
    1686  
     1687
    16871688  return hres;
    16881689}
     
    16971698  ICOM_THIS(IEnumFORMATETCImpl,iface);
    16981699  TRACE("(%p)->(num=%lu)\n", This, celt);
    1699  
     1700
    17001701  This->posFmt += celt;
    17011702  if (This->posFmt > This->countFmt)
     
    17161717  ICOM_THIS(IEnumFORMATETCImpl,iface);
    17171718  TRACE("(%p)->()\n", This);
    1718  
     1719
    17191720  This->posFmt = 0;
    17201721  return S_OK;
     
    17311732  ICOM_THIS(IEnumFORMATETCImpl,iface);
    17321733  HRESULT hr = S_OK;
    1733  
     1734
    17341735  TRACE("(%p)->(ppenum=%p)\n", This, ppenum);
    17351736
     
    17431744  if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenum)))
    17441745    return ( hr );
    1745  
     1746
    17461747  return (*ppenum) ? S_OK : E_OUTOFMEMORY;
    17471748}
  • trunk/src/ole32/compobj.c

    r5602 r6648  
     1/* $Id: compobj.c,v 1.2 2001-09-05 13:17:07 bird Exp $ */
    12/*
    2  *      COMPOBJ library
    3  *
    4  *      Copyright 1995  Martin von Loewis
    5  *      Copyright 1998  Justin Bradford
     3 *  COMPOBJ library
     4 *
     5 *  Copyright 1995  Martin von Loewis
     6 *  Copyright 1998  Justin Bradford
    67 *      Copyright 1999  Francis Beaudet
    78 *  Copyright 1999  Sylvain St-Germain
     
    4445 *  COM External Lock structures and methods declaration
    4546 *
    46  *  This api provides a linked list to managed external references to 
    47  *  COM objects. 
    48  *
    49  *  The public interface consists of three calls: 
     47 *  This api provides a linked list to managed external references to
     48 *  COM objects.
     49 *
     50 *  The public interface consists of three calls:
    5051 *      COM_ExternalLockAddRef
    5152 *      COM_ExternalLockRelease
     
    5758
    5859/*
    59  * Declaration of the static structure that manage the 
     60 * Declaration of the static structure that manage the
    6061 * external lock to COM  objects.
    6162 */
     
    8283
    8384/*
    84  * Public Interface to the external lock list   
     85 * Public Interface to the external lock list
    8586 */
    8687static void COM_ExternalLockFreeList();
     
    9091
    9192/*
    92  * Private methods used to managed the linked list   
     93 * Private methods used to managed the linked list
    9394 */
    9495static BOOL COM_ExternalLockInsert(
     
    152153 */
    153154typedef struct tagOpenDll {
    154   HINSTANCE hLibrary;       
     155  HINSTANCE hLibrary;
    155156  struct tagOpenDll *next;
    156157} OpenDll;
     
    163164 */
    164165static HRESULT COM_GetRegisteredClassObject(REFCLSID    rclsid,
    165                                             DWORD       dwClsContext,
    166                                             LPUNKNOWN*  ppUnk);
     166                        DWORD       dwClsContext,
     167                        LPUNKNOWN*  ppUnk);
    167168
    168169static void COM_RevokeAllClasses();
     
    173174 *
    174175 * RETURNS
    175  *      Current build version, hiword is majornumber, loword is minornumber
     176 *  Current build version, hiword is majornumber, loword is minornumber
    176177 */
    177178DWORD WINAPI CoBuildVersion(void)
     
    183184#ifndef __WIN32OS2__
    184185/******************************************************************************
    185  *              CoInitialize16  [COMPOBJ.2]
     186 *      CoInitialize16  [COMPOBJ.2]
    186187 * Set the win16 IMalloc used for memory management
    187188 */
    188189HRESULT WINAPI CoInitialize16(
    189         LPVOID lpReserved       /* [in] pointer to win16 malloc interface */
     190    LPVOID lpReserved   /* [in] pointer to win16 malloc interface */
    190191) {
    191192    currentMalloc16 = (LPMALLOC16)lpReserved;
     
    195196
    196197/******************************************************************************
    197  *              CoInitialize    [OLE32.26]
     198 *      CoInitialize    [OLE32.26]
    198199 *
    199200 * Initializes the COM libraries.
     
    202203 */
    203204HRESULT WINAPI CoInitialize(
    204         LPVOID lpReserved       /* [in] pointer to win32 malloc interface
     205    LPVOID lpReserved   /* [in] pointer to win32 malloc interface
    205206                                   (obsolete, should be NULL) */
    206 ) 
     207)
    207208{
    208209  /*
     
    213214
    214215/******************************************************************************
    215  *              CoInitializeEx  [OLE32.163]
     216 *      CoInitializeEx  [OLE32.163]
    216217 *
    217218 * Initializes the COM libraries. The behavior used to set the win32 IMalloc
     
    225226 *
    226227 * BUGS
    227  * Only the single threaded model is supported. As a result RPC_E_CHANGED_MODE 
     228 * Only the single threaded model is supported. As a result RPC_E_CHANGED_MODE
    228229 * is never returned.
    229230 *
     
    231232 */
    232233HRESULT WINAPI CoInitializeEx(
    233         LPVOID lpReserved,      /* [in] pointer to win32 malloc interface
     234    LPVOID lpReserved,  /* [in] pointer to win32 malloc interface
    234235                                   (obsolete, should be NULL) */
    235         DWORD dwCoInit          /* [in] A value from COINIT specifies the threading model */
    236 ) 
     236    DWORD dwCoInit      /* [in] A value from COINIT specifies the threading model */
     237)
    237238{
    238239  HRESULT hr;
     
    248249   * Check for unsupported features.
    249250   */
    250   if (dwCoInit!=COINIT_APARTMENTTHREADED) 
     251  if (dwCoInit!=COINIT_APARTMENTTHREADED)
    251252  {
    252253    FIXME(":(%p,%x): unsupported flag %x\n", lpReserved, (int)dwCoInit, (int)dwCoInit);
     
    283284/***********************************************************************
    284285 *           CoUninitialize16   [COMPOBJ.3]
    285  * Don't know what it does. 
     286 * Don't know what it does.
    286287 * 3-Nov-98 -- this was originally misspelled, I changed it to what I
    287288 *   believe is the correct spelling
     
    304305{
    305306  TRACE("()\n");
    306  
     307
    307308  /*
    308309   * Decrease the reference count.
    309310   */
    310311  s_COMLockCount--;
    311  
     312
    312313  /*
    313314   * If we are back to 0 locks on the COM library, make sure we free
     
    343344 *           CoGetMalloc16    [COMPOBJ.4]
    344345 * RETURNS
    345  *      The current win16 IMalloc
     346 *  The current win16 IMalloc
    346347 */
    347348HRESULT WINAPI CoGetMalloc16(
    348         DWORD dwMemContext,     /* [in] unknown */
    349         LPMALLOC16 * lpMalloc   /* [out] current win16 malloc interface */
     349    DWORD dwMemContext, /* [in] unknown */
     350    LPMALLOC16 * lpMalloc   /* [out] current win16 malloc interface */
    350351) {
    351352    if(!currentMalloc16)
    352         currentMalloc16 = IMalloc16_Constructor();
     353    currentMalloc16 = IMalloc16_Constructor();
    353354    *lpMalloc = currentMalloc16;
    354355    return S_OK;
     
    357358
    358359/******************************************************************************
    359  *              CoGetMalloc     [OLE32.20]
     360 *      CoGetMalloc [OLE32.20]
    360361 *
    361362 * RETURNS
    362  *      The current win32 IMalloc
     363 *  The current win32 IMalloc
    363364 */
    364365HRESULT WINAPI CoGetMalloc(
    365         DWORD dwMemContext,     /* [in] unknown */
    366         LPMALLOC *lpMalloc      /* [out] current win32 malloc interface */
     366    DWORD dwMemContext, /* [in] unknown */
     367    LPMALLOC *lpMalloc  /* [out] current win32 malloc interface */
    367368) {
    368369    if(!currentMalloc32)
    369         currentMalloc32 = IMalloc_Constructor();
     370    currentMalloc32 = IMalloc_Constructor();
    370371    *lpMalloc = currentMalloc32;
    371372    return S_OK;
     
    377378 */
    378379HRESULT WINAPI CoCreateStandardMalloc16(DWORD dwMemContext,
    379                                           LPMALLOC16 *lpMalloc)
     380                      LPMALLOC16 *lpMalloc)
    380381{
    381382    /* FIXME: docu says we shouldn't return the same allocator as in
     
    386387
    387388/******************************************************************************
    388  *              CoDisconnectObject      [COMPOBJ.15]
     389 *      CoDisconnectObject  [COMPOBJ.15]
    389390 */
    390391HRESULT WINAPI CoDisconnectObject( LPUNKNOWN lpUnk, DWORD reserved )
     
    400401 *
    401402 * RETURNS
    402  *      TRUE if equal
     403 *  TRUE if equal
    403404 */
    404405BOOL16 WINAPI IsEqualGUID16(
    405         GUID* g1,       /* [in] unique id 1 */
    406         GUID* g2        /* [in] unique id 2 */
     406    GUID* g1,   /* [in] unique id 1 */
     407    GUID* g2    /* [in] unique id 2 */
    407408) {
    408409    return !memcmp( g1, g2, sizeof(GUID) );
     
    411412
    412413/******************************************************************************
    413  *              CLSIDFromString16       [COMPOBJ.20]
    414  * Converts a unique identifier from its string representation into 
     414 *      CLSIDFromString16   [COMPOBJ.20]
     415 * Converts a unique identifier from its string representation into
    415416 * the GUID struct.
    416417 *
    417  * Class id: DWORD-WORD-WORD-BYTES[2]-BYTES[6] 
     418 * Class id: DWORD-WORD-WORD-BYTES[2]-BYTES[6]
    418419 *
    419420 * RETURNS
    420  *      the converted GUID
     421 *  the converted GUID
    421422 */
    422423HRESULT WINAPI CLSIDFromString16(
    423         LPCOLESTR16 idstr,      /* [in] string representation of guid */
    424         CLSID *id               /* [out] GUID converted from string */
     424    LPCOLESTR16 idstr,  /* [in] string representation of guid */
     425    CLSID *id       /* [out] GUID converted from string */
    425426) {
    426427  BYTE *s = (BYTE *) idstr;
    427428  BYTE *p;
    428   int   i;
     429  int   i;
    429430  BYTE table[256];
    430431
    431432  if (!s)
    432           s = "{00000000-0000-0000-0000-000000000000}";
     433      s = "{00000000-0000-0000-0000-000000000000}";
    433434  else {  /* validate the CLSID string */
    434435
     
    467468  p = (BYTE *) id;
    468469
    469   s++;  /* skip leading brace  */
     470  s++;  /* skip leading brace  */
    470471  for (i = 0; i < 4; i++) {
    471472    p[3 - i] = table[*s]<<4 | table[*(s+1)];
     
    473474  }
    474475  p += 4;
    475   s++;  /* skip - */
     476  s++;  /* skip - */
    476477
    477478  for (i = 0; i < 2; i++) {
     
    480481  }
    481482  p += 2;
    482   s++;  /* skip - */
     483  s++;  /* skip - */
    483484
    484485  for (i = 0; i < 2; i++) {
     
    487488  }
    488489  p += 2;
    489   s++;  /* skip - */
     490  s++;  /* skip - */
    490491
    491492  /* these are just sequential bytes */
     
    494495    s += 2;
    495496  }
    496   s++;  /* skip - */
     497  s++;  /* skip - */
    497498
    498499  for (i = 0; i < 6; i++) {
     
    505506
    506507/******************************************************************************
    507  *              CoCreateGuid[OLE32.6]
     508 *      CoCreateGuid[OLE32.6]
    508509 *
    509510 */
    510511HRESULT WINAPI CoCreateGuid(
    511         GUID *pguid /* [out] points to the GUID to initialize */
     512    GUID *pguid /* [out] points to the GUID to initialize */
    512513) {
    513514    return UuidCreate(pguid);
     
    515516
    516517/******************************************************************************
    517  *              CLSIDFromString [OLE32.3]
    518  * Converts a unique identifier from its string representation into 
     518 *      CLSIDFromString [OLE32.3]
     519 * Converts a unique identifier from its string representation into
    519520 * the GUID struct.
    520521 *
     
    523524 *
    524525 * RETURNS
    525  *      the converted GUID
     526 *  the converted GUID
    526527 */
    527528HRESULT WINAPI CLSIDFromString(
    528         LPCOLESTR idstr,        /* [in] string representation of GUID */
    529         CLSID *id               /* [out] GUID represented by above string */
     529    LPCOLESTR idstr,    /* [in] string representation of GUID */
     530    CLSID *id       /* [out] GUID represented by above string */
    530531) {
    531532    LPOLESTR16      xid = HEAP_strdupWtoA(GetProcessHeap(),0,idstr);
     
    540541
    541542/******************************************************************************
    542  *              WINE_StringFromCLSID    [Internal]
     543 *      WINE_StringFromCLSID    [Internal]
    543544 * Converts a GUID into the respective string representation.
    544545 *
     
    546547 *
    547548 * RETURNS
    548  *      the string representation and HRESULT
     549 *  the string representation and HRESULT
    549550 */
    550551#ifdef __WIN32OS2__
    551552HRESULT WINAPI WINE_StringFromCLSID(
    552         const CLSID *id,        /* [in] GUID to be converted */
    553         LPSTR idstr             /* [out] pointer to buffer to contain converted guid */
     553    const CLSID *id,    /* [in] GUID to be converted */
     554    LPSTR idstr     /* [out] pointer to buffer to contain converted guid */
    554555#else
    555556static HRESULT WINE_StringFromCLSID(
    556         const CLSID *id,        /* [in] GUID to be converted */
    557         LPSTR idstr             /* [out] pointer to buffer to contain converted guid */
     557    const CLSID *id,    /* [in] GUID to be converted */
     558    LPSTR idstr     /* [out] pointer to buffer to contain converted guid */
    558559#endif
    559560) {
    560561  static const char *hex = "0123456789ABCDEF";
    561562  char *s;
    562   int   i;
     563  int   i;
    563564
    564565  if (!id)
    565         { ERR("called with id=Null\n");
    566           *idstr = 0x00;
    567           return E_FAIL;
    568         }
    569        
     566    { ERR("called with id=Null\n");
     567      *idstr = 0x00;
     568      return E_FAIL;
     569    }
     570
    570571  sprintf(idstr, "{%08lX-%04X-%04X-%02X%02X-",
    571           id->Data1, id->Data2, id->Data3,
    572           id->Data4[0], id->Data4[1]);
     572      id->Data1, id->Data2, id->Data3,
     573      id->Data4[0], id->Data4[1]);
    573574  s = &idstr[25];
    574575
     
    588589#ifndef __WIN32OS2__
    589590/******************************************************************************
    590  *              StringFromCLSID16       [COMPOBJ.19]
     591 *      StringFromCLSID16   [COMPOBJ.19]
    591592 * Converts a GUID into the respective string representation.
    592593 * The target string is allocated using the OLE IMalloc.
    593594 * RETURNS
    594  *      the string representation and HRESULT
     595 *  the string representation and HRESULT
    595596 */
    596597HRESULT WINAPI StringFromCLSID16(
    597598        REFCLSID id,            /* [in] the GUID to be converted */
    598         LPOLESTR16 *idstr       /* [out] a pointer to a to-be-allocated segmented pointer pointing to the resulting string */
     599    LPOLESTR16 *idstr   /* [out] a pointer to a to-be-allocated segmented pointer pointing to the resulting string */
    599600
    600601) {
    601602    extern BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags,
    602603                                           DWORD cbArgs, LPVOID pArgs, LPDWORD pdwRetCode );
    603     LPMALLOC16  mllc;
    604     HRESULT     ret;
    605     DWORD       args[2];
     604    LPMALLOC16  mllc;
     605    HRESULT ret;
     606    DWORD   args[2];
    606607
    607608    ret = CoGetMalloc16(0,&mllc);
     
    615616     */
    616617    if (!K32WOWCallback16Ex(
    617         (DWORD)((ICOM_VTABLE(IMalloc16)*)MapSL(
     618        (DWORD)((ICOM_VTABLE(IMalloc16)*)MapSL(
    618619            (SEGPTR)ICOM_VTBL(((LPMALLOC16)MapSL((SEGPTR)mllc))))
    619         )->Alloc,
    620         WCB16_CDECL,
    621         2*sizeof(DWORD),
    622         (LPVOID)args,
    623         (LPDWORD)idstr
     620    )->Alloc,
     621    WCB16_CDECL,
     622    2*sizeof(DWORD),
     623    (LPVOID)args,
     624    (LPDWORD)idstr
    624625    )) {
    625         WARN("CallTo16 IMalloc16 failed\n");
    626         return E_FAIL;
     626        WARN("CallTo16 IMalloc16 failed\n");
     627        return E_FAIL;
    627628    }
    628629    return WINE_StringFromCLSID(id,MapSL((SEGPTR)*idstr));
     
    630631#endif
    631632/******************************************************************************
    632  *              StringFromCLSID [OLE32.151]
     633 *      StringFromCLSID [OLE32.151]
    633634 * Converts a GUID into the respective string representation.
    634635 * The target string is allocated using the OLE IMalloc.
    635636 * RETURNS
    636  *      the string representation and HRESULT
     637 *  the string representation and HRESULT
    637638 */
    638639HRESULT WINAPI StringFromCLSID(
    639640        REFCLSID id,            /* [in] the GUID to be converted */
    640         LPOLESTR *idstr /* [out] a pointer to a to-be-allocated pointer pointing to the resulting string */
     641    LPOLESTR *idstr /* [out] a pointer to a to-be-allocated pointer pointing to the resulting string */
    641642) {
    642         char            buf[80];
    643         HRESULT       ret;
    644         LPMALLOC        mllc;
    645 
    646         if ((ret=CoGetMalloc(0,&mllc)))
    647                 return ret;
    648 
    649         ret=WINE_StringFromCLSID(id,buf);
    650         if (!ret) {
     643    char            buf[80];
     644    HRESULT       ret;
     645    LPMALLOC    mllc;
     646
     647    if ((ret=CoGetMalloc(0,&mllc)))
     648        return ret;
     649
     650    ret=WINE_StringFromCLSID(id,buf);
     651    if (!ret) {
    651652            DWORD len = MultiByteToWideChar( CP_ACP, 0, buf, -1, NULL, 0 );
    652653            *idstr = IMalloc_Alloc( mllc, len * sizeof(WCHAR) );
    653654            MultiByteToWideChar( CP_ACP, 0, buf, -1, *idstr, len );
    654         }
    655         return ret;
    656 }
    657 
    658 /******************************************************************************
    659  *              StringFromGUID2 [COMPOBJ.76] [OLE32.152]
     655    }
     656    return ret;
     657}
     658
     659/******************************************************************************
     660 *      StringFromGUID2 [COMPOBJ.76] [OLE32.152]
    660661 *
    661662 * Converts a global unique identifier into a string of an API-
     
    663664 *
    664665 * RETURNS
    665  *      The (UNICODE) string representation of the GUID in 'str'
    666  *      The length of the resulting string, 0 if there was any problem.
     666 *  The (UNICODE) string representation of the GUID in 'str'
     667 *  The length of the resulting string, 0 if there was any problem.
    667668 */
    668669INT WINAPI
    669670StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
    670671{
    671   char          xguid[80];
     672  char      xguid[80];
    672673
    673674  if (WINE_StringFromCLSID(id,xguid))
    674         return 0;
     675    return 0;
    675676  return MultiByteToWideChar( CP_ACP, 0, xguid, -1, str, cmax );
    676677}
     
    729730
    730731/******************************************************************************
    731  *              CLSIDFromProgID16       [COMPOBJ.61]
     732 *      CLSIDFromProgID16   [COMPOBJ.61]
    732733 * Converts a program id into the respective GUID. (By using a registry lookup)
    733734 * RETURNS
    734  *      riid associated with the progid
     735 *  riid associated with the progid
    735736 */
    736737HRESULT WINAPI CLSIDFromProgID16(
    737         LPCOLESTR16 progid,     /* [in] program id as found in registry */
    738         LPCLSID riid            /* [out] associated CLSID */
     738    LPCOLESTR16 progid, /* [in] program id as found in registry */
     739    LPCLSID riid        /* [out] associated CLSID */
    739740) {
    740         char    *buf,buf2[80];
    741         DWORD   buf2len;
    742         HRESULT err;
    743         HKEY    xhkey;
    744 
    745         buf = HeapAlloc(GetProcessHeap(),0,strlen(progid)+8);
    746         sprintf(buf,"%s\\CLSID",progid);
    747         if ((err=RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&xhkey))) {
    748                 HeapFree(GetProcessHeap(),0,buf);
     741    char    *buf,buf2[80];
     742    DWORD   buf2len;
     743    HRESULT err;
     744    HKEY    xhkey;
     745
     746    buf = HeapAlloc(GetProcessHeap(),0,strlen(progid)+8);
     747    sprintf(buf,"%s\\CLSID",progid);
     748    if ((err=RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&xhkey))) {
     749        HeapFree(GetProcessHeap(),0,buf);
    749750                return CO_E_CLASSSTRING;
    750         }
    751         HeapFree(GetProcessHeap(),0,buf);
    752         buf2len = sizeof(buf2);
    753         if ((err=RegQueryValueA(xhkey,NULL,buf2,&buf2len))) {
    754                 RegCloseKey(xhkey);
     751    }
     752    HeapFree(GetProcessHeap(),0,buf);
     753    buf2len = sizeof(buf2);
     754    if ((err=RegQueryValueA(xhkey,NULL,buf2,&buf2len))) {
     755        RegCloseKey(xhkey);
    755756                return CO_E_CLASSSTRING;
    756         }
    757         RegCloseKey(xhkey);
    758         return CLSIDFromString16(buf2,riid);
    759 }
    760 
    761 /******************************************************************************
    762  *              CLSIDFromProgID [OLE32.2]
     757    }
     758    RegCloseKey(xhkey);
     759    return CLSIDFromString16(buf2,riid);
     760}
     761
     762/******************************************************************************
     763 *      CLSIDFromProgID [OLE32.2]
    763764 * Converts a program id into the respective GUID. (By using a registry lookup)
    764765 * RETURNS
    765  *      riid associated with the progid
     766 *  riid associated with the progid
    766767 */
    767768HRESULT WINAPI CLSIDFromProgID(
    768         LPCOLESTR progid,       /* [in] program id as found in registry */
    769         LPCLSID riid            /* [out] associated CLSID */
     769    LPCOLESTR progid,   /* [in] program id as found in registry */
     770    LPCLSID riid        /* [out] associated CLSID */
    770771) {
    771         LPOLESTR16 pid = HEAP_strdupWtoA(GetProcessHeap(),0,progid);
    772         HRESULT       ret = CLSIDFromProgID16(pid,riid);
    773 
    774         HeapFree(GetProcessHeap(),0,pid);
    775         return ret;
     772    LPOLESTR16 pid = HEAP_strdupWtoA(GetProcessHeap(),0,progid);
     773    HRESULT       ret = CLSIDFromProgID16(pid,riid);
     774
     775    HeapFree(GetProcessHeap(),0,pid);
     776    return ret;
    776777}
    777778
     
    782783 *
    783784 * This function returns the CLSID of the DLL that implements the proxy and stub
    784  * for the specified interface. 
    785  *
    786  * It determines this by searching the 
     785 * for the specified interface.
     786 *
     787 * It determines this by searching the
    787788 * HKEY_CLASSES_ROOT\Interface\{string form of riid}\ProxyStubClsid32 in the registry
    788789 * and any interface id registered by CoRegisterPSClsid within the current process.
    789  * 
     790 *
    790791 * FIXME: We only search the registry, not ids registered with CoRegisterPSClsid.
    791792 */
     
    822823
    823824    /* ... Once we have the key, query the registry to get the
    824        value of CLSID as a string, and convert it into a 
     825       value of CLSID as a string, and convert it into a
    825826       proper CLSID structure to be passed back to the app */
    826827    buf2len = sizeof(buf2);
     
    846847
    847848/***********************************************************************
    848  *              WriteClassStm
     849 *      WriteClassStm
    849850 *
    850851 * This function write a CLSID on stream
     
    861862
    862863/***********************************************************************
    863  *              ReadClassStm
     864 *      ReadClassStm
    864865 *
    865866 * This function read a CLSID from a stream
     
    869870    ULONG nbByte;
    870871    HRESULT res;
    871    
     872
    872873    TRACE("(%p,%p)\n",pStm,rclsid);
    873874
    874875    if (rclsid==NULL)
    875876        return E_INVALIDARG;
    876    
     877
    877878    res = IStream_Read(pStm,(void*)rclsid,sizeof(CLSID),&nbByte);
    878879
    879880    if (FAILED(res))
    880881        return res;
    881    
     882
    882883    if (nbByte != sizeof(CLSID))
    883884        return S_FALSE;
     
    892893 */
    893894HRESULT WINAPI LookupETask16(HTASK16 *hTask,LPVOID p) {
    894         FIXME("(%p,%p),stub!\n",hTask,p);
    895         if ((*hTask = GetCurrentTask()) == hETask) {
    896                 memcpy(p, Table_ETask, sizeof(Table_ETask));
    897         }
    898         return 0;
     895    FIXME("(%p,%p),stub!\n",hTask,p);
     896    if ((*hTask = GetCurrentTask()) == hETask) {
     897        memcpy(p, Table_ETask, sizeof(Table_ETask));
     898    }
     899    return 0;
    899900}
    900901
     
    905906HRESULT WINAPI SetETask16(HTASK16 hTask, LPVOID p) {
    906907        FIXME("(%04x,%p),stub!\n",hTask,p);
    907         hETask = hTask;
    908         return 0;
     908    hETask = hTask;
     909    return 0;
    909910}
    910911
     
    914915 */
    915916HRESULT WINAPI CallObjectInWOW(LPVOID p1,LPVOID p2) {
    916         FIXME("(%p,%p),stub!\n",p1,p2);
    917         return 0;
    918 }
    919 
    920 /******************************************************************************
    921  *              CoRegisterClassObject16 [COMPOBJ.5]
     917    FIXME("(%p,%p),stub!\n",p1,p2);
     918    return 0;
     919}
     920
     921/******************************************************************************
     922 *      CoRegisterClassObject16 [COMPOBJ.5]
    922923 *
    923924 * Don't know where it registers it ...
    924925 */
    925926HRESULT WINAPI CoRegisterClassObject16(
    926         REFCLSID rclsid,
    927         LPUNKNOWN pUnk,
    928         DWORD dwClsContext, /* [in] CLSCTX flags indicating the context in which to run the executable */
    929         DWORD flags,        /* [in] REGCLS flags indicating how connections are made */
    930         LPDWORD lpdwRegister
     927    REFCLSID rclsid,
     928    LPUNKNOWN pUnk,
     929    DWORD dwClsContext, /* [in] CLSCTX flags indicating the context in which to run the executable */
     930    DWORD flags,        /* [in] REGCLS flags indicating how connections are made */
     931    LPDWORD lpdwRegister
    931932) {
    932         char    buf[80];
    933 
    934         WINE_StringFromCLSID(rclsid,buf);
    935 
    936         FIXME("(%s,%p,0x%08lx,0x%08lx,%p),stub\n",
    937                 buf,pUnk,dwClsContext,flags,lpdwRegister
    938         );
    939         return 0;
     933    char    buf[80];
     934
     935    WINE_StringFromCLSID(rclsid,buf);
     936
     937    FIXME("(%s,%p,0x%08lx,0x%08lx,%p),stub\n",
     938        buf,pUnk,dwClsContext,flags,lpdwRegister
     939    );
     940    return 0;
    940941}
    941942
     
    956957 * COM_GetRegisteredClassObject
    957958 *
    958  * This internal method is used to scan the registered class list to 
     959 * This internal method is used to scan the registered class list to
    959960 * find a class object.
    960961 *
    961  * Params: 
     962 * Params:
    962963 *   rclsid        Class ID of the class to find.
    963964 *   dwClsContext  Class context to match.
     
    967968 */
    968969static HRESULT COM_GetRegisteredClassObject(
    969         REFCLSID    rclsid,
    970         DWORD       dwClsContext,
    971         LPUNKNOWN*  ppUnk)
     970    REFCLSID    rclsid,
     971    DWORD       dwClsContext,
     972    LPUNKNOWN*  ppUnk)
    972973{
    973974  RegisteredClass* curClass;
     
    10181019
    10191020/******************************************************************************
    1020  *              CoRegisterClassObject   [OLE32.36]
     1021 *      CoRegisterClassObject   [OLE32.36]
    10211022 *
    10221023 * This method will register the class object for a given class ID.
     
    10251026 */
    10261027HRESULT WINAPI CoRegisterClassObject(
    1027         REFCLSID rclsid,
    1028         LPUNKNOWN pUnk,
    1029         DWORD dwClsContext, /* [in] CLSCTX flags indicating the context in which to run the executable */
    1030         DWORD flags,        /* [in] REGCLS flags indicating how connections are made */
    1031         LPDWORD lpdwRegister
    1032 ) 
     1028    REFCLSID rclsid,
     1029    LPUNKNOWN pUnk,
     1030    DWORD dwClsContext, /* [in] CLSCTX flags indicating the context in which to run the executable */
     1031    DWORD flags,        /* [in] REGCLS flags indicating how connections are made */
     1032    LPDWORD lpdwRegister
     1033)
    10331034{
    10341035  RegisteredClass* newClass;
     
    10401041
    10411042  TRACE("(%s,%p,0x%08lx,0x%08lx,%p)\n",
    1042         buf,pUnk,dwClsContext,flags,lpdwRegister);
     1043    buf,pUnk,dwClsContext,flags,lpdwRegister);
    10431044
    10441045  /*
     
    10711072    return CO_E_OBJISREG;
    10721073  }
    1073    
     1074
    10741075  /*
    10751076   * If it is not registered, we must create a new entry for this class and
     
    11021103   */
    11031104  *lpdwRegister = newClass->dwCookie;
    1104    
     1105
    11051106  /*
    11061107   * We're successful Yippee!
     
    11171118 */
    11181119HRESULT WINAPI CoRevokeClassObject(
    1119         DWORD dwRegister) 
     1120        DWORD dwRegister)
    11201121{
    11211122  RegisteredClass** prevClassLink;
     
    11751176    REFIID iid, LPVOID *ppv
    11761177) {
    1177     LPUNKNOWN   regClassObject;
    1178     HRESULT     hres = E_UNEXPECTED;
    1179     char        xclsid[80];
     1178    LPUNKNOWN   regClassObject;
     1179    HRESULT hres = E_UNEXPECTED;
     1180    char    xclsid[80];
    11801181    WCHAR dllName[MAX_PATH+1];
    11811182    DWORD dllNameLen = sizeof(dllName);
    11821183    HINSTANCE hLibrary;
    11831184#ifdef __WIN32OS2__
    1184     typedef HRESULT (* CALLBACK DllGetClassObjectFunc)(REFCLSID clsid, 
    1185                              REFIID iid, LPVOID *ppv);
     1185    typedef HRESULT (* CALLBACK DllGetClassObjectFunc)(REFCLSID clsid,
     1186                 REFIID iid, LPVOID *ppv);
    11861187#else
    1187     typedef HRESULT CALLBACK (*DllGetClassObjectFunc)(REFCLSID clsid, 
    1188                              REFIID iid, LPVOID *ppv);
     1188    typedef HRESULT CALLBACK (*DllGetClassObjectFunc)(REFCLSID clsid,
     1189                 REFIID iid, LPVOID *ppv);
    11891190#endif
    11901191    DllGetClassObjectFunc DllGetClassObject;
     
    11931194
    11941195    TRACE("\n\tCLSID:\t%s,\n\tIID:\t%s\n",
    1195         debugstr_guid(rclsid),
    1196         debugstr_guid(iid)
     1196    debugstr_guid(rclsid),
     1197    debugstr_guid(iid)
    11971198    );
    11981199
    11991200    if (pServerInfo) {
    1200         FIXME("\tpServerInfo: name=%s\n",debugstr_w(pServerInfo->pwszName));
    1201         FIXME("\t\tpAuthInfo=%p\n",pServerInfo->pAuthInfo);
     1201    FIXME("\tpServerInfo: name=%s\n",debugstr_w(pServerInfo->pwszName));
     1202    FIXME("\t\tpAuthInfo=%p\n",pServerInfo->pAuthInfo);
    12021203    }
    12031204
    12041205    /*
    1205      * First, try and see if we can't match the class ID with one of the 
     1206     * First, try and see if we can't match the class ID with one of the
    12061207     * registered classes.
    12071208     */
     
    12281229    ){
    12291230        FIXME("%s %s not supported!\n",
    1230                 (dwClsContext&CLSCTX_LOCAL_SERVER)?"CLSCTX_LOCAL_SERVER":"",
    1231                 (dwClsContext&CLSCTX_REMOTE_SERVER)?"CLSCTX_REMOTE_SERVER":""
    1232         );
    1233         return E_ACCESSDENIED;
     1231        (dwClsContext&CLSCTX_LOCAL_SERVER)?"CLSCTX_LOCAL_SERVER":"",
     1232        (dwClsContext&CLSCTX_REMOTE_SERVER)?"CLSCTX_REMOTE_SERVER":""
     1233    );
     1234    return E_ACCESSDENIED;
    12341235    }
    12351236
    12361237    if ((CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER) & dwClsContext) {
    12371238        HKEY key;
    1238         char buf[200];
    1239 
    1240         sprintf(buf,"CLSID\\%s\\InprocServer32",xclsid);
     1239    char buf[200];
     1240
     1241    sprintf(buf,"CLSID\\%s\\InprocServer32",xclsid);
    12411242        hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, buf, 0, KEY_READ, &key);
    12421243
    1243         if (hres != ERROR_SUCCESS) {
    1244             return REGDB_E_CLASSNOTREG;
    1245         }
    1246 
    1247         memset(dllName,0,sizeof(dllName));
    1248         hres= RegQueryValueExW(key,NULL,NULL,NULL,(LPBYTE)dllName,&dllNameLen);
    1249         if (hres)
    1250                 return REGDB_E_CLASSNOTREG; /* FIXME: check retval */
    1251         RegCloseKey(key);
    1252         TRACE("found InprocServer32 dll %s\n", debugstr_w(dllName));
    1253 
    1254         /* open dll, call DllGetClassObject */
    1255         hLibrary = CoLoadLibrary(dllName, TRUE);
    1256         if (hLibrary == 0) {
    1257             FIXME("couldn't load InprocServer32 dll %s\n", debugstr_w(dllName));
    1258             return E_ACCESSDENIED; /* or should this be CO_E_DLLNOTFOUND? */
    1259         }
    1260         DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject");
    1261         if (!DllGetClassObject) {
    1262             /* not sure if this should be called here CoFreeLibrary(hLibrary);*/
    1263             FIXME("couldn't find function DllGetClassObject in %s\n", debugstr_w(dllName));
    1264             return E_ACCESSDENIED;
    1265         }
    1266 
    1267         /*
    1268         * Ask the DLL for its class object. (there was a note here about class
    1269         * factories but this is good.
    1270         */
    1271         return DllGetClassObject(rclsid, iid, ppv);
     1244    if (hres != ERROR_SUCCESS) {
     1245        return REGDB_E_CLASSNOTREG;
     1246    }
     1247
     1248    memset(dllName,0,sizeof(dllName));
     1249    hres= RegQueryValueExW(key,NULL,NULL,NULL,(LPBYTE)dllName,&dllNameLen);
     1250    if (hres)
     1251        return REGDB_E_CLASSNOTREG; /* FIXME: check retval */
     1252    RegCloseKey(key);
     1253    TRACE("found InprocServer32 dll %s\n", debugstr_w(dllName));
     1254
     1255    /* open dll, call DllGetClassObject */
     1256    hLibrary = CoLoadLibrary(dllName, TRUE);
     1257    if (hLibrary == 0) {
     1258        FIXME("couldn't load InprocServer32 dll %s\n", debugstr_w(dllName));
     1259        return E_ACCESSDENIED; /* or should this be CO_E_DLLNOTFOUND? */
     1260    }
     1261    DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject");
     1262    if (!DllGetClassObject) {
     1263        /* not sure if this should be called here CoFreeLibrary(hLibrary);*/
     1264        FIXME("couldn't find function DllGetClassObject in %s\n", debugstr_w(dllName));
     1265        return E_ACCESSDENIED;
     1266    }
     1267
     1268    /*
     1269    * Ask the DLL for its class object. (there was a note here about class
     1270    * factories but this is good.
     1271    */
     1272    return DllGetClassObject(rclsid, iid, ppv);
    12721273    }
    12731274    return hres;
     
    12811282HRESULT WINAPI CoResumeClassObjects(void)
    12821283{
    1283         FIXME("\n");
    1284         return S_OK;
     1284    FIXME("\n");
     1285    return S_OK;
    12851286}
    12861287
     
    13161317       pattern in the registry. this case is not frequently used ! so I present only the psodocode for
    13171318       this case
    1318        
     1319
    13191320     for(i=0;i<nFileTypes;i++)
    13201321
     
    13491350    length=lstrlenW(absFile);
    13501351    for(i=length-1; ( (i>=0) && (extention[i]=absFile[i]) );i--);
    1351        
     1352
    13521353    /* get the progId associated to the extension */
    13531354    progId=CoTaskMemAlloc(sizeProgId);
     
    13771378#ifndef __WIN32OS2__
    13781379/******************************************************************************
    1379  *              CoRegisterMessageFilter16       [COMPOBJ.27]
     1380 *      CoRegisterMessageFilter16   [COMPOBJ.27]
    13801381 */
    13811382HRESULT WINAPI CoRegisterMessageFilter16(
    1382         LPMESSAGEFILTER lpMessageFilter,
    1383         LPMESSAGEFILTER *lplpMessageFilter
     1383    LPMESSAGEFILTER lpMessageFilter,
     1384    LPMESSAGEFILTER *lplpMessageFilter
    13841385) {
    1385         FIXME("(%p,%p),stub!\n",lpMessageFilter,lplpMessageFilter);
    1386         return 0;
     1386    FIXME("(%p,%p),stub!\n",lpMessageFilter,lplpMessageFilter);
     1387    return 0;
    13871388}
    13881389#endif
     
    13921393 */
    13931394HRESULT WINAPI CoCreateInstance(
    1394         REFCLSID rclsid,
    1395         LPUNKNOWN pUnkOuter,
    1396         DWORD dwClsContext,
    1397         REFIID iid,
    1398         LPVOID *ppv)
    1399 {
    1400         HRESULT hres;
    1401         LPCLASSFACTORY lpclf = 0;
     1395    REFCLSID rclsid,
     1396    LPUNKNOWN pUnkOuter,
     1397    DWORD dwClsContext,
     1398    REFIID iid,
     1399    LPVOID *ppv)
     1400{
     1401    HRESULT hres;
     1402    LPCLASSFACTORY lpclf = 0;
    14021403
    14031404  /*
     
    14111412   */
    14121413  *ppv = 0;
    1413  
     1414
    14141415  /*
    14151416   * Get a class factory to construct the object we want.
    14161417   */
    14171418  hres = CoGetClassObject(rclsid,
    1418                           dwClsContext,
    1419                           NULL,
    1420                           &IID_IClassFactory,
    1421                           (LPVOID)&lpclf);
     1419              dwClsContext,
     1420              NULL,
     1421              &IID_IClassFactory,
     1422              (LPVOID)&lpclf);
    14221423
    14231424  if (FAILED(hres)) {
     
    14291430   * Create the object and don't forget to release the factory
    14301431   */
    1431         hres = IClassFactory_CreateInstance(lpclf, pUnkOuter, iid, ppv);
    1432         IClassFactory_Release(lpclf);
    1433 
    1434         return hres;
     1432    hres = IClassFactory_CreateInstance(lpclf, pUnkOuter, iid, ppv);
     1433    IClassFactory_Release(lpclf);
     1434
     1435    return hres;
    14351436}
    14361437
     
    14391440 */
    14401441HRESULT WINAPI CoCreateInstanceEx(
    1441   REFCLSID      rclsid, 
     1442  REFCLSID      rclsid,
    14421443  LPUNKNOWN     pUnkOuter,
    1443   DWORD         dwClsContext, 
     1444  DWORD         dwClsContext,
    14441445  COSERVERINFO* pServerInfo,
    14451446  ULONG         cmq,
     
    14721473   * Get the object and get its IUnknown pointer.
    14731474   */
    1474   hr = CoCreateInstance(rclsid, 
    1475                         pUnkOuter,
    1476                         dwClsContext,
    1477                         &IID_IUnknown,
    1478                         (VOID**)&pUnk);
     1475  hr = CoCreateInstance(rclsid,
     1476            pUnkOuter,
     1477            dwClsContext,
     1478            &IID_IUnknown,
     1479            (VOID**)&pUnk);
    14791480
    14801481  if (hr)
     
    14871488  {
    14881489    pResults[index].hr = IUnknown_QueryInterface(pUnk,
    1489                                                 pResults[index].pIID,
    1490                                                 (VOID**)&(pResults[index].pItf));
     1490                        pResults[index].pIID,
     1491                        (VOID**)&(pResults[index].pItf));
    14911492
    14921493    if (pResults[index].hr == S_OK)
     
    15191520    prev = NULL;
    15201521    for (ptr = openDllList; ptr != NULL; ptr=ptr->next) {
    1521         if (ptr->hLibrary == hLibrary) {
    1522             break;
    1523         }
    1524         prev = ptr;
     1522    if (ptr->hLibrary == hLibrary) {
     1523        break;
     1524    }
     1525    prev = ptr;
    15251526    }
    15261527
    15271528    if (ptr == NULL) {
    1528         /* shouldn't happen if user passed in a valid hLibrary */
    1529         return;
     1529    /* shouldn't happen if user passed in a valid hLibrary */
     1530    return;
    15301531    }
    15311532    /* assert: ptr points to the library entry to free */
     
    15341535    FreeLibrary(hLibrary);
    15351536    if (ptr == openDllList) {
    1536         tmp = openDllList->next;
    1537         HeapFree(GetProcessHeap(), 0, openDllList);
    1538         openDllList = tmp;
     1537    tmp = openDllList->next;
     1538    HeapFree(GetProcessHeap(), 0, openDllList);
     1539    openDllList = tmp;
    15391540    } else {
    1540         tmp = ptr->next;
    1541         HeapFree(GetProcessHeap(), 0, ptr);
    1542         prev->next = tmp;
     1541    tmp = ptr->next;
     1542    HeapFree(GetProcessHeap(), 0, ptr);
     1543    prev->next = tmp;
    15431544    }
    15441545
     
    15541555
    15551556    for (ptr = openDllList; ptr != NULL; ) {
    1556         tmp=ptr->next;
    1557         CoFreeLibrary(ptr->hLibrary);
    1558         ptr = tmp;
     1557    tmp=ptr->next;
     1558    CoFreeLibrary(ptr->hLibrary);
     1559    ptr = tmp;
    15591560    }
    15601561}
     
    15721573
    15731574    for (ptr = openDllList; ptr != NULL; ) {
    1574         DllCanUnloadNow = (DllCanUnloadNowFunc)
    1575             GetProcAddress(ptr->hLibrary, "DllCanUnloadNow");
    1576        
    1577         if ( (DllCanUnloadNow != NULL) &&
    1578              (DllCanUnloadNow() == S_OK) ) {
    1579             tmp=ptr->next;
    1580             CoFreeLibrary(ptr->hLibrary);
    1581             ptr = tmp;
    1582         } else {
    1583             ptr=ptr->next;
    1584         }
     1575    DllCanUnloadNow = (DllCanUnloadNowFunc)
     1576        GetProcAddress(ptr->hLibrary, "DllCanUnloadNow");
     1577
     1578    if ( (DllCanUnloadNow != NULL) &&
     1579         (DllCanUnloadNow() == S_OK) ) {
     1580        tmp=ptr->next;
     1581        CoFreeLibrary(ptr->hLibrary);
     1582        ptr = tmp;
     1583    } else {
     1584        ptr=ptr->next;
     1585    }
    15851586    }
    15861587}
     
    15891590 *           CoFileTimeNow [COMPOBJ.82, OLE32.10]
    15901591 * RETURNS
    1591  *      the current system time in lpFileTime
     1592 *  the current system time in lpFileTime
    15921593 */
    15931594HRESULT WINAPI CoFileTimeNow( FILETIME *lpFileTime ) /* [out] the current time */
     
    16001601 *           CoTaskMemAlloc (OLE32.43)
    16011602 * RETURNS
    1602  *      pointer to newly allocated block
     1603 *  pointer to newly allocated block
    16031604 */
    16041605LPVOID WINAPI CoTaskMemAlloc(
    1605         ULONG size      /* [in] size of memoryblock to be allocated */
     1606    ULONG size  /* [in] size of memoryblock to be allocated */
    16061607) {
    1607     LPMALLOC    lpmalloc;
    1608     HRESULT     ret = CoGetMalloc(0,&lpmalloc);
    1609 
    1610     if (FAILED(ret)) 
    1611         return NULL;
     1608    LPMALLOC    lpmalloc;
     1609    HRESULT ret = CoGetMalloc(0,&lpmalloc);
     1610
     1611    if (FAILED(ret))
     1612    return NULL;
    16121613
    16131614    return IMalloc_Alloc(lpmalloc,size);
     
    16171618 */
    16181619VOID WINAPI CoTaskMemFree(
    1619         LPVOID ptr      /* [in] pointer to be freed */
     1620    LPVOID ptr  /* [in] pointer to be freed */
    16201621) {
    1621     LPMALLOC    lpmalloc;
    1622     HRESULT     ret = CoGetMalloc(0,&lpmalloc);
    1623 
    1624     if (FAILED(ret)) 
     1622    LPMALLOC    lpmalloc;
     1623    HRESULT ret = CoGetMalloc(0,&lpmalloc);
     1624
     1625    if (FAILED(ret))
    16251626      return;
    16261627
     
    16311632 *           CoTaskMemRealloc (OLE32.45)
    16321633 * RETURNS
    1633  *      pointer to newly allocated block
     1634 *  pointer to newly allocated block
    16341635 */
    16351636LPVOID WINAPI CoTaskMemRealloc(
    16361637  LPVOID pvOld,
    1637   ULONG  size)  /* [in] size of memoryblock to be allocated */
     1638  ULONG  size)  /* [in] size of memoryblock to be allocated */
    16381639{
    16391640  LPMALLOC lpmalloc;
    16401641  HRESULT  ret = CoGetMalloc(0,&lpmalloc);
    1641  
    1642   if (FAILED(ret)) 
     1642
     1643  if (FAILED(ret))
    16431644    return NULL;
    16441645
     
    16541655    OpenDll *ptr;
    16551656    OpenDll *tmp;
    1656  
     1657
    16571658    TRACE("(%s, %d)\n", debugstr_w(lpszLibName), bAutoFree);
    16581659
     
    16601661
    16611662    if (!bAutoFree)
    1662         return hLibrary;
     1663    return hLibrary;
    16631664
    16641665    if (openDllList == NULL) {
    16651666        /* empty list -- add first node */
    16661667        openDllList = (OpenDll*)HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll));
    1667         openDllList->hLibrary=hLibrary;
    1668         openDllList->next = NULL;
     1668    openDllList->hLibrary=hLibrary;
     1669    openDllList->next = NULL;
    16691670    } else {
    16701671        /* search for this dll */
    16711672        int found = FALSE;
    16721673        for (ptr = openDllList; ptr->next != NULL; ptr=ptr->next) {
    1673             if (ptr->hLibrary == hLibrary) {
    1674                 found = TRUE;
    1675                 break;
    1676             }
     1674        if (ptr->hLibrary == hLibrary) {
     1675            found = TRUE;
     1676        break;
    16771677        }
    1678         if (!found) {
    1679             /* dll not found, add it */
    1680             tmp = openDllList;
    1681             openDllList = (OpenDll*)HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll));
    1682             openDllList->hLibrary = hLibrary;
    1683             openDllList->next = tmp;
    1684         }
    1685     }
    1686      
     1678        }
     1679    if (!found) {
     1680        /* dll not found, add it */
     1681        tmp = openDllList;
     1682        openDllList = (OpenDll*)HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll));
     1683        openDllList->hLibrary = hLibrary;
     1684        openDllList->next = tmp;
     1685    }
     1686    }
     1687
    16871688    return hLibrary;
    16881689}
     
    16981699#ifndef __WIN32OS2__
    16991700/******************************************************************************
    1700  *              CoLockObjectExternal16  [COMPOBJ.63]
     1701 *      CoLockObjectExternal16  [COMPOBJ.63]
    17011702 */
    17021703HRESULT WINAPI CoLockObjectExternal16(
    1703     LPUNKNOWN pUnk,             /* [in] object to be locked */
    1704     BOOL16 fLock,               /* [in] do lock */
    1705     BOOL16 fLastUnlockReleases  /* [in] ? */
     1704    LPUNKNOWN pUnk,     /* [in] object to be locked */
     1705    BOOL16 fLock,       /* [in] do lock */
     1706    BOOL16 fLastUnlockReleases  /* [in] ? */
    17061707) {
    17071708    FIXME("(%p,%d,%d),stub!\n",pUnk,fLock,fLastUnlockReleases);
     
    17111712
    17121713/******************************************************************************
    1713  *              CoLockObjectExternal    [OLE32.31]
     1714 *      CoLockObjectExternal    [OLE32.31]
    17141715 */
    17151716HRESULT WINAPI CoLockObjectExternal(
    1716     LPUNKNOWN pUnk,             /* [in] object to be locked */
    1717     BOOL fLock,         /* [in] do lock */
     1717    LPUNKNOWN pUnk,     /* [in] object to be locked */
     1718    BOOL fLock,     /* [in] do lock */
    17181719    BOOL fLastUnlockReleases) /* [in] unlock all */
    17191720{
    17201721
    1721   if (fLock) 
     1722  if (fLock)
    17221723  {
    1723     /* 
     1724    /*
    17241725     * Increment the external lock coutner, COM_ExternalLockAddRef also
    17251726     * increment the object's internal lock counter.
    17261727     */
    1727     COM_ExternalLockAddRef( pUnk); 
     1728    COM_ExternalLockAddRef( pUnk);
    17281729  }
    17291730  else
    17301731  {
    1731     /* 
     1732    /*
    17321733     * Decrement the external lock coutner, COM_ExternalLockRelease also
    17331734     * decrement the object's internal lock counter.
     
    17651766{
    17661767   FIXME ("(%p %p): stub\n", punkOuter, ppunkMarshal);
    1767    
     1768
    17681769   return S_OK;
    17691770}
     
    17741775 */
    17751776HRESULT WINAPI OLE32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
    1776 {       
    1777         FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
    1778         *ppv = NULL;
    1779         return CLASS_E_CLASSNOTAVAILABLE;
     1777{
     1778    FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
     1779    *ppv = NULL;
     1780    return CLASS_E_CLASSNOTAVAILABLE;
    17801781}
    17811782
     
    17841785 * COM_RevokeAllClasses
    17851786 *
    1786  * This method is called when the COM libraries are uninitialized to 
     1787 * This method is called when the COM libraries are uninitialized to
    17871788 * release all the references to the class objects registered with
    17881789 * the library
     
    18011802
    18021803/****************************************************************************
    1803  * Public - Method that increments the count for a IUnknown* in the linked 
     1804 * Public - Method that increments the count for a IUnknown* in the linked
    18041805 * list.  The item is inserted if not already in the list.
    18051806 */
     
    18221823   * Add an internal lock to the object
    18231824   */
    1824   IUnknown_AddRef(pUnk); 
     1825  IUnknown_AddRef(pUnk);
    18251826}
    18261827
    18271828/****************************************************************************
    1828  * Public - Method that decrements the count for a IUnknown* in the linked 
     1829 * Public - Method that decrements the count for a IUnknown* in the linked
    18291830 * list.  The item is removed from the list if its count end up at zero or if
    18301831 * bRelAll is TRUE.
     
    18431844      IUnknown_Release(pUnk);     /* release local locks as well */
    18441845
    1845       if ( bRelAll == FALSE ) 
     1846      if ( bRelAll == FALSE )
    18461847        break;  /* perform single release */
    18471848
    1848     } while ( externalLock->uRefCount > 0 ); 
     1849    } while ( externalLock->uRefCount > 0 );
    18491850
    18501851    if ( externalLock->uRefCount == 0 )  /* get rid of the list entry */
     
    18641865    COM_ExternalLockDelete(head);     /* get rid of the head stuff       */
    18651866
    1866     head = elList.head;               /* get the new head...             */ 
     1867    head = elList.head;               /* get the new head...             */
    18671868  }
    18681869}
     
    18801881  {
    18811882      DPRINTF( "\t%p with %lu references count.\n", current->pUnk, current->uRefCount);
    1882  
    1883     /* Skip to the next item */ 
     1883
     1884    /* Skip to the next item */
    18841885    current = current->next;
    1885   } 
     1886  }
    18861887
    18871888}
     
    19031904  IUnknown         *pUnk)
    19041905{
    1905   if ( element == EL_END_OF_LIST ) 
     1906  if ( element == EL_END_OF_LIST )
    19061907    return EL_NOT_FOUND;
    19071908
     
    19091910    return element;
    19101911
    1911   else                                 /* Not the right guy, keep on looking */ 
     1912  else                                 /* Not the right guy, keep on looking */
    19121913    return COM_ExternalLockLocate( element->next, pUnk);
    19131914}
     
    19291930  if (newLock!=NULL)
    19301931  {
    1931     if ( elList.head == EL_END_OF_LIST ) 
     1932    if ( elList.head == EL_END_OF_LIST )
    19321933    {
    19331934      elList.head = newLock;    /* The list is empty */
    19341935    }
    1935     else 
     1936    else
    19361937    {
    1937       /* 
     1938      /*
    19381939       * insert does it at the head
    19391940       */
     
    19431944
    19441945    /*
    1945      * Set new list item data member 
     1946     * Set new list item data member
    19461947     */
    19471948    newLock->pUnk      = pUnk;
    19481949    newLock->uRefCount = 1;
    19491950    newLock->next      = previousHead;
    1950    
     1951
    19511952    return TRUE;
    19521953  }
     
    19651966  if ( current == itemList )
    19661967  {
    1967     /* 
    1968      * this section handles the deletion of the first node 
     1968    /*
     1969     * this section handles the deletion of the first node
    19691970     */
    19701971    elList.head = itemList->next;
    1971     HeapFree( GetProcessHeap(), 0, itemList); 
     1972    HeapFree( GetProcessHeap(), 0, itemList);
    19721973  }
    19731974  else
    19741975  {
    1975     do 
     1976    do
    19761977    {
    19771978      if ( current->next == itemList )   /* We found the item to free  */
    19781979      {
    19791980        current->next = itemList->next;  /* readjust the list pointers */
    1980  
    1981         HeapFree( GetProcessHeap(), 0, itemList); 
    1982         break; 
     1981
     1982        HeapFree( GetProcessHeap(), 0, itemList);
     1983        break;
    19831984      }
    1984  
    1985       /* Skip to the next item */ 
     1985
     1986      /* Skip to the next item */
    19861987      current = current->next;
    1987  
     1988
    19881989    } while ( current != EL_END_OF_LIST );
    19891990  }
     
    20312032    {
    20322033        res = REGDB_E_CLASSNOTREG;
    2033         goto done;
     2034    goto done;
    20342035    }
    20352036    len = 200;
     
    20392040    {
    20402041        res = REGDB_E_KEYMISSING;
    2041         goto done;
     2042    goto done;
    20422043    }
    20432044    MultiByteToWideChar( CP_ACP, 0, buf, -1, wbuf, sizeof(wbuf)/sizeof(WCHAR) );
     
    20642065    {
    20652066        res = REGDB_E_CLASSNOTREG;
    2066         goto done;
     2067    goto done;
    20672068    }
    20682069    if (RegCreateKeyA(hkey, "AutoConvertTo", &hkeyConvert))
    20692070    {
    20702071        res = REGDB_E_WRITEREGDB;
    2071         goto done;
     2072    goto done;
    20722073    }
    20732074    if (RegSetValueExA(hkeyConvert, NULL, 0,
     
    20752076    {
    20762077        res = REGDB_E_WRITEREGDB;
    2077         goto done;
     2078    goto done;
    20782079    }
    20792080
     
    20912092 *
    20922093 * RETURNS
    2093  *      TRUE if equal
     2094 *  TRUE if equal
    20942095 */
    20952096#undef IsEqualGUID
     
    21102111
    21112112HRESULT WIN32API CLSIDFromStringA(
    2112     LPCSTR              lpsz,           // [in] - ASCII string CLSID
    2113     LPCLSID             pclsid)         // [out] - Binary CLSID
     2113    LPCSTR      lpsz,       // [in] - ASCII string CLSID
     2114    LPCLSID     pclsid)     // [out] - Binary CLSID
    21142115{
    21152116    return CLSIDFromString16(lpsz, pclsid);
  • trunk/src/ole32/compositemoniker.c

    r5602 r6648  
     1/* $Id: compositemoniker.c,v 1.2 2001-09-05 13:17:08 bird Exp $ */
    12/***************************************************************************************
    2  *                            CompositeMonikers implementation
     3 *                        CompositeMonikers implementation
    34 *
    45 *               Copyright 1999  Noomen Hamza
     
    2627    ICOM_VTABLE(IMoniker)*  lpvtbl1;  /* VTable relative to the IMoniker interface.*/
    2728
    28     /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 
     29    /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether
    2930     * two monikers are equal. That's whay IROTData interface is implemented by monikers.
    3031     */
     
    186187{
    187188    ICOM_THIS(CompositeMonikerImpl,iface);
    188  
     189
    189190    TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
    190191
    191192    /* Perform a sanity check on the parameters.*/
    192193    if ( (This==0) || (ppvObject==0) )
    193         return E_INVALIDARG;
    194  
     194    return E_INVALIDARG;
     195
    195196    /* Initialize the return parameter */
    196197    *ppvObject = 0;
     
    235236    ICOM_THIS(CompositeMonikerImpl,iface);
    236237    ULONG i;
    237    
     238
    238239    TRACE("(%p)\n",This);
    239240
     
    246247        for (i=0;i<This->tabLastIndex;i++)
    247248            IMoniker_Release(This->tabMoniker[i]);
    248        
     249
    249250        CompositeMonikerImpl_Destroy(This);
    250251
     
    263264    if (pClassID==NULL)
    264265        return E_POINTER;
    265            
     266
    266267    *pClassID = CLSID_CompositeMoniker;
    267        
     268
    268269    return S_OK;
    269270}
     
    292293    CLSID clsid;
    293294    WCHAR string[1]={0};
    294    
    295     ICOM_THIS(CompositeMonikerImpl,iface);   
     295
     296    ICOM_THIS(CompositeMonikerImpl,iface);
    296297
    297298    TRACE("(%p,%p)\n",iface,pStm);
     
    349350        /* resize the table if needed */
    350351        if (++This->tabLastIndex==This->tabSize){
    351                
     352
    352353            This->tabSize+=BLOCK_TAB_SIZE;
    353354            This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker));
     
    370371    IMoniker *pmk;
    371372    DWORD constant=3;
    372    
     373
    373374    TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty);
    374375
     
    445446    IMoniker *tempMk;
    446447    HRESULT res;
    447    
     448
    448449    TRACE("(%p,%p,%p)\n",This,pmkFirst,pmkRest);
    449450
     
    471472
    472473        IMoniker_Enum(pmkFirst,TRUE,&enumMoniker);
    473        
     474
    474475        while(IEnumMoniker_Next(enumMoniker,1,&This->tabMoniker[This->tabLastIndex],NULL)==S_OK){
    475476
    476477
    477478            if (++This->tabLastIndex==This->tabSize){
    478                
     479
    479480                This->tabSize+=BLOCK_TAB_SIZE;
    480481                This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker));
     
    491492
    492493    IMoniker_IsSystemMoniker(pmkRest,&mkSys);
    493    
     494
    494495    if (mkSys!=MKSYS_GENERICCOMPOSITE){
    495496
     
    498499        res=IMoniker_ComposeWith(This->tabMoniker[This->tabLastIndex-1],pmkRest,TRUE,&tempMk);
    499500
    500         if (res==MK_E_NEEDGENERIC){ 
     501        if (res==MK_E_NEEDGENERIC){
    501502
    502503            /* there's no simplification in this case */
     
    507508            IMoniker_AddRef(pmkRest);
    508509        }
    509         else if (tempMk==NULL){ 
     510        else if (tempMk==NULL){
    510511
    511512            /* we have an antimoniker after a simple moniker so we can make a simplification in this case */
     
    525526        /* resize tabMoniker if needed */
    526527        if (This->tabLastIndex==This->tabSize){
    527                
     528
    528529            This->tabSize+=BLOCK_TAB_SIZE;
    529530
     
    562563
    563564            if (This->tabLastIndex==This->tabSize){
    564                
     565
    565566                This->tabSize+=BLOCK_TAB_SIZE;
    566567
     
    605606    IMoniker *tempMk,*antiMk,*mostRigthMk;
    606607    IEnumMoniker *enumMoniker;
    607    
     608
    608609    TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
    609610
    610611    if (ppvResult==NULL)
    611612        return E_POINTER;
    612    
     613
    613614    *ppvResult=0;
    614615    /* If pmkToLeft is NULL, this method looks for the moniker in the ROT, and if found, queries the retrieved */
     
    634635        IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
    635636        IEnumMoniker_Release(enumMoniker);
    636        
     637
    637638        res=CreateAntiMoniker(&antiMk);
    638639        res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
    639640        IMoniker_Release(antiMk);
    640        
     641
    641642        res=CompositeMonikerImpl_BindToObject(mostRigthMk,pbc,tempMk,riid,ppvResult);
    642643
     
    669670
    670671    if (pmkToLeft!=NULL){
    671        
     672
    672673        IMoniker_Enum(iface,FALSE,&enumMoniker);
    673674        IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
    674675        IEnumMoniker_Release(enumMoniker);
    675        
     676
    676677        res=CreateAntiMoniker(&antiMk);
    677678        res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
    678679        IMoniker_Release(antiMk);
    679        
     680
    680681        res=CompositeMonikerImpl_BindToStorage(mostRigthMk,pbc,tempMk,riid,ppvResult);
    681682
     
    715716        IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
    716717        IEnumMoniker_Release(enumMoniker);
    717        
     718
    718719        res=CreateAntiMoniker(&antiMk);
    719720        res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
     
    732733        IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
    733734        IEnumMoniker_Release(enumMoniker);
    734        
     735
    735736        res=CreateAntiMoniker(&antiMk);
    736737        res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
     
    768769
    769770    if ((ppmkComposite==NULL)||(pmkRight==NULL))
    770         return E_POINTER;
     771    return E_POINTER;
    771772
    772773    *ppmkComposite=0;
     
    775776    /* otherwise, the method returns the result of combining the two monikers by calling the */
    776777    /* CreateGenericComposite function */
    777    
     778
    778779    if (fOnlyIfNotGeneric)
    779780        return MK_E_NEEDGENERIC;
    780    
     781
    781782    return CreateGenericComposite(iface,pmkRight,ppmkComposite);
    782783}
     
    793794    if (ppenumMoniker == NULL)
    794795        return E_POINTER;
    795    
     796
    796797    return EnumMonikerImpl_CreateEnumMoniker(This->tabMoniker,This->tabLastIndex,0,fForward,ppenumMoniker);
    797798}
     
    805806    IMoniker *tempMk1,*tempMk2;
    806807    HRESULT res1,res2,res;
    807    
     808
    808809    TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
    809810
     
    817818    if (enumMoniker1==NULL)
    818819        return S_FALSE;
    819    
     820
    820821    IMoniker_Enum(iface,TRUE,&enumMoniker2);
    821822
     
    824825        res1=IEnumMoniker_Next(enumMoniker1,1,&tempMk1,NULL);
    825826        res2=IEnumMoniker_Next(enumMoniker2,1,&tempMk2,NULL);
    826        
     827
    827828        if((res1==S_OK)&&(res2==S_OK)){
    828829
     
    894895        /* If pmkToLeft is NULL, this method returns S_OK if pmkNewlyRunning is non-NULL and is equal */
    895896        /* to this moniker */
    896        
     897
    897898        if (pmkNewlyRunning!=NULL)
    898899
     
    912913            /* IMoniker::IsRunning on the rightmost component of the composite, passing the remainder of */
    913914            /* the composite as the pmkToLeft parameter for that call.                                   */
    914            
     915
    915916             res=IBindCtx_GetRunningObjectTable(pbc,&rot);
    916917
     
    956957    IMoniker *tempMk,*antiMk,*mostRigthMk;
    957958    IEnumMoniker *enumMoniker;
    958    
     959
    959960    TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pCompositeTime);
    960961
     
    10531054    IEnumMoniker *enumMoniker1,*enumMoniker2;
    10541055    ULONG i,nbCommonMk=0;
    1055    
     1056
    10561057    /* If the other moniker is a composite, this method compares the components of each composite from left  */
    10571058    /* to right. The returned common prefix moniker might also be a composite moniker, depending on how many */
     
    10601061    if (ppmkPrefix==NULL)
    10611062        return E_POINTER;
    1062    
     1063
    10631064    *ppmkPrefix=0;
    10641065
    10651066    if (pmkOther==NULL)
    10661067        return MK_E_NOPREFIX;
    1067    
     1068
    10681069    IMoniker_IsSystemMoniker(pmkOther,&mkSys);
    10691070
     
    11291130            IMoniker_Release(tempMk1);
    11301131            IMoniker_Release(tempMk2);
    1131            
     1132
    11321133            /* compose all common monikers in a composite moniker */
    11331134            for(i=0;i<nbCommonMk;i++){
     
    11401141
    11411142                IMoniker_Release(tempMk1);
    1142                
     1143
    11431144                *ppmkPrefix=tempMk2;
    11441145            }
     
    11811182    DWORD mkSys;
    11821183    HRESULT res1,res2;
    1183    
     1184
    11841185    *restMk=0;
    11851186
     
    12791280
    12801281    /* finds the common prefix of the two monikers */
    1281     res=IMoniker_CommonPrefixWith(iface,pmkOther,&commonMk);   
     1282    res=IMoniker_CommonPrefixWith(iface,pmkOther,&commonMk);
    12821283
    12831284    /* if there's no common prefix or the two moniker are equal the relative is the other moniker */
     
    13361337    if (ppszDisplayName==NULL)
    13371338        return E_POINTER;
    1338    
     1339
    13391340    *ppszDisplayName=CoTaskMemAlloc(sizeof(WCHAR));
    13401341
     
    13481349
    13491350    IMoniker_Enum(iface,TRUE,&enumMoniker);
    1350    
     1351
    13511352    while(IEnumMoniker_Next(enumMoniker,1,&tempMk,NULL)==S_OK){
    13521353
     
    14081409    if (!pwdMksys)
    14091410        return E_POINTER;
    1410    
     1411
    14111412    (*pwdMksys)=MKSYS_GENERICCOMPOSITE;
    14121413
     
    14451446{
    14461447    ICOM_THIS_From_IROTData(IMoniker, iface);
    1447    
     1448
    14481449    TRACE("(%p)\n",iface);
    14491450
     
    14691470{
    14701471    ICOM_THIS(EnumMonikerImpl,iface);
    1471  
     1472
    14721473    TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
    14731474
    14741475    /* Perform a sanity check on the parameters.*/
    14751476    if ( (This==0) || (ppvObject==0) )
    1476         return E_INVALIDARG;
    1477  
     1477    return E_INVALIDARG;
     1478
    14781479    /* Initialize the return parameter */
    14791480    *ppvObject = 0;
     
    15201521    /* destroy the object if there's no more reference on it */
    15211522    if (This->ref==0){
    1522        
     1523
    15231524        for(i=0;i<This->tabSize;i++)
    15241525            IMoniker_Release(This->tabMoniker[i]);
     
    15471548    if (pceltFethed!=NULL)
    15481549        *pceltFethed= i;
    1549    
     1550
    15501551    if (i==celt)
    15511552        return S_OK;
     
    15651566
    15661567    This->currentPos+=celt;
    1567    
     1568
    15681569    return S_OK;
    15691570}
     
    16111612    if (currentPos > tabSize)
    16121613        return E_INVALIDARG;
    1613    
     1614
    16141615    /* Initialize the virtual function table. */
    16151616    ICOM_VTBL(newEnumMoniker)    = &VT_EnumMonikerImpl;
     
    16431644
    16441645/******************************************************************************
    1645  *        CreateGenericComposite        [OLE.55]
     1646 *        CreateGenericComposite    [OLE.55]
    16461647 ******************************************************************************/
    16471648HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite)
     
    16541655    if (ppmkComposite==NULL)
    16551656        return E_POINTER;
    1656    
     1657
    16571658    *ppmkComposite=0;
    16581659
     
    16921693
    16931694/******************************************************************************
    1694  *        MonikerCommonPrefixWith       [OLE.55]
     1695 *        MonikerCommonPrefixWith   [OLE.55]
    16951696 ******************************************************************************/
    16961697HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon)
  • trunk/src/ole32/datacache.c

    r5602 r6648  
     1/* $Id: datacache.c,v 1.2 2001-09-05 13:17:08 bird Exp $ */
    12/*
    2  *      OLE 2 Data cache
     3 *  OLE 2 Data cache
    34 *
    45 *      Copyright 1999  Francis Beaudet
     
    1718 *  -  This implementation of the datacache will let your application
    1819 *     load documents that have embedded OLE objects in them and it will
    19  *     also retrieve the metafile representation of those objects. 
     20 *     also retrieve the metafile representation of those objects.
    2021 *  -  This implementation of the datacache will also allow your
    2122 *     application to save new documents with OLE objects in them.
    22  *  -  The main thing that it doesn't do is allow you to activate 
     23 *  -  The main thing that it doesn't do is allow you to activate
    2324 *     or modify the OLE objects in any way.
    2425 *  -  I haven't found any good documentation on the real usage of
     
    2728 *     "\002OlePresXXX". It appears to just be a counter.
    2829 *  -  Also, I don't know the real content of the presentation stream
    29  *     header. I was able to figure-out where the extent of the object 
     30 *     header. I was able to figure-out where the extent of the object
    3031 *     was stored and the aspect, but that's about it.
    3132 */
     
    6061typedef struct PresentationDataHeader
    6162{
    62   DWORD unknown1;       /* -1 */
    63   DWORD unknown2;       /* 3, possibly CF_METAFILEPICT */
    64   DWORD unknown3;       /* 4, possibly TYMED_ISTREAM */
     63  DWORD unknown1;   /* -1 */
     64  DWORD unknown2;   /* 3, possibly CF_METAFILEPICT */
     65  DWORD unknown3;   /* 4, possibly TYMED_ISTREAM */
    6566  DVASPECT dvAspect;
    66   DWORD unknown5;       /* -1 */
     67  DWORD unknown5;   /* -1 */
    6768
    6869  DWORD unknown6;
    69   DWORD unknown7;       /* 0 */
     70  DWORD unknown7;   /* 0 */
    7071  DWORD dwObjectExtentX;
    7172  DWORD dwObjectExtentY;
     
    8182   * List all interface VTables here
    8283   */
    83   ICOM_VTABLE(IDataObject)*      lpvtbl1; 
     84  ICOM_VTABLE(IDataObject)*      lpvtbl1;
    8485  ICOM_VTABLE(IUnknown)*         lpvtbl2;
    8586  ICOM_VTABLE(IPersistStorage)*  lpvtbl3;
    86   ICOM_VTABLE(IViewObject2)*     lpvtbl4; 
     87  ICOM_VTABLE(IViewObject2)*     lpvtbl4;
    8788  ICOM_VTABLE(IOleCache2)*       lpvtbl5;
    8889  ICOM_VTABLE(IOleCacheControl)* lpvtbl6;
     
    119120
    120121/*
    121  * Here, I define utility macros to help with the casting of the 
     122 * Here, I define utility macros to help with the casting of the
    122123 * "this" parameter.
    123124 * There is a version to accomodate all of the VTables implemented
     
    125126 */
    126127#define _ICOM_THIS_From_IDataObject(class,name)       class* this = (class*)name;
    127 #define _ICOM_THIS_From_NDIUnknown(class, name)       class* this = (class*)(((char*)name)-sizeof(void*)); 
    128 #define _ICOM_THIS_From_IPersistStorage(class, name)  class* this = (class*)(((char*)name)-2*sizeof(void*)); 
    129 #define _ICOM_THIS_From_IViewObject2(class, name)     class* this = (class*)(((char*)name)-3*sizeof(void*)); 
    130 #define _ICOM_THIS_From_IOleCache2(class, name)       class* this = (class*)(((char*)name)-4*sizeof(void*)); 
    131 #define _ICOM_THIS_From_IOleCacheControl(class, name) class* this = (class*)(((char*)name)-5*sizeof(void*)); 
     128#define _ICOM_THIS_From_NDIUnknown(class, name)       class* this = (class*)(((char*)name)-sizeof(void*));
     129#define _ICOM_THIS_From_IPersistStorage(class, name)  class* this = (class*)(((char*)name)-2*sizeof(void*));
     130#define _ICOM_THIS_From_IViewObject2(class, name)     class* this = (class*)(((char*)name)-3*sizeof(void*));
     131#define _ICOM_THIS_From_IOleCache2(class, name)       class* this = (class*)(((char*)name)-4*sizeof(void*));
     132#define _ICOM_THIS_From_IOleCacheControl(class, name) class* this = (class*)(((char*)name)-5*sizeof(void*));
    132133
    133134/*
     
    135136 */
    136137static DataCache* DataCache_Construct(REFCLSID  clsid,
    137                                       LPUNKNOWN pUnkOuter);
     138                      LPUNKNOWN pUnkOuter);
    138139static void       DataCache_Destroy(DataCache* ptrToDestroy);
    139140static HRESULT    DataCache_ReadPresentationData(DataCache*              this,
    140                                                 DWORD                   drawAspect,
    141                                                 PresentationDataHeader* header);
     141                        DWORD                   drawAspect,
     142                        PresentationDataHeader* header);
    142143static HRESULT    DataCache_OpenPresStream(DataCache *this,
    143                                            DWORD      drawAspect,
    144                                            IStream  **pStm);
     144                       DWORD      drawAspect,
     145                       IStream  **pStm);
    145146static HMETAFILE  DataCache_ReadPresMetafile(DataCache* this,
    146                                              DWORD      drawAspect);
     147                         DWORD      drawAspect);
    147148static void       DataCache_FireOnViewChange(DataCache* this,
    148                                              DWORD      aspect,
    149                                              LONG       lindex);
     149                         DWORD      aspect,
     150                         LONG       lindex);
    150151
    151152/*
     
    157158            REFIID         riid,
    158159            void**         ppvObject);
    159 static ULONG WINAPI DataCache_NDIUnknown_AddRef( 
     160static ULONG WINAPI DataCache_NDIUnknown_AddRef(
    160161            IUnknown*      iface);
    161 static ULONG WINAPI DataCache_NDIUnknown_Release( 
     162static ULONG WINAPI DataCache_NDIUnknown_Release(
    162163            IUnknown*      iface);
    163164
     
    170171            REFIID           riid,
    171172            void**           ppvObject);
    172 static ULONG WINAPI DataCache_IDataObject_AddRef( 
     173static ULONG WINAPI DataCache_IDataObject_AddRef(
    173174            IDataObject*     iface);
    174 static ULONG WINAPI DataCache_IDataObject_Release( 
     175static ULONG WINAPI DataCache_IDataObject_Release(
    175176            IDataObject*     iface);
    176177static HRESULT WINAPI DataCache_GetData(
    177             IDataObject*     iface,
    178             LPFORMATETC      pformatetcIn,
    179             STGMEDIUM*       pmedium);
     178        IDataObject*     iface,
     179        LPFORMATETC      pformatetcIn,
     180        STGMEDIUM*       pmedium);
    180181static HRESULT WINAPI DataCache_GetDataHere(
    181             IDataObject*     iface,
    182             LPFORMATETC      pformatetc,
    183             STGMEDIUM*       pmedium);
     182        IDataObject*     iface,
     183        LPFORMATETC      pformatetc,
     184        STGMEDIUM*       pmedium);
    184185static HRESULT WINAPI DataCache_QueryGetData(
    185             IDataObject*     iface,
    186             LPFORMATETC      pformatetc);
     186        IDataObject*     iface,
     187        LPFORMATETC      pformatetc);
    187188static HRESULT WINAPI DataCache_GetCanonicalFormatEtc(
    188             IDataObject*     iface,
    189             LPFORMATETC      pformatectIn,
    190             LPFORMATETC      pformatetcOut);
     189        IDataObject*     iface,
     190        LPFORMATETC      pformatectIn,
     191        LPFORMATETC      pformatetcOut);
    191192static HRESULT WINAPI DataCache_IDataObject_SetData(
    192             IDataObject*     iface,
    193             LPFORMATETC      pformatetc,
    194             STGMEDIUM*       pmedium,
    195             BOOL             fRelease);
     193        IDataObject*     iface,
     194        LPFORMATETC      pformatetc,
     195        STGMEDIUM*       pmedium,
     196        BOOL             fRelease);
    196197static HRESULT WINAPI DataCache_EnumFormatEtc(
    197             IDataObject*     iface,       
    198             DWORD            dwDirection,
    199             IEnumFORMATETC** ppenumFormatEtc);
     198        IDataObject*     iface,
     199        DWORD            dwDirection,
     200        IEnumFORMATETC** ppenumFormatEtc);
    200201static HRESULT WINAPI DataCache_DAdvise(
    201             IDataObject*     iface,
    202             FORMATETC*       pformatetc,
    203             DWORD            advf,
    204             IAdviseSink*     pAdvSink,
    205             DWORD*           pdwConnection);
     202        IDataObject*     iface,
     203        FORMATETC*       pformatetc,
     204        DWORD            advf,
     205        IAdviseSink*     pAdvSink,
     206        DWORD*           pdwConnection);
    206207static HRESULT WINAPI DataCache_DUnadvise(
    207             IDataObject*     iface,
    208             DWORD            dwConnection);
     208        IDataObject*     iface,
     209        DWORD            dwConnection);
    209210static HRESULT WINAPI DataCache_EnumDAdvise(
    210             IDataObject*     iface,
    211             IEnumSTATDATA**  ppenumAdvise);
     211        IDataObject*     iface,
     212        IEnumSTATDATA**  ppenumAdvise);
    212213
    213214/*
     
    219220            REFIID           riid,
    220221            void**           ppvObject);
    221 static ULONG WINAPI DataCache_IPersistStorage_AddRef( 
     222static ULONG WINAPI DataCache_IPersistStorage_AddRef(
    222223            IPersistStorage* iface);
    223 static ULONG WINAPI DataCache_IPersistStorage_Release( 
     224static ULONG WINAPI DataCache_IPersistStorage_Release(
    224225            IPersistStorage* iface);
    225 static HRESULT WINAPI DataCache_GetClassID( 
     226static HRESULT WINAPI DataCache_GetClassID(
    226227            IPersistStorage* iface,
    227             CLSID*           pClassID);
    228 static HRESULT WINAPI DataCache_IsDirty( 
     228        CLSID*           pClassID);
     229static HRESULT WINAPI DataCache_IsDirty(
    229230            IPersistStorage* iface);
    230 static HRESULT WINAPI DataCache_InitNew(
    231             IPersistStorage* iface,
    232             IStorage*        pStg);
    233 static HRESULT WINAPI DataCache_Load(
     231static HRESULT WINAPI DataCache_InitNew(
    234232            IPersistStorage* iface,
    235             IStorage*        pStg);
    236 static HRESULT WINAPI DataCache_Save(
     233        IStorage*        pStg);
     234static HRESULT WINAPI DataCache_Load(
    237235            IPersistStorage* iface,
    238             IStorage*        pStg,
    239             BOOL             fSameAsLoad);
    240 static HRESULT WINAPI DataCache_SaveCompleted(
    241             IPersistStorage* iface, 
    242             IStorage*        pStgNew);
     236        IStorage*        pStg);
     237static HRESULT WINAPI DataCache_Save(
     238            IPersistStorage* iface,
     239        IStorage*        pStg,
     240        BOOL             fSameAsLoad);
     241static HRESULT WINAPI DataCache_SaveCompleted(
     242            IPersistStorage* iface,
     243        IStorage*        pStgNew);
    243244static HRESULT WINAPI DataCache_HandsOffStorage(
    244245            IPersistStorage* iface);
     
    252253            REFIID           riid,
    253254            void**           ppvObject);
    254 static ULONG WINAPI DataCache_IViewObject2_AddRef( 
     255static ULONG WINAPI DataCache_IViewObject2_AddRef(
    255256            IViewObject2* iface);
    256 static ULONG WINAPI DataCache_IViewObject2_Release( 
     257static ULONG WINAPI DataCache_IViewObject2_Release(
    257258            IViewObject2* iface);
    258259static HRESULT WINAPI DataCache_Draw(
    259260            IViewObject2*    iface,
    260             DWORD            dwDrawAspect,
    261             LONG             lindex,
    262             void*            pvAspect,
    263             DVTARGETDEVICE*  ptd,
    264             HDC              hdcTargetDev,
    265             HDC              hdcDraw,
    266             LPCRECTL         lprcBounds,
    267             LPCRECTL         lprcWBounds,
    268             IVO_ContCallback pfnContinue,
    269             DWORD            dwContinue);
     261        DWORD            dwDrawAspect,
     262        LONG             lindex,
     263        void*            pvAspect,
     264        DVTARGETDEVICE*  ptd,
     265        HDC              hdcTargetDev,
     266        HDC              hdcDraw,
     267        LPCRECTL         lprcBounds,
     268        LPCRECTL         lprcWBounds,
     269        IVO_ContCallback pfnContinue,
     270        DWORD            dwContinue);
    270271static HRESULT WINAPI DataCache_GetColorSet(
    271             IViewObject2*   iface, 
    272             DWORD           dwDrawAspect,
    273             LONG            lindex,
    274             void*           pvAspect,
    275             DVTARGETDEVICE* ptd,
    276             HDC             hicTargetDevice,
    277             LOGPALETTE**    ppColorSet);
     272            IViewObject2*   iface,
     273        DWORD           dwDrawAspect,
     274        LONG            lindex,
     275        void*           pvAspect,
     276        DVTARGETDEVICE* ptd,
     277        HDC             hicTargetDevice,
     278        LOGPALETTE**    ppColorSet);
    278279static HRESULT WINAPI DataCache_Freeze(
    279280            IViewObject2*   iface,
    280             DWORD           dwDrawAspect,
    281             LONG            lindex,
    282             void*           pvAspect,
    283             DWORD*          pdwFreeze);
     281        DWORD           dwDrawAspect,
     282        LONG            lindex,
     283        void*           pvAspect,
     284        DWORD*          pdwFreeze);
    284285static HRESULT WINAPI DataCache_Unfreeze(
    285286            IViewObject2*   iface,
    286             DWORD           dwFreeze);
     287        DWORD           dwFreeze);
    287288static HRESULT WINAPI DataCache_SetAdvise(
    288289            IViewObject2*   iface,
    289             DWORD           aspects,
    290             DWORD           advf,
    291             IAdviseSink*    pAdvSink);
     290        DWORD           aspects,
     291        DWORD           advf,
     292        IAdviseSink*    pAdvSink);
    292293static HRESULT WINAPI DataCache_GetAdvise(
    293             IViewObject2*   iface, 
    294             DWORD*          pAspects,
    295             DWORD*          pAdvf,
    296             IAdviseSink**   ppAdvSink);
     294            IViewObject2*   iface,
     295        DWORD*          pAspects,
     296        DWORD*          pAdvf,
     297        IAdviseSink**   ppAdvSink);
    297298static HRESULT WINAPI DataCache_GetExtent(
    298             IViewObject2*   iface, 
    299             DWORD           dwDrawAspect,
    300             LONG            lindex,
    301             DVTARGETDEVICE* ptd,
    302             LPSIZEL         lpsizel);
     299            IViewObject2*   iface,
     300        DWORD           dwDrawAspect,
     301        LONG            lindex,
     302        DVTARGETDEVICE* ptd,
     303        LPSIZEL         lpsizel);
    303304
    304305/*
     
    310311            REFIID          riid,
    311312            void**          ppvObject);
    312 static ULONG WINAPI DataCache_IOleCache2_AddRef( 
     313static ULONG WINAPI DataCache_IOleCache2_AddRef(
    313314            IOleCache2*     iface);
    314 static ULONG WINAPI DataCache_IOleCache2_Release( 
     315static ULONG WINAPI DataCache_IOleCache2_Release(
    315316            IOleCache2*     iface);
    316317static HRESULT WINAPI DataCache_Cache(
    317318            IOleCache2*     iface,
    318             FORMATETC*      pformatetc,
    319             DWORD           advf,
    320             DWORD*          pdwConnection);
     319        FORMATETC*      pformatetc,
     320        DWORD           advf,
     321        DWORD*          pdwConnection);
    321322static HRESULT WINAPI DataCache_Uncache(
    322             IOleCache2*     iface,
    323             DWORD           dwConnection);
     323        IOleCache2*     iface,
     324        DWORD           dwConnection);
    324325static HRESULT WINAPI DataCache_EnumCache(
    325326            IOleCache2*     iface,
    326             IEnumSTATDATA** ppenumSTATDATA);
     327        IEnumSTATDATA** ppenumSTATDATA);
    327328static HRESULT WINAPI DataCache_InitCache(
    328             IOleCache2*     iface,
    329             IDataObject*    pDataObject);
     329        IOleCache2*     iface,
     330        IDataObject*    pDataObject);
    330331static HRESULT WINAPI DataCache_IOleCache2_SetData(
    331332            IOleCache2*     iface,
    332             FORMATETC*      pformatetc,
    333             STGMEDIUM*      pmedium,
    334             BOOL            fRelease);
     333        FORMATETC*      pformatetc,
     334        STGMEDIUM*      pmedium,
     335        BOOL            fRelease);
    335336static HRESULT WINAPI DataCache_UpdateCache(
    336337            IOleCache2*     iface,
    337             LPDATAOBJECT    pDataObject,
    338             DWORD           grfUpdf,
    339             LPVOID          pReserved);
     338        LPDATAOBJECT    pDataObject,
     339        DWORD           grfUpdf,
     340        LPVOID          pReserved);
    340341static HRESULT WINAPI DataCache_DiscardCache(
    341342            IOleCache2*     iface,
    342             DWORD           dwDiscardOptions);
     343        DWORD           dwDiscardOptions);
    343344
    344345/*
     
    350351            REFIID            riid,
    351352            void**            ppvObject);
    352 static ULONG WINAPI DataCache_IOleCacheControl_AddRef( 
     353static ULONG WINAPI DataCache_IOleCacheControl_AddRef(
    353354            IOleCacheControl* iface);
    354 static ULONG WINAPI DataCache_IOleCacheControl_Release( 
     355static ULONG WINAPI DataCache_IOleCacheControl_Release(
    355356            IOleCacheControl* iface);
    356357static HRESULT WINAPI DataCache_OnRun(
    357             IOleCacheControl* iface,
    358             LPDATAOBJECT      pDataObject);
     358        IOleCacheControl* iface,
     359        LPDATAOBJECT      pDataObject);
    359360static HRESULT WINAPI DataCache_OnStop(
    360             IOleCacheControl* iface);
     361        IOleCacheControl* iface);
    361362
    362363/*
     
    447448 */
    448449HRESULT WINAPI CreateDataCache(
    449   LPUNKNOWN pUnkOuter, 
    450   REFCLSID  rclsid, 
    451   REFIID    riid, 
     450  LPUNKNOWN pUnkOuter,
     451  REFCLSID  rclsid,
     452  REFIID    riid,
    452453  LPVOID*   ppvObj)
    453454{
     
    471472   * IUnknown pointer can be returned to the outside.
    472473   */
    473   if ( (pUnkOuter!=NULL) && 
     474  if ( (pUnkOuter!=NULL) &&
    474475       (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) != 0) )
    475476    return CLASS_E_NOAGGREGATION;
     
    478479   * Try to construct a new instance of the class.
    479480   */
    480   newCache = DataCache_Construct(rclsid, 
    481                                 pUnkOuter);
     481  newCache = DataCache_Construct(rclsid,
     482                pUnkOuter);
    482483
    483484  if (newCache == 0)
     
    514515  if (newObject==0)
    515516    return newObject;
    516  
     517
    517518  /*
    518519   * Initialize the virtual function table.
     
    524525  newObject->lpvtbl5 = &DataCache_IOleCache2_VTable;
    525526  newObject->lpvtbl6 = &DataCache_IOleCacheControl_VTable;
    526  
    527   /*
    528    * Start with one reference count. The caller of this function 
     527
     528  /*
     529   * Start with one reference count. The caller of this function
    529530   * must release the interface pointer when it is done.
    530531   */
     
    533534  /*
    534535   * Initialize the outer unknown
    535    * We don't keep a reference on the outer unknown since, the way 
     536   * We don't keep a reference on the outer unknown since, the way
    536537   * aggregation works, our lifetime is at least as large as it's
    537538   * lifetime.
     
    579580 * DataCache_ReadPresentationData
    580581 *
    581  * This method will read information for the requested presentation 
     582 * This method will read information for the requested presentation
    582583 * into the given structure.
    583584 *
     
    601602  hres = DataCache_OpenPresStream(
    602603           this,
    603            drawAspect,
    604            &presStream);
     604       drawAspect,
     605       &presStream);
    605606
    606607  if (FAILED(hres))
     
    613614  hres = IStream_Read(
    614615           presStream,
    615            header,
    616            sizeof(PresentationDataHeader),
    617            NULL);
     616       header,
     617       sizeof(PresentationDataHeader),
     618       NULL);
    618619
    619620  /*
     
    657658    {
    658659      IAdviseSink_OnViewChange(this->sinkInterface,
    659                                aspect,
    660                                lindex);
     660                   aspect,
     661                   lindex);
    661662
    662663      /*
     
    666667      if ( (this->sinkAdviseFlag & ADVF_ONLYONCE) != 0)
    667668      {
    668         IAdviseSink_Release(this->sinkInterface);
    669 
    670         this->sinkInterface  = NULL;
    671         this->sinkAspects    = 0;
    672         this->sinkAdviseFlag = 0;
     669    IAdviseSink_Release(this->sinkInterface);
     670
     671    this->sinkInterface  = NULL;
     672    this->sinkAspects    = 0;
     673    this->sinkAdviseFlag = 0;
    673674      }
    674675    }
     
    686687
    687688    return (elem->type == STGTY_STREAM)
    688         && (elem->cbSize.s.LowPart >= sizeof(PresentationDataHeader))
    689         && (strlenW(name) == 11)
    690         && (strncmpW(name, OlePres, 8) == 0)
    691         && (name[8] >= '0') && (name[8] <= '9')
    692         && (name[9] >= '0') && (name[9] <= '9')
    693         && (name[10] >= '0') && (name[10] <= '9');
     689    && (elem->cbSize.s.LowPart >= sizeof(PresentationDataHeader))
     690    && (strlenW(name) == 11)
     691    && (strncmpW(name, OlePres, 8) == 0)
     692    && (name[8] >= '0') && (name[8] <= '9')
     693    && (name[9] >= '0') && (name[9] <= '9')
     694    && (name[10] >= '0') && (name[10] <= '9');
    694695}
    695696
     
    707708 *
    708709 * Errors:
    709  *   S_OK               The requested stream has been opened.
    710  *   OLE_E_BLANK        The requested stream could not be found.
     710 *   S_OK       The requested stream has been opened.
     711 *   OLE_E_BLANK    The requested stream could not be found.
    711712 *   Quite a few others I'm too lazy to map correctly.
    712713 *
    713714 * Notes:
    714  *   Algorithm: Scan the elements of the presentation storage, looking
    715  *              for presentation streams. For each presentation stream,
    716  *              load the header and check to see if the aspect maches.
     715 *   Algorithm: Scan the elements of the presentation storage, looking
     716 *      for presentation streams. For each presentation stream,
     717 *      load the header and check to see if the aspect maches.
    717718 *
    718719 *   If a fallback is desired, just opening the first presentation stream
     
    735736    while ((hr = IEnumSTATSTG_Next(pEnum, 1, &elem, NULL)) == S_OK)
    736737    {
    737         if (DataCache_IsPresentationStream(&elem))
    738         {
    739             IStream *pStm;
    740 
    741             hr = IStorage_OpenStream(this->presentationStorage, elem.pwcsName,
    742                                      NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0,
    743                                      &pStm);
    744             if (SUCCEEDED(hr))
    745             {
    746                 PresentationDataHeader header;
    747                 ULONG actual_read;
    748 
    749                 hr = IStream_Read(pStm, &header, sizeof(header), &actual_read);
    750 
    751                 /* can't use SUCCEEDED(hr): S_FALSE counts as an error */
    752                 if (hr == S_OK && actual_read == sizeof(header)
    753                     && header.dvAspect == drawAspect)
    754                 {
    755                     /* Rewind the stream before returning it. */
    756                     LARGE_INTEGER offset;
    757                     offset.s.LowPart = 0;
    758                     offset.s.HighPart = 0;
    759                     IStream_Seek(pStm, offset, STREAM_SEEK_SET, NULL);
    760 
    761                     *ppStm = pStm;
    762 
    763                     CoTaskMemFree(elem.pwcsName);
    764                     IEnumSTATSTG_Release(pEnum);
    765 
    766                     return S_OK;
    767                 }
    768 
    769                 IStream_Release(pStm);
    770             }
    771         }
    772 
    773         CoTaskMemFree(elem.pwcsName);
     738    if (DataCache_IsPresentationStream(&elem))
     739    {
     740        IStream *pStm;
     741
     742        hr = IStorage_OpenStream(this->presentationStorage, elem.pwcsName,
     743                     NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0,
     744                     &pStm);
     745        if (SUCCEEDED(hr))
     746        {
     747        PresentationDataHeader header;
     748        ULONG actual_read;
     749
     750        hr = IStream_Read(pStm, &header, sizeof(header), &actual_read);
     751
     752        /* can't use SUCCEEDED(hr): S_FALSE counts as an error */
     753        if (hr == S_OK && actual_read == sizeof(header)
     754            && header.dvAspect == drawAspect)
     755        {
     756            /* Rewind the stream before returning it. */
     757            LARGE_INTEGER offset;
     758            offset.s.LowPart = 0;
     759            offset.s.HighPart = 0;
     760            IStream_Seek(pStm, offset, STREAM_SEEK_SET, NULL);
     761
     762            *ppStm = pStm;
     763
     764            CoTaskMemFree(elem.pwcsName);
     765            IEnumSTATSTG_Release(pEnum);
     766
     767            return S_OK;
     768        }
     769
     770        IStream_Release(pStm);
     771        }
    774772    }
    775773
     774    CoTaskMemFree(elem.pwcsName);
     775    }
     776
    776777    IEnumSTATSTG_Release(pEnum);
    777778
     
    782783 * DataCache_ReadPresentationData
    783784 *
    784  * This method will read information for the requested presentation 
     785 * This method will read information for the requested presentation
    785786 * into the given structure.
    786787 *
     
    808809   */
    809810  hres = DataCache_OpenPresStream(
    810            this, 
    811            drawAspect,
    812            &presStream);
     811           this,
     812       drawAspect,
     813       &presStream);
    813814
    814815  if (FAILED(hres))
     
    819820   */
    820821  hres = IStream_Stat(presStream,
    821                       &streamInfo,
    822                       STATFLAG_NONAME);
     822              &streamInfo,
     823              STATFLAG_NONAME);
    823824
    824825  /*
     
    830831  hres = IStream_Seek(
    831832           presStream,
    832            offset,
    833            STREAM_SEEK_SET,
    834            NULL);
     833       offset,
     834       STREAM_SEEK_SET,
     835       NULL);
    835836
    836837  streamInfo.cbSize.s.LowPart -= offset.s.LowPart;
     
    839840   * Allocate a buffer for the metafile bits.
    840841   */
    841   metafileBits = HeapAlloc(GetProcessHeap(), 
    842                            0,
    843                            streamInfo.cbSize.s.LowPart);
     842  metafileBits = HeapAlloc(GetProcessHeap(),
     843               0,
     844               streamInfo.cbSize.s.LowPart);
    844845
    845846  /*
     
    847848   */
    848849  hres = IStream_Read(
    849            presStream,
    850            metafileBits,
    851            streamInfo.cbSize.s.LowPart,
    852            NULL);
     850       presStream,
     851       metafileBits,
     852       streamInfo.cbSize.s.LowPart,
     853       NULL);
    853854
    854855  /*
     
    897898  if ( (this==0) || (ppvObject==0) )
    898899    return E_INVALIDARG;
    899  
     900
    900901  /*
    901902   * Initialize the return parameter.
     
    906907   * Compare the riid with the interface IDs implemented by this object.
    907908   */
    908   if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 
     909  if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
    909910  {
    910911    *ppvObject = iface;
    911912  }
    912   else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) 
     913  else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0)
    913914  {
    914915    *ppvObject = (IDataObject*)&(this->lpvtbl1);
    915916  }
    916917  else if ( (memcmp(&IID_IPersistStorage, riid, sizeof(IID_IPersistStorage)) == 0)  ||
    917             (memcmp(&IID_IPersist, riid, sizeof(IID_IPersist)) == 0) )
     918        (memcmp(&IID_IPersist, riid, sizeof(IID_IPersist)) == 0) )
    918919  {
    919920    *ppvObject = (IPersistStorage*)&(this->lpvtbl3);
    920921  }
    921922  else if ( (memcmp(&IID_IViewObject, riid, sizeof(IID_IViewObject)) == 0) ||
    922             (memcmp(&IID_IViewObject2, riid, sizeof(IID_IViewObject2)) == 0) )
     923        (memcmp(&IID_IViewObject2, riid, sizeof(IID_IViewObject2)) == 0) )
    923924  {
    924925    *ppvObject = (IViewObject2*)&(this->lpvtbl4);
    925926  }
    926927  else if ( (memcmp(&IID_IOleCache, riid, sizeof(IID_IOleCache)) == 0) ||
    927             (memcmp(&IID_IOleCache2, riid, sizeof(IID_IOleCache2)) == 0) )
     928        (memcmp(&IID_IOleCache2, riid, sizeof(IID_IOleCache2)) == 0) )
    928929  {
    929930    *ppvObject = (IOleCache2*)&(this->lpvtbl5);
    930931  }
    931   else if (memcmp(&IID_IOleCacheControl, riid, sizeof(IID_IOleCacheControl)) == 0) 
     932  else if (memcmp(&IID_IOleCacheControl, riid, sizeof(IID_IOleCacheControl)) == 0)
    932933  {
    933934    *ppvObject = (IOleCacheControl*)&(this->lpvtbl6);
     
    942943    return E_NOINTERFACE;
    943944  }
    944  
     945
    945946  /*
    946947   * Query Interface always increases the reference count by one when it is
    947    * successful. 
     948   * successful.
    948949   */
    949950  IUnknown_AddRef((IUnknown*)*ppvObject);
    950951
    951   return S_OK;; 
     952  return S_OK;;
    952953}
    953954
     
    960961 * to the outer unknown.
    961962 */
    962 static ULONG WINAPI DataCache_NDIUnknown_AddRef( 
     963static ULONG WINAPI DataCache_NDIUnknown_AddRef(
    963964            IUnknown*      iface)
    964965{
     
    978979 * to the outer unknown.
    979980 */
    980 static ULONG WINAPI DataCache_NDIUnknown_Release( 
     981static ULONG WINAPI DataCache_NDIUnknown_Release(
    981982            IUnknown*      iface)
    982983{
     
    997998    return 0;
    998999  }
    999  
     1000
    10001001  return this->ref;
    10011002}
     
    10181019  _ICOM_THIS_From_IDataObject(DataCache, iface);
    10191020
    1020   return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 
     1021  return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject);
    10211022}
    10221023
     
    10261027 * See Windows documentation for more details on IUnknown methods.
    10271028 */
    1028 static ULONG WINAPI DataCache_IDataObject_AddRef( 
     1029static ULONG WINAPI DataCache_IDataObject_AddRef(
    10291030            IDataObject*     iface)
    10301031{
    10311032  _ICOM_THIS_From_IDataObject(DataCache, iface);
    10321033
    1033   return IUnknown_AddRef(this->outerUnknown); 
     1034  return IUnknown_AddRef(this->outerUnknown);
    10341035}
    10351036
     
    10391040 * See Windows documentation for more details on IUnknown methods.
    10401041 */
    1041 static ULONG WINAPI DataCache_IDataObject_Release( 
     1042static ULONG WINAPI DataCache_IDataObject_Release(
    10421043            IDataObject*     iface)
    10431044{
    10441045  _ICOM_THIS_From_IDataObject(DataCache, iface);
    10451046
    1046   return IUnknown_Release(this->outerUnknown); 
     1047  return IUnknown_Release(this->outerUnknown);
    10471048}
    10481049
     
    10551056 */
    10561057static HRESULT WINAPI DataCache_GetData(
    1057             IDataObject*     iface,
    1058             LPFORMATETC      pformatetcIn,
    1059             STGMEDIUM*       pmedium)
     1058        IDataObject*     iface,
     1059        LPFORMATETC      pformatetcIn,
     1060        STGMEDIUM*       pmedium)
    10601061{
    10611062  HRESULT hr = 0;
     
    11541155
    11551156static HRESULT WINAPI DataCache_GetDataHere(
    1156             IDataObject*     iface,
    1157             LPFORMATETC      pformatetc,
    1158             STGMEDIUM*       pmedium)
     1157        IDataObject*     iface,
     1158        LPFORMATETC      pformatetc,
     1159        STGMEDIUM*       pmedium)
    11591160{
    11601161  FIXME("stub\n");
     
    11631164
    11641165static HRESULT WINAPI DataCache_QueryGetData(
    1165             IDataObject*     iface,
    1166             LPFORMATETC      pformatetc)
     1166        IDataObject*     iface,
     1167        LPFORMATETC      pformatetc)
    11671168{
    11681169  FIXME("stub\n");
     
    11781179 */
    11791180static HRESULT WINAPI DataCache_GetCanonicalFormatEtc(
    1180             IDataObject*     iface,
    1181             LPFORMATETC      pformatectIn,
    1182             LPFORMATETC      pformatetcOut)
     1181        IDataObject*     iface,
     1182        LPFORMATETC      pformatectIn,
     1183        LPFORMATETC      pformatetcOut)
    11831184{
    11841185  TRACE("()\n");
     
    11941195 */
    11951196static HRESULT WINAPI DataCache_IDataObject_SetData(
    1196             IDataObject*     iface,
    1197             LPFORMATETC      pformatetc,
    1198             STGMEDIUM*       pmedium,
    1199             BOOL             fRelease)
     1197        IDataObject*     iface,
     1198        LPFORMATETC      pformatetc,
     1199        STGMEDIUM*       pmedium,
     1200        BOOL             fRelease)
    12001201{
    12011202  IOleCache2* oleCache = NULL;
     
    12241225 */
    12251226static HRESULT WINAPI DataCache_EnumFormatEtc(
    1226             IDataObject*     iface,       
    1227             DWORD            dwDirection,
    1228             IEnumFORMATETC** ppenumFormatEtc)
     1227        IDataObject*     iface,
     1228        DWORD            dwDirection,
     1229        IEnumFORMATETC** ppenumFormatEtc)
    12291230{
    12301231  TRACE("()\n");
     
    12401241 */
    12411242static HRESULT WINAPI DataCache_DAdvise(
    1242             IDataObject*     iface,
    1243             FORMATETC*       pformatetc,
    1244             DWORD            advf,
    1245             IAdviseSink*     pAdvSink,
    1246             DWORD*           pdwConnection)
     1243        IDataObject*     iface,
     1244        FORMATETC*       pformatetc,
     1245        DWORD            advf,
     1246        IAdviseSink*     pAdvSink,
     1247        DWORD*           pdwConnection)
    12471248{
    12481249  TRACE("()\n");
     
    12581259 */
    12591260static HRESULT WINAPI DataCache_DUnadvise(
    1260             IDataObject*     iface,
    1261             DWORD            dwConnection)
     1261        IDataObject*     iface,
     1262        DWORD            dwConnection)
    12621263{
    12631264  TRACE("()\n");
     
    12731274 */
    12741275static HRESULT WINAPI DataCache_EnumDAdvise(
    1275             IDataObject*     iface,
    1276             IEnumSTATDATA**  ppenumAdvise)
     1276        IDataObject*     iface,
     1277        IEnumSTATDATA**  ppenumAdvise)
    12771278{
    12781279  TRACE("()\n");
     
    12971298  _ICOM_THIS_From_IPersistStorage(DataCache, iface);
    12981299
    1299   return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 
     1300  return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject);
    13001301}
    13011302
     
    13051306 * See Windows documentation for more details on IUnknown methods.
    13061307 */
    1307 static ULONG WINAPI DataCache_IPersistStorage_AddRef( 
     1308static ULONG WINAPI DataCache_IPersistStorage_AddRef(
    13081309            IPersistStorage* iface)
    13091310{
    13101311  _ICOM_THIS_From_IPersistStorage(DataCache, iface);
    13111312
    1312   return IUnknown_AddRef(this->outerUnknown); 
     1313  return IUnknown_AddRef(this->outerUnknown);
    13131314}
    13141315
     
    13181319 * See Windows documentation for more details on IUnknown methods.
    13191320 */
    1320 static ULONG WINAPI DataCache_IPersistStorage_Release( 
     1321static ULONG WINAPI DataCache_IPersistStorage_Release(
    13211322            IPersistStorage* iface)
    13221323{
    13231324  _ICOM_THIS_From_IPersistStorage(DataCache, iface);
    13241325
    1325   return IUnknown_Release(this->outerUnknown); 
     1326  return IUnknown_Release(this->outerUnknown);
    13261327}
    13271328
     
    13331334 * See Windows documentation for more details on IPersistStorage methods.
    13341335 */
    1335 static HRESULT WINAPI DataCache_GetClassID( 
     1336static HRESULT WINAPI DataCache_GetClassID(
    13361337            IPersistStorage* iface,
    1337             CLSID*           pClassID)
     1338        CLSID*           pClassID)
    13381339{
    13391340  TRACE("(%p, %p)\n", iface, pClassID);
     
    13441345 * DataCache_IsDirty (IPersistStorage)
    13451346 *
    1346  * Until we actully connect to a running object and retrieve new 
     1347 * Until we actully connect to a running object and retrieve new
    13471348 * information to it, we never get dirty.
    13481349 *
    13491350 * See Windows documentation for more details on IPersistStorage methods.
    13501351 */
    1351 static HRESULT WINAPI DataCache_IsDirty( 
     1352static HRESULT WINAPI DataCache_IsDirty(
    13521353            IPersistStorage* iface)
    13531354{
     
    13651366 * See Windows documentation for more details on IPersistStorage methods.
    13661367 */
    1367 static HRESULT WINAPI DataCache_InitNew( 
    1368             IPersistStorage* iface, 
    1369             IStorage*        pStg)
     1368static HRESULT WINAPI DataCache_InitNew(
     1369            IPersistStorage* iface,
     1370        IStorage*        pStg)
    13701371{
    13711372  TRACE("(%p, %p)\n", iface, pStg);
     
    13771378 * DataCache_Load (IPersistStorage)
    13781379 *
    1379  * The data cache implementation of IPersistStorage_Load doesn't 
     1380 * The data cache implementation of IPersistStorage_Load doesn't
    13801381 * actually load anything. Instead, it holds on to the storage pointer
    1381  * and it will load the presentation information when the 
     1382 * and it will load the presentation information when the
    13821383 * IDataObject_GetData or IViewObject2_Draw methods are called.
    13831384 *
    13841385 * See Windows documentation for more details on IPersistStorage methods.
    13851386 */
    1386 static HRESULT WINAPI DataCache_Load( 
     1387static HRESULT WINAPI DataCache_Load(
    13871388            IPersistStorage* iface,
    1388             IStorage*        pStg)
     1389        IStorage*        pStg)
    13891390{
    13901391  _ICOM_THIS_From_IPersistStorage(DataCache, iface);
     
    14091410 * DataCache_Save (IPersistStorage)
    14101411 *
    1411  * Until we actully connect to a running object and retrieve new 
     1412 * Until we actully connect to a running object and retrieve new
    14121413 * information to it, we never have to save anything. However, it is
    14131414 * our responsability to copy the information when saving to a new
     
    14161417 * See Windows documentation for more details on IPersistStorage methods.
    14171418 */
    1418 static HRESULT WINAPI DataCache_Save( 
     1419static HRESULT WINAPI DataCache_Save(
    14191420            IPersistStorage* iface,
    1420             IStorage*        pStg,
    1421             BOOL             fSameAsLoad)
     1421        IStorage*        pStg,
     1422        BOOL             fSameAsLoad)
    14221423{
    14231424  _ICOM_THIS_From_IPersistStorage(DataCache, iface);
     
    14251426  TRACE("(%p, %p, %d)\n", iface, pStg, fSameAsLoad);
    14261427
    1427   if ( (!fSameAsLoad) && 
     1428  if ( (!fSameAsLoad) &&
    14281429       (this->presentationStorage!=NULL) )
    14291430  {
    14301431    return IStorage_CopyTo(this->presentationStorage,
    1431                            0,
    1432                            NULL,
    1433                            NULL,
    1434                            pStg);
     1432               0,
     1433               NULL,
     1434               NULL,
     1435               pStg);
    14351436  }
    14361437
     
    14461447 * See Windows documentation for more details on IPersistStorage methods.
    14471448 */
    1448 static HRESULT WINAPI DataCache_SaveCompleted( 
    1449             IPersistStorage* iface, 
    1450             IStorage*        pStgNew)
     1449static HRESULT WINAPI DataCache_SaveCompleted(
     1450            IPersistStorage* iface,
     1451        IStorage*        pStgNew)
    14511452{
    14521453  TRACE("(%p, %p)\n", iface, pStgNew);
     
    15111512  _ICOM_THIS_From_IViewObject2(DataCache, iface);
    15121513
    1513   return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 
     1514  return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject);
    15141515}
    15151516
     
    15191520 * See Windows documentation for more details on IUnknown methods.
    15201521 */
    1521 static ULONG WINAPI DataCache_IViewObject2_AddRef( 
     1522static ULONG WINAPI DataCache_IViewObject2_AddRef(
    15221523            IViewObject2* iface)
    15231524{
    15241525  _ICOM_THIS_From_IViewObject2(DataCache, iface);
    15251526
    1526   return IUnknown_AddRef(this->outerUnknown); 
     1527  return IUnknown_AddRef(this->outerUnknown);
    15271528}
    15281529
     
    15321533 * See Windows documentation for more details on IUnknown methods.
    15331534 */
    1534 static ULONG WINAPI DataCache_IViewObject2_Release( 
     1535static ULONG WINAPI DataCache_IViewObject2_Release(
    15351536            IViewObject2* iface)
    15361537{
    15371538  _ICOM_THIS_From_IViewObject2(DataCache, iface);
    15381539
    1539   return IUnknown_Release(this->outerUnknown); 
     1540  return IUnknown_Release(this->outerUnknown);
    15401541}
    15411542
     
    15501551static HRESULT WINAPI DataCache_Draw(
    15511552            IViewObject2*    iface,
    1552             DWORD            dwDrawAspect,
    1553             LONG             lindex,
    1554             void*            pvAspect,
    1555             DVTARGETDEVICE*  ptd,
    1556             HDC              hdcTargetDev,
    1557             HDC              hdcDraw,
    1558             LPCRECTL         lprcBounds,
    1559             LPCRECTL         lprcWBounds,
    1560             IVO_ContCallback pfnContinue,
    1561             DWORD            dwContinue)
     1553        DWORD            dwDrawAspect,
     1554        LONG             lindex,
     1555        void*            pvAspect,
     1556        DVTARGETDEVICE*  ptd,
     1557        HDC              hdcTargetDev,
     1558        HDC              hdcDraw,
     1559        LPCRECTL         lprcBounds,
     1560        LPCRECTL         lprcWBounds,
     1561        IVO_ContCallback pfnContinue,
     1562        DWORD            dwContinue)
    15621563{
    15631564  PresentationDataHeader presData;
     
    15681569
    15691570  TRACE("(%p, %lx, %ld, %p, %x, %x, %p, %p, %p, %lx)\n",
    1570         iface,
    1571         dwDrawAspect,
    1572         lindex,
    1573         pvAspect,
    1574         hdcTargetDev,
    1575         hdcDraw,
    1576         lprcBounds,
    1577         lprcWBounds,
    1578         pfnContinue,
    1579         dwContinue);
     1571    iface,
     1572    dwDrawAspect,
     1573    lindex,
     1574    pvAspect,
     1575    hdcTargetDev,
     1576    hdcDraw,
     1577    lprcBounds,
     1578    lprcWBounds,
     1579    pfnContinue,
     1580    dwContinue);
    15801581
    15811582  /*
     
    15901591   */
    15911592  hres = DataCache_ReadPresentationData(this,
    1592                                         dwDrawAspect,
    1593                                         &presData);
     1593                    dwDrawAspect,
     1594                    &presData);
    15941595
    15951596  if (FAILED(hres))
     
    16041605   */
    16051606  presMetafile = DataCache_ReadPresMetafile(this,
    1606                                             dwDrawAspect);
     1607                        dwDrawAspect);
    16071608
    16081609  /*
     
    16191620
    16201621    SetWindowExtEx(hdcDraw,
    1621                    presData.dwObjectExtentX,
    1622                    presData.dwObjectExtentY,
    1623                    &oldWindowExt);
    1624 
    1625     SetViewportExtEx(hdcDraw, 
    1626                      lprcBounds->right - lprcBounds->left,
    1627                      lprcBounds->bottom - lprcBounds->top,
    1628                      &oldViewportExt);
     1622           presData.dwObjectExtentX,
     1623           presData.dwObjectExtentY,
     1624           &oldWindowExt);
     1625
     1626    SetViewportExtEx(hdcDraw,
     1627             lprcBounds->right - lprcBounds->left,
     1628             lprcBounds->bottom - lprcBounds->top,
     1629             &oldViewportExt);
    16291630
    16301631    SetViewportOrgEx(hdcDraw,
    1631                      lprcBounds->left,
    1632                      lprcBounds->top,
    1633                      &oldViewportOrg);
     1632             lprcBounds->left,
     1633             lprcBounds->top,
     1634             &oldViewportOrg);
    16341635
    16351636    PlayMetaFile(hdcDraw, presMetafile);
    16361637
    16371638    SetWindowExtEx(hdcDraw,
    1638                    oldWindowExt.cx,
    1639                    oldWindowExt.cy,
    1640                    NULL);
    1641 
    1642     SetViewportExtEx(hdcDraw, 
    1643                      oldViewportExt.cx,
    1644                      oldViewportExt.cy,
    1645                      NULL);
     1639           oldWindowExt.cx,
     1640           oldWindowExt.cy,
     1641           NULL);
     1642
     1643    SetViewportExtEx(hdcDraw,
     1644             oldViewportExt.cx,
     1645             oldViewportExt.cy,
     1646             NULL);
    16461647
    16471648    SetViewportOrgEx(hdcDraw,
    1648                      oldViewportOrg.x,
    1649                      oldViewportOrg.y,
    1650                      NULL);
     1649             oldViewportOrg.x,
     1650             oldViewportOrg.y,
     1651             NULL);
    16511652
    16521653    SetMapMode(hdcDraw, prevMapMode);
     
    16591660
    16601661static HRESULT WINAPI DataCache_GetColorSet(
    1661             IViewObject2*   iface, 
    1662             DWORD           dwDrawAspect,
    1663             LONG            lindex,
    1664             void*           pvAspect,
    1665             DVTARGETDEVICE* ptd,
    1666             HDC             hicTargetDevice,
    1667             LOGPALETTE**    ppColorSet)
     1662            IViewObject2*   iface,
     1663        DWORD           dwDrawAspect,
     1664        LONG            lindex,
     1665        void*           pvAspect,
     1666        DVTARGETDEVICE* ptd,
     1667        HDC             hicTargetDevice,
     1668        LOGPALETTE**    ppColorSet)
    16681669{
    16691670  FIXME("stub\n");
     
    16731674static HRESULT WINAPI DataCache_Freeze(
    16741675            IViewObject2*   iface,
    1675             DWORD           dwDrawAspect,
    1676             LONG            lindex,
    1677             void*           pvAspect,
    1678             DWORD*          pdwFreeze)
     1676        DWORD           dwDrawAspect,
     1677        LONG            lindex,
     1678        void*           pvAspect,
     1679        DWORD*          pdwFreeze)
    16791680{
    16801681  FIXME("stub\n");
     
    16841685static HRESULT WINAPI DataCache_Unfreeze(
    16851686            IViewObject2*   iface,
    1686             DWORD           dwFreeze)
     1687        DWORD           dwFreeze)
    16871688{
    16881689  FIXME("stub\n");
     
    17001701static HRESULT WINAPI DataCache_SetAdvise(
    17011702            IViewObject2*   iface,
    1702             DWORD           aspects,
    1703             DWORD           advf,
    1704             IAdviseSink*    pAdvSink)
     1703        DWORD           aspects,
     1704        DWORD           advf,
     1705        IAdviseSink*    pAdvSink)
    17051706{
    17061707  _ICOM_THIS_From_IViewObject2(DataCache, iface);
     
    17151716    IAdviseSink_Release(this->sinkInterface);
    17161717    this->sinkInterface  = NULL;
    1717     this->sinkAspects    = 0; 
     1718    this->sinkAspects    = 0;
    17181719    this->sinkAdviseFlag = 0;
    17191720  }
     
    17251726  {
    17261727    this->sinkInterface  = pAdvSink;
    1727     this->sinkAspects    = aspects; 
    1728     this->sinkAdviseFlag = advf;   
     1728    this->sinkAspects    = aspects;
     1729    this->sinkAdviseFlag = advf;
    17291730
    17301731    IAdviseSink_AddRef(this->sinkInterface);
     
    17381739  {
    17391740    DataCache_FireOnViewChange(this,
    1740                                DVASPECT_CONTENT,
    1741                                -1);
     1741                   DVASPECT_CONTENT,
     1742                   -1);
    17421743  }
    17431744
     
    17481749 * DataCache_GetAdvise (IViewObject2)
    17491750 *
    1750  * This method queries the current state of the advise sink 
     1751 * This method queries the current state of the advise sink
    17511752 * installed on the data cache.
    17521753 *
     
    17541755 */
    17551756static HRESULT WINAPI DataCache_GetAdvise(
    1756             IViewObject2*   iface, 
    1757             DWORD*          pAspects,
    1758             DWORD*          pAdvf,
    1759             IAdviseSink**   ppAdvSink)
     1757            IViewObject2*   iface,
     1758        DWORD*          pAspects,
     1759        DWORD*          pAdvf,
     1760        IAdviseSink**   ppAdvSink)
    17601761{
    17611762  _ICOM_THIS_From_IViewObject2(DataCache, iface);
     
    17741775  if (ppAdvSink!=NULL)
    17751776  {
    1776     IAdviseSink_QueryInterface(this->sinkInterface, 
    1777                                &IID_IAdviseSink,
    1778                                (void**)ppAdvSink);
     1777    IAdviseSink_QueryInterface(this->sinkInterface,
     1778                   &IID_IAdviseSink,
     1779                   (void**)ppAdvSink);
    17791780  }
    17801781
     
    17901791 */
    17911792static HRESULT WINAPI DataCache_GetExtent(
    1792             IViewObject2*   iface, 
    1793             DWORD           dwDrawAspect,
    1794             LONG            lindex,
    1795             DVTARGETDEVICE* ptd,
    1796             LPSIZEL         lpsizel)
     1793            IViewObject2*   iface,
     1794        DWORD           dwDrawAspect,
     1795        LONG            lindex,
     1796        DVTARGETDEVICE* ptd,
     1797        LPSIZEL         lpsizel)
    17971798{
    17981799  PresentationDataHeader presData;
     
    18011802  _ICOM_THIS_From_IViewObject2(DataCache, iface);
    18021803
    1803   TRACE("(%p, %lx, %ld, %p, %p)\n", 
    1804         iface, dwDrawAspect, lindex, ptd, lpsizel);
     1804  TRACE("(%p, %lx, %ld, %p, %p)\n",
     1805    iface, dwDrawAspect, lindex, ptd, lpsizel);
    18051806
    18061807  /*
     
    18281829  if (ptd!=NULL)
    18291830    FIXME("Unimplemented ptd = %p\n", ptd);
    1830  
    1831   /*
    1832    * Get the presentation information from the 
     1831
     1832  /*
     1833   * Get the presentation information from the
    18331834   * cache.
    18341835   */
    18351836  hres = DataCache_ReadPresentationData(this,
    1836                                         dwDrawAspect,
    1837                                         &presData);
     1837                    dwDrawAspect,
     1838                    &presData);
    18381839
    18391840  if (SUCCEEDED(hres))
     
    18701871  _ICOM_THIS_From_IOleCache2(DataCache, iface);
    18711872
    1872   return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 
     1873  return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject);
    18731874}
    18741875
     
    18781879 * See Windows documentation for more details on IUnknown methods.
    18791880 */
    1880 static ULONG WINAPI DataCache_IOleCache2_AddRef( 
     1881static ULONG WINAPI DataCache_IOleCache2_AddRef(
    18811882            IOleCache2*     iface)
    18821883{
    18831884  _ICOM_THIS_From_IOleCache2(DataCache, iface);
    18841885
    1885   return IUnknown_AddRef(this->outerUnknown); 
     1886  return IUnknown_AddRef(this->outerUnknown);
    18861887}
    18871888
     
    18911892 * See Windows documentation for more details on IUnknown methods.
    18921893 */
    1893 static ULONG WINAPI DataCache_IOleCache2_Release( 
     1894static ULONG WINAPI DataCache_IOleCache2_Release(
    18941895            IOleCache2*     iface)
    18951896{
    18961897  _ICOM_THIS_From_IOleCache2(DataCache, iface);
    18971898
    1898   return IUnknown_Release(this->outerUnknown); 
     1899  return IUnknown_Release(this->outerUnknown);
    18991900}
    19001901
    19011902static HRESULT WINAPI DataCache_Cache(
    19021903            IOleCache2*     iface,
    1903             FORMATETC*      pformatetc,
    1904             DWORD           advf,
    1905             DWORD*          pdwConnection)
     1904        FORMATETC*      pformatetc,
     1905        DWORD           advf,
     1906        DWORD*          pdwConnection)
    19061907{
    19071908  FIXME("stub\n");
     
    19101911
    19111912static HRESULT WINAPI DataCache_Uncache(
    1912             IOleCache2*     iface,
    1913             DWORD           dwConnection)
     1913        IOleCache2*     iface,
     1914        DWORD           dwConnection)
    19141915{
    19151916  FIXME("stub\n");
     
    19191920static HRESULT WINAPI DataCache_EnumCache(
    19201921            IOleCache2*     iface,
    1921             IEnumSTATDATA** ppenumSTATDATA)
     1922        IEnumSTATDATA** ppenumSTATDATA)
    19221923{
    19231924  FIXME("stub\n");
     
    19261927
    19271928static HRESULT WINAPI DataCache_InitCache(
    1928             IOleCache2*     iface,
    1929             IDataObject*    pDataObject)
     1929        IOleCache2*     iface,
     1930        IDataObject*    pDataObject)
    19301931{
    19311932  FIXME("stub\n");
     
    19351936static HRESULT WINAPI DataCache_IOleCache2_SetData(
    19361937            IOleCache2*     iface,
    1937             FORMATETC*      pformatetc,
    1938             STGMEDIUM*      pmedium,
    1939             BOOL            fRelease)
     1938        FORMATETC*      pformatetc,
     1939        STGMEDIUM*      pmedium,
     1940        BOOL            fRelease)
    19401941{
    19411942  FIXME("stub\n");
     
    19451946static HRESULT WINAPI DataCache_UpdateCache(
    19461947            IOleCache2*     iface,
    1947             LPDATAOBJECT    pDataObject,
    1948             DWORD           grfUpdf,
    1949             LPVOID          pReserved)
     1948        LPDATAOBJECT    pDataObject,
     1949        DWORD           grfUpdf,
     1950        LPVOID          pReserved)
    19501951{
    19511952  FIXME("stub\n");
     
    19551956static HRESULT WINAPI DataCache_DiscardCache(
    19561957            IOleCache2*     iface,
    1957             DWORD           dwDiscardOptions)
     1958        DWORD           dwDiscardOptions)
    19581959{
    19591960  FIXME("stub\n");
     
    19791980  _ICOM_THIS_From_IOleCacheControl(DataCache, iface);
    19801981
    1981   return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 
     1982  return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject);
    19821983}
    19831984
     
    19871988 * See Windows documentation for more details on IUnknown methods.
    19881989 */
    1989 static ULONG WINAPI DataCache_IOleCacheControl_AddRef( 
     1990static ULONG WINAPI DataCache_IOleCacheControl_AddRef(
    19901991            IOleCacheControl* iface)
    19911992{
    19921993  _ICOM_THIS_From_IOleCacheControl(DataCache, iface);
    19931994
    1994   return IUnknown_AddRef(this->outerUnknown); 
     1995  return IUnknown_AddRef(this->outerUnknown);
    19951996}
    19961997
     
    20002001 * See Windows documentation for more details on IUnknown methods.
    20012002 */
    2002 static ULONG WINAPI DataCache_IOleCacheControl_Release( 
     2003static ULONG WINAPI DataCache_IOleCacheControl_Release(
    20032004            IOleCacheControl* iface)
    20042005{
    20052006  _ICOM_THIS_From_IOleCacheControl(DataCache, iface);
    20062007
    2007   return IUnknown_Release(this->outerUnknown); 
     2008  return IUnknown_Release(this->outerUnknown);
    20082009}
    20092010
    20102011static HRESULT WINAPI DataCache_OnRun(
    2011             IOleCacheControl* iface,
    2012             LPDATAOBJECT      pDataObject)
     2012        IOleCacheControl* iface,
     2013        LPDATAOBJECT      pDataObject)
    20132014{
    20142015  FIXME("stub\n");
     
    20172018
    20182019static HRESULT WINAPI DataCache_OnStop(
    2019             IOleCacheControl* iface)
     2020        IOleCacheControl* iface)
    20202021{
    20212022  FIXME("stub\n");
  • trunk/src/ole32/defaulthandler.c

    r5602 r6648  
     1/* $Id: defaulthandler.c,v 1.2 2001-09-05 13:17:08 bird Exp $ */
    12/*
    2  *      OLE 2 default object handler
     3 *  OLE 2 default object handler
    34 *
    45 *      Copyright 1999  Francis Beaudet
     
    2526 *   done in this area.
    2627 *
    27  * - Some functions still return E_NOTIMPL they have to be 
     28 * - Some functions still return E_NOTIMPL they have to be
    2829 *   implemented. Most of those are related to the running of the
    2930 *   actual server.
     
    5354   * List all interface VTables here
    5455   */
    55   ICOM_VTABLE(IOleObject)*      lpvtbl1; 
     56  ICOM_VTABLE(IOleObject)*      lpvtbl1;
    5657  ICOM_VTABLE(IUnknown)*        lpvtbl2;
    5758  ICOM_VTABLE(IDataObject)*     lpvtbl3;
     
    9091
    9192  /*
    92    * The IDataAdviseHolder maintains the data 
     93   * The IDataAdviseHolder maintains the data
    9394   * connections on behalf of the default handler.
    9495   */
     
    9899   * Name of the container and object contained
    99100   */
    100   LPWSTR containerApp; 
     101  LPWSTR containerApp;
    101102  LPWSTR containerObj;
    102103
     
    106107
    107108/*
    108  * Here, I define utility macros to help with the casting of the 
     109 * Here, I define utility macros to help with the casting of the
    109110 * "this" parameter.
    110111 * There is a version to accomodate all of the VTables implemented
     
    112113 */
    113114#define _ICOM_THIS_From_IOleObject(class,name)       class* this = (class*)name;
    114 #define _ICOM_THIS_From_NDIUnknown(class, name)      class* this = (class*)(((char*)name)-sizeof(void*)); 
    115 #define _ICOM_THIS_From_IDataObject(class, name)     class* this = (class*)(((char*)name)-2*sizeof(void*)); 
    116 #define _ICOM_THIS_From_IRunnableObject(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*)); 
     115#define _ICOM_THIS_From_NDIUnknown(class, name)      class* this = (class*)(((char*)name)-sizeof(void*));
     116#define _ICOM_THIS_From_IDataObject(class, name)     class* this = (class*)(((char*)name)-2*sizeof(void*));
     117#define _ICOM_THIS_From_IRunnableObject(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*));
    117118
    118119/*
     
    120121 */
    121122static DefaultHandler* DefaultHandler_Construct(REFCLSID  clsid,
    122                                                 LPUNKNOWN pUnkOuter);
     123                        LPUNKNOWN pUnkOuter);
    123124static void            DefaultHandler_Destroy(DefaultHandler* ptrToDestroy);
    124125
     
    131132            REFIID         riid,
    132133            void**         ppvObject);
    133 static ULONG WINAPI DefaultHandler_NDIUnknown_AddRef( 
     134static ULONG WINAPI DefaultHandler_NDIUnknown_AddRef(
    134135            IUnknown*      iface);
    135 static ULONG WINAPI DefaultHandler_NDIUnknown_Release( 
     136static ULONG WINAPI DefaultHandler_NDIUnknown_Release(
    136137            IUnknown*      iface);
    137138
     
    144145            REFIID           riid,
    145146            void**           ppvObject);
    146 static ULONG WINAPI DefaultHandler_AddRef( 
     147static ULONG WINAPI DefaultHandler_AddRef(
    147148            IOleObject*        iface);
    148 static ULONG WINAPI DefaultHandler_Release( 
     149static ULONG WINAPI DefaultHandler_Release(
    149150            IOleObject*        iface);
    150151static HRESULT WINAPI DefaultHandler_SetClientSite(
    151             IOleObject*        iface,
    152             IOleClientSite*    pClientSite);
     152        IOleObject*        iface,
     153        IOleClientSite*    pClientSite);
    153154static HRESULT WINAPI DefaultHandler_GetClientSite(
    154             IOleObject*        iface,
    155             IOleClientSite**   ppClientSite);
     155        IOleObject*        iface,
     156        IOleClientSite**   ppClientSite);
    156157static HRESULT WINAPI DefaultHandler_SetHostNames(
    157             IOleObject*        iface,
    158             LPCOLESTR          szContainerApp,
    159             LPCOLESTR          szContainerObj);
     158        IOleObject*        iface,
     159        LPCOLESTR          szContainerApp,
     160        LPCOLESTR          szContainerObj);
    160161static HRESULT WINAPI DefaultHandler_Close(
    161             IOleObject*        iface,
    162             DWORD              dwSaveOption);
     162        IOleObject*        iface,
     163        DWORD              dwSaveOption);
    163164static HRESULT WINAPI DefaultHandler_SetMoniker(
    164             IOleObject*        iface,
    165             DWORD              dwWhichMoniker,
    166             IMoniker*          pmk);
     165        IOleObject*        iface,
     166        DWORD              dwWhichMoniker,
     167        IMoniker*          pmk);
    167168static HRESULT WINAPI DefaultHandler_GetMoniker(
    168             IOleObject*        iface,
    169             DWORD              dwAssign,
    170             DWORD              dwWhichMoniker,
    171             IMoniker**         ppmk);
     169        IOleObject*        iface,
     170        DWORD              dwAssign,
     171        DWORD              dwWhichMoniker,
     172        IMoniker**         ppmk);
    172173static HRESULT WINAPI DefaultHandler_InitFromData(
    173             IOleObject*        iface,
    174             IDataObject*       pDataObject,
    175             BOOL               fCreation,
    176             DWORD              dwReserved);
     174        IOleObject*        iface,
     175        IDataObject*       pDataObject,
     176        BOOL               fCreation,
     177        DWORD              dwReserved);
    177178static HRESULT WINAPI DefaultHandler_GetClipboardData(
    178             IOleObject*        iface,
    179             DWORD              dwReserved,
    180             IDataObject**      ppDataObject);
     179        IOleObject*        iface,
     180        DWORD              dwReserved,
     181        IDataObject**      ppDataObject);
    181182static HRESULT WINAPI DefaultHandler_DoVerb(
    182             IOleObject*        iface,
    183             LONG               iVerb,
     183        IOleObject*        iface,
     184        LONG               iVerb,
    184185#ifdef __WIN32OS2__
    185             LPMSG              lpmsg,
     186        LPMSG              lpmsg,
    186187#else
    187             struct tagMSG*     lpmsg,
     188        struct tagMSG*     lpmsg,
    188189#endif
    189             IOleClientSite*    pActiveSite,
    190             LONG               lindex,
    191             HWND               hwndParent,
    192             LPCRECT            lprcPosRect);
     190        IOleClientSite*    pActiveSite,
     191        LONG               lindex,
     192        HWND               hwndParent,
     193        LPCRECT            lprcPosRect);
    193194static HRESULT WINAPI DefaultHandler_EnumVerbs(
    194             IOleObject*        iface,
    195             IEnumOLEVERB**     ppEnumOleVerb);
     195        IOleObject*        iface,
     196        IEnumOLEVERB**     ppEnumOleVerb);
    196197static HRESULT WINAPI DefaultHandler_Update(
    197             IOleObject*        iface);
     198        IOleObject*        iface);
    198199static HRESULT WINAPI DefaultHandler_IsUpToDate(
    199             IOleObject*        iface);
     200        IOleObject*        iface);
    200201static HRESULT WINAPI DefaultHandler_GetUserClassID(
    201             IOleObject*        iface,
    202             CLSID*             pClsid);
     202        IOleObject*        iface,
     203        CLSID*             pClsid);
    203204static HRESULT WINAPI DefaultHandler_GetUserType(
    204             IOleObject*        iface,
    205             DWORD              dwFormOfType,
    206             LPOLESTR*          pszUserType);
     205        IOleObject*        iface,
     206        DWORD              dwFormOfType,
     207        LPOLESTR*          pszUserType);
    207208static HRESULT WINAPI DefaultHandler_SetExtent(
    208             IOleObject*        iface,
    209             DWORD              dwDrawAspect,
    210             SIZEL*             psizel);
     209        IOleObject*        iface,
     210        DWORD              dwDrawAspect,
     211        SIZEL*             psizel);
    211212static HRESULT WINAPI DefaultHandler_GetExtent(
    212             IOleObject*        iface,
    213             DWORD              dwDrawAspect,
    214             SIZEL*             psizel);
     213        IOleObject*        iface,
     214        DWORD              dwDrawAspect,
     215        SIZEL*             psizel);
    215216static HRESULT WINAPI DefaultHandler_Advise(
    216             IOleObject*        iface,
    217             IAdviseSink*       pAdvSink,
    218             DWORD*             pdwConnection);
     217        IOleObject*        iface,
     218        IAdviseSink*       pAdvSink,
     219        DWORD*             pdwConnection);
    219220static HRESULT WINAPI DefaultHandler_Unadvise(
    220             IOleObject*        iface,
    221             DWORD              dwConnection);
     221        IOleObject*        iface,
     222        DWORD              dwConnection);
    222223static HRESULT WINAPI DefaultHandler_EnumAdvise(
    223             IOleObject*        iface,
    224             IEnumSTATDATA**    ppenumAdvise);
     224        IOleObject*        iface,
     225        IEnumSTATDATA**    ppenumAdvise);
    225226static HRESULT WINAPI DefaultHandler_GetMiscStatus(
    226             IOleObject*        iface,
    227             DWORD              dwAspect,
    228             DWORD*             pdwStatus);
     227        IOleObject*        iface,
     228        DWORD              dwAspect,
     229        DWORD*             pdwStatus);
    229230static HRESULT WINAPI DefaultHandler_SetColorScheme(
    230             IOleObject*           iface,
    231             struct tagLOGPALETTE* pLogpal);
     231        IOleObject*           iface,
     232        struct tagLOGPALETTE* pLogpal);
    232233
    233234/*
     
    239240            REFIID           riid,
    240241            void**           ppvObject);
    241 static ULONG WINAPI DefaultHandler_IDataObject_AddRef( 
     242static ULONG WINAPI DefaultHandler_IDataObject_AddRef(
    242243            IDataObject*     iface);
    243 static ULONG WINAPI DefaultHandler_IDataObject_Release( 
     244static ULONG WINAPI DefaultHandler_IDataObject_Release(
    244245            IDataObject*     iface);
    245246static HRESULT WINAPI DefaultHandler_GetData(
    246             IDataObject*     iface,
    247             LPFORMATETC      pformatetcIn,
    248             STGMEDIUM*       pmedium);
     247        IDataObject*     iface,
     248        LPFORMATETC      pformatetcIn,
     249        STGMEDIUM*       pmedium);
    249250static HRESULT WINAPI DefaultHandler_GetDataHere(
    250             IDataObject*     iface,
    251             LPFORMATETC      pformatetc,
    252             STGMEDIUM*       pmedium);
     251        IDataObject*     iface,
     252        LPFORMATETC      pformatetc,
     253        STGMEDIUM*       pmedium);
    253254static HRESULT WINAPI DefaultHandler_QueryGetData(
    254             IDataObject*     iface,
    255             LPFORMATETC      pformatetc);
     255        IDataObject*     iface,
     256        LPFORMATETC      pformatetc);
    256257static HRESULT WINAPI DefaultHandler_GetCanonicalFormatEtc(
    257             IDataObject*     iface,
    258             LPFORMATETC      pformatectIn,
    259             LPFORMATETC      pformatetcOut);
     258        IDataObject*     iface,
     259        LPFORMATETC      pformatectIn,
     260        LPFORMATETC      pformatetcOut);
    260261static HRESULT WINAPI DefaultHandler_SetData(
    261             IDataObject*     iface,
    262             LPFORMATETC      pformatetc,
    263             STGMEDIUM*       pmedium,
    264             BOOL             fRelease);
     262        IDataObject*     iface,
     263        LPFORMATETC      pformatetc,
     264        STGMEDIUM*       pmedium,
     265        BOOL             fRelease);
    265266static HRESULT WINAPI DefaultHandler_EnumFormatEtc(
    266             IDataObject*     iface,       
    267             DWORD            dwDirection,
    268             IEnumFORMATETC** ppenumFormatEtc);
     267        IDataObject*     iface,
     268        DWORD            dwDirection,
     269        IEnumFORMATETC** ppenumFormatEtc);
    269270static HRESULT WINAPI DefaultHandler_DAdvise(
    270             IDataObject*     iface,
    271             FORMATETC*       pformatetc,
    272             DWORD            advf,
    273             IAdviseSink*     pAdvSink,
    274             DWORD*           pdwConnection);
     271        IDataObject*     iface,
     272        FORMATETC*       pformatetc,
     273        DWORD            advf,
     274        IAdviseSink*     pAdvSink,
     275        DWORD*           pdwConnection);
    275276static HRESULT WINAPI DefaultHandler_DUnadvise(
    276             IDataObject*     iface,
    277             DWORD            dwConnection);
     277        IDataObject*     iface,
     278        DWORD            dwConnection);
    278279static HRESULT WINAPI DefaultHandler_EnumDAdvise(
    279             IDataObject*     iface,
    280             IEnumSTATDATA**  ppenumAdvise);
     280        IDataObject*     iface,
     281        IEnumSTATDATA**  ppenumAdvise);
    281282
    282283/*
     
    288289            REFIID               riid,
    289290            void**               ppvObject);
    290 static ULONG WINAPI DefaultHandler_IRunnableObject_AddRef( 
     291static ULONG WINAPI DefaultHandler_IRunnableObject_AddRef(
    291292            IRunnableObject*     iface);
    292 static ULONG WINAPI DefaultHandler_IRunnableObject_Release( 
     293static ULONG WINAPI DefaultHandler_IRunnableObject_Release(
    293294            IRunnableObject*     iface);
    294 static HRESULT WINAPI DefaultHandler_GetRunningClass(
    295             IRunnableObject*     iface,   
    296             LPCLSID              lpClsid);
    297 static HRESULT WINAPI DefaultHandler_Run(
     295static HRESULT WINAPI DefaultHandler_GetRunningClass(
    298296            IRunnableObject*     iface,
    299             IBindCtx*            pbc);
    300 static BOOL    WINAPI DefaultHandler_IsRunning(
     297        LPCLSID              lpClsid);
     298static HRESULT WINAPI DefaultHandler_Run(
     299            IRunnableObject*     iface,
     300        IBindCtx*            pbc);
     301static BOOL    WINAPI DefaultHandler_IsRunning(
    301302            IRunnableObject*     iface);
    302 static HRESULT WINAPI DefaultHandler_LockRunning( 
    303             IRunnableObject*     iface, 
    304             BOOL                 fLock,
    305             BOOL                 fLastUnlockCloses);
    306 static HRESULT WINAPI DefaultHandler_SetContainedObject( 
    307             IRunnableObject*     iface, 
    308             BOOL                 fContained);
     303static HRESULT WINAPI DefaultHandler_LockRunning(
     304            IRunnableObject*     iface,
     305        BOOL                 fLock,
     306        BOOL                 fLastUnlockCloses);
     307static HRESULT WINAPI DefaultHandler_SetContainedObject(
     308            IRunnableObject*     iface,
     309        BOOL                 fContained);
    309310
    310311
     
    407408   * IUnknown pointer can be returned to the outside.
    408409   */
    409   if ( (pUnkOuter!=NULL) && 
     410  if ( (pUnkOuter!=NULL) &&
    410411       (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) != 0) )
    411412    return CLASS_E_NOAGGREGATION;
     
    414415   * Try to construct a new instance of the class.
    415416   */
    416   newHandler = DefaultHandler_Construct(clsid, 
    417                                         pUnkOuter);
     417  newHandler = DefaultHandler_Construct(clsid,
     418                    pUnkOuter);
    418419
    419420  if (newHandler == 0)
     
    450451  if (newObject==0)
    451452    return newObject;
    452  
     453
    453454  /*
    454455   * Initialize the virtual function table.
     
    460461
    461462  /*
    462    * Start with one reference count. The caller of this function 
     463   * Start with one reference count. The caller of this function
    463464   * must release the interface pointer when it is done.
    464465   */
     
    467468  /*
    468469   * Initialize the outer unknown
    469    * We don't keep a reference on the outer unknown since, the way 
     470   * We don't keep a reference on the outer unknown since, the way
    470471   * aggregation works, our lifetime is at least as large as it's
    471472   * lifetime.
     
    479480   * Create a datacache object.
    480481   * We aggregate with the datacache. Make sure we pass our outer
    481    * unknown as the datacache's outer unknown. 
     482   * unknown as the datacache's outer unknown.
    482483   */
    483484  CreateDataCache(newObject->outerUnknown,
    484                   clsid,
    485                   &IID_IUnknown,
    486                   (void**)&newObject->dataCache);
     485          clsid,
     486          &IID_IUnknown,
     487          (void**)&newObject->dataCache);
    487488
    488489  /*
     
    516517    ptrToDestroy->containerObj = NULL;
    517518  }
    518  
     519
    519520  /*
    520521   * Release our reference to the data cache.
     
    585586  if ( (this==0) || (ppvObject==0) )
    586587    return E_INVALIDARG;
    587  
     588
    588589  /*
    589590   * Initialize the return parameter.
     
    594595   * Compare the riid with the interface IDs implemented by this object.
    595596   */
    596   if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 
     597  if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
    597598  {
    598599    *ppvObject = iface;
    599600  }
    600   else if (memcmp(&IID_IOleObject, riid, sizeof(IID_IOleObject)) == 0) 
     601  else if (memcmp(&IID_IOleObject, riid, sizeof(IID_IOleObject)) == 0)
    601602  {
    602603    *ppvObject = (IOleObject*)&(this->lpvtbl1);
    603604  }
    604   else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) 
     605  else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0)
    605606  {
    606607    *ppvObject = (IDataObject*)&(this->lpvtbl3);
    607608  }
    608   else if (memcmp(&IID_IRunnableObject, riid, sizeof(IID_IRunnableObject)) == 0) 
     609  else if (memcmp(&IID_IRunnableObject, riid, sizeof(IID_IRunnableObject)) == 0)
    609610  {
    610611    *ppvObject = (IRunnableObject*)&(this->lpvtbl4);
     
    616617     */
    617618    if (IUnknown_QueryInterface(this->dataCache, riid, ppvObject) == S_OK)
    618         return S_OK;
    619   }
    620  
     619    return S_OK;
     620  }
     621
    621622  /*
    622623   * Check that we obtained an interface.
     
    627628    return E_NOINTERFACE;
    628629  }
    629  
     630
    630631  /*
    631632   * Query Interface always increases the reference count by one when it is
    632    * successful. 
     633   * successful.
    633634   */
    634635  IUnknown_AddRef((IUnknown*)*ppvObject);
    635636
    636   return S_OK;; 
     637  return S_OK;;
    637638}
    638639
     
    645646 * to the outer unknown.
    646647 */
    647 static ULONG WINAPI DefaultHandler_NDIUnknown_AddRef( 
     648static ULONG WINAPI DefaultHandler_NDIUnknown_AddRef(
    648649            IUnknown*      iface)
    649650{
     
    663664 * to the outer unknown.
    664665 */
    665 static ULONG WINAPI DefaultHandler_NDIUnknown_Release( 
     666static ULONG WINAPI DefaultHandler_NDIUnknown_Release(
    666667            IUnknown*      iface)
    667668{
     
    682683    return 0;
    683684  }
    684  
     685
    685686  return this->ref;
    686687}
     
    703704  _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
    704705
    705   return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 
     706  return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject);
    706707}
    707708
     
    711712 * See Windows documentation for more details on IUnknown methods.
    712713 */
    713 static ULONG WINAPI DefaultHandler_AddRef( 
     714static ULONG WINAPI DefaultHandler_AddRef(
    714715            IOleObject*        iface)
    715716{
     
    724725 * See Windows documentation for more details on IUnknown methods.
    725726 */
    726 static ULONG WINAPI DefaultHandler_Release( 
     727static ULONG WINAPI DefaultHandler_Release(
    727728            IOleObject*        iface)
    728729{
     
    741742 */
    742743static HRESULT WINAPI DefaultHandler_SetClientSite(
    743             IOleObject*        iface,
    744             IOleClientSite*    pClientSite)
     744        IOleObject*        iface,
     745        IOleClientSite*    pClientSite)
    745746{
    746747  _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
     
    776777 */
    777778static HRESULT WINAPI DefaultHandler_GetClientSite(
    778             IOleObject*        iface,
    779             IOleClientSite**   ppClientSite)
     779        IOleObject*        iface,
     780        IOleClientSite**   ppClientSite)
    780781{
    781782  _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
     
    806807 */
    807808static HRESULT WINAPI DefaultHandler_SetHostNames(
    808             IOleObject*        iface,
    809             LPCOLESTR          szContainerApp,
    810             LPCOLESTR          szContainerObj)
     809        IOleObject*        iface,
     810        LPCOLESTR          szContainerApp,
     811        LPCOLESTR          szContainerObj)
    811812{
    812813  _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
    813814
    814815  TRACE("(%p, %s, %s)\n",
    815         iface,
    816         debugstr_w(szContainerApp),
    817         debugstr_w(szContainerObj));
     816    iface,
     817    debugstr_w(szContainerApp),
     818    debugstr_w(szContainerObj));
    818819
    819820  /*
    820821   * Be sure to cleanup before re-assinging the strings.
    821    */ 
     822   */
    822823  if (this->containerApp!=NULL)
    823824  {
     
    860861 */
    861862static HRESULT WINAPI DefaultHandler_Close(
    862             IOleObject*        iface,
    863             DWORD              dwSaveOption)
     863        IOleObject*        iface,
     864        DWORD              dwSaveOption)
    864865{
    865866  TRACE("()\n");
     
    875876 */
    876877static HRESULT WINAPI DefaultHandler_SetMoniker(
    877             IOleObject*        iface,
    878             DWORD              dwWhichMoniker,
    879             IMoniker*          pmk)
     878        IOleObject*        iface,
     879        DWORD              dwWhichMoniker,
     880        IMoniker*          pmk)
    880881{
    881882  TRACE("(%p, %ld, %p)\n",
    882         iface,
    883         dwWhichMoniker,
    884         pmk);
     883    iface,
     884    dwWhichMoniker,
     885    pmk);
    885886
    886887  return S_OK;
     
    895896 */
    896897static HRESULT WINAPI DefaultHandler_GetMoniker(
    897             IOleObject*        iface,
    898             DWORD              dwAssign,
    899             DWORD              dwWhichMoniker,
    900             IMoniker**         ppmk)
     898        IOleObject*        iface,
     899        DWORD              dwAssign,
     900        DWORD              dwWhichMoniker,
     901        IMoniker**         ppmk)
    901902{
    902903  _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
    903904
    904905  TRACE("(%p, %ld, %ld, %p)\n",
    905         iface, dwAssign, dwWhichMoniker, ppmk);
     906    iface, dwAssign, dwWhichMoniker, ppmk);
    906907
    907908  if (this->clientSite)
    908909  {
    909910    return IOleClientSite_GetMoniker(this->clientSite,
    910                                      dwAssign,
    911                                      dwWhichMoniker,
    912                                      ppmk);
    913                              
     911                     dwAssign,
     912                     dwWhichMoniker,
     913                     ppmk);
     914
    914915  }
    915916
     
    921922 *
    922923 * This method is meaningless if the server is not running
    923  * 
     924 *
    924925 * See Windows documentation for more details on IOleObject methods.
    925926 */
    926927static HRESULT WINAPI DefaultHandler_InitFromData(
    927             IOleObject*        iface,
    928             IDataObject*       pDataObject,
    929             BOOL               fCreation,
    930             DWORD              dwReserved)
     928        IOleObject*        iface,
     929        IDataObject*       pDataObject,
     930        BOOL               fCreation,
     931        DWORD              dwReserved)
    931932{
    932933  TRACE("(%p, %p, %d, %ld)\n",
    933         iface, pDataObject, fCreation, dwReserved);
     934    iface, pDataObject, fCreation, dwReserved);
    934935
    935936  return OLE_E_NOTRUNNING;
     
    940941 *
    941942 * This method is meaningless if the server is not running
    942  * 
     943 *
    943944 * See Windows documentation for more details on IOleObject methods.
    944945 */
    945946static HRESULT WINAPI DefaultHandler_GetClipboardData(
    946             IOleObject*        iface,
    947             DWORD              dwReserved,
    948             IDataObject**      ppDataObject)
     947        IOleObject*        iface,
     948        DWORD              dwReserved,
     949        IDataObject**      ppDataObject)
    949950{
    950951  TRACE("(%p, %ld, %p)\n",
    951         iface, dwReserved, ppDataObject);
     952    iface, dwReserved, ppDataObject);
    952953
    953954  return OLE_E_NOTRUNNING;
     
    955956
    956957static HRESULT WINAPI DefaultHandler_DoVerb(
    957             IOleObject*        iface,
    958             LONG               iVerb,
     958        IOleObject*        iface,
     959        LONG               iVerb,
    959960#ifdef __WIN32OS2__
    960             LPMSG              lpmsg,
     961        LPMSG              lpmsg,
    961962#else
    962             struct tagMSG*     lpmsg,
     963        struct tagMSG*     lpmsg,
    963964#endif
    964             IOleClientSite*    pActiveSite,
    965             LONG               lindex,
    966             HWND               hwndParent,
    967             LPCRECT            lprcPosRect)
     965        IOleClientSite*    pActiveSite,
     966        LONG               lindex,
     967        HWND               hwndParent,
     968        LPCRECT            lprcPosRect)
    968969{
    969970  FIXME(": Stub\n");
     
    976977 * The default handler implementation of this method simply delegates
    977978 * to OleRegEnumVerbs
    978  * 
     979 *
    979980 * See Windows documentation for more details on IOleObject methods.
    980981 */
    981982static HRESULT WINAPI DefaultHandler_EnumVerbs(
    982             IOleObject*        iface,
    983             IEnumOLEVERB**     ppEnumOleVerb)
     983        IOleObject*        iface,
     984        IEnumOLEVERB**     ppEnumOleVerb)
    984985{
    985986  _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
     
    991992
    992993static HRESULT WINAPI DefaultHandler_Update(
    993             IOleObject*        iface)
     994        IOleObject*        iface)
    994995{
    995996  FIXME(": Stub\n");
     
    10011002 *
    10021003 * This method is meaningless if the server is not running
    1003  * 
     1004 *
    10041005 * See Windows documentation for more details on IOleObject methods.
    10051006 */
    10061007static HRESULT WINAPI DefaultHandler_IsUpToDate(
    1007             IOleObject*        iface)
     1008        IOleObject*        iface)
    10081009{
    10091010  TRACE("(%p)\n", iface);
     
    10161017 *
    10171018 * TODO: Map to a new class ID if emulation is active.
    1018  * 
     1019 *
    10191020 * See Windows documentation for more details on IOleObject methods.
    10201021 */
    10211022static HRESULT WINAPI DefaultHandler_GetUserClassID(
    1022             IOleObject*        iface,
    1023             CLSID*             pClsid)
     1023        IOleObject*        iface,
     1024        CLSID*             pClsid)
    10241025{
    10251026  _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
     
    10431044 * The default handler implementation of this method simply delegates
    10441045 * to OleRegGetUserType
    1045  * 
     1046 *
    10461047 * See Windows documentation for more details on IOleObject methods.
    10471048 */
    10481049static HRESULT WINAPI DefaultHandler_GetUserType(
    1049             IOleObject*        iface,
    1050             DWORD              dwFormOfType,
    1051             LPOLESTR*          pszUserType)
     1050        IOleObject*        iface,
     1051        DWORD              dwFormOfType,
     1052        LPOLESTR*          pszUserType)
    10521053{
    10531054  _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
     
    10661067 */
    10671068static HRESULT WINAPI DefaultHandler_SetExtent(
    1068             IOleObject*        iface,
    1069             DWORD              dwDrawAspect,
    1070             SIZEL*             psizel)
     1069        IOleObject*        iface,
     1070        DWORD              dwDrawAspect,
     1071        SIZEL*             psizel)
    10711072{
    10721073  TRACE("(%p, %lx, (%ld x %ld))\n", iface,
     
    10841085 */
    10851086static HRESULT WINAPI DefaultHandler_GetExtent(
    1086             IOleObject*        iface,
    1087             DWORD              dwDrawAspect,
    1088             SIZEL*             psizel)
     1087        IOleObject*        iface,
     1088        DWORD              dwDrawAspect,
     1089        SIZEL*             psizel)
    10891090{
    10901091  DVTARGETDEVICE* targetDevice;
     
    10921093  HRESULT         hres;
    10931094
    1094   _ICOM_THIS_From_IOleObject(DefaultHandler, iface); 
     1095  _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
    10951096
    10961097  TRACE("(%p, %lx, %p)\n", iface, dwDrawAspect, psizel);
     
    11051106   *
    11061107   * Here we would build a valid DVTARGETDEVICE structure
    1107    * but, since we are calling into the data cache, we 
    1108    * know it's implementation and we'll skip this 
     1108   * but, since we are calling into the data cache, we
     1109   * know it's implementation and we'll skip this
    11091110   * extra work until later.
    11101111   */
     
    11121113
    11131114  hres = IViewObject2_GetExtent(cacheView,
    1114                                 dwDrawAspect,
    1115                                 -1,
    1116                                 targetDevice,
    1117                                 psizel);
     1115                dwDrawAspect,
     1116                -1,
     1117                targetDevice,
     1118                psizel);
    11181119
    11191120  /*
     
    11341135 */
    11351136static HRESULT WINAPI DefaultHandler_Advise(
    1136             IOleObject*        iface,
    1137             IAdviseSink*       pAdvSink,
    1138             DWORD*             pdwConnection)
     1137        IOleObject*        iface,
     1138        IAdviseSink*       pAdvSink,
     1139        DWORD*             pdwConnection)
    11391140{
    11401141  HRESULT hres = S_OK;
    1141   _ICOM_THIS_From_IOleObject(DefaultHandler, iface); 
     1142  _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
    11421143
    11431144  TRACE("(%p, %p, %p)\n", iface, pAdvSink, pdwConnection);
     
    11531154  if (SUCCEEDED(hres))
    11541155  {
    1155     hres = IOleAdviseHolder_Advise(this->oleAdviseHolder, 
    1156                                    pAdvSink,
    1157                                    pdwConnection);
     1156    hres = IOleAdviseHolder_Advise(this->oleAdviseHolder,
     1157                   pAdvSink,
     1158                   pdwConnection);
    11581159  }
    11591160
     
    11701171 */
    11711172static HRESULT WINAPI DefaultHandler_Unadvise(
    1172             IOleObject*        iface,
    1173             DWORD              dwConnection)
    1174 {
    1175   _ICOM_THIS_From_IOleObject(DefaultHandler, iface); 
     1173        IOleObject*        iface,
     1174        DWORD              dwConnection)
     1175{
     1176  _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
    11761177
    11771178  TRACE("(%p, %ld)\n", iface, dwConnection);
     
    11851186
    11861187  return IOleAdviseHolder_Unadvise(this->oleAdviseHolder,
    1187                                    dwConnection);
     1188                   dwConnection);
    11881189}
    11891190
     
    11971198 */
    11981199static HRESULT WINAPI DefaultHandler_EnumAdvise(
    1199             IOleObject*        iface,
    1200             IEnumSTATDATA**    ppenumAdvise)
    1201 {
    1202   _ICOM_THIS_From_IOleObject(DefaultHandler, iface); 
     1200        IOleObject*        iface,
     1201        IEnumSTATDATA**    ppenumAdvise)
     1202{
     1203  _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
    12031204
    12041205  TRACE("(%p, %p)\n", iface, ppenumAdvise);
     
    12171218  if (this->oleAdviseHolder==NULL)
    12181219    return IOleAdviseHolder_EnumAdvise(this->oleAdviseHolder,
    1219                                        ppenumAdvise);
     1220                       ppenumAdvise);
    12201221
    12211222  return S_OK;
     
    12311232 */
    12321233static HRESULT WINAPI DefaultHandler_GetMiscStatus(
    1233             IOleObject*        iface,
    1234             DWORD              dwAspect,
    1235             DWORD*             pdwStatus)
     1234        IOleObject*        iface,
     1235        DWORD              dwAspect,
     1236        DWORD*             pdwStatus)
    12361237{
    12371238  HRESULT hres;
     
    12561257 */
    12571258static HRESULT WINAPI DefaultHandler_SetColorScheme(
    1258             IOleObject*           iface,
    1259             struct tagLOGPALETTE* pLogpal)
     1259        IOleObject*           iface,
     1260        struct tagLOGPALETTE* pLogpal)
    12601261{
    12611262  TRACE("(%p, %p))\n", iface, pLogpal);
     
    12741275 */
    12751276static HRESULT WINAPI DefaultHandler_IDataObject_QueryInterface(
    1276             IDataObject*     iface, 
     1277            IDataObject*     iface,
    12771278           REFIID           riid,
    12781279            void**           ppvObject)
     
    12801281  _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
    12811282
    1282   return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 
     1283  return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject);
    12831284}
    12841285
     
    12881289 * See Windows documentation for more details on IUnknown methods.
    12891290 */
    1290 static ULONG WINAPI DefaultHandler_IDataObject_AddRef( 
     1291static ULONG WINAPI DefaultHandler_IDataObject_AddRef(
    12911292            IDataObject*     iface)
    12921293{
    12931294  _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
    12941295
    1295   return IUnknown_AddRef(this->outerUnknown); 
     1296  return IUnknown_AddRef(this->outerUnknown);
    12961297}
    12971298
     
    13011302 * See Windows documentation for more details on IUnknown methods.
    13021303 */
    1303 static ULONG WINAPI DefaultHandler_IDataObject_Release( 
     1304static ULONG WINAPI DefaultHandler_IDataObject_Release(
    13041305            IDataObject*     iface)
    13051306{
    13061307  _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
    13071308
    1308   return IUnknown_Release(this->outerUnknown); 
     1309  return IUnknown_Release(this->outerUnknown);
    13091310}
    13101311
     
    13171318 */
    13181319static HRESULT WINAPI DefaultHandler_GetData(
    1319             IDataObject*     iface,
    1320             LPFORMATETC      pformatetcIn,
    1321             STGMEDIUM*       pmedium)
     1320        IDataObject*     iface,
     1321        LPFORMATETC      pformatetcIn,
     1322        STGMEDIUM*       pmedium)
    13221323{
    13231324  IDataObject* cacheDataObject = NULL;
     
    13281329  TRACE("(%p, %p, %p)\n", iface, pformatetcIn, pmedium);
    13291330
    1330   hres = IUnknown_QueryInterface(this->dataCache, 
    1331                                 &IID_IDataObject,
    1332                                 (void**)&cacheDataObject);
     1331  hres = IUnknown_QueryInterface(this->dataCache,
     1332                &IID_IDataObject,
     1333                (void**)&cacheDataObject);
    13331334
    13341335  if (FAILED(hres))
     
    13361337
    13371338  hres = IDataObject_GetData(cacheDataObject,
    1338                              pformatetcIn,
    1339                              pmedium);
    1340  
     1339                 pformatetcIn,
     1340                 pmedium);
     1341
    13411342  IDataObject_Release(cacheDataObject);
    1342  
     1343
    13431344  return hres;
    13441345}
    13451346
    13461347static HRESULT WINAPI DefaultHandler_GetDataHere(
    1347             IDataObject*     iface,
    1348             LPFORMATETC      pformatetc,
    1349             STGMEDIUM*       pmedium)
     1348        IDataObject*     iface,
     1349        LPFORMATETC      pformatetc,
     1350        STGMEDIUM*       pmedium)
    13501351{
    13511352  FIXME(": Stub\n");
     
    13561357 * DefaultHandler_QueryGetData (IDataObject)
    13571358 *
    1358  * The default handler's implementation of this method delegates to 
     1359 * The default handler's implementation of this method delegates to
    13591360 * the cache.
    13601361 *
     
    13621363 */
    13631364static HRESULT WINAPI DefaultHandler_QueryGetData(
    1364             IDataObject*     iface,
    1365             LPFORMATETC      pformatetc)
     1365        IDataObject*     iface,
     1366        LPFORMATETC      pformatetc)
    13661367{
    13671368  IDataObject* cacheDataObject = NULL;
     
    13721373  TRACE("(%p, %p)\n", iface, pformatetc);
    13731374
    1374   hres = IUnknown_QueryInterface(this->dataCache, 
    1375                                 &IID_IDataObject,
    1376                                 (void**)&cacheDataObject);
     1375  hres = IUnknown_QueryInterface(this->dataCache,
     1376                &IID_IDataObject,
     1377                (void**)&cacheDataObject);
    13771378
    13781379  if (FAILED(hres))
     
    13801381
    13811382  hres = IDataObject_QueryGetData(cacheDataObject,
    1382                                   pformatetc);
     1383                  pformatetc);
    13831384
    13841385  IDataObject_Release(cacheDataObject);
    1385  
     1386
    13861387  return hres;
    13871388}
     
    13951396 */
    13961397static HRESULT WINAPI DefaultHandler_GetCanonicalFormatEtc(
    1397             IDataObject*     iface,
    1398             LPFORMATETC      pformatectIn,
    1399             LPFORMATETC      pformatetcOut)
     1398        IDataObject*     iface,
     1399        LPFORMATETC      pformatectIn,
     1400        LPFORMATETC      pformatetcOut)
    14001401{
    14011402  FIXME("(%p, %p, %p)\n", iface, pformatectIn, pformatetcOut);
     
    14071408 * DefaultHandler_SetData (IDataObject)
    14081409 *
    1409  * The default handler's implementation of this method delegates to 
     1410 * The default handler's implementation of this method delegates to
    14101411 * the cache.
    14111412 *
     
    14131414 */
    14141415static HRESULT WINAPI DefaultHandler_SetData(
    1415             IDataObject*     iface,
    1416             LPFORMATETC      pformatetc,
    1417             STGMEDIUM*       pmedium,
    1418             BOOL             fRelease)
     1416        IDataObject*     iface,
     1417        LPFORMATETC      pformatetc,
     1418        STGMEDIUM*       pmedium,
     1419        BOOL             fRelease)
    14191420{
    14201421  IDataObject* cacheDataObject = NULL;
     
    14251426  TRACE("(%p, %p, %p, %d)\n", iface, pformatetc, pmedium, fRelease);
    14261427
    1427   hres = IUnknown_QueryInterface(this->dataCache, 
    1428                                 &IID_IDataObject,
    1429                                 (void**)&cacheDataObject);
     1428  hres = IUnknown_QueryInterface(this->dataCache,
     1429                &IID_IDataObject,
     1430                (void**)&cacheDataObject);
    14301431
    14311432  if (FAILED(hres))
     
    14331434
    14341435  hres = IDataObject_SetData(cacheDataObject,
    1435                              pformatetc,
    1436                              pmedium,
    1437                              fRelease);
    1438  
     1436                 pformatetc,
     1437                 pmedium,
     1438                 fRelease);
     1439
    14391440  IDataObject_Release(cacheDataObject);
    1440  
     1441
    14411442  return hres;
    14421443}
     
    14511452 */
    14521453static HRESULT WINAPI DefaultHandler_EnumFormatEtc(
    1453             IDataObject*     iface,       
    1454             DWORD            dwDirection,
    1455             IEnumFORMATETC** ppenumFormatEtc)
     1454        IDataObject*     iface,
     1455        DWORD            dwDirection,
     1456        IEnumFORMATETC** ppenumFormatEtc)
    14561457{
    14571458  HRESULT hres;
     
    14741475 */
    14751476static HRESULT WINAPI DefaultHandler_DAdvise(
    1476             IDataObject*     iface,
    1477             FORMATETC*       pformatetc,
    1478             DWORD            advf,
    1479             IAdviseSink*     pAdvSink,
    1480             DWORD*           pdwConnection)
     1477        IDataObject*     iface,
     1478        FORMATETC*       pformatetc,
     1479        DWORD            advf,
     1480        IAdviseSink*     pAdvSink,
     1481        DWORD*           pdwConnection)
    14811482{
    14821483  HRESULT hres = S_OK;
    1483   _ICOM_THIS_From_IDataObject(DefaultHandler, iface); 
    1484 
    1485   TRACE("(%p, %p, %ld, %p, %p)\n", 
    1486         iface, pformatetc, advf, pAdvSink, pdwConnection);
     1484  _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
     1485
     1486  TRACE("(%p, %p, %ld, %p, %p)\n",
     1487    iface, pformatetc, advf, pAdvSink, pdwConnection);
    14871488
    14881489  /*
     
    14961497  if (SUCCEEDED(hres))
    14971498  {
    1498     hres = IDataAdviseHolder_Advise(this->dataAdviseHolder, 
    1499                                     iface,
    1500                                     pformatetc,
    1501                                     advf,
    1502                                     pAdvSink,
    1503                                     pdwConnection);
     1499    hres = IDataAdviseHolder_Advise(this->dataAdviseHolder,
     1500                    iface,
     1501                    pformatetc,
     1502                    advf,
     1503                    pAdvSink,
     1504                    pdwConnection);
    15041505  }
    15051506
     
    15161517 */
    15171518static HRESULT WINAPI DefaultHandler_DUnadvise(
    1518             IDataObject*     iface,
    1519             DWORD            dwConnection)
    1520 {
    1521   _ICOM_THIS_From_IDataObject(DefaultHandler, iface); 
     1519        IDataObject*     iface,
     1520        DWORD            dwConnection)
     1521{
     1522  _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
    15221523
    15231524  TRACE("(%p, %ld)\n", iface, dwConnection);
     
    15321533  }
    15331534
    1534   return IDataAdviseHolder_Unadvise(this->dataAdviseHolder, 
    1535                                     dwConnection);
     1535  return IDataAdviseHolder_Unadvise(this->dataAdviseHolder,
     1536                    dwConnection);
    15361537}
    15371538
     
    15451546 */
    15461547static HRESULT WINAPI DefaultHandler_EnumDAdvise(
    1547             IDataObject*     iface,
    1548             IEnumSTATDATA**  ppenumAdvise)
    1549 {
    1550   _ICOM_THIS_From_IDataObject(DefaultHandler, iface); 
     1548        IDataObject*     iface,
     1549        IEnumSTATDATA**  ppenumAdvise)
     1550{
     1551  _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
    15511552
    15521553  TRACE("(%p, %p)\n", iface, ppenumAdvise);
     
    15681569  if (this->dataAdviseHolder!=NULL)
    15691570  {
    1570     return IDataAdviseHolder_EnumAdvise(this->dataAdviseHolder, 
    1571                                         ppenumAdvise);
     1571    return IDataAdviseHolder_EnumAdvise(this->dataAdviseHolder,
     1572                    ppenumAdvise);
    15721573  }
    15731574
     
    15761577
    15771578/*********************************************************
    1578  * Methods implementation for the IRunnableObject part 
     1579 * Methods implementation for the IRunnableObject part
    15791580 * of the DefaultHandler class.
    15801581 */
     
    15921593  _ICOM_THIS_From_IRunnableObject(DefaultHandler, iface);
    15931594
    1594   return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject); 
     1595  return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject);
    15951596}
    15961597
     
    16001601 * See Windows documentation for more details on IUnknown methods.
    16011602 */
    1602 static ULONG WINAPI DefaultHandler_IRunnableObject_AddRef( 
     1603static ULONG WINAPI DefaultHandler_IRunnableObject_AddRef(
    16031604            IRunnableObject*     iface)
    16041605{
     
    16131614 * See Windows documentation for more details on IUnknown methods.
    16141615 */
    1615 static ULONG WINAPI DefaultHandler_IRunnableObject_Release( 
     1616static ULONG WINAPI DefaultHandler_IRunnableObject_Release(
    16161617            IRunnableObject*     iface)
    16171618{
     
    16241625 * DefaultHandler_GetRunningClass (IRunnableObject)
    16251626 *
    1626  * According to Brockscmidt, Chapter 19, the default handler's 
     1627 * According to Brockscmidt, Chapter 19, the default handler's
    16271628 * implementation of IRunnableobject does nothing until the object
    16281629 * is actually running.
     
    16301631 * See Windows documentation for more details on IRunnableObject methods.
    16311632 */
    1632 static HRESULT WINAPI DefaultHandler_GetRunningClass( 
    1633             IRunnableObject*     iface,   
    1634             LPCLSID              lpClsid)
     1633static HRESULT WINAPI DefaultHandler_GetRunningClass(
     1634            IRunnableObject*     iface,
     1635        LPCLSID              lpClsid)
    16351636{
    16361637  TRACE("()\n");
     
    16381639}
    16391640
    1640 static HRESULT WINAPI DefaultHandler_Run( 
     1641static HRESULT WINAPI DefaultHandler_Run(
    16411642            IRunnableObject*     iface,
    1642             IBindCtx*            pbc)
     1643        IBindCtx*            pbc)
    16431644{
    16441645  FIXME(": Stub\n");
     
    16491650 * DefaultHandler_IsRunning (IRunnableObject)
    16501651 *
    1651  * According to Brockscmidt, Chapter 19, the default handler's 
     1652 * According to Brockscmidt, Chapter 19, the default handler's
    16521653 * implementation of IRunnableobject does nothing until the object
    16531654 * is actually running.
     
    16551656 * See Windows documentation for more details on IRunnableObject methods.
    16561657 */
    1657 static BOOL    WINAPI DefaultHandler_IsRunning( 
     1658static BOOL    WINAPI DefaultHandler_IsRunning(
    16581659            IRunnableObject*     iface)
    16591660{
     
    16651666 * DefaultHandler_LockRunning (IRunnableObject)
    16661667 *
    1667  * According to Brockscmidt, Chapter 19, the default handler's 
     1668 * According to Brockscmidt, Chapter 19, the default handler's
    16681669 * implementation of IRunnableobject does nothing until the object
    16691670 * is actually running.
     
    16711672 * See Windows documentation for more details on IRunnableObject methods.
    16721673 */
    1673 static HRESULT WINAPI DefaultHandler_LockRunning( 
    1674             IRunnableObject*     iface, 
    1675             BOOL                 fLock,
    1676             BOOL                 fLastUnlockCloses)
     1674static HRESULT WINAPI DefaultHandler_LockRunning(
     1675            IRunnableObject*     iface,
     1676        BOOL                 fLock,
     1677        BOOL                 fLastUnlockCloses)
    16771678{
    16781679  TRACE("()\n");
     
    16831684 * DefaultHandler_SetContainedObject (IRunnableObject)
    16841685 *
    1685  * According to Brockscmidt, Chapter 19, the default handler's 
     1686 * According to Brockscmidt, Chapter 19, the default handler's
    16861687 * implementation of IRunnableobject does nothing until the object
    16871688 * is actually running.
     
    16891690 * See Windows documentation for more details on IRunnableObject methods.
    16901691 */
    1691 static HRESULT WINAPI DefaultHandler_SetContainedObject( 
    1692             IRunnableObject*     iface, 
    1693             BOOL                 fContained)
     1692static HRESULT WINAPI DefaultHandler_SetContainedObject(
     1693            IRunnableObject*     iface,
     1694        BOOL                 fContained)
    16941695{
    16951696  TRACE("()\n");
  • trunk/src/ole32/errorinfo.c

    r5602 r6648  
     1/* $Id: errorinfo.c,v 1.3 2001-09-05 13:17:09 bird Exp $ */
    12/*
    23 * ErrorInfo API
     
    56 *
    67 *
    7  * The errorinfo is a per-thread object. The reference is stored in the 
     8 * The errorinfo is a per-thread object. The reference is stored in the
    89 * TEB at offset 0xf80
    910 */
     
    3031    WCHAR* stringBuffer;
    3132    DWORD len;
    32    
     33
    3334    if (in == NULL)
    34         return NULL;
     35    return NULL;
    3536    /*
    3637     * Find the lenth of the buffer passed-in in bytes.
     
    8990{
    9091    DWORD* bufferPointer;
    91    
     92
    9293    /* NULL is a valid parameter */
    9394    if(!in) return;
     
    111112typedef struct ErrorInfoImpl
    112113{
    113         ICOM_VTABLE(IErrorInfo)         *lpvtei;
    114         ICOM_VTABLE(ICreateErrorInfo)   *lpvtcei;
    115         ICOM_VTABLE(ISupportErrorInfo)  *lpvtsei;
    116         DWORD                           ref;
    117        
    118         GUID m_Guid;
    119         BSTR bstrSource;
    120         BSTR bstrDescription;
    121         BSTR bstrHelpFile;
    122         DWORD m_dwHelpContext;
     114    ICOM_VTABLE(IErrorInfo)     *lpvtei;
     115    ICOM_VTABLE(ICreateErrorInfo)   *lpvtcei;
     116    ICOM_VTABLE(ISupportErrorInfo)  *lpvtsei;
     117    DWORD               ref;
     118
     119    GUID m_Guid;
     120    BSTR bstrSource;
     121    BSTR bstrDescription;
     122    BSTR bstrHelpFile;
     123    DWORD m_dwHelpContext;
    123124} ErrorInfoImpl;
    124125
    125 static ICOM_VTABLE(IErrorInfo)          IErrorInfoImpl_VTable;
    126 static ICOM_VTABLE(ICreateErrorInfo)    ICreateErrorInfoImpl_VTable;
    127 static ICOM_VTABLE(ISupportErrorInfo)   ISupportErrorInfoImpl_VTable;
     126static ICOM_VTABLE(IErrorInfo)      IErrorInfoImpl_VTable;
     127static ICOM_VTABLE(ICreateErrorInfo)    ICreateErrorInfoImpl_VTable;
     128static ICOM_VTABLE(ISupportErrorInfo)   ISupportErrorInfoImpl_VTable;
    128129
    129130/*
    130131 converts a objectpointer to This
    131132 */
    132 #define _IErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtei))) 
    133 #define _ICOM_THIS_From_IErrorInfo(class, name) class* This = (class*)(((char*)name)-_IErrorInfo_Offset); 
    134 
    135 #define _ICreateErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtcei))) 
    136 #define _ICOM_THIS_From_ICreateErrorInfo(class, name) class* This = (class*)(((char*)name)-_ICreateErrorInfo_Offset); 
    137 
    138 #define _ISupportErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtsei))) 
    139 #define _ICOM_THIS_From_ISupportErrorInfo(class, name) class* This = (class*)(((char*)name)-_ISupportErrorInfo_Offset); 
     133#define _IErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtei)))
     134#define _ICOM_THIS_From_IErrorInfo(class, name) class* This = (class*)(((char*)name)-_IErrorInfo_Offset);
     135
     136#define _ICreateErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtcei)))
     137#define _ICOM_THIS_From_ICreateErrorInfo(class, name) class* This = (class*)(((char*)name)-_ICreateErrorInfo_Offset);
     138
     139#define _ISupportErrorInfo_Offset ((int)(&(((ErrorInfoImpl*)0)->lpvtsei)))
     140#define _ICOM_THIS_From_ISupportErrorInfo(class, name) class* This = (class*)(((char*)name)-_ISupportErrorInfo_Offset);
    140141
    141142/*
    142143 converts This to a objectpointer
    143144 */
    144 #define _IErrorInfo_(This)              (IErrorInfo*)&(This->lpvtei)
    145 #define _ICreateErrorInfo_(This)        (ICreateErrorInfo*)&(This->lpvtcei)
    146 #define _ISupportErrorInfo_(This)       (ISupportErrorInfo*)&(This->lpvtsei)
     145#define _IErrorInfo_(This)      (IErrorInfo*)&(This->lpvtei)
     146#define _ICreateErrorInfo_(This)    (ICreateErrorInfo*)&(This->lpvtcei)
     147#define _ISupportErrorInfo_(This)   (ISupportErrorInfo*)&(This->lpvtsei)
    147148
    148149IErrorInfo * IErrorInfoImpl_Constructor()
    149150{
    150         ErrorInfoImpl * ei = HeapAlloc(GetProcessHeap(), 0, sizeof(ErrorInfoImpl));
    151         if (ei)
    152         {
    153           ei->lpvtei = &IErrorInfoImpl_VTable;
    154           ei->lpvtcei = &ICreateErrorInfoImpl_VTable;
    155           ei->lpvtsei = &ISupportErrorInfoImpl_VTable;
    156           ei->ref = 1;
    157           ei->bstrSource = NULL;
    158           ei->bstrDescription = NULL;
    159           ei->bstrHelpFile = NULL;
    160           ei->m_dwHelpContext = 0;
    161         }
    162         return (IErrorInfo *)ei;
     151    ErrorInfoImpl * ei = HeapAlloc(GetProcessHeap(), 0, sizeof(ErrorInfoImpl));
     152    if (ei)
     153    {
     154      ei->lpvtei = &IErrorInfoImpl_VTable;
     155      ei->lpvtcei = &ICreateErrorInfoImpl_VTable;
     156      ei->lpvtsei = &ISupportErrorInfoImpl_VTable;
     157      ei->ref = 1;
     158      ei->bstrSource = NULL;
     159      ei->bstrDescription = NULL;
     160      ei->bstrHelpFile = NULL;
     161      ei->m_dwHelpContext = 0;
     162    }
     163    return (IErrorInfo *)ei;
    163164}
    164165
    165166
    166167static HRESULT WINAPI IErrorInfoImpl_QueryInterface(
    167         IErrorInfo* iface,
    168         REFIID     riid,
    169         VOID**     ppvoid)
    170 {
    171         _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
    172         TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvoid);
    173 
    174         *ppvoid = NULL;
    175 
    176         if(IsEqualIID(riid, &IID_IErrorInfo))
    177         {
    178           *ppvoid = _IErrorInfo_(This);
    179         }
    180         else if(IsEqualIID(riid, &IID_ICreateErrorInfo))
    181         {
    182           *ppvoid = _ICreateErrorInfo_(This);
    183         }
    184         else if(IsEqualIID(riid, &IID_ISupportErrorInfo))
    185         {
    186           *ppvoid = _ISupportErrorInfo_(This);
    187         }
    188 
    189         if(*ppvoid)
    190         {
    191           IUnknown_AddRef( (IUnknown*)*ppvoid );
    192           TRACE("-- Interface: (%p)->(%p)\n",ppvoid,*ppvoid);
    193           return S_OK;
    194         }
    195         TRACE("-- Interface: E_NOINTERFACE\n");
    196         return E_NOINTERFACE;
     168    IErrorInfo* iface,
     169    REFIID     riid,
     170    VOID**     ppvoid)
     171{
     172    _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
     173    TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvoid);
     174
     175    *ppvoid = NULL;
     176
     177    if(IsEqualIID(riid, &IID_IErrorInfo))
     178    {
     179      *ppvoid = _IErrorInfo_(This);
     180    }
     181    else if(IsEqualIID(riid, &IID_ICreateErrorInfo))
     182    {
     183      *ppvoid = _ICreateErrorInfo_(This);
     184    }
     185    else if(IsEqualIID(riid, &IID_ISupportErrorInfo))
     186    {
     187      *ppvoid = _ISupportErrorInfo_(This);
     188    }
     189
     190    if(*ppvoid)
     191    {
     192      IUnknown_AddRef( (IUnknown*)*ppvoid );
     193      TRACE("-- Interface: (%p)->(%p)\n",ppvoid,*ppvoid);
     194      return S_OK;
     195    }
     196    TRACE("-- Interface: E_NOINTERFACE\n");
     197    return E_NOINTERFACE;
    197198}
    198199
    199200static ULONG WINAPI IErrorInfoImpl_AddRef(
    200         IErrorInfo* iface)
    201 {
    202         _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
    203         TRACE("(%p)->(count=%lu)\n",This,This->ref);
    204         return InterlockedIncrement(&This->ref);
     201    IErrorInfo* iface)
     202{
     203    _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
     204    TRACE("(%p)->(count=%lu)\n",This,This->ref);
     205    return InterlockedIncrement(&This->ref);
    205206}
    206207
    207208static ULONG WINAPI IErrorInfoImpl_Release(
    208         IErrorInfo* iface)
    209 {
    210         _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
    211         TRACE("(%p)->(count=%lu)\n",This,This->ref);
    212 
    213         if (!InterlockedDecrement(&This->ref))
    214         {
    215           TRACE("-- destroying IErrorInfo(%p)\n",This);
    216           HeapFree(GetProcessHeap(),0,This);
    217           return 0;
    218         }
    219         return This->ref;
     209    IErrorInfo* iface)
     210{
     211    _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
     212    TRACE("(%p)->(count=%lu)\n",This,This->ref);
     213
     214    if (!InterlockedDecrement(&This->ref))
     215    {
     216      TRACE("-- destroying IErrorInfo(%p)\n",This);
     217      HeapFree(GetProcessHeap(),0,This);
     218      return 0;
     219    }
     220    return This->ref;
    220221}
    221222
    222223static HRESULT WINAPI IErrorInfoImpl_GetGUID(
    223         IErrorInfo* iface,
    224         GUID * pGUID)
    225 {
    226         _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
    227         TRACE("(%p)->(count=%lu)\n",This,This->ref);
    228         if(!pGUID )return E_INVALIDARG;
    229         memcpy(pGUID, &This->m_Guid, sizeof(GUID));
    230         return S_OK;
     224    IErrorInfo* iface,
     225    GUID * pGUID)
     226{
     227    _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
     228    TRACE("(%p)->(count=%lu)\n",This,This->ref);
     229    if(!pGUID )return E_INVALIDARG;
     230    memcpy(pGUID, &This->m_Guid, sizeof(GUID));
     231    return S_OK;
    231232}
    232233
    233234static HRESULT WINAPI IErrorInfoImpl_GetSource(
    234         IErrorInfo* iface,
    235         BSTR *pBstrSource)
    236 {
    237         _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
    238         TRACE("(%p)->(pBstrSource=%p)\n",This,pBstrSource);
    239         if (pBstrSource == NULL)
    240             return E_INVALIDARG;
    241         *pBstrSource = ERRORINFO_SysAllocString(This->bstrSource);
    242         return S_OK;
     235    IErrorInfo* iface,
     236    BSTR *pBstrSource)
     237{
     238    _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
     239    TRACE("(%p)->(pBstrSource=%p)\n",This,pBstrSource);
     240    if (pBstrSource == NULL)
     241        return E_INVALIDARG;
     242    *pBstrSource = ERRORINFO_SysAllocString(This->bstrSource);
     243    return S_OK;
    243244}
    244245
    245246static HRESULT WINAPI IErrorInfoImpl_GetDescription(
    246         IErrorInfo* iface,
    247         BSTR *pBstrDescription)
    248 {
    249         _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
    250 
    251         TRACE("(%p)->(pBstrDescription=%p)\n",This,pBstrDescription);
    252         if (pBstrDescription == NULL)
    253             return E_INVALIDARG;
    254         *pBstrDescription = ERRORINFO_SysAllocString(This->bstrDescription);
    255        
    256         return S_OK;
     247    IErrorInfo* iface,
     248    BSTR *pBstrDescription)
     249{
     250    _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
     251
     252    TRACE("(%p)->(pBstrDescription=%p)\n",This,pBstrDescription);
     253    if (pBstrDescription == NULL)
     254        return E_INVALIDARG;
     255    *pBstrDescription = ERRORINFO_SysAllocString(This->bstrDescription);
     256
     257    return S_OK;
    257258}
    258259
    259260static HRESULT WINAPI IErrorInfoImpl_GetHelpFile(
    260         IErrorInfo* iface,
    261         BSTR *pBstrHelpFile)
    262 {
    263         _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
    264 
    265         TRACE("(%p)->(pBstrHelpFile=%p)\n",This, pBstrHelpFile);
    266         if (pBstrHelpFile == NULL)
    267             return E_INVALIDARG;
    268         *pBstrHelpFile = ERRORINFO_SysAllocString(This->bstrHelpFile);
    269        
    270         return S_OK;
     261    IErrorInfo* iface,
     262    BSTR *pBstrHelpFile)
     263{
     264    _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
     265
     266    TRACE("(%p)->(pBstrHelpFile=%p)\n",This, pBstrHelpFile);
     267    if (pBstrHelpFile == NULL)
     268        return E_INVALIDARG;
     269    *pBstrHelpFile = ERRORINFO_SysAllocString(This->bstrHelpFile);
     270
     271    return S_OK;
    271272}
    272273
    273274static HRESULT WINAPI IErrorInfoImpl_GetHelpContext(
    274         IErrorInfo* iface,
    275         DWORD *pdwHelpContext)
    276 {
    277         _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
    278         TRACE("(%p)->(pdwHelpContext=%p)\n",This, pdwHelpContext);
    279         if (pdwHelpContext == NULL)
    280             return E_INVALIDARG;
    281         *pdwHelpContext = This->m_dwHelpContext;
    282        
    283         return S_OK;
     275    IErrorInfo* iface,
     276    DWORD *pdwHelpContext)
     277{
     278    _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface);
     279    TRACE("(%p)->(pdwHelpContext=%p)\n",This, pdwHelpContext);
     280    if (pdwHelpContext == NULL)
     281        return E_INVALIDARG;
     282    *pdwHelpContext = This->m_dwHelpContext;
     283
     284    return S_OK;
    284285}
    285286
     
    290291  IErrorInfoImpl_AddRef,
    291292  IErrorInfoImpl_Release,
    292  
     293
    293294  IErrorInfoImpl_GetGUID,
    294295  IErrorInfoImpl_GetSource,
     
    300301
    301302static HRESULT WINAPI ICreateErrorInfoImpl_QueryInterface(
    302         ICreateErrorInfo* iface,
    303         REFIID     riid,
    304         VOID**     ppvoid)
    305 {
    306         _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
    307         TRACE("(%p)\n", This);
    308         return IErrorInfo_QueryInterface(_IErrorInfo_(This), riid, ppvoid);
     303    ICreateErrorInfo* iface,
     304    REFIID     riid,
     305    VOID**     ppvoid)
     306{
     307    _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
     308    TRACE("(%p)\n", This);
     309    return IErrorInfo_QueryInterface(_IErrorInfo_(This), riid, ppvoid);
    309310}
    310311
    311312static ULONG WINAPI ICreateErrorInfoImpl_AddRef(
    312         ICreateErrorInfo* iface)
    313 {
    314         _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
    315         TRACE("(%p)\n", This);
    316         return IErrorInfo_AddRef(_IErrorInfo_(This));
     313    ICreateErrorInfo* iface)
     314{
     315    _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
     316    TRACE("(%p)\n", This);
     317    return IErrorInfo_AddRef(_IErrorInfo_(This));
    317318}
    318319
    319320static ULONG WINAPI ICreateErrorInfoImpl_Release(
    320         ICreateErrorInfo* iface)
    321 {
    322         _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
    323         TRACE("(%p)\n", This);
    324         return IErrorInfo_Release(_IErrorInfo_(This));
     321    ICreateErrorInfo* iface)
     322{
     323    _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
     324    TRACE("(%p)\n", This);
     325    return IErrorInfo_Release(_IErrorInfo_(This));
    325326}
    326327
    327328
    328329static HRESULT WINAPI ICreateErrorInfoImpl_SetGUID(
    329         ICreateErrorInfo* iface,
    330         REFGUID rguid)
    331 {
    332         _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
    333         TRACE("(%p)->(%s)\n", This, debugstr_guid(rguid));
    334         memcpy(&This->m_Guid,  rguid, sizeof(GUID));
    335         return S_OK;
     330    ICreateErrorInfo* iface,
     331    REFGUID rguid)
     332{
     333    _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
     334    TRACE("(%p)->(%s)\n", This, debugstr_guid(rguid));
     335    memcpy(&This->m_Guid,  rguid, sizeof(GUID));
     336    return S_OK;
    336337}
    337338
    338339static HRESULT WINAPI ICreateErrorInfoImpl_SetSource(
    339         ICreateErrorInfo* iface,
    340         LPOLESTR szSource)
    341 {
    342         _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
    343         TRACE("(%p)\n",This);
    344         if (This->bstrSource != NULL)
    345             ERRORINFO_SysFreeString(This->bstrSource);
    346         This->bstrSource = ERRORINFO_SysAllocString(szSource);
    347        
    348         return S_OK;
     340    ICreateErrorInfo* iface,
     341    LPOLESTR szSource)
     342{
     343    _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
     344    TRACE("(%p)\n",This);
     345    if (This->bstrSource != NULL)
     346        ERRORINFO_SysFreeString(This->bstrSource);
     347    This->bstrSource = ERRORINFO_SysAllocString(szSource);
     348
     349    return S_OK;
    349350}
    350351
    351352static HRESULT WINAPI ICreateErrorInfoImpl_SetDescription(
    352         ICreateErrorInfo* iface,
    353         LPOLESTR szDescription)
    354 {
    355         _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
    356         TRACE("(%p)\n",This);
    357         if (This->bstrDescription != NULL)
    358             ERRORINFO_SysFreeString(This->bstrDescription);
    359         This->bstrDescription = ERRORINFO_SysAllocString(szDescription);
    360        
    361         return S_OK;
     353    ICreateErrorInfo* iface,
     354    LPOLESTR szDescription)
     355{
     356    _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
     357    TRACE("(%p)\n",This);
     358    if (This->bstrDescription != NULL)
     359        ERRORINFO_SysFreeString(This->bstrDescription);
     360    This->bstrDescription = ERRORINFO_SysAllocString(szDescription);
     361
     362    return S_OK;
    362363}
    363364
    364365static HRESULT WINAPI ICreateErrorInfoImpl_SetHelpFile(
    365         ICreateErrorInfo* iface,
    366         LPOLESTR szHelpFile)
    367 {
    368         _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
    369         TRACE("(%p)\n",This);
    370         if (This->bstrHelpFile != NULL)
    371             ERRORINFO_SysFreeString(This->bstrHelpFile);
    372         This->bstrHelpFile = ERRORINFO_SysAllocString(szHelpFile);
    373 
    374         return S_OK;
     366    ICreateErrorInfo* iface,
     367    LPOLESTR szHelpFile)
     368{
     369    _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
     370    TRACE("(%p)\n",This);
     371    if (This->bstrHelpFile != NULL)
     372        ERRORINFO_SysFreeString(This->bstrHelpFile);
     373    This->bstrHelpFile = ERRORINFO_SysAllocString(szHelpFile);
     374
     375    return S_OK;
    375376}
    376377
    377378static HRESULT WINAPI ICreateErrorInfoImpl_SetHelpContext(
    378         ICreateErrorInfo* iface,
    379         DWORD dwHelpContext)
    380 {
    381         _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
    382         TRACE("(%p)\n",This);
    383         This->m_dwHelpContext = dwHelpContext;
    384        
    385         return S_OK;
     379    ICreateErrorInfo* iface,
     380    DWORD dwHelpContext)
     381{
     382    _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface);
     383    TRACE("(%p)\n",This);
     384    This->m_dwHelpContext = dwHelpContext;
     385
     386    return S_OK;
    386387}
    387388
     
    401402
    402403static HRESULT WINAPI ISupportErrorInfoImpl_QueryInterface(
    403         ISupportErrorInfo* iface,
    404         REFIID     riid,
    405         VOID**     ppvoid)
    406 {
    407         _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface);
    408         TRACE("(%p)\n", This);
    409        
    410         return IErrorInfo_QueryInterface(_IErrorInfo_(This), riid, ppvoid);
     404    ISupportErrorInfo* iface,
     405    REFIID     riid,
     406    VOID**     ppvoid)
     407{
     408    _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface);
     409    TRACE("(%p)\n", This);
     410
     411    return IErrorInfo_QueryInterface(_IErrorInfo_(This), riid, ppvoid);
    411412}
    412413
    413414static ULONG WINAPI ISupportErrorInfoImpl_AddRef(
    414         ISupportErrorInfo* iface)
    415 {
    416         _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface);
    417         TRACE("(%p)\n", This);
    418         return IErrorInfo_AddRef(_IErrorInfo_(This));
     415    ISupportErrorInfo* iface)
     416{
     417    _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface);
     418    TRACE("(%p)\n", This);
     419    return IErrorInfo_AddRef(_IErrorInfo_(This));
    419420}
    420421
    421422static ULONG WINAPI ISupportErrorInfoImpl_Release(
    422         ISupportErrorInfo* iface)
    423 {
    424         _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface);
    425         TRACE("(%p)\n", This);
    426         return IErrorInfo_Release(_IErrorInfo_(This));
     423    ISupportErrorInfo* iface)
     424{
     425    _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface);
     426    TRACE("(%p)\n", This);
     427    return IErrorInfo_Release(_IErrorInfo_(This));
    427428}
    428429
    429430
    430431static HRESULT WINAPI ISupportErrorInfoImpl_InterfaceSupportsErrorInfo(
    431         ISupportErrorInfo* iface,
    432         REFIID riid)
    433 {
    434         _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface);
    435         TRACE("(%p)->(%s)\n", This, debugstr_guid(riid));
    436         return (IsEqualIID(riid, &This->m_Guid)) ? S_OK : S_FALSE;
     432    ISupportErrorInfo* iface,
     433    REFIID riid)
     434{
     435    _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface);
     436    TRACE("(%p)->(%s)\n", This, debugstr_guid(riid));
     437    return (IsEqualIID(riid, &This->m_Guid)) ? S_OK : S_FALSE;
    437438}
    438439
     
    448449};
    449450/***********************************************************************
    450  *              CreateErrorInfo
     451 *      CreateErrorInfo
    451452 */
    452453HRESULT WINAPI CreateErrorInfo(ICreateErrorInfo **pperrinfo)
    453454{
    454         IErrorInfo * pei;
    455         HRESULT res;
    456         TRACE("(%p): stub:\n", pperrinfo);
    457         if(! pperrinfo ) return E_INVALIDARG;
    458         if(!(pei=IErrorInfoImpl_Constructor()))return E_OUTOFMEMORY;
    459        
    460         res = IErrorInfo_QueryInterface(pei, &IID_ICreateErrorInfo, (LPVOID*)pperrinfo);
    461         IErrorInfo_Release(pei);
    462         return res;
     455    IErrorInfo * pei;
     456    HRESULT res;
     457    TRACE("(%p): stub:\n", pperrinfo);
     458    if(! pperrinfo ) return E_INVALIDARG;
     459    if(!(pei=IErrorInfoImpl_Constructor()))return E_OUTOFMEMORY;
     460
     461    res = IErrorInfo_QueryInterface(pei, &IID_ICreateErrorInfo, (LPVOID*)pperrinfo);
     462    IErrorInfo_Release(pei);
     463    return res;
    463464}
    464465
    465466/***********************************************************************
    466  *              GetErrorInfo
     467 *      GetErrorInfo
    467468 */
    468469HRESULT WINAPI GetErrorInfo(ULONG dwReserved, IErrorInfo **pperrinfo)
    469470{
    470         TRACE("(%ld, %p, %p): stub:\n", dwReserved, pperrinfo, NtCurrentTeb()->ErrorInfo);
    471 
    472         if(! pperrinfo ) return E_INVALIDARG;
    473         if(!(*pperrinfo = (IErrorInfo*)(NtCurrentTeb()->ErrorInfo))) return S_FALSE;
    474 
    475         /* clear thread error state */
    476         NtCurrentTeb()->ErrorInfo = NULL;
    477         return S_OK;
     471    TRACE("(%ld, %p, %p): stub:\n", dwReserved, pperrinfo, NtCurrentTeb()->ErrorInfo);
     472
     473    if(! pperrinfo ) return E_INVALIDARG;
     474    if(!(*pperrinfo = (IErrorInfo*)(NtCurrentTeb()->ErrorInfo))) return S_FALSE;
     475
     476    /* clear thread error state */
     477    NtCurrentTeb()->ErrorInfo = NULL;
     478    return S_OK;
    478479}
    479480
    480481/***********************************************************************
    481  *              SetErrorInfo
     482 *      SetErrorInfo
    482483 */
    483484HRESULT WINAPI SetErrorInfo(ULONG dwReserved, IErrorInfo *perrinfo)
    484485{
    485         IErrorInfo * pei;
    486         TRACE("(%ld, %p): stub:\n", dwReserved, perrinfo);
    487 
    488         /* release old errorinfo */
    489         pei = (IErrorInfo*)NtCurrentTeb()->ErrorInfo;
    490         if(pei) IErrorInfo_Release(pei);
    491 
    492         /* set to new value */
    493         NtCurrentTeb()->ErrorInfo = perrinfo;
    494         if(perrinfo) IErrorInfo_AddRef(perrinfo);
    495         return S_OK;
    496 }
     486    IErrorInfo * pei;
     487    TRACE("(%ld, %p): stub:\n", dwReserved, perrinfo);
     488
     489    /* release old errorinfo */
     490    pei = (IErrorInfo*)NtCurrentTeb()->ErrorInfo;
     491    if(pei) IErrorInfo_Release(pei);
     492
     493    /* set to new value */
     494    NtCurrentTeb()->ErrorInfo = perrinfo;
     495    if(perrinfo) IErrorInfo_AddRef(perrinfo);
     496    return S_OK;
     497}
  • trunk/src/ole32/filemoniker.c

    r5602 r6648  
     1/* $Id: filemoniker.c,v 1.2 2001-09-05 13:17:09 bird Exp $ */
    12/***************************************************************************************
    2  *                            FileMonikers implementation
     3 *                        FileMonikers implementation
    34 *
    45 *               Copyright 1999  Noomen Hamza
     
    2627    ICOM_VTABLE(IMoniker)*  lpvtbl1;  /* VTable relative to the IMoniker interface.*/
    2728
    28     /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 
     29    /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether
    2930     * two monikers are equal. That's whay IROTData interface is implemented by monikers.
    3031     */
     
    136137{
    137138    ICOM_THIS(FileMonikerImpl,iface);
    138  
     139
    139140  TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
    140141
    141142    /* Perform a sanity check on the parameters.*/
    142143    if ( (This==0) || (ppvObject==0) )
    143         return E_INVALIDARG;
    144  
     144    return E_INVALIDARG;
     145
    145146    /* Initialize the return parameter */
    146147  *ppvObject = 0;
     
    153154       )
    154155        *ppvObject = iface;
    155    
     156
    156157    else if (IsEqualIID(&IID_IROTData, riid))
    157158        *ppvObject = (IROTData*)&(This->lpvtbl2);
     
    160161    if ((*ppvObject)==0)
    161162        return E_NOINTERFACE;
    162  
     163
    163164    /* Query Interface always increases the reference count by one when it is successful */
    164165  FileMonikerImpl_AddRef(iface);
     
    212213
    213214    *pClassID = CLSID_FileMoniker;
    214        
     215
    215216    return S_OK;
    216217}
     
    252253    if (bread!=sizeof(WORD) || wbuffer!=0)
    253254        return E_FAIL;
    254    
     255
    255256    /* read filePath string length (plus one) */
    256257    res=IStream_Read(pStm,&length,sizeof(DWORD),&bread);
     
    268269    if (bread != sizeof(DWORD) || dwbuffer != 0xDEADFFFF)
    269270        return E_FAIL;
    270        
     271
    271272    length--;
    272        
     273
    273274    for(i=0;i<10;i++){
    274275        res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread);
     
    276277            return E_FAIL;
    277278    }
    278    
     279
    279280    if (length>8)
    280281        length=0;
    281        
     282
    282283    doubleLenHex=doubleLenDec=2*length;
    283284    if (length > 5)
     
    290291    if (length==0)
    291292        return res;
    292        
     293
    293294    res=IStream_Read(pStm,&dwbuffer,sizeof(DWORD),&bread);
    294295    if (bread!=sizeof(DWORD) || dwbuffer!=doubleLenHex)
     
    311312
    312313    HeapFree(GetProcessHeap(),0,filePathA);
    313    
     314
    314315    return res;
    315316}
     
    324325    /* this function saves data of this object. In the begining I thougth that I have just to write
    325326     * the filePath string on Stream. But, when I tested this function whith windows programs samples !
    326      * I noted that it was not the case. So I analysed data written by this function on Windows system and 
     327     * I noted that it was not the case. So I analysed data written by this function on Windows system and
    327328     * what did this function do exactly ! but I have no idear a bout its logic !
    328329     * I guessed data who must be written on stream wich is:
     
    333334     */
    334335
    335     ICOM_THIS(FileMonikerImpl,iface);       
     336    ICOM_THIS(FileMonikerImpl,iface);
    336337
    337338    HRESULT res;
     
    368369    /* write a DWORD set to 0xDEADFFFF: constant */
    369370    res=IStream_Write(pStm,&constant1,sizeof(DWORD),NULL);
    370        
     371
    371372    len--;
    372373    /* write 10 times a DWORD set to 0 : constants */
    373374    for(i=0;i<10;i++)
    374375        res=IStream_Write(pStm,&zero,sizeof(WORD),NULL);
    375        
     376
    376377    if (len>8)
    377378        len=0;
    378        
     379
    379380    doubleLenHex=doubleLenDec=2*len;
    380381    if (len > 5)
     
    415416
    416417    /* for more details see FileMonikerImpl_Save coments */
    417    
     418
    418419    sizeMAx =  sizeof(WORD) +           /* first WORD is 0 */
    419420               sizeof(DWORD)+           /* length of filePath including "\0" in the end of the string */
     
    425426    if (len==0 || len > 8)
    426427        return S_OK;
    427    
     428
    428429    sizeMAx += sizeof(DWORD)+           /* size of the unicode filePath: "\0" not included */
    429430               sizeof(WORD)+            /* constant : 0x3 */
    430431               len*sizeof(WCHAR);       /* unicde filePath string */
    431    
     432
    432433    pcbSize->s.LowPart=sizeMAx;
    433434    pcbSize->s.HighPart=0;
     
    447448    WCHAR bkSlash[]={'\\',0};
    448449    BYTE addBkSlash;
    449    
     450
    450451    TRACE("(%p,%p)\n",This,lpszPathName);
    451452
     
    492493
    493494        *This->filePathName=0;
    494    
     495
    495496        for(i=0;tabStr[i]!=NULL;i++)
    496497            strcatW(This->filePathName,tabStr[i]);
    497    
     498
    498499        if (addBkSlash)
    499500            strcatW(This->filePathName,bkSlash);
     
    538539    IClassFactory *pcf=0;
    539540    IClassActivator *pca=0;
    540    
    541     ICOM_THIS(FileMonikerImpl,iface);   
     541
     542    ICOM_THIS(FileMonikerImpl,iface);
    542543
    543544    *ppvResult=0;
     
    546547
    547548    if(pmkToLeft==NULL){
    548        
     549
    549550        res=IBindCtx_GetRunningObjectTable(pbc,&prot);
    550551
     
    578579
    579580            res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IClassActivator,(void**)&pca);
    580        
     581
    581582            if (res==E_NOINTERFACE)
    582583                return MK_E_INTERMEDIATEINTERFACENOTSUPPORTED;
     
    597598
    598599            FIXME("()");
    599            
     600
    600601            /*res=GetClassFile(This->filePathName,&clsID);
    601602
     
    633634    if (pcf!=NULL)
    634635        IClassFactory_Release(pcf);
    635    
     636
    636637    return res;
    637638}
     
    736737
    737738    if (pmkRight==NULL)
    738         return E_INVALIDARG;
     739    return E_INVALIDARG;
    739740
    740741    *ppmkComposite=0;
    741    
     742
    742743    IMoniker_IsSystemMoniker(pmkRight,&mkSys);
    743744
     
    768769        /* the length of the composed path string  is raised by the sum of the two paths lengths  */
    769770        newStr=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(lstrlenW(str1)+lstrlenW(str2)+1));
    770        
    771           if (newStr==NULL)
    772                 return E_OUTOFMEMORY;
     771
     772      if (newStr==NULL)
     773        return E_OUTOFMEMORY;
    773774
    774775        /* new path is the concatenation of the rest of str1 and str2 */
     
    778779        if ((strDec2[i]==NULL && lastIdx1>-1 && lastIdx2>-1) || lstrcmpW(strDec2[i],bkSlash)!=0)
    779780            strcatW(newStr,bkSlash);
    780            
     781
    781782        for(j=i;j<=lastIdx2;j++)
    782783            strcatW(newStr,strDec2[j]);
    783        
     784
    784785        /* create a new moniker with the new string */
    785786        res=CreateFileMoniker(newStr,ppmkComposite);
     
    857858
    858859    IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&filePath);
    859    
     860
    860861    if (lstrcmpiW(filePath,
    861862                  This->filePathName)!=0)
    862863
    863864        return S_FALSE;
    864    
     865
    865866    return S_OK;
    866867}
     
    879880    if (pdwHash==NULL)
    880881        return E_POINTER;
    881    
     882
    882883    val =  This->filePathName;
    883884    len = lstrlenW(val);
     
    886887        for (i = len ; i > 0; i--) {
    887888            h = (h * 37) + val[off++];
    888         }
     889    }
    889890    } else {
    890891        /* only sample some characters */
    891         skip = len / 8;
    892         for (i = len ; i > 0; i -= skip, off += skip) {
     892    skip = len / 8;
     893    for (i = len ; i > 0; i -= skip, off += skip) {
    893894            h = (h * 39) + val[off];
    894         }
     895    }
    895896}
    896897
     
    963964        if (!GetFileAttributesExW(This->filePathName,GetFileExInfoStandard,&info))
    964965            return MK_E_NOOBJECT;
    965        
     966
    966967        *pFileTime=info.ftLastWriteTime;
    967968}
     
    998999    if (pmkOther==NULL)
    9991000        return E_INVALIDARG;
    1000    
     1001
    10011002    *ppmkPrefix=0;
    1002    
     1003
    10031004    /* check if we have the same type of moniker */
    10041005    IMoniker_IsSystemMoniker(pmkOther,&mkSys);
     
    10221023
    10231024        *commonPath=0;
    1024        
     1025
    10251026        for(sameIdx=0; ( (stringTable1[sameIdx]!=NULL) &&
    10261027                         (stringTable2[sameIdx]!=NULL) &&
     
    10411042        if (machimeNameCase && *stringTable1[sameIdx-1]=='\\')
    10421043            sameIdx--;
    1043        
     1044
    10441045        if (machimeNameCase && (sameIdx<=3) && (nb1 > 3 || nb2 > 3) )
    10451046            return MK_E_NOPREFIX;
     
    10471048        for(i=0;i<sameIdx;i++)
    10481049            strcatW(commonPath,stringTable1[i]);
    1049        
     1050
    10501051        for(i=0;i<nb1;i++)
    10511052            CoTaskMemFree(stringTable1[i]);
     
    10591060
    10601061        HeapFree(GetProcessHeap(),0,commonPath);
    1061        
     1062
    10621063        return CreateFileMoniker(commonPath,ppmkPrefix);
    10631064    }
     
    10791080
    10801081    strgtable =CoTaskMemAlloc(len*sizeof(LPOLESTR));
    1081    
     1082
    10821083    if (strgtable==NULL)
    1083         return E_OUTOFMEMORY;
    1084    
     1084    return E_OUTOFMEMORY;
     1085
    10851086    while(str[i]!=0){
    10861087
     
    10901091
    10911092            if (strgtable[tabIndex]==NULL)
    1092                 return E_OUTOFMEMORY;
     1093            return E_OUTOFMEMORY;
    10931094
    10941095            strcpyW(strgtable[tabIndex++],bSlash);
     
    11131114    }
    11141115    strgtable[tabIndex]=NULL;
    1115    
     1116
    11161117    *stringTable=strgtable;
    1117    
     1118
    11181119    return tabIndex;
    11191120}
     
    11291130    DWORD len1=0,len2=0,sameIdx=0,j=0;
    11301131    WCHAR back[] ={'.','.','\\',0};
    1131    
     1132
    11321133    TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath);
    11331134
     
    11371138    if (pmOther==NULL)
    11381139        return E_INVALIDARG;
    1139    
     1140
    11401141    res=CreateBindCtx(0,&bind);
    11411142    if (FAILED(res))
    1142         return res;
     1143    return res;
    11431144
    11441145    res=IMoniker_GetDisplayName(iface,bind,NULL,&str1);
    11451146    if (FAILED(res))
    1146         return res;
     1147    return res;
    11471148    res=IMoniker_GetDisplayName(pmOther,bind,NULL,&str2);
    11481149    if (FAILED(res))
    1149         return res;
     1150    return res;
    11501151
    11511152    len1=FileMonikerImpl_DecomposePath(str1,&tabStr1);
     
    11531154
    11541155    if (FAILED(len1) || FAILED(len2))
    1155         return E_OUTOFMEMORY;
    1156        
     1156    return E_OUTOFMEMORY;
     1157
    11571158    /* count the number of similar items from the begin of the two paths */
    11581159    for(sameIdx=0; ( (tabStr1[sameIdx]!=NULL) &&
    1159                    (tabStr2[sameIdx]!=NULL) &&
     1160           (tabStr2[sameIdx]!=NULL) &&
    11601161               (lstrcmpiW(tabStr1[sameIdx],tabStr2[sameIdx])==0)); sameIdx++);
    11611162
     
    11751176    for(j=sameIdx;tabStr2[j]!=NULL;j++)
    11761177        strcatW(relPath,tabStr2[j]);
    1177    
     1178
    11781179    res=CreateFileMoniker(relPath,ppmkRelPath);
    1179    
     1180
    11801181    for(j=0; tabStr1[j]!=NULL;j++)
    11811182        CoTaskMemFree(tabStr1[j]);
     
    12191220
    12201221    strcpyW(*ppszDisplayName,This->filePathName);
    1221    
     1222
    12221223    return S_OK;
    12231224}
     
    12461247    if (!pwdMksys)
    12471248        return E_POINTER;
    1248    
     1249
    12491250    (*pwdMksys)=MKSYS_FILEMONIKER;
    12501251
     
    12831284{
    12841285    ICOM_THIS_From_IROTData(IMoniker, iface);
    1285    
     1286
    12861287    TRACE("(%p)\n",This);
    12871288
     
    13271328    if(lpszPathName==NULL)
    13281329        return MK_E_SYNTAX;
    1329            
     1330
    13301331    *ppmk=0;
    1331        
     1332
    13321333    newFileMoniker = HeapAlloc(GetProcessHeap(), 0, sizeof(FileMonikerImpl));
    13331334
     
    13381339
    13391340    if (SUCCEEDED(hr))
    1340         hr = FileMonikerImpl_QueryInterface((IMoniker*)newFileMoniker,&riid,(void**)ppmk);
     1341    hr = FileMonikerImpl_QueryInterface((IMoniker*)newFileMoniker,&riid,(void**)ppmk);
    13411342    else
    13421343        HeapFree(GetProcessHeap(),0,newFileMoniker);
  • trunk/src/ole32/hglobalstream.c

    r5602 r6648  
     1/* $Id: hglobalstream.c,v 1.2 2001-09-05 13:17:09 bird Exp $ */
    12/*
    23 * HGLOBAL Stream implementation
     
    2930{
    3031  ICOM_VFIELD(IStream);  /* Needs to be the first item in the stuct
    31                           * since we want to cast this in a IStream pointer */
    32  
     32              * since we want to cast this in a IStream pointer */
     33
    3334  /*
    3435   * Reference count
    3536   */
    36   ULONG              ref;
     37  ULONG          ref;
    3738
    3839  /*
     
    6465 */
    6566HGLOBALStreamImpl* HGLOBALStreamImpl_Construct(
    66                 HGLOBAL  hGlobal,
    67                 BOOL     fDeleteOnRelease);
     67        HGLOBAL  hGlobal,
     68        BOOL     fDeleteOnRelease);
    6869
    6970void HGLOBALStreamImpl_Destroy(
     
    7475
    7576HRESULT WINAPI HGLOBALStreamImpl_QueryInterface(
    76                 IStream*      iface,
    77                 REFIID         riid,            /* [in] */         
    78                 void**         ppvObject);  /* [iid_is][out] */
    79        
     77        IStream*      iface,
     78        REFIID         riid,        /* [in] */
     79        void**         ppvObject);  /* [iid_is][out] */
     80
    8081ULONG WINAPI HGLOBALStreamImpl_AddRef(
    81                 IStream*      iface);
    82        
     82        IStream*      iface);
     83
    8384ULONG WINAPI HGLOBALStreamImpl_Release(
    84                 IStream*      iface);
    85        
    86 HRESULT WINAPI HGLOBALStreamImpl_Read( 
    87                 IStream*      iface,
    88                 void*          pv,        /* [length_is][size_is][out] */
    89                 ULONG          cb,        /* [in] */                     
    90                 ULONG*         pcbRead);  /* [out] */                   
    91        
     85        IStream*      iface);
     86
     87HRESULT WINAPI HGLOBALStreamImpl_Read(
     88            IStream*      iface,
     89        void*          pv,        /* [length_is][size_is][out] */
     90        ULONG          cb,        /* [in] */
     91        ULONG*         pcbRead);  /* [out] */
     92
    9293HRESULT WINAPI HGLOBALStreamImpl_Write(
    93                 IStream*      iface,
    94                 const void*    pv,          /* [size_is][in] */
    95                 ULONG          cb,          /* [in] */         
    96                 ULONG*         pcbWritten); /* [out] */         
    97        
    98 HRESULT WINAPI HGLOBALStreamImpl_Seek( 
    99                 IStream*      iface,
    100                 LARGE_INTEGER   dlibMove,         /* [in] */
    101                 DWORD           dwOrigin,         /* [in] */
    102                 ULARGE_INTEGER* plibNewPosition); /* [out] */
    103        
    104 HRESULT WINAPI HGLOBALStreamImpl_SetSize( 
    105                 IStream*      iface,
    106                 ULARGE_INTEGER  libNewSize);  /* [in] */
    107        
    108 HRESULT WINAPI HGLOBALStreamImpl_CopyTo( 
    109                 IStream*      iface,
    110                 IStream*      pstm,         /* [unique][in] */
    111                 ULARGE_INTEGER  cb,           /* [in] */         
    112                 ULARGE_INTEGER* pcbRead,      /* [out] */       
    113                 ULARGE_INTEGER* pcbWritten);  /* [out] */       
    114 
    115 HRESULT WINAPI HGLOBALStreamImpl_Commit( 
    116                 IStream*      iface,
    117                 DWORD           grfCommitFlags); /* [in] */
    118        
    119 HRESULT WINAPI HGLOBALStreamImpl_Revert( 
    120                 IStream*  iface);
    121        
    122 HRESULT WINAPI HGLOBALStreamImpl_LockRegion( 
    123                 IStream*     iface,
    124                 ULARGE_INTEGER libOffset,   /* [in] */
    125                 ULARGE_INTEGER cb,          /* [in] */
    126                 DWORD          dwLockType); /* [in] */
    127        
    128 HRESULT WINAPI HGLOBALStreamImpl_UnlockRegion( 
    129                 IStream*     iface,
    130                 ULARGE_INTEGER libOffset,   /* [in] */
    131                 ULARGE_INTEGER cb,          /* [in] */
    132                 DWORD          dwLockType); /* [in] */
    133        
    134 HRESULT WINAPI HGLOBALStreamImpl_Stat( 
    135                 IStream*     iface,
    136                 STATSTG*       pstatstg,     /* [out] */
    137                 DWORD          grfStatFlag); /* [in] */
    138        
    139 HRESULT WINAPI HGLOBALStreamImpl_Clone( 
    140                 IStream*     iface,
    141                 IStream**    ppstm);       /* [out] */
     94        IStream*      iface,
     95        const void*    pv,          /* [size_is][in] */
     96        ULONG          cb,          /* [in] */
     97        ULONG*         pcbWritten); /* [out] */
     98
     99HRESULT WINAPI HGLOBALStreamImpl_Seek(
     100        IStream*      iface,
     101        LARGE_INTEGER   dlibMove,         /* [in] */
     102        DWORD           dwOrigin,         /* [in] */
     103        ULARGE_INTEGER* plibNewPosition); /* [out] */
     104
     105HRESULT WINAPI HGLOBALStreamImpl_SetSize(
     106            IStream*      iface,
     107        ULARGE_INTEGER  libNewSize);  /* [in] */
     108
     109HRESULT WINAPI HGLOBALStreamImpl_CopyTo(
     110        IStream*      iface,
     111        IStream*      pstm,         /* [unique][in] */
     112        ULARGE_INTEGER  cb,           /* [in] */
     113        ULARGE_INTEGER* pcbRead,      /* [out] */
     114        ULARGE_INTEGER* pcbWritten);  /* [out] */
     115
     116HRESULT WINAPI HGLOBALStreamImpl_Commit(
     117            IStream*      iface,
     118        DWORD           grfCommitFlags); /* [in] */
     119
     120HRESULT WINAPI HGLOBALStreamImpl_Revert(
     121        IStream*  iface);
     122
     123HRESULT WINAPI HGLOBALStreamImpl_LockRegion(
     124        IStream*     iface,
     125        ULARGE_INTEGER libOffset,   /* [in] */
     126        ULARGE_INTEGER cb,          /* [in] */
     127        DWORD          dwLockType); /* [in] */
     128
     129HRESULT WINAPI HGLOBALStreamImpl_UnlockRegion(
     130        IStream*     iface,
     131        ULARGE_INTEGER libOffset,   /* [in] */
     132            ULARGE_INTEGER cb,          /* [in] */
     133        DWORD          dwLockType); /* [in] */
     134
     135HRESULT WINAPI HGLOBALStreamImpl_Stat(
     136        IStream*     iface,
     137            STATSTG*       pstatstg,     /* [out] */
     138            DWORD          grfStatFlag); /* [in] */
     139
     140HRESULT WINAPI HGLOBALStreamImpl_Clone(
     141        IStream*     iface,
     142        IStream**    ppstm);       /* [out] */
    142143
    143144
     
    168169 */
    169170HRESULT WINAPI CreateStreamOnHGlobal(
    170                 HGLOBAL   hGlobal,
    171                 BOOL      fDeleteOnRelease,
    172                 LPSTREAM* ppstm)
     171        HGLOBAL   hGlobal,
     172        BOOL      fDeleteOnRelease,
     173        LPSTREAM* ppstm)
    173174{
    174175  HGLOBALStreamImpl* newStream;
    175176
    176177  newStream = HGLOBALStreamImpl_Construct(hGlobal,
    177                                           fDeleteOnRelease);
     178                      fDeleteOnRelease);
    178179
    179180  if (newStream!=NULL)
    180181  {
    181     return IUnknown_QueryInterface((IUnknown*)newStream, 
    182                                    &IID_IStream,
    183                                    (void**)ppstm);
     182    return IUnknown_QueryInterface((IUnknown*)newStream,
     183                   &IID_IStream,
     184                   (void**)ppstm);
    184185  }
    185186
     
    222223 * Params:
    223224 *    hGlobal          - Handle that will support the stream. can be NULL.
    224  *    fDeleteOnRelease - Flag set to TRUE if the HGLOBAL will be released 
     225 *    fDeleteOnRelease - Flag set to TRUE if the HGLOBAL will be released
    225226 *                       when the IStream object is destroyed.
    226227 */
    227228HGLOBALStreamImpl* HGLOBALStreamImpl_Construct(
    228                 HGLOBAL  hGlobal,
    229                 BOOL     fDeleteOnRelease)
     229        HGLOBAL  hGlobal,
     230        BOOL     fDeleteOnRelease)
    230231{
    231232  HGLOBALStreamImpl* newStream;
    232233
    233234  newStream = HeapAlloc(GetProcessHeap(), 0, sizeof(HGLOBALStreamImpl));
    234  
     235
    235236  if (newStream!=0)
    236237  {
     
    240241    ICOM_VTBL(newStream) = &HGLOBALStreamImpl_Vtbl;
    241242    newStream->ref    = 0;
    242    
     243
    243244    /*
    244245     * Initialize the support.
     
    253254    {
    254255      newStream->supportHandle = GlobalAlloc(GMEM_MOVEABLE | GMEM_NODISCARD |
    255                                              GMEM_SHARE, 0);
     256                         GMEM_SHARE, 0);
    256257    }
    257    
     258
    258259    /*
    259260     * Start the stream at the begining.
     
    261262    newStream->currentPosition.s.HighPart = 0;
    262263    newStream->currentPosition.s.LowPart = 0;
    263    
     264
    264265    /*
    265266     * Initialize the size of the stream to the size of the handle.
     
    268269    newStream->streamSize.s.LowPart  = GlobalSize(newStream->supportHandle);
    269270  }
    270  
     271
    271272  return newStream;
    272273}
     
    275276 * This is the destructor of the HGLOBALStreamImpl class.
    276277 *
    277  * This method will clean-up all the resources used-up by the given HGLOBALStreamImpl 
     278 * This method will clean-up all the resources used-up by the given HGLOBALStreamImpl
    278279 * class. The pointer passed-in to this function will be freed and will not
    279280 * be valid anymore.
     
    295296   * Finally, free the memory used-up by the class.
    296297   */
    297   HeapFree(GetProcessHeap(), 0, This); 
     298  HeapFree(GetProcessHeap(), 0, This);
    298299}
    299300
     
    303304 */
    304305HRESULT WINAPI HGLOBALStreamImpl_QueryInterface(
    305                   IStream*     iface,
    306                   REFIID         riid,        /* [in] */         
    307                   void**         ppvObject)   /* [iid_is][out] */
     306          IStream*     iface,
     307          REFIID         riid,        /* [in] */
     308          void**         ppvObject)   /* [iid_is][out] */
    308309{
    309310  HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
     
    314315  if (ppvObject==0)
    315316    return E_INVALIDARG;
    316  
     317
    317318  /*
    318319   * Initialize the return parameter.
    319320   */
    320321  *ppvObject = 0;
    321  
     322
    322323  /*
    323324   * Compare the riid with the interface IDs implemented by this object.
    324325   */
    325   if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 
     326  if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
    326327  {
    327328    *ppvObject = (IStream*)This;
    328329  }
    329   else if (memcmp(&IID_IStream, riid, sizeof(IID_IStream)) == 0) 
     330  else if (memcmp(&IID_IStream, riid, sizeof(IID_IStream)) == 0)
    330331  {
    331332    *ppvObject = (IStream*)This;
    332333  }
    333  
     334
    334335  /*
    335336   * Check that we obtained an interface.
     
    337338  if ((*ppvObject)==0)
    338339    return E_NOINTERFACE;
    339  
     340
    340341  /*
    341342   * Query Interface always increases the reference count by one when it is
     
    343344   */
    344345  HGLOBALStreamImpl_AddRef(iface);
    345  
     346
    346347  return S_OK;;
    347348}
     
    352353 */
    353354ULONG WINAPI HGLOBALStreamImpl_AddRef(
    354                 IStream* iface)
     355        IStream* iface)
    355356{
    356357  HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
    357358
    358359  This->ref++;
    359  
     360
    360361  return This->ref;
    361362}
     
    366367 */
    367368ULONG WINAPI HGLOBALStreamImpl_Release(
    368                 IStream* iface)
     369        IStream* iface)
    369370{
    370371  HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
    371372
    372373  ULONG newRef;
    373  
     374
    374375  This->ref--;
    375  
     376
    376377  newRef = This->ref;
    377  
     378
    378379  /*
    379380   * If the reference count goes down to 0, perform suicide.
     
    383384    HGLOBALStreamImpl_Destroy(This);
    384385  }
    385  
     386
    386387  return newRef;
    387388}
     
    396397 * See the documentation of ISequentialStream for more info.
    397398 */
    398 HRESULT WINAPI HGLOBALStreamImpl_Read( 
    399                   IStream*     iface,
    400                   void*          pv,        /* [length_is][size_is][out] */
    401                   ULONG          cb,        /* [in] */                     
    402                   ULONG*         pcbRead)   /* [out] */                   
     399HRESULT WINAPI HGLOBALStreamImpl_Read(
     400          IStream*     iface,
     401          void*          pv,        /* [length_is][size_is][out] */
     402          ULONG          cb,        /* [in] */
     403          ULONG*         pcbRead)   /* [out] */
    403404{
    404405  HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
     
    409410
    410411  TRACE("(%p, %p, %ld, %p)\n", iface,
    411         pv, cb, pcbRead);
    412  
    413   /* 
     412    pv, cb, pcbRead);
     413
     414  /*
    414415   * If the caller is not interested in the nubmer of bytes read,
    415416   * we use another buffer to avoid "if" statements in the code.
     
    417418  if (pcbRead==0)
    418419    pcbRead = &bytesReadBuffer;
    419  
     420
    420421  /*
    421422   * Using the known size of the stream, calculate the number of bytes
     
    445446   */
    446447  GlobalUnlock(This->supportHandle);
    447  
     448
    448449  /*
    449450   * The function returns S_OK if the buffer was filled completely
     
    453454  if(*pcbRead == cb)
    454455    return S_OK;
    455  
     456
    456457  return S_FALSE;
    457458}
    458        
     459
    459460/***
    460461 * This method is part of the ISequentialStream interface.
     
    468469 */
    469470HRESULT WINAPI HGLOBALStreamImpl_Write(
    470                   IStream*     iface,
    471                   const void*    pv,          /* [size_is][in] */
    472                   ULONG          cb,          /* [in] */         
    473                   ULONG*         pcbWritten)  /* [out] */         
     471              IStream*     iface,
     472          const void*    pv,          /* [size_is][in] */
     473          ULONG          cb,          /* [in] */
     474          ULONG*         pcbWritten)  /* [out] */
    474475{
    475476  HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
     
    480481
    481482  TRACE("(%p, %p, %ld, %p)\n", iface,
    482         pv, cb, pcbWritten);
    483  
     483    pv, cb, pcbWritten);
     484
    484485  /*
    485486   * If the caller is not interested in the number of bytes written,
     
    488489  if (pcbWritten == 0)
    489490    pcbWritten = &bytesWritten;
    490  
     491
    491492  if (cb == 0)
    492493  {
     
    498499    newSize.s.LowPart = This->currentPosition.s.LowPart + cb;
    499500  }
    500  
     501
    501502  /*
    502503   * Verify if we need to grow the stream
     
    507508   IStream_SetSize(iface, newSize);
    508509  }
    509  
     510
    510511  /*
    511512   * Lock the buffer in position and copy the data.
     
    513514  supportBuffer = GlobalLock(This->supportHandle);
    514515
    515   memcpy((char *) supportBuffer+This->currentPosition.s.LowPart, pv, cb); 
     516  memcpy((char *) supportBuffer+This->currentPosition.s.LowPart, pv, cb);
    516517
    517518  /*
     
    529530   */
    530531  GlobalUnlock(This->supportHandle);
    531  
     532
    532533  return S_OK;
    533534}
     
    540541 *
    541542 * See the documentation of IStream for more info.
    542  */       
    543 HRESULT WINAPI HGLOBALStreamImpl_Seek( 
    544                   IStream*      iface,
    545                   LARGE_INTEGER   dlibMove,         /* [in] */
    546                   DWORD           dwOrigin,         /* [in] */
    547                   ULARGE_INTEGER* plibNewPosition) /* [out] */
     543 */
     544HRESULT WINAPI HGLOBALStreamImpl_Seek(
     545          IStream*      iface,
     546          LARGE_INTEGER   dlibMove,         /* [in] */
     547          DWORD           dwOrigin,         /* [in] */
     548          ULARGE_INTEGER* plibNewPosition) /* [out] */
    548549{
    549550  HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
     
    552553
    553554  TRACE("(%p, %ld, %ld, %p)\n", iface,
    554         dlibMove.s.LowPart, dwOrigin, plibNewPosition);
    555 
    556   /* 
     555    dlibMove.s.LowPart, dwOrigin, plibNewPosition);
     556
     557  /*
    557558   * The caller is allowed to pass in NULL as the new position return value.
    558559   * If it happens, we assign it to a dynamic variable to avoid special cases
     
    608609  plibNewPosition->s.LowPart += dlibMove.s.LowPart;
    609610  This->currentPosition = *plibNewPosition;
    610  
     611
    611612  return S_OK;
    612613}
     
    621622 * See the documentation of IStream for more info.
    622623 */
    623 HRESULT WINAPI HGLOBALStreamImpl_SetSize( 
    624                                      IStream*      iface,
    625                                      ULARGE_INTEGER  libNewSize)   /* [in] */
     624HRESULT WINAPI HGLOBALStreamImpl_SetSize(
     625                     IStream*      iface,
     626                     ULARGE_INTEGER  libNewSize)   /* [in] */
    626627{
    627628  HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
     
    634635  if (libNewSize.s.HighPart != 0)
    635636    return STG_E_INVALIDFUNCTION;
    636  
     637
    637638  if (This->streamSize.s.LowPart == libNewSize.s.LowPart)
    638639    return S_OK;
     
    641642   * Re allocate the HGlobal to fit the new size of the stream.
    642643   */
    643   This->supportHandle = GlobalReAlloc(This->supportHandle, 
    644                                       libNewSize.s.LowPart,
    645                                       0);
     644  This->supportHandle = GlobalReAlloc(This->supportHandle,
     645                      libNewSize.s.LowPart,
     646                      0);
    646647
    647648  This->streamSize.s.LowPart = libNewSize.s.LowPart;
    648  
     649
    649650  return S_OK;
    650651}
    651        
     652
    652653/***
    653654 * This method is part of the IStream interface.
     
    657658 * See the documentation of IStream for more info.
    658659 */
    659 HRESULT WINAPI HGLOBALStreamImpl_CopyTo( 
    660                                     IStream*      iface,
    661                                     IStream*      pstm,         /* [unique][in] */
    662                                     ULARGE_INTEGER  cb,           /* [in] */         
    663                                     ULARGE_INTEGER* pcbRead,      /* [out] */       
    664                                     ULARGE_INTEGER* pcbWritten)   /* [out] */       
     660HRESULT WINAPI HGLOBALStreamImpl_CopyTo(
     661                    IStream*      iface,
     662                    IStream*      pstm,         /* [unique][in] */
     663                    ULARGE_INTEGER  cb,           /* [in] */
     664                    ULARGE_INTEGER* pcbRead,      /* [out] */
     665                    ULARGE_INTEGER* pcbWritten)   /* [out] */
    665666{
    666667  HRESULT        hr = S_OK;
     
    670671  ULARGE_INTEGER totalBytesWritten;
    671672
    672   TRACE("(%p, %p, %ld, %p, %p)\n", iface, pstm, 
    673         cb.s.LowPart, pcbRead, pcbWritten);
     673  TRACE("(%p, %p, %ld, %p, %p)\n", iface, pstm,
     674    cb.s.LowPart, pcbRead, pcbWritten);
    674675
    675676  /*
     
    693694    else
    694695      copySize = cb.s.LowPart;
    695    
     696
    696697    IStream_Read(iface, tmpBuffer, copySize, &bytesRead);
    697698
    698699    totalBytesRead.s.LowPart += bytesRead;
    699    
     700
    700701    IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten);
    701702
     
    710711      break;
    711712    }
    712    
     713
    713714    if (bytesRead!=copySize)
    714715      cb.s.LowPart = 0;
     
    737738 * This method is part of the IStream interface.
    738739 *
    739  * For streams supported by HGLOBALS, this function does nothing. 
     740 * For streams supported by HGLOBALS, this function does nothing.
    740741 * This is what the documentation tells us.
    741742 *
    742743 * See the documentation of IStream for more info.
    743  */       
    744 HRESULT WINAPI HGLOBALStreamImpl_Commit( 
    745                   IStream*      iface,
    746                   DWORD         grfCommitFlags)  /* [in] */
     744 */
     745HRESULT WINAPI HGLOBALStreamImpl_Commit(
     746          IStream*      iface,
     747          DWORD         grfCommitFlags)  /* [in] */
    747748{
    748749  return S_OK;
     
    752753 * This method is part of the IStream interface.
    753754 *
    754  * For streams supported by HGLOBALS, this function does nothing. 
     755 * For streams supported by HGLOBALS, this function does nothing.
    755756 * This is what the documentation tells us.
    756757 *
    757758 * See the documentation of IStream for more info.
    758  */       
    759 HRESULT WINAPI HGLOBALStreamImpl_Revert( 
    760                   IStream* iface)
     759 */
     760HRESULT WINAPI HGLOBALStreamImpl_Revert(
     761          IStream* iface)
    761762{
    762763  return S_OK;
     
    766767 * This method is part of the IStream interface.
    767768 *
    768  * For streams supported by HGLOBALS, this function does nothing. 
     769 * For streams supported by HGLOBALS, this function does nothing.
    769770 * This is what the documentation tells us.
    770771 *
    771772 * See the documentation of IStream for more info.
    772  */       
    773 HRESULT WINAPI HGLOBALStreamImpl_LockRegion( 
    774                   IStream*       iface,
    775                   ULARGE_INTEGER libOffset,   /* [in] */
    776                   ULARGE_INTEGER cb,          /* [in] */
    777                   DWORD          dwLockType)  /* [in] */
     773 */
     774HRESULT WINAPI HGLOBALStreamImpl_LockRegion(
     775          IStream*       iface,
     776          ULARGE_INTEGER libOffset,   /* [in] */
     777          ULARGE_INTEGER cb,          /* [in] */
     778          DWORD          dwLockType)  /* [in] */
    778779{
    779780  return S_OK;
     
    783784 * This method is part of the IStream interface.
    784785 *
    785  * For streams supported by HGLOBALS, this function does nothing. 
     786 * For streams supported by HGLOBALS, this function does nothing.
    786787 * This is what the documentation tells us.
    787788 *
    788789 * See the documentation of IStream for more info.
    789  */       
    790 HRESULT WINAPI HGLOBALStreamImpl_UnlockRegion( 
    791                   IStream*       iface,
    792                   ULARGE_INTEGER libOffset,   /* [in] */
    793                   ULARGE_INTEGER cb,          /* [in] */
    794                   DWORD          dwLockType)  /* [in] */
     790 */
     791HRESULT WINAPI HGLOBALStreamImpl_UnlockRegion(
     792          IStream*       iface,
     793          ULARGE_INTEGER libOffset,   /* [in] */
     794          ULARGE_INTEGER cb,          /* [in] */
     795          DWORD          dwLockType)  /* [in] */
    795796{
    796797  return S_OK;
     
    804805 *
    805806 * See the documentation of IStream for more info.
    806  */       
    807 HRESULT WINAPI HGLOBALStreamImpl_Stat( 
    808                   IStream*     iface,
    809                   STATSTG*     pstatstg,     /* [out] */
    810                   DWORD        grfStatFlag)  /* [in] */
     807 */
     808HRESULT WINAPI HGLOBALStreamImpl_Stat(
     809          IStream*     iface,
     810          STATSTG*     pstatstg,     /* [out] */
     811          DWORD        grfStatFlag)  /* [in] */
    811812{
    812813  HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
     
    820821  return S_OK;
    821822}
    822        
    823 HRESULT WINAPI HGLOBALStreamImpl_Clone( 
    824                   IStream*     iface,
    825                   IStream**    ppstm) /* [out] */
     823
     824HRESULT WINAPI HGLOBALStreamImpl_Clone(
     825          IStream*     iface,
     826          IStream**    ppstm) /* [out] */
    826827{
    827828  FIXME("not implemented!\n");
  • trunk/src/ole32/ifs.c

    r5602 r6648  
     1/* $Id: ifs.c,v 1.2 2001-09-05 13:17:09 bird Exp $ */
    12/*
    2  *      basic interfaces
     3 *  basic interfaces
    34 *
    4  *      Copyright 1997  Marcus Meissner
     5 *  Copyright 1997  Marcus Meissner
    56 */
    67
     
    3031
    3132/******************************************************************************
    32  *              IUnknown_AddRef [VTABLE:IUNKNOWN.1]
    33  */
    34 static ULONG WINAPI IUnknown_fnAddRef(LPUNKNOWN iface) { 
    35         ICOM_THIS(IUnknownImpl,iface);
    36         TRACE("(%p)->AddRef()\n",This);
    37         return ++(This->ref);
     33 *      IUnknown_AddRef [VTABLE:IUNKNOWN.1]
     34 */
     35static ULONG WINAPI IUnknown_fnAddRef(LPUNKNOWN iface) {
     36    ICOM_THIS(IUnknownImpl,iface);
     37    TRACE("(%p)->AddRef()\n",This);
     38    return ++(This->ref);
    3839}
    3940
     
    4243 */
    4344static ULONG WINAPI IUnknown_fnRelease(LPUNKNOWN iface) {
    44         ICOM_THIS(IUnknownImpl,iface);
    45         TRACE("(%p)->Release()\n",This);
    46         if (!--(This->ref)) {
    47                 HeapFree(GetProcessHeap(),0,This);
    48                 return 0;
    49         }
    50         return This->ref;
     45    ICOM_THIS(IUnknownImpl,iface);
     46    TRACE("(%p)->Release()\n",This);
     47    if (!--(This->ref)) {
     48        HeapFree(GetProcessHeap(),0,This);
     49        return 0;
     50    }
     51    return This->ref;
    5152}
    5253
     
    5556 */
    5657static HRESULT WINAPI IUnknown_fnQueryInterface(LPUNKNOWN iface,REFIID refiid,LPVOID *obj) {
    57         ICOM_THIS(IUnknownImpl,iface);
    58 
    59         TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
    60 
    61         if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
    62                 *obj = This;
    63                 return 0;
    64         }
    65         return OLE_E_ENUM_NOMORE;
    66 }
    67 
    68 static ICOM_VTABLE(IUnknown) uvt = 
    69 {
    70         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    71         IUnknown_fnQueryInterface,
    72         IUnknown_fnAddRef,
    73         IUnknown_fnRelease
     58    ICOM_THIS(IUnknownImpl,iface);
     59
     60    TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
     61
     62    if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) {
     63        *obj = This;
     64        return 0;
     65    }
     66    return OLE_E_ENUM_NOMORE;
     67}
     68
     69static ICOM_VTABLE(IUnknown) uvt =
     70{
     71    ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     72    IUnknown_fnQueryInterface,
     73    IUnknown_fnAddRef,
     74    IUnknown_fnRelease
    7475};
    7576
     
    7980LPUNKNOWN
    8081IUnknown_Constructor() {
    81         IUnknownImpl*   unk;
    82 
    83         unk = (IUnknownImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IUnknownImpl));
    84         ICOM_VTBL(unk)  = &uvt;
    85         unk->ref        = 1;
    86         return (LPUNKNOWN)unk;
     82    IUnknownImpl*   unk;
     83
     84    unk = (IUnknownImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IUnknownImpl));
     85    ICOM_VTBL(unk)  = &uvt;
     86    unk->ref    = 1;
     87    return (LPUNKNOWN)unk;
    8788}
    8889
     
    100101
    101102/******************************************************************************
    102  *              IMalloc16_QueryInterface        [COMPOBJ.500]
     103 *      IMalloc16_QueryInterface    [COMPOBJ.500]
    103104 */
    104105HRESULT WINAPI IMalloc16_fnQueryInterface(IMalloc16* iface,REFIID refiid,LPVOID *obj) {
    105106        ICOM_THIS(IMalloc16Impl,iface);
    106107
    107         TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
    108         if (    !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
    109                 !memcmp(&IID_IMalloc,refiid,sizeof(IID_IMalloc))
    110         ) {
    111                 *obj = This;
    112                 return 0;
    113         }
    114         return OLE_E_ENUM_NOMORE;
    115 }
    116 
    117 /******************************************************************************
    118  *              IMalloc16_AddRef        [COMPOBJ.501]
     108    TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
     109    if (    !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
     110        !memcmp(&IID_IMalloc,refiid,sizeof(IID_IMalloc))
     111    ) {
     112        *obj = This;
     113        return 0;
     114    }
     115    return OLE_E_ENUM_NOMORE;
     116}
     117
     118/******************************************************************************
     119 *      IMalloc16_AddRef    [COMPOBJ.501]
    119120 */
    120121ULONG WINAPI IMalloc16_fnAddRef(IMalloc16* iface) {
    121122        ICOM_THIS(IMalloc16Impl,iface);
    122         TRACE("(%p)->AddRef()\n",This);
    123         return 1; /* cannot be freed */
    124 }
    125 
    126 /******************************************************************************
    127  *              IMalloc16_Release       [COMPOBJ.502]
     123    TRACE("(%p)->AddRef()\n",This);
     124    return 1; /* cannot be freed */
     125}
     126
     127/******************************************************************************
     128 *      IMalloc16_Release   [COMPOBJ.502]
    128129 */
    129130ULONG WINAPI IMalloc16_fnRelease(IMalloc16* iface) {
    130131        ICOM_THIS(IMalloc16Impl,iface);
    131         TRACE("(%p)->Release()\n",This);
    132         return 1; /* cannot be freed */
     132    TRACE("(%p)->Release()\n",This);
     133    return 1; /* cannot be freed */
    133134}
    134135
     
    138139SEGPTR WINAPI IMalloc16_fnAlloc(IMalloc16* iface,DWORD cb) {
    139140        ICOM_THIS(IMalloc16Impl,iface);
    140         TRACE("(%p)->Alloc(%ld)\n",This,cb);
     141    TRACE("(%p)->Alloc(%ld)\n",This,cb);
    141142        return MapLS( HeapAlloc( GetProcessHeap(), HEAP_WINE_SEGPTR, cb ) );
    142143}
     
    165166DWORD WINAPI IMalloc16_fnGetSize(const IMalloc16* iface,SEGPTR pv)
    166167{
    167         ICOM_CTHIS(IMalloc16Impl,iface);
     168    ICOM_CTHIS(IMalloc16Impl,iface);
    168169        TRACE("(%p)->GetSize(%08lx)\n",This,pv);
    169170        return HeapSize( GetProcessHeap(), HEAP_WINE_SEGPTR, MapSL(pv) );
     
    175176INT16 WINAPI IMalloc16_fnDidAlloc(const IMalloc16* iface,LPVOID pv) {
    176177        ICOM_CTHIS(IMalloc16,iface);
    177         TRACE("(%p)->DidAlloc(%p)\n",This,pv);
    178         return (INT16)-1;
     178    TRACE("(%p)->DidAlloc(%p)\n",This,pv);
     179    return (INT16)-1;
    179180}
    180181
     
    184185LPVOID WINAPI IMalloc16_fnHeapMinimize(IMalloc16* iface) {
    185186        ICOM_THIS(IMalloc16Impl,iface);
    186         TRACE("(%p)->HeapMinimize()\n",This);
    187         return NULL;
     187    TRACE("(%p)->HeapMinimize()\n",This);
     188    return NULL;
    188189}
    189190
     
    195196LPMALLOC16
    196197IMalloc16_Constructor() {
    197         IMalloc16Impl*  This;
    198         HMODULE16       hcomp = GetModuleHandle16("COMPOBJ");
    199 
    200         This = (IMalloc16Impl*)SEGPTR_NEW(IMalloc16Impl);
     198    IMalloc16Impl*  This;
     199        HMODULE16   hcomp = GetModuleHandle16("COMPOBJ");
     200
     201    This = (IMalloc16Impl*)SEGPTR_NEW(IMalloc16Impl);
    201202        if (!msegvt16) {
    202203            msegvt16 = SEGPTR_NEW(ICOM_VTABLE(IMalloc16));
     
    213214            VTENT(HeapMinimize);
    214215#undef VTENT
    215         }
     216    }
    216217        ICOM_VTBL(This) = (ICOM_VTABLE(IMalloc16)*)SEGPTR_GET(msegvt16);
    217         This->ref = 1;
    218         return (LPMALLOC16)SEGPTR_GET(This);
     218    This->ref = 1;
     219    return (LPMALLOC16)SEGPTR_GET(This);
    219220}
    220221#endif
     
    230231
    231232/******************************************************************************
    232  *              IMalloc32_QueryInterface        [VTABLE]
     233 *      IMalloc32_QueryInterface    [VTABLE]
    233234 */
    234235static HRESULT WINAPI IMalloc_fnQueryInterface(LPMALLOC iface,REFIID refiid,LPVOID *obj) {
    235         ICOM_THIS(IMalloc32Impl,iface);
    236 
    237         TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
    238         if (    !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
    239                 !memcmp(&IID_IMalloc,refiid,sizeof(IID_IMalloc))
    240         ) {
    241                 *obj = This;
    242                 return S_OK;
    243         }
    244         return OLE_E_ENUM_NOMORE;
    245 }
    246 
    247 /******************************************************************************
    248  *              IMalloc32_AddRef        [VTABLE]
     236    ICOM_THIS(IMalloc32Impl,iface);
     237
     238    TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
     239    if (    !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
     240        !memcmp(&IID_IMalloc,refiid,sizeof(IID_IMalloc))
     241    ) {
     242        *obj = This;
     243        return S_OK;
     244    }
     245    return OLE_E_ENUM_NOMORE;
     246}
     247
     248/******************************************************************************
     249 *      IMalloc32_AddRef    [VTABLE]
    249250 */
    250251static ULONG WINAPI IMalloc_fnAddRef(LPMALLOC iface) {
    251         ICOM_THIS(IMalloc32Impl,iface);
    252         TRACE("(%p)->AddRef()\n",This);
    253         return 1; /* cannot be freed */
    254 }
    255 
    256 /******************************************************************************
    257  *              IMalloc32_Release       [VTABLE]
     252    ICOM_THIS(IMalloc32Impl,iface);
     253    TRACE("(%p)->AddRef()\n",This);
     254    return 1; /* cannot be freed */
     255}
     256
     257/******************************************************************************
     258 *      IMalloc32_Release   [VTABLE]
    258259 */
    259260static ULONG WINAPI IMalloc_fnRelease(LPMALLOC iface) {
    260         ICOM_THIS(IMalloc32Impl,iface);
    261         TRACE("(%p)->Release()\n",This);
    262         return 1; /* cannot be freed */
     261    ICOM_THIS(IMalloc32Impl,iface);
     262    TRACE("(%p)->Release()\n",This);
     263    return 1; /* cannot be freed */
    263264}
    264265
     
    267268 */
    268269static LPVOID WINAPI IMalloc_fnAlloc(LPMALLOC iface,DWORD cb) {
    269         LPVOID addr;
    270         ICOM_THIS(IMalloc32Impl,iface);
    271         addr = HeapAlloc(GetProcessHeap(),0,cb);
    272         TRACE("(%p)->Alloc(%ld) -> %p\n",This,cb,addr);
    273         return addr;
     270    LPVOID addr;
     271    ICOM_THIS(IMalloc32Impl,iface);
     272    addr = HeapAlloc(GetProcessHeap(),0,cb);
     273    TRACE("(%p)->Alloc(%ld) -> %p\n",This,cb,addr);
     274    return addr;
    274275}
    275276
     
    278279 */
    279280static LPVOID WINAPI IMalloc_fnRealloc(LPMALLOC iface,LPVOID pv,DWORD cb) {
    280         ICOM_THIS(IMalloc32Impl,iface);
    281         TRACE("(%p)->Realloc(%p,%ld)\n",This,pv,cb);
    282         return HeapReAlloc(GetProcessHeap(),0,pv,cb);
     281    ICOM_THIS(IMalloc32Impl,iface);
     282    TRACE("(%p)->Realloc(%p,%ld)\n",This,pv,cb);
     283    return HeapReAlloc(GetProcessHeap(),0,pv,cb);
    283284}
    284285
     
    287288 */
    288289static VOID WINAPI IMalloc_fnFree(LPMALLOC iface,LPVOID pv) {
    289         ICOM_THIS(IMalloc32Impl,iface);
    290         TRACE("(%p)->Free(%p)\n",This,pv);
    291         HeapFree(GetProcessHeap(),0,pv);
     290    ICOM_THIS(IMalloc32Impl,iface);
     291    TRACE("(%p)->Free(%p)\n",This,pv);
     292    HeapFree(GetProcessHeap(),0,pv);
    292293}
    293294
     
    296297 */
    297298static DWORD WINAPI IMalloc_fnGetSize(LPMALLOC iface,LPVOID pv) {
    298         ICOM_CTHIS(IMalloc,iface);
    299         TRACE("(%p)->GetSize(%p)\n",This,pv);
    300         return HeapSize(GetProcessHeap(),0,pv);
     299    ICOM_CTHIS(IMalloc,iface);
     300    TRACE("(%p)->GetSize(%p)\n",This,pv);
     301    return HeapSize(GetProcessHeap(),0,pv);
    301302}
    302303
     
    305306 */
    306307static INT WINAPI IMalloc_fnDidAlloc(LPMALLOC iface,LPVOID pv) {
    307         ICOM_CTHIS(IMalloc32Impl,iface);
    308         TRACE("(%p)->DidAlloc(%p)\n",This,pv);
    309         return -1;
     308    ICOM_CTHIS(IMalloc32Impl,iface);
     309    TRACE("(%p)->DidAlloc(%p)\n",This,pv);
     310    return -1;
    310311}
    311312
     
    314315 */
    315316static VOID WINAPI IMalloc_fnHeapMinimize(LPMALLOC iface) {
    316         ICOM_THIS(IMalloc32Impl,iface);
    317         TRACE("(%p)->HeapMinimize()\n",This);
    318 }
    319 
    320 static ICOM_VTABLE(IMalloc) VT_IMalloc32 = 
     317    ICOM_THIS(IMalloc32Impl,iface);
     318    TRACE("(%p)->HeapMinimize()\n",This);
     319}
     320
     321static ICOM_VTABLE(IMalloc) VT_IMalloc32 =
    321322{
    322323    ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     
    337338LPMALLOC
    338339IMalloc_Constructor() {
    339         IMalloc32Impl* This;
    340 
    341         This = (IMalloc32Impl*)HeapAlloc(GetProcessHeap(),0,sizeof(IMalloc32Impl));
    342         ICOM_VTBL(This) = &VT_IMalloc32;
    343         This->ref = 1;
    344         return (LPMALLOC)This;
     340    IMalloc32Impl* This;
     341
     342    This = (IMalloc32Impl*)HeapAlloc(GetProcessHeap(),0,sizeof(IMalloc32Impl));
     343    ICOM_VTBL(This) = &VT_IMalloc32;
     344    This->ref = 1;
     345    return (LPMALLOC)This;
    345346}
    346347
     
    350351
    351352/******************************************************************************
    352  *              IsValidInterface        [OLE32.78]
     353 *      IsValidInterface    [OLE32.78]
    353354 *
    354355 * RETURNS
     
    356357 */
    357358BOOL WINAPI IsValidInterface(
    358         LPUNKNOWN punk  /* [in] interface to be tested */
     359    LPUNKNOWN punk  /* [in] interface to be tested */
    359360) {
    360         return !(
    361                 IsBadReadPtr(punk,4)                                    ||
    362                 IsBadReadPtr(ICOM_VTBL(punk),4)                         ||
     361    return !(
     362        IsBadReadPtr(punk,4)                    ||
     363        IsBadReadPtr(ICOM_VTBL(punk),4)             ||
    363364#ifdef __WIN32OS2__
    364                 IsBadReadPtr(ICOM_VTBL(punk)->fnQueryInterface,9)       ||
    365                 IsBadCodePtr((FARPROC)ICOM_VTBL(punk)->fnQueryInterface)
     365        IsBadReadPtr(ICOM_VTBL(punk)->fnQueryInterface,9)   ||
     366        IsBadCodePtr((FARPROC)ICOM_VTBL(punk)->fnQueryInterface)
    366367#else
    367                 IsBadReadPtr(ICOM_VTBL(punk)->QueryInterface,9) ||
    368                 IsBadCodePtr((FARPROC)ICOM_VTBL(punk)->QueryInterface)
     368        IsBadReadPtr(ICOM_VTBL(punk)->QueryInterface,9) ||
     369        IsBadCodePtr((FARPROC)ICOM_VTBL(punk)->QueryInterface)
    369370#endif
    370         );
    371 }
     371    );
     372}
  • trunk/src/ole32/initole32.cpp

    r6401 r6648  
    1 /*
     1/* $Id: initole32.cpp,v 1.3 2001-09-05 13:17:10 bird Exp $
    22 * DLL entry point
    33 *
     
    5252   case DLL_THREAD_ATTACH:
    5353   case DLL_THREAD_DETACH:
    54         return OLE32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad);
     54    return OLE32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad);
    5555
    5656   case DLL_PROCESS_DETACH:
    5757        OLE32_DllEntryPoint(hinstDLL, fdwReason, fImpLoad);
    58         return TRUE;
     58    return TRUE;
    5959   }
    6060   return FALSE;
     
    8282      case 0 :
    8383      {
    84         dllHandle = RegisterLxDll(hModule, LibMainOLE32, (PVOID)&ole32os2_PEResTab);
    85          if(dllHandle == 0) 
    86                 return 0UL;
     84    dllHandle = RegisterLxDll(hModule, LibMainOLE32, (PVOID)&ole32os2_PEResTab);
     85         if(dllHandle == 0)
     86        return 0UL;
    8787
    8888         break;
     
    9090      case 1 :
    9191         if(dllHandle) {
    92                 UnregisterLxDll(dllHandle);
     92        UnregisterLxDll(dllHandle);
    9393         }
    9494         break;
  • trunk/src/ole32/initterm.cpp

    r6375 r6648  
    1 /*
     1/* $Id: initterm.cpp,v 1.11 2001-09-05 13:17:10 bird Exp $
     2 *
    23 * DLL entry point
    34 *
  • trunk/src/ole32/itemmoniker.c

    r5602 r6648  
     1/* $Id: itemmoniker.c,v 1.2 2001-09-05 13:17:10 bird Exp $ */
    12/***************************************************************************************
    2  *                            ItemMonikers implementation
     3 *                        ItemMonikers implementation
    34 *
    45 *           Copyright 1999  Noomen Hamza
     
    2526    ICOM_VTABLE(IMoniker)*  lpvtbl1;  /* VTable relative to the IMoniker interface.*/
    2627
    27     /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 
     28    /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether
    2829     * two monikers are equal. That's whay IROTData interface is implemented by monikers.
    2930     */
     
    3536
    3637    LPOLESTR itemDelimiter; /* Delimiter string */
    37    
     38
    3839} ItemMonikerImpl;
    3940
     
    140141  /* Perform a sanity check on the parameters.*/
    141142    if ( (This==0) || (ppvObject==0) )
    142         return E_INVALIDARG;
    143  
     143    return E_INVALIDARG;
     144
    144145  /* Initialize the return parameter */
    145146  *ppvObject = 0;
     
    152153     )
    153154      *ppvObject = iface;
    154  
     155
    155156    else if (IsEqualIID(&IID_IROTData, riid))
    156157        *ppvObject = (IROTData*)&(This->lpvtbl2);
     
    159160    if ((*ppvObject)==0)
    160161        return E_NOINTERFACE;
    161  
     162
    162163   /* Query Interface always increases the reference count by one when it is successful */
    163164  ItemMonikerImpl_AddRef(iface);
     
    208209    if (pClassID==NULL)
    209210        return E_POINTER;
    210            
     211
    211212    *pClassID = CLSID_ItemMoniker;
    212        
     213
    213214    return S_OK;
    214215}
     
    342343
    343344    /* for more details see ItemMonikerImpl_Save coments */
    344    
     345
    345346    pcbSize->s.LowPart =  sizeof(DWORD) + /* DWORD which contains delimiter length */
    346347                        delimiterLength + /* item delimiter string */
     
    362363    int sizeStr1=lstrlenW(lpszItem), sizeStr2;
    363364    static const OLECHAR emptystr[1];
    364     LPCOLESTR   delim;
     365    LPCOLESTR   delim;
    365366
    366367    TRACE("(%p,%p)\n",This,lpszItem);
     
    373374    This->itemName=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(sizeStr1+1));
    374375    if (!This->itemName)
    375         return E_OUTOFMEMORY;
     376    return E_OUTOFMEMORY;
    376377    strcpyW(This->itemName,lpszItem);
    377378
    378379    if (!lpszDelim)
    379         FIXME("lpszDelim is NULL. Using empty string which is possibly wrong.\n");
     380    FIXME("lpszDelim is NULL. Using empty string which is possibly wrong.\n");
    380381
    381382    delim = lpszDelim ? lpszDelim : emptystr;
     
    384385    This->itemDelimiter=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(sizeStr2+1));
    385386    if (!This->itemDelimiter) {
    386         HeapFree(GetProcessHeap(),0,This->itemName);
    387         return E_OUTOFMEMORY;
     387    HeapFree(GetProcessHeap(),0,This->itemName);
     388    return E_OUTOFMEMORY;
    388389    }
    389390    strcpyW(This->itemDelimiter,delim);
     
    419420{
    420421    ICOM_THIS(ItemMonikerImpl,iface);
    421    
     422
    422423    HRESULT   res;
    423424    IID    refid=IID_IOleItemContainer;
     
    466467    if(pmkToLeft==NULL)
    467468        return E_INVALIDARG;
    468        
     469
    469470    res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic);
    470471
     
    496497
    497498    *ppmkReduced=iface;
    498    
     499
    499500    return MK_S_REDUCED_TO_SELF;
    500501}
     
    516517
    517518    if ((ppmkComposite==NULL)||(pmkRight==NULL))
    518         return E_POINTER;
     519    return E_POINTER;
    519520
    520521    *ppmkComposite=0;
    521    
     522
    522523    IMoniker_IsSystemMoniker(pmkRight,&mkSys);
    523524
     
    529530        /* if pmkRight is a composite whose leftmost component is an anti-moniker,           */
    530531        /* the returned moniker is the composite after the leftmost anti-moniker is removed. */
    531        
     532
    532533         if(mkSys==MKSYS_GENERICCOMPOSITE){
    533534
     
    547548                tempMkComposite=iface;
    548549                IMoniker_AddRef(iface);
    549                
     550
    550551                while(IEnumMoniker_Next(penumMk,1,&pmostLeftMk,NULL)==S_OK){
    551552
     
    604605    if (pmkOtherMoniker==NULL)
    605606        return S_FALSE;
    606    
     607
    607608    /* This method returns S_OK if both monikers are item monikers and their display names are */
    608609    /* identical (using a case-insensitive comparison); otherwise, the method returns S_FALSE. */
     
    619620    IMoniker_GetDisplayName(iface,bind,NULL,&dispName1);
    620621    IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&dispName2);
    621    
     622
    622623    if (lstrcmpW(dispName1,dispName2)!=0)
    623624        return S_FALSE;
    624    
     625
    625626    return S_OK;
    626627}
     
    639640    if (pdwHash==NULL)
    640641        return E_POINTER;
    641    
     642
    642643    val =  This->itemName;
    643644    len = lstrlenW(val);
     
    649650    } else {
    650651        /* only sample some characters */
    651         skip = len / 8;
    652         for (i = len ; i > 0; i -= skip, off += skip) {
     652    skip = len / 8;
     653    for (i = len ; i > 0; i -= skip, off += skip) {
    653654            h = (h * 39) + val[off];
    654         }
     655    }
    655656    }
    656657
     
    698699        /* requesting an IOleItemContainer interface pointer. The method then calls IOleItemContainer::IsRunning,*/
    699700        /* passing the string contained within this moniker. */
    700        
     701
    701702        res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic);
    702703
     
    779780
    780781        *ppmkPrefix=iface;
    781        
     782
    782783        IMoniker_AddRef(iface);
    783        
     784
    784785        return MK_S_US;
    785786    }
     
    801802
    802803    *ppmkRelPath=0;
    803    
     804
    804805    return MK_E_NOTBINDABLE;
    805806}
     
    831832    strcpyW(*ppszDisplayName,This->itemDelimiter);
    832833    strcatW(*ppszDisplayName,This->itemName);
    833    
     834
    834835    return S_OK;
    835836}
     
    885886    if (!pwdMksys)
    886887        return E_POINTER;
    887    
     888
    888889    (*pwdMksys)=MKSYS_ITEMMONIKER;
    889890
     
    922923{
    923924    ICOM_THIS_From_IROTData(IMoniker, iface);
    924    
     925
    925926    TRACE("(%p)\n",iface);
    926927
     
    941942
    942943/******************************************************************************
    943  *        CreateItemMoniker16   [OLE2.28]
     944 *        CreateItemMoniker16   [OLE2.28]
    944945 ******************************************************************************/
    945946HRESULT WINAPI CreateItemMoniker16(LPCOLESTR16 lpszDelim,LPCOLESTR  lpszItem,LPMONIKER* ppmk)
     
    952953
    953954/******************************************************************************
    954  *        CreateItemMoniker     [OLE.55]
     955 *        CreateItemMoniker [OLE.55]
    955956 ******************************************************************************/
    956957HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim,LPCOLESTR  lpszItem, LPMONIKER * ppmk)
  • trunk/src/ole32/memlockbytes.c

    r5602 r6648  
     1/* $Id: memlockbytes.c,v 1.2 2001-09-05 13:17:10 bird Exp $ */
    12/******************************************************************************
    23 *
     
    2526{
    2627  /*
    27    * Needs to be the first item in the stuct 
     28   * Needs to be the first item in the stuct
    2829   * since we want to cast this in an ILockBytes pointer
    2930   */
     
    188189  HGLOBALLockBytesImpl* newLockBytes;
    189190  newLockBytes = HeapAlloc(GetProcessHeap(), 0, sizeof(HGLOBALLockBytesImpl));
    190  
     191
    191192  if (newLockBytes!=0)
    192193  {
     
    196197    ICOM_VTBL(newLockBytes) = &HGLOBALLockBytesImpl_Vtbl;
    197198    newLockBytes->ref    = 0;
    198  
     199
    199200    /*
    200201     * Initialize the support.
     
    398399   * The function returns S_OK if the specified number of bytes were read
    399400   * or the end of the array was reached.
    400    * It returns STG_E_READFAULT if the number of bytes to read does not equal 
     401   * It returns STG_E_READFAULT if the number of bytes to read does not equal
    401402   * the number of bytes actually read.
    402403   */
     
    503504  if (libNewSize.s.HighPart != 0)
    504505    return STG_E_INVALIDFUNCTION;
    505  
     506
    506507  if (This->byteArraySize.s.LowPart == libNewSize.s.LowPart)
    507508    return S_OK;
     
    518519
    519520  This->byteArraySize.s.LowPart = libNewSize.s.LowPart;
    520  
     521
    521522  return S_OK;
    522523}
  • trunk/src/ole32/moniker.c

    r5843 r6648  
     1/* $Id: moniker.c,v 1.3 2001-09-05 13:17:10 bird Exp $ */
    12/*
    2  *      Monikers
     3 *  Monikers
    34 *
    4  *      Copyright 1998  Marcus Meissner
     5 *  Copyright 1998  Marcus Meissner
    56 *      Copyright 1999  Noomen Hamza
    67 */
     
    4647    DWORD      runObjTabLastIndx;  /* first free index element in the table.        */
    4748    DWORD      runObjTabRegister; /* registration key of the next registered object */
    48    
     49
    4950} RunningObjectTableImpl;
    5051
     
    136137{
    137138    TRACE("()\n");
    138    
     139
    139140    if (runningObjectTableInstance==NULL)
    140141        return E_INVALIDARG;
     
    169170            if (( This->runObjTab[i].regTypeObj &  ROTFLAGS_REGISTRATIONKEEPSALIVE) != 0)
    170171                IUnknown_Release(This->runObjTab[i].pObj);
    171  
     172
    172173            IMoniker_Release(This->runObjTab[i].pmkObj);
    173174        }
     
    229230    if (runningObjectTableInstance==NULL)
    230231        return E_POINTER;
    231    
     232
    232233    RunningObjectTableImpl_Release((IRunningObjectTable*)runningObjectTableInstance);
    233234
     
    270271    This->runObjTab[This->runObjTabLastIndx].identRegObj = This->runObjTabRegister;
    271272    CoFileTimeNow(&(This->runObjTab[This->runObjTabLastIndx].lastModifObj));
    272    
     273
    273274    /* gives a registration identifier to the registered object*/
    274275    (*pdwRegister)= This->runObjTabRegister;
     
    277278
    278279        FIXME("runObjTabRegister: %ld is out of data limite \n",This->runObjTabRegister);
    279         return E_FAIL;
     280    return E_FAIL;
    280281}
    281282    This->runObjTabRegister++;
    282283    This->runObjTabLastIndx++;
    283    
     284
    284285    if (This->runObjTabLastIndx == This->runObjTabSize){ /* table is full ! so it must be resized */
    285286
     
    295296
    296297    IMoniker_AddRef(pmkObjectName);
    297    
     298
    298299    return res;
    299300}
     
    321322
    322323    IMoniker_Release(This->runObjTab[index].pmkObj);
    323    
     324
    324325    /* remove the object from the table */
    325326    for(j=index; j<This->runObjTabLastIndx-1; j++)
    326327        This->runObjTab[j]= This->runObjTab[j+1];
    327    
     328
    328329    This->runObjTabLastIndx--;
    329330
     
    336337HRESULT WINAPI RunningObjectTableImpl_IsRunning(  IRunningObjectTable* iface,
    337338                                                  IMoniker *pmkObjectName)  /* Pointer to the moniker of the object whose status is desired */
    338 {   
     339{
    339340    ICOM_THIS(RunningObjectTableImpl,iface);
    340341
     
    358359    if (ppunkObject==NULL)
    359360        return E_POINTER;
    360    
     361
    361362    *ppunkObject=0;
    362363
     
    393394    return S_OK;
    394395}
    395    
     396
    396397/***********************************************************************
    397398 *        RunningObjectTable_GetTimeOfLastChange
     
    447448        /* search object identified by a register identifier */
    448449        for(i=0;((i<This->runObjTabLastIndx)&&(This->runObjTab[i].identRegObj!=identReg));i++);
    449    
     450
    450451    if (i==This->runObjTabLastIndx)  return S_FALSE;
    451452
     
    456457
    457458/******************************************************************************
    458  *              GetRunningObjectTable16 [OLE2.30]
     459 *      GetRunningObjectTable16 [OLE2.30]
    459460 */
    460461HRESULT WINAPI GetRunningObjectTable16(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot)
    461462{
    462         FIXME("(%ld,%p),stub!\n",reserved,pprot);
     463    FIXME("(%ld,%p),stub!\n",reserved,pprot);
    463464    return E_NOTIMPL;
    464465}
     
    490491HRESULT WINAPI OleRun(LPUNKNOWN pUnknown)
    491492{
    492   IRunnableObject       *runable;
     493  IRunnableObject   *runable;
    493494  ICOM_THIS(IRunnableObject,pUnknown);
    494   LRESULT               ret;
     495  LRESULT       ret;
    495496
    496497#ifdef __WIN32OS2__
     
    501502
    502503  ret = IRunnableObject_QueryInterface(This,&IID_IRunnableObject,(LPVOID*)&runable);
    503   if (ret) 
    504         return 0; /* Appears to return no error. */
     504  if (ret)
     505    return 0; /* Appears to return no error. */
    505506  ret  = IRunnableObject_Run(runable,NULL);
    506507  IRunnableObject_Release(runable);
     
    512513 */
    513514HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szUserName,
    514                                 LPDWORD pchEaten, LPMONIKER *ppmk)
     515                LPDWORD pchEaten, LPMONIKER *ppmk)
    515516{
    516517    FIXME("(%p, %s, %p, %p): stub.\n", pbc, debugstr_w(szUserName), pchEaten, *ppmk);
    517518    if (!(IsValidInterface((LPUNKNOWN) pbc)))
    518         return E_INVALIDARG;
     519    return E_INVALIDARG;
    519520
    520521    return MK_E_SYNTAX;
  • trunk/src/ole32/ole2.c

    r5602 r6648  
     1/* $Id: ole2.c,v 1.2 2001-09-05 13:17:11 bird Exp $ */
    12/*
    2  *      OLE2 library
    3  *
    4  *      Copyright 1995  Martin von Loewis
     3 *  OLE2 library
     4 *
     5 *  Copyright 1995  Martin von Loewis
    56 *      Copyright 1999  Francis Beaudet
    6  *      Copyright 1999  Noel Borthwick 
     7 *      Copyright 1999  Noel Borthwick
    78 */
    89
     
    3233
    3334/******************************************************************************
    34  * These are static/global variables and internal data structures that the 
     35 * These are static/global variables and internal data structures that the
    3536 * OLE module uses to maintain it's state.
    3637 */
     
    9495
    9596/******************************************************************************
    96  * These are the prototypes of miscelaneous utility methods 
     97 * These are the prototypes of miscelaneous utility methods
    9798 */
    9899static void OLEUTL_ReadRegistryDWORDValue(HKEY regKey, DWORD* pdwValue);
     
    123124static void            OLEDD_UnInitialize();
    124125static void            OLEDD_InsertDropTarget(
    125                         DropTargetNode* nodeToAdd);
     126            DropTargetNode* nodeToAdd);
    126127static DropTargetNode* OLEDD_ExtractDropTarget(
    127128                         HWND hwndOfTarget);
     
    129130                         HWND hwndOfTarget);
    130131static LRESULT WINAPI  OLEDD_DragTrackerWindowProc(
    131                          HWND   hwnd,
    132                         UINT   uMsg,
    133                          WPARAM wParam,
    134                         LPARAM   lParam);
     132             HWND   hwnd,
     133            UINT   uMsg,
     134             WPARAM wParam,
     135            LPARAM   lParam);
    135136static void OLEDD_TrackMouseMove(
    136137                         TrackerWindowInfo* trackerInfo,
    137                         POINT            mousePos,
    138                         DWORD              keyState);
     138            POINT            mousePos,
     139            DWORD              keyState);
    139140static void OLEDD_TrackStateChange(
    140141                         TrackerWindowInfo* trackerInfo,
    141                         POINT            mousePos,
    142                         DWORD              keyState);
     142            POINT            mousePos,
     143            DWORD              keyState);
    143144static DWORD OLEDD_GetButtonState();
    144145
    145146
    146147/******************************************************************************
    147  *              OleBuildVersion [OLE2.1]
     148 *      OleBuildVersion [OLE2.1]
    148149 */
    149150DWORD WINAPI OleBuildVersion(void)
     
    168169
    169170  /*
    170    * If the CoInitializeEx call failed, the OLE libraries can't be 
     171   * If the CoInitializeEx call failed, the OLE libraries can't be
    171172   * initialized.
    172173   */
    173174  if (FAILED(hr))
    174     return hr;   
     175    return hr;
    175176
    176177  /*
     
    184185  if (OLE_moduleLockCount==0)
    185186{
    186     /* 
     187    /*
    187188     * Initialize the libraries.
    188189     */
     
    208209   * Then, we increase the lock count on the OLE module.
    209210   */
    210   OLE_moduleLockCount++; 
     211  OLE_moduleLockCount++;
    211212
    212213  return hr;
     
    214215
    215216/******************************************************************************
    216  *              CoGetCurrentProcess     [COMPOBJ.34] [OLE2.2][OLE32.108]
     217 *      CoGetCurrentProcess [COMPOBJ.34] [OLE2.2][OLE32.108]
    217218 *
    218219 * NOTES
     
    221222DWORD WINAPI CoGetCurrentProcess(void)
    222223{
    223         return GetCurrentProcessId();
     224    return GetCurrentProcessId();
    224225}
    225226
    226227/******************************************************************************
    227  *              OleUninitialize [OLE2.3] [OLE32.131]
     228 *      OleUninitialize [OLE2.3] [OLE32.131]
    228229 */
    229230void WINAPI OleUninitialize(void)
     
    255256     */
    256257    OLEDD_UnInitialize();
    257    
     258
    258259    /*
    259260     * OLE shared menu
     
    261262    OLEMenu_UnInitialize();
    262263  }
    263  
     264
    264265  /*
    265266   * Then, uninitialize the COM libraries.
     
    271272//imessagefilter.cpp
    272273/******************************************************************************
    273  *              CoRegisterMessageFilter [OLE32.38]
     274 *      CoRegisterMessageFilter [OLE32.38]
    274275 */
    275276HRESULT WINAPI CoRegisterMessageFilter(
    276     LPMESSAGEFILTER lpMessageFilter,    /* [in] Pointer to interface */
    277     LPMESSAGEFILTER *lplpMessageFilter  /* [out] Indirect pointer to prior instance if non-NULL */
     277    LPMESSAGEFILTER lpMessageFilter,    /* [in] Pointer to interface */
     278    LPMESSAGEFILTER *lplpMessageFilter  /* [out] Indirect pointer to prior instance if non-NULL */
    278279) {
    279280    FIXME("stub\n");
    280281    if (lplpMessageFilter) {
    281         *lplpMessageFilter = NULL;
     282    *lplpMessageFilter = NULL;
    282283    }
    283284    return S_OK;
     
    286287
    287288/******************************************************************************
    288  *              OleInitializeWOW        [OLE32.109]
     289 *      OleInitializeWOW    [OLE32.109]
    289290 */
    290291HRESULT WINAPI OleInitializeWOW(DWORD x) {
     
    297298 */
    298299HRESULT WINAPI RegisterDragDrop16(
    299         HWND16 hwnd,
    300         LPDROPTARGET pDropTarget
     300    HWND16 hwnd,
     301    LPDROPTARGET pDropTarget
    301302) {
    302         FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget);
    303         return S_OK;
     303    FIXME("(0x%04x,%p),stub!\n",hwnd,pDropTarget);
     304    return S_OK;
    304305}
    305306
     
    308309 */
    309310HRESULT WINAPI RegisterDragDrop(
    310         HWND hwnd,
    311         LPDROPTARGET pDropTarget)
     311    HWND hwnd,
     312    LPDROPTARGET pDropTarget)
    312313{
    313314  DropTargetNode* dropTargetInfo;
     
    341342  dropTargetInfo->dropTarget  = pDropTarget;
    342343  IDropTarget_AddRef(dropTargetInfo->dropTarget);
    343  
     344
    344345  OLEDD_InsertDropTarget(dropTargetInfo);
    345346
    346         return S_OK;
     347    return S_OK;
    347348}
    348349
     
    351352 */
    352353HRESULT WINAPI RevokeDragDrop16(
    353         HWND16 hwnd
     354    HWND16 hwnd
    354355) {
    355         FIXME("(0x%04x),stub!\n",hwnd);
    356         return S_OK;
     356    FIXME("(0x%04x),stub!\n",hwnd);
     357    return S_OK;
    357358}
    358359
     
    361362 */
    362363HRESULT WINAPI RevokeDragDrop(
    363         HWND hwnd)
     364    HWND hwnd)
    364365{
    365366  DropTargetNode* dropTargetInfo;
     
    383384   */
    384385  IDropTarget_Release(dropTargetInfo->dropTarget);
    385   HeapFree(GetProcessHeap(), 0, dropTargetInfo); 
    386 
    387         return S_OK;
     386  HeapFree(GetProcessHeap(), 0, dropTargetInfo);
     387
     388    return S_OK;
    388389}
    389390
     
    396397 * way they are registered.
    397398 */
    398 HRESULT WINAPI OleRegGetUserType( 
    399         REFCLSID clsid,
    400         DWORD dwFormOfType,
    401         LPOLESTR* pszUserType)
     399HRESULT WINAPI OleRegGetUserType(
     400    REFCLSID clsid,
     401    DWORD dwFormOfType,
     402    LPOLESTR* pszUserType)
    402403{
    403404  char    keyName[60];
     
    427428   */
    428429  hres = RegOpenKeyA(HKEY_CLASSES_ROOT,
    429                      keyName,
    430                      &clsidKey);
     430             keyName,
     431             &clsidKey);
    431432
    432433  if (hres != ERROR_SUCCESS)
     
    439440
    440441  hres = RegQueryValueExA(clsidKey,
    441                           "",
    442                           NULL,
    443                           &dwKeyType,
    444                           NULL,
    445                           &cbData);
     442              "",
     443              NULL,
     444              &dwKeyType,
     445              NULL,
     446              &cbData);
    446447
    447448  if (hres!=ERROR_SUCCESS)
     
    473474
    474475  hres = RegQueryValueExA(clsidKey,
    475                           "",
    476                           NULL,
    477                           &dwKeyType,
    478                           buffer,
    479                           &cbData);
     476              "",
     477              NULL,
     478              &dwKeyType,
     479              buffer,
     480              &cbData);
    480481
    481482  RegCloseKey(clsidKey);
    482483
    483  
     484
    484485  if (hres!=ERROR_SUCCESS)
    485486  {
     
    527528
    528529  hwndTrackWindow = CreateWindowA(OLEDD_DRAGTRACKERCLASS,
    529                                     "TrackerWindow",
    530                                     WS_POPUP,
    531                                     CW_USEDEFAULT, CW_USEDEFAULT,
    532                                     CW_USEDEFAULT, CW_USEDEFAULT,
    533                                     0,
    534                                     0,
    535                                     0,
    536                                     (LPVOID)&trackerInfo);
     530                    "TrackerWindow",
     531                    WS_POPUP,
     532                    CW_USEDEFAULT, CW_USEDEFAULT,
     533                    CW_USEDEFAULT, CW_USEDEFAULT,
     534                    0,
     535                    0,
     536                    0,
     537                    (LPVOID)&trackerInfo);
    537538
    538539  if (hwndTrackWindow!=0)
     
    548549    while (!trackerInfo.trackingDone && GetMessageA(&msg, 0, 0, 0) )
    549550    {
    550       if ( (msg.message >= WM_KEYFIRST) && 
    551            (msg.message <= WM_KEYLAST) )
     551      if ( (msg.message >= WM_KEYFIRST) &&
     552       (msg.message <= WM_KEYLAST) )
    552553      {
    553         /*
    554         * When keyboard messages are sent to windows on this thread, we
    555         * want to ignore notify the drop source that the state changed.
    556         * in the case of the Escape key, we also notify the drop source
    557         * we give it a special meaning.
    558         */
    559         if ( (msg.message==WM_KEYDOWN) &&
    560              (msg.wParam==VK_ESCAPE) )
    561         {
    562           trackerInfo.escPressed = TRUE;
    563         }
    564 
    565         /*
    566         * Notify the drop source.
    567          */       
    568         OLEDD_TrackStateChange(&trackerInfo,
    569                                msg.pt,
    570                                OLEDD_GetButtonState());
     554    /*
     555    * When keyboard messages are sent to windows on this thread, we
     556    * want to ignore notify the drop source that the state changed.
     557    * in the case of the Escape key, we also notify the drop source
     558    * we give it a special meaning.
     559    */
     560    if ( (msg.message==WM_KEYDOWN) &&
     561         (msg.wParam==VK_ESCAPE) )
     562    {
     563      trackerInfo.escPressed = TRUE;
     564    }
     565
     566    /*
     567    * Notify the drop source.
     568     */
     569    OLEDD_TrackStateChange(&trackerInfo,
     570                   msg.pt,
     571                   OLEDD_GetButtonState());
    571572      }
    572573      else
    573574      {
    574         /*
    575         * Dispatch the messages only when it's not a keyboard message.
    576         */
    577         DispatchMessageA(&msg);
     575    /*
     576    * Dispatch the messages only when it's not a keyboard message.
     577    */
     578    DispatchMessageA(&msg);
    578579      }
    579580    }
     
    633634   */
    634635  result = RegOpenKeyA(HKEY_CLASSES_ROOT,
    635                        keyName,
    636                        &clsidKey);
     636               keyName,
     637               &clsidKey);
    637638
    638639  if (result != ERROR_SUCCESS)
     
    643644   */
    644645  result = RegOpenKeyA(clsidKey,
    645                        "MiscStatus",
    646                        &miscStatusKey);
    647 
    648  
     646               "MiscStatus",
     647               &miscStatusKey);
     648
     649
    649650  if (result != ERROR_SUCCESS)
    650651  {
     
    664665
    665666  result = RegOpenKeyA(miscStatusKey,
    666                        keyName,
    667                        &aspectKey);
    668  
     667               keyName,
     668               &aspectKey);
     669
    669670  if (result == ERROR_SUCCESS)
    670671  {
     
    686687 */
    687688HRESULT WINAPI OleSetContainedObject(
    688   LPUNKNOWN pUnknown, 
     689  LPUNKNOWN pUnknown,
    689690  BOOL      fContained)
    690691{
     
    695696
    696697  hres = IUnknown_QueryInterface(pUnknown,
    697                                 &IID_IRunnableObject,
    698                                 (void**)&runnable);
     698                &IID_IRunnableObject,
     699                (void**)&runnable);
    699700
    700701  if (SUCCEEDED(hres))
     
    714715 */
    715716HRESULT WINAPI OleLoad(
    716   LPSTORAGE       pStg, 
    717   REFIID          riid, 
    718   LPOLECLIENTSITE pClientSite, 
     717  LPSTORAGE       pStg,
     718  REFIID          riid,
     719  LPOLECLIENTSITE pClientSite,
    719720  LPVOID*         ppvObj)
    720721{
     
    725726
    726727  TRACE("(%p,%p,%p,%p)\n", pStg, riid, pClientSite, ppvObj);
    727  
     728
    728729  /*
    729730   * TODO, Conversion ... OleDoAutoConvert
     
    739740   */
    740741  hres = CoCreateInstance(&storageInfo.clsid,
    741                           NULL,
    742                           CLSCTX_INPROC_HANDLER,
    743                           &IID_IOleObject,
    744                           (void**)&oleObject);
     742              NULL,
     743              CLSCTX_INPROC_HANDLER,
     744              &IID_IOleObject,
     745              (void**)&oleObject);
    745746
    746747  /*
     
    751752  {
    752753    hres = OleCreateDefaultHandler(&storageInfo.clsid,
    753                                    NULL,
    754                                    &IID_IOleObject,
    755                                    (void**)&oleObject);
     754                   NULL,
     755                   &IID_IOleObject,
     756                   (void**)&oleObject);
    756757  }
    757758
     
    771772   */
    772773  hres = IOleObject_QueryInterface(oleObject,
    773                                    &IID_IPersistStorage,
    774                                    (void**)&persistStorage);
    775 
    776   if (SUCCEEDED(hres)) 
     774                   &IID_IPersistStorage,
     775                   (void**)&persistStorage);
     776
     777  if (SUCCEEDED(hres))
    777778  {
    778779    IPersistStorage_Load(persistStorage, pStg);
     
    827828  {
    828829    IStorage_Commit(pStg,
    829                     STGC_DEFAULT);
    830   }
    831  
     830            STGC_DEFAULT);
     831  }
     832
    832833  return hres;
    833834}
     
    837838 *              OleLockRunning        [OLE32.114]
    838839 */
    839 HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses) 
     840HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses)
    840841{
    841842  IRunnableObject* runnable = NULL;
     
    845846
    846847  hres = IUnknown_QueryInterface(pUnknown,
    847                                 &IID_IRunnableObject,
    848                                 (void**)&runnable);
     848                &IID_IRunnableObject,
     849                (void**)&runnable);
    849850
    850851  if (SUCCEEDED(hres))
     
    902903  pHookItem->tid = tid;
    903904  pHookItem->hHeap = GetProcessHeap();
    904  
     905
    905906  /* Install a thread scope message hook for WH_GETMESSAGE */
    906907  pHookItem->GetMsg_hHook = SetWindowsHookExA( WH_GETMESSAGE, OLEMenu_GetMsgProc,
     
    918919  pHookItem->next = hook_list;
    919920  hook_list = pHookItem;
    920  
     921
    921922  return TRUE;
    922  
     923
    923924CLEANUP:
    924925  /* Unhook any hooks */
     
    929930  /* Release the hook table entry */
    930931  HeapFree(pHookItem->hHeap, 0, pHookItem );
    931  
     932
    932933  return FALSE;
    933934}
     
    994995      return pHookItem;
    995996  }
    996  
     997
    997998  return NULL;
    998999}
     
    10151016  {
    10161017    HMENU hsubmenu;
    1017      
     1018
    10181019    /*  Is the current item a submenu? */
    10191020    if ( (hsubmenu = GetSubMenu(hMainMenu, i)) )
     
    10621063  if ( !OLEMenu_FindMainMenuIndex( pOleMenuDescriptor->hmenuCombined, hmenu,  &nPos ) )
    10631064    return FALSE;
    1064  
     1065
    10651066  /* The group widths array has counts for the number of elements
    10661067   * in the groups File, Edit, Container, Object, Window, Help.
     
    10951096  OleMenuHookItem *pHookItem = NULL;
    10961097  WORD fuFlags;
    1097  
     1098
    10981099  TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam );
    10991100
     
    11011102  if ( HC_ACTION != code )
    11021103    goto NEXTHOOK;
    1103      
     1104
    11041105  /* Retrieve the current message being dispatched from lParam */
    11051106  pMsg = (LPCWPSTRUCT)lParam;
     
    11311132      goto NEXTHOOK;
    11321133    }
    1133    
     1134
    11341135    case WM_INITMENUPOPUP:
    11351136    {
     
    11381139      break;
    11391140    }
    1140    
     1141
    11411142    case WM_MENUSELECT:
    11421143    {
     
    11511152      break;
    11521153    }
    1153    
     1154
    11541155    case WM_DRAWITEM:
    11551156    {
     
    11711172                  pMsg->message, pMsg->wParam, pMsg->lParam );
    11721173  }
    1173    
     1174
    11741175NEXTHOOK:
    11751176  if ( pOleMenuDescriptor )
    11761177    GlobalUnlock( hOleMenu );
    1177  
     1178
    11781179  /* Lookup the hook item for the current thread */
    11791180  if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
     
    11831184    return 0;
    11841185  }
    1185  
     1186
    11861187  /* Pass on the message to the next hooker */
    11871188  return CallNextHookEx( pHookItem->CallWndProc_hHook, code, wParam, lParam );
     
    12001201  OleMenuHookItem *pHookItem = NULL;
    12011202  WORD wCode;
    1202  
     1203
    12031204  TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam );
    12041205
     
    12061207  if ( HC_ACTION != code )
    12071208    goto NEXTHOOK;
    1208      
     1209
    12091210  /* Retrieve the current message being dispatched from lParam */
    12101211  pMsg = (LPMSG)lParam;
     
    12451246    pMsg->hwnd = pOleMenuDescriptor->hwndActiveObject;
    12461247  }
    1247    
     1248
    12481249NEXTHOOK:
    12491250  if ( pOleMenuDescriptor )
    12501251    GlobalUnlock( hOleMenu );
    1251  
     1252
    12521253  /* Lookup the hook item for the current thread */
    12531254  if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
     
    12571258    return FALSE;
    12581259  }
    1259  
     1260
    12601261  /* Pass on the message to the next hooker */
    12611262  return CallNextHookEx( pHookItem->GetMsg_hHook, code, wParam, lParam );
     
    12951296  for ( i = 0; i < 6; i++ )
    12961297    pOleMenuDescriptor->mgw.width[i] = lpMenuWidths->width[i];
    1297  
     1298
    12981299  pOleMenuDescriptor->hmenuCombined = hmenuCombined;
    12991300  pOleMenuDescriptor->bIsServerItem = FALSE;
    13001301  GlobalUnlock( hOleMenu );
    1301      
     1302
    13021303  return hOleMenu;
    13031304}
     
    13121313  if ( hmenuDescriptor )
    13131314    GlobalFree( hmenuDescriptor );
    1314         return S_OK;
     1315    return S_OK;
    13151316}
    13161317
     
    13211322 * OLE should install context sensitive help F1 filtering for the app when
    13221323 * these are non null.
    1323  * 
     1324 *
    13241325 * PARAMS:
    13251326 *     hOleMenu         Handle to composite menu descriptor
     
    13491350  {
    13501351     FIXME("(%x, %x, %x, %p, %p), Context sensitive help filtering not implemented!\n",
    1351         (unsigned int)hOleMenu,
    1352         hwndFrame,
    1353         hwndActiveObject,
    1354         lpFrame,
    1355         lpActiveObject);
     1352    (unsigned int)hOleMenu,
     1353    hwndFrame,
     1354    hwndActiveObject,
     1355    lpFrame,
     1356    lpActiveObject);
    13561357  }
    13571358
     
    13691370    if ( OLEMenu_IsHookInstalled( GetCurrentThreadId() ) )
    13701371  return E_FAIL;
    1371        
     1372
    13721373    /* Get the menu descriptor */
    13731374    pOleMenuDescriptor = (OleMenuDescriptor *) GlobalLock( hOleMenu );
     
    13811382    GlobalUnlock( hOleMenu );
    13821383    pOleMenuDescriptor = NULL;
    1383    
     1384
    13841385    /* Add a menu descriptor windows property to the frame window */
    13851386    SetPropA( hwndFrame, "PROP_OLEMenuDescriptor", hOleMenu );
     
    13941395    if ( !OLEMenu_UnInstallHooks( GetCurrentThreadId() ) )
    13951396      return E_FAIL;
    1396    
     1397
    13971398    /* Remove the menu descriptor property from the frame window */
    13981399    RemovePropA( hwndFrame, "PROP_OLEMenuDescriptor" );
    13991400  }
    1400      
     1401
    14011402  return S_OK;
    14021403}
     
    14191420#endif
    14201421    {
    1421         WARN_(accel)("invalid accel handle=%04x\n", hAccel);
    1422         return FALSE;
     1422    WARN_(accel)("invalid accel handle=%04x\n", hAccel);
     1423    return FALSE;
    14231424    }
    14241425    if((lpMsg->message != WM_KEYDOWN &&
    1425         lpMsg->message != WM_KEYUP &&
    1426         lpMsg->message != WM_SYSKEYDOWN &&
    1427         lpMsg->message != WM_SYSKEYUP &&
    1428         lpMsg->message != WM_CHAR)) return FALSE;
     1426    lpMsg->message != WM_KEYUP &&
     1427    lpMsg->message != WM_SYSKEYDOWN &&
     1428    lpMsg->message != WM_SYSKEYUP &&
     1429    lpMsg->message != WM_CHAR)) return FALSE;
    14291430
    14301431    TRACE_(accel)("hAccel=%04x, cAccelEntries=%d,"
    1431                 "msg->hwnd=%04x, msg->message=%04x, wParam=%08x, lParam=%08lx\n",
    1432                 hAccel, cAccelEntries,
    1433                 lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam);
     1432        "msg->hwnd=%04x, msg->message=%04x, wParam=%08x, lParam=%08lx\n",
     1433        hAccel, cAccelEntries,
     1434        lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam);
    14341435    for(i = 0; i < cAccelEntries; i++)
    14351436    {
    1436         if(lpAccelTbl[i].key != lpMsg->wParam)
    1437             continue;
    1438 
    1439         if(lpMsg->message == WM_CHAR)
    1440         {
    1441             if(!(lpAccelTbl[i].fVirt & FALT) && !(lpAccelTbl[i].fVirt & FVIRTKEY))
    1442             {
    1443                 TRACE_(accel)("found accel for WM_CHAR: ('%c')\n", lpMsg->wParam & 0xff);
    1444                 goto found;
    1445             }
    1446         }
    1447         else
    1448         {
    1449             if(lpAccelTbl[i].fVirt & FVIRTKEY)
    1450             {
    1451                 INT mask = 0;
    1452                 TRACE_(accel)("found accel for virt_key %04x (scan %04x)\n",
    1453                                 lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff);
    1454                 if(GetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT;
    1455                 if(GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
    1456                 if(GetKeyState(VK_MENU) & 0x8000) mask |= FALT;
    1457                 if(mask == (lpAccelTbl[i].fVirt & (FSHIFT | FCONTROL | FALT))) goto found;
    1458                 TRACE_(accel)("incorrect SHIFT/CTRL/ALT-state\n");
    1459             }
    1460             else
    1461             {
    1462                 if(!(lpMsg->lParam & 0x01000000))  /* no special_key */
    1463                 {
    1464                     if((lpAccelTbl[i].fVirt & FALT) && (lpMsg->lParam & 0x20000000))
    1465                     {                                                  /* ^^ ALT pressed */
    1466                         TRACE_(accel)("found accel for Alt-%c\n", lpMsg->wParam & 0xff);
    1467                         goto found;
    1468                     }
    1469                 }
    1470             }
    1471         }
    1472     }   
     1437    if(lpAccelTbl[i].key != lpMsg->wParam)
     1438        continue;
     1439
     1440    if(lpMsg->message == WM_CHAR)
     1441    {
     1442        if(!(lpAccelTbl[i].fVirt & FALT) && !(lpAccelTbl[i].fVirt & FVIRTKEY))
     1443        {
     1444        TRACE_(accel)("found accel for WM_CHAR: ('%c')\n", lpMsg->wParam & 0xff);
     1445        goto found;
     1446        }
     1447    }
     1448    else
     1449    {
     1450        if(lpAccelTbl[i].fVirt & FVIRTKEY)
     1451        {
     1452        INT mask = 0;
     1453        TRACE_(accel)("found accel for virt_key %04x (scan %04x)\n",
     1454                lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff);
     1455        if(GetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT;
     1456        if(GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
     1457        if(GetKeyState(VK_MENU) & 0x8000) mask |= FALT;
     1458        if(mask == (lpAccelTbl[i].fVirt & (FSHIFT | FCONTROL | FALT))) goto found;
     1459        TRACE_(accel)("incorrect SHIFT/CTRL/ALT-state\n");
     1460        }
     1461        else
     1462        {
     1463        if(!(lpMsg->lParam & 0x01000000))  /* no special_key */
     1464        {
     1465            if((lpAccelTbl[i].fVirt & FALT) && (lpMsg->lParam & 0x20000000))
     1466            {                              /* ^^ ALT pressed */
     1467            TRACE_(accel)("found accel for Alt-%c\n", lpMsg->wParam & 0xff);
     1468            goto found;
     1469            }
     1470        }
     1471        }
     1472    }
     1473    }
    14731474
    14741475    WARN_(accel)("couldn't translate accelerator key\n");
     
    14901491    case TYMED_HGLOBAL:
    14911492    {
    1492       if ( (pmedium->pUnkForRelease==0) && 
    1493            (pmedium->u.hGlobal!=0) )
    1494         GlobalFree(pmedium->u.hGlobal);
     1493      if ( (pmedium->pUnkForRelease==0) &&
     1494       (pmedium->u.hGlobal!=0) )
     1495    GlobalFree(pmedium->u.hGlobal);
    14951496
    14961497      pmedium->u.hGlobal = 0;
     
    15011502      if (pmedium->u.lpszFileName!=0)
    15021503      {
    1503         if (pmedium->pUnkForRelease==0)
    1504         {
    1505           DeleteFileW(pmedium->u.lpszFileName);
    1506         }
    1507        
    1508         CoTaskMemFree(pmedium->u.lpszFileName);
     1504    if (pmedium->pUnkForRelease==0)
     1505    {
     1506      DeleteFileW(pmedium->u.lpszFileName);
     1507    }
     1508
     1509    CoTaskMemFree(pmedium->u.lpszFileName);
    15091510      }
    15101511
     
    15161517      if (pmedium->u.pstm!=0)
    15171518      {
    1518         IStream_Release(pmedium->u.pstm);
     1519    IStream_Release(pmedium->u.pstm);
    15191520      }
    15201521
     
    15261527      if (pmedium->u.pstg!=0)
    15271528      {
    1528         IStorage_Release(pmedium->u.pstg);
     1529    IStorage_Release(pmedium->u.pstg);
    15291530      }
    15301531
     
    15341535    case TYMED_GDI:
    15351536    {
    1536       if ( (pmedium->pUnkForRelease==0) && 
    1537            (pmedium->u.hGlobal!=0) )
    1538         DeleteObject(pmedium->u.hGlobal);
     1537      if ( (pmedium->pUnkForRelease==0) &&
     1538       (pmedium->u.hGlobal!=0) )
     1539    DeleteObject(pmedium->u.hGlobal);
    15391540
    15401541      pmedium->u.hGlobal = 0;
     
    15431544    case TYMED_MFPICT:
    15441545    {
    1545       if ( (pmedium->pUnkForRelease==0) && 
    1546            (pmedium->u.hMetaFilePict!=0) )
     1546      if ( (pmedium->pUnkForRelease==0) &&
     1547       (pmedium->u.hMetaFilePict!=0) )
    15471548      {
    1548         LPMETAFILEPICT pMP = GlobalLock(pmedium->u.hMetaFilePict);
    1549         DeleteMetaFile(pMP->hMF);
    1550         GlobalUnlock(pmedium->u.hMetaFilePict);
    1551         GlobalFree(pmedium->u.hMetaFilePict);
     1549    LPMETAFILEPICT pMP = GlobalLock(pmedium->u.hMetaFilePict);
     1550    DeleteMetaFile(pMP->hMF);
     1551    GlobalUnlock(pmedium->u.hMetaFilePict);
     1552    GlobalFree(pmedium->u.hMetaFilePict);
    15521553      }
    15531554
     
    15571558    case TYMED_ENHMF:
    15581559    {
    1559       if ( (pmedium->pUnkForRelease==0) && 
    1560            (pmedium->u.hEnhMetaFile!=0) )
     1560      if ( (pmedium->pUnkForRelease==0) &&
     1561       (pmedium->u.hEnhMetaFile!=0) )
    15611562      {
    1562         DeleteEnhMetaFile(pmedium->u.hEnhMetaFile);
     1563    DeleteEnhMetaFile(pmedium->u.hEnhMetaFile);
    15631564      }
    15641565
     
    15981599    wndClass.hbrBackground = 0;
    15991600    wndClass.lpszClassName = OLEDD_DRAGTRACKERCLASS;
    1600  
     1601
    16011602    RegisterClassA (&wndClass);
    16021603}
     
    16641665  /*
    16651666   * If we get here, we have found a spot for our item. The parentNodeLink
    1666    * pointer points to the pointer that we have to modify. 
     1667   * pointer points to the pointer that we have to modify.
    16671668   * The curNode should be NULL. We just have to establish the link and Voila!
    16681669   */
     
    17111712    {
    17121713      /*
    1713        * The item was found in the list. Detach it from it's parent and 
     1714       * The item was found in the list. Detach it from it's parent and
    17141715       * re-insert it's kids in the tree.
    17151716       */
     
    17271728      if (curNode->nextDropTarget!=NULL)
    17281729      {
    1729         OLEDD_InsertDropTarget(curNode->nextDropTarget);
     1730    OLEDD_InsertDropTarget(curNode->nextDropTarget);
    17301731      }
    17311732
     
    18011802 */
    18021803static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
    1803                          HWND   hwnd,
    1804                         UINT   uMsg,
    1805                          WPARAM wParam,
    1806                         LPARAM   lParam)
     1804             HWND   hwnd,
     1805            UINT   uMsg,
     1806             WPARAM wParam,
     1807            LPARAM   lParam)
    18071808{
    18081809  switch (uMsg)
     
    18121813      LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam;
    18131814
    1814       SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams); 
    1815 
    1816      
     1815      SetWindowLongA(hwnd, 0, (LONG)createStruct->lpCreateParams);
     1816
     1817
    18171818      break;
    18181819    }
     
    19091910   * DragOver notification
    19101911   */
    1911   if ( (trackerInfo->curDragTarget != 0) && 
     1912  if ( (trackerInfo->curDragTarget != 0) &&
    19121913       (trackerInfo->curDragTargetHWND==hwndNewTarget) )
    19131914  {
    19141915    POINTL  mousePosParam;
    1915    
     1916
    19161917    /*
    19171918     * The documentation tells me that the coordinate should be in the target
     
    19211922    mousePosParam.x = mousePos.x;
    19221923    mousePosParam.y = mousePos.y;
    1923    
     1924
    19241925    IDropTarget_DragOver(trackerInfo->curDragTarget,
    1925                         keyState,
    1926                         mousePosParam,
    1927                         trackerInfo->pdwEffect);
     1926            keyState,
     1927            mousePosParam,
     1928            trackerInfo->pdwEffect);
    19281929  }
    19291930  else
    19301931  {
    19311932    DropTargetNode* newDropTargetNode = 0;
    1932    
     1933
    19331934    /*
    19341935     * If we changed window, we have to notify our old target and check for
     
    19391940      IDropTarget_DragLeave(trackerInfo->curDragTarget);
    19401941    }
    1941    
     1942
    19421943    /*
    19431944     * Make sure we're hovering over a window.
     
    19501951      HWND nexttar = hwndNewTarget;
    19511952      do {
    1952         newDropTargetNode = OLEDD_FindDropTarget(nexttar);
     1953    newDropTargetNode = OLEDD_FindDropTarget(nexttar);
    19531954      } while (!newDropTargetNode && (nexttar = GetParent(nexttar)) != 0);
    19541955      if(nexttar) hwndNewTarget = nexttar;
     
    19561957      trackerInfo->curDragTargetHWND = hwndNewTarget;
    19571958      trackerInfo->curDragTarget     = newDropTargetNode ? newDropTargetNode->dropTarget : 0;
    1958      
     1959
    19591960      /*
    19601961       * If there is, notify it that we just dragged-in
     
    19621963      if (trackerInfo->curDragTarget!=0)
    19631964      {
    1964         POINTL  mousePosParam;
    1965        
    1966         /*
    1967         * The documentation tells me that the coordinate should be in the target
    1968         * window's coordinate space. However, the tests I made tell me the
    1969         * coordinates should be in screen coordinates.
    1970         */
    1971         mousePosParam.x = mousePos.x;
    1972         mousePosParam.y = mousePos.y;
    1973        
    1974         IDropTarget_DragEnter(trackerInfo->curDragTarget,
    1975                               trackerInfo->dataObject,
    1976                               keyState,
    1977                               mousePosParam,
    1978                               trackerInfo->pdwEffect);
     1965    POINTL  mousePosParam;
     1966
     1967    /*
     1968    * The documentation tells me that the coordinate should be in the target
     1969    * window's coordinate space. However, the tests I made tell me the
     1970    * coordinates should be in screen coordinates.
     1971    */
     1972    mousePosParam.x = mousePos.x;
     1973    mousePosParam.y = mousePos.y;
     1974
     1975    IDropTarget_DragEnter(trackerInfo->curDragTarget,
     1976                  trackerInfo->dataObject,
     1977                  keyState,
     1978                  mousePosParam,
     1979                  trackerInfo->pdwEffect);
    19791980      }
    19801981    }
     
    19901991
    19911992  /*
    1992    * Now that we have done that, we have to tell the source to give 
    1993    * us feedback on the work being done by the target.  If we don't 
     1993   * Now that we have done that, we have to tell the source to give
     1994   * us feedback on the work being done by the target.  If we don't
    19941995   * have a target, simulate no effect.
    19951996   */
     
    20002001
    20012002  hr = IDropSource_GiveFeedback(trackerInfo->dropSource,
    2002                                 *trackerInfo->pdwEffect);
     2003                *trackerInfo->pdwEffect);
    20032004
    20042005  /*
     
    20262027      SetCursor(LoadCursorA(OLE32_hInstance, MAKEINTRESOURCEA(0)));
    20272028    }
    2028   } 
     2029  }
    20292030}
    20302031
     
    20542055   */
    20552056  trackerInfo->returnValue = IDropSource_QueryContinueDrag(
    2056                                trackerInfo->dropSource,
    2057                                trackerInfo->escPressed,
    2058                                keyState);
    2059  
     2057                   trackerInfo->dropSource,
     2058                   trackerInfo->escPressed,
     2059                   keyState);
     2060
    20602061  /*
    20612062   * All the return valued will stop the operation except the S_OK
     
    20702071
    20712072    /*
    2072      * Release the mouse in case the drop target decides to show a popup 
     2073     * Release the mouse in case the drop target decides to show a popup
    20732074     * or a menu or something.
    20742075     */
    20752076    ReleaseCapture();
    2076    
     2077
    20772078    /*
    2078      * If we end-up over a target, drop the object in the target or 
     2079     * If we end-up over a target, drop the object in the target or
    20792080     * inform the target that the operation was cancelled.
    20802081     */
     
    20832084      switch (trackerInfo->returnValue)
    20842085      {
    2085         /*
    2086          * If the source wants us to complete the operation, we tell
    2087         * the drop target that we just dropped the object in it.
    2088         */
     2086    /*
     2087     * If the source wants us to complete the operation, we tell
     2088    * the drop target that we just dropped the object in it.
     2089    */
    20892090        case DRAGDROP_S_DROP:
    2090         {
    2091           POINTL  mousePosParam;
    2092        
    2093           /*
    2094            * The documentation tells me that the coordinate should be
    2095            * in the target window's coordinate space. However, the tests
    2096            * I made tell me the coordinates should be in screen coordinates.
    2097            */
    2098           mousePosParam.x = mousePos.x;
    2099           mousePosParam.y = mousePos.y;
    2100          
    2101           IDropTarget_Drop(trackerInfo->curDragTarget,
    2102                            trackerInfo->dataObject,
    2103                            keyState,
    2104                            mousePosParam,
    2105                            trackerInfo->pdwEffect);
    2106           break;
    2107         }
    2108         /*
    2109          * If the source told us that we should cancel, fool the drop
    2110         * target by telling it that the mouse left it's window.
    2111          * Also set the drop effect to "NONE" in case the application
    2112         * ignores the result of DoDragDrop.
    2113         */
     2091    {
     2092      POINTL  mousePosParam;
     2093
     2094      /*
     2095       * The documentation tells me that the coordinate should be
     2096       * in the target window's coordinate space. However, the tests
     2097       * I made tell me the coordinates should be in screen coordinates.
     2098       */
     2099      mousePosParam.x = mousePos.x;
     2100      mousePosParam.y = mousePos.y;
     2101
     2102      IDropTarget_Drop(trackerInfo->curDragTarget,
     2103               trackerInfo->dataObject,
     2104               keyState,
     2105               mousePosParam,
     2106               trackerInfo->pdwEffect);
     2107      break;
     2108    }
     2109    /*
     2110     * If the source told us that we should cancel, fool the drop
     2111    * target by telling it that the mouse left it's window.
     2112     * Also set the drop effect to "NONE" in case the application
     2113    * ignores the result of DoDragDrop.
     2114    */
    21142115        case DRAGDROP_S_CANCEL:
    2115           IDropTarget_DragLeave(trackerInfo->curDragTarget);
    2116           *trackerInfo->pdwEffect = DROPEFFECT_NONE;
    2117           break;
     2116      IDropTarget_DragLeave(trackerInfo->curDragTarget);
     2117      *trackerInfo->pdwEffect = DROPEFFECT_NONE;
     2118      break;
    21182119      }
    21192120    }
     
    21622163 * params:
    21632164 *     regKey   - Key to read the default value from
    2164  *     pdwValue - Pointer to the location where the DWORD 
     2165 *     pdwValue - Pointer to the location where the DWORD
    21652166 *                value is returned. This value is not modified
    21662167 *                if the value is not found.
     
    21682169
    21692170static void OLEUTL_ReadRegistryDWORDValue(
    2170   HKEY   regKey, 
     2171  HKEY   regKey,
    21712172  DWORD* pdwValue)
    21722173{
     
    21772178
    21782179  lres = RegQueryValueExA(regKey,
    2179                           "",
    2180                           NULL,
    2181                           &dwKeyType,
    2182                           (LPBYTE)buffer,
    2183                           &cbData);
     2180              "",
     2181              NULL,
     2182              &dwKeyType,
     2183              (LPBYTE)buffer,
     2184              &cbData);
    21842185
    21852186  if (lres==ERROR_SUCCESS)
     
    21882189    {
    21892190      case REG_DWORD:
    2190         *pdwValue = *(DWORD*)buffer;
    2191         break;
     2191    *pdwValue = *(DWORD*)buffer;
     2192    break;
    21922193      case REG_EXPAND_SZ:
    21932194      case REG_MULTI_SZ:
    21942195      case REG_SZ:
    2195         *pdwValue = (DWORD)strtoul(buffer, NULL, 10);
    2196         break;
     2196    *pdwValue = (DWORD)strtoul(buffer, NULL, 10);
     2197    break;
    21972198    }
    21982199  }
     
    22092210 */
    22102211HGLOBAL16 WINAPI OleMetaFilePictFromIconAndLabel16(
    2211         HICON16 hIcon,
    2212         LPCOLESTR16 lpszLabel,
    2213         LPCOLESTR16 lpszSourceFile,
    2214         UINT16 iIconIndex
     2212    HICON16 hIcon,
     2213    LPCOLESTR16 lpszLabel,
     2214    LPCOLESTR16 lpszSourceFile,
     2215    UINT16 iIconIndex
    22152216) {
    22162217    METAFILEPICT16 *mf;
     
    22222223    if (!hIcon) {
    22232224        if (lpszSourceFile) {
    2224             HINSTANCE16 hInstance = LoadLibrary16(lpszSourceFile);
    2225 
    2226             /* load the icon at index from lpszSourceFile */
    2227             hIcon = (HICON16)LoadIconA(hInstance, (LPCSTR)(DWORD)iIconIndex);
    2228             FreeLibrary16(hInstance);
    2229         } else
    2230             return (HGLOBAL)NULL;
     2225        HINSTANCE16 hInstance = LoadLibrary16(lpszSourceFile);
     2226
     2227        /* load the icon at index from lpszSourceFile */
     2228        hIcon = (HICON16)LoadIconA(hInstance, (LPCSTR)(DWORD)iIconIndex);
     2229        FreeLibrary16(hInstance);
     2230    } else
     2231        return (HGLOBAL)NULL;
    22312232    }
    22322233
  • trunk/src/ole32/ole2impl.c

    r5602 r6648  
     1/* $Id: ole2impl.c,v 1.2 2001-09-05 13:17:11 bird Exp $ */
    12/*
    23 * Ole 2 Create functions implementation
  • trunk/src/ole32/ole2stubs.c

    r5602 r6648  
     1/* $Id: ole2stubs.c,v 1.2 2001-09-05 13:17:11 bird Exp $ */
    12/*
    23 * Temporary place for ole2 stubs.
     
    1920 */
    2021HRESULT WINAPI  OleCreateLinkToFile(LPCOLESTR lpszFileName, REFIID riid,
    21                         DWORD renderopt, LPFORMATETC lpFormatEtc,
    22                         LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID* ppvObj)
     22            DWORD renderopt, LPFORMATETC lpFormatEtc,
     23            LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID* ppvObj)
    2324{
    2425    FIXME("(%p,%p,%li,%p,%p,%p,%p), stub!\n",lpszFileName, riid, renderopt, lpFormatEtc, pClientSite, pStg, ppvObj);
     
    3132 */
    3233HRESULT WINAPI OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat,
    33                                   UINT uiFlags)
     34                              UINT uiFlags)
    3435{
    3536    FIXME("(%x,%x,%x), stub!\n", hSrc, cfFormat, uiFlags);
     
    3738}
    3839
    39  
     40
    4041/***********************************************************************
    4142 *               WriteFmtUserTypeStg (OLE32.160)
    4243 */
    4344HRESULT WINAPI WriteFmtUserTypeStg(
    44           LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType)
     45      LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType)
    4546{
    4647    FIXME("(%p,%x,%s) stub!\n",pstg,cf,debugstr_w(lpszUserType));
     
    8182 */
    8283HRESULT WINAPI OleCreate(
    83         REFCLSID rclsid,
    84         REFIID riid,
    85         DWORD renderopt,
    86         LPFORMATETC pFormatEtc,
    87         LPOLECLIENTSITE pClientSite,
    88         LPSTORAGE pStg,
    89         LPVOID* ppvObj)
     84    REFCLSID rclsid,
     85    REFIID riid,
     86    DWORD renderopt,
     87    LPFORMATETC pFormatEtc,
     88    LPOLECLIENTSITE pClientSite,
     89    LPSTORAGE pStg,
     90    LPVOID* ppvObj)
    9091{
    9192  HRESULT hres, hres1;
    9293  IUnknown * pUnk = NULL;
    93    
     94
    9495  FIXME("\n\t%s\n\t%s stub!\n", debugstr_guid(rclsid), debugstr_guid(riid));
    9596
     
    105106        hres1 = IOleObject_SetClientSite(pOE, pClientSite);
    106107        TRACE("-- result 0x%08lx\n", hres1);
    107         IOleObject_Release(pOE);
     108    IOleObject_Release(pOE);
    108109      }
    109110      if (SUCCEEDED((hres = IUnknown_QueryInterface( pUnk, &IID_IPersistStorage, (LPVOID*)&pPS))))
    110111      {
    111112        TRACE("trying to set stg %p\n", pStg);
    112         hres1 = IPersistStorage_InitNew(pPS, pStg);
     113    hres1 = IPersistStorage_InitNew(pPS, pStg);
    113114        TRACE("-- result 0x%08lx\n", hres1);
    114         IPersistStorage_Release(pPS);
     115    IPersistStorage_Release(pPS);
    115116      }
    116117    }
     
    208209 */
    209210HRESULT     WINAPI OleRegEnumFormatEtc (
    210   REFCLSID clsid, 
     211  REFCLSID clsid,
    211212  DWORD    dwDirection,
    212213  LPENUMFORMATETC* ppenumFormatetc)
     
    218219
    219220/***********************************************************************
    220  *           PropVariantClear                       [OLE32.166]
     221 *           PropVariantClear               [OLE32.166]
    221222 */
    222223HRESULT WINAPI PropVariantClear(void *pvar) /* [in/out] FIXME: PROPVARIANT * */
    223224{
    224         FIXME("(%p): stub:\n", pvar);
    225 
    226         *(LPWORD)pvar = 0;
    227         /* sets at least the vt field to VT_EMPTY */
    228         return S_OK;
    229 }
    230 
    231 /***********************************************************************
    232  *           PropVariantCopy                        [OLE32.246]
     225    FIXME("(%p): stub:\n", pvar);
     226
     227    *(LPWORD)pvar = 0;
     228    /* sets at least the vt field to VT_EMPTY */
     229    return S_OK;
     230}
     231
     232/***********************************************************************
     233 *           PropVariantCopy                [OLE32.246]
    233234 */
    234235HRESULT WINAPI PropVariantCopy(void *pvarDest,      /* [out] FIXME: PROPVARIANT * */
    235                                const void *pvarSrc) /* [in] FIXME: const PROPVARIANT * */
    236 {
    237         FIXME("(%p, %p): stub:\n", pvarDest, pvarSrc);
    238 
    239         return S_OK;
    240 }
    241 
    242 /***********************************************************************
    243  *           FreePropVariantArray                           [OLE32.195]
     236                   const void *pvarSrc) /* [in] FIXME: const PROPVARIANT * */
     237{
     238    FIXME("(%p, %p): stub:\n", pvarDest, pvarSrc);
     239
     240    return S_OK;
     241}
     242
     243/***********************************************************************
     244 *           FreePropVariantArray               [OLE32.195]
    244245 */
    245246HRESULT WINAPI FreePropVariantArray(ULONG cVariants, /* [in] */
    246                                     void *rgvars)    /* [in/out] FIXME: PROPVARIANT * */
    247 {
    248         FIXME("(%lu, %p): stub:\n", cVariants, rgvars);
    249 
    250         return S_OK;
     247                    void *rgvars)    /* [in/out] FIXME: PROPVARIANT * */
     248{
     249    FIXME("(%lu, %p): stub:\n", cVariants, rgvars);
     250
     251    return S_OK;
    251252}
    252253
  • trunk/src/ole32/ole32_main.c

    r5602 r6648  
     1/* $Id: ole32_main.c,v 1.2 2001-09-05 13:17:11 bird Exp $ */
    12/*
    23 *  OLE32 Initialization
     
    1617
    1718/***********************************************************************
    18  *              DllEntryPoint (OLE32.@)
     19 *      DllEntryPoint (OLE32.@)
    1920 */
    2021
     
    2627    case DLL_PROCESS_ATTACH:
    2728        OLE32_hInstance = hinstDLL;
    28         break;
     29    break;
    2930
    3031    case DLL_PROCESS_DETACH:
    3132        OLE32_hInstance = 0;
    32         break;
     33    break;
    3334    }
    3435    return TRUE;
     
    3637
    3738/***********************************************************************
    38  *              DllRegisterServer (OLE32.@)
     39 *      DllRegisterServer (OLE32.@)
    3940 */
    4041HRESULT WINAPI OLE32_DllRegisterServer() {
  • trunk/src/ole32/oleobj.c

    r5602 r6648  
     1/* $Id: oleobj.c,v 1.2 2001-09-05 13:17:11 bird Exp $ */
    12/*
    2  *      OLE2 COM objects
     3 *  OLE2 COM objects
    34 *
    4  *      Copyright 1998 Eric Kohl
     5 *  Copyright 1998 Eric Kohl
    56 *      Copyright 1999 Francis Beaudet
    67 */
     
    7172
    7273  lpoah= (OleAdviseHolderImpl*)HeapAlloc(GetProcessHeap(),
    73                                         0,
    74                                         sizeof(OleAdviseHolderImpl));
    75  
     74                    0,
     75                    sizeof(OleAdviseHolderImpl));
     76
    7677  ICOM_VTBL(lpoah) = &oahvt;
    7778  lpoah->ref = 1;
    7879  lpoah->maxSinks = INITIAL_SINKS;
    7980  lpoah->arrayOfSinks = HeapAlloc(GetProcessHeap(),
    80                                   0,
    81                                   lpoah->maxSinks * sizeof(IAdviseSink*));
     81                  0,
     82                  lpoah->maxSinks * sizeof(IAdviseSink*));
    8283
    8384  for (index = 0; index < lpoah->maxSinks; index++)
     
    105106    }
    106107  }
    107  
     108
    108109  HeapFree(GetProcessHeap(),
    109            0,
    110            ptrToDestroy->arrayOfSinks);
    111  
     110       0,
     111       ptrToDestroy->arrayOfSinks);
     112
    112113
    113114  HeapFree(GetProcessHeap(),
    114            0,
    115            ptrToDestroy);
     115       0,
     116       ptrToDestroy);
    116117}
    117118
     
    121122static HRESULT WINAPI OleAdviseHolderImpl_QueryInterface(
    122123  LPOLEADVISEHOLDER iface,
    123   REFIID            riid, 
     124  REFIID            riid,
    124125  LPVOID*           ppvObj)
    125126{
    126   ICOM_THIS(OleAdviseHolderImpl, iface); 
     127  ICOM_THIS(OleAdviseHolderImpl, iface);
    127128  TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObj);
    128129  /*
     
    134135  *ppvObj = NULL;
    135136
    136   if (IsEqualIID(riid, &IID_IUnknown)) 
     137  if (IsEqualIID(riid, &IID_IUnknown))
    137138  {
    138139    /* IUnknown */
    139     *ppvObj = This; 
    140   }
    141   else if(IsEqualIID(riid, &IID_IOleAdviseHolder)) 
     140    *ppvObj = This;
     141  }
     142  else if(IsEqualIID(riid, &IID_IOleAdviseHolder))
    142143  {
    143144    /* IOleAdviseHolder */
     
    147148  if(*ppvObj == NULL)
    148149    return E_NOINTERFACE;
    149  
     150
    150151  /*
    151152   * A successful QI always increments the reference count.
     
    162163  LPOLEADVISEHOLDER iface)
    163164{
    164   ICOM_THIS(OleAdviseHolderImpl, iface); 
    165   TRACE("(%p)->(ref=%ld)\n", This, This->ref); 
     165  ICOM_THIS(OleAdviseHolderImpl, iface);
     166  TRACE("(%p)->(ref=%ld)\n", This, This->ref);
    166167  return ++(This->ref);
    167168}
     
    173174  LPOLEADVISEHOLDER iface)
    174175{
    175   ICOM_THIS(OleAdviseHolderImpl, iface); 
    176   TRACE("(%p)->(ref=%ld)\n", This, This->ref); 
     176  ICOM_THIS(OleAdviseHolderImpl, iface);
     177  TRACE("(%p)->(ref=%ld)\n", This, This->ref);
    177178  This->ref--;
    178179
     
    196197{
    197198  DWORD index;
    198  
    199   ICOM_THIS(OleAdviseHolderImpl, iface); 
     199
     200  ICOM_THIS(OleAdviseHolderImpl, iface);
    200201
    201202  TRACE("(%p)->(%p, %p)\n", This, pAdvise, pdwConnection);
     
    206207  if (pdwConnection==NULL)
    207208    return E_POINTER;
    208  
     209
    209210  *pdwConnection = 0;
    210211
     
    227228    This->maxSinks+=INITIAL_SINKS;
    228229
    229     This->arrayOfSinks = HeapReAlloc(GetProcessHeap(), 
    230                                      0,
    231                                      This->arrayOfSinks,
    232                                      This->maxSinks*sizeof(IAdviseSink*));
     230    This->arrayOfSinks = HeapReAlloc(GetProcessHeap(),
     231                     0,
     232                     This->arrayOfSinks,
     233                     This->maxSinks*sizeof(IAdviseSink*));
    233234
    234235    for (i=index;i < This->maxSinks; i++)
    235       This->arrayOfSinks[i]=0;     
     236      This->arrayOfSinks[i]=0;
    236237  }
    237238
     
    258259 */
    259260static HRESULT WINAPI OleAdviseHolderImpl_Unadvise(
    260   LPOLEADVISEHOLDER iface, 
     261  LPOLEADVISEHOLDER iface,
    261262  DWORD             dwConnection)
    262263{
    263   ICOM_THIS(OleAdviseHolderImpl, iface); 
     264  ICOM_THIS(OleAdviseHolderImpl, iface);
    264265
    265266  TRACE("(%p)->(%lu)\n", This, dwConnection);
    266267
    267268  /*
    268    * So we don't return 0 as a cookie, the index was 
     269   * So we don't return 0 as a cookie, the index was
    269270   * incremented by 1 in OleAdviseHolderImpl_Advise
    270271   * we have to compensate.
    271272   */
    272273  dwConnection--;
    273  
     274
    274275  /*
    275276   * Check for invalid cookies.
    276277   */
    277   if ( (dwConnection < 0) || 
     278  if ( (dwConnection < 0) ||
    278279       (dwConnection >= This->maxSinks) )
    279280    return OLE_E_NOCONNECTION;
     
    297298OleAdviseHolderImpl_EnumAdvise (LPOLEADVISEHOLDER iface, IEnumSTATDATA **ppenumAdvise)
    298299{
    299     ICOM_THIS(OleAdviseHolderImpl, iface); 
     300    ICOM_THIS(OleAdviseHolderImpl, iface);
    300301    FIXME("(%p)->(%p)\n", This, ppenumAdvise);
    301302
     
    311312OleAdviseHolderImpl_SendOnRename (LPOLEADVISEHOLDER iface, IMoniker *pmk)
    312313{
    313     ICOM_THIS(OleAdviseHolderImpl, iface); 
     314    ICOM_THIS(OleAdviseHolderImpl, iface);
    314315    FIXME("(%p)->(%p)\n", This, pmk);
    315316
     
    324325OleAdviseHolderImpl_SendOnSave (LPOLEADVISEHOLDER iface)
    325326{
    326     ICOM_THIS(OleAdviseHolderImpl, iface); 
     327    ICOM_THIS(OleAdviseHolderImpl, iface);
    327328    FIXME("(%p)\n", This);
    328329
     
    336337OleAdviseHolderImpl_SendOnClose (LPOLEADVISEHOLDER iface)
    337338{
    338     ICOM_THIS(OleAdviseHolderImpl, iface); 
     339    ICOM_THIS(OleAdviseHolderImpl, iface);
    339340    FIXME("(%p)\n", This);
    340341
     
    350351  FORMATETC fmat;
    351352  DWORD advf;
    352 } DataAdviseConnection; 
     353} DataAdviseConnection;
    353354
    354355typedef struct DataAdviseHolder
     
    367368static void               DataAdviseHolder_Destructor(DataAdviseHolder* ptrToDestroy);
    368369static HRESULT WINAPI     DataAdviseHolder_QueryInterface(
    369                             IDataAdviseHolder*      iface,
    370                             REFIID                  riid,
    371                             void**                  ppvObject);
    372 static ULONG WINAPI       DataAdviseHolder_AddRef( 
     370                IDataAdviseHolder*      iface,
     371                REFIID                  riid,
     372                void**                  ppvObject);
     373static ULONG WINAPI       DataAdviseHolder_AddRef(
    373374                            IDataAdviseHolder*      iface);
    374 static ULONG WINAPI       DataAdviseHolder_Release( 
     375static ULONG WINAPI       DataAdviseHolder_Release(
    375376                            IDataAdviseHolder*      iface);
    376 static HRESULT WINAPI     DataAdviseHolder_Advise( 
     377static HRESULT WINAPI     DataAdviseHolder_Advise(
    377378                            IDataAdviseHolder*      iface,
    378                             IDataObject*            pDataObject,
    379                             FORMATETC*              pFetc,
    380                             DWORD                   advf,
    381                             IAdviseSink*            pAdvise,
    382                             DWORD*                  pdwConnection);
    383 static HRESULT WINAPI     DataAdviseHolder_Unadvise( 
     379                IDataObject*            pDataObject,
     380                FORMATETC*              pFetc,
     381                DWORD                   advf,
     382                IAdviseSink*            pAdvise,
     383                DWORD*                  pdwConnection);
     384static HRESULT WINAPI     DataAdviseHolder_Unadvise(
    384385                            IDataAdviseHolder*      iface,
    385                             DWORD                   dwConnection);
    386 static HRESULT WINAPI     DataAdviseHolder_EnumAdvise( 
    387                             IDataAdviseHolder*      iface,       
    388                             IEnumSTATDATA**         ppenumAdvise);
    389 static HRESULT WINAPI     DataAdviseHolder_SendOnDataChange( 
    390                             IDataAdviseHolder*      iface, 
    391                             IDataObject*            pDataObject,
    392                             DWORD                   dwReserved,
    393                             DWORD                   advf);
     386                DWORD                   dwConnection);
     387static HRESULT WINAPI     DataAdviseHolder_EnumAdvise(
     388                            IDataAdviseHolder*      iface,
     389                IEnumSTATDATA**         ppenumAdvise);
     390static HRESULT WINAPI     DataAdviseHolder_SendOnDataChange(
     391                            IDataAdviseHolder*      iface,
     392                IDataObject*            pDataObject,
     393                DWORD                   dwReserved,
     394                DWORD                   advf);
    394395
    395396/**************************************************************************
     
    416417
    417418  newHolder = (DataAdviseHolder*)HeapAlloc(GetProcessHeap(),
    418                                            0,
    419                                            sizeof(DataAdviseHolder));
    420  
     419                       0,
     420                       sizeof(DataAdviseHolder));
     421
    421422  ICOM_VTBL(newHolder) = &DataAdviseHolderImpl_VTable;
    422423  newHolder->ref = 1;
    423424  newHolder->maxCons = INITIAL_SINKS;
    424425  newHolder->Connections = HeapAlloc(GetProcessHeap(),
    425                                      HEAP_ZERO_MEMORY,
    426                                      newHolder->maxCons *
    427                                      sizeof(DataAdviseConnection));
     426                     HEAP_ZERO_MEMORY,
     427                     newHolder->maxCons *
     428                     sizeof(DataAdviseConnection));
    428429
    429430  TRACE("returning %p\n", newHolder);
     
    447448    }
    448449  }
    449  
     450
    450451  HeapFree(GetProcessHeap(), 0, ptrToDestroy->Connections);
    451452  HeapFree(GetProcessHeap(), 0, ptrToDestroy);
     
    462463  void**                  ppvObject)
    463464{
    464   ICOM_THIS(DataAdviseHolder, iface); 
     465  ICOM_THIS(DataAdviseHolder, iface);
    465466  TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject);
    466467  /*
     
    469470  if ( (This==0) || (ppvObject==0) )
    470471    return E_INVALIDARG;
    471  
     472
    472473  /*
    473474   * Initialize the return parameter.
     
    483484    *ppvObject = iface;
    484485  }
    485  
     486
    486487  /*
    487488   * Check that we obtained an interface.
     
    491492    return E_NOINTERFACE;
    492493  }
    493  
     494
    494495  /*
    495496   * Query Interface always increases the reference count by one when it is
    496    * successful. 
     497   * successful.
    497498   */
    498499  IUnknown_AddRef((IUnknown*)*ppvObject);
    499500
    500   return S_OK;; 
     501  return S_OK;;
    501502}
    502503
     
    506507 * See Windows documentation for more details on IUnknown methods.
    507508 */
    508 static ULONG WINAPI       DataAdviseHolder_AddRef(                             
     509static ULONG WINAPI       DataAdviseHolder_AddRef(
    509510  IDataAdviseHolder*      iface)
    510511{
    511   ICOM_THIS(DataAdviseHolder, iface); 
     512  ICOM_THIS(DataAdviseHolder, iface);
    512513  TRACE("(%p) (ref=%ld)\n", This, This->ref);
    513514  This->ref++;
     
    521522 * See Windows documentation for more details on IUnknown methods.
    522523 */
    523 static ULONG WINAPI DataAdviseHolder_Release( 
     524static ULONG WINAPI DataAdviseHolder_Release(
    524525  IDataAdviseHolder*      iface)
    525526{
     
    541542    return 0;
    542543  }
    543  
     544
    544545  return This->ref;
    545546}
     
    551552static HRESULT WINAPI DataAdviseHolder_Advise(
    552553  IDataAdviseHolder*      iface,
    553   IDataObject*            pDataObject, 
    554   FORMATETC*              pFetc, 
    555   DWORD                   advf, 
    556   IAdviseSink*            pAdvise, 
     554  IDataObject*            pDataObject,
     555  FORMATETC*              pFetc,
     556  DWORD                   advf,
     557  IAdviseSink*            pAdvise,
    557558  DWORD*                  pdwConnection)
    558559{
    559560  DWORD index;
    560  
    561   ICOM_THIS(DataAdviseHolder, iface); 
     561
     562  ICOM_THIS(DataAdviseHolder, iface);
    562563
    563564  TRACE("(%p)->(%p, %p, %08lx, %p, %p)\n", This, pDataObject, pFetc, advf,
    564         pAdvise, pdwConnection);
     565    pAdvise, pdwConnection);
    565566  /*
    566567   * Sanity check
     
    568569  if (pdwConnection==NULL)
    569570    return E_POINTER;
    570  
     571
    571572  *pdwConnection = 0;
    572573
     
    587588    This->maxCons+=INITIAL_SINKS;
    588589    This->Connections = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
    589                                     This->Connections,
    590                                     This->maxCons*sizeof(DataAdviseConnection));
     590                    This->Connections,
     591                    This->maxCons*sizeof(DataAdviseConnection));
    591592  }
    592593  /*
     
    616617 * DataAdviseHolder_Unadvise
    617618 */
    618 static HRESULT WINAPI     DataAdviseHolder_Unadvise( 
     619static HRESULT WINAPI     DataAdviseHolder_Unadvise(
    619620  IDataAdviseHolder*      iface,
    620621  DWORD                   dwConnection)
    621622{
    622   ICOM_THIS(DataAdviseHolder, iface); 
     623  ICOM_THIS(DataAdviseHolder, iface);
    623624
    624625  TRACE("(%p)->(%lu)\n", This, dwConnection);
    625626
    626627  /*
    627    * So we don't return 0 as a cookie, the index was 
     628   * So we don't return 0 as a cookie, the index was
    628629   * incremented by 1 in OleAdviseHolderImpl_Advise
    629630   * we have to compensate.
    630631   */
    631632  dwConnection--;
    632  
     633
    633634  /*
    634635   * Check for invalid cookies.
    635636   */
    636   if ( (dwConnection < 0) || 
     637  if ( (dwConnection < 0) ||
    637638       (dwConnection >= This->maxCons) )
    638639    return OLE_E_NOCONNECTION;
     
    649650}
    650651
    651 static HRESULT WINAPI     DataAdviseHolder_EnumAdvise( 
    652   IDataAdviseHolder*      iface,       
     652static HRESULT WINAPI     DataAdviseHolder_EnumAdvise(
     653  IDataAdviseHolder*      iface,
    653654  IEnumSTATDATA**         ppenumAdvise)
    654655{
    655   ICOM_THIS(DataAdviseHolder, iface); 
     656  ICOM_THIS(DataAdviseHolder, iface);
    656657
    657658  FIXME("(%p)->(%p)\n", This, ppenumAdvise);
     
    662663 * DataAdviseHolder_SendOnDataChange
    663664 */
    664 static HRESULT WINAPI     DataAdviseHolder_SendOnDataChange( 
    665   IDataAdviseHolder*      iface, 
    666   IDataObject*            pDataObject, 
    667   DWORD                   dwReserved, 
     665static HRESULT WINAPI     DataAdviseHolder_SendOnDataChange(
     666  IDataAdviseHolder*      iface,
     667  IDataObject*            pDataObject,
     668  DWORD                   dwReserved,
    668669  DWORD                   advf)
    669670{
    670   ICOM_THIS(DataAdviseHolder, iface); 
     671  ICOM_THIS(DataAdviseHolder, iface);
    671672  DWORD index;
    672673  STGMEDIUM stg;
     
    678679    if(This->Connections[index].sink != NULL) {
    679680      if(!(This->Connections[index].advf & ADVF_NODATA)) {
    680         TRACE("Calling IDataObject_GetData\n");
    681         res = IDataObject_GetData(pDataObject,
    682                                   &(This->Connections[index].fmat),
    683                                   &stg);
    684         TRACE("returns %08lx\n", res);
     681    TRACE("Calling IDataObject_GetData\n");
     682    res = IDataObject_GetData(pDataObject,
     683                  &(This->Connections[index].fmat),
     684                  &stg);
     685    TRACE("returns %08lx\n", res);
    685686      }
    686687      TRACE("Calling IAdviseSink_OnDataChange\n");
    687688      IAdviseSink_OnDataChange(This->Connections[index].sink,
    688                                      &(This->Connections[index].fmat),
    689                                      &stg);
     689                     &(This->Connections[index].fmat),
     690                     &stg);
    690691      TRACE("Done IAdviseSink_OnDataChange\n");
    691692      if(This->Connections[index].advf & ADVF_ONLYONCE) {
    692         TRACE("Removing connection\n");
    693         DataAdviseHolder_Unadvise(iface, index+1);
     693    TRACE("Removing connection\n");
     694    DataAdviseHolder_Unadvise(iface, index+1);
    694695      }
    695696    }
  • trunk/src/ole32/stg_bigblockfile.c

    r5602 r6648  
     1/* $Id: stg_bigblockfile.c,v 1.3 2001-09-05 13:17:12 bird Exp $ */
    12/******************************************************************************
    23 *
    34 * BigBlockFile
    45 *
    5  * This is the implementation of a file that consists of blocks of 
     6 * This is the implementation of a file that consists of blocks of
    67 * a predetermined size.
    7  * This class is used in the Compound File implementation of the 
    8  * IStorage and IStream interfaces. It provides the functionality 
    9  * to read and write any blocks in the file as well as setting and 
     8 * This class is used in the Compound File implementation of the
     9 * IStorage and IStream interfaces. It provides the functionality
     10 * to read and write any blocks in the file as well as setting and
    1011 * obtaining the size of the file.
    1112 * The blocks are indexed sequentially from the start of the file
    1213 * starting with -1.
    13  * 
     14 *
    1415 * TODO:
    1516 * - Support for a transacted mode
     
    6970/***
    7071 * This structure identifies the paged that are mapped
    71  * from the file and their position in memory. It is 
     72 * from the file and their position in memory. It is
    7273 * also used to hold a reference count to those pages.
    7374 *
     
    102103                                                 ULONG          index,
    103104                                                 DWORD          desired_access);
    104 static MappedPage* BIGBLOCKFILE_GetPageFromPointer(LPBIGBLOCKFILE This, 
    105                                                    void*         pBlock);
     105static MappedPage* BIGBLOCKFILE_GetPageFromPointer(LPBIGBLOCKFILE This,
     106                           void*         pBlock);
    106107static MappedPage* BIGBLOCKFILE_CreatePage(LPBIGBLOCKFILE This,
    107                                            ULONG page_index);
     108                       ULONG page_index);
    108109static DWORD     BIGBLOCKFILE_GetProtectMode(DWORD openFlags);
    109110static BOOL      BIGBLOCKFILE_FileInit(LPBIGBLOCKFILE This, HANDLE hFile);
     
    118119 */
    119120static inline BOOL BIGBLOCKFILE_TestBit(const BlockBits *bb,
    120                                         unsigned int index)
     121                    unsigned int index)
    121122{
    122123    unsigned int array_index = index / (CHAR_BIT * sizeof(unsigned int));
     
    150151 *      BIGBLOCKFILE_Construct
    151152 *
    152  * Construct a big block file. Create the file mapping object. 
     153 * Construct a big block file. Create the file mapping object.
    153154 * Create the read only mapped pages list, the writable mapped page list
    154155 * and the blocks in use list.
     
    230231
    231232  This->filesize.s.LowPart = GetFileSize(This->hfile,
    232                                         &This->filesize.s.HighPart);
     233                    &This->filesize.s.HighPart);
    233234
    234235  This->maplist = NULL;
     
    323324  /*
    324325   * validate the block index
    325    * 
     326   *
    326327   */
    327328  if (This->blocksize * (index + 1)
     
    329330  {
    330331    TRACE("out of range %lu vs %lu\n", This->blocksize * (index + 1),
    331           This->filesize.s.LowPart);
     332      This->filesize.s.LowPart);
    332333    return NULL;
    333334  }
     
    379380
    380381    if (pBlock == NULL)
    381         return;
     382    return;
    382383
    383384    page = BIGBLOCKFILE_GetPageFromPointer(This, pBlock);
    384385
    385386    if (page == NULL)
    386         return;
     387    return;
    387388
    388389    BIGBLOCKFILE_ReleaseMappedPage(This, page);
     
    393394 *
    394395 * Sets the size of the file.
    395  * 
     396 *
    396397 */
    397398void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize)
     
    405406   */
    406407  BIGBLOCKFILE_UnmapAllMappedPages(This);
    407  
     408
    408409  if (This->fileBased)
    409410  {
     
    423424     *
    424425     * The problem is that the SetFilePointer-SetEndOfFile combo below
    425      * doesn't always succeed. The file is not grown. It seems like the 
     426     * doesn't always succeed. The file is not grown. It seems like the
    426427     * operation is cached. By doing the WriteFile, the file is actually
    427428     * grown on disk.
     
    432433    WriteFile(This->hfile, buf, 10, NULL, NULL);
    433434    /*
    434      * END HACK 
     435     * END HACK
    435436     */
    436437
     
    440441    SetFilePointer(This->hfile, newSize.s.LowPart, NULL, FILE_BEGIN);
    441442    SetEndOfFile(This->hfile);
    442  
     443
    443444    /*
    444445     * re-create the file mapping object
     
    447448                                        NULL,
    448449                                        This->flProtect,
    449                                         0, 0, 
     450                                        0, 0,
    450451                                        NULL);
    451452  }
     
    476477 *
    477478 * Returns the size of the file.
    478  * 
     479 *
    479480 */
    480481ULARGE_INTEGER BIGBLOCKFILE_GetSize(LPBIGBLOCKFILE This)
     
    489490 */
    490491static BOOL BIGBLOCKFILE_AccessCheck(MappedPage *page, ULONG block_index,
    491                                      DWORD desired_access)
     492                     DWORD desired_access)
    492493{
    493494    assert(block_index < BLOCKS_PER_PAGE);
     
    495496    if (desired_access == FILE_MAP_READ)
    496497    {
    497         if (BIGBLOCKFILE_TestBit(&page->writable_blocks, block_index))
    498             return FALSE;
    499 
    500         BIGBLOCKFILE_SetBit(&page->readable_blocks, block_index);
     498    if (BIGBLOCKFILE_TestBit(&page->writable_blocks, block_index))
     499        return FALSE;
     500
     501    BIGBLOCKFILE_SetBit(&page->readable_blocks, block_index);
    501502    }
    502503    else
    503504    {
    504         assert(desired_access == FILE_MAP_WRITE);
    505 
    506         if (BIGBLOCKFILE_TestBit(&page->readable_blocks, block_index))
    507             return FALSE;
    508 
    509         BIGBLOCKFILE_SetBit(&page->writable_blocks, block_index);
     505    assert(desired_access == FILE_MAP_WRITE);
     506
     507    if (BIGBLOCKFILE_TestBit(&page->readable_blocks, block_index))
     508        return FALSE;
     509
     510    BIGBLOCKFILE_SetBit(&page->writable_blocks, block_index);
    510511    }
    511512
     
    519520 */
    520521static void* BIGBLOCKFILE_GetBigBlockPointer(
    521   LPBIGBLOCKFILE This, 
    522   ULONG          block_index, 
     522  LPBIGBLOCKFILE This,
     523  ULONG          block_index,
    523524  DWORD          desired_access)
    524525{
     
    531532    if (!BIGBLOCKFILE_AccessCheck(page, block_on_page, desired_access))
    532533    {
    533         BIGBLOCKFILE_ReleaseMappedPage(This, page);
    534         return NULL;
     534    BIGBLOCKFILE_ReleaseMappedPage(This, page);
     535    return NULL;
    535536    }
    536537
     
    547548 */
    548549static MappedPage *BIGBLOCKFILE_GetPageFromPointer(LPBIGBLOCKFILE This,
    549                                                    void *pBlock)
     550                           void *pBlock)
    550551{
    551552    MappedPage *page;
     
    553554    for (page = This->maplist; page != NULL; page = page->next)
    554555    {
    555         if ((LPBYTE)pBlock >= (LPBYTE)page->lpBytes
    556             && (LPBYTE)pBlock <= (LPBYTE)page->lpBytes + PAGE_SIZE)
    557             break;
     556    if ((LPBYTE)pBlock >= (LPBYTE)page->lpBytes
     557        && (LPBYTE)pBlock <= (LPBYTE)page->lpBytes + PAGE_SIZE)
     558        break;
    558559
    559560    }
     
    567568 */
    568569static MappedPage *BIGBLOCKFILE_FindPageInList(MappedPage *head,
    569                                                ULONG page_index)
     570                           ULONG page_index)
    570571{
    571572    for (; head != NULL; head = head->next)
    572573    {
    573         if (head->page_index == page_index)
    574         {
    575             InterlockedIncrement(&head->refcnt);
    576             break;
    577         }
     574    if (head->page_index == page_index)
     575    {
     576        InterlockedIncrement(&head->refcnt);
     577        break;
     578    }
    578579    }
    579580
     
    611612    if (!page)
    612613    {
    613         page = BIGBLOCKFILE_FindPageInList(This->victimhead, page_index);
    614         if (page)
    615         {
    616             This->num_victim_pages--;
    617 
    618             BIGBLOCKFILE_Zero(&page->readable_blocks);
    619             BIGBLOCKFILE_Zero(&page->writable_blocks);
    620         }
    621     }
    622 
     614    page = BIGBLOCKFILE_FindPageInList(This->victimhead, page_index);
    623615    if (page)
    624616    {
    625         /* If the page is not already at the head of the list, move
    626          * it there. (Also moves pages from victim to main list.) */
    627         if (This->maplist != page)
    628         {
    629             if (This->victimhead == page) This->victimhead = page->next;
    630             if (This->victimtail == page) This->victimtail = page->prev;
    631 
    632             BIGBLOCKFILE_UnlinkPage(page);
    633 
    634             BIGBLOCKFILE_LinkHeadPage(&This->maplist, page);
    635         }
    636 
    637         return page;
     617        This->num_victim_pages--;
     618
     619        BIGBLOCKFILE_Zero(&page->readable_blocks);
     620        BIGBLOCKFILE_Zero(&page->writable_blocks);
     621    }
     622    }
     623
     624    if (page)
     625    {
     626    /* If the page is not already at the head of the list, move
     627     * it there. (Also moves pages from victim to main list.) */
     628    if (This->maplist != page)
     629    {
     630        if (This->victimhead == page) This->victimhead = page->next;
     631        if (This->victimtail == page) This->victimtail = page->prev;
     632
     633        BIGBLOCKFILE_UnlinkPage(page);
     634
     635        BIGBLOCKFILE_LinkHeadPage(&This->maplist, page);
     636    }
     637
     638    return page;
    638639    }
    639640
     
    652653    if (This->fileBased)
    653654    {
    654         DWORD numBytesToMap;
    655         DWORD desired_access;
    656 
    657         if (lowoffset + PAGE_SIZE > This->filesize.s.LowPart)
    658             numBytesToMap = This->filesize.s.LowPart - lowoffset;
    659         else
    660             numBytesToMap = PAGE_SIZE;
    661 
    662         if (This->flProtect == PAGE_READONLY)
    663             desired_access = FILE_MAP_READ;
    664         else
    665             desired_access = FILE_MAP_WRITE;
    666 
    667         page->lpBytes = MapViewOfFile(This->hfilemap, desired_access, 0,
    668                                       lowoffset, numBytesToMap);
    669     }
     655    DWORD numBytesToMap;
     656    DWORD desired_access;
     657
     658    if (lowoffset + PAGE_SIZE > This->filesize.s.LowPart)
     659        numBytesToMap = This->filesize.s.LowPart - lowoffset;
    670660    else
    671     {
    672         page->lpBytes = (LPBYTE)This->pbytearray + lowoffset;
     661        numBytesToMap = PAGE_SIZE;
     662
     663    if (This->flProtect == PAGE_READONLY)
     664        desired_access = FILE_MAP_READ;
     665    else
     666        desired_access = FILE_MAP_WRITE;
     667
     668    page->lpBytes = MapViewOfFile(This->hfilemap, desired_access, 0,
     669                      lowoffset, numBytesToMap);
     670    }
     671    else
     672    {
     673    page->lpBytes = (LPBYTE)This->pbytearray + lowoffset;
    673674    }
    674675
     
    679680
    680681static MappedPage *BIGBLOCKFILE_CreatePage(LPBIGBLOCKFILE This,
    681                                            ULONG page_index)
     682                       ULONG page_index)
    682683{
    683684    MappedPage *page;
     
    705706    TRACE("%ld at %p\n", page->page_index, page->lpBytes);
    706707    if (page->refcnt > 0)
    707         ERR("unmapping inuse page %p\n", page->lpBytes);
     708    ERR("unmapping inuse page %p\n", page->lpBytes);
    708709
    709710    if (This->fileBased && page->lpBytes)
    710         UnmapViewOfFile(page->lpBytes);
     711    UnmapViewOfFile(page->lpBytes);
    711712
    712713    page->lpBytes = NULL;
     
    736737    if (!InterlockedDecrement(&page->refcnt))
    737738    {
    738         if (This->maplist == page) This->maplist = page->next;
    739 
    740         BIGBLOCKFILE_UnlinkPage(page);
    741 
    742         if (MAX_VICTIM_PAGES > 0)
    743         {
    744             if (This->num_victim_pages >= MAX_VICTIM_PAGES)
    745             {
    746                 MappedPage *victim = This->victimtail;
    747                 if (victim)
    748                 {
    749                     This->victimtail = victim->prev;
    750                     if (This->victimhead == victim)
    751                         This->victimhead = victim->next;
    752 
    753                     BIGBLOCKFILE_UnlinkPage(victim);
    754                     BIGBLOCKFILE_DeletePage(This, victim);
    755                 }
    756             }
    757             else This->num_victim_pages++;
    758 
    759             BIGBLOCKFILE_LinkHeadPage(&This->victimhead, page);
    760             if (This->victimtail == NULL) This->victimtail = page;
    761         }
    762         else
    763             BIGBLOCKFILE_DeletePage(This, page);
     739    if (This->maplist == page) This->maplist = page->next;
     740
     741    BIGBLOCKFILE_UnlinkPage(page);
     742
     743    if (MAX_VICTIM_PAGES > 0)
     744    {
     745        if (This->num_victim_pages >= MAX_VICTIM_PAGES)
     746        {
     747        MappedPage *victim = This->victimtail;
     748        if (victim)
     749        {
     750            This->victimtail = victim->prev;
     751            if (This->victimhead == victim)
     752            This->victimhead = victim->next;
     753
     754            BIGBLOCKFILE_UnlinkPage(victim);
     755            BIGBLOCKFILE_DeletePage(This, victim);
     756        }
     757        }
     758        else This->num_victim_pages++;
     759
     760        BIGBLOCKFILE_LinkHeadPage(&This->victimhead, page);
     761        if (This->victimtail == NULL) This->victimtail = page;
     762    }
     763    else
     764        BIGBLOCKFILE_DeletePage(This, page);
    764765    }
    765766}
     
    769770    while (list != NULL)
    770771    {
    771         MappedPage *next = list->next;
    772 
    773         BIGBLOCKFILE_DeletePage(This, list);
    774 
    775         list = next;
     772    MappedPage *next = list->next;
     773
     774    BIGBLOCKFILE_DeletePage(This, list);
     775
     776    list = next;
    776777    }
    777778}
     
    799800    for (; list != NULL; list = list->next)
    800801    {
    801         BIGBLOCKFILE_UnmapPage(This, list);
     802    BIGBLOCKFILE_UnmapPage(This, list);
    802803    }
    803804}
     
    813814    while (list != NULL)
    814815    {
    815         MappedPage *next = list->next;
    816 
    817         if (list->page_index * PAGE_SIZE > This->filesize.s.LowPart)
    818         {
    819             TRACE("discarding %lu\n", list->page_index);
    820 
    821             /* page is entirely outside of the file, delete it */
    822             BIGBLOCKFILE_UnlinkPage(list);
    823             BIGBLOCKFILE_DeletePage(This, list);
    824         }
    825         else
    826         {
    827             /* otherwise, remap it */
    828             BIGBLOCKFILE_MapPage(This, list);
    829         }
    830 
    831         list = next;
     816    MappedPage *next = list->next;
     817
     818    if (list->page_index * PAGE_SIZE > This->filesize.s.LowPart)
     819    {
     820        TRACE("discarding %lu\n", list->page_index);
     821
     822        /* page is entirely outside of the file, delete it */
     823        BIGBLOCKFILE_UnlinkPage(list);
     824        BIGBLOCKFILE_DeletePage(This, list);
     825    }
     826    else
     827    {
     828        /* otherwise, remap it */
     829        BIGBLOCKFILE_MapPage(This, list);
     830    }
     831
     832    list = next;
    832833    }
    833834}
     
    848849{
    849850    if (openFlags & (STGM_WRITE | STGM_READWRITE))
    850         return PAGE_READWRITE;
     851    return PAGE_READWRITE;
    851852    else
    852         return PAGE_READONLY;
    853 }
     853    return PAGE_READONLY;
     854}
  • trunk/src/ole32/stg_stream.c

    r5602 r6648  
     1/* $Id: stg_stream.c,v 1.3 2001-09-05 13:17:12 bird Exp $ */
    12/*
    23 * Compound Storage (32 bit version)
     
    6566 */
    6667StgStreamImpl* StgStreamImpl_Construct(
    67                 StorageBaseImpl* parentStorage,
     68        StorageBaseImpl* parentStorage,
    6869    DWORD            grfMode,
    6970    ULONG            ownerProperty)
     
    7273
    7374  newStream = HeapAlloc(GetProcessHeap(), 0, sizeof(StgStreamImpl));
    74  
     75
    7576  if (newStream!=0)
    7677  {
     
    8081    ICOM_VTBL(newStream) = &StgStreamImpl_Vtbl;
    8182    newStream->ref       = 0;
    82    
     83
    8384    /*
    8485     * We want to nail-down the reference to the storage in case the
     
    8889    IStorage_AddRef((IStorage*)newStream->parentStorage);
    8990
    90     newStream->grfMode = grfMode;   
     91    newStream->grfMode = grfMode;
    9192    newStream->ownerProperty = ownerProperty;
    92    
     93
    9394    /*
    9495     * Start the stream at the begining.
     
    9697    newStream->currentPosition.s.HighPart = 0;
    9798    newStream->currentPosition.s.LowPart = 0;
    98    
     99
    99100    /*
    100101     * Initialize the rest of the data.
     
    104105    newStream->bigBlockChain       = 0;
    105106    newStream->smallBlockChain     = 0;
    106    
     107
    107108    /*
    108109     * Read the size from the property and determine if the blocks forming
     
    111112    StgStreamImpl_OpenBlockChain(newStream);
    112113  }
    113  
     114
    114115  return newStream;
    115116}
     
    118119 * This is the destructor of the StgStreamImpl class.
    119120 *
    120  * This method will clean-up all the resources used-up by the given StgStreamImpl 
     121 * This method will clean-up all the resources used-up by the given StgStreamImpl
    121122 * class. The pointer passed-in to this function will be freed and will not
    122123 * be valid anymore.
     
    150151   * Finally, free the memory used-up by the class.
    151152   */
    152   HeapFree(GetProcessHeap(), 0, This); 
     153  HeapFree(GetProcessHeap(), 0, This);
    153154}
    154155
     
    158159 */
    159160HRESULT WINAPI StgStreamImpl_QueryInterface(
    160                   IStream*     iface,
    161                   REFIID         riid,        /* [in] */         
    162                   void**         ppvObject)   /* [iid_is][out] */
     161          IStream*     iface,
     162          REFIID         riid,        /* [in] */
     163          void**         ppvObject)   /* [iid_is][out] */
    163164{
    164165  StgStreamImpl* const This=(StgStreamImpl*)iface;
     
    169170  if (ppvObject==0)
    170171    return E_INVALIDARG;
    171  
     172
    172173  /*
    173174   * Initialize the return parameter.
    174175   */
    175176  *ppvObject = 0;
    176  
     177
    177178  /*
    178179   * Compare the riid with the interface IDs implemented by this object.
    179180   */
    180   if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 
     181  if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
    181182  {
    182183    *ppvObject = (IStream*)This;
    183184  }
    184   else if (memcmp(&IID_IStream, riid, sizeof(IID_IStream)) == 0) 
     185  else if (memcmp(&IID_IStream, riid, sizeof(IID_IStream)) == 0)
    185186  {
    186187    *ppvObject = (IStream*)This;
    187188  }
    188  
     189
    189190  /*
    190191   * Check that we obtained an interface.
     
    192193  if ((*ppvObject)==0)
    193194    return E_NOINTERFACE;
    194  
     195
    195196  /*
    196197   * Query Interface always increases the reference count by one when it is
     
    198199   */
    199200  StgStreamImpl_AddRef(iface);
    200  
     201
    201202  return S_OK;;
    202203}
     
    207208 */
    208209ULONG WINAPI StgStreamImpl_AddRef(
    209                 IStream* iface)
     210        IStream* iface)
    210211{
    211212  StgStreamImpl* const This=(StgStreamImpl*)iface;
    212213
    213214  This->ref++;
    214  
     215
    215216  return This->ref;
    216217}
     
    221222 */
    222223ULONG WINAPI StgStreamImpl_Release(
    223                 IStream* iface)
     224        IStream* iface)
    224225{
    225226  StgStreamImpl* const This=(StgStreamImpl*)iface;
    226227
    227228  ULONG newRef;
    228  
     229
    229230  This->ref--;
    230  
     231
    231232  newRef = This->ref;
    232  
     233
    233234  /*
    234235   * If the reference count goes down to 0, perform suicide.
     
    238239    StgStreamImpl_Destroy(This);
    239240  }
    240  
     241
    241242  return newRef;
    242243}
     
    272273   */
    273274  readSucessful = StorageImpl_ReadProperty(This->parentStorage->ancestorStorage,
    274                                              This->ownerProperty,
    275                                              &curProperty);
    276  
     275                         This->ownerProperty,
     276                         &curProperty);
     277
    277278  if (readSucessful)
    278279  {
    279280    This->streamSize = curProperty.size;
    280    
     281
    281282    /*
    282283     * This code supports only streams that are <32 bits in size.
    283284     */
    284285    assert(This->streamSize.s.HighPart == 0);
    285    
     286
    286287    if(curProperty.startingBlock == BLOCK_END_OF_CHAIN)
    287288    {
     
    291292    {
    292293      if ( (This->streamSize.s.HighPart == 0) &&
    293            (This->streamSize.s.LowPart < LIMIT_TO_USE_SMALL_BLOCK) )
     294       (This->streamSize.s.LowPart < LIMIT_TO_USE_SMALL_BLOCK) )
    294295      {
    295         This->smallBlockChain = SmallBlockChainStream_Construct(
    296                                                                 This->parentStorage->ancestorStorage,   
    297                                                                 This->ownerProperty);
     296    This->smallBlockChain = SmallBlockChainStream_Construct(
     297                                This->parentStorage->ancestorStorage,
     298                                This->ownerProperty);
    298299      }
    299300      else
    300301      {
    301         This->bigBlockChain = BlockChainStream_Construct(
    302                                                         This->parentStorage->ancestorStorage,
    303                                                         NULL,
    304                                                         This->ownerProperty);
     302    This->bigBlockChain = BlockChainStream_Construct(
     303                            This->parentStorage->ancestorStorage,
     304                            NULL,
     305                            This->ownerProperty);
    305306      }
    306307    }
     
    317318 * See the documentation of ISequentialStream for more info.
    318319 */
    319 HRESULT WINAPI StgStreamImpl_Read( 
    320                   IStream*     iface,
    321                   void*          pv,        /* [length_is][size_is][out] */
    322                   ULONG          cb,        /* [in] */                     
    323                   ULONG*         pcbRead)   /* [out] */                   
     320HRESULT WINAPI StgStreamImpl_Read(
     321          IStream*     iface,
     322          void*          pv,        /* [length_is][size_is][out] */
     323          ULONG          cb,        /* [in] */
     324          ULONG*         pcbRead)   /* [out] */
    324325{
    325326  StgStreamImpl* const This=(StgStreamImpl*)iface;
     
    329330
    330331  TRACE("(%p, %p, %ld, %p)\n",
    331         iface, pv, cb, pcbRead);
    332 
    333   /* 
     332    iface, pv, cb, pcbRead);
     333
     334  /*
    334335   * If the caller is not interested in the nubmer of bytes read,
    335336   * we use another buffer to avoid "if" statements in the code.
     
    337338  if (pcbRead==0)
    338339    pcbRead = &bytesReadBuffer;
    339  
     340
    340341  /*
    341342   * Using the known size of the stream, calculate the number of bytes
     
    343344   */
    344345  bytesToReadFromBuffer = min( This->streamSize.s.LowPart - This->currentPosition.s.LowPart, cb);
    345  
     346
    346347  /*
    347348   * Depending on the type of chain that was opened when the stream was constructed,
     
    351352  {
    352353    SmallBlockChainStream_ReadAt(This->smallBlockChain,
    353                                 This->currentPosition,
    354                                 bytesToReadFromBuffer,
    355                                 pv,
    356                                 pcbRead);
    357    
     354                This->currentPosition,
     355                bytesToReadFromBuffer,
     356                pv,
     357                pcbRead);
     358
    358359  }
    359360  else if (This->bigBlockChain!=0)
    360361  {
    361362    BlockChainStream_ReadAt(This->bigBlockChain,
    362                             This->currentPosition,
    363                             bytesToReadFromBuffer,
    364                             pv,
    365                             pcbRead);
     363                This->currentPosition,
     364                bytesToReadFromBuffer,
     365                pv,
     366                pcbRead);
    366367  }
    367368  else
     
    386387   */
    387388  This->currentPosition.s.LowPart += *pcbRead;
    388  
     389
    389390  /*
    390391   * The function returns S_OK if the buffer was filled completely
     
    394395  if(*pcbRead == cb)
    395396    return S_OK;
    396  
     397
    397398  return S_FALSE;
    398399}
    399        
     400
    400401/***
    401402 * This method is part of the ISequentialStream interface.
     
    409410 */
    410411HRESULT WINAPI StgStreamImpl_Write(
    411                   IStream*     iface,
    412                   const void*    pv,          /* [size_is][in] */
    413                   ULONG          cb,          /* [in] */         
    414                   ULONG*         pcbWritten)  /* [out] */         
     412              IStream*     iface,
     413          const void*    pv,          /* [size_is][in] */
     414          ULONG          cb,          /* [in] */
     415          ULONG*         pcbWritten)  /* [out] */
    415416{
    416417  StgStreamImpl* const This=(StgStreamImpl*)iface;
     
    420421
    421422  TRACE("(%p, %p, %ld, %p)\n",
    422         iface, pv, cb, pcbWritten);
    423  
     423    iface, pv, cb, pcbWritten);
     424
    424425  /*
    425426   * Do we have permission to write to this stream?
     
    435436  if (pcbWritten == 0)
    436437    pcbWritten = &bytesWritten;
    437  
     438
    438439  /*
    439440   * Initialize the out parameter
     
    450451    newSize.s.LowPart = This->currentPosition.s.LowPart + cb;
    451452  }
    452  
     453
    453454  /*
    454455   * Verify if we need to grow the stream
     
    459460    IStream_SetSize(iface, newSize);
    460461  }
    461  
     462
    462463  /*
    463464   * Depending on the type of chain that was opened when the stream was constructed,
     
    467468  {
    468469    SmallBlockChainStream_WriteAt(This->smallBlockChain,
    469                                   This->currentPosition,
    470                                   cb,
    471                                   pv,
    472                                   pcbWritten);
    473    
     470                  This->currentPosition,
     471                  cb,
     472                  pv,
     473                  pcbWritten);
     474
    474475  }
    475476  else if (This->bigBlockChain!=0)
    476477  {
    477478    BlockChainStream_WriteAt(This->bigBlockChain,
    478                              This->currentPosition,
    479                              cb,
    480                              pv,
    481                              pcbWritten);
     479                 This->currentPosition,
     480                 cb,
     481                 pv,
     482                 pcbWritten);
    482483  }
    483484  else
    484485    assert(FALSE);
    485  
     486
    486487  /*
    487488   * Advance the position pointer for the number of positions written.
    488489   */
    489490  This->currentPosition.s.LowPart += *pcbWritten;
    490  
     491
    491492  return S_OK;
    492493}
     
    499500 *
    500501 * See the documentation of IStream for more info.
    501  */       
    502 HRESULT WINAPI StgStreamImpl_Seek( 
    503                   IStream*      iface,
    504                   LARGE_INTEGER   dlibMove,         /* [in] */
    505                   DWORD           dwOrigin,         /* [in] */
    506                   ULARGE_INTEGER* plibNewPosition) /* [out] */
     502 */
     503HRESULT WINAPI StgStreamImpl_Seek(
     504          IStream*      iface,
     505          LARGE_INTEGER   dlibMove,         /* [in] */
     506          DWORD           dwOrigin,         /* [in] */
     507          ULARGE_INTEGER* plibNewPosition) /* [out] */
    507508{
    508509  StgStreamImpl* const This=(StgStreamImpl*)iface;
     
    511512
    512513  TRACE("(%p, %ld, %ld, %p)\n",
    513         iface, dlibMove.s.LowPart, dwOrigin, plibNewPosition);
    514 
    515   /* 
     514    iface, dlibMove.s.LowPart, dwOrigin, plibNewPosition);
     515
     516  /*
    516517   * The caller is allowed to pass in NULL as the new position return value.
    517518   * If it happens, we assign it to a dynamic variable to avoid special cases
     
    555556      /* ... and subtract with carry */
    556557      if (dlibMove.s.LowPart > plibNewPosition->s.LowPart) {
    557           /* carry needed, This accounts for any underflows at [1]*/
    558           plibNewPosition->s.HighPart -= 1;
     558      /* carry needed, This accounts for any underflows at [1]*/
     559      plibNewPosition->s.HighPart -= 1;
    559560      }
    560561      plibNewPosition->s.LowPart -= dlibMove.s.LowPart; /* [1] */
    561       plibNewPosition->s.HighPart -= dlibMove.s.HighPart; 
     562      plibNewPosition->s.HighPart -= dlibMove.s.HighPart;
    562563  } else {
    563564      /* add directly */
     
    565566      plibNewPosition->s.LowPart += dlibMove.s.LowPart;
    566567      if((plibNewPosition->s.LowPart < initialLowPart) ||
    567         (plibNewPosition->s.LowPart < dlibMove.s.LowPart)) {
    568           /* LowPart has rolled over => add the carry digit to HighPart */
    569           plibNewPosition->s.HighPart++;
     568    (plibNewPosition->s.LowPart < dlibMove.s.LowPart)) {
     569      /* LowPart has rolled over => add the carry digit to HighPart */
     570      plibNewPosition->s.HighPart++;
    570571      }
    571       plibNewPosition->s.HighPart += dlibMove.s.HighPart; 
    572   }
    573   /*
    574    * Check if we end-up before the beginning of the file. That should 
     572      plibNewPosition->s.HighPart += dlibMove.s.HighPart;
     573  }
     574  /*
     575   * Check if we end-up before the beginning of the file. That should
    575576   * trigger an error.
    576577   */
     
    580581
    581582    /*
    582    * We currently don't support files with offsets of >32 bits. 
     583   * We currently don't support files with offsets of >32 bits.
    583584   * Note that we have checked for a negative offset already
    584585     */
     
    593594   */
    594595  This->currentPosition = *plibNewPosition;
    595  
     596
    596597  return S_OK;
    597598}
     
    606607 * See the documentation of IStream for more info.
    607608 */
    608 HRESULT WINAPI StgStreamImpl_SetSize( 
    609                                      IStream*      iface,
    610                                      ULARGE_INTEGER  libNewSize)   /* [in] */
     609HRESULT WINAPI StgStreamImpl_SetSize(
     610                     IStream*      iface,
     611                     ULARGE_INTEGER  libNewSize)   /* [in] */
    611612{
    612613  StgStreamImpl* const This=(StgStreamImpl*)iface;
     
    657658  Success = StorageImpl_ReadProperty(This->parentStorage->ancestorStorage,
    658659                                       This->ownerProperty,
    659                                        &curProperty); 
     660                                       &curProperty);
    660661  /*
    661662   * Determine if we have to switch from small to big blocks or vice versa
    662    */ 
    663   if ( (This->smallBlockChain!=0) && 
     663   */
     664  if ( (This->smallBlockChain!=0) &&
    664665       (curProperty.size.s.LowPart < LIMIT_TO_USE_SMALL_BLOCK) )
    665666  {
     
    693694  curProperty.size.s.HighPart = libNewSize.s.HighPart;
    694695  curProperty.size.s.LowPart = libNewSize.s.LowPart;
    695  
     696
    696697  if (Success)
    697698  {
    698699    StorageImpl_WriteProperty(This->parentStorage->ancestorStorage,
    699                                 This->ownerProperty,
    700                                 &curProperty);
    701   }
    702  
     700                This->ownerProperty,
     701                &curProperty);
     702  }
     703
    703704  This->streamSize = libNewSize;
    704  
     705
    705706  return S_OK;
    706707}
    707        
     708
    708709/***
    709710 * This method is part of the IStream interface.
     
    713714 * See the documentation of IStream for more info.
    714715 */
    715 HRESULT WINAPI StgStreamImpl_CopyTo( 
    716                                     IStream*      iface,
    717                                     IStream*      pstm,         /* [unique][in] */
    718                                     ULARGE_INTEGER  cb,           /* [in] */         
    719                                     ULARGE_INTEGER* pcbRead,      /* [out] */       
    720                                     ULARGE_INTEGER* pcbWritten)   /* [out] */       
     716HRESULT WINAPI StgStreamImpl_CopyTo(
     717                    IStream*      iface,
     718                    IStream*      pstm,         /* [unique][in] */
     719                    ULARGE_INTEGER  cb,           /* [in] */
     720                    ULARGE_INTEGER* pcbRead,      /* [out] */
     721                    ULARGE_INTEGER* pcbWritten)   /* [out] */
    721722{
    722723  HRESULT        hr = S_OK;
     
    726727  ULARGE_INTEGER totalBytesWritten;
    727728
    728   TRACE("(%p, %p, %ld, %p, %p)\n", 
    729         iface, pstm, cb.s.LowPart, pcbRead, pcbWritten);
     729  TRACE("(%p, %p, %ld, %p, %p)\n",
     730    iface, pstm, cb.s.LowPart, pcbRead, pcbWritten);
    730731
    731732  /*
     
    749750    else
    750751      copySize = cb.s.LowPart;
    751    
     752
    752753    IStream_Read(iface, tmpBuffer, copySize, &bytesRead);
    753754
    754755    totalBytesRead.s.LowPart += bytesRead;
    755    
     756
    756757    IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten);
    757758
     
    766767      break;
    767768    }
    768    
     769
    769770    if (bytesRead!=copySize)
    770771      cb.s.LowPart = 0;
     
    797798 *
    798799 * See the documentation of IStream for more info.
    799  */       
    800 HRESULT WINAPI StgStreamImpl_Commit( 
    801                   IStream*      iface,
    802                   DWORD           grfCommitFlags)  /* [in] */
     800 */
     801HRESULT WINAPI StgStreamImpl_Commit(
     802          IStream*      iface,
     803          DWORD           grfCommitFlags)  /* [in] */
    803804{
    804805  return S_OK;
     
    812813 *
    813814 * See the documentation of IStream for more info.
    814  */       
    815 HRESULT WINAPI StgStreamImpl_Revert( 
    816                   IStream* iface)
     815 */
     816HRESULT WINAPI StgStreamImpl_Revert(
     817          IStream* iface)
    817818{
    818819  return S_OK;
    819820}
    820821
    821 HRESULT WINAPI StgStreamImpl_LockRegion( 
    822                                         IStream*     iface,
    823                                         ULARGE_INTEGER libOffset,   /* [in] */
    824                                         ULARGE_INTEGER cb,          /* [in] */
    825                                         DWORD          dwLockType)  /* [in] */
     822HRESULT WINAPI StgStreamImpl_LockRegion(
     823                    IStream*     iface,
     824                    ULARGE_INTEGER libOffset,   /* [in] */
     825                    ULARGE_INTEGER cb,          /* [in] */
     826                    DWORD          dwLockType)  /* [in] */
    826827{
    827828  FIXME("not implemented!\n");
     
    829830}
    830831
    831 HRESULT WINAPI StgStreamImpl_UnlockRegion( 
    832                                           IStream*     iface,
    833                                           ULARGE_INTEGER libOffset,   /* [in] */
    834                                           ULARGE_INTEGER cb,          /* [in] */
    835                                           DWORD          dwLockType)  /* [in] */
     832HRESULT WINAPI StgStreamImpl_UnlockRegion(
     833                      IStream*     iface,
     834                      ULARGE_INTEGER libOffset,   /* [in] */
     835                      ULARGE_INTEGER cb,          /* [in] */
     836                      DWORD          dwLockType)  /* [in] */
    836837{
    837838  FIXME("not implemented!\n");
     
    846847 *
    847848 * See the documentation of IStream for more info.
    848  */       
    849 HRESULT WINAPI StgStreamImpl_Stat( 
    850                   IStream*     iface,
    851                   STATSTG*       pstatstg,     /* [out] */
    852                   DWORD          grfStatFlag)  /* [in] */
     849 */
     850HRESULT WINAPI StgStreamImpl_Stat(
     851          IStream*     iface,
     852          STATSTG*       pstatstg,     /* [out] */
     853          DWORD          grfStatFlag)  /* [in] */
    853854{
    854855  StgStreamImpl* const This=(StgStreamImpl*)iface;
     
    856857  StgProperty    curProperty;
    857858  BOOL         readSucessful;
    858  
     859
    859860  /*
    860861   * Read the information from the property.
    861862   */
    862863  readSucessful = StorageImpl_ReadProperty(This->parentStorage->ancestorStorage,
    863                                              This->ownerProperty,
    864                                              &curProperty);
    865  
     864                         This->ownerProperty,
     865                         &curProperty);
     866
    866867  if (readSucessful)
    867868  {
    868     StorageUtl_CopyPropertyToSTATSTG(pstatstg, 
    869                                      &curProperty,
    870                                      grfStatFlag);
     869    StorageUtl_CopyPropertyToSTATSTG(pstatstg,
     870                     &curProperty,
     871                     grfStatFlag);
    871872
    872873    pstatstg->grfMode = This->grfMode;
    873    
     874
    874875    return S_OK;
    875876  }
    876  
     877
    877878  return E_FAIL;
    878879}
    879        
    880 HRESULT WINAPI StgStreamImpl_Clone( 
    881                                    IStream*     iface,
    882                                    IStream**    ppstm) /* [out] */
     880
     881HRESULT WINAPI StgStreamImpl_Clone(
     882                   IStream*     iface,
     883                   IStream**    ppstm) /* [out] */
    883884{
    884885  FIXME("not implemented!\n");
  • trunk/src/ole32/storage32.c

    r5602 r6648  
     1/* $Id: storage32.c,v 1.3 2001-09-05 13:17:12 bird Exp $ */
    12/*
    23 * Compound Storage (32 bit version)
     
    4748/* OLESTREAM memory structure to use for Get and Put Routines */
    4849/* Used for OleConvertIStorageToOLESTREAM and OleConvertOLESTREAMToIStorage */
    49 typedef struct 
     50typedef struct
    5051{
    5152    DWORD dwOleID;
     
    8586    DWORD dwExtentX;
    8687    DWORD dwExtentY;
    87     DWORD dwSize; 
     88    DWORD dwSize;
    8889    BYTE *pData;
    8990}OLECONVERT_ISTORAGE_OLEPRES;
     
    110111  INT         typeOfRelation);
    111112
    112 static HRESULT adjustPropertyChain( 
     113static HRESULT adjustPropertyChain(
    113114  StorageImpl *This,
    114115  StgProperty   propertyToDelete,
     
    137138 * Declaration of miscellaneous functions...
    138139 */
    139 static HRESULT validateSTGM(DWORD stgmValue); 
     140static HRESULT validateSTGM(DWORD stgmValue);
    140141
    141142static DWORD GetShareModeFromSTGM(DWORD stgm);
     
    223224 * This method implements the common QueryInterface for all IStorage32
    224225 * implementations contained in this file.
    225  * 
     226 *
    226227 * See Windows documentation for more details on IUnknown methods.
    227228 */
     
    237238  if ( (This==0) || (ppvObject==0) )
    238239    return E_INVALIDARG;
    239  
     240
    240241  /*
    241242   * Initialize the return parameter.
    242243   */
    243244  *ppvObject = 0;
    244  
     245
    245246  /*
    246247   * Compare the riid with the interface IDs implemented by this object.
    247248   */
    248   if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 
     249  if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
    249250  {
    250251    *ppvObject = (IStorage*)This;
    251252  }
    252   else if (memcmp(&IID_IStorage, riid, sizeof(IID_IStorage)) == 0) 
     253  else if (memcmp(&IID_IStorage, riid, sizeof(IID_IStorage)) == 0)
    253254  {
    254255    *ppvObject = (IStorage*)This;
    255256  }
    256  
     257
    257258  /*
    258259   * Check that we obtained an interface.
     
    260261  if ((*ppvObject)==0)
    261262    return E_NOINTERFACE;
    262  
     263
    263264  /*
    264265   * Query Interface always increases the reference count by one when it is
     
    269270  return S_OK;
    270271}
    271        
     272
    272273/************************************************************************
    273274 * Storage32BaseImpl_AddRef (IUnknown)
     
    275276 * This method implements the common AddRef for all IStorage32
    276277 * implementations contained in this file.
    277  * 
     278 *
    278279 * See Windows documentation for more details on IUnknown methods.
    279280 */
    280 ULONG WINAPI StorageBaseImpl_AddRef( 
     281ULONG WINAPI StorageBaseImpl_AddRef(
    281282            IStorage* iface)
    282283{
     
    286287  return This->ref;
    287288}
    288        
     289
    289290/************************************************************************
    290291 * Storage32BaseImpl_Release (IUnknown)
     
    292293 * This method implements the common Release for all IStorage32
    293294 * implementations contained in this file.
    294  * 
     295 *
    295296 * See Windows documentation for more details on IUnknown methods.
    296297 */
    297 ULONG WINAPI StorageBaseImpl_Release( 
     298ULONG WINAPI StorageBaseImpl_Release(
    298299      IStorage* iface)
    299300{
     
    310311  {
    311312    /*
    312      * Since we are using a system of base-classes, we want to call the 
    313      * destructor of the appropriate derived class. To do this, we are 
     313     * Since we are using a system of base-classes, we want to call the
     314     * destructor of the appropriate derived class. To do this, we are
    314315     * using virtual functions to implement the destructor.
    315316     */
     
    318319    return 0;
    319320  }
    320  
     321
    321322  return This->ref;
    322323}
     
    329330 * See Windows documentation for more details on IStorage methods.
    330331 */
    331 HRESULT WINAPI StorageBaseImpl_OpenStream( 
     332HRESULT WINAPI StorageBaseImpl_OpenStream(
    332333  IStorage*        iface,
    333334  const OLECHAR*   pwcsName,  /* [string][in] */
    334335  void*            reserved1, /* [unique][in] */
    335   DWORD            grfMode,   /* [in]  */       
    336   DWORD            reserved2, /* [in]  */       
    337   IStream**        ppstm)     /* [out] */       
     336  DWORD            grfMode,   /* [in]  */
     337  DWORD            reserved2, /* [in]  */
     338  IStream**        ppstm)     /* [out] */
    338339{
    339340  ICOM_THIS(StorageBaseImpl,iface);
     
    343344  ULONG             foundPropertyIndex;
    344345
    345   TRACE("(%p, %s, %p, %lx, %ld, %p)\n", 
    346         iface, debugstr_w(pwcsName), reserved1, grfMode, reserved2, ppstm);
     346  TRACE("(%p, %s, %p, %lx, %ld, %p)\n",
     347    iface, debugstr_w(pwcsName), reserved1, grfMode, reserved2, ppstm);
    347348
    348349  /*
     
    351352  if ( (pwcsName==NULL) || (ppstm==0) )
    352353    return E_INVALIDARG;
    353  
     354
    354355  /*
    355356   * Initialize the out parameter
    356357   */
    357358  *ppstm = 0;
    358  
     359
    359360  /*
    360361   * Validate the STGM flags
     
    375376   */
    376377  propertyEnumeration = IEnumSTATSTGImpl_Construct(
    377     This->ancestorStorage, 
     378    This->ancestorStorage,
    378379    This->rootPropertySetIndex);
    379  
     380
    380381  /*
    381382   * Search the enumeration for the property with the given name
     
    385386    pwcsName,
    386387    &currentProperty);
    387  
     388
    388389  /*
    389390   * Delete the property enumeration since we don't need it anymore
    390391   */
    391392  IEnumSTATSTGImpl_Destroy(propertyEnumeration);
    392  
     393
    393394  /*
    394395   * If it was found, construct the stream object and return a pointer to it.
    395396   */
    396   if ( (foundPropertyIndex!=PROPERTY_NULL) && 
     397  if ( (foundPropertyIndex!=PROPERTY_NULL) &&
    397398       (currentProperty.propertyType==PROPTYPE_STREAM) )
    398399  {
    399400    newStream = StgStreamImpl_Construct(This, grfMode, foundPropertyIndex);
    400    
     401
    401402    if (newStream!=0)
    402403    {
     
    405406
    406407      /*
    407        * Since we are returning a pointer to the interface, we have to 
     408       * Since we are returning a pointer to the interface, we have to
    408409       * nail down the reference.
    409410       */
    410411      StgStreamImpl_AddRef(*ppstm);
    411      
     412
    412413      return S_OK;
    413414    }
    414    
     415
    415416    return E_OUTOFMEMORY;
    416417  }
    417  
     418
    418419  return STG_E_FILENOTFOUND;
    419420}
     
    423424 *
    424425 * This method will open a new storage object from the current storage.
    425  * 
     426 *
    426427 * See Windows documentation for more details on IStorage methods.
    427  */       
    428 HRESULT WINAPI StorageBaseImpl_OpenStorage( 
     428 */
     429HRESULT WINAPI StorageBaseImpl_OpenStorage(
    429430  IStorage*        iface,
    430   const OLECHAR*   pwcsName,      /* [string][unique][in] */ 
    431   IStorage*        pstgPriority,  /* [unique][in] */         
    432   DWORD            grfMode,       /* [in] */                 
    433   SNB              snbExclude,    /* [unique][in] */         
    434   DWORD            reserved,      /* [in] */                 
    435   IStorage**       ppstg)         /* [out] */                       
     431  const OLECHAR*   pwcsName,      /* [string][unique][in] */
     432  IStorage*        pstgPriority,  /* [unique][in] */
     433  DWORD            grfMode,       /* [in] */
     434  SNB              snbExclude,    /* [unique][in] */
     435  DWORD            reserved,      /* [in] */
     436  IStorage**       ppstg)         /* [out] */
    436437{
    437438  ICOM_THIS(StorageBaseImpl,iface);
     
    441442  ULONG                  foundPropertyIndex;
    442443
    443   TRACE("(%p, %s, %p, %lx, %p, %ld, %p)\n", 
    444         iface, debugstr_w(pwcsName), pstgPriority,
    445         grfMode, snbExclude, reserved, ppstg);
    446  
     444  TRACE("(%p, %s, %p, %lx, %p, %ld, %p)\n",
     445    iface, debugstr_w(pwcsName), pstgPriority,
     446    grfMode, snbExclude, reserved, ppstg);
     447
    447448  /*
    448449   * Perform a sanity check on the parameters.
     
    450451  if ( (This==0) || (pwcsName==NULL) || (ppstg==0) )
    451452    return E_INVALIDARG;
    452  
     453
    453454  /*
    454455   * Validate the STGM flags
     
    460461   * As documented.
    461462   */
    462   if ( !(grfMode & STGM_SHARE_EXCLUSIVE) || 
     463  if ( !(grfMode & STGM_SHARE_EXCLUSIVE) ||
    463464        (grfMode & STGM_DELETEONRELEASE) ||
    464465        (grfMode & STGM_PRIORITY) )
     
    469470   */
    470471  *ppstg = 0;
    471  
     472
    472473  /*
    473474   * Create a property enumeration to search the properties
    474475   */
    475476  propertyEnumeration = IEnumSTATSTGImpl_Construct(
    476                           This->ancestorStorage, 
     477                          This->ancestorStorage,
    477478                          This->rootPropertySetIndex);
    478  
     479
    479480  /*
    480481   * Search the enumeration for the property with the given name
     
    484485                         pwcsName,
    485486                         &currentProperty);
    486  
     487
    487488  /*
    488489   * Delete the property enumeration since we don't need it anymore
    489490   */
    490491  IEnumSTATSTGImpl_Destroy(propertyEnumeration);
    491  
     492
    492493  /*
    493494   * If it was found, construct the stream object and return a pointer to it.
    494495   */
    495   if ( (foundPropertyIndex!=PROPERTY_NULL) && 
     496  if ( (foundPropertyIndex!=PROPERTY_NULL) &&
    496497       (currentProperty.propertyType==PROPTYPE_STORAGE) )
    497498  {
     
    502503                   This->ancestorStorage,
    503504                   foundPropertyIndex);
    504    
     505
    505506    if (newStorage != 0)
    506507    {
     
    508509
    509510      /*
    510        * Since we are returning a pointer to the interface, 
     511       * Since we are returning a pointer to the interface,
    511512       * we have to nail down the reference.
    512513       */
    513514      StorageBaseImpl_AddRef(*ppstg);
    514      
     515
    515516      return S_OK;
    516517    }
    517    
     518
    518519    return STG_E_INSUFFICIENTMEMORY;
    519520  }
    520  
     521
    521522  return STG_E_FILENOTFOUND;
    522523}
     
    525526 * Storage32BaseImpl_EnumElements (IStorage)
    526527 *
    527  * This method will create an enumerator object that can be used to 
     528 * This method will create an enumerator object that can be used to
    528529 * retrieve informatino about all the properties in the storage object.
    529  * 
     530 *
    530531 * See Windows documentation for more details on IStorage methods.
    531  */       
    532 HRESULT WINAPI StorageBaseImpl_EnumElements( 
     532 */
     533HRESULT WINAPI StorageBaseImpl_EnumElements(
    533534  IStorage*       iface,
    534   DWORD           reserved1, /* [in] */                 
    535   void*           reserved2, /* [size_is][unique][in] */ 
    536   DWORD           reserved3, /* [in] */                 
    537   IEnumSTATSTG**  ppenum)    /* [out] */                 
     535  DWORD           reserved1, /* [in] */
     536  void*           reserved2, /* [size_is][unique][in] */
     537  DWORD           reserved3, /* [in] */
     538  IEnumSTATSTG**  ppenum)    /* [out] */
    538539{
    539540  ICOM_THIS(StorageBaseImpl,iface);
    540541  IEnumSTATSTGImpl* newEnum;
    541542
    542   TRACE("(%p, %ld, %p, %ld, %p)\n", 
    543         iface, reserved1, reserved2, reserved3, ppenum);
     543  TRACE("(%p, %ld, %p, %ld, %p)\n",
     544    iface, reserved1, reserved2, reserved3, ppenum);
    544545
    545546  /*
     
    548549  if ( (This==0) || (ppenum==0))
    549550    return E_INVALIDARG;
    550  
     551
    551552  /*
    552553   * Construct the enumerator.
     
    565566     */
    566567    IEnumSTATSTGImpl_AddRef(*ppenum);
    567    
     568
    568569    return S_OK;
    569570  }
     
    576577 *
    577578 * This method will retrieve information about this storage object.
    578  * 
     579 *
    579580 * See Windows documentation for more details on IStorage methods.
    580  */       
    581 HRESULT WINAPI StorageBaseImpl_Stat( 
     581 */
     582HRESULT WINAPI StorageBaseImpl_Stat(
    582583  IStorage*        iface,
    583   STATSTG*         pstatstg,     /* [out] */ 
    584   DWORD            grfStatFlag)  /* [in] */ 
     584  STATSTG*         pstatstg,     /* [out] */
     585  DWORD            grfStatFlag)  /* [in] */
    585586{
    586587  ICOM_THIS(StorageBaseImpl,iface);
     
    588589  BOOL         readSuccessful;
    589590
    590   TRACE("(%p, %p, %lx)\n", 
    591         iface, pstatstg, grfStatFlag);
     591  TRACE("(%p, %p, %lx)\n",
     592    iface, pstatstg, grfStatFlag);
    592593
    593594  /*
     
    608609  {
    609610    StorageUtl_CopyPropertyToSTATSTG(
    610       pstatstg, 
    611       &curProperty, 
     611      pstatstg,
     612      &curProperty,
    612613      grfStatFlag);
    613    
     614
    614615    return S_OK;
    615616  }
    616  
     617
    617618  return E_FAIL;
    618619}
     
    621622 * Storage32BaseImpl_RenameElement (IStorage)
    622623 *
    623  * This method will rename the specified element. 
     624 * This method will rename the specified element.
    624625 *
    625626 * See Windows documentation for more details on IStorage methods.
    626  * 
    627  * Implementation notes: The method used to rename consists of creating a clone 
    628  *    of the deleted StgProperty object setting it with the new name and to 
     627 *
     628 * Implementation notes: The method used to rename consists of creating a clone
     629 *    of the deleted StgProperty object setting it with the new name and to
    629630 *    perform a DestroyElement of the old StgProperty.
    630631 */
     
    639640  ULONG             foundPropertyIndex;
    640641
    641   TRACE("(%p, %s, %s)\n", 
    642         iface, debugstr_w(pwcsOldName), debugstr_w(pwcsNewName));
     642  TRACE("(%p, %s, %s)\n",
     643    iface, debugstr_w(pwcsOldName), debugstr_w(pwcsNewName));
    643644
    644645  /*
     
    686687     * Setup a new property for the renamed property
    687688     */
    688     renamedProperty.sizeOfNameString = 
     689    renamedProperty.sizeOfNameString =
    689690      ( lstrlenW(pwcsNewName)+1 ) * sizeof(WCHAR);
    690  
     691
    691692    if (renamedProperty.sizeOfNameString > PROPERTY_NAME_BUFFER_LEN)
    692693      return STG_E_INVALIDNAME;
    693  
     694
    694695    strcpyW(renamedProperty.name, pwcsNewName);
    695  
     696
    696697    renamedProperty.propertyType  = currentProperty.propertyType;
    697698    renamedProperty.startingBlock = currentProperty.startingBlock;
    698699    renamedProperty.size.s.LowPart  = currentProperty.size.s.LowPart;
    699700    renamedProperty.size.s.HighPart = currentProperty.size.s.HighPart;
    700  
     701
    701702    renamedProperty.previousProperty = PROPERTY_NULL;
    702703    renamedProperty.nextProperty     = PROPERTY_NULL;
    703  
     704
    704705    /*
    705706     * Bring the dirProperty link in case it is a storage and in which
     
    707708     */
    708709    renamedProperty.dirProperty = currentProperty.dirProperty;
    709  
    710     /* call CoFileTime to get the current time 
     710
     711    /* call CoFileTime to get the current time
    711712    renamedProperty.timeStampS1
    712713    renamedProperty.timeStampD1
    713714    renamedProperty.timeStampS2
    714715    renamedProperty.timeStampD2
    715     renamedProperty.propertyUniqueID 
     716    renamedProperty.propertyUniqueID
    716717    */
    717  
    718     /* 
     718
     719    /*
    719720     * Obtain a free property in the property chain
    720721     */
    721722    renamedPropertyIndex = getFreeProperty(This->ancestorStorage);
    722  
     723
    723724    /*
    724725     * Save the new property into the new property spot
    725      */ 
     726     */
    726727    StorageImpl_WriteProperty(
    727728      This->ancestorStorage,
    728       renamedPropertyIndex, 
     729      renamedPropertyIndex,
    729730      &renamedProperty);
    730  
    731     /* 
     731
     732    /*
    732733     * Find a spot in the property chain for our newly created property.
    733734     */
    734735    updatePropertyChain(
    735736      (StorageImpl*)This,
    736       renamedPropertyIndex, 
     737      renamedPropertyIndex,
    737738      renamedProperty);
    738739
    739740    /*
    740      * At this point the renamed property has been inserted in the tree, 
    741      * now, before to Destroy the old property we must zeroed it's dirProperty 
    742      * otherwise the DestroyProperty below will zap it all and we do not want 
     741     * At this point the renamed property has been inserted in the tree,
     742     * now, before to Destroy the old property we must zeroed it's dirProperty
     743     * otherwise the DestroyProperty below will zap it all and we do not want
    743744     * this to happen.
    744745     * Also, we fake that the old property is a storage so the DestroyProperty
    745746     * will not do a SetSize(0) on the stream data.
    746      * 
     747     *
    747748     * This means that we need to tweek the StgProperty if it is a stream or a
    748749     * non empty storage.
     
    756757    StorageImpl_WriteProperty(
    757758      This->ancestorStorage,
    758       foundPropertyIndex, 
     759      foundPropertyIndex,
    759760      &currentProperty);
    760761
    761     /* 
    762      * Invoke Destroy to get rid of the ole property and automatically redo 
    763      * the linking of it's previous and next members... 
    764      */ 
    765     StorageImpl_DestroyElement((IStorage*)This->ancestorStorage, pwcsOldName); 
     762    /*
     763     * Invoke Destroy to get rid of the ole property and automatically redo
     764     * the linking of it's previous and next members...
     765     */
     766    StorageImpl_DestroyElement((IStorage*)This->ancestorStorage, pwcsOldName);
    766767
    767768  }
     
    780781 * Storage32BaseImpl_CreateStream (IStorage)
    781782 *
    782  * This method will create a stream object within this storage 
     783 * This method will create a stream object within this storage
    783784 *
    784785 * See Windows documentation for more details on IStorage methods.
     
    798799  ULONG             foundPropertyIndex, newPropertyIndex;
    799800
    800   TRACE("(%p, %s, %lx, %ld, %ld, %p)\n", 
    801         iface, debugstr_w(pwcsName), grfMode,
    802         reserved1, reserved2, ppstm);
     801  TRACE("(%p, %s, %lx, %ld, %ld, %p)\n",
     802    iface, debugstr_w(pwcsName), grfMode,
     803    reserved1, reserved2, ppstm);
    803804
    804805  /*
     
    845846  {
    846847    /*
    847      * An element with this name already exists 
     848     * An element with this name already exists
    848849     */
    849850    if (grfMode & STGM_CREATE)
    850851    {
    851       IStorage_DestroyElement(iface, pwcsName); 
    852     }
    853     else 
     852      IStorage_DestroyElement(iface, pwcsName);
     853    }
     854    else
    854855      return STG_E_FILEALREADYEXISTS;
    855856  }
    856857
    857   /* 
    858    * memset the empty property 
     858  /*
     859   * memset the empty property
    859860   */
    860861  memset(&newStreamProperty, 0, sizeof(StgProperty));
     
    877878  newStreamProperty.dirProperty      = PROPERTY_NULL;
    878879
    879   /* call CoFileTime to get the current time 
     880  /* call CoFileTime to get the current time
    880881  newStreamProperty.timeStampS1
    881882  newStreamProperty.timeStampD1
     
    887888
    888889  /*
    889    * Get a free property or create a new one 
     890   * Get a free property or create a new one
    890891   */
    891892  newPropertyIndex = getFreeProperty(This->ancestorStorage);
     
    893894  /*
    894895   * Save the new property into the new property spot
    895    */ 
     896   */
    896897  StorageImpl_WriteProperty(
    897898    This->ancestorStorage,
    898     newPropertyIndex, 
     899    newPropertyIndex,
    899900    &newStreamProperty);
    900901
    901   /* 
     902  /*
    902903   * Find a spot in the property chain for our newly created property.
    903904   */
    904905  updatePropertyChain(
    905906    (StorageImpl*)This,
    906     newPropertyIndex, 
     907    newPropertyIndex,
    907908    newStreamProperty);
    908909
    909   /* 
     910  /*
    910911   * Open the stream to return it.
    911912   */
     
    933934 * Storage32BaseImpl_SetClass (IStorage)
    934935 *
    935  * This method will write the specified CLSID in the property of this 
     936 * This method will write the specified CLSID in the property of this
    936937 * storage.
    937938 *
     
    948949
    949950  TRACE("(%p, %p)\n", iface, clsid);
    950  
     951
    951952  success = StorageImpl_ReadProperty(This->ancestorStorage,
    952953                                       This->rootPropertySetIndex,
     
    969970** Storage32Impl implementation
    970971*/
    971        
     972
    972973/************************************************************************
    973974 * Storage32Impl_CreateStorage (IStorage)
     
    977978 * See Windows documentation for more details on IStorage methods.
    978979 */
    979 HRESULT WINAPI StorageImpl_CreateStorage( 
     980HRESULT WINAPI StorageImpl_CreateStorage(
    980981  IStorage*      iface,
    981   const OLECHAR  *pwcsName, /* [string][in] */ 
    982   DWORD            grfMode,   /* [in] */ 
    983   DWORD            reserved1, /* [in] */ 
    984   DWORD            reserved2, /* [in] */ 
    985   IStorage       **ppstg)   /* [out] */ 
     982  const OLECHAR  *pwcsName, /* [string][in] */
     983  DWORD            grfMode,   /* [in] */
     984  DWORD            reserved1, /* [in] */
     985  DWORD            reserved2, /* [in] */
     986  IStorage       **ppstg)   /* [out] */
    986987{
    987988  StorageImpl* const This=(StorageImpl*)iface;
     
    994995  HRESULT          hr;
    995996
    996   TRACE("(%p, %s, %lx, %ld, %ld, %p)\n", 
    997         iface, debugstr_w(pwcsName), grfMode,
    998         reserved1, reserved2, ppstg);
    999  
     997  TRACE("(%p, %s, %lx, %ld, %ld, %p)\n",
     998    iface, debugstr_w(pwcsName), grfMode,
     999    reserved1, reserved2, ppstg);
     1000
    10001001  /*
    10011002   * Validate parameters
     
    10331034  {
    10341035    /*
    1035      * An element with this name already exists 
     1036     * An element with this name already exists
    10361037     */
    10371038    if (grfMode & STGM_CREATE)
    1038       IStorage_DestroyElement(iface, pwcsName); 
    1039     else 
     1039      IStorage_DestroyElement(iface, pwcsName);
     1040    else
    10401041      return STG_E_FILEALREADYEXISTS;
    10411042  }
    10421043
    1043   /* 
    1044    * memset the empty property 
     1044  /*
     1045   * memset the empty property
    10451046   */
    10461047  memset(&newProperty, 0, sizeof(StgProperty));
     
    10621063  newProperty.dirProperty      = PROPERTY_NULL;
    10631064
    1064   /* call CoFileTime to get the current time 
     1065  /* call CoFileTime to get the current time
    10651066  newProperty.timeStampS1
    10661067  newProperty.timeStampD1
     
    10711072  /*  newStorageProperty.propertyUniqueID */
    10721073
    1073   /* 
     1074  /*
    10741075   * Obtain a free property in the property chain
    10751076   */
     
    10781079  /*
    10791080   * Save the new property into the new property spot
    1080    */ 
     1081   */
    10811082  StorageImpl_WriteProperty(
    10821083    This->ancestorStorage,
    1083     newPropertyIndex, 
     1084    newPropertyIndex,
    10841085    &newProperty);
    10851086
    1086   /* 
     1087  /*
    10871088   * Find a spot in the property chain for our newly created property.
    10881089   */
    10891090  updatePropertyChain(
    10901091    This,
    1091     newPropertyIndex, 
     1092    newPropertyIndex,
    10921093    newProperty);
    10931094
    1094   /* 
     1095  /*
    10951096   * Open it to get a pointer to return.
    10961097   */
     
    11091110  }
    11101111
    1111  
     1112
    11121113  return S_OK;
    11131114}
     
    11401141      if (currentProperty.sizeOfNameString == 0)
    11411142      {
    1142         /* 
     1143        /*
    11431144         * The property existis and is available, we found it.
    11441145         */
     
    11571158  } while (newPropertyIndex == PROPERTY_NULL);
    11581159
    1159   /* 
    1160    * grow the property chain 
     1160  /*
     1161   * grow the property chain
    11611162   */
    11621163  if (! readSuccessful)
     
    11681169    ULONG          blockCount    = 0;
    11691170
    1170     /* 
    1171      * obtain the new count of property blocks 
     1171    /*
     1172     * obtain the new count of property blocks
    11721173     */
    11731174    blockCount = BlockChainStream_GetCount(
    11741175                   storage->ancestorStorage->rootBlockChain)+1;
    11751176
    1176     /* 
    1177      * initialize the size used by the property stream 
     1177    /*
     1178     * initialize the size used by the property stream
    11781179     */
    11791180    newSize.s.HighPart = 0;
    11801181    newSize.s.LowPart  = storage->bigBlockSize * blockCount;
    11811182
    1182     /* 
    1183      * add a property block to the property chain 
     1183    /*
     1184     * add a property block to the property chain
    11841185     */
    11851186    BlockChainStream_SetSize(storage->ancestorStorage->rootBlockChain, newSize);
    11861187
    1187     /* 
    1188      * memset the empty property in order to initialize the unused newly 
     1188    /*
     1189     * memset the empty property in order to initialize the unused newly
    11891190     * created property
    11901191     */
    11911192    memset(&emptyProperty, 0, sizeof(StgProperty));
    11921193
    1193     /* 
     1194    /*
    11941195     * initialize them
    11951196     */
    1196     lastProperty = storage->bigBlockSize / PROPSET_BLOCK_SIZE * blockCount; 
    1197    
     1197    lastProperty = storage->bigBlockSize / PROPSET_BLOCK_SIZE * blockCount;
     1198
    11981199    for(
    11991200      propertyIndex = newPropertyIndex;
     
    12031204      StorageImpl_WriteProperty(
    12041205        storage->ancestorStorage,
    1205         propertyIndex, 
     1206        propertyIndex,
    12061207        &emptyProperty);
    12071208    }
     
    12151216 * Internal Method
    12161217 *
    1217  * Case insensitive comparaison of StgProperty.name by first considering 
     1218 * Case insensitive comparaison of StgProperty.name by first considering
    12181219 * their size.
    12191220 *
     
    12281229  LONG diff      = lstrlenW(newProperty) - lstrlenW(currentProperty);
    12291230
    1230   if (diff == 0) 
    1231   {
    1232     /* 
     1231  if (diff == 0)
     1232  {
     1233    /*
    12331234     * We compare the string themselves only when they are of the same lenght
    12341235     */
     
    12361237  }
    12371238
    1238   return diff; 
     1239  return diff;
    12391240}
    12401241
     
    12481249  StorageImpl *storage,
    12491250  ULONG         newPropertyIndex,
    1250   StgProperty   newProperty) 
     1251  StgProperty   newProperty)
    12511252{
    12521253  StgProperty currentProperty;
     
    12611262  if (currentProperty.dirProperty != PROPERTY_NULL)
    12621263  {
    1263     /* 
     1264    /*
    12641265     * The root storage contains some element, therefore, start the research
    12651266     * for the appropriate location.
     
    12741275
    12751276    /*
    1276      * Read 
     1277     * Read
    12771278     */
    12781279    StorageImpl_ReadProperty(storage->ancestorStorage,
     
    12871288    {
    12881289      LONG diff = propertyNameCmp( newProperty.name, currentProperty.name);
    1289  
     1290
    12901291      if (diff < 0)
    12911292      {
     
    13261327      else
    13271328      {
    1328         /*
    1329         * Trying to insert an item with the same name in the
    1330         * subtree structure.
    1331         */
    1332         assert(FALSE);
     1329    /*
     1330    * Trying to insert an item with the same name in the
     1331    * subtree structure.
     1332    */
     1333    assert(FALSE);
    13331334      }
    13341335
     
    13391340  else
    13401341  {
    1341     /* 
     1342    /*
    13421343     * The root storage is empty, link the new property to it's dir property
    13431344     */
     
    13491350}
    13501351
    1351      
     1352
    13521353/*************************************************************************
    13531354 * CopyTo (IStorage)
    13541355 */
    1355 HRESULT WINAPI StorageImpl_CopyTo( 
     1356HRESULT WINAPI StorageImpl_CopyTo(
    13561357  IStorage*   iface,
    1357   DWORD       ciidExclude,  /* [in] */ 
    1358   const IID*  rgiidExclude, /* [size_is][unique][in] */ 
    1359   SNB         snbExclude,   /* [unique][in] */ 
    1360   IStorage*   pstgDest)     /* [unique][in] */ 
     1358  DWORD       ciidExclude,  /* [in] */
     1359  const IID*  rgiidExclude, /* [size_is][unique][in] */
     1360  SNB         snbExclude,   /* [unique][in] */
     1361  IStorage*   pstgDest)     /* [unique][in] */
    13611362{
    13621363  IEnumSTATSTG *elements     = 0;
     
    13691370    FIXME("Exclude option not implemented\n");
    13701371
    1371   TRACE("(%p, %ld, %p, %p, %p)\n", 
    1372         iface, ciidExclude, rgiidExclude,
    1373         snbExclude, pstgDest);
     1372  TRACE("(%p, %ld, %p, %p, %p)\n",
     1373    iface, ciidExclude, rgiidExclude,
     1374    snbExclude, pstgDest);
    13741375
    13751376  /*
     
    13791380    return STG_E_INVALIDPOINTER;
    13801381
    1381   /* 
     1382  /*
    13821383   * Enumerate the elements
    13831384   */
     
    13921393  IStorage_Stat( iface, &curElement, STATFLAG_NONAME);
    13931394  IStorage_SetClass( pstgDest, &curElement.clsid );
    1394  
     1395
    13951396  do
    13961397  {
     
    14121413       */
    14131414      hr = IStorage_OpenStorage( iface, curElement.pwcsName, NULL,
    1414                                 STGM_READ|STGM_SHARE_EXCLUSIVE,
    1415                                 NULL, 0, &pstgChild );
     1415                STGM_READ|STGM_SHARE_EXCLUSIVE,
     1416                NULL, 0, &pstgChild );
    14161417
    14171418      if (hr != S_OK)
     
    14241425      if (pstgChild == pstgDest)
    14251426      {
    1426         IEnumSTATSTG_Release(elements);
    1427 
    1428         return STG_E_ACCESSDENIED;
     1427    IEnumSTATSTG_Release(elements);
     1428
     1429    return STG_E_ACCESSDENIED;
    14291430      }
    1430            
     1431
    14311432      /*
    14321433       * create a new storage in destination storage
     
    14341435      hr = IStorage_CreateStorage( pstgDest, curElement.pwcsName,
    14351436                                   STGM_FAILIFTHERE|STGM_WRITE|STGM_SHARE_EXCLUSIVE,
    1436                                    0, 0,
     1437                   0, 0,
    14371438                                   &pstgTmp );
    14381439      /*
     
    14451446                                   NULL, 0, &pstgTmp );
    14461447      }
    1447        
     1448
    14481449      if (hr != S_OK)
    14491450        break;
    14501451
    1451        
     1452
    14521453      /*
    14531454       * do the copy recursively
     
    14551456      hr = IStorage_CopyTo( pstgChild, ciidExclude, rgiidExclude,
    14561457                               snbExclude, pstgTmp );
    1457                                
     1458
    14581459      IStorage_Release( pstgTmp );
    14591460      IStorage_Release( pstgChild );
     
    14761477       */
    14771478      hr = IStorage_OpenStream( iface, curElement.pwcsName, NULL,
    1478                                 STGM_READ|STGM_SHARE_EXCLUSIVE,
    1479                                 0, &pstrChild );
     1479                STGM_READ|STGM_SHARE_EXCLUSIVE,
     1480                0, &pstrChild );
    14801481
    14811482      if (hr != S_OK)
     
    14911492       */
    14921493      IStream_SetSize(pstrTmp, strStat.cbSize);
    1493      
     1494
    14941495      /*
    14951496       * do the copy
     
    14971498      hr = IStream_CopyTo( pstrChild, pstrTmp, strStat.cbSize,
    14981499                           NULL, NULL );
    1499                                
     1500
    15001501      IStream_Release( pstrTmp );
    15011502      IStream_Release( pstrChild );
     
    15121513   */
    15131514  IEnumSTATSTG_Release(elements);
    1514  
     1515
    15151516  return hr;
    15161517}
    1517        
     1518
    15181519/*************************************************************************
    15191520 * MoveElementTo (IStorage)
    15201521 */
    1521 HRESULT WINAPI StorageImpl_MoveElementTo( 
     1522HRESULT WINAPI StorageImpl_MoveElementTo(
    15221523  IStorage*     iface,
    1523   const OLECHAR *pwcsName,   /* [string][in] */ 
    1524   IStorage      *pstgDest,   /* [unique][in] */ 
    1525   const OLECHAR *pwcsNewName,/* [string][in] */ 
    1526   DWORD           grfFlags)    /* [in] */ 
     1524  const OLECHAR *pwcsName,   /* [string][in] */
     1525  IStorage      *pstgDest,   /* [unique][in] */
     1526  const OLECHAR *pwcsNewName,/* [string][in] */
     1527  DWORD           grfFlags)    /* [in] */
    15271528{
    15281529  FIXME("not implemented!\n");
    15291530  return E_NOTIMPL;
    15301531}
    1531        
     1532
    15321533/*************************************************************************
    15331534 * Commit (IStorage)
    15341535 */
    1535 HRESULT WINAPI StorageImpl_Commit( 
     1536HRESULT WINAPI StorageImpl_Commit(
    15361537  IStorage*   iface,
    1537   DWORD         grfCommitFlags)/* [in] */ 
     1538  DWORD         grfCommitFlags)/* [in] */
    15381539{
    15391540  FIXME("(%ld): stub!\n", grfCommitFlags);
    15401541  return S_OK;
    15411542}
    1542        
     1543
    15431544/*************************************************************************
    15441545 * Revert (IStorage)
    15451546 */
    1546 HRESULT WINAPI StorageImpl_Revert( 
     1547HRESULT WINAPI StorageImpl_Revert(
    15471548  IStorage* iface)
    15481549{
     
    15541555 * DestroyElement (IStorage)
    15551556 *
    1556  * Stategy: This implementation is build this way for simplicity not for speed. 
     1557 * Stategy: This implementation is build this way for simplicity not for speed.
    15571558 *          I always delete the top most element of the enumeration and adjust
    1558  *          the deleted element pointer all the time.  This takes longer to 
    1559  *          do but allow to reinvoke DestroyElement whenever we encounter a 
     1559 *          the deleted element pointer all the time.  This takes longer to
     1560 *          do but allow to reinvoke DestroyElement whenever we encounter a
    15601561 *          storage object.  The optimisation reside in the usage of another
    1561  *          enumeration stategy that would give all the leaves of a storage 
     1562 *          enumeration stategy that would give all the leaves of a storage
    15621563 *          first. (postfix order)
    15631564 */
    1564 HRESULT WINAPI StorageImpl_DestroyElement( 
     1565HRESULT WINAPI StorageImpl_DestroyElement(
    15651566  IStorage*     iface,
    1566   const OLECHAR *pwcsName)/* [string][in] */ 
     1567  const OLECHAR *pwcsName)/* [string][in] */
    15671568{
    15681569  StorageImpl* const This=(StorageImpl*)iface;
     
    15771578  ULONG             parentPropertyId;
    15781579
    1579   TRACE("(%p, %s)\n", 
    1580         iface, debugstr_w(pwcsName));
     1580  TRACE("(%p, %s)\n",
     1581    iface, debugstr_w(pwcsName));
    15811582
    15821583  /*
    15831584   * Perform a sanity check on the parameters.
    15841585   */
    1585   if (pwcsName==NULL) 
     1586  if (pwcsName==NULL)
    15861587    return STG_E_INVALIDPOINTER;
    1587  
     1588
    15881589  /*
    15891590   * Create a property enumeration to search the property with the given name
    15901591   */
    15911592  propertyEnumeration = IEnumSTATSTGImpl_Construct(
    1592     This->ancestorStorage, 
     1593    This->ancestorStorage,
    15931594    This->rootPropertySetIndex);
    1594  
     1595
    15951596  foundPropertyIndexToDelete = IEnumSTATSTGImpl_FindProperty(
    15961597    propertyEnumeration,
     
    16001601  IEnumSTATSTGImpl_Destroy(propertyEnumeration);
    16011602
    1602   if ( foundPropertyIndexToDelete == PROPERTY_NULL ) 
     1603  if ( foundPropertyIndexToDelete == PROPERTY_NULL )
    16031604  {
    16041605    return STG_E_FILENOTFOUND;
    16051606  }
    16061607
    1607   /* 
    1608    * Find the parent property of the property to delete (the one that 
    1609    * link to it).  If This->dirProperty == foundPropertyIndexToDelete, 
     1608  /*
     1609   * Find the parent property of the property to delete (the one that
     1610   * link to it).  If This->dirProperty == foundPropertyIndexToDelete,
    16101611   * the parent is This. Otherwise, the parent is one of it's sibling...
    16111612   */
    16121613
    1613   /* 
     1614  /*
    16141615   * First, read This's StgProperty..
    16151616   */
    1616   res = StorageImpl_ReadProperty( 
     1617  res = StorageImpl_ReadProperty(
    16171618          This->ancestorStorage,
    16181619          This->rootPropertySetIndex,
     
    16211622  assert(res==TRUE);
    16221623
    1623   /* 
     1624  /*
    16241625   * Second, check to see if by any chance the actual storage (This) is not
    16251626   * the parent of the property to delete... We never know...
     
    16271628  if ( parentProperty.dirProperty == foundPropertyIndexToDelete )
    16281629  {
    1629     /* 
     1630    /*
    16301631     * Set data as it would have been done in the else part...
    16311632     */
     
    16331634    parentPropertyId = This->rootPropertySetIndex;
    16341635  }
    1635   else 
    1636   { 
    1637     /*
    1638      * Create a property enumeration to search the parent properties, and 
     1636  else
     1637  {
     1638    /*
     1639     * Create a property enumeration to search the parent properties, and
    16391640     * delete it once done.
    16401641     */
     
    16421643
    16431644    propertyEnumeration2 = IEnumSTATSTGImpl_Construct(
    1644       This->ancestorStorage, 
     1645      This->ancestorStorage,
    16451646      This->rootPropertySetIndex);
    1646  
     1647
    16471648    typeOfRelation = IEnumSTATSTGImpl_FindParentProperty(
    16481649      propertyEnumeration2,
     
    16541655  }
    16551656
    1656   if ( propertyToDelete.propertyType == PROPTYPE_STORAGE ) 
     1657  if ( propertyToDelete.propertyType == PROPTYPE_STORAGE )
    16571658  {
    16581659    hr = deleteStorageProperty(
    1659            This, 
     1660           This,
    16601661           foundPropertyIndexToDelete,
    16611662           propertyToDelete);
    1662   } 
     1663  }
    16631664  else if ( propertyToDelete.propertyType == PROPTYPE_STREAM )
    16641665  {
    16651666    hr = deleteStreamProperty(
    1666            This, 
     1667           This,
    16671668           foundPropertyIndexToDelete,
    16681669           propertyToDelete);
    16691670  }
    16701671
    1671   if (hr!=S_OK) 
     1672  if (hr!=S_OK)
    16721673    return hr;
    16731674
     
    16771678  hr = adjustPropertyChain(
    16781679        This,
    1679         propertyToDelete, 
     1680        propertyToDelete,
    16801681        parentProperty,
    16811682        parentPropertyId,
     
    17211722  }
    17221723
    1723   /* 
     1724  /*
    17241725   * Enumerate the elements
    17251726   */
     
    17351736    {
    17361737      destroyHr = StorageImpl_DestroyElement(
    1737                     (IStorage*)childStorage, 
     1738                    (IStorage*)childStorage,
    17381739                    (OLECHAR*)currentElement.pwcsName);
    17391740
     
    17601761  IStorage_Release(childStorage);
    17611762  IEnumSTATSTG_Release(elements);
    1762    
     1763
    17631764  return destroyHr;
    17641765}
     
    17901791         0,
    17911792         &pis);
    1792    
     1793
    17931794  if (hr!=S_OK)
    17941795  {
     
    17961797  }
    17971798
    1798   /* 
    1799    * Zap the stream 
    1800    */ 
    1801   hr = IStream_SetSize(pis, size); 
     1799  /*
     1800   * Zap the stream
     1801   */
     1802  hr = IStream_SetSize(pis, size);
    18021803
    18031804  if(hr != S_OK)
     
    18111812  IStream_Release(pis);
    18121813
    1813   /* 
     1814  /*
    18141815   * Invalidate the property by zeroing it's name member.
    18151816   */
    18161817  propertyToDelete.sizeOfNameString = 0;
    18171818
    1818   /* 
     1819  /*
    18191820   * Here we should re-read the property so we get the updated pointer
    18201821   * but since we are here to zap it, I don't do it...
    18211822   */
    18221823  StorageImpl_WriteProperty(
    1823     parentStorage->ancestorStorage, 
     1824    parentStorage->ancestorStorage,
    18241825    indexOfPropertyToDelete,
    18251826    &propertyToDelete);
     
    18501851  res = StorageImpl_ReadProperty(
    18511852          storage->ancestorStorage,
    1852           storePropertyIndex, 
     1853          storePropertyIndex,
    18531854          &storeProperty);
    18541855
     
    18641865      return findPlaceholder(
    18651866               storage,
    1866                propertyIndexToStore, 
     1867               propertyIndexToStore,
    18671868               storeProperty.previousProperty,
    18681869               typeOfRelation);
     
    18791880      return findPlaceholder(
    18801881               storage,
    1881                propertyIndexToStore, 
     1882               propertyIndexToStore,
    18821883               storeProperty.nextProperty,
    18831884               typeOfRelation);
     
    18871888      storeProperty.nextProperty = propertyIndexToStore;
    18881889    }
    1889   } 
     1890  }
    18901891  else if (typeOfRelation == PROPERTY_RELATION_DIR)
    18911892  {
     
    18941895      return findPlaceholder(
    18951896               storage,
    1896                propertyIndexToStore, 
     1897               propertyIndexToStore,
    18971898               storeProperty.dirProperty,
    18981899               typeOfRelation);
     
    19061907  hr = StorageImpl_WriteProperty(
    19071908         storage->ancestorStorage,
    1908          storePropertyIndex, 
     1909         storePropertyIndex,
    19091910         &storeProperty);
    19101911
     
    19211922 * Internal Method
    19221923 *
    1923  * This method takes the previous and the next property link of a property 
     1924 * This method takes the previous and the next property link of a property
    19241925 * to be deleted and find them a place in the Storage.
    19251926 */
    1926 static HRESULT adjustPropertyChain( 
     1927static HRESULT adjustPropertyChain(
    19271928  StorageImpl *This,
    19281929  StgProperty   propertyToDelete,
     
    19381939  HRESULT hr                     = S_OK;
    19391940  BOOL  res                    = TRUE;
    1940  
    1941   if (typeOfRelation == PROPERTY_RELATION_PREVIOUS) 
    1942   {
    1943     if (propertyToDelete.previousProperty != PROPERTY_NULL) 
    1944     {
    1945       /* 
     1941
     1942  if (typeOfRelation == PROPERTY_RELATION_PREVIOUS)
     1943  {
     1944    if (propertyToDelete.previousProperty != PROPERTY_NULL)
     1945    {
     1946      /*
    19461947       * Set the parent previous to the property to delete previous
    19471948       */
    19481949      newLinkProperty = propertyToDelete.previousProperty;
    19491950
    1950       if (propertyToDelete.nextProperty != PROPERTY_NULL) 
     1951      if (propertyToDelete.nextProperty != PROPERTY_NULL)
    19511952      {
    19521953        /*
    1953          * We also need to find a storage for the other link, setup variables 
     1954         * We also need to find a storage for the other link, setup variables
    19541955         * to do this at the end...
    1955          */     
     1956         */
    19561957        needToFindAPlaceholder = TRUE;
    19571958        storeNode              = propertyToDelete.previousProperty;
     
    19591960        relationType           = PROPERTY_RELATION_NEXT;
    19601961      }
    1961     } 
    1962     else if (propertyToDelete.nextProperty != PROPERTY_NULL) 
    1963     {
    1964       /* 
     1962    }
     1963    else if (propertyToDelete.nextProperty != PROPERTY_NULL)
     1964    {
     1965      /*
    19651966       * Set the parent previous to the property to delete next
    19661967       */
    19671968      newLinkProperty = propertyToDelete.nextProperty;
    19681969    }
    1969    
    1970     /* 
     1970
     1971    /*
    19711972     * Link it for real...
    1972      */ 
     1973     */
    19731974    parentProperty.previousProperty = newLinkProperty;
    1974  
    1975   } 
    1976   else if (typeOfRelation == PROPERTY_RELATION_NEXT) 
    1977   {
    1978     if (propertyToDelete.previousProperty != PROPERTY_NULL) 
    1979     {
    1980       /* 
     1975
     1976  }
     1977  else if (typeOfRelation == PROPERTY_RELATION_NEXT)
     1978  {
     1979    if (propertyToDelete.previousProperty != PROPERTY_NULL)
     1980    {
     1981      /*
    19811982       * Set the parent next to the property to delete next previous
    19821983       */
    19831984      newLinkProperty = propertyToDelete.previousProperty;
    1984      
    1985       if (propertyToDelete.nextProperty != PROPERTY_NULL) 
     1985
     1986      if (propertyToDelete.nextProperty != PROPERTY_NULL)
    19861987      {
    19871988        /*
    1988          * We also need to find a storage for the other link, setup variables 
     1989         * We also need to find a storage for the other link, setup variables
    19891990         * to do this at the end...
    1990          */     
     1991         */
    19911992        needToFindAPlaceholder = TRUE;
    19921993        storeNode              = propertyToDelete.previousProperty;
     
    19941995        relationType           = PROPERTY_RELATION_NEXT;
    19951996      }
    1996     } 
    1997     else if (propertyToDelete.nextProperty != PROPERTY_NULL) 
    1998     {
    1999       /* 
     1997    }
     1998    else if (propertyToDelete.nextProperty != PROPERTY_NULL)
     1999    {
     2000      /*
    20002001       * Set the parent next to the property to delete next
    20012002       */
     
    20032004    }
    20042005
    2005     /* 
     2006    /*
    20062007     * Link it for real...
    2007      */ 
     2008     */
    20082009    parentProperty.nextProperty = newLinkProperty;
    2009   } 
     2010  }
    20102011  else /* (typeOfRelation == PROPERTY_RELATION_DIR) */
    20112012  {
    2012     if (propertyToDelete.previousProperty != PROPERTY_NULL) 
    2013     {
    2014       /* 
     2013    if (propertyToDelete.previousProperty != PROPERTY_NULL)
     2014    {
     2015      /*
    20152016       * Set the parent dir to the property to delete previous
    20162017       */
    20172018      newLinkProperty = propertyToDelete.previousProperty;
    20182019
    2019       if (propertyToDelete.nextProperty != PROPERTY_NULL) 
     2020      if (propertyToDelete.nextProperty != PROPERTY_NULL)
    20202021      {
    20212022        /*
    2022          * We also need to find a storage for the other link, setup variables 
     2023         * We also need to find a storage for the other link, setup variables
    20232024         * to do this at the end...
    2024          */     
     2025         */
    20252026        needToFindAPlaceholder = TRUE;
    20262027        storeNode              = propertyToDelete.previousProperty;
     
    20282029        relationType           = PROPERTY_RELATION_NEXT;
    20292030      }
    2030     } 
    2031     else if (propertyToDelete.nextProperty != PROPERTY_NULL) 
    2032     {
    2033       /* 
     2031    }
     2032    else if (propertyToDelete.nextProperty != PROPERTY_NULL)
     2033    {
     2034      /*
    20342035       * Set the parent dir to the property to delete next
    20352036       */
     
    20372038    }
    20382039
    2039     /* 
     2040    /*
    20402041     * Link it for real...
    2041      */ 
     2042     */
    20422043    parentProperty.dirProperty = newLinkProperty;
    20432044  }
    20442045
    2045   /* 
    2046    * Write back the parent property   
     2046  /*
     2047   * Write back the parent property
    20472048   */
    20482049  res = StorageImpl_WriteProperty(
    2049           This->ancestorStorage, 
     2050          This->ancestorStorage,
    20502051          parentPropertyId,
    20512052          &parentProperty);
     
    20562057
    20572058  /*
    2058    * If a placeholder is required for the other link, then, find one and 
     2059   * If a placeholder is required for the other link, then, find one and
    20592060   * get out of here...
    20602061   */
    2061   if (needToFindAPlaceholder) 
     2062  if (needToFindAPlaceholder)
    20622063  {
    20632064    hr = findPlaceholder(
    2064            This, 
    2065            toStoreNode, 
     2065           This,
     2066           toStoreNode,
    20662067           storeNode,
    20672068           relationType);
     
    20752076 * SetElementTimes (IStorage)
    20762077 */
    2077 HRESULT WINAPI StorageImpl_SetElementTimes( 
     2078HRESULT WINAPI StorageImpl_SetElementTimes(
    20782079  IStorage*     iface,
    2079   const OLECHAR *pwcsName,/* [string][in] */ 
    2080   const FILETIME  *pctime,  /* [in] */ 
    2081   const FILETIME  *patime,  /* [in] */ 
    2082   const FILETIME  *pmtime)  /* [in] */ 
     2080  const OLECHAR *pwcsName,/* [string][in] */
     2081  const FILETIME  *pctime,  /* [in] */
     2082  const FILETIME  *patime,  /* [in] */
     2083  const FILETIME  *pmtime)  /* [in] */
    20832084{
    20842085  FIXME("not implemented!\n");
     
    20892090 * SetStateBits (IStorage)
    20902091 */
    2091 HRESULT WINAPI StorageImpl_SetStateBits( 
     2092HRESULT WINAPI StorageImpl_SetStateBits(
    20922093  IStorage*   iface,
    2093   DWORD         grfStateBits,/* [in] */ 
    2094   DWORD         grfMask)     /* [in] */ 
     2094  DWORD         grfStateBits,/* [in] */
     2095  DWORD         grfMask)     /* [in] */
    20952096{
    20962097  FIXME("not implemented!\n");
     
    21102111  BOOL      readSuccessful;
    21112112  ULONG       currentPropertyIndex;
    2112  
     2113
    21132114  if ( FAILED( validateSTGM(openFlags) ))
    21142115    return STG_E_INVALIDFLAG;
    21152116
    21162117  memset(This, 0, sizeof(StorageImpl));
    2117  
     2118
    21182119  /*
    21192120   * Initialize the virtual fgunction table.
     
    21212122  ICOM_VTBL(This)    = &Storage32Impl_Vtbl;
    21222123  This->v_destructor = &StorageImpl_Destroy;
    2123  
     2124
    21242125  /*
    21252126   * This is the top-level storage so initialize the ancester pointer
     
    21272128   */
    21282129  This->ancestorStorage = This;
    2129  
     2130
    21302131  /*
    21312132   * Initialize the physical support of the storage.
    21322133   */
    21332134  This->hFile = hFile;
    2134  
     2135
    21352136  /*
    21362137   * Initialize the big block cache.
     
    21462147  if (This->bigBlockFile == 0)
    21472148    return E_FAIL;
    2148  
     2149
    21492150  if (fileCreate)
    21502151  {
     
    21582159     * - There is no small block depot
    21592160     */
    2160     memset( This->bigBlockDepotStart,     
    2161             BLOCK_UNUSED, 
     2161    memset( This->bigBlockDepotStart,
     2162            BLOCK_UNUSED,
    21622163            sizeof(This->bigBlockDepotStart));
    21632164
     
    22132214   */
    22142215  This->prevFreeBlock = 0;
    2215  
     2216
    22162217  /*
    22172218   * Create the block chain abstractions.
    22182219   */
    2219   This->rootBlockChain = 
     2220  This->rootBlockChain =
    22202221    BlockChainStream_Construct(This, &This->rootStartBlock, PROPERTY_NULL);
    22212222
    22222223  This->smallBlockDepotChain = BlockChainStream_Construct(
    2223                                  This, 
    2224                                  &This->smallBlockDepotStart, 
     2224                                 This,
     2225                                 &This->smallBlockDepotStart,
    22252226                                 PROPERTY_NULL);
    22262227
    22272228  /*
    2228    * Write the root property 
     2229   * Write the root property
    22292230   */
    22302231  if (fileCreate)
     
    22532254   */
    22542255  currentPropertyIndex = 0;
    2255  
     2256
    22562257  do
    22572258  {
    22582259    readSuccessful = StorageImpl_ReadProperty(
    2259                       This, 
    2260                       currentPropertyIndex, 
     2260                      This,
     2261                      currentPropertyIndex,
    22612262                      &currentProperty);
    2262    
     2263
    22632264    if (readSuccessful)
    22642265    {
     
    22712272
    22722273    currentPropertyIndex++;
    2273    
     2274
    22742275  } while (readSuccessful && (This->rootPropertySetIndex == PROPERTY_NULL) );
    2275  
     2276
    22762277  if (!readSuccessful)
    22772278  {
     
    22842285   */
    22852286  This->smallBlockRootChain = BlockChainStream_Construct(
    2286                                 This, 
    2287                                 NULL, 
     2287                                This,
     2288                                NULL,
    22882289                                This->rootPropertySetIndex);
    2289  
     2290
    22902291  return hr;
    22912292}
     
    28202821
    28212822    StorageUtl_ReadWord(
    2822       headerBigBlock, 
    2823       OFFSET_BIGBLOCKSIZEBITS,   
     2823      headerBigBlock,
     2824      OFFSET_BIGBLOCKSIZEBITS,
    28242825      &This->bigBlockSizeBits);
    28252826
    28262827    StorageUtl_ReadWord(
    2827       headerBigBlock, 
    2828       OFFSET_SMALLBLOCKSIZEBITS, 
     2828      headerBigBlock,
     2829      OFFSET_SMALLBLOCKSIZEBITS,
    28292830      &This->smallBlockSizeBits);
    28302831
    28312832    StorageUtl_ReadDWord(
    2832       headerBigBlock, 
    2833       OFFSET_BBDEPOTCOUNT,     
     2833      headerBigBlock,
     2834      OFFSET_BBDEPOTCOUNT,
    28342835      &This->bigBlockDepotCount);
    28352836
    28362837    StorageUtl_ReadDWord(
    2837       headerBigBlock, 
    2838       OFFSET_ROOTSTARTBLOCK,   
     2838      headerBigBlock,
     2839      OFFSET_ROOTSTARTBLOCK,
    28392840      &This->rootStartBlock);
    28402841
    28412842    StorageUtl_ReadDWord(
    2842       headerBigBlock, 
    2843       OFFSET_SBDEPOTSTART,     
     2843      headerBigBlock,
     2844      OFFSET_SBDEPOTSTART,
    28442845      &This->smallBlockDepotStart);
    28452846
    2846     StorageUtl_ReadDWord( 
    2847       headerBigBlock, 
    2848       OFFSET_EXTBBDEPOTSTART,   
     2847    StorageUtl_ReadDWord(
     2848      headerBigBlock,
     2849      OFFSET_EXTBBDEPOTSTART,
    28492850      &This->extBigBlockDepotStart);
    28502851
    28512852    StorageUtl_ReadDWord(
    2852       headerBigBlock, 
    2853       OFFSET_EXTBBDEPOTCOUNT,   
     2853      headerBigBlock,
     2854      OFFSET_EXTBBDEPOTCOUNT,
    28542855      &This->extBigBlockDepotCount);
    2855    
     2856
    28562857    for (index = 0; index < COUNT_BBDEPOTINHEADER; index ++)
    28572858    {
    28582859      StorageUtl_ReadDWord(
    2859         headerBigBlock, 
     2860        headerBigBlock,
    28602861        OFFSET_BBDEPOTSTART + (sizeof(ULONG)*index),
    28612862        &(This->bigBlockDepotStart[index]));
    28622863    }
    2863    
     2864
    28642865    /*
    28652866     * Make the bitwise arithmetic to get the size of the blocks in bytes.
     
    28752876      This->smallBlockSize = 0x000000001 >> (DWORD)This->smallBlockSizeBits;
    28762877    }
    2877    
    2878     /*
    2879      * Right now, the code is making some assumptions about the size of the 
     2878
     2879    /*
     2880     * Right now, the code is making some assumptions about the size of the
    28802881     * blocks, just make sure they are what we're expecting.
    28812882     */
    2882     assert( (This->bigBlockSize==DEF_BIG_BLOCK_SIZE) && 
     2883    assert( (This->bigBlockSize==DEF_BIG_BLOCK_SIZE) &&
    28832884            (This->smallBlockSize==DEF_SMALL_BLOCK_SIZE));
    2884    
     2885
    28852886    /*
    28862887     * Release the block.
     
    28902891    hr = S_OK;
    28912892  }
    2892  
     2893
    28932894  return hr;
    28942895}
     
    29102911   */
    29112912  success = StorageImpl_ReadBigBlock(This, -1, headerBigBlock);
    2912  
     2913
    29132914  /*
    29142915   * If the block read failed, the file is probably new.
     
    29202921     */
    29212922    memset(headerBigBlock, 0, BIG_BLOCK_SIZE);
    2922    
     2923
    29232924    /*
    29242925     * Initialize the magic number.
    29252926     */
    29262927    memcpy(headerBigBlock, STORAGE_magic, sizeof(STORAGE_magic));
    2927    
     2928
    29282929    /*
    29292930     * And a bunch of things we don't know what they mean
     
    29352936    StorageUtl_WriteDWord(headerBigBlock, 0x40, (DWORD)0x0001);
    29362937  }
    2937  
     2938
    29382939  /*
    29392940   * Write the information to the header.
     
    29422943  {
    29432944    StorageUtl_WriteWord(
    2944       headerBigBlock, 
    2945       OFFSET_BIGBLOCKSIZEBITS,   
     2945      headerBigBlock,
     2946      OFFSET_BIGBLOCKSIZEBITS,
    29462947      This->bigBlockSizeBits);
    29472948
    29482949    StorageUtl_WriteWord(
    2949       headerBigBlock, 
    2950       OFFSET_SMALLBLOCKSIZEBITS, 
     2950      headerBigBlock,
     2951      OFFSET_SMALLBLOCKSIZEBITS,
    29512952      This->smallBlockSizeBits);
    29522953
    29532954    StorageUtl_WriteDWord(
    2954       headerBigBlock, 
    2955       OFFSET_BBDEPOTCOUNT,     
     2955      headerBigBlock,
     2956      OFFSET_BBDEPOTCOUNT,
    29562957      This->bigBlockDepotCount);
    29572958
    29582959    StorageUtl_WriteDWord(
    2959       headerBigBlock, 
    2960       OFFSET_ROOTSTARTBLOCK,   
     2960      headerBigBlock,
     2961      OFFSET_ROOTSTARTBLOCK,
    29612962      This->rootStartBlock);
    29622963
    29632964    StorageUtl_WriteDWord(
    2964       headerBigBlock, 
    2965       OFFSET_SBDEPOTSTART,     
     2965      headerBigBlock,
     2966      OFFSET_SBDEPOTSTART,
    29662967      This->smallBlockDepotStart);
    29672968
    29682969    StorageUtl_WriteDWord(
    2969       headerBigBlock, 
    2970       OFFSET_EXTBBDEPOTSTART,   
     2970      headerBigBlock,
     2971      OFFSET_EXTBBDEPOTSTART,
    29712972      This->extBigBlockDepotStart);
    29722973
    29732974    StorageUtl_WriteDWord(
    2974       headerBigBlock, 
    2975       OFFSET_EXTBBDEPOTCOUNT,   
     2975      headerBigBlock,
     2976      OFFSET_EXTBBDEPOTCOUNT,
    29762977      This->extBigBlockDepotCount);
    29772978
     
    29792980    {
    29802981      StorageUtl_WriteDWord(
    2981         headerBigBlock, 
     2982        headerBigBlock,
    29822983        OFFSET_BBDEPOTSTART + (sizeof(ULONG)*index),
    29832984        (This->bigBlockDepotStart[index]));
    29842985    }
    29852986  }
    2986  
     2987
    29872988  /*
    29882989   * Write the big block back to the file.
     
    30083009  offsetInPropSet.s.HighPart = 0;
    30093010  offsetInPropSet.s.LowPart  = index * PROPSET_BLOCK_SIZE;
    3010  
     3011
    30113012  readSuccessful = BlockChainStream_ReadAt(
    30123013                    This->rootBlockChain,
     
    30153016                    currentProperty,
    30163017                    &bytesRead);
    3017  
     3018
    30183019  if (readSuccessful)
    30193020  {
    30203021    memset(buffer->name, 0, sizeof(buffer->name));
    30213022    memcpy(
    3022       buffer->name, 
    3023       currentProperty+OFFSET_PS_NAME, 
     3023      buffer->name,
     3024      currentProperty+OFFSET_PS_NAME,
    30243025      PROPERTY_NAME_BUFFER_LEN );
    30253026
    30263027    memcpy(&buffer->propertyType, currentProperty + OFFSET_PS_PROPERTYTYPE, 1);
    3027    
     3028
    30283029    StorageUtl_ReadWord(
    3029       currentProperty, 
    3030       OFFSET_PS_NAMELENGTH, 
     3030      currentProperty,
     3031      OFFSET_PS_NAMELENGTH,
    30313032      &buffer->sizeOfNameString);
    30323033
    30333034    StorageUtl_ReadDWord(
    3034       currentProperty, 
    3035       OFFSET_PS_PREVIOUSPROP, 
     3035      currentProperty,
     3036      OFFSET_PS_PREVIOUSPROP,
    30363037      &buffer->previousProperty);
    30373038
    30383039    StorageUtl_ReadDWord(
    3039       currentProperty, 
    3040       OFFSET_PS_NEXTPROP,     
     3040      currentProperty,
     3041      OFFSET_PS_NEXTPROP,
    30413042      &buffer->nextProperty);
    30423043
    30433044    StorageUtl_ReadDWord(
    3044       currentProperty, 
    3045       OFFSET_PS_DIRPROP,     
     3045      currentProperty,
     3046      OFFSET_PS_DIRPROP,
    30463047      &buffer->dirProperty);
    30473048
    30483049    StorageUtl_ReadGUID(
    3049       currentProperty, 
    3050       OFFSET_PS_GUID,       
     3050      currentProperty,
     3051      OFFSET_PS_GUID,
    30513052      &buffer->propertyUniqueID);
    30523053
    30533054    StorageUtl_ReadDWord(
    3054       currentProperty, 
    3055       OFFSET_PS_TSS1,         
     3055      currentProperty,
     3056      OFFSET_PS_TSS1,
    30563057      &buffer->timeStampS1);
    30573058
    30583059    StorageUtl_ReadDWord(
    3059       currentProperty, 
    3060       OFFSET_PS_TSD1,         
     3060      currentProperty,
     3061      OFFSET_PS_TSD1,
    30613062      &buffer->timeStampD1);
    30623063
    30633064    StorageUtl_ReadDWord(
    3064       currentProperty, 
    3065       OFFSET_PS_TSS2,         
     3065      currentProperty,
     3066      OFFSET_PS_TSS2,
    30663067      &buffer->timeStampS2);
    30673068
    30683069    StorageUtl_ReadDWord(
    3069       currentProperty, 
    3070       OFFSET_PS_TSD2,         
     3070      currentProperty,
     3071      OFFSET_PS_TSD2,
    30713072      &buffer->timeStampD2);
    30723073
    30733074    StorageUtl_ReadDWord(
    3074       currentProperty, 
    3075       OFFSET_PS_STARTBLOCK,   
     3075      currentProperty,
     3076      OFFSET_PS_STARTBLOCK,
    30763077      &buffer->startingBlock);
    30773078
    30783079    StorageUtl_ReadDWord(
    3079       currentProperty, 
    3080       OFFSET_PS_SIZE,         
     3080      currentProperty,
     3081      OFFSET_PS_SIZE,
    30813082      &buffer->size.s.LowPart);
    30823083
     
    31063107
    31073108  memcpy(
    3108     currentProperty + OFFSET_PS_NAME, 
    3109     buffer->name, 
     3109    currentProperty + OFFSET_PS_NAME,
     3110    buffer->name,
    31103111    PROPERTY_NAME_BUFFER_LEN );
    31113112
     
    31133114
    31143115  StorageUtl_WriteWord(
    3115     currentProperty, 
    3116       OFFSET_PS_NAMELENGTH,   
     3116    currentProperty,
     3117      OFFSET_PS_NAMELENGTH,
    31173118      buffer->sizeOfNameString);
    31183119
    31193120  StorageUtl_WriteDWord(
    3120     currentProperty, 
    3121       OFFSET_PS_PREVIOUSPROP, 
     3121    currentProperty,
     3122      OFFSET_PS_PREVIOUSPROP,
    31223123      buffer->previousProperty);
    31233124
    31243125  StorageUtl_WriteDWord(
    3125     currentProperty, 
    3126       OFFSET_PS_NEXTPROP,     
     3126    currentProperty,
     3127      OFFSET_PS_NEXTPROP,
    31273128      buffer->nextProperty);
    31283129
    31293130  StorageUtl_WriteDWord(
    3130     currentProperty, 
    3131       OFFSET_PS_DIRPROP,     
     3131    currentProperty,
     3132      OFFSET_PS_DIRPROP,
    31323133      buffer->dirProperty);
    31333134
    31343135  StorageUtl_WriteGUID(
    3135     currentProperty, 
    3136       OFFSET_PS_GUID,       
     3136    currentProperty,
     3137      OFFSET_PS_GUID,
    31373138      &buffer->propertyUniqueID);
    31383139
    31393140  StorageUtl_WriteDWord(
    3140     currentProperty, 
    3141       OFFSET_PS_TSS1,         
     3141    currentProperty,
     3142      OFFSET_PS_TSS1,
    31423143      buffer->timeStampS1);
    31433144
    31443145  StorageUtl_WriteDWord(
    3145     currentProperty, 
    3146       OFFSET_PS_TSD1,         
     3146    currentProperty,
     3147      OFFSET_PS_TSD1,
    31473148      buffer->timeStampD1);
    31483149
    31493150  StorageUtl_WriteDWord(
    3150     currentProperty, 
    3151       OFFSET_PS_TSS2,         
     3151    currentProperty,
     3152      OFFSET_PS_TSS2,
    31523153      buffer->timeStampS2);
    31533154
    31543155  StorageUtl_WriteDWord(
    3155     currentProperty, 
    3156       OFFSET_PS_TSD2,         
     3156    currentProperty,
     3157      OFFSET_PS_TSD2,
    31573158      buffer->timeStampD2);
    31583159
    31593160  StorageUtl_WriteDWord(
    3160     currentProperty, 
    3161       OFFSET_PS_STARTBLOCK,   
     3161    currentProperty,
     3162      OFFSET_PS_STARTBLOCK,
    31623163      buffer->startingBlock);
    31633164
    31643165  StorageUtl_WriteDWord(
    3165     currentProperty, 
    3166       OFFSET_PS_SIZE,         
     3166    currentProperty,
     3167      OFFSET_PS_SIZE,
    31673168      buffer->size.s.LowPart);
    31683169
     
    32103211
    32113212    StorageImpl_ReleaseBigBlock(This, bigBlockBuffer);
    3212    
     3213
    32133214    return TRUE;
    32143215  }
    3215  
     3216
    32163217  return FALSE;
    32173218}
     
    33433344
    33443345StorageInternalImpl* StorageInternalImpl_Construct(
    3345   StorageImpl* ancestorStorage, 
     3346  StorageImpl* ancestorStorage,
    33463347  ULONG          rootPropertyIndex)
    33473348{
     
    33943395** does nothing.
    33953396*/
    3396 HRESULT WINAPI StorageInternalImpl_Commit( 
     3397HRESULT WINAPI StorageInternalImpl_Commit(
    33973398  IStorage*            iface,
    3398   DWORD                  grfCommitFlags)  /* [in] */ 
     3399  DWORD                  grfCommitFlags)  /* [in] */
    33993400{
    34003401  return S_OK;
    34013402}
    3402        
     3403
    34033404/******************************************************************************
    34043405**
     
    34083409** does nothing.
    34093410*/
    3410 HRESULT WINAPI StorageInternalImpl_Revert( 
     3411HRESULT WINAPI StorageInternalImpl_Revert(
    34113412  IStorage*            iface)
    34123413{
     
    34253426
    34263427  newEnumeration = HeapAlloc(GetProcessHeap(), 0, sizeof(IEnumSTATSTGImpl));
    3427  
     3428
    34283429  if (newEnumeration!=0)
    34293430  {
     
    34333434    ICOM_VTBL(newEnumeration) = &IEnumSTATSTGImpl_Vtbl;
    34343435    newEnumeration->ref       = 0;
    3435    
     3436
    34363437    /*
    34373438     * We want to nail-down the reference to the storage in case the
     
    34403441    newEnumeration->parentStorage = parentStorage;
    34413442    IStorage_AddRef((IStorage*)newEnumeration->parentStorage);
    3442    
     3443
    34433444    newEnumeration->firstPropertyNode   = firstPropertyNode;
    3444    
     3445
    34453446    /*
    34463447     * Initialize the search stack
     
    34483449    newEnumeration->stackSize    = 0;
    34493450    newEnumeration->stackMaxSize = ENUMSTATSGT_SIZE_INCREMENT;
    3450     newEnumeration->stackToVisit = 
     3451    newEnumeration->stackToVisit =
    34513452      HeapAlloc(GetProcessHeap(), 0, sizeof(ULONG)*ENUMSTATSGT_SIZE_INCREMENT);
    3452    
     3453
    34533454    /*
    34543455     * Make sure the current node of the iterator is the first one.
     
    34563457    IEnumSTATSTGImpl_Reset((IEnumSTATSTG*)newEnumeration);
    34573458  }
    3458  
     3459
    34593460  return newEnumeration;
    34603461}
     
    34883489   * Compare the riid with the interface IDs implemented by this object.
    34893490   */
    3490   if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 
     3491  if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
    34913492  {
    34923493    *ppvObject = (IEnumSTATSTG*)This;
    34933494  }
    3494   else if (memcmp(&IID_IStorage, riid, sizeof(IID_IEnumSTATSTG)) == 0) 
     3495  else if (memcmp(&IID_IStorage, riid, sizeof(IID_IEnumSTATSTG)) == 0)
    34953496  {
    34963497    *ppvObject = (IEnumSTATSTG*)This;
     
    35113512  return S_OK;
    35123513}
    3513        
     3514
    35143515ULONG   WINAPI IEnumSTATSTGImpl_AddRef(
    35153516  IEnumSTATSTG* iface)
     
    35203521  return This->ref;
    35213522}
    3522        
     3523
    35233524ULONG   WINAPI IEnumSTATSTGImpl_Release(
    35243525  IEnumSTATSTG* iface)
     
    35593560   */
    35603561  if ( (rgelt==0) || ( (celt!=1) && (pceltFetched==0) ) )
    3561     return E_INVALIDARG; 
    3562  
     3562    return E_INVALIDARG;
     3563
    35633564  /*
    35643565   * To avoid the special case, get another pointer to a ULONG value if
     
    35673568  if (pceltFetched==0)
    35683569    pceltFetched = &objectFetched;
    3569  
     3570
    35703571  /*
    35713572   * Start the iteration, we will iterate until we hit the end of the
     
    35793580  currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE);
    35803581
    3581   while ( ( *pceltFetched < celt) && 
     3582  while ( ( *pceltFetched < celt) &&
    35823583          ( currentSearchNode!=PROPERTY_NULL) )
    35833584  {
    3584     /* 
     3585    /*
    35853586     * Remove the top node from the stack
    35863587     */
     
    35913592     */
    35923593    StorageImpl_ReadProperty(This->parentStorage,
    3593       currentSearchNode, 
     3594      currentSearchNode,
    35943595      &currentProperty);
    35953596
     
    36003601      &currentProperty,
    36013602      STATFLAG_DEFAULT);
    3602        
     3603
    36033604    /*
    36043605     * Step to the next item in the iteration
     
    36243625}
    36253626
    3626        
     3627
    36273628HRESULT WINAPI IEnumSTATSTGImpl_Skip(
    36283629  IEnumSTATSTG* iface,
     
    36403641  currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE);
    36413642
    3642   while ( (objectFetched < celt) && 
     3643  while ( (objectFetched < celt) &&
    36433644          (currentSearchNode!=PROPERTY_NULL) )
    36443645  {
    3645     /* 
     3646    /*
    36463647     * Remove the top node from the stack
    36473648     */
     
    36523653     */
    36533654    StorageImpl_ReadProperty(This->parentStorage,
    3654       currentSearchNode, 
     3655      currentSearchNode,
    36553656      &currentProperty);
    3656    
     3657
    36573658    /*
    36583659     * Step to the next item in the iteration
     
    36763677  return S_FALSE;
    36773678}
    3678        
     3679
    36793680HRESULT WINAPI IEnumSTATSTGImpl_Reset(
    36803681  IEnumSTATSTG* iface)
     
    36953696  readSuccessful = StorageImpl_ReadProperty(
    36963697                    This->parentStorage,
    3697                     This->firstPropertyNode, 
     3698                    This->firstPropertyNode,
    36983699                    &rootProperty);
    36993700
     
    37103711  return S_OK;
    37113712}
    3712        
     3713
    37133714HRESULT WINAPI IEnumSTATSTGImpl_Clone(
    37143715  IEnumSTATSTG* iface,
     
    37243725  if (ppenum==0)
    37253726    return E_INVALIDARG;
    3726  
     3727
    37273728  newClone = IEnumSTATSTGImpl_Construct(This->parentStorage,
    37283729               This->firstPropertyNode);
    37293730
    3730  
     3731
    37313732  /*
    37323733   * The new clone enumeration must point to the same current node as
     
    37353736  newClone->stackSize    = This->stackSize    ;
    37363737  newClone->stackMaxSize = This->stackMaxSize ;
    3737   newClone->stackToVisit = 
     3738  newClone->stackToVisit =
    37383739    HeapAlloc(GetProcessHeap(), 0, sizeof(ULONG) * newClone->stackMaxSize);
    37393740
    37403741  memcpy(
    3741     newClone->stackToVisit, 
    3742     This->stackToVisit, 
     3742    newClone->stackToVisit,
     3743    This->stackToVisit,
    37433744    sizeof(ULONG) * newClone->stackSize);
    37443745
     
    37563757INT IEnumSTATSTGImpl_FindParentProperty(
    37573758  IEnumSTATSTGImpl *This,
    3758   ULONG             childProperty, 
     3759  ULONG             childProperty,
    37593760  StgProperty      *currentProperty,
    37603761  ULONG            *thisNodeId)
     
    37743775   */
    37753776  currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE);
    3776  
     3777
    37773778
    37783779  while (currentSearchNode!=PROPERTY_NULL)
     
    37833784    *thisNodeId = currentSearchNode;
    37843785
    3785     /* 
     3786    /*
    37863787     * Remove the top node from the stack
    37873788     */
     
    37933794    StorageImpl_ReadProperty(
    37943795      This->parentStorage,
    3795       currentSearchNode, 
     3796      currentSearchNode,
    37963797      currentProperty);
    3797      
     3798
    37983799    if (currentProperty->previousProperty == childProperty)
    37993800      return PROPERTY_RELATION_PREVIOUS;
    38003801
    3801     else if (currentProperty->nextProperty == childProperty) 
     3802    else if (currentProperty->nextProperty == childProperty)
    38023803      return PROPERTY_RELATION_NEXT;
    3803  
     3804
    38043805    else if (currentProperty->dirProperty == childProperty)
    38053806      return PROPERTY_RELATION_DIR;
    3806        
     3807
    38073808    /*
    38083809     * Push the next search node in the search stack.
     
    38333834  while (currentSearchNode!=PROPERTY_NULL)
    38343835  {
    3835     /* 
     3836    /*
    38363837     * Remove the top node from the stack
    38373838     */
     
    38423843     */
    38433844    StorageImpl_ReadProperty(This->parentStorage,
    3844       currentSearchNode, 
     3845      currentSearchNode,
    38453846      currentProperty);
    38463847
    38473848    if ( propertyNameCmp(
    3848           (OLECHAR*)currentProperty->name, 
     3849          (OLECHAR*)currentProperty->name,
    38493850          (OLECHAR*)lpszPropName) == 0)
    38503851      return currentSearchNode;
     
    38853886
    38863887    This->stackToVisit = HeapReAlloc(
    3887                            GetProcessHeap(), 
     3888                           GetProcessHeap(),
    38883889                           0,
    38893890                           This->stackToVisit,
     
    38993900  readSuccessful = StorageImpl_ReadProperty(
    39003901                    This->parentStorage,
    3901                     nodeToPush, 
     3902                    nodeToPush,
    39023903                    &rootProperty);
    39033904
     
    39863987  else
    39873988  {
    3988     destination->pwcsName = 
     3989    destination->pwcsName =
    39893990      CoTaskMemAlloc((lstrlenW(source->name)+1)*sizeof(WCHAR));
    39903991
    39913992    strcpyW((LPWSTR)destination->pwcsName, source->name);
    39923993  }
    3993  
     3994
    39943995  switch (source->propertyType)
    39953996  {
     
    40034004    default:
    40044005      destination->type = STGTY_STREAM;
    4005       break;       
     4006      break;
    40064007  }
    40074008
    40084009  destination->cbSize            = source->size;
    4009 /*   
     4010/*
    40104011  currentReturnStruct->mtime     = {0}; TODO
    40114012  currentReturnStruct->ctime     = {0};
    4012   currentReturnStruct->atime     = {0}; 
     4013  currentReturnStruct->atime     = {0};
    40134014*/
    40144015  destination->grfMode           = 0;
    4015   destination->grfLocksSupported = 0; 
     4016  destination->grfLocksSupported = 0;
    40164017  destination->clsid             = source->propertyUniqueID;
    4017   destination->grfStateBits      = 0; 
    4018   destination->reserved          = 0; 
     4018  destination->grfStateBits      = 0;
     4019  destination->reserved          = 0;
    40194020}
    40204021
     
    40244025
    40254026BlockChainStream* BlockChainStream_Construct(
    4026   StorageImpl* parentStorage, 
     4027  StorageImpl* parentStorage,
    40274028  ULONG*         headOfStreamPlaceHolder,
    40284029  ULONG          propertyIndex)
     
    40974098 * Returns the number of blocks that comprises this chain.
    40984099 * This is not the size of the stream as the last block may not be full!
    4099  * 
     4100 *
    41004101 */
    41014102ULONG BlockChainStream_GetCount(BlockChainStream* This)
     
    41114112
    41124113    blockIndex = StorageImpl_GetNextBlockInChain(
    4113                    This->parentStorage, 
     4114                   This->parentStorage,
    41144115                   blockIndex);
    41154116  }
     
    41194120
    41204121/******************************************************************************
    4121  *      BlockChainStream_ReadAt 
     4122 *      BlockChainStream_ReadAt
    41224123 *
    41234124 * Reads a specified number of bytes from this chain at the specified offset.
     
    41594160  while ( (blockNoInSequence > 0) &&  (blockIndex != BLOCK_END_OF_CHAIN))
    41604161  {
    4161     blockIndex = 
     4162    blockIndex =
    41624163      StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex);
    4163    
     4164
    41644165    blockNoInSequence--;
    41654166  }
     
    41724173  *bytesRead   = 0;
    41734174  bufferWalker = buffer;
    4174  
     4175
    41754176  while ( (size > 0) && (blockIndex != BLOCK_END_OF_CHAIN) )
    41764177  {
     
    41784179     * Calculate how many bytes we can copy from this big block.
    41794180     */
    4180     bytesToReadInBuffer = 
     4181    bytesToReadInBuffer =
    41814182      min(This->parentStorage->bigBlockSize - offsetInBlock, size);
    4182    
     4183
    41834184    /*
    41844185     * Copy those bytes to the buffer
    41854186     */
    4186     bigBlockBuffer = 
     4187    bigBlockBuffer =
    41874188      StorageImpl_GetROBigBlock(This->parentStorage, blockIndex);
    4188    
     4189
    41894190    memcpy(bufferWalker, bigBlockBuffer + offsetInBlock, bytesToReadInBuffer);
    4190    
     4191
    41914192    StorageImpl_ReleaseBigBlock(This->parentStorage, bigBlockBuffer);
    4192    
     4193
    41934194    /*
    41944195     * Step to the next big block.
    41954196     */
    4196     blockIndex    = 
     4197    blockIndex    =
    41974198      StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex);
    41984199
     
    42034204
    42044205  }
    4205  
     4206
    42064207  return (size == 0);
    42074208}
     
    42484249  while ( (blockNoInSequence > 0) &&  (blockIndex != BLOCK_END_OF_CHAIN))
    42494250  {
    4250     blockIndex = 
     4251    blockIndex =
    42514252      StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex);
    4252    
     4253
    42534254    blockNoInSequence--;
    42544255  }
     
    42684269     * Calculate how many bytes we can copy from this big block.
    42694270     */
    4270     bytesToWrite = 
     4271    bytesToWrite =
    42714272      min(This->parentStorage->bigBlockSize - offsetInBlock, size);
    4272    
     4273
    42734274    /*
    42744275     * Copy those bytes to the buffer
    42754276     */
    42764277    bigBlockBuffer = StorageImpl_GetBigBlock(This->parentStorage, blockIndex);
    4277    
     4278
    42784279    memcpy(bigBlockBuffer + offsetInBlock, bufferWalker, bytesToWrite);
    4279    
     4280
    42804281    StorageImpl_ReleaseBigBlock(This->parentStorage, bigBlockBuffer);
    4281    
     4282
    42824283    /*
    42834284     * Step to the next big block.
    42844285     */
    4285     blockIndex    = 
     4286    blockIndex    =
    42864287      StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex);
    42874288
     
    42914292    offsetInBlock  = 0;      /* There is no offset on the next block */
    42924293  }
    4293  
     4294
    42944295  return (size == 0);
    42954296}
     
    43284329  while (count < numBlocks)
    43294330  {
    4330     blockIndex = 
     4331    blockIndex =
    43314332      StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex);
    43324333
     
    43354336
    43364337  /* Get the next block before marking the new end */
    4337   extraBlock = 
     4338  extraBlock =
    43384339    StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex);
    43394340
    43404341  /* Mark the new end of chain */
    43414342  StorageImpl_SetNextBlockInChain(
    4342     This->parentStorage, 
    4343     blockIndex, 
     4343    This->parentStorage,
     4344    blockIndex,
    43444345    BLOCK_END_OF_CHAIN);
    43454346
     
    43524353  while (extraBlock != BLOCK_END_OF_CHAIN)
    43534354  {
    4354     blockIndex = 
     4355    blockIndex =
    43554356      StorageImpl_GetNextBlockInChain(This->parentStorage, extraBlock);
    43564357
     
    43964397
    43974398      StorageImpl_ReadProperty(
    4398         This->parentStorage, 
     4399        This->parentStorage,
    43994400        This->ownerPropertyIndex,
    44004401        &chainProp);
    44014402
    4402       chainProp.startingBlock = blockIndex; 
     4403      chainProp.startingBlock = blockIndex;
    44034404
    44044405      StorageImpl_WriteProperty(
    4405         This->parentStorage, 
     4406        This->parentStorage,
    44064407        This->ownerPropertyIndex,
    44074408        &chainProp);
     
    44524453
    44534454      StorageImpl_SetNextBlockInChain(
    4454         This->parentStorage,
    4455         currentBlock,
    4456         blockIndex);
     4455    This->parentStorage,
     4456    currentBlock,
     4457    blockIndex);
    44574458
    44584459      StorageImpl_SetNextBlockInChain(
    4459         This->parentStorage, 
    4460         blockIndex,
    4461         BLOCK_END_OF_CHAIN);
     4460        This->parentStorage,
     4461    blockIndex,
     4462    BLOCK_END_OF_CHAIN);
    44624463
    44634464      currentBlock = blockIndex;
     
    44804481 * TODO: Free the actual blocks in the file when we shrink the chain.
    44814482 *       Currently, the blocks are still in the file. So the file size
    4482  *       doesn't shrink even if we shrink streams. 
     4483 *       doesn't shrink even if we shrink streams.
    44834484 */
    44844485BOOL BlockChainStream_SetSize(
     
    44974498  else
    44984499  {
    4499     ULARGE_INTEGER fileSize = 
     4500    ULARGE_INTEGER fileSize =
    45004501      BIGBLOCKFILE_GetSize(This->parentStorage->bigBlockFile);
    45014502
     
    45064507     */
    45074508    if ((diff % This->parentStorage->bigBlockSize) != 0)
    4508       diff += (This->parentStorage->bigBlockSize - 
     4509      diff += (This->parentStorage->bigBlockSize -
    45094510                (diff % This->parentStorage->bigBlockSize) );
    45104511
     
    45304531  if(This->headOfStreamPlaceHolder == NULL)
    45314532  {
    4532     /* 
    4533      * This chain is a data stream read the property and return 
     4533    /*
     4534     * This chain is a data stream read the property and return
    45344535     * the appropriate size
    45354536     */
     
    45444545  {
    45454546    /*
    4546      * this chain is a chain that does not have a property, figure out the 
    4547      * size by making the product number of used blocks times the 
     4547     * this chain is a chain that does not have a property, figure out the
     4548     * size by making the product number of used blocks times the
    45484549     * size of them
    45494550     */
     
    45514552    result.s.HighPart = 0;
    45524553
    4553     result.s.LowPart  = 
    4554       BlockChainStream_GetCount(This) * 
     4554    result.s.LowPart  =
     4555      BlockChainStream_GetCount(This) *
    45554556      This->parentStorage->bigBlockSize;
    45564557
     
    45644565
    45654566SmallBlockChainStream* SmallBlockChainStream_Construct(
    4566   StorageImpl* parentStorage, 
     4567  StorageImpl* parentStorage,
    45674568  ULONG          propertyIndex)
    45684569{
     
    46154616 *
    46164617 * Returns the index of the next small block in this chain.
    4617  * 
     4618 *
    46184619 * Return Values:
    46194620 *    - BLOCK_END_OF_CHAIN: end of this chain
     
    47424743    else
    47434744    {
    4744       ULONG count = 
     4745      ULONG count =
    47454746        BlockChainStream_GetCount(This->parentStorage->smallBlockDepotChain);
    47464747
     
    47534754      {
    47544755        sbdIndex = nextBlock;
    4755         nextBlock = 
     4756        nextBlock =
    47564757          StorageImpl_GetNextBlockInChain(This->parentStorage, sbdIndex);
    47574758      }
     
    47604761      if (sbdIndex != BLOCK_END_OF_CHAIN)
    47614762        StorageImpl_SetNextBlockInChain(
    4762           This->parentStorage, 
    4763           sbdIndex, 
     4763          This->parentStorage,
     4764          sbdIndex,
    47644765          newsbdIndex);
    47654766
    47664767      StorageImpl_SetNextBlockInChain(
    4767         This->parentStorage, 
    4768         newsbdIndex, 
     4768        This->parentStorage,
     4769        newsbdIndex,
    47694770        BLOCK_END_OF_CHAIN);
    47704771
     
    47724773       * Initialize all the small blocks to free
    47734774       */
    4774       smallBlockDepot = 
     4775      smallBlockDepot =
    47754776        StorageImpl_GetBigBlock(This->parentStorage, newsbdIndex);
    47764777
     
    47844785         */
    47854786        StgProperty rootProp;
    4786         ULONG sbStartIndex; 
     4787        ULONG sbStartIndex;
    47874788
    47884789        /*
     
    47934794
    47944795        /*
    4795          * And allocate the first big block that will contain small blocks 
     4796         * And allocate the first big block that will contain small blocks
    47964797         */
    4797         sbStartIndex = 
     4798        sbStartIndex =
    47984799          StorageImpl_GetNextFreeBigBlock(This->parentStorage);
    47994800
    48004801        StorageImpl_SetNextBlockInChain(
    4801           This->parentStorage, 
    4802           sbStartIndex, 
     4802          This->parentStorage,
     4803          sbStartIndex,
    48034804          BLOCK_END_OF_CHAIN);
    48044805
    48054806        StorageImpl_ReadProperty(
    4806           This->parentStorage, 
    4807           This->parentStorage->rootPropertySetIndex, 
     4807          This->parentStorage,
     4808          This->parentStorage->rootPropertySetIndex,
    48084809          &rootProp);
    48094810
     
    48134814
    48144815        StorageImpl_WriteProperty(
    4815           This->parentStorage, 
    4816           This->parentStorage->rootPropertySetIndex, 
     4816          This->parentStorage,
     4817          This->parentStorage->rootPropertySetIndex,
    48174818          &rootProp);
    48184819      }
     
    48204821  }
    48214822
    4822   smallBlocksPerBigBlock = 
     4823  smallBlocksPerBigBlock =
    48234824    This->parentStorage->bigBlockSize / This->parentStorage->smallBlockSize;
    48244825
     
    48324833
    48334834    StorageImpl_ReadProperty(
    4834       This->parentStorage, 
    4835       This->parentStorage->rootPropertySetIndex, 
     4835      This->parentStorage,
     4836      This->parentStorage->rootPropertySetIndex,
    48364837      &rootProp);
    48374838
    4838     if (rootProp.size.s.LowPart < 
     4839    if (rootProp.size.s.LowPart <
    48394840       (blocksRequired * This->parentStorage->bigBlockSize))
    48404841    {
     
    48424843
    48434844      BlockChainStream_SetSize(
    4844         This->parentStorage->smallBlockRootChain, 
     4845        This->parentStorage->smallBlockRootChain,
    48454846        rootProp.size);
    48464847
    48474848      StorageImpl_WriteProperty(
    4848         This->parentStorage, 
    4849         This->parentStorage->rootPropertySetIndex, 
     4849        This->parentStorage,
     4850        This->parentStorage->rootPropertySetIndex,
    48504851        &rootProp);
    48514852    }
     
    48604861 * Reads a specified number of bytes from this chain at the specified offset.
    48614862 * bytesRead may be NULL.
    4862  * Failure will be returned if the specified number of bytes has not been read. 
     4863 * Failure will be returned if the specified number of bytes has not been read.
    48634864 */
    48644865BOOL SmallBlockChainStream_ReadAt(
     
    48704871{
    48714872  ULARGE_INTEGER offsetInBigBlockFile;
    4872   ULONG blockNoInSequence = 
     4873  ULONG blockNoInSequence =
    48734874    offset.s.LowPart / This->parentStorage->smallBlockSize;
    48744875
     
    49074908     * Calculate how many bytes we can copy from this small block.
    49084909     */
    4909     bytesToReadInBuffer = 
     4910    bytesToReadInBuffer =
    49104911      min(This->parentStorage->smallBlockSize - offsetInBlock, size);
    49114912
     
    49144915     */
    49154916    offsetInBigBlockFile.s.HighPart  = 0;
    4916     offsetInBigBlockFile.s.LowPart   = 
     4917    offsetInBigBlockFile.s.LowPart   =
    49174918      blockIndex * This->parentStorage->smallBlockSize;
    49184919
     
    49584959{
    49594960  ULARGE_INTEGER offsetInBigBlockFile;
    4960   ULONG blockNoInSequence = 
     4961  ULONG blockNoInSequence =
    49614962    offset.s.LowPart / This->parentStorage->smallBlockSize;
    49624963
     
    49664967  ULONG bytesWrittenFromBigBlockFile;
    49674968  BYTE* bufferWalker;
    4968  
     4969
    49694970  /*
    49704971   * This should never happen on a small block file.
    49714972   */
    49724973  assert(offset.s.HighPart==0);
    4973  
     4974
    49744975  /*
    49754976   * Find the first block in the stream that contains part of the buffer.
    49764977   */
    49774978  blockIndex = SmallBlockChainStream_GetHeadOfChain(This);
    4978  
     4979
    49794980  while ( (blockNoInSequence > 0) &&  (blockIndex != BLOCK_END_OF_CHAIN))
    49804981  {
    49814982    blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex);
    4982    
     4983
    49834984    blockNoInSequence--;
    49844985  }
    4985  
     4986
    49864987  /*
    49874988   * Start writing the buffer.
     
    49974998     * Calculate how many bytes we can copy to this small block.
    49984999     */
    4999     bytesToWriteInBuffer = 
     5000    bytesToWriteInBuffer =
    50005001      min(This->parentStorage->smallBlockSize - offsetInBlock, size);
    5001    
     5002
    50025003    /*
    50035004     * Calculate the offset of the small block in the small block file.
    50045005     */
    50055006    offsetInBigBlockFile.s.HighPart  = 0;
    5006     offsetInBigBlockFile.s.LowPart   = 
     5007    offsetInBigBlockFile.s.LowPart   =
    50075008      blockIndex * This->parentStorage->smallBlockSize;
    50085009
    50095010    offsetInBigBlockFile.s.LowPart  += offsetInBlock;
    5010    
     5011
    50115012    /*
    50125013     * Write those bytes in the buffer to the small block file.
     
    50175018      bufferWalker,
    50185019      &bytesWrittenFromBigBlockFile);
    5019    
     5020
    50205021    assert(bytesWrittenFromBigBlockFile == bytesToWriteInBuffer);
    5021    
     5022
    50225023    /*
    50235024     * Step to the next big block.
     
    50295030    offsetInBlock  = 0;     /* There is no offset on the next block */
    50305031  }
    5031  
     5032
    50325033  return (size == 0);
    50335034}
     
    50365037 *       SmallBlockChainStream_Shrink
    50375038 *
    5038  * Shrinks this chain in the small block depot. 
     5039 * Shrinks this chain in the small block depot.
    50395040 */
    50405041BOOL SmallBlockChainStream_Shrink(
     
    50645065  /*
    50655066   * If the count is 0, we have a special case, the head of the chain was
    5066    * just freed. 
     5067   * just freed.
    50675068   */
    50685069  if (count == 0)
     
    50705071    StgProperty chainProp;
    50715072
    5072     StorageImpl_ReadProperty(This->parentStorage, 
    5073                              This->ownerPropertyIndex,
    5074                              &chainProp);
     5073    StorageImpl_ReadProperty(This->parentStorage,
     5074                 This->ownerPropertyIndex,
     5075                 &chainProp);
    50755076
    50765077    chainProp.startingBlock = BLOCK_END_OF_CHAIN;
    50775078
    50785079    StorageImpl_WriteProperty(This->parentStorage,
    5079                               This->ownerPropertyIndex,
    5080                               &chainProp);
     5080                  This->ownerPropertyIndex,
     5081                  &chainProp);
    50815082
    50825083    /*
     
    50925093    /* Mark the new end of chain */
    50935094    SmallBlockChainStream_SetNextBlockInChain(
    5094       This, 
    5095       blockIndex, 
     5095      This,
     5096      blockIndex,
    50965097      BLOCK_END_OF_CHAIN);
    50975098  }
     
    51075108  }
    51085109
    5109   return TRUE; 
     5110  return TRUE;
    51105111}
    51115112
     
    51435144    blockIndex = chainProp.startingBlock;
    51445145    SmallBlockChainStream_SetNextBlockInChain(
    5145       This, 
    5146       blockIndex, 
     5146      This,
     5147      blockIndex,
    51475148      BLOCK_END_OF_CHAIN);
    51485149  }
     
    51775178
    51785179    SmallBlockChainStream_SetNextBlockInChain(
    5179       This, 
    5180       blockIndex, 
     5180      This,
     5181      blockIndex,
    51815182      BLOCK_END_OF_CHAIN);
    51825183
     
    52195220 * TODO: Free the actual blocks in the file when we shrink the chain.
    52205221 *       Currently, the blocks are still in the file. So the file size
    5221  *       doesn't shrink even if we shrink streams. 
     5222 *       doesn't shrink even if we shrink streams.
    52225223 */
    52235224BOOL SmallBlockChainStream_SetSize(
     
    52775278  WCHAR          tempFileName[MAX_PATH];
    52785279
    5279   TRACE("(%s, %lx, %ld, %p)\n", 
    5280         debugstr_w(pwcsName), grfMode,
    5281         reserved, ppstgOpen);
     5280  TRACE("(%s, %lx, %ld, %p)\n",
     5281    debugstr_w(pwcsName), grfMode,
     5282    reserved, ppstgOpen);
    52825283
    52835284  /*
     
    53255326
    53265327  /*
    5327    * Interpret the STGM value grfMode 
     5328   * Interpret the STGM value grfMode
    53285329   */
    53295330  shareMode    = GetShareModeFromSTGM(grfMode);
     
    53505351                        fileAttributes,
    53515352            0);
    5352  
     5353
    53535354  if (hFile == INVALID_HANDLE_VALUE)
    53545355  {
     
    53605361   */
    53615362  newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageImpl));
    5362  
     5363
    53635364  if (newStorage == 0)
    53645365    return STG_E_INSUFFICIENTMEMORY;
     
    53715372         TRUE,
    53725373         TRUE);
    5373  
     5374
    53745375  if (FAILED(hr))
    53755376  {
     
    53975398  DWORD           grfMode,
    53985399  SNB           snbExclude,
    5399   DWORD           reserved, 
     5400  DWORD           reserved,
    54005401  IStorage      **ppstgOpen)
    54015402{
     
    54065407  DWORD          accessMode;
    54075408
    5408   TRACE("(%s, %p, %lx, %p, %ld, %p)\n", 
    5409         debugstr_w(pwcsName), pstgPriority, grfMode,
    5410         snbExclude, reserved, ppstgOpen);
     5409  TRACE("(%s, %p, %lx, %p, %ld, %p)\n",
     5410    debugstr_w(pwcsName), pstgPriority, grfMode,
     5411    snbExclude, reserved, ppstgOpen);
    54115412
    54125413  /*
     
    54325433   */
    54335434  *ppstgOpen = 0;
    5434  
    5435   hFile = CreateFileW( pwcsName, 
     5435
     5436  hFile = CreateFileW( pwcsName,
    54365437                       accessMode,
    54375438                       shareMode,
     
    54405441                       FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
    54415442                       0);
    5442  
    5443  
     5443
     5444
    54445445  if (hFile==INVALID_HANDLE_VALUE)
    54455446  {
     
    54775478   */
    54785479  newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageImpl));
    5479  
     5480
    54805481  if (newStorage == 0)
    54815482    return STG_E_INSUFFICIENTMEMORY;
     
    54885489         TRUE,
    54895490         FALSE);
    5490  
     5491
    54915492  if (FAILED(hr))
    54925493  {
     
    54965497     */
    54975498    if(hr == STG_E_INVALIDHEADER)
    5498         return STG_E_FILEALREADYEXISTS;
     5499    return STG_E_FILEALREADYEXISTS;
    54995500    return hr;
    55005501  }
    5501  
     5502
    55025503  /*
    55035504   * Get an "out" pointer for the caller.
     
    55075508         (REFIID)&IID_IStorage,
    55085509         (void**)ppstgOpen);
    5509  
     5510
    55105511  return hr;
    55115512}
     
    55595560         (void**)ppstgOpen);
    55605561
    5561   return hr; 
     5562  return hr;
    55625563}
    55635564
     
    55975598   */
    55985599  newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageImpl));
    5599  
     5600
    56005601  if (newStorage == 0)
    56015602    return STG_E_INSUFFICIENTMEMORY;
     
    56335634HRESULT WINAPI StgSetTimes(WCHAR * str, FILETIME * a, FILETIME * b, FILETIME *c )
    56345635{
    5635  
     5636
    56365637  FIXME("(%p, %p, %p, %p),stub!\n", str, a, b, c);
    56375638  return FALSE;
     
    56845685    STATSTG pstatstg;
    56855686    HRESULT hRes;
    5686    
     5687
    56875688    TRACE("()\n");
    56885689
     
    57075708HRESULT  WINAPI OleLoadFromStream(IStream *pStm,REFIID iidInterface,void** ppvObj)
    57085709{
    5709     CLSID       clsid;
    5710     HRESULT     res;
    5711     LPPERSISTSTREAM     xstm;
     5710    CLSID   clsid;
     5711    HRESULT res;
     5712    LPPERSISTSTREAM xstm;
    57125713
    57135714    TRACE("(%p,%s,%p)\n",pStm,debugstr_guid(iidInterface),ppvObj);
     
    57155716    res=ReadClassStm(pStm,&clsid);
    57165717    if (!SUCCEEDED(res))
    5717         return res;
     5718    return res;
    57185719    res=CoCreateInstance(&clsid,NULL,CLSCTX_INPROC_SERVER,iidInterface,ppvObj);
    57195720    if (!SUCCEEDED(res))
    5720         return res;
     5721    return res;
    57215722    res=IUnknown_QueryInterface((IUnknown*)*ppvObj,&IID_IPersistStream,(LPVOID*)&xstm);
    57225723    if (!SUCCEEDED(res)) {
    5723         IUnknown_Release((IUnknown*)*ppvObj);
    5724         return res;
     5724    IUnknown_Release((IUnknown*)*ppvObj);
     5725    return res;
    57255726    }
    57265727    res=IPersistStream_Load(xstm,pStm);
    57275728    IPersistStream_Release(xstm);
    57285729    /* FIXME: all refcounts ok at this point? I think they should be:
    5729      *          pStm    : unchanged
    5730      *          ppvObj  : 1
    5731      *          xstm    : 0 (released)
     5730     *      pStm    : unchanged
     5731     *      ppvObj  : 1
     5732     *      xstm    : 0 (released)
    57325733     */
    57335734    return res;
     
    57455746    CLSID clsid;
    57465747    HRESULT res;
    5747    
     5748
    57485749    TRACE("(%p,%p)\n",pPStm,pStm);
    57495750
     
    57515752
    57525753    if (SUCCEEDED(res)){
    5753        
     5754
    57545755        res=WriteClassStm(pStm,&clsid);
    57555756
     
    57695770 * STGM_TRANSACTED           0x00010000
    57705771 * STGM_SIMPLE               0x08000000
    5771  * 
     5772 *
    57725773 * STGM_READ                 0x00000000
    57735774 * STGM_WRITE                0x00000001
    57745775 * STGM_READWRITE            0x00000002
    5775  * 
     5776 *
    57765777 * STGM_SHARE_DENY_NONE      0x00000040
    57775778 * STGM_SHARE_DENY_READ      0x00000030
    57785779 * STGM_SHARE_DENY_WRITE     0x00000020
    57795780 * STGM_SHARE_EXCLUSIVE      0x00000010
    5780  * 
     5781 *
    57815782 * STGM_PRIORITY             0x00040000
    57825783 * STGM_DELETEONRELEASE      0x04000000
     
    57945795  BOOL bSTGM_SIMPLE           = ((stgm & STGM_SIMPLE) == STGM_SIMPLE);
    57955796  BOOL bSTGM_DIRECT           = ! (bSTGM_TRANSACTED || bSTGM_SIMPLE);
    5796    
     5797
    57975798  BOOL bSTGM_WRITE            = ((stgm & STGM_WRITE) == STGM_WRITE);
    57985799  BOOL bSTGM_READWRITE        = ((stgm & STGM_READWRITE) == STGM_READWRITE);
    57995800  BOOL bSTGM_READ             = ! (bSTGM_WRITE || bSTGM_READWRITE);
    5800    
     5801
    58015802  BOOL bSTGM_SHARE_DENY_NONE  =
    58025803                     ((stgm & STGM_SHARE_DENY_NONE)  == STGM_SHARE_DENY_NONE);
     
    58135814  BOOL bSTGM_CREATE           = ((stgm & STGM_CREATE) == STGM_CREATE);
    58145815  BOOL bSTGM_CONVERT          = ((stgm & STGM_CONVERT) == STGM_CONVERT);
    5815    
     5816
    58165817  BOOL bSTGM_NOSCRATCH        = ((stgm & STGM_NOSCRATCH) == STGM_NOSCRATCH);
    58175818  BOOL bSTGM_NOSNAPSHOT       = ((stgm & STGM_NOSNAPSHOT) == STGM_NOSNAPSHOT);
    58185819
    5819   /* 
     5820  /*
    58205821   * STGM_DIRECT | STGM_TRANSACTED | STGM_SIMPLE
    58215822   */
     
    58245825      return E_FAIL;
    58255826
    5826   /* 
     5827  /*
    58275828   * STGM_WRITE |  STGM_READWRITE | STGM_READ
    58285829   */
     
    58325833
    58335834  /*
    5834    * STGM_SHARE_DENY_NONE | others 
     5835   * STGM_SHARE_DENY_NONE | others
    58355836   * (I assume here that DENY_READ implies DENY_WRITE)
    58365837   */
    58375838  if ( bSTGM_SHARE_DENY_NONE )
    58385839    if ( bSTGM_SHARE_DENY_READ ||
    5839          bSTGM_SHARE_DENY_WRITE || 
    5840          bSTGM_SHARE_EXCLUSIVE) 
     5840         bSTGM_SHARE_DENY_WRITE ||
     5841         bSTGM_SHARE_EXCLUSIVE)
    58415842      return E_FAIL;
    58425843
     
    58535854  if ( bSTGM_NOSCRATCH && ! bSTGM_TRANSACTED )
    58545855    return E_FAIL;
    5855  
    5856   /*
    5857    * STGM_NOSNAPSHOT requires STGM_TRANSACTED and 
     5856
     5857  /*
     5858   * STGM_NOSNAPSHOT requires STGM_TRANSACTED and
    58585859   * not STGM_SHARE_EXCLUSIVE or STGM_SHARE_DENY_WRITE`
    58595860   */
    58605861  if (bSTGM_NOSNAPSHOT)
    58615862  {
    5862     if ( ! ( bSTGM_TRANSACTED && 
     5863    if ( ! ( bSTGM_TRANSACTED &&
    58635864           !(bSTGM_SHARE_EXCLUSIVE || bSTGM_SHARE_DENY_WRITE)) )
    58645865    return E_FAIL;
     
    58725873 *
    58735874 * This method will return a share mode flag from a STGM value.
    5874  * The STGM value is assumed valid. 
     5875 * The STGM value is assumed valid.
    58755876 */
    58765877static DWORD GetShareModeFromSTGM(DWORD stgm)
     
    59425943  /* All other cases */
    59435944  if (stgm & ~ (STGM_CREATE|STGM_CONVERT))
    5944         FIXME("unhandled storage mode : 0x%08lx\n",stgm & ~ (STGM_CREATE|STGM_CONVERT));
     5945    FIXME("unhandled storage mode : 0x%08lx\n",stgm & ~ (STGM_CREATE|STGM_CONVERT));
    59455946  return CREATE_NEW;
    59465947}
     
    59485949
    59495950/*************************************************************************
    5950  * OLECONVERT_LoadOLE10 [Internal] 
    5951  *
    5952  * Loads the OLE10 STREAM to memory 
     5951 * OLECONVERT_LoadOLE10 [Internal]
     5952 *
     5953 * Loads the OLE10 STREAM to memory
    59535954 *
    59545955 * PARAMS
     
    59635964 * NOTES
    59645965 *     This function is used by OleConvertOLESTREAMToIStorage only.
    5965  *     
     5966 *
    59665967 *     Memory allocated for pData must be freed by the caller
    59675968 */
    59685969HRESULT OLECONVERT_LoadOLE10(LPOLESTREAM pOleStream, OLECONVERT_OLESTREAM_DATA *pData, BOOL bStrem1)
    59695970{
    5970         DWORD dwSize;
    5971         HRESULT hRes = S_OK;
    5972         int nTryCnt=0;
    5973         int max_try = 6;
    5974 
    5975         pData->pData = NULL;
    5976         pData->pstrOleObjFileName = (CHAR *) NULL;
    5977 
    5978         for( nTryCnt=0;nTryCnt < max_try; nTryCnt++)
    5979         {
    5980         /* Get the OleID */
    5981         dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwOleID), sizeof(pData->dwOleID));
    5982         if(dwSize != sizeof(pData->dwOleID))
    5983         {
    5984                 hRes = CONVERT10_E_OLESTREAM_GET;
    5985         }
    5986         else if(pData->dwOleID != OLESTREAM_ID)
    5987         {
    5988                 hRes = CONVERT10_E_OLESTREAM_FMT;
    5989         }
    5990                 else
    5991                 {
    5992                         hRes = S_OK;
    5993                         break;
    5994                 }
    5995         }
    5996 
    5997         if(hRes == S_OK)
    5998         {
    5999                 /* Get the TypeID...more info needed for this field */
    6000                 dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwTypeID), sizeof(pData->dwTypeID));
    6001                 if(dwSize != sizeof(pData->dwTypeID))
    6002                 {
    6003                         hRes = CONVERT10_E_OLESTREAM_GET;
    6004                 }
    6005         }
    6006         if(hRes == S_OK)
    6007         {
    6008                 if(pData->dwTypeID != 0)
    6009                 {
    6010                         /* Get the lenght of the OleTypeName */
    6011                         dwSize = pOleStream->lpstbl->Get(pOleStream, (void *) &(pData->dwOleTypeNameLength), sizeof(pData->dwOleTypeNameLength));
    6012                         if(dwSize != sizeof(pData->dwOleTypeNameLength))
    6013                         {
    6014                                 hRes = CONVERT10_E_OLESTREAM_GET;
    6015                         }
    6016 
    6017                         if(hRes == S_OK)
    6018                         {
    6019                                 if(pData->dwOleTypeNameLength > 0)
    6020                                 {
    6021                                         /* Get the OleTypeName */
    6022                                         dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)pData->strOleTypeName, pData->dwOleTypeNameLength);
    6023                                         if(dwSize != pData->dwOleTypeNameLength)
    6024                                         {
    6025                                                 hRes = CONVERT10_E_OLESTREAM_GET;
    6026                                         }
    6027                                 }
    6028                         }
    6029                         if(bStrem1)
    6030                         {
    6031                                 dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwOleObjFileNameLength), sizeof(pData->dwOleObjFileNameLength));
    6032                                 if(dwSize != sizeof(pData->dwOleObjFileNameLength))
    6033                                 {
    6034                                         hRes = CONVERT10_E_OLESTREAM_GET;
    6035                                 }
    6036                         if(hRes == S_OK)
    6037                         {
    6038                                         if(pData->dwOleObjFileNameLength < 1) /* there is no file name exist */
    6039                                                 pData->dwOleObjFileNameLength = sizeof(pData->dwOleObjFileNameLength);
    6040                                         pData->pstrOleObjFileName = (CHAR *)malloc(pData->dwOleObjFileNameLength);
    6041                                         if(pData->pstrOleObjFileName)
    6042                                         {
    6043                                                 dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)(pData->pstrOleObjFileName),pData->dwOleObjFileNameLength);
    6044                                                 if(dwSize != pData->dwOleObjFileNameLength)
    6045                                                 {
    6046                                                         hRes = CONVERT10_E_OLESTREAM_GET;
    6047                                                 }
    6048                                         }
    6049                                         else
    6050                                                 hRes = CONVERT10_E_OLESTREAM_GET;
    6051                                 }
    6052                         }
    6053                         else
    6054                         {
    6055                                 /* Get the Width of the Metafile */
    6056                                 dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwMetaFileWidth), sizeof(pData->dwMetaFileWidth));
    6057                                 if(dwSize != sizeof(pData->dwMetaFileWidth))
    6058                                 {
    6059                                         hRes = CONVERT10_E_OLESTREAM_GET;
    6060                                 }
    6061                         if(hRes == S_OK)
    6062                         {
    6063                                 /* Get the Height of the Metafile */
    6064                                 dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwMetaFileHeight), sizeof(pData->dwMetaFileHeight));
    6065                                 if(dwSize != sizeof(pData->dwMetaFileHeight))
    6066                                 {
    6067                                         hRes = CONVERT10_E_OLESTREAM_GET;
    6068                                 }
    6069                         }
    6070                         }
    6071                         if(hRes == S_OK)
    6072                         {
    6073                                 /* Get the Lenght of the Data */
    6074                                 dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwDataLength), sizeof(pData->dwDataLength));
    6075                                 if(dwSize != sizeof(pData->dwDataLength))
    6076                                 {
    6077                                         hRes = CONVERT10_E_OLESTREAM_GET;
    6078                                 }
    6079                         }
    6080 
    6081                         if(hRes == S_OK) /* I don't know what is this 8 byts information is we have to figure out */
    6082                         {
    6083                                 if(!bStrem1) /* if it is a second OLE stream data */
    6084                                 {
    6085                                         pData->dwDataLength -= 8;
    6086                                         dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)(pData->strUnknown), sizeof(pData->strUnknown));
    6087                                         if(dwSize != sizeof(pData->strUnknown))
    6088                                         {
    6089                                                 hRes = CONVERT10_E_OLESTREAM_GET;
    6090                                         }
    6091                                 }
    6092                         }
    6093                         if(hRes == S_OK)
    6094                         {
    6095                                 if(pData->dwDataLength > 0)
    6096                                 {
    6097                                         pData->pData = (BYTE *)HeapAlloc(GetProcessHeap(),0,pData->dwDataLength);
    6098 
    6099                                         /* Get Data (ex. IStorage, Metafile, or BMP) */
    6100                                         if(pData->pData)
    6101                                         {
    6102                                                 dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)pData->pData, pData->dwDataLength);
    6103                                                 if(dwSize != pData->dwDataLength)
    6104                                                 {
    6105                                                         hRes = CONVERT10_E_OLESTREAM_GET;
    6106                                                 }
    6107                                         }
    6108                                         else
    6109                                         {
    6110                                                 hRes = CONVERT10_E_OLESTREAM_GET;
    6111                                         }
    6112                                 }
    6113                         }
    6114                 }
    6115         }
    6116         return hRes;
     5971    DWORD dwSize;
     5972    HRESULT hRes = S_OK;
     5973    int nTryCnt=0;
     5974    int max_try = 6;
     5975
     5976    pData->pData = NULL;
     5977    pData->pstrOleObjFileName = (CHAR *) NULL;
     5978
     5979    for( nTryCnt=0;nTryCnt < max_try; nTryCnt++)
     5980    {
     5981    /* Get the OleID */
     5982    dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwOleID), sizeof(pData->dwOleID));
     5983    if(dwSize != sizeof(pData->dwOleID))
     5984    {
     5985        hRes = CONVERT10_E_OLESTREAM_GET;
     5986    }
     5987    else if(pData->dwOleID != OLESTREAM_ID)
     5988    {
     5989        hRes = CONVERT10_E_OLESTREAM_FMT;
     5990    }
     5991        else
     5992        {
     5993            hRes = S_OK;
     5994            break;
     5995        }
     5996    }
     5997
     5998    if(hRes == S_OK)
     5999    {
     6000        /* Get the TypeID...more info needed for this field */
     6001        dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwTypeID), sizeof(pData->dwTypeID));
     6002        if(dwSize != sizeof(pData->dwTypeID))
     6003        {
     6004            hRes = CONVERT10_E_OLESTREAM_GET;
     6005        }
     6006    }
     6007    if(hRes == S_OK)
     6008    {
     6009        if(pData->dwTypeID != 0)
     6010        {
     6011            /* Get the lenght of the OleTypeName */
     6012            dwSize = pOleStream->lpstbl->Get(pOleStream, (void *) &(pData->dwOleTypeNameLength), sizeof(pData->dwOleTypeNameLength));
     6013            if(dwSize != sizeof(pData->dwOleTypeNameLength))
     6014            {
     6015                hRes = CONVERT10_E_OLESTREAM_GET;
     6016            }
     6017
     6018            if(hRes == S_OK)
     6019            {
     6020                if(pData->dwOleTypeNameLength > 0)
     6021                {
     6022                    /* Get the OleTypeName */
     6023                    dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)pData->strOleTypeName, pData->dwOleTypeNameLength);
     6024                    if(dwSize != pData->dwOleTypeNameLength)
     6025                    {
     6026                        hRes = CONVERT10_E_OLESTREAM_GET;
     6027                    }
     6028                }
     6029            }
     6030            if(bStrem1)
     6031            {
     6032                dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwOleObjFileNameLength), sizeof(pData->dwOleObjFileNameLength));
     6033                if(dwSize != sizeof(pData->dwOleObjFileNameLength))
     6034                {
     6035                    hRes = CONVERT10_E_OLESTREAM_GET;
     6036                }
     6037            if(hRes == S_OK)
     6038            {
     6039                    if(pData->dwOleObjFileNameLength < 1) /* there is no file name exist */
     6040                        pData->dwOleObjFileNameLength = sizeof(pData->dwOleObjFileNameLength);
     6041                    pData->pstrOleObjFileName = (CHAR *)malloc(pData->dwOleObjFileNameLength);
     6042                    if(pData->pstrOleObjFileName)
     6043                    {
     6044                        dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)(pData->pstrOleObjFileName),pData->dwOleObjFileNameLength);
     6045                        if(dwSize != pData->dwOleObjFileNameLength)
     6046                        {
     6047                            hRes = CONVERT10_E_OLESTREAM_GET;
     6048                        }
     6049                    }
     6050                    else
     6051                        hRes = CONVERT10_E_OLESTREAM_GET;
     6052                }
     6053            }
     6054            else
     6055            {
     6056                /* Get the Width of the Metafile */
     6057                dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwMetaFileWidth), sizeof(pData->dwMetaFileWidth));
     6058                if(dwSize != sizeof(pData->dwMetaFileWidth))
     6059                {
     6060                    hRes = CONVERT10_E_OLESTREAM_GET;
     6061                }
     6062            if(hRes == S_OK)
     6063            {
     6064                /* Get the Height of the Metafile */
     6065                dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwMetaFileHeight), sizeof(pData->dwMetaFileHeight));
     6066                if(dwSize != sizeof(pData->dwMetaFileHeight))
     6067                {
     6068                    hRes = CONVERT10_E_OLESTREAM_GET;
     6069                }
     6070            }
     6071            }
     6072            if(hRes == S_OK)
     6073            {
     6074                /* Get the Lenght of the Data */
     6075                dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)&(pData->dwDataLength), sizeof(pData->dwDataLength));
     6076                if(dwSize != sizeof(pData->dwDataLength))
     6077                {
     6078                    hRes = CONVERT10_E_OLESTREAM_GET;
     6079                }
     6080            }
     6081
     6082            if(hRes == S_OK) /* I don't know what is this 8 byts information is we have to figure out */
     6083            {
     6084                if(!bStrem1) /* if it is a second OLE stream data */
     6085                {
     6086                    pData->dwDataLength -= 8;
     6087                    dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)(pData->strUnknown), sizeof(pData->strUnknown));
     6088                    if(dwSize != sizeof(pData->strUnknown))
     6089                    {
     6090                        hRes = CONVERT10_E_OLESTREAM_GET;
     6091                    }
     6092                }
     6093            }
     6094            if(hRes == S_OK)
     6095            {
     6096                if(pData->dwDataLength > 0)
     6097                {
     6098                    pData->pData = (BYTE *)HeapAlloc(GetProcessHeap(),0,pData->dwDataLength);
     6099
     6100                    /* Get Data (ex. IStorage, Metafile, or BMP) */
     6101                    if(pData->pData)
     6102                    {
     6103                        dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)pData->pData, pData->dwDataLength);
     6104                        if(dwSize != pData->dwDataLength)
     6105                        {
     6106                            hRes = CONVERT10_E_OLESTREAM_GET;
     6107                        }
     6108                    }
     6109                    else
     6110                    {
     6111                        hRes = CONVERT10_E_OLESTREAM_GET;
     6112                    }
     6113                }
     6114            }
     6115        }
     6116    }
     6117    return hRes;
    61176118}
    61186119
    61196120/*************************************************************************
    6120  * OLECONVERT_SaveOLE10 [Internal] 
    6121  *
    6122  * Saves the OLE10 STREAM From memory 
     6121 * OLECONVERT_SaveOLE10 [Internal]
     6122 *
     6123 * Saves the OLE10 STREAM From memory
    61236124 *
    61246125 * PARAMS
     
    61326133 * NOTES
    61336134 *     This function is used by OleConvertIStorageToOLESTREAM only.
    6134  *     
     6135 *
    61356136 */
    61366137HRESULT OLECONVERT_SaveOLE10(OLECONVERT_OLESTREAM_DATA *pData, LPOLESTREAM pOleStream)
     
    62266227
    62276228/*************************************************************************
    6228  * OLECONVERT_GetOLE20FromOLE10[Internal] 
     6229 * OLECONVERT_GetOLE20FromOLE10[Internal]
    62296230 *
    62306231 * This function copies OLE10 Data (the IStorage in the OLESTREAM) to disk,
    6231  * opens it, and copies the content to the dest IStorage for 
     6232 * opens it, and copies the content to the dest IStorage for
    62326233 * OleConvertOLESTREAMToIStorage
    6233  * 
     6234 *
    62346235 *
    62356236 * PARAMS
     
    62426243 *
    62436244 * NOTES
    6244  *     
    6245  *     
     6245 *
     6246 *
    62466247 */
    62476248void OLECONVERT_GetOLE20FromOLE10(LPSTORAGE pDestStorage, BYTE *pBuffer, DWORD nBufferLength)
     
    62786279
    62796280/*************************************************************************
    6280  * OLECONVERT_WriteOLE20ToBuffer [Internal] 
    6281  *
    6282  * Saves the OLE10 STREAM From memory 
     6281 * OLECONVERT_WriteOLE20ToBuffer [Internal]
     6282 *
     6283 * Saves the OLE10 STREAM From memory
    62836284 *
    62846285 * PARAMS
     
    62936294 *
    62946295 *     Used by OleConvertIStorageToOLESTREAM only.
    6295  *     
     6296 *
    62966297 */
    62976298DWORD OLECONVERT_WriteOLE20ToBuffer(LPSTORAGE pStorage, BYTE **pData)
     
    63056306
    63066307    *pData = NULL;
    6307    
     6308
    63086309    /* Create temp Storage */
    63096310    GetTempPathW(MAX_PATH, wstrTempDir);
     
    63326333
    63336334/*************************************************************************
    6334  * OLECONVERT_CreateOleStream [Internal] 
     6335 * OLECONVERT_CreateOleStream [Internal]
    63356336 *
    63366337 * Creates the "\001OLE" stream in the IStorage if neccessary.
     
    63476348 *     This stream is still unknown, MS Word seems to have extra data
    63486349 *     but since the data is stored in the OLESTREAM there should be
    6349  *     no need to recreate the stream.  If the stream is manually 
     6350 *     no need to recreate the stream.  If the stream is manually
    63506351 *     deleted it will create it with this default data.
    6351  *     
     6352 *
    63526353 */
    63536354void OLECONVERT_CreateOleStream(LPSTORAGE pStorage)
     
    63566357    IStream *pStream;
    63576358    WCHAR wstrStreamName[] = {1,'O', 'l', 'e', 0};
    6358     BYTE pOleStreamHeader [] = 
    6359     {
    6360         0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 
    6361         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    6362         0x00, 0x00, 0x00, 0x00 
     6359    BYTE pOleStreamHeader [] =
     6360    {
     6361        0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
     6362        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     6363        0x00, 0x00, 0x00, 0x00
    63636364    };
    6364    
     6365
    63656366    /* Create stream if not present */
    6366     hRes = IStorage_CreateStream(pStorage, wstrStreamName, 
     6367    hRes = IStorage_CreateStream(pStorage, wstrStreamName,
    63676368        STGM_WRITE  | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream );
    63686369
     
    63776378
    63786379/*************************************************************************
    6379  * OLECONVERT_CreateCompObjStream [Internal] 
     6380 * OLECONVERT_CreateCompObjStream [Internal]
    63806381 *
    63816382 * Creates a "\001CompObj" is the destination IStorage if necessary.
    63826383 *
    63836384 * PARAMS
    6384  *     pStorage       [I] The dest IStorage to create the CompObj Stream 
     6385 *     pStorage       [I] The dest IStorage to create the CompObj Stream
    63856386 *                        if necessary.
    63866387 *     strOleTypeName [I] The ProgID
     
    63946395 *
    63956396 *     The stream data is stored in the OLESTREAM and there should be
    6396  *     no need to recreate the stream.  If the stream is manually 
     6397 *     no need to recreate the stream.  If the stream is manually
    63976398 *     deleted it will attempt to create it by querying the registry.
    63986399 *
    6399  *     
     6400 *
    64006401 */
    64016402HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName)
     
    64166417
    64176418    /*  Create a CompObj stream if it doesn't exist */
    6418     hStorageRes = IStorage_CreateStream(pStorage, wstrStreamName, 
     6419    hStorageRes = IStorage_CreateStream(pStorage, wstrStreamName,
    64196420        STGM_WRITE  | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream );
    64206421    if(hStorageRes == S_OK)
     
    64376438            LONG hErr;
    64386439            /* Get the CLSID Default Name from the Registry */
    6439             hErr = RegOpenKeyA(HKEY_CLASSES_ROOT, IStorageCompObj.strProgIDName, &hKey); 
     6440            hErr = RegOpenKeyA(HKEY_CLASSES_ROOT, IStorageCompObj.strProgIDName, &hKey);
    64406441            if(hErr == ERROR_SUCCESS)
    64416442            {
     
    64796480
    64806481/*************************************************************************
    6481  * OLECONVERT_CreateOlePresStream[Internal] 
     6482 * OLECONVERT_CreateOlePresStream[Internal]
    64826483 *
    64836484 * Creates the "\002OlePres000" Stream with the Metafile data
     
    64866487 *     pStorage     [I] The dest IStorage to create \002OLEPres000 stream in.
    64876488 *     dwExtentX    [I] Width of the Metafile
    6488  *     dwExtentY    [I] Height of the Metafile 
     6489 *     dwExtentY    [I] Height of the Metafile
    64896490 *     pData        [I] Metafile data
    64906491 *     dwDataLength [I] Size of the Metafile data
     
    64966497 * NOTES
    64976498 *     This function is used by OleConvertOLESTREAMToIStorage only.
    6498  *     
     6499 *
    64996500 */
    65006501void OLECONVERT_CreateOlePresStream(LPSTORAGE pStorage, DWORD dwExtentX, DWORD dwExtentY , BYTE *pData, DWORD dwDataLength)
     
    65036504    IStream *pStream;
    65046505    WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0};
    6505     BYTE pOlePresStreamHeader [] = 
    6506     {
    6507         0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 
    6508         0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
     6506    BYTE pOlePresStreamHeader [] =
     6507    {
     6508        0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
     6509        0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
    65096510        0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
    65106511        0x00, 0x00, 0x00, 0x00
    65116512    };
    65126513
    6513     BYTE pOlePresStreamHeaderEmpty [] = 
    6514     {
    6515         0x00, 0x00, 0x00, 0x00, 
    6516         0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
     6514    BYTE pOlePresStreamHeaderEmpty [] =
     6515    {
     6516        0x00, 0x00, 0x00, 0x00,
     6517        0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
    65176518        0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
    65186519        0x00, 0x00, 0x00, 0x00
    65196520    };
    6520      
     6521
    65216522    /* Create the OlePres000 Stream */
    6522     hRes = IStorage_CreateStream(pStorage, wstrStreamName, 
     6523    hRes = IStorage_CreateStream(pStorage, wstrStreamName,
    65236524        STGM_CREATE | STGM_WRITE  | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream );
    65246525
     
    65646565
    65656566/*************************************************************************
    6566  * OLECONVERT_CreateOle10NativeStream [Internal] 
     6567 * OLECONVERT_CreateOle10NativeStream [Internal]
    65676568 *
    65686569 * Creates the "\001Ole10Native" Stream (should contain a BMP)
     
    65806581 *
    65816582 *     Might need to verify the data and return appropriate error message
    6582  *     
     6583 *
    65836584 */
    65846585void OLECONVERT_CreateOle10NativeStream(LPSTORAGE pStorage, BYTE *pData, DWORD dwDataLength)
     
    65876588    IStream *pStream;
    65886589    WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0};
    6589    
     6590
    65906591    /* Create the Ole10Native Stream */
    6591     hRes = IStorage_CreateStream(pStorage, wstrStreamName, 
     6592    hRes = IStorage_CreateStream(pStorage, wstrStreamName,
    65926593        STGM_CREATE | STGM_WRITE  | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream );
    65936594
     
    66036604
    66046605/*************************************************************************
    6605  * OLECONVERT_GetOLE10ProgID [Internal] 
     6606 * OLECONVERT_GetOLE10ProgID [Internal]
    66066607 *
    66076608 * Finds the ProgID (or OleTypeID) from the IStorage
     
    66196620 *     This function is used by OleConvertIStorageToOLESTREAM only.
    66206621 *
    6621  *     
     6622 *
    66226623 */
    66236624HRESULT OLECONVERT_GetOLE10ProgID(LPSTORAGE pStorage, char *strProgID, DWORD *dwSize)
     
    66306631
    66316632    /* Open the CompObj Stream */
    6632     hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, 
     6633    hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL,
    66336634        STGM_READ  | STGM_SHARE_EXCLUSIVE, 0, &pStream );
    66346635    if(hRes == S_OK)
     
    66676668            *dwSize = WideCharToMultiByte(CP_ACP, 0, wstrProgID, -1, strProgID, *dwSize, NULL, FALSE);
    66686669        }
    6669  
     6670
    66706671    }
    66716672    return hRes;
     
    66736674
    66746675/*************************************************************************
    6675  * OLECONVERT_GetOle10PresData [Internal] 
     6676 * OLECONVERT_GetOle10PresData [Internal]
    66766677 *
    66776678 * Converts IStorage "/001Ole10Native" stream to a OLE10 Stream
     
    66886689 *
    66896690 *     Memory allocated for pData must be freed by the caller
    6690  *     
    6691  *     
     6691 *
     6692 *
    66926693 */
    66936694void OLECONVERT_GetOle10PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA *pOleStreamData)
     
    67096710
    67106711    /* Open Ole10Native Stream */
    6711     hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, 
     6712    hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL,
    67126713        STGM_READ  | STGM_SHARE_EXCLUSIVE, 0, &pStream );
    67136714    if(hRes == S_OK)
     
    67286729
    67296730/*************************************************************************
    6730  * OLECONVERT_GetOle20PresData[Internal] 
     6731 * OLECONVERT_GetOle20PresData[Internal]
    67316732 *
    67326733 * Converts IStorage "/002OlePres000" stream to a OLE10 Stream
     
    67416742 * NOTES
    67426743 *     This function is used by OleConvertIStorageToOLESTREAM only.
    6743  *     
     6744 *
    67446745 *     Memory allocated for pData must be freed by the caller
    67456746 */
     
    67686769
    67696770    /* Open OlePress000 stream */
    6770     hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, 
     6771    hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL,
    67716772        STGM_READ  | STGM_SHARE_EXCLUSIVE, 0, &pStream );
    67726773    if(hRes == S_OK)
     
    68166817
    68176818/*************************************************************************
    6818  * OleConvertOLESTREAMToIStorage [OLE32.87] 
     6819 * OleConvertOLESTREAMToIStorage [OLE32.87]
    68196820 *
    68206821 * Read info on MSDN
     
    68256826 *      Still some unknowns for the IStorage: "\002OlePres000", "\001CompObj",
    68266827 *      and "\001OLE" streams
    6827  *     
     6828 *
    68286829 */
    68296830HRESULT WINAPI OleConvertOLESTREAMToIStorage (
    6830     LPOLESTREAM pOleStream, 
    6831     LPSTORAGE pstg, 
     6831    LPOLESTREAM pOleStream,
     6832    LPSTORAGE pstg,
    68326833    const DVTARGETDEVICE* ptd)
    68336834{
     
    69016902        }
    69026903        if(pOleStreamData[i].pstrOleObjFileName != NULL)
    6903         {
    6904                 HeapFree(GetProcessHeap(),0,pOleStreamData[i].pstrOleObjFileName);
    6905                 pOleStreamData[i].pstrOleObjFileName = NULL;
    6906         }
     6904    {
     6905            HeapFree(GetProcessHeap(),0,pOleStreamData[i].pstrOleObjFileName);
     6906            pOleStreamData[i].pstrOleObjFileName = NULL;
     6907    }
    69076908    }
    69086909    return hRes;
     
    69206921 *      Still some unknowns for the IStorage: "\002OlePres000", "\001CompObj",
    69216922 *      and "\001OLE" streams.
    6922  *     
     6923 *
    69236924 */
    69246925HRESULT WINAPI OleConvertIStorageToOLESTREAM (
    6925     LPSTORAGE pstg, 
     6926    LPSTORAGE pstg,
    69266927    LPOLESTREAM pOleStream)
    69276928{
     
    69486949    {
    69496950        /*Was it originaly Ole10 */
    6950         hRes = IStorage_OpenStream(pstg, wstrStreamName, 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream);   
     6951        hRes = IStorage_OpenStream(pstg, wstrStreamName, 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream);
    69516952        if(hRes == S_OK)
    69526953        {
     
    69836984
    69846985/***********************************************************************
    6985  *              GetConvertStg (OLE32.68)
     6986 *      GetConvertStg (OLE32.68)
    69866987 */
    69876988HRESULT WINAPI GetConvertStg(LPGUID guid) {
     
    69976998 */
    69986999HRESULT WINAPI StgIsStorageFile16(LPCOLESTR16 fn) {
    6999         HFILE           hf;
    7000         OFSTRUCT        ofs;
    7001         BYTE            magic[24];
    7002 
    7003         TRACE("(\'%s\')\n",fn);
    7004         hf = OpenFile(fn,&ofs,OF_SHARE_DENY_NONE);
    7005         if (hf==HFILE_ERROR)
    7006                 return STG_E_FILENOTFOUND;
    7007         if (24!=_lread(hf,magic,24)) {
    7008                 WARN(" too short\n");
    7009                 _lclose(hf);
    7010                 return S_FALSE;
    7011         }
    7012         if (!memcmp(magic,STORAGE_magic,8)) {
    7013                 WARN(" -> YES\n");
    7014                 _lclose(hf);
    7015                 return S_OK;
    7016         }
    7017         if (!memcmp(magic,STORAGE_notmagic,8)) {
    7018                 WARN(" -> NO\n");
    7019                 _lclose(hf);
    7020                 return S_FALSE;
    7021         }
    7022         if (!memcmp(magic,STORAGE_oldmagic,8)) {
    7023                 WARN(" -> old format\n");
    7024                 _lclose(hf);
    7025                 return STG_E_OLDFORMAT;
    7026         }
    7027         WARN(" -> Invalid header.\n");
    7028         _lclose(hf);
    7029         return STG_E_INVALIDHEADER;
     7000    HFILE       hf;
     7001    OFSTRUCT    ofs;
     7002    BYTE        magic[24];
     7003
     7004    TRACE("(\'%s\')\n",fn);
     7005    hf = OpenFile(fn,&ofs,OF_SHARE_DENY_NONE);
     7006    if (hf==HFILE_ERROR)
     7007        return STG_E_FILENOTFOUND;
     7008    if (24!=_lread(hf,magic,24)) {
     7009        WARN(" too short\n");
     7010        _lclose(hf);
     7011        return S_FALSE;
     7012    }
     7013    if (!memcmp(magic,STORAGE_magic,8)) {
     7014        WARN(" -> YES\n");
     7015        _lclose(hf);
     7016        return S_OK;
     7017    }
     7018    if (!memcmp(magic,STORAGE_notmagic,8)) {
     7019        WARN(" -> NO\n");
     7020        _lclose(hf);
     7021        return S_FALSE;
     7022    }
     7023    if (!memcmp(magic,STORAGE_oldmagic,8)) {
     7024        WARN(" -> old format\n");
     7025        _lclose(hf);
     7026        return STG_E_OLDFORMAT;
     7027    }
     7028    WARN(" -> Invalid header.\n");
     7029    _lclose(hf);
     7030    return STG_E_INVALIDHEADER;
    70307031}
    70317032
     
    70337034 * StgIsStorageFile [OLE32.146]
    70347035 */
    7035 HRESULT WINAPI 
    7036 StgIsStorageFile(LPCOLESTR fn) 
    7037 {
    7038         LPOLESTR16      xfn = HEAP_strdupWtoA(GetProcessHeap(),0,fn);
    7039         HRESULT ret = StgIsStorageFile16(xfn);
    7040 
    7041         HeapFree(GetProcessHeap(),0,xfn);
    7042         return ret;
     7036HRESULT WINAPI
     7037StgIsStorageFile(LPCOLESTR fn)
     7038{
     7039    LPOLESTR16  xfn = HEAP_strdupWtoA(GetProcessHeap(),0,fn);
     7040    HRESULT ret = StgIsStorageFile16(xfn);
     7041
     7042    HeapFree(GetProcessHeap(),0,xfn);
     7043    return ret;
    70437044}
    70447045#endif
Note: See TracChangeset for help on using the changeset viewer.