Subversion Repositories autosfx

Rev

Blame | Last modification | View Log | RSS feed

  1. #include "stdafx.h"
  2. #pragma hdrstop
  3. /*
  4.  
  5. Copyright (c) 1990-2007 Info-ZIP.  All rights reserved.
  6.  
  7. See the accompanying file LICENSE, version 2007-Mar-4 or later
  8. (the contents of which are also included in zip.h) for terms of use.
  9. If, for some reason, all these files are missing, the Info-ZIP license
  10. also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
  11.  
  12. parts Copyright (C) 1997 Mike White, Eric W. Engler
  13.  ************************************************************************
  14. Copyright (C) 2009, 2010  by Russell J. Peters, Roger Aelbrecht
  15.  
  16. This file is part of TZipMaster Version 1.9.
  17.  
  18. TZipMaster is free software: you can redistribute it and/or modify
  19. it under the terms of the GNU Lesser General Public License as published by
  20. the Free Software Foundation, either version 3 of the License, or
  21. (at your option) any later version.
  22.  
  23. TZipMaster is distributed in the hope that it will be useful,
  24. but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  26. GNU Lesser General Public License for more details.
  27.  
  28. You should have received a copy of the GNU Lesser General Public License
  29. along with TZipMaster.  If not, see <http://www.gnu.org/licenses/>.
  30.  
  31. contact: problems@delphizip.org (include ZipMaster in the subject).
  32. updates: http://www.delphizip.org
  33. DelphiZip maillist subscribe at http://www.freelists.org/list/delphizip
  34.  *********************************************************************** */
  35. #include "UnzOp.h"
  36. #include "dz_errs.h"
  37.  
  38. #undef _DZ_FILE_
  39. #define _DZ_FILE_ DZ_UNZOP_CPP
  40.  
  41. // ---------------------------------------------------------------------------
  42. // #pragma package(smart_init)
  43.  
  44. #include "enter.h"
  45.  
  46.  
  47. UnzOpr::UnzOpr(const DllCommands *C) : UnzInf(C)
  48. {
  49.     fdflag = 0;
  50.     ffflag = 0;
  51.     fjflag = 0;
  52.     flflag = 0;
  53.     foverwrite_all = 0;
  54.     fvolflag = 0;
  55.     fT_flag = 0;
  56.     fuflag = 0;
  57.     fzflag = 0;
  58.  
  59.     ffilespecs = 0;
  60.     SrchSpecs = NULL;
  61.     fprocess_all_files = 0;
  62.     fcreate_dirs = 0;
  63.     fextract_flag = 0;
  64.     freal_ecrec_offset = 0;
  65.     fexpect_ecrec_offset = 0;
  66.     fziplen = 0;
  67.     fhold = 0;
  68.     fno_ecrec = 0;
  69. #ifdef NOVELL_BUG_FAILSAFE
  70.     fdne = 0;
  71. #endif
  72.  
  73.     fcreated_dir = 0;
  74.     frenamed_fullpath = 0;
  75.     ffnlen = 0;
  76.     fnLabelDrive = 0;
  77.     frootlen = 0;
  78.     fhave_dirname = 0;
  79.     fdirnamelen = 0;
  80.     fnotfirstcall = 0;
  81.     fwild_dir = 0;
  82.  
  83.     ffiles_acted_on = 0;
  84.     fEncodedAs = 0; // default Auto
  85.     // #ifdef CRYPT
  86.     flpszPassword[PWLEN + 1];
  87.     fcchPassword = 0;
  88.     fpwork = 0;
  89.     frcode = 0;
  90.     // #endif
  91.     flflag = (-1);
  92.     fsol = true; // At start of line.
  93.     // give the component the 'key'
  94.     CB->Arg1 = ((unsigned)this) >> 2;
  95.     Set_Oper(this, UNZOPER); // add to 'active' list
  96.     CB->UserCB(zacKey);
  97. }
  98.  
  99. UnzOpr::~UnzOpr(void)
  100. {
  101.     Set_Oper(this, 0); // remove from list
  102.     CB->Arg1 = 0;
  103.     CB->UserCB(zacKey);
  104.     delete[]SrchSpecs;
  105.     SrchSpecs = NULL;
  106.     TakeDownFromProcessZipFile();
  107. }
  108.  
  109. int UnzOpr::Init(void)
  110. {
  111.     DZStrW ExtDir = CB->UserArg(zcbExtractDir, 0, 0);
  112.     // RP allow relative extract path
  113.     if (!ExtDir)
  114.         ExtDir = _T(".\\");
  115.     TCHAR lc = ExtDir.LastChar();
  116.     if (lc != _T('\\') && lc != _T(':'))
  117.         ExtDir += _T('\\');
  118.     DZStrW fExtractPath;
  119.     int l = GetFullPathName(ExtDir, MAX_PATH, fExtractPath.GetBuffer(MAX_PATH),
  120.         NULL);
  121.     fExtractPath.ReleaseBuffer(l);
  122.     if (!l)
  123.         return -1;
  124.     AddBase(fExtractPath, true);
  125.  
  126.     return 0;
  127. }
  128.  
  129. DZOp *MakeUnzipper(const DllCommands *C)
  130. {
  131.     return new UnzOpr(C);
  132. }
  133.