Ignore:
Timestamp:
Jun 9, 2002, 6:37:22 PM (23 years ago)
Author:
sandervl
Message:

Resync with latest Wine

File:
1 edited

Legend:

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

    r8441 r8620  
    2424 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    2525 */
    26 
    2726#ifdef __WIN32OS2__
    2827#include "ole32.h"
     
    6059/* OLESTREAM memory structure to use for Get and Put Routines */
    6160/* Used for OleConvertIStorageToOLESTREAM and OleConvertOLESTREAMToIStorage */
    62 typedef struct 
     61typedef struct
    6362{
    6463    DWORD dwOleID;
     
    9897    DWORD dwExtentX;
    9998    DWORD dwExtentY;
    100     DWORD dwSize; 
     99    DWORD dwSize;
    101100    BYTE *pData;
    102101}OLECONVERT_ISTORAGE_OLEPRES;
     
    123122  INT         typeOfRelation);
    124123
    125 static HRESULT adjustPropertyChain( 
     124static HRESULT adjustPropertyChain(
    126125  StorageImpl *This,
    127126  StgProperty   propertyToDelete,
     
    150149 * Declaration of miscellaneous functions...
    151150 */
    152 static HRESULT validateSTGM(DWORD stgmValue); 
     151static HRESULT validateSTGM(DWORD stgmValue);
    153152
    154153static DWORD GetShareModeFromSTGM(DWORD stgm);
     
    236235 * This method implements the common QueryInterface for all IStorage32
    237236 * implementations contained in this file.
    238  * 
     237 *
    239238 * See Windows documentation for more details on IUnknown methods.
    240239 */
     
    250249  if ( (This==0) || (ppvObject==0) )
    251250    return E_INVALIDARG;
    252  
     251
    253252  /*
    254253   * Initialize the return parameter.
    255254   */
    256255  *ppvObject = 0;
    257  
     256
    258257  /*
    259258   * Compare the riid with the interface IDs implemented by this object.
    260259   */
    261   if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 
     260  if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
    262261  {
    263262    *ppvObject = (IStorage*)This;
    264263  }
    265   else if (memcmp(&IID_IStorage, riid, sizeof(IID_IStorage)) == 0) 
     264  else if (memcmp(&IID_IStorage, riid, sizeof(IID_IStorage)) == 0)
    266265  {
    267266    *ppvObject = (IStorage*)This;
    268267  }
    269  
     268
    270269  /*
    271270   * Check that we obtained an interface.
     
    273272  if ((*ppvObject)==0)
    274273    return E_NOINTERFACE;
    275  
     274
    276275  /*
    277276   * Query Interface always increases the reference count by one when it is
     
    282281  return S_OK;
    283282}
    284        
     283
    285284/************************************************************************
    286285 * Storage32BaseImpl_AddRef (IUnknown)
     
    288287 * This method implements the common AddRef for all IStorage32
    289288 * implementations contained in this file.
    290  * 
     289 *
    291290 * See Windows documentation for more details on IUnknown methods.
    292291 */
    293 ULONG WINAPI StorageBaseImpl_AddRef( 
     292ULONG WINAPI StorageBaseImpl_AddRef(
    294293            IStorage* iface)
    295294{
     
    299298  return This->ref;
    300299}
    301        
     300
    302301/************************************************************************
    303302 * Storage32BaseImpl_Release (IUnknown)
     
    305304 * This method implements the common Release for all IStorage32
    306305 * implementations contained in this file.
    307  * 
     306 *
    308307 * See Windows documentation for more details on IUnknown methods.
    309308 */
    310 ULONG WINAPI StorageBaseImpl_Release( 
     309ULONG WINAPI StorageBaseImpl_Release(
    311310      IStorage* iface)
    312311{
     
    323322  {
    324323    /*
    325      * Since we are using a system of base-classes, we want to call the 
    326      * destructor of the appropriate derived class. To do this, we are 
     324     * Since we are using a system of base-classes, we want to call the
     325     * destructor of the appropriate derived class. To do this, we are
    327326     * using virtual functions to implement the destructor.
    328327     */
     
    331330    return 0;
    332331  }
    333  
     332
    334333  return This->ref;
    335334}
     
    342341 * See Windows documentation for more details on IStorage methods.
    343342 */
    344 HRESULT WINAPI StorageBaseImpl_OpenStream( 
     343HRESULT WINAPI StorageBaseImpl_OpenStream(
    345344  IStorage*        iface,
    346345  const OLECHAR*   pwcsName,  /* [string][in] */
    347346  void*            reserved1, /* [unique][in] */
    348   DWORD            grfMode,   /* [in]  */       
    349   DWORD            reserved2, /* [in]  */       
    350   IStream**        ppstm)     /* [out] */       
     347  DWORD            grfMode,   /* [in]  */
     348  DWORD            reserved2, /* [in]  */
     349  IStream**        ppstm)     /* [out] */
    351350{
    352351  ICOM_THIS(StorageBaseImpl,iface);
     
    357356  HRESULT           res = STG_E_UNKNOWN;
    358357
    359   TRACE("(%p, %s, %p, %lx, %ld, %p)\n", 
     358  TRACE("(%p, %s, %p, %lx, %ld, %p)\n",
    360359        iface, debugstr_w(pwcsName), reserved1, grfMode, reserved2, ppstm);
    361360
     
    368367    goto end;
    369368  }
    370  
     369
    371370  /*
    372371   * Initialize the out parameter
    373372   */
    374373  *ppstm = NULL;
    375  
     374
    376375  /*
    377376   * Validate the STGM flags
     
    398397   */
    399398  propertyEnumeration = IEnumSTATSTGImpl_Construct(
    400     This->ancestorStorage, 
     399    This->ancestorStorage,
    401400    This->rootPropertySetIndex);
    402  
     401
    403402  /*
    404403   * Search the enumeration for the property with the given name
     
    408407    pwcsName,
    409408    &currentProperty);
    410  
     409
    411410  /*
    412411   * Delete the property enumeration since we don't need it anymore
    413412   */
    414413  IEnumSTATSTGImpl_Destroy(propertyEnumeration);
    415  
     414
    416415  /*
    417416   * If it was found, construct the stream object and return a pointer to it.
    418417   */
    419   if ( (foundPropertyIndex!=PROPERTY_NULL) && 
     418  if ( (foundPropertyIndex!=PROPERTY_NULL) &&
    420419       (currentProperty.propertyType==PROPTYPE_STREAM) )
    421420  {
    422421    newStream = StgStreamImpl_Construct(This, grfMode, foundPropertyIndex);
    423    
     422
    424423    if (newStream!=0)
    425424    {
     
    428427
    429428      /*
    430        * Since we are returning a pointer to the interface, we have to 
     429       * Since we are returning a pointer to the interface, we have to
    431430       * nail down the reference.
    432431       */
    433432      StgStreamImpl_AddRef(*ppstm);
    434      
     433
    435434      res = S_OK;
    436435      goto end;
    437436    }
    438    
     437
    439438    res = E_OUTOFMEMORY;
    440439    goto end;
    441440  }
    442  
     441
    443442  res = STG_E_FILENOTFOUND;
    444443
     
    454453 *
    455454 * This method will open a new storage object from the current storage.
    456  * 
     455 *
    457456 * See Windows documentation for more details on IStorage methods.
    458  */       
    459 HRESULT WINAPI StorageBaseImpl_OpenStorage( 
     457 */
     458HRESULT WINAPI StorageBaseImpl_OpenStorage(
    460459  IStorage*        iface,
    461   const OLECHAR*   pwcsName,      /* [string][unique][in] */ 
    462   IStorage*        pstgPriority,  /* [unique][in] */         
    463   DWORD            grfMode,       /* [in] */                 
    464   SNB              snbExclude,    /* [unique][in] */         
    465   DWORD            reserved,      /* [in] */                 
    466   IStorage**       ppstg)         /* [out] */                       
     460  const OLECHAR*   pwcsName,      /* [string][unique][in] */
     461  IStorage*        pstgPriority,  /* [unique][in] */
     462  DWORD            grfMode,       /* [in] */
     463  SNB              snbExclude,    /* [unique][in] */
     464  DWORD            reserved,      /* [in] */
     465  IStorage**       ppstg)         /* [out] */
    467466{
    468467  ICOM_THIS(StorageBaseImpl,iface);
     
    473472  HRESULT                res = STG_E_UNKNOWN;
    474473
    475   TRACE("(%p, %s, %p, %lx, %p, %ld, %p)\n", 
    476         iface, debugstr_w(pwcsName), pstgPriority, 
     474  TRACE("(%p, %s, %p, %lx, %p, %ld, %p)\n",
     475        iface, debugstr_w(pwcsName), pstgPriority,
    477476        grfMode, snbExclude, reserved, ppstg);
    478  
     477
    479478  /*
    480479   * Perform a sanity check on the parameters.
     
    485484    goto end;
    486485  }
    487  
     486
    488487  /* as documented */
    489488  if (snbExclude != NULL)
     
    492491    goto end;
    493492  }
    494  
     493
    495494  /*
    496495   * Validate the STGM flags
     
    505504   * As documented.
    506505   */
    507   if ( !(grfMode & STGM_SHARE_EXCLUSIVE) || 
     506  if ( !(grfMode & STGM_SHARE_EXCLUSIVE) ||
    508507        (grfMode & STGM_DELETEONRELEASE) ||
    509508        (grfMode & STGM_PRIORITY) )
     
    517516   */
    518517  *ppstg = NULL;
    519  
     518
    520519  /*
    521520   * Create a property enumeration to search the properties
    522521   */
    523522  propertyEnumeration = IEnumSTATSTGImpl_Construct(
    524                           This->ancestorStorage, 
     523                          This->ancestorStorage,
    525524                          This->rootPropertySetIndex);
    526  
     525
    527526  /*
    528527   * Search the enumeration for the property with the given name
     
    532531                         pwcsName,
    533532                         &currentProperty);
    534  
     533
    535534  /*
    536535   * Delete the property enumeration since we don't need it anymore
    537536   */
    538537  IEnumSTATSTGImpl_Destroy(propertyEnumeration);
    539  
     538
    540539  /*
    541540   * If it was found, construct the stream object and return a pointer to it.
    542541   */
    543   if ( (foundPropertyIndex!=PROPERTY_NULL) && 
     542  if ( (foundPropertyIndex!=PROPERTY_NULL) &&
    544543       (currentProperty.propertyType==PROPTYPE_STORAGE) )
    545544  {
     
    550549                   This->ancestorStorage,
    551550                   foundPropertyIndex);
    552    
     551
    553552    if (newStorage != 0)
    554553    {
     
    556555
    557556      /*
    558        * Since we are returning a pointer to the interface, 
     557       * Since we are returning a pointer to the interface,
    559558       * we have to nail down the reference.
    560559       */
    561560      StorageBaseImpl_AddRef(*ppstg);
    562      
     561
    563562      res = S_OK;
    564563      goto end;
    565564    }
    566    
     565
    567566    res = STG_E_INSUFFICIENTMEMORY;
    568567    goto end;
    569568  }
    570  
     569
    571570  res = STG_E_FILENOTFOUND;
    572571
     
    579578 * Storage32BaseImpl_EnumElements (IStorage)
    580579 *
    581  * This method will create an enumerator object that can be used to 
     580 * This method will create an enumerator object that can be used to
    582581 * retrieve informatino about all the properties in the storage object.
    583  * 
     582 *
    584583 * See Windows documentation for more details on IStorage methods.
    585  */       
    586 HRESULT WINAPI StorageBaseImpl_EnumElements( 
     584 */
     585HRESULT WINAPI StorageBaseImpl_EnumElements(
    587586  IStorage*       iface,
    588   DWORD           reserved1, /* [in] */                 
    589   void*           reserved2, /* [size_is][unique][in] */ 
    590   DWORD           reserved3, /* [in] */                 
    591   IEnumSTATSTG**  ppenum)    /* [out] */                 
     587  DWORD           reserved1, /* [in] */
     588  void*           reserved2, /* [size_is][unique][in] */
     589  DWORD           reserved3, /* [in] */
     590  IEnumSTATSTG**  ppenum)    /* [out] */
    592591{
    593592  ICOM_THIS(StorageBaseImpl,iface);
    594593  IEnumSTATSTGImpl* newEnum;
    595594
    596   TRACE("(%p, %ld, %p, %ld, %p)\n", 
     595  TRACE("(%p, %ld, %p, %ld, %p)\n",
    597596        iface, reserved1, reserved2, reserved3, ppenum);
    598597
     
    602601  if ( (This==0) || (ppenum==0))
    603602    return E_INVALIDARG;
    604  
     603
    605604  /*
    606605   * Construct the enumerator.
     
    619618     */
    620619    IEnumSTATSTGImpl_AddRef(*ppenum);
    621    
     620
    622621    return S_OK;
    623622  }
     
    630629 *
    631630 * This method will retrieve information about this storage object.
    632  * 
     631 *
    633632 * See Windows documentation for more details on IStorage methods.
    634  */       
    635 HRESULT WINAPI StorageBaseImpl_Stat( 
     633 */
     634HRESULT WINAPI StorageBaseImpl_Stat(
    636635  IStorage*        iface,
    637   STATSTG*         pstatstg,     /* [out] */ 
    638   DWORD            grfStatFlag)  /* [in] */ 
     636  STATSTG*         pstatstg,     /* [out] */
     637  DWORD            grfStatFlag)  /* [in] */
    639638{
    640639  ICOM_THIS(StorageBaseImpl,iface);
     
    643642  HRESULT        res = STG_E_UNKNOWN;
    644643
    645   TRACE("(%p, %p, %lx)\n", 
     644  TRACE("(%p, %p, %lx)\n",
    646645        iface, pstatstg, grfStatFlag);
    647646
     
    666665  {
    667666    StorageUtl_CopyPropertyToSTATSTG(
    668       pstatstg, 
    669       &curProperty, 
     667      pstatstg,
     668      &curProperty,
    670669      grfStatFlag);
    671    
     670
    672671    res = S_OK;
    673672    goto end;
    674673  }
    675  
     674
    676675  res = E_FAIL;
    677676
     
    688687 * Storage32BaseImpl_RenameElement (IStorage)
    689688 *
    690  * This method will rename the specified element. 
     689 * This method will rename the specified element.
    691690 *
    692691 * See Windows documentation for more details on IStorage methods.
    693  * 
    694  * Implementation notes: The method used to rename consists of creating a clone 
    695  *    of the deleted StgProperty object setting it with the new name and to 
     692 *
     693 * Implementation notes: The method used to rename consists of creating a clone
     694 *    of the deleted StgProperty object setting it with the new name and to
    696695 *    perform a DestroyElement of the old StgProperty.
    697696 */
     
    706705  ULONG             foundPropertyIndex;
    707706
    708   TRACE("(%p, %s, %s)\n", 
     707  TRACE("(%p, %s, %s)\n",
    709708        iface, debugstr_w(pwcsOldName), debugstr_w(pwcsNewName));
    710709
     
    753752     * Setup a new property for the renamed property
    754753     */
    755     renamedProperty.sizeOfNameString = 
     754    renamedProperty.sizeOfNameString =
    756755      ( lstrlenW(pwcsNewName)+1 ) * sizeof(WCHAR);
    757  
     756
    758757    if (renamedProperty.sizeOfNameString > PROPERTY_NAME_BUFFER_LEN)
    759758      return STG_E_INVALIDNAME;
    760  
     759
    761760    strcpyW(renamedProperty.name, pwcsNewName);
    762  
     761
    763762    renamedProperty.propertyType  = currentProperty.propertyType;
    764763    renamedProperty.startingBlock = currentProperty.startingBlock;
    765764    renamedProperty.size.s.LowPart  = currentProperty.size.s.LowPart;
    766765    renamedProperty.size.s.HighPart = currentProperty.size.s.HighPart;
    767  
     766
    768767    renamedProperty.previousProperty = PROPERTY_NULL;
    769768    renamedProperty.nextProperty     = PROPERTY_NULL;
    770  
     769
    771770    /*
    772771     * Bring the dirProperty link in case it is a storage and in which
     
    774773     */
    775774    renamedProperty.dirProperty = currentProperty.dirProperty;
    776  
    777     /* call CoFileTime to get the current time 
     775
     776    /* call CoFileTime to get the current time
    778777    renamedProperty.timeStampS1
    779778    renamedProperty.timeStampD1
    780779    renamedProperty.timeStampS2
    781780    renamedProperty.timeStampD2
    782     renamedProperty.propertyUniqueID 
     781    renamedProperty.propertyUniqueID
    783782    */
    784  
    785     /* 
     783
     784    /*
    786785     * Obtain a free property in the property chain
    787786     */
    788787    renamedPropertyIndex = getFreeProperty(This->ancestorStorage);
    789  
     788
    790789    /*
    791790     * Save the new property into the new property spot
    792      */ 
     791     */
    793792    StorageImpl_WriteProperty(
    794793      This->ancestorStorage,
    795       renamedPropertyIndex, 
     794      renamedPropertyIndex,
    796795      &renamedProperty);
    797  
    798     /* 
     796
     797    /*
    799798     * Find a spot in the property chain for our newly created property.
    800799     */
    801800    updatePropertyChain(
    802801      (StorageImpl*)This,
    803       renamedPropertyIndex, 
     802      renamedPropertyIndex,
    804803      renamedProperty);
    805804
    806805    /*
    807      * At this point the renamed property has been inserted in the tree, 
    808      * now, before to Destroy the old property we must zeroed it's dirProperty 
    809      * otherwise the DestroyProperty below will zap it all and we do not want 
     806     * At this point the renamed property has been inserted in the tree,
     807     * now, before to Destroy the old property we must zeroed it's dirProperty
     808     * otherwise the DestroyProperty below will zap it all and we do not want
    810809     * this to happen.
    811810     * Also, we fake that the old property is a storage so the DestroyProperty
    812811     * will not do a SetSize(0) on the stream data.
    813      * 
     812     *
    814813     * This means that we need to tweek the StgProperty if it is a stream or a
    815814     * non empty storage.
     
    823822    StorageImpl_WriteProperty(
    824823      This->ancestorStorage,
    825       foundPropertyIndex, 
     824      foundPropertyIndex,
    826825      &currentProperty);
    827826
    828     /* 
    829      * Invoke Destroy to get rid of the ole property and automatically redo 
    830      * the linking of it's previous and next members... 
    831      */ 
    832     StorageImpl_DestroyElement((IStorage*)This->ancestorStorage, pwcsOldName); 
     827    /*
     828     * Invoke Destroy to get rid of the ole property and automatically redo
     829     * the linking of it's previous and next members...
     830     */
     831    StorageImpl_DestroyElement((IStorage*)This->ancestorStorage, pwcsOldName);
    833832
    834833  }
     
    847846 * Storage32BaseImpl_CreateStream (IStorage)
    848847 *
    849  * This method will create a stream object within this storage 
     848 * This method will create a stream object within this storage
    850849 *
    851850 * See Windows documentation for more details on IStorage methods.
     
    865864  ULONG             foundPropertyIndex, newPropertyIndex;
    866865
    867   TRACE("(%p, %s, %lx, %ld, %ld, %p)\n", 
    868         iface, debugstr_w(pwcsName), grfMode, 
     866  TRACE("(%p, %s, %lx, %ld, %ld, %p)\n",
     867        iface, debugstr_w(pwcsName), grfMode,
    869868        reserved1, reserved2, ppstm);
    870869
     
    912911  {
    913912    /*
    914      * An element with this name already exists 
     913     * An element with this name already exists
    915914     */
    916915    if (grfMode & STGM_CREATE)
    917916    {
    918       IStorage_DestroyElement(iface, pwcsName); 
    919     }
    920     else 
     917      IStorage_DestroyElement(iface, pwcsName);
     918    }
     919    else
    921920      return STG_E_FILEALREADYEXISTS;
    922921  }
    923922
    924   /* 
    925    * memset the empty property 
     923  /*
     924   * memset the empty property
    926925   */
    927926  memset(&newStreamProperty, 0, sizeof(StgProperty));
     
    944943  newStreamProperty.dirProperty      = PROPERTY_NULL;
    945944
    946   /* call CoFileTime to get the current time 
     945  /* call CoFileTime to get the current time
    947946  newStreamProperty.timeStampS1
    948947  newStreamProperty.timeStampD1
     
    954953
    955954  /*
    956    * Get a free property or create a new one 
     955   * Get a free property or create a new one
    957956   */
    958957  newPropertyIndex = getFreeProperty(This->ancestorStorage);
     
    960959  /*
    961960   * Save the new property into the new property spot
    962    */ 
     961   */
    963962  StorageImpl_WriteProperty(
    964963    This->ancestorStorage,
    965     newPropertyIndex, 
     964    newPropertyIndex,
    966965    &newStreamProperty);
    967966
    968   /* 
     967  /*
    969968   * Find a spot in the property chain for our newly created property.
    970969   */
    971970  updatePropertyChain(
    972971    (StorageImpl*)This,
    973     newPropertyIndex, 
     972    newPropertyIndex,
    974973    newStreamProperty);
    975974
    976   /* 
     975  /*
    977976   * Open the stream to return it.
    978977   */
     
    1000999 * Storage32BaseImpl_SetClass (IStorage)
    10011000 *
    1002  * This method will write the specified CLSID in the property of this 
     1001 * This method will write the specified CLSID in the property of this
    10031002 * storage.
    10041003 *
     
    10151014
    10161015  TRACE("(%p, %p)\n", iface, clsid);
    1017  
     1016
    10181017  success = StorageImpl_ReadProperty(This->ancestorStorage,
    10191018                                       This->rootPropertySetIndex,
     
    10361035** Storage32Impl implementation
    10371036*/
    1038        
     1037
    10391038/************************************************************************
    10401039 * Storage32Impl_CreateStorage (IStorage)
     
    10441043 * See Windows documentation for more details on IStorage methods.
    10451044 */
    1046 HRESULT WINAPI StorageImpl_CreateStorage( 
     1045HRESULT WINAPI StorageImpl_CreateStorage(
    10471046  IStorage*      iface,
    1048   const OLECHAR  *pwcsName, /* [string][in] */ 
    1049   DWORD            grfMode,   /* [in] */ 
    1050   DWORD            reserved1, /* [in] */ 
    1051   DWORD            reserved2, /* [in] */ 
    1052   IStorage       **ppstg)   /* [out] */ 
     1047  const OLECHAR  *pwcsName, /* [string][in] */
     1048  DWORD            grfMode,   /* [in] */
     1049  DWORD            reserved1, /* [in] */
     1050  DWORD            reserved2, /* [in] */
     1051  IStorage       **ppstg)   /* [out] */
    10531052{
    10541053  StorageImpl* const This=(StorageImpl*)iface;
     
    10611060  HRESULT          hr;
    10621061
    1063   TRACE("(%p, %s, %lx, %ld, %ld, %p)\n", 
    1064         iface, debugstr_w(pwcsName), grfMode, 
     1062  TRACE("(%p, %s, %lx, %ld, %ld, %p)\n",
     1063        iface, debugstr_w(pwcsName), grfMode,
    10651064        reserved1, reserved2, ppstg);
    1066  
     1065
    10671066  /*
    10681067   * Validate parameters
     
    11001099  {
    11011100    /*
    1102      * An element with this name already exists 
     1101     * An element with this name already exists
    11031102     */
    11041103    if (grfMode & STGM_CREATE)
    1105       IStorage_DestroyElement(iface, pwcsName); 
    1106     else 
     1104      IStorage_DestroyElement(iface, pwcsName);
     1105    else
    11071106      return STG_E_FILEALREADYEXISTS;
    11081107  }
    11091108
    1110   /* 
    1111    * memset the empty property 
     1109  /*
     1110   * memset the empty property
    11121111   */
    11131112  memset(&newProperty, 0, sizeof(StgProperty));
     
    11291128  newProperty.dirProperty      = PROPERTY_NULL;
    11301129
    1131   /* call CoFileTime to get the current time 
     1130  /* call CoFileTime to get the current time
    11321131  newProperty.timeStampS1
    11331132  newProperty.timeStampD1
     
    11381137  /*  newStorageProperty.propertyUniqueID */
    11391138
    1140   /* 
     1139  /*
    11411140   * Obtain a free property in the property chain
    11421141   */
     
    11451144  /*
    11461145   * Save the new property into the new property spot
    1147    */ 
     1146   */
    11481147  StorageImpl_WriteProperty(
    11491148    This->ancestorStorage,
    1150     newPropertyIndex, 
     1149    newPropertyIndex,
    11511150    &newProperty);
    11521151
    1153   /* 
     1152  /*
    11541153   * Find a spot in the property chain for our newly created property.
    11551154   */
    11561155  updatePropertyChain(
    11571156    This,
    1158     newPropertyIndex, 
     1157    newPropertyIndex,
    11591158    newProperty);
    11601159
    1161   /* 
     1160  /*
    11621161   * Open it to get a pointer to return.
    11631162   */
     
    11761175  }
    11771176
    1178  
     1177
    11791178  return S_OK;
    11801179}
     
    12071206      if (currentProperty.sizeOfNameString == 0)
    12081207      {
    1209         /* 
     1208        /*
    12101209         * The property existis and is available, we found it.
    12111210         */
     
    12241223  } while (newPropertyIndex == PROPERTY_NULL);
    12251224
    1226   /* 
    1227    * grow the property chain 
     1225  /*
     1226   * grow the property chain
    12281227   */
    12291228  if (! readSuccessful)
     
    12351234    ULONG          blockCount    = 0;
    12361235
    1237     /* 
    1238      * obtain the new count of property blocks 
     1236    /*
     1237     * obtain the new count of property blocks
    12391238     */
    12401239    blockCount = BlockChainStream_GetCount(
    12411240                   storage->ancestorStorage->rootBlockChain)+1;
    12421241
    1243     /* 
    1244      * initialize the size used by the property stream 
     1242    /*
     1243     * initialize the size used by the property stream
    12451244     */
    12461245    newSize.s.HighPart = 0;
    12471246    newSize.s.LowPart  = storage->bigBlockSize * blockCount;
    12481247
    1249     /* 
    1250      * add a property block to the property chain 
     1248    /*
     1249     * add a property block to the property chain
    12511250     */
    12521251    BlockChainStream_SetSize(storage->ancestorStorage->rootBlockChain, newSize);
    12531252
    1254     /* 
    1255      * memset the empty property in order to initialize the unused newly 
     1253    /*
     1254     * memset the empty property in order to initialize the unused newly
    12561255     * created property
    12571256     */
    12581257    memset(&emptyProperty, 0, sizeof(StgProperty));
    12591258
    1260     /* 
     1259    /*
    12611260     * initialize them
    12621261     */
    1263     lastProperty = storage->bigBlockSize / PROPSET_BLOCK_SIZE * blockCount; 
    1264    
     1262    lastProperty = storage->bigBlockSize / PROPSET_BLOCK_SIZE * blockCount;
     1263
    12651264    for(
    12661265      propertyIndex = newPropertyIndex;
     
    12701269      StorageImpl_WriteProperty(
    12711270        storage->ancestorStorage,
    1272         propertyIndex, 
     1271        propertyIndex,
    12731272        &emptyProperty);
    12741273    }
     
    12821281 * Internal Method
    12831282 *
    1284  * Case insensitive comparaison of StgProperty.name by first considering 
     1283 * Case insensitive comparaison of StgProperty.name by first considering
    12851284 * their size.
    12861285 *
     
    12951294  LONG diff      = lstrlenW(newProperty) - lstrlenW(currentProperty);
    12961295
    1297   if (diff == 0) 
    1298   {
    1299     /* 
     1296  if (diff == 0)
     1297  {
     1298    /*
    13001299     * We compare the string themselves only when they are of the same lenght
    13011300     */
     
    13031302  }
    13041303
    1305   return diff; 
     1304  return diff;
    13061305}
    13071306
     
    13151314  StorageImpl *storage,
    13161315  ULONG         newPropertyIndex,
    1317   StgProperty   newProperty) 
     1316  StgProperty   newProperty)
    13181317{
    13191318  StgProperty currentProperty;
     
    13281327  if (currentProperty.dirProperty != PROPERTY_NULL)
    13291328  {
    1330     /* 
     1329    /*
    13311330     * The root storage contains some element, therefore, start the research
    13321331     * for the appropriate location.
     
    13411340
    13421341    /*
    1343      * Read 
     1342     * Read
    13441343     */
    13451344    StorageImpl_ReadProperty(storage->ancestorStorage,
     
    13541353    {
    13551354      LONG diff = propertyNameCmp( newProperty.name, currentProperty.name);
    1356  
     1355
    13571356      if (diff < 0)
    13581357      {
     
    14061405  else
    14071406  {
    1408     /* 
     1407    /*
    14091408     * The root storage is empty, link the new property to it's dir property
    14101409     */
     
    14161415}
    14171416
    1418      
     1417
    14191418/*************************************************************************
    14201419 * CopyTo (IStorage)
    14211420 */
    1422 HRESULT WINAPI StorageImpl_CopyTo( 
     1421HRESULT WINAPI StorageImpl_CopyTo(
    14231422  IStorage*   iface,
    1424   DWORD       ciidExclude,  /* [in] */ 
    1425   const IID*  rgiidExclude, /* [size_is][unique][in] */ 
    1426   SNB         snbExclude,   /* [unique][in] */ 
    1427   IStorage*   pstgDest)     /* [unique][in] */ 
     1423  DWORD       ciidExclude,  /* [in] */
     1424  const IID*  rgiidExclude, /* [size_is][unique][in] */
     1425  SNB         snbExclude,   /* [unique][in] */
     1426  IStorage*   pstgDest)     /* [unique][in] */
    14281427{
    14291428  IEnumSTATSTG *elements     = 0;
     
    14361435    FIXME("Exclude option not implemented\n");
    14371436
    1438   TRACE("(%p, %ld, %p, %p, %p)\n", 
    1439         iface, ciidExclude, rgiidExclude, 
     1437  TRACE("(%p, %ld, %p, %p, %p)\n",
     1438        iface, ciidExclude, rgiidExclude,
    14401439        snbExclude, pstgDest);
    14411440
     
    14461445    return STG_E_INVALIDPOINTER;
    14471446
    1448   /* 
     1447  /*
    14491448   * Enumerate the elements
    14501449   */
     
    14591458  IStorage_Stat( iface, &curElement, STATFLAG_NONAME);
    14601459  IStorage_SetClass( pstgDest, &curElement.clsid );
    1461  
     1460
    14621461  do
    14631462  {
     
    14951494        return STG_E_ACCESSDENIED;
    14961495      }
    1497            
     1496
    14981497      /*
    14991498       * create a new storage in destination storage
     
    15121511                                   NULL, 0, &pstgTmp );
    15131512      }
    1514        
     1513
    15151514      if (hr != S_OK)
    15161515        break;
    15171516
    1518        
     1517
    15191518      /*
    15201519       * do the copy recursively
     
    15221521      hr = IStorage_CopyTo( pstgChild, ciidExclude, rgiidExclude,
    15231522                               snbExclude, pstgTmp );
    1524                                
     1523
    15251524      IStorage_Release( pstgTmp );
    15261525      IStorage_Release( pstgChild );
     
    15581557       */
    15591558      IStream_SetSize(pstrTmp, strStat.cbSize);
    1560      
     1559
    15611560      /*
    15621561       * do the copy
     
    15641563      hr = IStream_CopyTo( pstrChild, pstrTmp, strStat.cbSize,
    15651564                           NULL, NULL );
    1566                                
     1565
    15671566      IStream_Release( pstrTmp );
    15681567      IStream_Release( pstrChild );
     
    15791578   */
    15801579  IEnumSTATSTG_Release(elements);
    1581  
     1580
    15821581  return hr;
    15831582}
    1584        
     1583
    15851584/*************************************************************************
    15861585 * MoveElementTo (IStorage)
    15871586 */
    1588 HRESULT WINAPI StorageImpl_MoveElementTo( 
     1587HRESULT WINAPI StorageImpl_MoveElementTo(
    15891588  IStorage*     iface,
    1590   const OLECHAR *pwcsName,   /* [string][in] */ 
    1591   IStorage      *pstgDest,   /* [unique][in] */ 
    1592   const OLECHAR *pwcsNewName,/* [string][in] */ 
    1593   DWORD           grfFlags)    /* [in] */ 
     1589  const OLECHAR *pwcsName,   /* [string][in] */
     1590  IStorage      *pstgDest,   /* [unique][in] */
     1591  const OLECHAR *pwcsNewName,/* [string][in] */
     1592  DWORD           grfFlags)    /* [in] */
    15941593{
    15951594  FIXME("not implemented!\n");
    15961595  return E_NOTIMPL;
    15971596}
    1598        
     1597
    15991598/*************************************************************************
    16001599 * Commit (IStorage)
    16011600 */
    1602 HRESULT WINAPI StorageImpl_Commit( 
     1601HRESULT WINAPI StorageImpl_Commit(
    16031602  IStorage*   iface,
    1604   DWORD         grfCommitFlags)/* [in] */ 
     1603  DWORD         grfCommitFlags)/* [in] */
    16051604{
    16061605  FIXME("(%ld): stub!\n", grfCommitFlags);
    16071606  return S_OK;
    16081607}
    1609        
     1608
    16101609/*************************************************************************
    16111610 * Revert (IStorage)
    16121611 */
    1613 HRESULT WINAPI StorageImpl_Revert( 
     1612HRESULT WINAPI StorageImpl_Revert(
    16141613  IStorage* iface)
    16151614{
     
    16211620 * DestroyElement (IStorage)
    16221621 *
    1623  * Stategy: This implementation is build this way for simplicity not for speed. 
     1622 * Stategy: This implementation is build this way for simplicity not for speed.
    16241623 *          I always delete the top most element of the enumeration and adjust
    1625  *          the deleted element pointer all the time.  This takes longer to 
    1626  *          do but allow to reinvoke DestroyElement whenever we encounter a 
     1624 *          the deleted element pointer all the time.  This takes longer to
     1625 *          do but allow to reinvoke DestroyElement whenever we encounter a
    16271626 *          storage object.  The optimisation reside in the usage of another
    1628  *          enumeration stategy that would give all the leaves of a storage 
     1627 *          enumeration stategy that would give all the leaves of a storage
    16291628 *          first. (postfix order)
    16301629 */
    1631 HRESULT WINAPI StorageImpl_DestroyElement( 
     1630HRESULT WINAPI StorageImpl_DestroyElement(
    16321631  IStorage*     iface,
    1633   const OLECHAR *pwcsName)/* [string][in] */ 
     1632  const OLECHAR *pwcsName)/* [string][in] */
    16341633{
    16351634  StorageImpl* const This=(StorageImpl*)iface;
     
    16441643  ULONG             parentPropertyId;
    16451644
    1646   TRACE("(%p, %s)\n", 
     1645  TRACE("(%p, %s)\n",
    16471646        iface, debugstr_w(pwcsName));
    16481647
     
    16501649   * Perform a sanity check on the parameters.
    16511650   */
    1652   if (pwcsName==NULL) 
     1651  if (pwcsName==NULL)
    16531652    return STG_E_INVALIDPOINTER;
    1654  
     1653
    16551654  /*
    16561655   * Create a property enumeration to search the property with the given name
    16571656   */
    16581657  propertyEnumeration = IEnumSTATSTGImpl_Construct(
    1659     This->ancestorStorage, 
     1658    This->ancestorStorage,
    16601659    This->rootPropertySetIndex);
    1661  
     1660
    16621661  foundPropertyIndexToDelete = IEnumSTATSTGImpl_FindProperty(
    16631662    propertyEnumeration,
     
    16671666  IEnumSTATSTGImpl_Destroy(propertyEnumeration);
    16681667
    1669   if ( foundPropertyIndexToDelete == PROPERTY_NULL ) 
     1668  if ( foundPropertyIndexToDelete == PROPERTY_NULL )
    16701669  {
    16711670    return STG_E_FILENOTFOUND;
    16721671  }
    16731672
    1674   /* 
    1675    * Find the parent property of the property to delete (the one that 
    1676    * link to it).  If This->dirProperty == foundPropertyIndexToDelete, 
     1673  /*
     1674   * Find the parent property of the property to delete (the one that
     1675   * link to it).  If This->dirProperty == foundPropertyIndexToDelete,
    16771676   * the parent is This. Otherwise, the parent is one of it's sibling...
    16781677   */
    16791678
    1680   /* 
     1679  /*
    16811680   * First, read This's StgProperty..
    16821681   */
    1683   res = StorageImpl_ReadProperty( 
     1682  res = StorageImpl_ReadProperty(
    16841683          This->ancestorStorage,
    16851684          This->rootPropertySetIndex,
     
    16881687  assert(res==TRUE);
    16891688
    1690   /* 
     1689  /*
    16911690   * Second, check to see if by any chance the actual storage (This) is not
    16921691   * the parent of the property to delete... We never know...
     
    16941693  if ( parentProperty.dirProperty == foundPropertyIndexToDelete )
    16951694  {
    1696     /* 
     1695    /*
    16971696     * Set data as it would have been done in the else part...
    16981697     */
     
    17001699    parentPropertyId = This->rootPropertySetIndex;
    17011700  }
    1702   else 
    1703   { 
    1704     /*
    1705      * Create a property enumeration to search the parent properties, and 
     1701  else
     1702  {
     1703    /*
     1704     * Create a property enumeration to search the parent properties, and
    17061705     * delete it once done.
    17071706     */
     
    17091708
    17101709    propertyEnumeration2 = IEnumSTATSTGImpl_Construct(
    1711       This->ancestorStorage, 
     1710      This->ancestorStorage,
    17121711      This->rootPropertySetIndex);
    1713  
     1712
    17141713    typeOfRelation = IEnumSTATSTGImpl_FindParentProperty(
    17151714      propertyEnumeration2,
     
    17211720  }
    17221721
    1723   if ( propertyToDelete.propertyType == PROPTYPE_STORAGE ) 
     1722  if ( propertyToDelete.propertyType == PROPTYPE_STORAGE )
    17241723  {
    17251724    hr = deleteStorageProperty(
    1726            This, 
     1725           This,
    17271726           foundPropertyIndexToDelete,
    17281727           propertyToDelete);
    1729   } 
     1728  }
    17301729  else if ( propertyToDelete.propertyType == PROPTYPE_STREAM )
    17311730  {
    17321731    hr = deleteStreamProperty(
    1733            This, 
     1732           This,
    17341733           foundPropertyIndexToDelete,
    17351734           propertyToDelete);
    17361735  }
    17371736
    1738   if (hr!=S_OK) 
     1737  if (hr!=S_OK)
    17391738    return hr;
    17401739
     
    17441743  hr = adjustPropertyChain(
    17451744        This,
    1746         propertyToDelete, 
     1745        propertyToDelete,
    17471746        parentProperty,
    17481747        parentPropertyId,
     
    17531752
    17541753
    1755 /************************************************************************ 
    1756  * StorageImpl_Stat (IStorage) 
    1757  * 
    1758  * This method will retrieve information about this storage object. 
    1759  * 
    1760  * See Windows documentation for more details on IStorage methods. 
     1754/************************************************************************
     1755 * StorageImpl_Stat (IStorage)
     1756 *
     1757 * This method will retrieve information about this storage object.
     1758 *
     1759 * See Windows documentation for more details on IStorage methods.
    17611760 */
    17621761HRESULT WINAPI StorageImpl_Stat( IStorage* iface,
     
    18141813  }
    18151814
    1816   /* 
     1815  /*
    18171816   * Enumerate the elements
    18181817   */
     
    18281827    {
    18291828      destroyHr = StorageImpl_DestroyElement(
    1830                     (IStorage*)childStorage, 
     1829                    (IStorage*)childStorage,
    18311830                    (OLECHAR*)currentElement.pwcsName);
    18321831
     
    18531852  IStorage_Release(childStorage);
    18541853  IEnumSTATSTG_Release(elements);
    1855    
     1854
    18561855  return destroyHr;
    18571856}
     
    18831882         0,
    18841883         &pis);
    1885    
     1884
    18861885  if (hr!=S_OK)
    18871886  {
     
    18891888  }
    18901889
    1891   /* 
    1892    * Zap the stream 
    1893    */ 
    1894   hr = IStream_SetSize(pis, size); 
     1890  /*
     1891   * Zap the stream
     1892   */
     1893  hr = IStream_SetSize(pis, size);
    18951894
    18961895  if(hr != S_OK)
     
    19041903  IStream_Release(pis);
    19051904
    1906   /* 
     1905  /*
    19071906   * Invalidate the property by zeroing it's name member.
    19081907   */
    19091908  propertyToDelete.sizeOfNameString = 0;
    19101909
    1911   /* 
     1910  /*
    19121911   * Here we should re-read the property so we get the updated pointer
    19131912   * but since we are here to zap it, I don't do it...
    19141913   */
    19151914  StorageImpl_WriteProperty(
    1916     parentStorage->ancestorStorage, 
     1915    parentStorage->ancestorStorage,
    19171916    indexOfPropertyToDelete,
    19181917    &propertyToDelete);
     
    19431942  res = StorageImpl_ReadProperty(
    19441943          storage->ancestorStorage,
    1945           storePropertyIndex, 
     1944          storePropertyIndex,
    19461945          &storeProperty);
    19471946
     
    19571956      return findPlaceholder(
    19581957               storage,
    1959                propertyIndexToStore, 
     1958               propertyIndexToStore,
    19601959               storeProperty.previousProperty,
    19611960               typeOfRelation);
     
    19721971      return findPlaceholder(
    19731972               storage,
    1974                propertyIndexToStore, 
     1973               propertyIndexToStore,
    19751974               storeProperty.nextProperty,
    19761975               typeOfRelation);
     
    19801979      storeProperty.nextProperty = propertyIndexToStore;
    19811980    }
    1982   } 
     1981  }
    19831982  else if (typeOfRelation == PROPERTY_RELATION_DIR)
    19841983  {
     
    19871986      return findPlaceholder(
    19881987               storage,
    1989                propertyIndexToStore, 
     1988               propertyIndexToStore,
    19901989               storeProperty.dirProperty,
    19911990               typeOfRelation);
     
    19991998  hr = StorageImpl_WriteProperty(
    20001999         storage->ancestorStorage,
    2001          storePropertyIndex, 
     2000         storePropertyIndex,
    20022001         &storeProperty);
    20032002
     
    20142013 * Internal Method
    20152014 *
    2016  * This method takes the previous and the next property link of a property 
     2015 * This method takes the previous and the next property link of a property
    20172016 * to be deleted and find them a place in the Storage.
    20182017 */
    2019 static HRESULT adjustPropertyChain( 
     2018static HRESULT adjustPropertyChain(
    20202019  StorageImpl *This,
    20212020  StgProperty   propertyToDelete,
     
    20312030  HRESULT hr                     = S_OK;
    20322031  BOOL  res                    = TRUE;
    2033  
    2034   if (typeOfRelation == PROPERTY_RELATION_PREVIOUS) 
    2035   {
    2036     if (propertyToDelete.previousProperty != PROPERTY_NULL) 
    2037     {
    2038       /* 
     2032
     2033  if (typeOfRelation == PROPERTY_RELATION_PREVIOUS)
     2034  {
     2035    if (propertyToDelete.previousProperty != PROPERTY_NULL)
     2036    {
     2037      /*
    20392038       * Set the parent previous to the property to delete previous
    20402039       */
    20412040      newLinkProperty = propertyToDelete.previousProperty;
    20422041
    2043       if (propertyToDelete.nextProperty != PROPERTY_NULL) 
     2042      if (propertyToDelete.nextProperty != PROPERTY_NULL)
    20442043      {
    20452044        /*
    2046          * We also need to find a storage for the other link, setup variables 
     2045         * We also need to find a storage for the other link, setup variables
    20472046         * to do this at the end...
    2048          */     
     2047         */
    20492048        needToFindAPlaceholder = TRUE;
    20502049        storeNode              = propertyToDelete.previousProperty;
     
    20522051        relationType           = PROPERTY_RELATION_NEXT;
    20532052      }
    2054     } 
    2055     else if (propertyToDelete.nextProperty != PROPERTY_NULL) 
    2056     {
    2057       /* 
     2053    }
     2054    else if (propertyToDelete.nextProperty != PROPERTY_NULL)
     2055    {
     2056      /*
    20582057       * Set the parent previous to the property to delete next
    20592058       */
    20602059      newLinkProperty = propertyToDelete.nextProperty;
    20612060    }
    2062    
    2063     /* 
     2061
     2062    /*
    20642063     * Link it for real...
    2065      */ 
     2064     */
    20662065    parentProperty.previousProperty = newLinkProperty;
    2067  
    2068   } 
    2069   else if (typeOfRelation == PROPERTY_RELATION_NEXT) 
    2070   {
    2071     if (propertyToDelete.previousProperty != PROPERTY_NULL) 
    2072     {
    2073       /* 
     2066
     2067  }
     2068  else if (typeOfRelation == PROPERTY_RELATION_NEXT)
     2069  {
     2070    if (propertyToDelete.previousProperty != PROPERTY_NULL)
     2071    {
     2072      /*
    20742073       * Set the parent next to the property to delete next previous
    20752074       */
    20762075      newLinkProperty = propertyToDelete.previousProperty;
    2077      
    2078       if (propertyToDelete.nextProperty != PROPERTY_NULL) 
     2076
     2077      if (propertyToDelete.nextProperty != PROPERTY_NULL)
    20792078      {
    20802079        /*
    2081          * We also need to find a storage for the other link, setup variables 
     2080         * We also need to find a storage for the other link, setup variables
    20822081         * to do this at the end...
    2083          */     
     2082         */
    20842083        needToFindAPlaceholder = TRUE;
    20852084        storeNode              = propertyToDelete.previousProperty;
     
    20872086        relationType           = PROPERTY_RELATION_NEXT;
    20882087      }
    2089     } 
    2090     else if (propertyToDelete.nextProperty != PROPERTY_NULL) 
    2091     {
    2092       /* 
     2088    }
     2089    else if (propertyToDelete.nextProperty != PROPERTY_NULL)
     2090    {
     2091      /*
    20932092       * Set the parent next to the property to delete next
    20942093       */
     
    20962095    }
    20972096
    2098     /* 
     2097    /*
    20992098     * Link it for real...
    2100      */ 
     2099     */
    21012100    parentProperty.nextProperty = newLinkProperty;
    2102   } 
     2101  }
    21032102  else /* (typeOfRelation == PROPERTY_RELATION_DIR) */
    21042103  {
    2105     if (propertyToDelete.previousProperty != PROPERTY_NULL) 
    2106     {
    2107       /* 
     2104    if (propertyToDelete.previousProperty != PROPERTY_NULL)
     2105    {
     2106      /*
    21082107       * Set the parent dir to the property to delete previous
    21092108       */
    21102109      newLinkProperty = propertyToDelete.previousProperty;
    21112110
    2112       if (propertyToDelete.nextProperty != PROPERTY_NULL) 
     2111      if (propertyToDelete.nextProperty != PROPERTY_NULL)
    21132112      {
    21142113        /*
    2115          * We also need to find a storage for the other link, setup variables 
     2114         * We also need to find a storage for the other link, setup variables
    21162115         * to do this at the end...
    2117          */     
     2116         */
    21182117        needToFindAPlaceholder = TRUE;
    21192118        storeNode              = propertyToDelete.previousProperty;
     
    21212120        relationType           = PROPERTY_RELATION_NEXT;
    21222121      }
    2123     } 
    2124     else if (propertyToDelete.nextProperty != PROPERTY_NULL) 
    2125     {
    2126       /* 
     2122    }
     2123    else if (propertyToDelete.nextProperty != PROPERTY_NULL)
     2124    {
     2125      /*
    21272126       * Set the parent dir to the property to delete next
    21282127       */
     
    21302129    }
    21312130
    2132     /* 
     2131    /*
    21332132     * Link it for real...
    2134      */ 
     2133     */
    21352134    parentProperty.dirProperty = newLinkProperty;
    21362135  }
    21372136
    2138   /* 
    2139    * Write back the parent property   
     2137  /*
     2138   * Write back the parent property
    21402139   */
    21412140  res = StorageImpl_WriteProperty(
    2142           This->ancestorStorage, 
     2141          This->ancestorStorage,
    21432142          parentPropertyId,
    21442143          &parentProperty);
     
    21492148
    21502149  /*
    2151    * If a placeholder is required for the other link, then, find one and 
     2150   * If a placeholder is required for the other link, then, find one and
    21522151   * get out of here...
    21532152   */
    2154   if (needToFindAPlaceholder) 
     2153  if (needToFindAPlaceholder)
    21552154  {
    21562155    hr = findPlaceholder(
    2157            This, 
    2158            toStoreNode, 
     2156           This,
     2157           toStoreNode,
    21592158           storeNode,
    21602159           relationType);
     
    21682167 * SetElementTimes (IStorage)
    21692168 */
    2170 HRESULT WINAPI StorageImpl_SetElementTimes( 
     2169HRESULT WINAPI StorageImpl_SetElementTimes(
    21712170  IStorage*     iface,
    2172   const OLECHAR *pwcsName,/* [string][in] */ 
    2173   const FILETIME  *pctime,  /* [in] */ 
    2174   const FILETIME  *patime,  /* [in] */ 
    2175   const FILETIME  *pmtime)  /* [in] */ 
     2171  const OLECHAR *pwcsName,/* [string][in] */
     2172  const FILETIME  *pctime,  /* [in] */
     2173  const FILETIME  *patime,  /* [in] */
     2174  const FILETIME  *pmtime)  /* [in] */
    21762175{
    21772176  FIXME("(%s,...), stub!\n",debugstr_w(pwcsName));
     
    21822181 * SetStateBits (IStorage)
    21832182 */
    2184 HRESULT WINAPI StorageImpl_SetStateBits( 
     2183HRESULT WINAPI StorageImpl_SetStateBits(
    21852184  IStorage*   iface,
    2186   DWORD         grfStateBits,/* [in] */ 
    2187   DWORD         grfMask)     /* [in] */ 
     2185  DWORD         grfStateBits,/* [in] */
     2186  DWORD         grfMask)     /* [in] */
    21882187{
    21892188  FIXME("not implemented!\n");
     
    22092208
    22102209  memset(This, 0, sizeof(StorageImpl));
    2211  
     2210
    22122211  /*
    22132212   * Initialize the virtual function table.
     
    22152214  ICOM_VTBL(This)    = &Storage32Impl_Vtbl;
    22162215  This->v_destructor = &StorageImpl_Destroy;
    2217  
     2216
    22182217  /*
    22192218   * This is the top-level storage so initialize the ancestor pointer
     
    22212220   */
    22222221  This->ancestorStorage = This;
    2223  
     2222
    22242223  /*
    22252224   * Initialize the physical support of the storage.
    22262225   */
    22272226  This->hFile = hFile;
    2228  
     2227
    22292228  /*
    22302229   * Store copy of file path.
    22312230   */
    22322231  if(pwcsName) {
    2233       This->pwcsName = HeapAlloc(GetProcessHeap(), 0, 
     2232      This->pwcsName = HeapAlloc(GetProcessHeap(), 0,
    22342233                                (lstrlenW(pwcsName)+1)*sizeof(WCHAR));
    22352234      if (!This->pwcsName)
    22362235         return STG_E_INSUFFICIENTMEMORY;
    2237       strcpyW(This->pwcsName, pwcsName); 
     2236      strcpyW(This->pwcsName, pwcsName);
    22382237  }
    22392238
     
    22512250  if (This->bigBlockFile == 0)
    22522251    return E_FAIL;
    2253  
     2252
    22542253  if (fileCreate)
    22552254  {
     
    22632262     * - There is no small block depot
    22642263     */
    2265     memset( This->bigBlockDepotStart,     
    2266             BLOCK_UNUSED, 
     2264    memset( This->bigBlockDepotStart,
     2265            BLOCK_UNUSED,
    22672266            sizeof(This->bigBlockDepotStart));
    22682267
     
    23182317   */
    23192318  This->prevFreeBlock = 0;
    2320  
     2319
    23212320  /*
    23222321   * Create the block chain abstractions.
    23232322   */
    2324   This->rootBlockChain = 
     2323  This->rootBlockChain =
    23252324    BlockChainStream_Construct(This, &This->rootStartBlock, PROPERTY_NULL);
    23262325
    23272326  This->smallBlockDepotChain = BlockChainStream_Construct(
    2328                                  This, 
    2329                                  &This->smallBlockDepotStart, 
     2327                                 This,
     2328                                 &This->smallBlockDepotStart,
    23302329                                 PROPERTY_NULL);
    23312330
    23322331  /*
    2333    * Write the root property 
     2332   * Write the root property
    23342333   */
    23352334  if (fileCreate)
     
    23582357   */
    23592358  currentPropertyIndex = 0;
    2360  
     2359
    23612360  do
    23622361  {
    23632362    readSuccessful = StorageImpl_ReadProperty(
    2364                       This, 
    2365                       currentPropertyIndex, 
     2363                      This,
     2364                      currentPropertyIndex,
    23662365                      &currentProperty);
    2367    
     2366
    23682367    if (readSuccessful)
    23692368    {
     
    23762375
    23772376    currentPropertyIndex++;
    2378    
     2377
    23792378  } while (readSuccessful && (This->rootPropertySetIndex == PROPERTY_NULL) );
    2380  
     2379
    23812380  if (!readSuccessful)
    23822381  {
     
    23892388   */
    23902389  This->smallBlockRootChain = BlockChainStream_Construct(
    2391                                 This, 
    2392                                 NULL, 
     2390                                This,
     2391                                NULL,
    23932392                                This->rootPropertySetIndex);
    2394  
     2393
    23952394  return hr;
    23962395}
     
    29282927
    29292928    StorageUtl_ReadWord(
    2930       headerBigBlock, 
    2931       OFFSET_BIGBLOCKSIZEBITS,   
     2929      headerBigBlock,
     2930      OFFSET_BIGBLOCKSIZEBITS,
    29322931      &This->bigBlockSizeBits);
    29332932
    29342933    StorageUtl_ReadWord(
    2935       headerBigBlock, 
    2936       OFFSET_SMALLBLOCKSIZEBITS, 
     2934      headerBigBlock,
     2935      OFFSET_SMALLBLOCKSIZEBITS,
    29372936      &This->smallBlockSizeBits);
    29382937
    29392938    StorageUtl_ReadDWord(
    2940       headerBigBlock, 
    2941       OFFSET_BBDEPOTCOUNT,     
     2939      headerBigBlock,
     2940      OFFSET_BBDEPOTCOUNT,
    29422941      &This->bigBlockDepotCount);
    29432942
    29442943    StorageUtl_ReadDWord(
    2945       headerBigBlock, 
    2946       OFFSET_ROOTSTARTBLOCK,   
     2944      headerBigBlock,
     2945      OFFSET_ROOTSTARTBLOCK,
    29472946      &This->rootStartBlock);
    29482947
    29492948    StorageUtl_ReadDWord(
    2950       headerBigBlock, 
    2951       OFFSET_SBDEPOTSTART,     
     2949      headerBigBlock,
     2950      OFFSET_SBDEPOTSTART,
    29522951      &This->smallBlockDepotStart);
    29532952
    2954     StorageUtl_ReadDWord( 
    2955       headerBigBlock, 
    2956       OFFSET_EXTBBDEPOTSTART,   
     2953    StorageUtl_ReadDWord(
     2954      headerBigBlock,
     2955      OFFSET_EXTBBDEPOTSTART,
    29572956      &This->extBigBlockDepotStart);
    29582957
    29592958    StorageUtl_ReadDWord(
    2960       headerBigBlock, 
    2961       OFFSET_EXTBBDEPOTCOUNT,   
     2959      headerBigBlock,
     2960      OFFSET_EXTBBDEPOTCOUNT,
    29622961      &This->extBigBlockDepotCount);
    2963    
     2962
    29642963    for (index = 0; index < COUNT_BBDEPOTINHEADER; index ++)
    29652964    {
    29662965      StorageUtl_ReadDWord(
    2967         headerBigBlock, 
     2966        headerBigBlock,
    29682967        OFFSET_BBDEPOTSTART + (sizeof(ULONG)*index),
    29692968        &(This->bigBlockDepotStart[index]));
    29702969    }
    2971    
     2970
    29722971    /*
    29732972     * Make the bitwise arithmetic to get the size of the blocks in bytes.
     
    29832982      This->smallBlockSize = 0x000000001 >> (DWORD)This->smallBlockSizeBits;
    29842983    }
    2985    
    2986     /*
    2987      * Right now, the code is making some assumptions about the size of the 
     2984
     2985    /*
     2986     * Right now, the code is making some assumptions about the size of the
    29882987     * blocks, just make sure they are what we're expecting.
    29892988     */
     
    29962995    else
    29972996        hr = S_OK;
    2998    
     2997
    29992998    /*
    30002999     * Release the block.
     
    30023001    StorageImpl_ReleaseBigBlock(This, headerBigBlock);
    30033002  }
    3004  
     3003
    30053004  return hr;
    30063005}
     
    30223021   */
    30233022  success = StorageImpl_ReadBigBlock(This, -1, headerBigBlock);
    3024  
     3023
    30253024  /*
    30263025   * If the block read failed, the file is probably new.
     
    30323031     */
    30333032    memset(headerBigBlock, 0, BIG_BLOCK_SIZE);
    3034    
     3033
    30353034    /*
    30363035     * Initialize the magic number.
    30373036     */
    30383037    memcpy(headerBigBlock, STORAGE_magic, sizeof(STORAGE_magic));
    3039    
     3038
    30403039    /*
    30413040     * And a bunch of things we don't know what they mean
     
    30473046    StorageUtl_WriteDWord(headerBigBlock, 0x40, (DWORD)0x0001);
    30483047  }
    3049  
     3048
    30503049  /*
    30513050   * Write the information to the header.
     
    30543053  {
    30553054    StorageUtl_WriteWord(
    3056       headerBigBlock, 
    3057       OFFSET_BIGBLOCKSIZEBITS,   
     3055      headerBigBlock,
     3056      OFFSET_BIGBLOCKSIZEBITS,
    30583057      This->bigBlockSizeBits);
    30593058
    30603059    StorageUtl_WriteWord(
    3061       headerBigBlock, 
    3062       OFFSET_SMALLBLOCKSIZEBITS, 
     3060      headerBigBlock,
     3061      OFFSET_SMALLBLOCKSIZEBITS,
    30633062      This->smallBlockSizeBits);
    30643063
    30653064    StorageUtl_WriteDWord(
    3066       headerBigBlock, 
    3067       OFFSET_BBDEPOTCOUNT,     
     3065      headerBigBlock,
     3066      OFFSET_BBDEPOTCOUNT,
    30683067      This->bigBlockDepotCount);
    30693068
    30703069    StorageUtl_WriteDWord(
    3071       headerBigBlock, 
    3072       OFFSET_ROOTSTARTBLOCK,   
     3070      headerBigBlock,
     3071      OFFSET_ROOTSTARTBLOCK,
    30733072      This->rootStartBlock);
    30743073
    30753074    StorageUtl_WriteDWord(
    3076       headerBigBlock, 
    3077       OFFSET_SBDEPOTSTART,     
     3075      headerBigBlock,
     3076      OFFSET_SBDEPOTSTART,
    30783077      This->smallBlockDepotStart);
    30793078
    30803079    StorageUtl_WriteDWord(
    3081       headerBigBlock, 
    3082       OFFSET_EXTBBDEPOTSTART,   
     3080      headerBigBlock,
     3081      OFFSET_EXTBBDEPOTSTART,
    30833082      This->extBigBlockDepotStart);
    30843083
    30853084    StorageUtl_WriteDWord(
    3086       headerBigBlock, 
    3087       OFFSET_EXTBBDEPOTCOUNT,   
     3085      headerBigBlock,
     3086      OFFSET_EXTBBDEPOTCOUNT,
    30883087      This->extBigBlockDepotCount);
    30893088
     
    30913090    {
    30923091      StorageUtl_WriteDWord(
    3093         headerBigBlock, 
     3092        headerBigBlock,
    30943093        OFFSET_BBDEPOTSTART + (sizeof(ULONG)*index),
    30953094        (This->bigBlockDepotStart[index]));
    30963095    }
    30973096  }
    3098  
     3097
    30993098  /*
    31003099   * Write the big block back to the file.
     
    31203119  offsetInPropSet.s.HighPart = 0;
    31213120  offsetInPropSet.s.LowPart  = index * PROPSET_BLOCK_SIZE;
    3122  
     3121
    31233122  readSuccessful = BlockChainStream_ReadAt(
    31243123                    This->rootBlockChain,
     
    31363135    memset(buffer->name, 0, sizeof(buffer->name));
    31373136    memcpy(
    3138       buffer->name, 
    3139       propName, 
     3137      buffer->name,
     3138      propName,
    31403139      PROPERTY_NAME_BUFFER_LEN );
    31413140    TRACE("storage name: %s\n", debugstr_w(buffer->name));
    31423141
    31433142    memcpy(&buffer->propertyType, currentProperty + OFFSET_PS_PROPERTYTYPE, 1);
    3144    
     3143
    31453144    StorageUtl_ReadWord(
    3146       currentProperty, 
    3147       OFFSET_PS_NAMELENGTH, 
     3145      currentProperty,
     3146      OFFSET_PS_NAMELENGTH,
    31483147      &buffer->sizeOfNameString);
    31493148
    31503149    StorageUtl_ReadDWord(
    3151       currentProperty, 
    3152       OFFSET_PS_PREVIOUSPROP, 
     3150      currentProperty,
     3151      OFFSET_PS_PREVIOUSPROP,
    31533152      &buffer->previousProperty);
    31543153
    31553154    StorageUtl_ReadDWord(
    3156       currentProperty, 
    3157       OFFSET_PS_NEXTPROP,     
     3155      currentProperty,
     3156      OFFSET_PS_NEXTPROP,
    31583157      &buffer->nextProperty);
    31593158
    31603159    StorageUtl_ReadDWord(
    3161       currentProperty, 
    3162       OFFSET_PS_DIRPROP,     
     3160      currentProperty,
     3161      OFFSET_PS_DIRPROP,
    31633162      &buffer->dirProperty);
    31643163
    31653164    StorageUtl_ReadGUID(
    3166       currentProperty, 
    3167       OFFSET_PS_GUID,       
     3165      currentProperty,
     3166      OFFSET_PS_GUID,
    31683167      &buffer->propertyUniqueID);
    31693168
    31703169    StorageUtl_ReadDWord(
    3171       currentProperty, 
    3172       OFFSET_PS_TSS1,         
     3170      currentProperty,
     3171      OFFSET_PS_TSS1,
    31733172      &buffer->timeStampS1);
    31743173
    31753174    StorageUtl_ReadDWord(
    3176       currentProperty, 
    3177       OFFSET_PS_TSD1,         
     3175      currentProperty,
     3176      OFFSET_PS_TSD1,
    31783177      &buffer->timeStampD1);
    31793178
    31803179    StorageUtl_ReadDWord(
    3181       currentProperty, 
    3182       OFFSET_PS_TSS2,         
     3180      currentProperty,
     3181      OFFSET_PS_TSS2,
    31833182      &buffer->timeStampS2);
    31843183
    31853184    StorageUtl_ReadDWord(
    3186       currentProperty, 
    3187       OFFSET_PS_TSD2,         
     3185      currentProperty,
     3186      OFFSET_PS_TSD2,
    31883187      &buffer->timeStampD2);
    31893188
    31903189    StorageUtl_ReadDWord(
    3191       currentProperty, 
    3192       OFFSET_PS_STARTBLOCK,   
     3190      currentProperty,
     3191      OFFSET_PS_STARTBLOCK,
    31933192      &buffer->startingBlock);
    31943193
    31953194    StorageUtl_ReadDWord(
    3196       currentProperty, 
    3197       OFFSET_PS_SIZE,         
     3195      currentProperty,
     3196      OFFSET_PS_SIZE,
    31983197      &buffer->size.s.LowPart);
    31993198
     
    32233222
    32243223  memcpy(
    3225     currentProperty + OFFSET_PS_NAME, 
    3226     buffer->name, 
     3224    currentProperty + OFFSET_PS_NAME,
     3225    buffer->name,
    32273226    PROPERTY_NAME_BUFFER_LEN );
    32283227
     
    32303229
    32313230  StorageUtl_WriteWord(
    3232     currentProperty, 
    3233       OFFSET_PS_NAMELENGTH,   
     3231    currentProperty,
     3232      OFFSET_PS_NAMELENGTH,
    32343233      buffer->sizeOfNameString);
    32353234
    32363235  StorageUtl_WriteDWord(
    3237     currentProperty, 
    3238       OFFSET_PS_PREVIOUSPROP, 
     3236    currentProperty,
     3237      OFFSET_PS_PREVIOUSPROP,
    32393238      buffer->previousProperty);
    32403239
    32413240  StorageUtl_WriteDWord(
    3242     currentProperty, 
    3243       OFFSET_PS_NEXTPROP,     
     3241    currentProperty,
     3242      OFFSET_PS_NEXTPROP,
    32443243      buffer->nextProperty);
    32453244
    32463245  StorageUtl_WriteDWord(
    3247     currentProperty, 
    3248       OFFSET_PS_DIRPROP,     
     3246    currentProperty,
     3247      OFFSET_PS_DIRPROP,
    32493248      buffer->dirProperty);
    32503249
    32513250  StorageUtl_WriteGUID(
    3252     currentProperty, 
    3253       OFFSET_PS_GUID,       
     3251    currentProperty,
     3252      OFFSET_PS_GUID,
    32543253      &buffer->propertyUniqueID);
    32553254
    32563255  StorageUtl_WriteDWord(
    3257     currentProperty, 
    3258       OFFSET_PS_TSS1,         
     3256    currentProperty,
     3257      OFFSET_PS_TSS1,
    32593258      buffer->timeStampS1);
    32603259
    32613260  StorageUtl_WriteDWord(
    3262     currentProperty, 
    3263       OFFSET_PS_TSD1,         
     3261    currentProperty,
     3262      OFFSET_PS_TSD1,
    32643263      buffer->timeStampD1);
    32653264
    32663265  StorageUtl_WriteDWord(
    3267     currentProperty, 
    3268       OFFSET_PS_TSS2,         
     3266    currentProperty,
     3267      OFFSET_PS_TSS2,
    32693268      buffer->timeStampS2);
    32703269
    32713270  StorageUtl_WriteDWord(
    3272     currentProperty, 
    3273       OFFSET_PS_TSD2,         
     3271    currentProperty,
     3272      OFFSET_PS_TSD2,
    32743273      buffer->timeStampD2);
    32753274
    32763275  StorageUtl_WriteDWord(
    3277     currentProperty, 
    3278       OFFSET_PS_STARTBLOCK,   
     3276    currentProperty,
     3277      OFFSET_PS_STARTBLOCK,
    32793278      buffer->startingBlock);
    32803279
    32813280  StorageUtl_WriteDWord(
    3282     currentProperty, 
    3283       OFFSET_PS_SIZE,         
     3281    currentProperty,
     3282      OFFSET_PS_SIZE,
    32843283      buffer->size.s.LowPart);
    32853284
     
    33273326
    33283327    StorageImpl_ReleaseBigBlock(This, bigBlockBuffer);
    3329    
     3328
    33303329    return TRUE;
    33313330  }
    3332  
     3331
    33333332  return FALSE;
    33343333}
     
    34603459
    34613460StorageInternalImpl* StorageInternalImpl_Construct(
    3462   StorageImpl* ancestorStorage, 
     3461  StorageImpl* ancestorStorage,
    34633462  ULONG          rootPropertyIndex)
    34643463{
     
    35113510** does nothing.
    35123511*/
    3513 HRESULT WINAPI StorageInternalImpl_Commit( 
     3512HRESULT WINAPI StorageInternalImpl_Commit(
    35143513  IStorage*            iface,
    3515   DWORD                  grfCommitFlags)  /* [in] */ 
     3514  DWORD                  grfCommitFlags)  /* [in] */
    35163515{
    35173516  return S_OK;
    35183517}
    3519        
     3518
    35203519/******************************************************************************
    35213520**
     
    35253524** does nothing.
    35263525*/
    3527 HRESULT WINAPI StorageInternalImpl_Revert( 
     3526HRESULT WINAPI StorageInternalImpl_Revert(
    35283527  IStorage*            iface)
    35293528{
     
    35423541
    35433542  newEnumeration = HeapAlloc(GetProcessHeap(), 0, sizeof(IEnumSTATSTGImpl));
    3544  
     3543
    35453544  if (newEnumeration!=0)
    35463545  {
     
    35503549    ICOM_VTBL(newEnumeration) = &IEnumSTATSTGImpl_Vtbl;
    35513550    newEnumeration->ref       = 0;
    3552    
     3551
    35533552    /*
    35543553     * We want to nail-down the reference to the storage in case the
     
    35573556    newEnumeration->parentStorage = parentStorage;
    35583557    IStorage_AddRef((IStorage*)newEnumeration->parentStorage);
    3559    
     3558
    35603559    newEnumeration->firstPropertyNode   = firstPropertyNode;
    3561    
     3560
    35623561    /*
    35633562     * Initialize the search stack
     
    35653564    newEnumeration->stackSize    = 0;
    35663565    newEnumeration->stackMaxSize = ENUMSTATSGT_SIZE_INCREMENT;
    3567     newEnumeration->stackToVisit = 
     3566    newEnumeration->stackToVisit =
    35683567      HeapAlloc(GetProcessHeap(), 0, sizeof(ULONG)*ENUMSTATSGT_SIZE_INCREMENT);
    3569    
     3568
    35703569    /*
    35713570     * Make sure the current node of the iterator is the first one.
     
    35733572    IEnumSTATSTGImpl_Reset((IEnumSTATSTG*)newEnumeration);
    35743573  }
    3575  
     3574
    35763575  return newEnumeration;
    35773576}
     
    36053604   * Compare the riid with the interface IDs implemented by this object.
    36063605   */
    3607   if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 
     3606  if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
    36083607  {
    36093608    *ppvObject = (IEnumSTATSTG*)This;
    36103609  }
    3611   else if (memcmp(&IID_IStorage, riid, sizeof(IID_IEnumSTATSTG)) == 0) 
     3610  else if (memcmp(&IID_IStorage, riid, sizeof(IID_IEnumSTATSTG)) == 0)
    36123611  {
    36133612    *ppvObject = (IEnumSTATSTG*)This;
     
    36283627  return S_OK;
    36293628}
    3630        
     3629
    36313630ULONG   WINAPI IEnumSTATSTGImpl_AddRef(
    36323631  IEnumSTATSTG* iface)
     
    36373636  return This->ref;
    36383637}
    3639        
     3638
    36403639ULONG   WINAPI IEnumSTATSTGImpl_Release(
    36413640  IEnumSTATSTG* iface)
     
    36563655  }
    36573656
    3658   return newRef;;
     3657  return newRef;
    36593658}
    36603659
     
    36763675   */
    36773676  if ( (rgelt==0) || ( (celt!=1) && (pceltFetched==0) ) )
    3678     return E_INVALIDARG; 
    3679  
     3677    return E_INVALIDARG;
     3678
    36803679  /*
    36813680   * To avoid the special case, get another pointer to a ULONG value if
     
    36843683  if (pceltFetched==0)
    36853684    pceltFetched = &objectFetched;
    3686  
     3685
    36873686  /*
    36883687   * Start the iteration, we will iterate until we hit the end of the
     
    36963695  currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE);
    36973696
    3698   while ( ( *pceltFetched < celt) && 
     3697  while ( ( *pceltFetched < celt) &&
    36993698          ( currentSearchNode!=PROPERTY_NULL) )
    37003699  {
    3701     /* 
     3700    /*
    37023701     * Remove the top node from the stack
    37033702     */
     
    37083707     */
    37093708    StorageImpl_ReadProperty(This->parentStorage,
    3710       currentSearchNode, 
     3709      currentSearchNode,
    37113710      &currentProperty);
    37123711
     
    37173716      &currentProperty,
    37183717      STATFLAG_DEFAULT);
    3719        
     3718
    37203719    /*
    37213720     * Step to the next item in the iteration
     
    37413740}
    37423741
    3743        
     3742
    37443743HRESULT WINAPI IEnumSTATSTGImpl_Skip(
    37453744  IEnumSTATSTG* iface,
     
    37573756  currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE);
    37583757
    3759   while ( (objectFetched < celt) && 
     3758  while ( (objectFetched < celt) &&
    37603759          (currentSearchNode!=PROPERTY_NULL) )
    37613760  {
    3762     /* 
     3761    /*
    37633762     * Remove the top node from the stack
    37643763     */
     
    37693768     */
    37703769    StorageImpl_ReadProperty(This->parentStorage,
    3771       currentSearchNode, 
     3770      currentSearchNode,
    37723771      &currentProperty);
    3773    
     3772
    37743773    /*
    37753774     * Step to the next item in the iteration
     
    37933792  return S_FALSE;
    37943793}
    3795        
     3794
    37963795HRESULT WINAPI IEnumSTATSTGImpl_Reset(
    37973796  IEnumSTATSTG* iface)
     
    38123811  readSuccessful = StorageImpl_ReadProperty(
    38133812                    This->parentStorage,
    3814                     This->firstPropertyNode, 
     3813                    This->firstPropertyNode,
    38153814                    &rootProperty);
    38163815
     
    38273826  return S_OK;
    38283827}
    3829        
     3828
    38303829HRESULT WINAPI IEnumSTATSTGImpl_Clone(
    38313830  IEnumSTATSTG* iface,
     
    38413840  if (ppenum==0)
    38423841    return E_INVALIDARG;
    3843  
     3842
    38443843  newClone = IEnumSTATSTGImpl_Construct(This->parentStorage,
    38453844               This->firstPropertyNode);
    38463845
    3847  
     3846
    38483847  /*
    38493848   * The new clone enumeration must point to the same current node as
     
    38523851  newClone->stackSize    = This->stackSize    ;
    38533852  newClone->stackMaxSize = This->stackMaxSize ;
    3854   newClone->stackToVisit = 
     3853  newClone->stackToVisit =
    38553854    HeapAlloc(GetProcessHeap(), 0, sizeof(ULONG) * newClone->stackMaxSize);
    38563855
    38573856  memcpy(
    3858     newClone->stackToVisit, 
    3859     This->stackToVisit, 
     3857    newClone->stackToVisit,
     3858    This->stackToVisit,
    38603859    sizeof(ULONG) * newClone->stackSize);
    38613860
     
    38733872INT IEnumSTATSTGImpl_FindParentProperty(
    38743873  IEnumSTATSTGImpl *This,
    3875   ULONG             childProperty, 
     3874  ULONG             childProperty,
    38763875  StgProperty      *currentProperty,
    38773876  ULONG            *thisNodeId)
     
    38913890   */
    38923891  currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE);
    3893  
     3892
    38943893
    38953894  while (currentSearchNode!=PROPERTY_NULL)
     
    39003899    *thisNodeId = currentSearchNode;
    39013900
    3902     /* 
     3901    /*
    39033902     * Remove the top node from the stack
    39043903     */
     
    39103909    StorageImpl_ReadProperty(
    39113910      This->parentStorage,
    3912       currentSearchNode, 
     3911      currentSearchNode,
    39133912      currentProperty);
    3914      
     3913
    39153914    if (currentProperty->previousProperty == childProperty)
    39163915      return PROPERTY_RELATION_PREVIOUS;
    39173916
    3918     else if (currentProperty->nextProperty == childProperty) 
     3917    else if (currentProperty->nextProperty == childProperty)
    39193918      return PROPERTY_RELATION_NEXT;
    3920  
     3919
    39213920    else if (currentProperty->dirProperty == childProperty)
    39223921      return PROPERTY_RELATION_DIR;
    3923        
     3922
    39243923    /*
    39253924     * Push the next search node in the search stack.
     
    39503949  while (currentSearchNode!=PROPERTY_NULL)
    39513950  {
    3952     /* 
     3951    /*
    39533952     * Remove the top node from the stack
    39543953     */
     
    39593958     */
    39603959    StorageImpl_ReadProperty(This->parentStorage,
    3961       currentSearchNode, 
     3960      currentSearchNode,
    39623961      currentProperty);
    39633962
    39643963    if ( propertyNameCmp(
    3965           (OLECHAR*)currentProperty->name, 
     3964          (OLECHAR*)currentProperty->name,
    39663965          (OLECHAR*)lpszPropName) == 0)
    39673966      return currentSearchNode;
     
    40024001
    40034002    This->stackToVisit = HeapReAlloc(
    4004                            GetProcessHeap(), 
     4003                           GetProcessHeap(),
    40054004                           0,
    40064005                           This->stackToVisit,
     
    40164015  readSuccessful = StorageImpl_ReadProperty(
    40174016                    This->parentStorage,
    4018                     nodeToPush, 
     4017                    nodeToPush,
    40194018                    &rootProperty);
    40204019
     
    41034102  else
    41044103  {
    4105     destination->pwcsName = 
     4104    destination->pwcsName =
    41064105      CoTaskMemAlloc((lstrlenW(source->name)+1)*sizeof(WCHAR));
    41074106
    41084107    strcpyW((LPWSTR)destination->pwcsName, source->name);
    41094108  }
    4110  
     4109
    41114110  switch (source->propertyType)
    41124111  {
     
    41204119    default:
    41214120      destination->type = STGTY_STREAM;
    4122       break;       
     4121      break;
    41234122  }
    41244123
    41254124  destination->cbSize            = source->size;
    4126 /*   
     4125/*
    41274126  currentReturnStruct->mtime     = {0}; TODO
    41284127  currentReturnStruct->ctime     = {0};
    4129   currentReturnStruct->atime     = {0}; 
     4128  currentReturnStruct->atime     = {0};
    41304129*/
    41314130  destination->grfMode           = 0;
    4132   destination->grfLocksSupported = 0; 
     4131  destination->grfLocksSupported = 0;
    41334132  destination->clsid             = source->propertyUniqueID;
    4134   destination->grfStateBits      = 0; 
    4135   destination->reserved          = 0; 
     4133  destination->grfStateBits      = 0;
     4134  destination->reserved          = 0;
    41364135}
    41374136
     
    41414140
    41424141BlockChainStream* BlockChainStream_Construct(
    4143   StorageImpl* parentStorage, 
     4142  StorageImpl* parentStorage,
    41444143  ULONG*         headOfStreamPlaceHolder,
    41454144  ULONG          propertyIndex)
     
    42144213 * Returns the number of blocks that comprises this chain.
    42154214 * This is not the size of the stream as the last block may not be full!
    4216  * 
     4215 *
    42174216 */
    42184217ULONG BlockChainStream_GetCount(BlockChainStream* This)
     
    42284227
    42294228    blockIndex = StorageImpl_GetNextBlockInChain(
    4230                    This->parentStorage, 
     4229                   This->parentStorage,
    42314230                   blockIndex);
    42324231  }
     
    42364235
    42374236/******************************************************************************
    4238  *      BlockChainStream_ReadAt 
     4237 *      BlockChainStream_ReadAt
    42394238 *
    42404239 * Reads a specified number of bytes from this chain at the specified offset.
     
    42764275  while ( (blockNoInSequence > 0) &&  (blockIndex != BLOCK_END_OF_CHAIN))
    42774276  {
    4278     blockIndex = 
     4277    blockIndex =
    42794278      StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex);
    4280    
     4279
    42814280    blockNoInSequence--;
    42824281  }
     
    42894288  *bytesRead   = 0;
    42904289  bufferWalker = buffer;
    4291  
     4290
    42924291  while ( (size > 0) && (blockIndex != BLOCK_END_OF_CHAIN) )
    42934292  {
     
    42954294     * Calculate how many bytes we can copy from this big block.
    42964295     */
    4297     bytesToReadInBuffer = 
     4296    bytesToReadInBuffer =
    42984297      min(This->parentStorage->bigBlockSize - offsetInBlock, size);
    4299    
     4298
    43004299    /*
    43014300     * Copy those bytes to the buffer
    43024301     */
    4303     bigBlockBuffer = 
     4302    bigBlockBuffer =
    43044303      StorageImpl_GetROBigBlock(This->parentStorage, blockIndex);
    4305    
     4304
    43064305    memcpy(bufferWalker, bigBlockBuffer + offsetInBlock, bytesToReadInBuffer);
    4307    
     4306
    43084307    StorageImpl_ReleaseBigBlock(This->parentStorage, bigBlockBuffer);
    4309    
     4308
    43104309    /*
    43114310     * Step to the next big block.
    43124311     */
    4313     blockIndex    = 
     4312    blockIndex    =
    43144313      StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex);
    43154314
     
    43204319
    43214320  }
    4322  
     4321
    43234322  return (size == 0);
    43244323}
     
    43654364  while ( (blockNoInSequence > 0) &&  (blockIndex != BLOCK_END_OF_CHAIN))
    43664365  {
    4367     blockIndex = 
     4366    blockIndex =
    43684367      StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex);
    4369    
     4368
    43704369    blockNoInSequence--;
    43714370  }
     
    43854384     * Calculate how many bytes we can copy from this big block.
    43864385     */
    4387     bytesToWrite = 
     4386    bytesToWrite =
    43884387      min(This->parentStorage->bigBlockSize - offsetInBlock, size);
    4389    
     4388
    43904389    /*
    43914390     * Copy those bytes to the buffer
    43924391     */
    43934392    bigBlockBuffer = StorageImpl_GetBigBlock(This->parentStorage, blockIndex);
    4394    
     4393
    43954394    memcpy(bigBlockBuffer + offsetInBlock, bufferWalker, bytesToWrite);
    4396    
     4395
    43974396    StorageImpl_ReleaseBigBlock(This->parentStorage, bigBlockBuffer);
    4398    
     4397
    43994398    /*
    44004399     * Step to the next big block.
    44014400     */
    4402     blockIndex    = 
     4401    blockIndex    =
    44034402      StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex);
    44044403
     
    44084407    offsetInBlock  = 0;      /* There is no offset on the next block */
    44094408  }
    4410  
     4409
    44114410  return (size == 0);
    44124411}
     
    44454444  while (count < numBlocks)
    44464445  {
    4447     blockIndex = 
     4446    blockIndex =
    44484447      StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex);
    44494448
     
    44524451
    44534452  /* Get the next block before marking the new end */
    4454   extraBlock = 
     4453  extraBlock =
    44554454    StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex);
    44564455
    44574456  /* Mark the new end of chain */
    44584457  StorageImpl_SetNextBlockInChain(
    4459     This->parentStorage, 
    4460     blockIndex, 
     4458    This->parentStorage,
     4459    blockIndex,
    44614460    BLOCK_END_OF_CHAIN);
    44624461
     
    44694468  while (extraBlock != BLOCK_END_OF_CHAIN)
    44704469  {
    4471     blockIndex = 
     4470    blockIndex =
    44724471      StorageImpl_GetNextBlockInChain(This->parentStorage, extraBlock);
    44734472
     
    45134512
    45144513      StorageImpl_ReadProperty(
    4515         This->parentStorage, 
     4514        This->parentStorage,
    45164515        This->ownerPropertyIndex,
    45174516        &chainProp);
    45184517
    4519       chainProp.startingBlock = blockIndex; 
     4518      chainProp.startingBlock = blockIndex;
    45204519
    45214520      StorageImpl_WriteProperty(
    4522         This->parentStorage, 
     4521        This->parentStorage,
    45234522        This->ownerPropertyIndex,
    45244523        &chainProp);
     
    45694568
    45704569      StorageImpl_SetNextBlockInChain(
    4571         This->parentStorage, 
    4572         currentBlock, 
     4570        This->parentStorage,
     4571        currentBlock,
    45734572        blockIndex);
    45744573
    45754574      StorageImpl_SetNextBlockInChain(
    4576         This->parentStorage, 
    4577         blockIndex, 
     4575        This->parentStorage,
     4576        blockIndex,
    45784577        BLOCK_END_OF_CHAIN);
    45794578
     
    45974596 * TODO: Free the actual blocks in the file when we shrink the chain.
    45984597 *       Currently, the blocks are still in the file. So the file size
    4599  *       doesn't shrink even if we shrink streams. 
     4598 *       doesn't shrink even if we shrink streams.
    46004599 */
    46014600BOOL BlockChainStream_SetSize(
     
    46144613  else
    46154614  {
    4616     ULARGE_INTEGER fileSize = 
     4615    ULARGE_INTEGER fileSize =
    46174616      BIGBLOCKFILE_GetSize(This->parentStorage->bigBlockFile);
    46184617
     
    46234622     */
    46244623    if ((diff % This->parentStorage->bigBlockSize) != 0)
    4625       diff += (This->parentStorage->bigBlockSize - 
     4624      diff += (This->parentStorage->bigBlockSize -
    46264625                (diff % This->parentStorage->bigBlockSize) );
    46274626
     
    46474646  if(This->headOfStreamPlaceHolder == NULL)
    46484647  {
    4649     /* 
    4650      * This chain is a data stream read the property and return 
     4648    /*
     4649     * This chain is a data stream read the property and return
    46514650     * the appropriate size
    46524651     */
     
    46614660  {
    46624661    /*
    4663      * this chain is a chain that does not have a property, figure out the 
    4664      * size by making the product number of used blocks times the 
     4662     * this chain is a chain that does not have a property, figure out the
     4663     * size by making the product number of used blocks times the
    46654664     * size of them
    46664665     */
     
    46684667    result.s.HighPart = 0;
    46694668
    4670     result.s.LowPart  = 
    4671       BlockChainStream_GetCount(This) * 
     4669    result.s.LowPart  =
     4670      BlockChainStream_GetCount(This) *
    46724671      This->parentStorage->bigBlockSize;
    46734672
     
    46814680
    46824681SmallBlockChainStream* SmallBlockChainStream_Construct(
    4683   StorageImpl* parentStorage, 
     4682  StorageImpl* parentStorage,
    46844683  ULONG          propertyIndex)
    46854684{
     
    47324731 *
    47334732 * Returns the index of the next small block in this chain.
    4734  * 
     4733 *
    47354734 * Return Values:
    47364735 *    - BLOCK_END_OF_CHAIN: end of this chain
     
    48594858    else
    48604859    {
    4861       ULONG count = 
     4860      ULONG count =
    48624861        BlockChainStream_GetCount(This->parentStorage->smallBlockDepotChain);
    48634862
     
    48704869      {
    48714870        sbdIndex = nextBlock;
    4872         nextBlock = 
     4871        nextBlock =
    48734872          StorageImpl_GetNextBlockInChain(This->parentStorage, sbdIndex);
    48744873      }
     
    48774876      if (sbdIndex != BLOCK_END_OF_CHAIN)
    48784877        StorageImpl_SetNextBlockInChain(
    4879           This->parentStorage, 
    4880           sbdIndex, 
     4878          This->parentStorage,
     4879          sbdIndex,
    48814880          newsbdIndex);
    48824881
    48834882      StorageImpl_SetNextBlockInChain(
    4884         This->parentStorage, 
    4885         newsbdIndex, 
     4883        This->parentStorage,
     4884        newsbdIndex,
    48864885        BLOCK_END_OF_CHAIN);
    48874886
     
    48894888       * Initialize all the small blocks to free
    48904889       */
    4891       smallBlockDepot = 
     4890      smallBlockDepot =
    48924891        StorageImpl_GetBigBlock(This->parentStorage, newsbdIndex);
    48934892
     
    49014900         */
    49024901        StgProperty rootProp;
    4903         ULONG sbStartIndex; 
     4902        ULONG sbStartIndex;
    49044903
    49054904        /*
     
    49104909
    49114910        /*
    4912          * And allocate the first big block that will contain small blocks 
     4911         * And allocate the first big block that will contain small blocks
    49134912         */
    4914         sbStartIndex = 
     4913        sbStartIndex =
    49154914          StorageImpl_GetNextFreeBigBlock(This->parentStorage);
    49164915
    49174916        StorageImpl_SetNextBlockInChain(
    4918           This->parentStorage, 
    4919           sbStartIndex, 
     4917          This->parentStorage,
     4918          sbStartIndex,
    49204919          BLOCK_END_OF_CHAIN);
    49214920
    49224921        StorageImpl_ReadProperty(
    4923           This->parentStorage, 
    4924           This->parentStorage->rootPropertySetIndex, 
     4922          This->parentStorage,
     4923          This->parentStorage->rootPropertySetIndex,
    49254924          &rootProp);
    49264925
     
    49304929
    49314930        StorageImpl_WriteProperty(
    4932           This->parentStorage, 
    4933           This->parentStorage->rootPropertySetIndex, 
     4931          This->parentStorage,
     4932          This->parentStorage->rootPropertySetIndex,
    49344933          &rootProp);
    49354934      }
     
    49374936  }
    49384937
    4939   smallBlocksPerBigBlock = 
     4938  smallBlocksPerBigBlock =
    49404939    This->parentStorage->bigBlockSize / This->parentStorage->smallBlockSize;
    49414940
     
    49494948
    49504949    StorageImpl_ReadProperty(
    4951       This->parentStorage, 
    4952       This->parentStorage->rootPropertySetIndex, 
     4950      This->parentStorage,
     4951      This->parentStorage->rootPropertySetIndex,
    49534952      &rootProp);
    49544953
    4955     if (rootProp.size.s.LowPart < 
     4954    if (rootProp.size.s.LowPart <
    49564955       (blocksRequired * This->parentStorage->bigBlockSize))
    49574956    {
     
    49594958
    49604959      BlockChainStream_SetSize(
    4961         This->parentStorage->smallBlockRootChain, 
     4960        This->parentStorage->smallBlockRootChain,
    49624961        rootProp.size);
    49634962
    49644963      StorageImpl_WriteProperty(
    4965         This->parentStorage, 
    4966         This->parentStorage->rootPropertySetIndex, 
     4964        This->parentStorage,
     4965        This->parentStorage->rootPropertySetIndex,
    49674966        &rootProp);
    49684967    }
     
    49774976 * Reads a specified number of bytes from this chain at the specified offset.
    49784977 * bytesRead may be NULL.
    4979  * Failure will be returned if the specified number of bytes has not been read. 
     4978 * Failure will be returned if the specified number of bytes has not been read.
    49804979 */
    49814980BOOL SmallBlockChainStream_ReadAt(
     
    49874986{
    49884987  ULARGE_INTEGER offsetInBigBlockFile;
    4989   ULONG blockNoInSequence = 
     4988  ULONG blockNoInSequence =
    49904989    offset.s.LowPart / This->parentStorage->smallBlockSize;
    49914990
     
    50245023     * Calculate how many bytes we can copy from this small block.
    50255024     */
    5026     bytesToReadInBuffer = 
     5025    bytesToReadInBuffer =
    50275026      min(This->parentStorage->smallBlockSize - offsetInBlock, size);
    50285027
     
    50315030     */
    50325031    offsetInBigBlockFile.s.HighPart  = 0;
    5033     offsetInBigBlockFile.s.LowPart   = 
     5032    offsetInBigBlockFile.s.LowPart   =
    50345033      blockIndex * This->parentStorage->smallBlockSize;
    50355034
     
    50755074{
    50765075  ULARGE_INTEGER offsetInBigBlockFile;
    5077   ULONG blockNoInSequence = 
     5076  ULONG blockNoInSequence =
    50785077    offset.s.LowPart / This->parentStorage->smallBlockSize;
    50795078
     
    50835082  ULONG bytesWrittenFromBigBlockFile;
    50845083  BYTE* bufferWalker;
    5085  
     5084
    50865085  /*
    50875086   * This should never happen on a small block file.
    50885087   */
    50895088  assert(offset.s.HighPart==0);
    5090  
     5089
    50915090  /*
    50925091   * Find the first block in the stream that contains part of the buffer.
    50935092   */
    50945093  blockIndex = SmallBlockChainStream_GetHeadOfChain(This);
    5095  
     5094
    50965095  while ( (blockNoInSequence > 0) &&  (blockIndex != BLOCK_END_OF_CHAIN))
    50975096  {
    50985097    blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex);
    5099    
     5098
    51005099    blockNoInSequence--;
    51015100  }
    5102  
     5101
    51035102  /*
    51045103   * Start writing the buffer.
     
    51145113     * Calculate how many bytes we can copy to this small block.
    51155114     */
    5116     bytesToWriteInBuffer = 
     5115    bytesToWriteInBuffer =
    51175116      min(This->parentStorage->smallBlockSize - offsetInBlock, size);
    5118    
     5117
    51195118    /*
    51205119     * Calculate the offset of the small block in the small block file.
    51215120     */
    51225121    offsetInBigBlockFile.s.HighPart  = 0;
    5123     offsetInBigBlockFile.s.LowPart   = 
     5122    offsetInBigBlockFile.s.LowPart   =
    51245123      blockIndex * This->parentStorage->smallBlockSize;
    51255124
    51265125    offsetInBigBlockFile.s.LowPart  += offsetInBlock;
    5127    
     5126
    51285127    /*
    51295128     * Write those bytes in the buffer to the small block file.
     
    51345133      bufferWalker,
    51355134      &bytesWrittenFromBigBlockFile);
    5136    
     5135
    51375136    assert(bytesWrittenFromBigBlockFile == bytesToWriteInBuffer);
    5138    
     5137
    51395138    /*
    51405139     * Step to the next big block.
     
    51465145    offsetInBlock  = 0;     /* There is no offset on the next block */
    51475146  }
    5148  
     5147
    51495148  return (size == 0);
    51505149}
     
    51535152 *       SmallBlockChainStream_Shrink
    51545153 *
    5155  * Shrinks this chain in the small block depot. 
     5154 * Shrinks this chain in the small block depot.
    51565155 */
    51575156BOOL SmallBlockChainStream_Shrink(
     
    51815180  /*
    51825181   * If the count is 0, we have a special case, the head of the chain was
    5183    * just freed. 
     5182   * just freed.
    51845183   */
    51855184  if (count == 0)
     
    51875186    StgProperty chainProp;
    51885187
    5189     StorageImpl_ReadProperty(This->parentStorage, 
     5188    StorageImpl_ReadProperty(This->parentStorage,
    51905189                             This->ownerPropertyIndex,
    51915190                             &chainProp);
     
    52095208    /* Mark the new end of chain */
    52105209    SmallBlockChainStream_SetNextBlockInChain(
    5211       This, 
    5212       blockIndex, 
     5210      This,
     5211      blockIndex,
    52135212      BLOCK_END_OF_CHAIN);
    52145213  }
     
    52245223  }
    52255224
    5226   return TRUE; 
     5225  return TRUE;
    52275226}
    52285227
     
    52605259    blockIndex = chainProp.startingBlock;
    52615260    SmallBlockChainStream_SetNextBlockInChain(
    5262       This, 
    5263       blockIndex, 
     5261      This,
     5262      blockIndex,
    52645263      BLOCK_END_OF_CHAIN);
    52655264  }
     
    52945293
    52955294    SmallBlockChainStream_SetNextBlockInChain(
    5296       This, 
    5297       blockIndex, 
     5295      This,
     5296      blockIndex,
    52985297      BLOCK_END_OF_CHAIN);
    52995298
     
    53365335 * TODO: Free the actual blocks in the file when we shrink the chain.
    53375336 *       Currently, the blocks are still in the file. So the file size
    5338  *       doesn't shrink even if we shrink streams. 
     5337 *       doesn't shrink even if we shrink streams.
    53395338 */
    53405339BOOL SmallBlockChainStream_SetSize(
     
    53945393  WCHAR          tempFileName[MAX_PATH];
    53955394
    5396   TRACE("(%s, %lx, %ld, %p)\n", 
    5397         debugstr_w(pwcsName), grfMode, 
     5395  TRACE("(%s, %lx, %ld, %p)\n",
     5396        debugstr_w(pwcsName), grfMode,
    53985397        reserved, ppstgOpen);
    53995398
     
    54425441
    54435442  /*
    5444    * Interpret the STGM value grfMode 
     5443   * Interpret the STGM value grfMode
    54455444   */
    54465445  shareMode    = GetShareModeFromSTGM(grfMode);
     
    54675466                        fileAttributes,
    54685467            0);
    5469  
     5468
    54705469  if (hFile == INVALID_HANDLE_VALUE)
    54715470  {
     
    54775476   */
    54785477  newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageImpl));
    5479  
     5478
    54805479  if (newStorage == 0)
    54815480    return STG_E_INSUFFICIENTMEMORY;
     
    54895488         TRUE,
    54905489         TRUE);
    5491  
     5490
    54925491  if (FAILED(hr))
    54935492  {
     
    55155514  DWORD           grfMode,
    55165515  SNB           snbExclude,
    5517   DWORD           reserved, 
     5516  DWORD           reserved,
    55185517  IStorage      **ppstgOpen)
    55195518{
     
    55265525  DWORD          length;
    55275526
    5528   TRACE("(%s, %p, %lx, %p, %ld, %p)\n", 
     5527  TRACE("(%s, %p, %lx, %p, %ld, %p)\n",
    55295528        debugstr_w(pwcsName), pstgPriority, grfMode,
    55305529        snbExclude, reserved, ppstgOpen);
     
    55585557   */
    55595558  *ppstgOpen = 0;
    5560  
    5561   hFile = CreateFileW( pwcsName, 
     5559
     5560  hFile = CreateFileW( pwcsName,
    55625561                       accessMode,
    55635562                       shareMode,
     
    55665565                       FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS,
    55675566                       0);
    5568  
     5567
    55695568  length = GetFileSize(hFile, NULL);
    5570  
     5569
    55715570  if (hFile==INVALID_HANDLE_VALUE)
    55725571  {
     
    56055604   */
    56065605  newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageImpl));
    5607  
     5606
    56085607  if (newStorage == 0)
    56095608  {
     
    56215620         TRUE,
    56225621         !length );
    5623  
     5622
    56245623  if (FAILED(hr))
    56255624  {
     
    56325631    goto end;
    56335632  }
    5634  
     5633
    56355634  /* prepare the file name string given in lieu of the root property name */
    56365635  GetFullPathNameW(pwcsName, MAX_PATH, fullname, NULL);
     
    56455644         (REFIID)&IID_IStorage,
    56465645         (void**)ppstgOpen);
    5647  
     5646
    56485647end:
    56495648  TRACE("<-- %08lx, IStorage %p\n", hr, ppstgOpen ? *ppstgOpen : NULL);
     
    57005699         (void**)ppstgOpen);
    57015700
    5702   return hr; 
     5701  return hr;
    57035702}
    57045703
     
    57385737   */
    57395738  newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageImpl));
    5740  
     5739
    57415740  if (newStorage == 0)
    57425741    return STG_E_INSUFFICIENTMEMORY;
     
    58265825    STATSTG pstatstg;
    58275826    HRESULT hRes;
    5828    
     5827
    58295828    TRACE("()\n");
    58305829
     
    58875886    CLSID clsid;
    58885887    HRESULT res;
    5889    
     5888
    58905889    TRACE("(%p,%p)\n",pPStm,pStm);
    58915890
     
    58935892
    58945893    if (SUCCEEDED(res)){
    5895        
     5894
    58965895        res=WriteClassStm(pStm,&clsid);
    58975896
     
    59115910 * STGM_TRANSACTED           0x00010000
    59125911 * STGM_SIMPLE               0x08000000
    5913  * 
     5912 *
    59145913 * STGM_READ                 0x00000000
    59155914 * STGM_WRITE                0x00000001
    59165915 * STGM_READWRITE            0x00000002
    5917  * 
     5916 *
    59185917 * STGM_SHARE_DENY_NONE      0x00000040
    59195918 * STGM_SHARE_DENY_READ      0x00000030
    59205919 * STGM_SHARE_DENY_WRITE     0x00000020
    59215920 * STGM_SHARE_EXCLUSIVE      0x00000010
    5922  * 
     5921 *
    59235922 * STGM_PRIORITY             0x00040000
    59245923 * STGM_DELETEONRELEASE      0x04000000
     
    59365935  BOOL bSTGM_SIMPLE           = ((stgm & STGM_SIMPLE) == STGM_SIMPLE);
    59375936  BOOL bSTGM_DIRECT           = ! (bSTGM_TRANSACTED || bSTGM_SIMPLE);
    5938    
     5937
    59395938  BOOL bSTGM_WRITE            = ((stgm & STGM_WRITE) == STGM_WRITE);
    59405939  BOOL bSTGM_READWRITE        = ((stgm & STGM_READWRITE) == STGM_READWRITE);
    59415940  BOOL bSTGM_READ             = ! (bSTGM_WRITE || bSTGM_READWRITE);
    5942    
     5941
    59435942  BOOL bSTGM_SHARE_DENY_NONE  =
    59445943                     ((stgm & STGM_SHARE_DENY_NONE)  == STGM_SHARE_DENY_NONE);
     
    59555954  BOOL bSTGM_CREATE           = ((stgm & STGM_CREATE) == STGM_CREATE);
    59565955  BOOL bSTGM_CONVERT          = ((stgm & STGM_CONVERT) == STGM_CONVERT);
    5957    
     5956
    59585957  BOOL bSTGM_NOSCRATCH        = ((stgm & STGM_NOSCRATCH) == STGM_NOSCRATCH);
    59595958  BOOL bSTGM_NOSNAPSHOT       = ((stgm & STGM_NOSNAPSHOT) == STGM_NOSNAPSHOT);
    59605959
    5961   /* 
     5960  /*
    59625961   * STGM_DIRECT | STGM_TRANSACTED | STGM_SIMPLE
    59635962   */
     
    59665965      return E_FAIL;
    59675966
    5968   /* 
     5967  /*
    59695968   * STGM_WRITE |  STGM_READWRITE | STGM_READ
    59705969   */
     
    59745973
    59755974  /*
    5976    * STGM_SHARE_DENY_NONE | others 
     5975   * STGM_SHARE_DENY_NONE | others
    59775976   * (I assume here that DENY_READ implies DENY_WRITE)
    59785977   */
    59795978  if ( bSTGM_SHARE_DENY_NONE )
    59805979    if ( bSTGM_SHARE_DENY_READ ||
    5981          bSTGM_SHARE_DENY_WRITE || 
    5982          bSTGM_SHARE_EXCLUSIVE) 
     5980         bSTGM_SHARE_DENY_WRITE ||
     5981         bSTGM_SHARE_EXCLUSIVE)
    59835982      return E_FAIL;
    59845983
     
    59955994  if ( bSTGM_NOSCRATCH && ! bSTGM_TRANSACTED )
    59965995    return E_FAIL;
    5997  
    5998   /*
    5999    * STGM_NOSNAPSHOT requires STGM_TRANSACTED and 
     5996
     5997  /*
     5998   * STGM_NOSNAPSHOT requires STGM_TRANSACTED and
    60005999   * not STGM_SHARE_EXCLUSIVE or STGM_SHARE_DENY_WRITE`
    60016000   */
    60026001  if (bSTGM_NOSNAPSHOT)
    60036002  {
    6004     if ( ! ( bSTGM_TRANSACTED && 
     6003    if ( ! ( bSTGM_TRANSACTED &&
    60056004           !(bSTGM_SHARE_EXCLUSIVE || bSTGM_SHARE_DENY_WRITE)) )
    60066005    return E_FAIL;
     
    60146013 *
    60156014 * This method will return a share mode flag from a STGM value.
    6016  * The STGM value is assumed valid. 
     6015 * The STGM value is assumed valid.
    60176016 */
    60186017static DWORD GetShareModeFromSTGM(DWORD stgm)
     
    60906089
    60916090/*************************************************************************
    6092  * OLECONVERT_LoadOLE10 [Internal] 
    6093  *
    6094  * Loads the OLE10 STREAM to memory 
     6091 * OLECONVERT_LoadOLE10 [Internal]
     6092 *
     6093 * Loads the OLE10 STREAM to memory
    60956094 *
    60966095 * PARAMS
     
    61056104 * NOTES
    61066105 *     This function is used by OleConvertOLESTREAMToIStorage only.
    6107  *     
     6106 *
    61086107 *     Memory allocated for pData must be freed by the caller
    61096108 */
     
    62606259
    62616260/*************************************************************************
    6262  * OLECONVERT_SaveOLE10 [Internal] 
    6263  *
    6264  * Saves the OLE10 STREAM From memory 
     6261 * OLECONVERT_SaveOLE10 [Internal]
     6262 *
     6263 * Saves the OLE10 STREAM From memory
    62656264 *
    62666265 * PARAMS
     
    62746273 * NOTES
    62756274 *     This function is used by OleConvertIStorageToOLESTREAM only.
    6276  *     
     6275 *
    62776276 */
    62786277HRESULT OLECONVERT_SaveOLE10(OLECONVERT_OLESTREAM_DATA *pData, LPOLESTREAM pOleStream)
     
    63686367
    63696368/*************************************************************************
    6370  * OLECONVERT_GetOLE20FromOLE10[Internal] 
     6369 * OLECONVERT_GetOLE20FromOLE10[Internal]
    63716370 *
    63726371 * This function copies OLE10 Data (the IStorage in the OLESTREAM) to disk,
    6373  * opens it, and copies the content to the dest IStorage for 
     6372 * opens it, and copies the content to the dest IStorage for
    63746373 * OleConvertOLESTREAMToIStorage
    6375  * 
     6374 *
    63766375 *
    63776376 * PARAMS
     
    63846383 *
    63856384 * NOTES
    6386  *     
    6387  *     
     6385 *
     6386 *
    63886387 */
    63896388void OLECONVERT_GetOLE20FromOLE10(LPSTORAGE pDestStorage, BYTE *pBuffer, DWORD nBufferLength)
     
    64206419
    64216420/*************************************************************************
    6422  * OLECONVERT_WriteOLE20ToBuffer [Internal] 
    6423  *
    6424  * Saves the OLE10 STREAM From memory 
     6421 * OLECONVERT_WriteOLE20ToBuffer [Internal]
     6422 *
     6423 * Saves the OLE10 STREAM From memory
    64256424 *
    64266425 * PARAMS
     
    64356434 *
    64366435 *     Used by OleConvertIStorageToOLESTREAM only.
    6437  *     
     6436 *
    64386437 */
    64396438DWORD OLECONVERT_WriteOLE20ToBuffer(LPSTORAGE pStorage, BYTE **pData)
     
    64476446
    64486447    *pData = NULL;
    6449    
     6448
    64506449    /* Create temp Storage */
    64516450    GetTempPathW(MAX_PATH, wstrTempDir);
     
    64746473
    64756474/*************************************************************************
    6476  * OLECONVERT_CreateOleStream [Internal] 
     6475 * OLECONVERT_CreateOleStream [Internal]
    64776476 *
    64786477 * Creates the "\001OLE" stream in the IStorage if neccessary.
     
    64896488 *     This stream is still unknown, MS Word seems to have extra data
    64906489 *     but since the data is stored in the OLESTREAM there should be
    6491  *     no need to recreate the stream.  If the stream is manually 
     6490 *     no need to recreate the stream.  If the stream is manually
    64926491 *     deleted it will create it with this default data.
    6493  *     
     6492 *
    64946493 */
    64956494void OLECONVERT_CreateOleStream(LPSTORAGE pStorage)
     
    64986497    IStream *pStream;
    64996498    WCHAR wstrStreamName[] = {1,'O', 'l', 'e', 0};
    6500     BYTE pOleStreamHeader [] = 
    6501     {
    6502         0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 
    6503         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    6504         0x00, 0x00, 0x00, 0x00 
     6499    BYTE pOleStreamHeader [] =
     6500    {
     6501        0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
     6502        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     6503        0x00, 0x00, 0x00, 0x00
    65056504    };
    6506    
     6505
    65076506    /* Create stream if not present */
    6508     hRes = IStorage_CreateStream(pStorage, wstrStreamName, 
     6507    hRes = IStorage_CreateStream(pStorage, wstrStreamName,
    65096508        STGM_WRITE  | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream );
    65106509
     
    65196518
    65206519/*************************************************************************
    6521  * OLECONVERT_CreateCompObjStream [Internal] 
     6520 * OLECONVERT_CreateCompObjStream [Internal]
    65226521 *
    65236522 * Creates a "\001CompObj" is the destination IStorage if necessary.
    65246523 *
    65256524 * PARAMS
    6526  *     pStorage       [I] The dest IStorage to create the CompObj Stream 
     6525 *     pStorage       [I] The dest IStorage to create the CompObj Stream
    65276526 *                        if necessary.
    65286527 *     strOleTypeName [I] The ProgID
     
    65366535 *
    65376536 *     The stream data is stored in the OLESTREAM and there should be
    6538  *     no need to recreate the stream.  If the stream is manually 
     6537 *     no need to recreate the stream.  If the stream is manually
    65396538 *     deleted it will attempt to create it by querying the registry.
    65406539 *
    6541  *     
     6540 *
    65426541 */
    65436542HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName)
     
    65586557
    65596558    /*  Create a CompObj stream if it doesn't exist */
    6560     hStorageRes = IStorage_CreateStream(pStorage, wstrStreamName, 
     6559    hStorageRes = IStorage_CreateStream(pStorage, wstrStreamName,
    65616560        STGM_WRITE  | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream );
    65626561    if(hStorageRes == S_OK)
     
    65796578            LONG hErr;
    65806579            /* Get the CLSID Default Name from the Registry */
    6581             hErr = RegOpenKeyA(HKEY_CLASSES_ROOT, IStorageCompObj.strProgIDName, &hKey); 
     6580            hErr = RegOpenKeyA(HKEY_CLASSES_ROOT, IStorageCompObj.strProgIDName, &hKey);
    65826581            if(hErr == ERROR_SUCCESS)
    65836582            {
     
    66216620
    66226621/*************************************************************************
    6623  * OLECONVERT_CreateOlePresStream[Internal] 
     6622 * OLECONVERT_CreateOlePresStream[Internal]
    66246623 *
    66256624 * Creates the "\002OlePres000" Stream with the Metafile data
     
    66286627 *     pStorage     [I] The dest IStorage to create \002OLEPres000 stream in.
    66296628 *     dwExtentX    [I] Width of the Metafile
    6630  *     dwExtentY    [I] Height of the Metafile 
     6629 *     dwExtentY    [I] Height of the Metafile
    66316630 *     pData        [I] Metafile data
    66326631 *     dwDataLength [I] Size of the Metafile data
     
    66386637 * NOTES
    66396638 *     This function is used by OleConvertOLESTREAMToIStorage only.
    6640  *     
     6639 *
    66416640 */
    66426641void OLECONVERT_CreateOlePresStream(LPSTORAGE pStorage, DWORD dwExtentX, DWORD dwExtentY , BYTE *pData, DWORD dwDataLength)
     
    66456644    IStream *pStream;
    66466645    WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0};
    6647     BYTE pOlePresStreamHeader [] = 
    6648     {
    6649         0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 
    6650         0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
     6646    BYTE pOlePresStreamHeader [] =
     6647    {
     6648        0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
     6649        0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
    66516650        0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
    66526651        0x00, 0x00, 0x00, 0x00
    66536652    };
    66546653
    6655     BYTE pOlePresStreamHeaderEmpty [] = 
    6656     {
    6657         0x00, 0x00, 0x00, 0x00, 
    6658         0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
     6654    BYTE pOlePresStreamHeaderEmpty [] =
     6655    {
     6656        0x00, 0x00, 0x00, 0x00,
     6657        0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
    66596658        0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
    66606659        0x00, 0x00, 0x00, 0x00
    66616660    };
    6662      
     6661
    66636662    /* Create the OlePres000 Stream */
    6664     hRes = IStorage_CreateStream(pStorage, wstrStreamName, 
     6663    hRes = IStorage_CreateStream(pStorage, wstrStreamName,
    66656664        STGM_CREATE | STGM_WRITE  | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream );
    66666665
     
    67066705
    67076706/*************************************************************************
    6708  * OLECONVERT_CreateOle10NativeStream [Internal] 
     6707 * OLECONVERT_CreateOle10NativeStream [Internal]
    67096708 *
    67106709 * Creates the "\001Ole10Native" Stream (should contain a BMP)
     
    67226721 *
    67236722 *     Might need to verify the data and return appropriate error message
    6724  *     
     6723 *
    67256724 */
    67266725void OLECONVERT_CreateOle10NativeStream(LPSTORAGE pStorage, BYTE *pData, DWORD dwDataLength)
     
    67296728    IStream *pStream;
    67306729    WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0};
    6731    
     6730
    67326731    /* Create the Ole10Native Stream */
    6733     hRes = IStorage_CreateStream(pStorage, wstrStreamName, 
     6732    hRes = IStorage_CreateStream(pStorage, wstrStreamName,
    67346733        STGM_CREATE | STGM_WRITE  | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream );
    67356734
     
    67456744
    67466745/*************************************************************************
    6747  * OLECONVERT_GetOLE10ProgID [Internal] 
     6746 * OLECONVERT_GetOLE10ProgID [Internal]
    67486747 *
    67496748 * Finds the ProgID (or OleTypeID) from the IStorage
     
    67616760 *     This function is used by OleConvertIStorageToOLESTREAM only.
    67626761 *
    6763  *     
     6762 *
    67646763 */
    67656764HRESULT OLECONVERT_GetOLE10ProgID(LPSTORAGE pStorage, char *strProgID, DWORD *dwSize)
     
    67726771
    67736772    /* Open the CompObj Stream */
    6774     hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, 
     6773    hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL,
    67756774        STGM_READ  | STGM_SHARE_EXCLUSIVE, 0, &pStream );
    67766775    if(hRes == S_OK)
     
    68096808            *dwSize = WideCharToMultiByte(CP_ACP, 0, wstrProgID, -1, strProgID, *dwSize, NULL, FALSE);
    68106809        }
    6811  
     6810
    68126811    }
    68136812    return hRes;
     
    68156814
    68166815/*************************************************************************
    6817  * OLECONVERT_GetOle10PresData [Internal] 
     6816 * OLECONVERT_GetOle10PresData [Internal]
    68186817 *
    68196818 * Converts IStorage "/001Ole10Native" stream to a OLE10 Stream
     
    68306829 *
    68316830 *     Memory allocated for pData must be freed by the caller
    6832  *     
    6833  *     
     6831 *
     6832 *
    68346833 */
    68356834void OLECONVERT_GetOle10PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA *pOleStreamData)
     
    68516850
    68526851    /* Open Ole10Native Stream */
    6853     hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, 
     6852    hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL,
    68546853        STGM_READ  | STGM_SHARE_EXCLUSIVE, 0, &pStream );
    68556854    if(hRes == S_OK)
     
    68706869
    68716870/*************************************************************************
    6872  * OLECONVERT_GetOle20PresData[Internal] 
     6871 * OLECONVERT_GetOle20PresData[Internal]
    68736872 *
    68746873 * Converts IStorage "/002OlePres000" stream to a OLE10 Stream
     
    68836882 * NOTES
    68846883 *     This function is used by OleConvertIStorageToOLESTREAM only.
    6885  *     
     6884 *
    68866885 *     Memory allocated for pData must be freed by the caller
    68876886 */
     
    69106909
    69116910    /* Open OlePress000 stream */
    6912     hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL, 
     6911    hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL,
    69136912        STGM_READ  | STGM_SHARE_EXCLUSIVE, 0, &pStream );
    69146913    if(hRes == S_OK)
     
    69586957
    69596958/*************************************************************************
    6960  * OleConvertOLESTREAMToIStorage [OLE32.87] 
     6959 * OleConvertOLESTREAMToIStorage [OLE32.87]
    69616960 *
    69626961 * Read info on MSDN
     
    69676966 *      Still some unknowns for the IStorage: "\002OlePres000", "\001CompObj",
    69686967 *      and "\001OLE" streams
    6969  *     
     6968 *
    69706969 */
    69716970HRESULT WINAPI OleConvertOLESTREAMToIStorage (
    6972     LPOLESTREAM pOleStream, 
    6973     LPSTORAGE pstg, 
     6971    LPOLESTREAM pOleStream,
     6972    LPSTORAGE pstg,
    69746973    const DVTARGETDEVICE* ptd)
    69756974{
     
    70627061 *      Still some unknowns for the IStorage: "\002OlePres000", "\001CompObj",
    70637062 *      and "\001OLE" streams.
    7064  *     
     7063 *
    70657064 */
    70667065HRESULT WINAPI OleConvertIStorageToOLESTREAM (
    7067     LPSTORAGE pstg, 
     7066    LPSTORAGE pstg,
    70687067    LPOLESTREAM pOleStream)
    70697068{
     
    70907089    {
    70917090        /* Was it originally Ole10 */
    7092         hRes = IStorage_OpenStream(pstg, wstrStreamName, 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream);   
     7091        hRes = IStorage_OpenStream(pstg, wstrStreamName, 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream);
    70937092        if(hRes == S_OK)
    70947093        {
Note: See TracChangeset for help on using the changeset viewer.