| 2 | |
| 3 | #if !defined(SFX_MODULE) && defined(_WIN_ALL) |
| 4 | void ExtractStreams20(Archive &Arc,const wchar *FileName) |
| 5 | { |
| 6 | if (Arc.BrokenHeader) |
| 7 | { |
| 8 | uiMsg(UIERROR_STREAMBROKEN,Arc.FileName,FileName); |
| 9 | ErrHandler.SetErrorCode(RARX_CRC); |
| 10 | return; |
| 11 | } |
| 12 | |
| 13 | if (Arc.StreamHead.Method<0x31 || Arc.StreamHead.Method>0x35 || Arc.StreamHead.UnpVer>VER_PACK) |
| 14 | { |
| 15 | uiMsg(UIERROR_STREAMUNKNOWN,Arc.FileName,FileName); |
| 16 | ErrHandler.SetErrorCode(RARX_WARNING); |
| 17 | return; |
| 18 | } |
| 19 | |
| 20 | wchar StreamName[NM+2]; |
| 21 | if (FileName[0]!=0 && FileName[1]==0) |
| 22 | { |
| 23 | // Convert single character names like f:stream to .\f:stream to |
| 24 | // resolve the ambiguity with drive letters. |
| 25 | wcsncpyz(StreamName,L".\\",ASIZE(StreamName)); |
| 26 | wcsncatz(StreamName,FileName,ASIZE(StreamName)); |
| 27 | } |
| 28 | else |
| 29 | wcsncpyz(StreamName,FileName,ASIZE(StreamName)); |
| 30 | if (wcslen(StreamName)+strlen(Arc.StreamHead.StreamName)>=ASIZE(StreamName) || |
| 31 | Arc.StreamHead.StreamName[0]!=':') |
| 32 | { |
| 33 | uiMsg(UIERROR_STREAMBROKEN,Arc.FileName,FileName); |
| 34 | ErrHandler.SetErrorCode(RARX_CRC); |
| 35 | return; |
| 36 | } |
| 37 | |
| 38 | wchar StoredName[NM]; |
| 39 | CharToWide(Arc.StreamHead.StreamName,StoredName,ASIZE(StoredName)); |
| 40 | ConvertPath(StoredName+1,StoredName+1,ASIZE(StoredName)-1); |
| 41 | |
| 42 | wcsncatz(StreamName,StoredName,ASIZE(StreamName)); |
| 43 | |
| 44 | FindData fd; |
| 45 | bool Found=FindFile::FastFind(FileName,&fd); |
| 46 | |
| 47 | if ((fd.FileAttr & FILE_ATTRIBUTE_READONLY)!=0) |
| 48 | SetFileAttr(FileName,fd.FileAttr & ~FILE_ATTRIBUTE_READONLY); |
| 49 | |
| 50 | File CurFile; |
| 51 | if (CurFile.WCreate(StreamName)) |
| 52 | { |
| 53 | ComprDataIO DataIO; |
| 54 | Unpack Unpack(&DataIO); |
| 55 | Unpack.Init(0x10000,false); |
| 56 | |
| 57 | DataIO.SetPackedSizeToRead(Arc.StreamHead.DataSize); |
| 58 | DataIO.EnableShowProgress(false); |
| 59 | DataIO.SetFiles(&Arc,&CurFile); |
| 60 | DataIO.UnpHash.Init(HASH_CRC32,1); |
| 61 | Unpack.SetDestSize(Arc.StreamHead.UnpSize); |
no test coverage detected