Ignore:
Timestamp:
Apr 26, 2001, 9:33:15 PM (25 years ago)
Author:
sandervl
Message:

resync with Wine 20010418

File:
1 edited

Legend:

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

    r5026 r5602  
    1212
    1313#ifdef __WIN32OS2__
    14 #define WINE_LARGE_INTEGER
    15 
    1614#include <odin.h>
    1715#include "ole32.h"
    1816#include "heapstring.h"
    19 
    2017#endif
    2118
     
    53045301    WCHAR prefix[] = { 'S', 'T', 'O', 0 };
    53055302
     5303    if (!(grfMode & STGM_SHARE_EXCLUSIVE))
     5304      return STG_E_INVALIDFLAG;
     5305    if (!(grfMode & (STGM_WRITE|STGM_READWRITE)))
     5306      return STG_E_INVALIDFLAG;
     5307
    53065308    memset(tempPath, 0, sizeof(tempPath));
    53075309    memset(tempFileName, 0, sizeof(tempFileName));
     
    53145316    else
    53155317      return STG_E_INSUFFICIENTMEMORY;
     5318
     5319    creationMode = TRUNCATE_EXISTING;
     5320  }
     5321  else
     5322  {
     5323    creationMode = GetCreationModeFromSTGM(grfMode);
    53165324  }
    53175325
     
    53215329  shareMode    = GetShareModeFromSTGM(grfMode);
    53225330  accessMode   = GetAccessModeFromSTGM(grfMode);
    5323   creationMode = GetCreationModeFromSTGM(grfMode);
    53245331
    53255332  if (grfMode & STGM_DELETEONRELEASE)
     
    54855492  {
    54865493    HeapFree(GetProcessHeap(), 0, newStorage);
     5494    /*
     5495     * According to the docs if the file is not a storage, return STG_E_FILEALREADYEXISTS
     5496     */
     5497    if(hr == STG_E_INVALIDHEADER)
     5498        return STG_E_FILEALREADYEXISTS;
    54875499    return hr;
    54885500  }
     
    56135625  return hr;
    56145626}
    5615 #ifndef __WIN32OS2__
     5627
    56165628/******************************************************************************
    56175629 *              StgSetTimes [ole32.150]
     
    56255637  return FALSE;
    56265638}
    5627 #endif
    56285639
    56295640/******************************************************************************
     
    64146425
    64156426        /* copy the OleTypeName to the compobj struct */
    6416         /* Note: in the test made, these where Identical      */
     6427        /* Note: in the test made, these were Identical      */
    64176428        IStorageCompObj.dwProgIDNameLength = strlen(strOleTypeName)+1;
    64186429        strcpy(IStorageCompObj.strProgIDName, strOleTypeName);
     
    69716982}
    69726983
     6984/***********************************************************************
     6985 *              GetConvertStg (OLE32.68)
     6986 */
     6987HRESULT WINAPI GetConvertStg(LPGUID guid) {
     6988    FIXME("(%s), unimplemented stub!\n",debugstr_guid(guid));
     6989    return E_FAIL;
     6990}
     6991
    69736992#ifdef __WIN32OS2__
     6993static const BYTE STORAGE_notmagic[8]={0x0e,0x11,0xfc,0x0d,0xd0,0xcf,0x11,0xe0};
     6994
    69746995/******************************************************************************
    69756996 * StgIsStorageFile16 [STORAGE.5]
    69766997 */
    69776998HRESULT WINAPI StgIsStorageFile16(LPCOLESTR16 fn) {
    6978 static const BYTE STORAGE_notmagic[8]={0x0e,0x11,0xfc,0x0d,0xd0,0xcf,0x11,0xe0};
    6979         HFILE           hf;
    6980         OFSTRUCT        ofs;
    6981         BYTE            magic[24];
    6982 
    6983         TRACE_(ole)("(\'%s\')\n",fn);
    6984         hf = OpenFile(fn,&ofs,OF_SHARE_DENY_NONE);
    6985         if (hf==HFILE_ERROR)
    6986                 return STG_E_FILENOTFOUND;
    6987         if (24!=_lread(hf,magic,24)) {
    6988                 WARN_(ole)(" too short\n");
    6989                 _lclose(hf);
    6990                 return S_FALSE;
    6991         }
    6992         if (!memcmp(magic,STORAGE_magic,8)) {
    6993                 WARN_(ole)(" -> YES\n");
    6994                 _lclose(hf);
    6995                 return S_OK;
    6996         }
    6997         if (!memcmp(magic,STORAGE_notmagic,8)) {
    6998                 WARN_(ole)(" -> NO\n");
    6999                 _lclose(hf);
    7000                 return S_FALSE;
    7001         }
    7002         if (!memcmp(magic,STORAGE_oldmagic,8)) {
    7003                 WARN_(ole)(" -> old format\n");
    7004                 _lclose(hf);
    7005                 return STG_E_OLDFORMAT;
    7006         }
    7007         WARN_(ole)(" -> Invalid header.\n");
    7008         _lclose(hf);
    7009         return STG_E_INVALIDHEADER;
    7010 }
    7011 
    7012 HRESULT WINAPI
    7013 StgIsStorageFile(LPCOLESTR fn)
    7014 {
    7015         LPOLESTR16      xfn = HEAP_strdupWtoA(GetProcessHeap(),0,fn);
    7016         HRESULT       ret = StgIsStorageFile16(xfn);
    7017 
    7018         HeapFree(GetProcessHeap(),0,xfn);
    7019         return ret;
     6999        HFILE           hf;
     7000        OFSTRUCT        ofs;
     7001        BYTE            magic[24];
     7002
     7003        TRACE("(\'%s\')\n",fn);
     7004        hf = OpenFile(fn,&ofs,OF_SHARE_DENY_NONE);
     7005        if (hf==HFILE_ERROR)
     7006                return STG_E_FILENOTFOUND;
     7007        if (24!=_lread(hf,magic,24)) {
     7008                WARN(" too short\n");
     7009                _lclose(hf);
     7010                return S_FALSE;
     7011        }
     7012        if (!memcmp(magic,STORAGE_magic,8)) {
     7013                WARN(" -> YES\n");
     7014                _lclose(hf);
     7015                return S_OK;
     7016        }
     7017        if (!memcmp(magic,STORAGE_notmagic,8)) {
     7018                WARN(" -> NO\n");
     7019                _lclose(hf);
     7020                return S_FALSE;
     7021        }
     7022        if (!memcmp(magic,STORAGE_oldmagic,8)) {
     7023                WARN(" -> old format\n");
     7024                _lclose(hf);
     7025                return STG_E_OLDFORMAT;
     7026        }
     7027        WARN(" -> Invalid header.\n");
     7028        _lclose(hf);
     7029        return STG_E_INVALIDHEADER;
     7030}
     7031
     7032/******************************************************************************
     7033 * StgIsStorageFile [OLE32.146]
     7034 */
     7035HRESULT WINAPI
     7036StgIsStorageFile(LPCOLESTR fn)
     7037{
     7038        LPOLESTR16      xfn = HEAP_strdupWtoA(GetProcessHeap(),0,fn);
     7039        HRESULT ret = StgIsStorageFile16(xfn);
     7040
     7041        HeapFree(GetProcessHeap(),0,xfn);
     7042        return ret;
    70207043}
    70217044#endif
Note: See TracChangeset for help on using the changeset viewer.