Changeset 5602 for trunk/src/ole32/storage32.c
- Timestamp:
- Apr 26, 2001, 9:33:15 PM (25 years ago)
- File:
-
- 1 edited
-
trunk/src/ole32/storage32.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ole32/storage32.c
r5026 r5602 12 12 13 13 #ifdef __WIN32OS2__ 14 #define WINE_LARGE_INTEGER15 16 14 #include <odin.h> 17 15 #include "ole32.h" 18 16 #include "heapstring.h" 19 20 17 #endif 21 18 … … 5304 5301 WCHAR prefix[] = { 'S', 'T', 'O', 0 }; 5305 5302 5303 if (!(grfMode & STGM_SHARE_EXCLUSIVE)) 5304 return STG_E_INVALIDFLAG; 5305 if (!(grfMode & (STGM_WRITE|STGM_READWRITE))) 5306 return STG_E_INVALIDFLAG; 5307 5306 5308 memset(tempPath, 0, sizeof(tempPath)); 5307 5309 memset(tempFileName, 0, sizeof(tempFileName)); … … 5314 5316 else 5315 5317 return STG_E_INSUFFICIENTMEMORY; 5318 5319 creationMode = TRUNCATE_EXISTING; 5320 } 5321 else 5322 { 5323 creationMode = GetCreationModeFromSTGM(grfMode); 5316 5324 } 5317 5325 … … 5321 5329 shareMode = GetShareModeFromSTGM(grfMode); 5322 5330 accessMode = GetAccessModeFromSTGM(grfMode); 5323 creationMode = GetCreationModeFromSTGM(grfMode);5324 5331 5325 5332 if (grfMode & STGM_DELETEONRELEASE) … … 5485 5492 { 5486 5493 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; 5487 5499 return hr; 5488 5500 } … … 5613 5625 return hr; 5614 5626 } 5615 #ifndef __WIN32OS2__ 5627 5616 5628 /****************************************************************************** 5617 5629 * StgSetTimes [ole32.150] … … 5625 5637 return FALSE; 5626 5638 } 5627 #endif5628 5639 5629 5640 /****************************************************************************** … … 6414 6425 6415 6426 /* copy the OleTypeName to the compobj struct */ 6416 /* Note: in the test made, these w here Identical */6427 /* Note: in the test made, these were Identical */ 6417 6428 IStorageCompObj.dwProgIDNameLength = strlen(strOleTypeName)+1; 6418 6429 strcpy(IStorageCompObj.strProgIDName, strOleTypeName); … … 6971 6982 } 6972 6983 6984 /*********************************************************************** 6985 * GetConvertStg (OLE32.68) 6986 */ 6987 HRESULT WINAPI GetConvertStg(LPGUID guid) { 6988 FIXME("(%s), unimplemented stub!\n",debugstr_guid(guid)); 6989 return E_FAIL; 6990 } 6991 6973 6992 #ifdef __WIN32OS2__ 6993 static const BYTE STORAGE_notmagic[8]={0x0e,0x11,0xfc,0x0d,0xd0,0xcf,0x11,0xe0}; 6994 6974 6995 /****************************************************************************** 6975 6996 * StgIsStorageFile16 [STORAGE.5] 6976 6997 */ 6977 6998 HRESULT 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 */ 7035 HRESULT WINAPI 7036 StgIsStorageFile(LPCOLESTR fn) 7037 { 7038 LPOLESTR16 xfn = HEAP_strdupWtoA(GetProcessHeap(),0,fn); 7039 HRESULT ret = StgIsStorageFile16(xfn); 7040 7041 HeapFree(GetProcessHeap(),0,xfn); 7042 return ret; 7020 7043 } 7021 7044 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
