1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#include "rar.hpp"
#include "recvol3.cpp"
#include "recvol5.cpp"
bool RecVolumesRestore(RAROptions *Cmd,const wchar *Name,bool Silent)
{
Archive Arc(Cmd);
if (!Arc.Open(Name))
{
if (!Silent)
ErrHandler.OpenErrorMsg(Name);
return false;
}
RARFORMAT Fmt=RARFMT15;
if (Arc.IsArchive(true))
Fmt=Arc.Format;
else
{
byte Sign[REV5_SIGN_SIZE];
Arc.Seek(0,SEEK_SET);
if (Arc.Read(Sign,REV5_SIGN_SIZE)==REV5_SIGN_SIZE && memcmp(Sign,REV5_SIGN,REV5_SIGN_SIZE)==0)
Fmt=RARFMT50;
}
Arc.Close();
// We define RecVol as local variable for proper stack unwinding when
// handling exceptions. So it can close and delete files on Cancel.
if (Fmt==RARFMT15)
{
RecVolumes3 RecVol;
return RecVol.Restore(Cmd,Name,Silent);
}
else
{
RecVolumes5 RecVol;
return RecVol.Restore(Cmd,Name,Silent);
}
}
|