本文整理汇总了C++中Archive::FileLength方法的典型用法代码示例。如果您正苦于以下问题:C++ Archive::FileLength方法的具体用法?C++ Archive::FileLength怎么用?C++ Archive::FileLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Archive
的用法示例。
在下文中一共展示了Archive::FileLength方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExtractArchiveInit
void CmdExtract::ExtractArchiveInit(CommandData *Cmd,Archive &Arc)
{
DataIO.UnpArcSize=Arc.FileLength();
FileCount=0;
MatchedArgs=0;
#ifndef SFX_MODULE
FirstFile=true;
#endif
if (*Cmd->Password!=0)
strcpy(Password,Cmd->Password);
PasswordAll=(*Cmd->Password!=0);
DataIO.UnpVolume=false;
PrevExtracted=false;
SignatureFound=false;
AllMatchesExact=true;
ReconstructDone=false;
}
示例2: ExtractArchiveInit
void CmdExtract::ExtractArchiveInit(Archive &Arc)
{
DataIO.UnpArcSize=Arc.FileLength();
FileCount=0;
MatchedArgs=0;
#ifndef SFX_MODULE
FirstFile=true;
#endif
PasswordAll=(Cmd->Password.IsSet());
DataIO.UnpVolume=false;
PrevExtracted=false;
AllMatchesExact=true;
ReconstructDone=false;
AnySolidDataUnpackedWell=false;
StartTime.SetCurrentTime();
}
示例3: ExtractCurrentFile
//.........这里部分代码省略.........
// If header is damaged, we cannot rely on password check value,
// because it can be damaged too.
if (Arc.FileHead.Encrypted && Arc.FileHead.UsePswCheck &&
memcmp(Arc.FileHead.PswCheck,PswCheck,SIZE_PSWCHECK)!=0 &&
!Arc.BrokenHeader)
{
uiMsg(UIERROR_BADPSW,Arc.FileName);
ErrHandler.SetErrorCode(RARX_BADPWD);
WrongPassword=true;
}
DataIO.CurUnpRead=0;
DataIO.CurUnpWrite=0;
DataIO.UnpHash.Init(Arc.FileHead.FileHash.Type,Cmd->Threads);
DataIO.PackedDataHash.Init(Arc.FileHead.FileHash.Type,Cmd->Threads);
DataIO.SetPackedSizeToRead(Arc.FileHead.PackSize);
DataIO.SetFiles(&Arc,&CurFile);
DataIO.SetTestMode(TestMode);
DataIO.SetSkipUnpCRC(SkipSolid);
#if defined(_WIN_ALL) && !defined(SFX_MODULE) && !defined(SILENT)
if (!TestMode && !WrongPassword && !Arc.BrokenHeader &&
Arc.FileHead.UnpSize>0xffffffff && (Fat32 || !NotFat32))
{
if (!Fat32) // Not detected yet.
NotFat32=!(Fat32=IsFAT(Cmd->ExtrPath));
if (Fat32)
uiMsg(UIMSG_FAT32SIZE); // Inform user about FAT32 size limit.
}
#endif
if (!TestMode && !WrongPassword && !Arc.BrokenHeader &&
(Arc.FileHead.PackSize<<11)>Arc.FileHead.UnpSize &&
(Arc.FileHead.UnpSize<100000000 || Arc.FileLength()>Arc.FileHead.PackSize))
CurFile.Prealloc(Arc.FileHead.UnpSize);
CurFile.SetAllowDelete(!Cmd->KeepBroken);
bool FileCreateMode=!TestMode && !SkipSolid && Command!='P';
bool ShowChecksum=true; // Display checksum verification result.
bool LinkSuccess=true; // Assume success for test mode.
if (LinkEntry)
{
FILE_SYSTEM_REDIRECT Type=Arc.FileHead.RedirType;
if (Type==FSREDIR_HARDLINK || Type==FSREDIR_FILECOPY)
{
wchar NameExisting[NM];
ExtrPrepareName(Arc,Arc.FileHead.RedirName,NameExisting,ASIZE(NameExisting));
if (FileCreateMode && *NameExisting!=0) // *NameExisting can be 0 in case of excessive -ap switch.
{
if (Type==FSREDIR_HARDLINK)
LinkSuccess=ExtractHardlink(DestFileName,NameExisting,ASIZE(NameExisting));
else
LinkSuccess=ExtractFileCopy(CurFile,Arc.FileName,DestFileName,NameExisting,ASIZE(NameExisting));
}
}
else
if (Type==FSREDIR_UNIXSYMLINK || Type==FSREDIR_WINSYMLINK || Type==FSREDIR_JUNCTION)
{
if (FileCreateMode)
LinkSuccess=ExtractSymlink(Cmd,DataIO,Arc,DestFileName);
}
else
{
示例4: MergeArchive
bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,char Command)
{
RAROptions *Cmd=Arc.GetRAROptions();
int HeaderType=Arc.GetHeaderType();
FileHeader *hd=HeaderType==NEWSUB_HEAD ? &Arc.SubHead:&Arc.NewLhd;
bool SplitHeader=(HeaderType==FILE_HEAD || HeaderType==NEWSUB_HEAD) &&
(hd->Flags & LHD_SPLIT_AFTER)!=0;
if (DataIO!=NULL && SplitHeader && hd->UnpVer>=20 &&
hd->FileCRC!=0xffffffff && DataIO->PackedCRC!=~hd->FileCRC)
{
Log(Arc.FileName,St(MDataBadCRC),hd->FileName,Arc.FileName);
}
Int64 PosBeforeClose=Arc.Tell();
if (DataIO!=NULL)
DataIO->ProcessedArcSize+=Arc.FileLength();
Arc.Close();
char NextName[NM];
wchar NextNameW[NM];
strcpy(NextName,Arc.FileName);
strcpyw(NextNameW,Arc.FileNameW);
NextVolumeName(NextName,NextNameW,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
#if !defined(SFX_MODULE) && !defined(RARDLL)
bool RecoveryDone=false;
#endif
bool FailedOpen=false,OldSchemeTested=false;
while (!Arc.Open(NextName,NextNameW))
{
// We need to open a new volume which size was not calculated
// in total size before, so we cannot calculate the total progress
// anymore. Let's reset the total size to zero and stop
// the total progress.
if (DataIO!=NULL)
DataIO->TotalArcSize=0;
if (!OldSchemeTested)
{
// Checking for new style volumes renamed by user to old style
// name format. Some users did it for unknown reason.
char AltNextName[NM];
wchar AltNextNameW[NM];
strcpy(AltNextName,Arc.FileName);
strcpyw(AltNextNameW,Arc.FileNameW);
NextVolumeName(AltNextName,AltNextNameW,ASIZE(AltNextName),true);
OldSchemeTested=true;
if (Arc.Open(AltNextName,AltNextNameW))
{
strcpy(NextName,AltNextName);
strcpyw(NextNameW,AltNextNameW);
break;
}
}
#ifdef RARDLL
if (Cmd->Callback==NULL && Cmd->ChangeVolProc==NULL ||
Cmd->Callback!=NULL && Cmd->Callback(UCM_CHANGEVOLUME,Cmd->UserData,(LPARAM)NextName,RAR_VOL_ASK)==-1)
{
Cmd->DllError=ERAR_EOPEN;
FailedOpen=true;
break;
}
if (Cmd->ChangeVolProc!=NULL)
{
#if defined(_WIN_32) && !defined(_MSC_VER) && !defined(__MINGW32__)
_EBX=_ESP;
#endif
int RetCode=Cmd->ChangeVolProc(NextName,RAR_VOL_ASK);
#if defined(_WIN_32) && !defined(_MSC_VER) && !defined(__MINGW32__)
_ESP=_EBX;
#endif
if (RetCode==0)
{
Cmd->DllError=ERAR_EOPEN;
FailedOpen=true;
break;
}
}
#else // RARDLL
#if !defined(SFX_MODULE) && !defined(_WIN_CE)
if (!RecoveryDone)
{
RecVolumes RecVol;
RecVol.Restore(Cmd,Arc.FileName,Arc.FileNameW,true);
RecoveryDone=true;
continue;
}
#endif
#ifndef GUI
if (!Cmd->VolumePause && !IsRemovable(NextName))
{
FailedOpen=true;
break;
//.........这里部分代码省略.........
示例5: ExtractCurrentFile
//.........这里部分代码省略.........
SecPassword FilePassword=Password;
#if defined(_WIN_ALL) && !defined(SFX_MODULE)
ConvertDosPassword(Arc,FilePassword);
#endif
byte PswCheck[SIZE_PSWCHECK];
DataIO.SetEncryption(false,Arc.FileHead.CryptMethod,&FilePassword,
Arc.FileHead.SaltSet ? Arc.FileHead.Salt:NULL,
Arc.FileHead.InitV,Arc.FileHead.Lg2Count,
PswCheck,Arc.FileHead.HashKey);
bool WrongPassword=false;
// If header is damaged, we cannot rely on password check value,
// because it can be damaged too.
if (Arc.FileHead.Encrypted && Arc.FileHead.UsePswCheck &&
memcmp(Arc.FileHead.PswCheck,PswCheck,SIZE_PSWCHECK)!=0 &&
!Arc.BrokenHeader)
{
Log(Arc.FileName,St(MWrongPassword));
ErrHandler.SetErrorCode(RARX_BADPWD);
WrongPassword=true;
}
DataIO.CurUnpRead=0;
DataIO.CurUnpWrite=0;
DataIO.UnpHash.Init(Arc.FileHead.FileHash.Type,Cmd->Threads);
DataIO.PackedDataHash.Init(Arc.FileHead.FileHash.Type,Cmd->Threads);
DataIO.SetPackedSizeToRead(Arc.FileHead.PackSize);
DataIO.SetFiles(&Arc,&CurFile);
DataIO.SetTestMode(TestMode);
DataIO.SetSkipUnpCRC(SkipSolid);
if (!TestMode && !WrongPassword && !Arc.BrokenHeader &&
(Arc.FileHead.PackSize<<11)>Arc.FileHead.UnpSize &&
(Arc.FileHead.UnpSize<100000000 || Arc.FileLength()>Arc.FileHead.PackSize))
CurFile.Prealloc(Arc.FileHead.UnpSize);
CurFile.SetAllowDelete(!Cmd->KeepBroken);
bool FileCreateMode=!TestMode && !SkipSolid && Command!='P';
bool ShowChecksum=true; // Display checksum verification result.
bool LinkSuccess=true; // Assume success for test mode.
if (LinkEntry)
{
FILE_SYSTEM_REDIRECT Type=Arc.FileHead.RedirType;
if (Type==FSREDIR_HARDLINK || Type==FSREDIR_FILECOPY)
{
wchar NameExisting[NM];
ExtrPrepareName(Cmd,Arc,Arc.FileHead.RedirName,NameExisting,ASIZE(NameExisting));
if (FileCreateMode && *NameExisting!=0) // *NameExisting can be 0 in case of excessive -ap switch.
if (Type==FSREDIR_HARDLINK)
LinkSuccess=ExtractHardlink(DestFileName,NameExisting,ASIZE(NameExisting));
else
LinkSuccess=ExtractFileCopy(Cmd,CurFile,Arc.FileName,DestFileName,NameExisting,ASIZE(NameExisting));
}
else
if (Type==FSREDIR_UNIXSYMLINK || Type==FSREDIR_WINSYMLINK || Type==FSREDIR_JUNCTION)
{
if (FileCreateMode)
LinkSuccess=ExtractSymlink(Cmd,DataIO,Arc,DestFileName);
}
else
{
#ifndef SFX_MODULE
Log(Arc.FileName,St(MUnknownExtra),DestFileName);
示例6: MergeArchive
bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,char Command)
{
RAROptions *Cmd=Arc.GetRAROptions();
int HeaderType=Arc.GetHeaderType();
FileHeader *hd=HeaderType==NEWSUB_HEAD ? &Arc.SubHead:&Arc.NewLhd;
bool SplitHeader=(HeaderType==FILE_HEAD || HeaderType==NEWSUB_HEAD) &&
(hd->Flags & LHD_SPLIT_AFTER)!=0;
if (DataIO!=NULL && SplitHeader && hd->UnpVer>=20 &&
hd->FileCRC!=0xffffffff && DataIO->PackedCRC!=~hd->FileCRC)
{
Log(Arc.FileName,St(MDataBadCRC),hd->FileName,Arc.FileName);
}
int64 PosBeforeClose=Arc.Tell();
if (DataIO!=NULL)
DataIO->ProcessedArcSize+=Arc.FileLength();
Arc.Close();
char NextName[NM];
wchar NextNameW[NM];
strcpy(NextName,Arc.FileName);
wcscpy(NextNameW,Arc.FileNameW);
NextVolumeName(NextName,NextNameW,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
#if !defined(SFX_MODULE) && !defined(RARDLL)
bool RecoveryDone=false;
#endif
bool FailedOpen=false,OldSchemeTested=false;
#if !defined(GUI) && !defined(SILENT)
// In -vp mode we force the pause before next volume even if it is present
// and even if we are on the hard disk. It is important when user does not
// want to process partially downloaded volumes preliminary.
if (Cmd->VolumePause && !AskNextVol(NextName,NextNameW))
FailedOpen=true;
#endif
if (!FailedOpen)
while (!Arc.Open(NextName,NextNameW,0))
{
// We need to open a new volume which size was not calculated
// in total size before, so we cannot calculate the total progress
// anymore. Let's reset the total size to zero and stop
// the total progress.
if (DataIO!=NULL)
DataIO->TotalArcSize=0;
if (!OldSchemeTested)
{
// Checking for new style volumes renamed by user to old style
// name format. Some users did it for unknown reason.
char AltNextName[NM];
wchar AltNextNameW[NM];
strcpy(AltNextName,Arc.FileName);
wcscpy(AltNextNameW,Arc.FileNameW);
NextVolumeName(AltNextName,AltNextNameW,ASIZE(AltNextName),true);
OldSchemeTested=true;
if (Arc.Open(AltNextName,AltNextNameW,0))
{
strcpy(NextName,AltNextName);
wcscpy(NextNameW,AltNextNameW);
break;
}
}
#ifdef RARDLL
bool DllVolChanged=false;
if (Cmd->Callback!=NULL)
{
GetWideName(NextName,NextNameW,NextNameW,ASIZE(NextNameW));
char CurName[ASIZE(NextName)];
strcpy(CurName,NextName);
wchar CurNameW[ASIZE(NextNameW)];
wcscpy(CurNameW,NextNameW);
if (Cmd->Callback(UCM_CHANGEVOLUMEW,Cmd->UserData,(LPARAM)NextNameW,RAR_VOL_ASK)!=-1 &&
wcscmp(CurNameW,NextNameW)!=0)
{
*NextName=0;
DllVolChanged=true;
}
else
if (Cmd->Callback(UCM_CHANGEVOLUME,Cmd->UserData,(LPARAM)NextName,RAR_VOL_ASK)!=-1 &&
strcmp(CurName,NextName)!=0)
{
*NextNameW=0;
DllVolChanged=true;
}
}
if (!DllVolChanged && Cmd->ChangeVolProc!=NULL)
{
// Here we preserve ESP value. It is necessary for those developers,
// who still define ChangeVolProc callback as "C" type function,
// even though in year 2001 we announced in unrar.dll whatsnew.txt
// that it will be PASCAL type (for compatibility with Visual Basic).
#if defined(_MSC_VER)
#ifndef _WIN_64
//.........这里部分代码省略.........
示例7: MergeArchive
//.........这里部分代码省略.........
// _ESP=_EBX;
//#endif
if (RetCode==0)
{
Cmd->DllError=ERAR_EOPEN;
FailedOpen=true;
break;
}
}
#else
#if !defined(SFX_MODULE) //&& !defined(_WIN_CE)
if (!RecoveryDone)
{
RecVolumes RecVol;
RecVol.Restore(Cmd,Arc.FileName,Arc.FileNameW,true);
RecoveryDone=true;
continue;
}
#endif
#ifndef GUI
if (!Cmd->VolumePause && !IsRemovable(NextName))
{
Log(Arc.FileName,St(MAbsNextVol),NextName);
FailedOpen=true;
break;
}
#endif
#ifndef SILENT
if (Cmd->AllYes || !AskNextVol(NextName))
#endif
{
FailedOpen=true;
break;
}
#endif
}
if (FailedOpen)
{
Arc.Open(Arc.FileName,Arc.FileNameW);
Arc.Seek(PosBeforeClose,SEEK_SET);
return(false);
}
Arc.CheckArc(true);
#ifdef RARDLL
if (Cmd->Callback!=NULL &&
Cmd->Callback(UCM_CHANGEVOLUME,Cmd->UserData,(LONG)NextName,RAR_VOL_NOTIFY)==-1)
return(false);
if (Cmd->ChangeVolProc!=NULL)
{
//#ifdef _WIN_32
// _EBX=_ESP;
//#endif
int RetCode=Cmd->ChangeVolProc(NextName,RAR_VOL_NOTIFY);
//#ifdef _WIN_32
// _ESP=_EBX;
//#endif
if (RetCode==0)
return(false);
}
#endif
if (Command=='T' || Command=='X' || Command=='E')
mprintf(St(Command=='T' ? MTestVol:MExtrVol),Arc.FileName);
if (SplitHeader)
Arc.SearchBlock(HeaderType);
else
Arc.ReadHeader();
if (Arc.GetHeaderType()==FILE_HEAD)
{
Arc.ConvertAttributes();
Arc.Seek(Arc.NextBlockPos-Arc.NewLhd.FullPackSize,SEEK_SET);
}
#ifndef GUI
if (ShowFileName)
{
mprintf(St(MExtrPoints),IntNameToExt(Arc.NewLhd.FileName));
if (!Cmd->DisablePercentage)
mprintf(" ");
}
#endif
if (DataIO!=NULL)
{
if (HeaderType==ENDARC_HEAD)
DataIO->UnpVolume=false;
else
{
DataIO->UnpVolume=(hd->Flags & LHD_SPLIT_AFTER);
DataIO->SetPackedSizeToRead(hd->FullPackSize);
}
#ifdef SFX_MODULE
DataIO->UnpArcSize=Arc.FileLength();
DataIO->CurUnpRead=0;
#endif
DataIO->PackedCRC=0xffffffff;
// DataIO->SetFiles(&Arc,NULL);
}
return(true);
}
示例8: MergeArchive
bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,wchar Command)
{
RAROptions *Cmd=Arc.GetRAROptions();
HEADER_TYPE HeaderType=Arc.GetHeaderType();
FileHeader *hd=HeaderType==HEAD_SERVICE ? &Arc.SubHead:&Arc.FileHead;
bool SplitHeader=(HeaderType==HEAD_FILE || HeaderType==HEAD_SERVICE) &&
hd->SplitAfter;
if (DataIO!=NULL && SplitHeader)
{
bool PackedHashPresent=Arc.Format==RARFMT50 ||
hd->UnpVer>=20 && hd->FileHash.CRC32!=0xffffffff;
if (PackedHashPresent &&
!DataIO->PackedDataHash.Cmp(&hd->FileHash,hd->UseHashKey ? hd->HashKey:NULL))
uiMsg(UIERROR_CHECKSUMPACKED, Arc.FileName, hd->FileName);
}
int64 PosBeforeClose=Arc.Tell();
if (DataIO!=NULL)
DataIO->ProcessedArcSize+=Arc.FileLength();
Arc.Close();
wchar NextName[NM];
wcscpy(NextName,Arc.FileName);
NextVolumeName(NextName,ASIZE(NextName),!Arc.NewNumbering);
#if !defined(SFX_MODULE) && !defined(RARDLL)
bool RecoveryDone=false;
#endif
bool FailedOpen=false,OldSchemeTested=false;
#if !defined(GUI) && !defined(SILENT)
// In -vp mode we force the pause before next volume even if it is present
// and even if we are on the hard disk. It is important when user does not
// want to process partially downloaded volumes preliminary.
if (Cmd->VolumePause && !uiAskNextVolume(NextName,ASIZE(NextName)))
FailedOpen=true;
#endif
uint OpenMode = Cmd->OpenShared ? FMF_OPENSHARED : 0;
if (!FailedOpen)
while (!Arc.Open(NextName,OpenMode))
{
// We need to open a new volume which size was not calculated
// in total size before, so we cannot calculate the total progress
// anymore. Let's reset the total size to zero and stop
// the total progress.
if (DataIO!=NULL)
DataIO->TotalArcSize=0;
if (!OldSchemeTested)
{
// Checking for new style volumes renamed by user to old style
// name format. Some users did it for unknown reason.
wchar AltNextName[NM];
wcscpy(AltNextName,Arc.FileName);
NextVolumeName(AltNextName,ASIZE(AltNextName),true);
OldSchemeTested=true;
if (Arc.Open(AltNextName,OpenMode))
{
wcscpy(NextName,AltNextName);
break;
}
}
#ifdef RARDLL
if (!DllVolChange(Cmd,NextName,ASIZE(NextName)))
{
FailedOpen=true;
break;
}
#else // !RARDLL
#ifndef SFX_MODULE
if (!RecoveryDone)
{
RecVolumesRestore(Cmd,Arc.FileName,true);
RecoveryDone=true;
continue;
}
#endif
#ifndef GUI
if (!Cmd->VolumePause && !IsRemovable(NextName))
{
FailedOpen=true;
break;
}
#endif
#ifndef SILENT
if (Cmd->AllYes || !uiAskNextVolume(NextName,ASIZE(NextName)))
#endif
{
FailedOpen=true;
break;
}
//.........这里部分代码省略.........
示例9: MergeArchive
//.........这里部分代码省略.........
RecoveryDone=true;
continue;
}
#endif
#ifndef GUI
if (!Cmd->VolumePause && !IsRemovable(NextName))
{
FailedOpen=true;
break;
}
#endif
#ifndef SILENT
if (Cmd->AllYes || !AskNextVol(NextName))
#endif
{
FailedOpen=true;
break;
}
#endif // RARDLL
*NextNameW=0;
}
if (FailedOpen)
{
#if !defined(SILENT) && !defined(_WIN_CE)
Log(Arc.FileName,St(MAbsNextVol),NextName);
#endif
Arc.Open(Arc.FileName,Arc.FileNameW);
Arc.Seek(PosBeforeClose,SEEK_SET);
return(false);
}
Arc.CheckArc(true);
#ifdef RARDLL
if (Cmd->Callback!=NULL &&
Cmd->Callback(UCM_CHANGEVOLUME,Cmd->UserData,(LONG)NextName,RAR_VOL_NOTIFY)==-1)
return(false);
if (Cmd->ChangeVolProc!=NULL)
{
#if defined(_WIN_32) && !defined(_MSC_VER) && !defined(__MINGW32__)
_EBX=_ESP;
#endif
int RetCode=Cmd->ChangeVolProc(NextName,RAR_VOL_NOTIFY);
#if defined(_WIN_32) && !defined(_MSC_VER) && !defined(__MINGW32__)
_ESP=_EBX;
#endif
if (RetCode==0)
return(false);
}
#endif
if (Command=='T' || Command=='X' || Command=='E')
mprintf(St(Command=='T' ? MTestVol:MExtrVol),Arc.FileName);
if (SplitHeader)
Arc.SearchBlock(HeaderType);
else
Arc.ReadHeader();
if (Arc.GetHeaderType()==FILE_HEAD)
{
Arc.ConvertAttributes();
Arc.Seek(Arc.NextBlockPos-Arc.NewLhd.FullPackSize,SEEK_SET);
}
#ifndef GUI
if (ShowFileName)
{
char OutName[NM];
IntToExt(Arc.NewLhd.FileName,OutName);
#ifdef UNICODE_SUPPORTED
bool WideName=(Arc.NewLhd.Flags & LHD_UNICODE) && UnicodeEnabled();
if (WideName)
{
wchar NameW[NM];
ConvertPath(Arc.NewLhd.FileNameW,NameW);
char Name[NM];
if (WideToChar(NameW,Name) && IsNameUsable(Name))
strcpy(OutName,Name);
}
#endif
mprintf(St(MExtrPoints),OutName);
if (!Cmd->DisablePercentage)
mprintf(" ");
}
#endif
if (DataIO!=NULL)
{
if (HeaderType==ENDARC_HEAD)
DataIO->UnpVolume=false;
else
{
DataIO->UnpVolume=(hd->Flags & LHD_SPLIT_AFTER);
DataIO->SetPackedSizeToRead(hd->FullPackSize);
}
#ifdef SFX_MODULE
DataIO->UnpArcSize=Arc.FileLength();
DataIO->CurUnpRead=0;
#endif
DataIO->PackedCRC=0xffffffff;
// DataIO->SetFiles(&Arc,NULL);
}
return(true);
}
示例10: ExtractCurrentFile
//.........这里部分代码省略.........
switch(Cmd->Test ? 'T':Command)
{
case 'T':
mprintf(St(MExtrTestFile),ArcFileName);
break;
#ifndef SFX_MODULE
case 'P':
mprintf(St(MExtrPrinting),ArcFileName);
break;
#endif
case 'X':
case 'E':
mprintf(St(MExtrFile),DestFileName);
break;
}
if (!Cmd->DisablePercentage)
mprintf(" ");
#endif
DataIO.CurUnpRead=0;
DataIO.CurUnpWrite=0;
DataIO.UnpFileCRC=Arc.OldFormat ? 0 : 0xffffffff;
DataIO.PackedCRC=0xffffffff;
DataIO.SetEncryption(
(Arc.NewLhd.Flags & LHD_PASSWORD) ? Arc.NewLhd.UnpVer:0,Password,
(Arc.NewLhd.Flags & LHD_SALT) ? Arc.NewLhd.Salt:NULL,false,
Arc.NewLhd.UnpVer>=36);
DataIO.SetPackedSizeToRead(Arc.NewLhd.FullPackSize);
DataIO.SetFiles(&Arc,&CurFile);
DataIO.SetTestMode(TestMode);
DataIO.SetSkipUnpCRC(SkipSolid);
#ifndef _WIN_CE
if (!TestMode && !Arc.BrokenFileHeader &&
(Arc.NewLhd.FullPackSize<<11)>Arc.NewLhd.FullUnpSize &&
(Arc.NewLhd.FullUnpSize<100000000 || Arc.FileLength()>Arc.NewLhd.FullPackSize))
CurFile.Prealloc(Arc.NewLhd.FullUnpSize);
#endif
CurFile.SetAllowDelete(!Cmd->KeepBroken);
bool LinkCreateMode=!Cmd->Test && !SkipSolid;
if (ExtractLink(DataIO,Arc,DestFileName,DataIO.UnpFileCRC,LinkCreateMode))
PrevExtracted=LinkCreateMode;
else
if ((Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)==0)
if (Arc.NewLhd.Method==0x30)
UnstoreFile(DataIO,Arc.NewLhd.FullUnpSize);
else
{
Unp->SetDestSize(Arc.NewLhd.FullUnpSize);
#ifndef SFX_MODULE
if (Arc.NewLhd.UnpVer<=15)
Unp->DoUnpack(15,FileCount>1 && Arc.Solid);
else
#endif
Unp->DoUnpack(Arc.NewLhd.UnpVer,(Arc.NewLhd.Flags & LHD_SOLID)!=0);
}
if (Arc.IsOpened())
Arc.SeekToNext();
bool BrokenFile=false;
if (!SkipSolid)
{
if (Arc.OldFormat && UINT32(DataIO.UnpFileCRC)==UINT32(Arc.NewLhd.FileCRC) ||
!Arc.OldFormat && UINT32(DataIO.UnpFileCRC)==UINT32(Arc.NewLhd.FileCRC^0xffffffff))
{
示例11: ExtractCurrentFile
//.........这里部分代码省略.........
}
#endif
DataIO.CurUnpRead=0;
DataIO.CurUnpWrite=0;
DataIO.UnpFileCRC=Arc.OldFormat ? 0 : 0xffffffff;
DataIO.PackedCRC=0xffffffff;
wchar FilePassword[MAXPASSWORD];
#ifdef _WIN_ALL
if (Arc.NewLhd.HostOS==HOST_MSDOS/* && Arc.NewLhd.UnpVer<=25*/)
{
// We need the password in OEM encoding if file was encrypted by
// native RAR/DOS (not extender based). Let's make the conversion.
char PswA[MAXPASSWORD];
CharToOemBuffW(Password,PswA,ASIZE(PswA));
CharToWide(PswA,FilePassword,ASIZE(FilePassword));
FilePassword[ASIZE(FilePassword)-1]=0;
}
else
#endif
wcscpy(FilePassword,Password);
DataIO.SetEncryption(
(Arc.NewLhd.Flags & LHD_PASSWORD)!=0 ? Arc.NewLhd.UnpVer:0,FilePassword,
(Arc.NewLhd.Flags & LHD_SALT)!=0 ? Arc.NewLhd.Salt:NULL,false,
Arc.NewLhd.UnpVer>=36);
DataIO.SetPackedSizeToRead(Arc.NewLhd.FullPackSize);
DataIO.SetFiles(&Arc,&CurFile);
DataIO.SetTestMode(TestMode);
DataIO.SetSkipUnpCRC(SkipSolid);
#ifndef _WIN_CE
if (!TestMode && !Arc.BrokenFileHeader &&
(Arc.NewLhd.FullPackSize<<11)>Arc.NewLhd.FullUnpSize &&
(Arc.NewLhd.FullUnpSize<100000000 || Arc.FileLength()>Arc.NewLhd.FullPackSize))
CurFile.Prealloc(Arc.NewLhd.FullUnpSize);
#endif
CurFile.SetAllowDelete(!Cmd->KeepBroken);
bool LinkCreateMode=!Cmd->Test && !SkipSolid;
if (false)
{
PrevExtracted=LinkCreateMode;
}
else
{
if ((Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)==0)
{
if (Arc.NewLhd.Method==0x30)
{
UnstoreFile(DataIO,Arc.NewLhd.FullUnpSize);
}
else
{
Unp->SetDestSize(Arc.NewLhd.FullUnpSize);
if (Arc.NewLhd.UnpVer<=15)
{
Unp->DoUnpack(15,FileCount>1 && Arc.Solid);
}
else
{
Unp->DoUnpack(Arc.NewLhd.UnpVer,(Arc.NewLhd.Flags & LHD_SOLID)!=0); //unpacking of the file
}
}
}
}