~ubuntu-branches/ubuntu/lucid/unrar-nonfree/lucid

« back to all changes in this revision

Viewing changes to volume.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Martin Meredith
  • Date: 2009-06-06 17:46:05 UTC
  • mfrom: (1.1.11 upstream) (5.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20090606174605-h4ciqxlpy39jmjx0
Tags: 1:3.9.3-1
* New upstream release
* Updated Copyright file (Closes: #531432)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
 
5
5
 
 
6
#if defined(RARDLL) && defined(_MSC_VER) && !defined(_M_X64)
 
7
// Disable the run time stack check for unrar.dll, so we can manipulate
 
8
// with ChangeVolProc call type below. Run time check would intercept
 
9
// a wrong ESP before we restore it.
 
10
#pragma runtime_checks( "s", off )
 
11
#endif
 
12
 
6
13
bool MergeArchive(Archive &Arc,ComprDataIO *DataIO,bool ShowFileName,char Command)
7
14
{
8
15
  RAROptions *Cmd=Arc.GetRAROptions();
18
25
    Log(Arc.FileName,St(MDataBadCRC),hd->FileName,Arc.FileName);
19
26
  }
20
27
 
21
 
  Int64 PosBeforeClose=Arc.Tell();
 
28
  int64 PosBeforeClose=Arc.Tell();
22
29
 
23
30
  if (DataIO!=NULL)
24
31
    DataIO->ProcessedArcSize+=Arc.FileLength();
72
79
    }
73
80
    if (Cmd->ChangeVolProc!=NULL)
74
81
    {
75
 
#if defined(_WIN_32) && !defined(_MSC_VER) && !defined(__MINGW32__)
 
82
      // Here we preserve ESP value. It is necessary for those developers,
 
83
      // who still define ChangeVolProc callback as "C" type function,
 
84
      // even though in year 2001 we announced in unrar.dll whatsnew.txt
 
85
      // that it will be PASCAL type (for compatibility with Visual Basic).
 
86
#if defined(_MSC_VER)
 
87
#ifndef _M_X64
 
88
      __asm mov ebx,esp
 
89
#endif
 
90
#elif defined(_WIN_32) && defined(__BORLANDC__)
76
91
      _EBX=_ESP;
77
92
#endif
78
93
      int RetCode=Cmd->ChangeVolProc(NextName,RAR_VOL_ASK);
79
 
#if defined(_WIN_32) && !defined(_MSC_VER) && !defined(__MINGW32__)
 
94
 
 
95
      // Restore ESP after ChangeVolProc with wrongly defined calling
 
96
      // convention broken it.
 
97
#if defined(_MSC_VER)
 
98
#ifndef _M_X64
 
99
      __asm mov esp,ebx
 
100
#endif
 
101
#elif defined(_WIN_32) && defined(__BORLANDC__)
80
102
      _ESP=_EBX;
81
103
#endif
82
104
      if (RetCode==0)
182
204
      DataIO->UnpVolume=false;
183
205
    else
184
206
    {
185
 
      DataIO->UnpVolume=(hd->Flags & LHD_SPLIT_AFTER);
 
207
      DataIO->UnpVolume=(hd->Flags & LHD_SPLIT_AFTER)!=0;
186
208
      DataIO->SetPackedSizeToRead(hd->FullPackSize);
187
209
    }
188
210
#ifdef SFX_MODULE
200
222
  return(true);
201
223
}
202
224
 
 
225
#if defined(RARDLL) && defined(_MSC_VER) && !defined(_M_X64)
 
226
// Restore the run time stack check for unrar.dll.
 
227
#pragma runtime_checks( "s", restore )
 
228
#endif
 
229
 
203
230
 
204
231
 
205
232