diff -uNr unrar/archive.cpp unrar/archive.cpp
--- unrar/archive.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/archive.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -57,7 +57,7 @@
   if (!IsArchive(EnableBroken))
   {
     Log(FileName,St(MBadArc),FileName);
-    ErrHandler.Exit(RAR_FATAL_ERROR);
+    ErrHandler.Exit(FATAL_ERROR);
   }
 }
 #endif
@@ -186,7 +186,7 @@
 #ifdef RARDLL
     Cmd->DllError=ERAR_UNKNOWN_FORMAT;
 #else
-    ErrHandler.SetErrorCode(RAR_WARNING);
+    ErrHandler.SetErrorCode(WARNING);
   #if !defined(SILENT) && !defined(SFX_MODULE)
       Log(FileName,St(MUnknownMeth),FileName);
       Log(FileName,St(MVerRequired),NewMhd.EncryptVer/10,NewMhd.EncryptVer%10);
diff -uNr unrar/archive.hpp unrar/archive.hpp
--- unrar/archive.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/archive.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -14,7 +14,6 @@
     void ConvertNameCase(wchar *Name);
     void ConvertUnknownHeader();
     int ReadOldHeader();
-    void PrepareExtraTime(FileHeader *hd,EXTTIME_MODE etm,EXTTIME_MODE etc,EXTTIME_MODE eta,EXTTIME_MODE etarc,Array<byte> &TimeData);
 
 #if !defined(SHELL_EXT) && !defined(NOCRYPT)
     CryptData HeadersCrypt;
diff -uNr unrar/arcread.cpp unrar/arcread.cpp
--- unrar/arcread.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/arcread.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -52,17 +52,17 @@
     if (*Cmd->Password==0)
 #ifdef RARDLL
       if (Cmd->Callback==NULL ||
-          Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LONG)Cmd->Password,sizeof(Cmd->Password))==-1)
+          Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LPARAM)Cmd->Password,sizeof(Cmd->Password))==-1)
       {
         Close();
-        ErrHandler.Exit(RAR_USER_BREAK);
+        ErrHandler.Exit(USER_BREAK);
       }
 
 #else
       if (!GetPassword(PASSWORD_ARCHIVE,FileName,Cmd->Password,sizeof(Cmd->Password)))
       {
         Close();
-        ErrHandler.Exit(RAR_USER_BREAK);
+        ErrHandler.Exit(USER_BREAK);
       }
 #endif
     HeadersCrypt.SetCryptKeys(Cmd->Password,HeadersSalt,false,false,NewMhd.EncryptVer>=36);
@@ -79,7 +79,7 @@
   #ifndef SHELL_EXT
       Log(FileName,St(MLogUnexpEOF));
   #endif
-      ErrHandler.SetErrorCode(RAR_WARNING);
+      ErrHandler.SetErrorCode(WARNING);
     }
     return(0);
   }
@@ -96,7 +96,7 @@
     Log(FileName,St(MLogFileHead),"???");
 #endif
     BrokenFileHeader=true;
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return(0);
   }
 
@@ -261,7 +261,7 @@
           if (hd->HeadType==NEWSUB_HEAD)
             strcat(hd->FileName,"- ???");
           BrokenFileHeader=true;
-          ErrHandler.SetErrorCode(RAR_WARNING);
+          ErrHandler.SetErrorCode(WARNING);
 #ifndef SHELL_EXT
           Log(Archive::FileName,St(MLogFileHead),IntNameToExt(hd->FileName));
           Alarm();
@@ -370,6 +370,8 @@
       bool Recovered=false;
       if (ShortBlock.HeadType==ENDARC_HEAD && (EndArcHead.Flags & EARC_REVSPACE)!=0)
       {
+        // Last 7 bytes of recovered volume can contain zeroes, because
+        // REV files store its own information (volume number, etc.) here.
         SaveFilePos SavePos(*this);
         Int64 Length=Tell();
         Seek(Length-7,SEEK_SET);
@@ -386,9 +388,9 @@
         Close();
 
         BrokenFileHeader=true;
-        ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+        ErrHandler.SetErrorCode(CRC_ERROR);
         return(0);
-//        ErrHandler.Exit(RAR_CRC_ERROR);
+//        ErrHandler.Exit(CRC_ERROR);
       }
     }
   }
@@ -399,7 +401,7 @@
     Log(FileName,St(MLogFileHead),"???");
 #endif
     BrokenFileHeader=true;
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return(0);
   }
   return(Raw.Size());
@@ -582,10 +584,34 @@
     if ((byte)*s<32 || (byte)*s>127)
       *s='_';
 #endif
+
+#if defined(_WIN_32) || defined(_EMX)
+    // ':' in file names is allowed in Unix, but not in Windows.
+    // Even worse, file data will be written to NTFS stream on NTFS,
+    // so automatic name correction on file create error in extraction 
+    // routine does not work. In Windows and DOS versions we better 
+    // replace ':' now.
+    if (*s==':')
+      *s='_';
+#endif
+
   }
+
   for (wchar *s=NewLhd.FileNameW;*s!=0;s++)
+  {
     if (*s=='/' || *s=='\\')
       *s=CPATHDIVIDER;
+
+#if defined(_WIN_32) || defined(_EMX)
+    // ':' in file names is allowed in Unix, but not in Windows.
+    // Even worse, file data will be written to NTFS stream on NTFS,
+    // so automatic name correction on file create error in extraction 
+    // routine does not work. In Windows and DOS versions we better 
+    // replace ':' now.
+    if (*s==':')
+      *s='_';
+#endif
+  }
 }
 
 
@@ -597,7 +623,7 @@
 #ifndef SHELL_EXT
     Log(FileName,St(MSubHeadCorrupt));
 #endif
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return(false);
   }
   if (SubHead.Method<0x30 || SubHead.Method>0x35 || SubHead.UnpVer>/*PACK_VER*/36)
@@ -643,7 +669,7 @@
 #ifndef SHELL_EXT
     Log(FileName,St(MSubHeadDataCRC),SubHead.FileName);
 #endif
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     if (UnpData!=NULL)
       UnpData->Reset();
     return(false);
diff -uNr unrar/beosea.cpp unrar/beosea.cpp
--- unrar/beosea.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/beosea.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -5,7 +5,7 @@
   if (Arc.HeaderCRC!=Arc.EAHead.HeadCRC)
   {
     Log(Arc.FileName,St(MEABroken),FileName);
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return;
   }
   if (Arc.EAHead.Method<0x31 || Arc.EAHead.Method>0x35 || Arc.EAHead.UnpVer>PACK_VER)
@@ -29,14 +29,14 @@
   if (Arc.EAHead.EACRC!=~DataIO.UnpFileCRC)
   {
     Log(Arc.FileName,St(MEABroken),FileName);
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return;
   }
   int fd = open(FileName,O_WRONLY);
   if (fd==-1)
   {
     Log(Arc.FileName,St(MCannotSetEA),FileName);
-    ErrHandler.SetErrorCode(RAR_WARNING);
+    ErrHandler.SetErrorCode(WARNING);
     return;
   }
 
@@ -51,7 +51,7 @@
     if (NameSize>=sizeof(Name))
     {
       Log(Arc.FileName,St(MCannotSetEA),FileName);
-      ErrHandler.SetErrorCode(RAR_WARNING);
+      ErrHandler.SetErrorCode(WARNING);
       break;
     }
     memcpy(Name,CurItem+10,NameSize);
@@ -59,7 +59,7 @@
     if (fs_write_attr(fd,Name,Type,0,CurItem+10+NameSize,Size)==-1)
     {
       Log(Arc.FileName,St(MCannotSetEA),FileName);
-      ErrHandler.SetErrorCode(RAR_WARNING);
+      ErrHandler.SetErrorCode(WARNING);
       break;
     }
     AttrPos+=10+NameSize+Size;
@@ -79,7 +79,7 @@
   if (fd==-1)
   {
     Log(Arc.FileName,St(MCannotSetEA),FileName);
-    ErrHandler.SetErrorCode(RAR_WARNING);
+    ErrHandler.SetErrorCode(WARNING);
     return;
   }
 
@@ -94,7 +94,7 @@
     if (NameSize>=sizeof(Name))
     {
       Log(Arc.FileName,St(MCannotSetEA),FileName);
-      ErrHandler.SetErrorCode(RAR_WARNING);
+      ErrHandler.SetErrorCode(WARNING);
       break;
     }
     memcpy(Name,CurItem+10,NameSize);
@@ -102,7 +102,7 @@
     if (fs_write_attr(fd,Name,Type,0,CurItem+10+NameSize,Size)==-1)
     {
       Log(Arc.FileName,St(MCannotSetEA),FileName);
-      ErrHandler.SetErrorCode(RAR_WARNING);
+      ErrHandler.SetErrorCode(WARNING);
       break;
     }
     AttrPos+=10+NameSize+Size;
diff -uNr unrar/cmddata.cpp unrar/cmddata.cpp
--- unrar/cmddata.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/cmddata.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -51,7 +51,7 @@
     if (Arg[1]=='-')
       NoMoreSwitches=true;
     else
-      ProcessSwitch(&Arg[1]);
+      ProcessSwitch(&Arg[1],(ArgW!=NULL && *ArgW!=0 ? &ArgW[1]:NULL));
   else
     if (*Command==0)
     {
@@ -81,8 +81,8 @@
       }
       else
       {
-        int Length=strlen(Arg);
-        char EndChar=Arg[Length-1];
+        size_t Length=strlen(Arg);
+        char EndChar=Length==0 ? 0:Arg[Length-1];
         char CmdChar=etoupper(*Command);
         bool Add=strchr("AFUM",CmdChar)!=NULL;
         bool Extract=CmdChar=='X' || CmdChar=='E';
@@ -113,7 +113,7 @@
                 Charset=RCH_OEM;
 #endif
 
-              ReadTextFile(Arg+1,FileArgs,false,true,Charset,true,true);
+              ReadTextFile(Arg+1,FileArgs,false,true,Charset,true,true,true);
             }
             else
               if (Found && FileData.IsDir && Extract && *ExtrPath==0)
@@ -226,7 +226,7 @@
 
 
 #if !defined(SFX_MODULE)
-void CommandData::ProcessSwitch(char *Switch)
+void CommandData::ProcessSwitch(char *Switch,wchar *SwitchW)
 {
 
   switch(etoupper(Switch[0]))
@@ -375,6 +375,8 @@
           break;
         case 'P':
           strcpy(ArcPath,Switch+2);
+          if (SwitchW!=NULL && *SwitchW!=0)
+            strcpyw(ArcPathW,SwitchW+2);
           break;
         case 'S':
           SyncFiles=true;
@@ -408,6 +410,9 @@
         case '-':
           Overwrite=OVERWRITE_NONE;
           break;
+        case 0:
+          Overwrite=OVERWRITE_FORCE_ASK;
+          break;
         case 'R':
           Overwrite=OVERWRITE_AUTORENAME;
           break;
@@ -480,7 +485,7 @@
             Charset=RCH_OEM;
 #endif
 
-          ReadTextFile(Switch+2,Args,false,true,Charset,true,true);
+          ReadTextFile(Switch+2,Args,false,true,Charset,true,true,true);
         }
         else
           Args->AddString(Switch+1);
@@ -794,7 +799,7 @@
             break;
           case 'C':
             {
-              RAR_CHARSET rch;
+              RAR_CHARSET rch=RCH_DEFAULT;
               switch(etoupper(Switch[2]))
               {
                 case 'A':
@@ -874,7 +879,7 @@
 void CommandData::BadSwitch(char *Switch)
 {
   mprintf(St(MUnknownOption),Switch);
-  ErrHandler.Exit(RAR_USER_ERROR);
+  ErrHandler.Exit(USER_ERROR);
 }
 #endif
 
@@ -908,6 +913,18 @@
 #endif
 
 
+inline bool CmpMSGID(MSGID i1,MSGID i2)
+{
+#ifdef MSGID_INT
+  return(i1==i2);
+#else
+  // If MSGID is const char*, we cannot compare pointers only.
+  // Pointers to different instances of same strings can differ,
+  // so we need to compare complete strings.
+  return(strcmp(i1,i2)==0);
+#endif
+}
+
 void CommandData::OutHelp()
 {
 #if !defined(GUI) && !defined(SILENT)
@@ -916,12 +933,13 @@
 #ifdef SFX_MODULE
     MCHelpCmd,MSHelpCmdE,MSHelpCmdT,MSHelpCmdV
 #elif defined(UNRAR)
-    MUNRARTitle1,MRARTitle2,MCHelpCmd,MCHelpCmdE,MCHelpCmdL,MCHelpCmdP,
-    MCHelpCmdT,MCHelpCmdV,MCHelpCmdX,MCHelpSw,MCHelpSwm,MCHelpSwAC,MCHelpSwAD,
-    MCHelpSwAP,MCHelpSwAVm,MCHelpSwCm,MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU,
+    MUNRARTitle1,MRARTitle2,MCHelpCmd,MCHelpCmdE,MCHelpCmdL,
+    MCHelpCmdP,MCHelpCmdT,MCHelpCmdV,MCHelpCmdX,MCHelpSw,
+    MCHelpSwm,MCHelpSwAC,MCHelpSwAD,MCHelpSwAP,
+    MCHelpSwCm,MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU,
     MCHelpSwDH,MCHelpSwEP,MCHelpSwEP3,MCHelpSwF,MCHelpSwIDP,MCHelpSwIERR,
     MCHelpSwINUL,MCHelpSwIOFF,MCHelpSwKB,MCHelpSwN,MCHelpSwNa,MCHelpSwNal,
-    MCHelpSwOp,MCHelpSwOm,MCHelpSwOC,MCHelpSwOR,MCHelpSwOW,MCHelpSwP,
+    MCHelpSwO,MCHelpSwOC,MCHelpSwOR,MCHelpSwOW,MCHelpSwP,
     MCHelpSwPm,MCHelpSwR,MCHelpSwRI,MCHelpSwSL,MCHelpSwSM,MCHelpSwTA,
     MCHelpSwTB,MCHelpSwTN,MCHelpSwTO,MCHelpSwTS,MCHelpSwU,MCHelpSwVUnr,
     MCHelpSwVER,MCHelpSwVP,MCHelpSwX,MCHelpSwXa,MCHelpSwXal,MCHelpSwY
@@ -932,13 +950,13 @@
     MCHelpCmdRN,MCHelpCmdRR,MCHelpCmdRV,MCHelpCmdS,MCHelpCmdT,MCHelpCmdU,
     MCHelpCmdV,MCHelpCmdX,MCHelpSw,MCHelpSwm,MCHelpSwAC,MCHelpSwAD,MCHelpSwAG,
     MCHelpSwAO,MCHelpSwAP,MCHelpSwAS,MCHelpSwAV,MCHelpSwAVm,MCHelpSwCm,
-    MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU,MCHelpSwDF,MCHelpSwDH,MCHelpSwDS,
-    MCHelpSwEa,MCHelpSwED,MCHelpSwEE,MCHelpSwEN,MCHelpSwEP,MCHelpSwEP1,
-    MCHelpSwEP2,MCHelpSwEP3,MCHelpSwF,MCHelpSwHP,MCHelpSwIDP,
-    MCHelpSwIEML,MCHelpSwIERR,MCHelpSwILOG,MCHelpSwINUL,MCHelpSwIOFF,
-    MCHelpSwISND,MCHelpSwK,MCHelpSwKB,MCHelpSwMn,MCHelpSwMC,MCHelpSwMD,
-    MCHelpSwMS,MCHelpSwMT,MCHelpSwN,MCHelpSwNa,MCHelpSwNal,MCHelpSwOp,
-    MCHelpSwOm,MCHelpSwOC,MCHelpSwOL,MCHelpSwOR,MCHelpSwOS,MCHelpSwOW,
+    MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU,MCHelpSwDF,MCHelpSwDH,MCHelpSwDR,
+    MCHelpSwDS,MCHelpSwDW,MCHelpSwEa,MCHelpSwED,MCHelpSwEE,MCHelpSwEN,
+    MCHelpSwEP,MCHelpSwEP1,MCHelpSwEP2,MCHelpSwEP3,MCHelpSwF,MCHelpSwHP,
+    MCHelpSwIDP,MCHelpSwIEML,MCHelpSwIERR,MCHelpSwILOG,MCHelpSwINUL,
+    MCHelpSwIOFF,MCHelpSwISND,MCHelpSwK,MCHelpSwKB,MCHelpSwMn,MCHelpSwMC,
+    MCHelpSwMD,MCHelpSwMS,MCHelpSwMT,MCHelpSwN,MCHelpSwNa,MCHelpSwNal,
+    MCHelpSwO,MCHelpSwOC,MCHelpSwOL,MCHelpSwOR,MCHelpSwOS,MCHelpSwOW,
     MCHelpSwP,MCHelpSwPm,MCHelpSwR,MCHelpSwR0,MCHelpSwRI,MCHelpSwRR,
     MCHelpSwRV,MCHelpSwS,MCHelpSwSm,MCHelpSwSC,MCHelpSwSFX,MCHelpSwSI,
     MCHelpSwSL,MCHelpSwSM,MCHelpSwT,MCHelpSwTA,MCHelpSwTB,MCHelpSwTK,
@@ -958,11 +976,11 @@
 #ifndef _WIN_32
     static MSGID Win32Only[]={
       MCHelpSwIEML,MCHelpSwVD,MCHelpSwAO,MCHelpSwOS,MCHelpSwIOFF,
-      MCHelpSwEP2,MCHelpSwOC
+      MCHelpSwEP2,MCHelpSwOC,MCHelpSwDR,MCHelpSwRI
     };
     bool Found=false;
     for (int J=0;J<sizeof(Win32Only)/sizeof(Win32Only[0]);J++)
-      if (Help[I]==Win32Only[J])
+      if (CmpMSGID(Help[I],Win32Only[J]))
       {
         Found=true;
         break;
@@ -971,27 +989,23 @@
       continue;
 #endif
 #if !defined(_UNIX) && !defined(_WIN_32)
-    if (Help[I]==MCHelpSwOW)
+    if (CmpMSGID(Help[I],MCHelpSwOW))
       continue;
 #endif
 #if !defined(_WIN_32) && !defined(_EMX)
-    if (Help[I]==MCHelpSwAC)
+    if (CmpMSGID(Help[I],MCHelpSwAC))
       continue;
 #endif
 #ifndef SAVE_LINKS
-    if (Help[I]==MCHelpSwOL)
-      continue;
-#endif
-#ifndef _WIN_32
-    if (Help[I]==MCHelpSwRI)
+    if (CmpMSGID(Help[I],MCHelpSwOL))
       continue;
 #endif
 #ifndef PACK_SMP
-    if (Help[I]==MCHelpSwMT)
+    if (CmpMSGID(Help[I],MCHelpSwMT))
       continue;
 #endif
 #ifndef _BEOS
-    if (Help[I]==MCHelpSwEE)
+    if (CmpMSGID(Help[I],MCHelpSwEE))
     {
 #if defined(_EMX) && !defined(_DJGPP)
       if (_osmode != OS2_MODE)
@@ -1005,7 +1019,7 @@
     mprintf(St(Help[I]));
   }
   mprintf("\n");
-  ErrHandler.Exit(RAR_USER_ERROR);
+  ErrHandler.Exit(USER_ERROR);
 #endif
 }
 
diff -uNr unrar/cmddata.hpp unrar/cmddata.hpp
--- unrar/cmddata.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/cmddata.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -7,7 +7,7 @@
 {
   private:
     void ProcessSwitchesString(char *Str);
-    void ProcessSwitch(char *Switch);
+    void ProcessSwitch(char *Switch,wchar *SwitchW=NULL);
     void BadSwitch(char *Switch);
     bool ExclCheckArgs(StringList *Args,char *CheckName,bool CheckFullPath,int MatchMode);
     uint GetExclAttr(char *Str);
diff -uNr unrar/consio.cpp unrar/consio.cpp
--- unrar/consio.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/consio.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -4,8 +4,11 @@
 #include "log.cpp"
 #endif
 
+static int KbdAnsi(char *Addr,int Size);
+
 #if !defined(GUI) && !defined(SILENT)
 static void RawPrint(char *Msg,MESSAGE_TYPE MessageType);
+static uint GetKey();
 #endif
 
 static MESSAGE_TYPE MsgStream=MSG_STDOUT;
@@ -133,27 +136,6 @@
 #endif
 
 
-#if !defined(GUI) && !defined(SILENT)
-unsigned int GetKey()
-{
-#ifdef SILENT
-  return(0);
-#else
-  char Str[80];
-#ifdef __GNUC__
-  fgets(Str,sizeof(Str),stdin);
-  return(Str[0]);
-#else
-  File SrcFile;
-  SrcFile.SetHandleType(FILE_HANDLESTD);
-  SrcFile.Read(Str,sizeof(Str));
-  return(Str[0]);
-#endif
-#endif
-}
-#endif
-
-
 #ifndef SILENT
 bool GetPassword(PASSWORD_TYPE Type,const char *FileName,char *Password,int MaxLength)
 {
@@ -199,6 +181,29 @@
 
 
 #if !defined(GUI) && !defined(SILENT)
+uint GetKey()
+{
+  char Str[80];
+  bool EndOfFile;
+#if defined(__GNUC__) || defined(sun)
+  EndOfFile=(fgets(Str,sizeof(Str),stdin)==NULL);
+#else
+  File SrcFile;
+  SrcFile.SetHandleType(FILE_HANDLESTD);
+  EndOfFile=(SrcFile.Read(Str,sizeof(Str))==0);
+#endif
+  if (EndOfFile)
+  {
+    // Looks like stdin is a null device. We can enter to infinite loop
+    // calling Ask(), so let's better exit.
+    ErrHandler.Exit(USER_BREAK);
+  }
+  return(Str[0]);
+}
+#endif
+
+
+#if !defined(GUI) && !defined(SILENT)
 int Ask(const char *AskStr)
 {
   const int MaxItems=10;
diff -uNr unrar/consio.hpp unrar/consio.hpp
--- unrar/consio.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/consio.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -12,12 +12,10 @@
 void eprintf(const char *fmt,...);
 void Alarm();
 void GetPasswordText(char *Str,int MaxLength);
-unsigned int GetKey();
 bool GetPassword(PASSWORD_TYPE Type,const char *FileName,char *Password,int MaxLength);
 int Ask(const char *AskStr);
 #endif
 
-int KbdAnsi(char *Addr,int Size);
 void OutComment(char *Comment,int Size);
 
 #ifdef SILENT
diff -uNr unrar/crc.cpp unrar/crc.cpp
--- unrar/crc.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/crc.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -14,12 +14,18 @@
 }
 
 
-uint CRC(uint StartCRC,const void *Addr,uint Size)
+uint CRC(uint StartCRC,const void *Addr,size_t Size)
 {
   if (CRCTab[1]==0)
     InitCRC();
   byte *Data=(byte *)Addr;
 #if defined(LITTLE_ENDIAN) && defined(PRESENT_INT32) && defined(ALLOW_NOT_ALIGNED_INT)
+
+#ifdef _MSC_VER
+  // avoid a warning about 'Data' pointer truncation in 64 bit mode
+  #pragma warning( disable : 4311 )
+#endif
+
   while (Size>0 && ((long)Data & 7))
   {
     StartCRC=CRCTab[(byte)(StartCRC^Data[0])]^(StartCRC>>8);
@@ -42,16 +48,16 @@
     Size-=8;
   }
 #endif
-  for (int I=0;I<Size;I++)
+  for (size_t I=0;I<Size;I++)
     StartCRC=CRCTab[(byte)(StartCRC^Data[I])]^(StartCRC>>8);
   return(StartCRC);
 }
 
 #ifndef SFX_MODULE
-ushort OldCRC(ushort StartCRC,const void *Addr,uint Size)
+ushort OldCRC(ushort StartCRC,const void *Addr,size_t Size)
 {
   byte *Data=(byte *)Addr;
-  for (int I=0;I<Size;I++)
+  for (size_t I=0;I<Size;I++)
   {
     StartCRC=(StartCRC+Data[I])&0xffff;
     StartCRC=((StartCRC<<1)|(StartCRC>>15))&0xffff;
diff -uNr unrar/crc.hpp unrar/crc.hpp
--- unrar/crc.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/crc.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -4,7 +4,7 @@
 extern uint CRCTab[256];
 
 void InitCRC();
-uint CRC(uint StartCRC,const void *Addr,uint Size);
-ushort OldCRC(ushort StartCRC,const void *Addr,uint Size);
+uint CRC(uint StartCRC,const void *Addr,size_t Size);
+ushort OldCRC(ushort StartCRC,const void *Addr,size_t Size);
 
 #endif
diff -uNr unrar/dll.cpp unrar/dll.cpp
--- unrar/dll.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/dll.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -221,9 +221,10 @@
   try
   {
     Data->Cmd.DllError=0;
-    if (Data->OpenMode==RAR_OM_LIST || Operation==RAR_SKIP && !Data->Arc.Solid)
+    if (Data->OpenMode==RAR_OM_LIST || Data->OpenMode==RAR_OM_LIST_INCSPLIT ||
+        Operation==RAR_SKIP && !Data->Arc.Solid)
     {
-      if (/*Data->OpenMode==RAR_OM_LIST && */Data->Arc.Volume &&
+      if (Data->Arc.Volume &&
           Data->Arc.GetHeaderType()==FILE_HEAD &&
           (Data->Arc.NewLhd.Flags & LHD_SPLIT_AFTER)!=0)
         if (MergeArchive(Data->Arc,NULL,false,'L'))
@@ -265,6 +266,9 @@
         strncpyw(Data->Cmd.ExtrPathW,NullToEmpty(DestPathW),NM-2);
         AddEndSlash(Data->Cmd.ExtrPathW);
         strncpyw(Data->Cmd.DllDestNameW,NullToEmpty(DestNameW),NM-1);
+
+        if (*Data->Cmd.DllDestNameW!=0 && *Data->Cmd.DllDestName==0)
+          WideToChar(Data->Cmd.DllDestNameW,Data->Cmd.DllDestName);
       }
       else
       {
@@ -312,7 +316,7 @@
 }
 
 
-void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LONG UserData)
+void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LPARAM UserData)
 {
   DataSet *Data=(DataSet *)hArcData;
   Data->Cmd.Callback=Callback;
@@ -345,19 +349,19 @@
 {
   switch(ErrCode)
   {
-    case RAR_FATAL_ERROR:
+    case FATAL_ERROR:
       return(ERAR_EREAD);
-    case RAR_CRC_ERROR:
+    case CRC_ERROR:
       return(ERAR_BAD_DATA);
-    case RAR_WRITE_ERROR:
+    case WRITE_ERROR:
       return(ERAR_EWRITE);
-    case RAR_OPEN_ERROR:
+    case OPEN_ERROR:
       return(ERAR_EOPEN);
-    case RAR_CREATE_ERROR:
+    case CREATE_ERROR:
       return(ERAR_ECREATE);
-    case RAR_MEMORY_ERROR:
+    case MEMORY_ERROR:
       return(ERAR_NO_MEMORY);
-    case RAR_SUCCESS:
+    case SUCCESS:
       return(0);
     default:
       return(ERAR_UNKNOWN);
diff -uNr unrar/dll.hpp unrar/dll.hpp
--- unrar/dll.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/dll.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -15,8 +15,9 @@
 #define ERAR_UNKNOWN            21
 #define ERAR_MISSING_PASSWORD   22
 
-#define RAR_OM_LIST           0
-#define RAR_OM_EXTRACT        1
+#define RAR_OM_LIST              0
+#define RAR_OM_EXTRACT           1
+#define RAR_OM_LIST_INCSPLIT     2
 
 #define RAR_SKIP              0
 #define RAR_TEST              1
@@ -32,6 +33,7 @@
 #define PASCAL
 #define LONG long
 #define HANDLE void *
+#define LPARAM long
 #define UINT unsigned int
 #endif
 
@@ -109,7 +111,7 @@
   UCM_CHANGEVOLUME,UCM_PROCESSDATA,UCM_NEEDPASSWORD
 };
 
-typedef int (CALLBACK *UNRARCALLBACK)(UINT msg,LONG UserData,LONG P1,LONG P2);
+typedef int (CALLBACK *UNRARCALLBACK)(UINT msg,LPARAM UserData,LPARAM P1,LPARAM P2);
 
 typedef int (PASCAL *CHANGEVOLPROC)(char *ArcName,int Mode);
 typedef int (PASCAL *PROCESSDATAPROC)(unsigned char *Addr,int Size);
@@ -125,7 +127,7 @@
 int    PASCAL RARReadHeaderEx(HANDLE hArcData,struct RARHeaderDataEx *HeaderData);
 int    PASCAL RARProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName);
 int    PASCAL RARProcessFileW(HANDLE hArcData,int Operation,wchar_t *DestPath,wchar_t *DestName);
-void   PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LONG UserData);
+void   PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LPARAM UserData);
 void   PASCAL RARSetChangeVolProc(HANDLE hArcData,CHANGEVOLPROC ChangeVolProc);
 void   PASCAL RARSetProcessDataProc(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc);
 void   PASCAL RARSetPassword(HANDLE hArcData,char *Password);
diff -uNr unrar/errhnd.cpp unrar/errhnd.cpp
--- unrar/errhnd.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/errhnd.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -11,7 +11,7 @@
 
 void ErrorHandler::Clean()
 {
-  ExitCode=RAR_SUCCESS;
+  ExitCode=SUCCESS;
   ErrCount=0;
   EnableBreak=true;
   Silent=false;
@@ -22,7 +22,7 @@
 void ErrorHandler::MemoryError()
 {
   MemoryErrorMsg();
-  Throw(RAR_MEMORY_ERROR);
+  Throw(MEMORY_ERROR);
 }
 
 
@@ -30,7 +30,7 @@
 {
 #ifndef SILENT
   OpenErrorMsg(FileName);
-  Throw(RAR_OPEN_ERROR);
+  Throw(OPEN_ERROR);
 #endif
 }
 
@@ -45,7 +45,7 @@
   }
 #endif
 #if !defined(SILENT) || defined(RARDLL)
-  Throw(RAR_FATAL_ERROR);
+  Throw(FATAL_ERROR);
 #endif
 }
 
@@ -56,7 +56,7 @@
   ReadErrorMsg(NULL,FileName);
 #endif
 #if !defined(SILENT) || defined(RARDLL)
-  Throw(RAR_FATAL_ERROR);
+  Throw(FATAL_ERROR);
 #endif
 }
 
@@ -81,7 +81,7 @@
   WriteErrorMsg(ArcName,FileName);
 #endif
 #if !defined(SILENT) || defined(RARDLL)
-  Throw(RAR_WRITE_ERROR);
+  Throw(WRITE_ERROR);
 #endif
 }
 
@@ -94,7 +94,7 @@
   ErrMsg(NULL,St(MNTFSRequired),FileName);
 #endif
 #if !defined(SILENT) && !defined(SFX_MODULE) || defined(RARDLL)
-  Throw(RAR_WRITE_ERROR);
+  Throw(WRITE_ERROR);
 #endif
 }
 #endif
@@ -124,7 +124,7 @@
   }
 #endif
 #if !defined(SILENT) || defined(RARDLL)
-  Throw(RAR_FATAL_ERROR);
+  Throw(FATAL_ERROR);
 #endif
 }
 
@@ -247,14 +247,14 @@
 {
   switch(Code)
   {
-    case RAR_WARNING:
-    case RAR_USER_BREAK:
-      if (ExitCode==RAR_SUCCESS)
+    case WARNING:
+    case USER_BREAK:
+      if (ExitCode==SUCCESS)
         ExitCode=Code;
       break;
-    case RAR_FATAL_ERROR:
-      if (ExitCode==RAR_SUCCESS || ExitCode==RAR_WARNING)
-        ExitCode=RAR_FATAL_ERROR;
+    case FATAL_ERROR:
+      if (ExitCode==SUCCESS || ExitCode==WARNING)
+        ExitCode=FATAL_ERROR;
       break;
     default:
       ExitCode=Code;
@@ -289,8 +289,9 @@
 #if defined(USE_RC) && !defined(SFX_MODULE) && !defined(_WIN_CE)
   ExtRes.UnloadDLL();
 #endif
-  exit(RAR_USER_BREAK);
-#ifdef _WIN_32
+  exit(USER_BREAK);
+#if defined(_WIN_32) && !defined(_MSC_VER)
+  // never reached, just to avoid a compiler warning
   return(TRUE);
 #endif
 }
@@ -314,7 +315,7 @@
 
 void ErrorHandler::Throw(int Code)
 {
-  if (Code==RAR_USER_BREAK && !EnableBreak)
+  if (Code==USER_BREAK && !EnableBreak)
     return;
   ErrHandler.SetErrorCode(Code);
 #ifdef ALLOW_EXCEPTIONS
diff -uNr unrar/errhnd.hpp unrar/errhnd.hpp
--- unrar/errhnd.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/errhnd.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -12,11 +12,12 @@
 #define rarrealloc realloc
 #define rarfree free
 #define rarstrdup strdup
+#define rarstrdupw strdupw
 
 
 
-enum { RAR_SUCCESS,RAR_WARNING,RAR_FATAL_ERROR,RAR_CRC_ERROR,RAR_LOCK_ERROR,RAR_WRITE_ERROR,
-       RAR_OPEN_ERROR,RAR_USER_ERROR,RAR_MEMORY_ERROR,RAR_CREATE_ERROR,RAR_USER_BREAK=255};
+enum { SUCCESS,WARNING,FATAL_ERROR,CRC_ERROR,LOCK_ERROR,WRITE_ERROR,
+       OPEN_ERROR,USER_ERROR,MEMORY_ERROR,CREATE_ERROR,USER_BREAK=255};
 
 class ErrorHandler
 {
diff -uNr unrar/extract.cpp unrar/extract.cpp
--- unrar/extract.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/extract.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -25,6 +25,7 @@
   while (Cmd->GetArcName(ArcName,ArcNameW,sizeof(ArcName)))
     if (FindFile::FastFind(ArcName,ArcNameW,&FD))
       DataIO.TotalArcSize+=FD.Size;
+
   Cmd->ArcNames->Rewind();
   while (Cmd->GetArcName(ArcName,ArcNameW,sizeof(ArcName)))
   {
@@ -35,10 +36,8 @@
 
       EXTRACT_ARC_CODE Code=ExtractArchive(Cmd);
 
-/*
-      restore Cmd->Password which could be changed in IsArchive() call
-      for next header encrypted archive
-*/
+      // restore Cmd->Password which could be changed in IsArchive() call
+      // for next header encrypted archive
       strcpy(Cmd->Password,PrevCmdPassword);
 
       if (Code!=EXTRACT_ARC_REPEAT)
@@ -54,7 +53,7 @@
     {
       mprintf(St(MExtrNoFiles));
     }
-    ErrHandler.SetErrorCode(RAR_WARNING);
+    ErrHandler.SetErrorCode(WARNING);
   }
 #ifndef GUI
   else
@@ -90,6 +89,8 @@
   SignatureFound=false;
   AllMatchesExact=true;
   ReconstructDone=false;
+
+  StartTime.SetCurrentTime();
 }
 
 
@@ -98,7 +99,7 @@
   Archive Arc(Cmd);
   if (!Arc.WOpen(ArcName,ArcNameW))
   {
-    ErrHandler.SetErrorCode(RAR_OPEN_ERROR);
+    ErrHandler.SetErrorCode(OPEN_ERROR);
     return(EXTRACT_ARC_NEXT);
   }
 
@@ -108,10 +109,11 @@
     mprintf(St(MNotRAR),ArcName);
 #endif
     if (CmpExt(ArcName,"rar"))
-      ErrHandler.SetErrorCode(RAR_WARNING);
+      ErrHandler.SetErrorCode(WARNING);
     return(EXTRACT_ARC_NEXT);
   }
 
+  // archive with corrupt encrypted header can be closed in IsArchive() call
   if (!Arc.IsOpened())
     return(EXTRACT_ARC_NEXT);
 
@@ -119,13 +121,42 @@
   if (Arc.Volume && Arc.NotFirstVolume)
   {
     char FirstVolName[NM];
-
     VolNameToFirstName(ArcName,FirstVolName,(Arc.NewMhd.Flags & MHD_NEWNUMBERING));
+
+    // If several volume names from same volume set are specified
+    // and current volume is not first in set and first volume is present
+    // and specified too, let's skip the current volume.
     if (stricomp(ArcName,FirstVolName)!=0 && FileExist(FirstVolName) &&
         Cmd->ArcNames->Search(FirstVolName,NULL,false))
       return(EXTRACT_ARC_NEXT);
   }
 #endif
+
+  if (Arc.Volume)
+  {
+    // Calculate the total size of all accessible volumes.
+    // This size is necessary to display the correct total progress indicator.
+
+    char NextName[NM];
+    wchar NextNameW[NM];
+
+    strcpy(NextName,Arc.FileName);
+    strcpyw(NextNameW,Arc.FileNameW);
+
+    while (true)
+    {
+      // First volume is already added to DataIO.TotalArcSize 
+      // in initial TotalArcSize calculation in DoExtract.
+      // So we skip it and start from second volume.
+      NextVolumeName(NextName,NextNameW,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
+      struct FindData FD;
+      if (FindFile::FastFind(NextName,NextNameW,&FD))
+        DataIO.TotalArcSize+=FD.Size;
+      else
+        break;
+    }
+  }
+
   ExtractArchiveInit(Cmd,Arc);
 
   if (*Cmd->Command=='T' || *Cmd->Command=='I')
@@ -174,9 +205,9 @@
 #ifdef NOVOLUME
       return(false);
 #else
-      if (!MergeArchive(Arc,NULL,false,Command))
+      if (!MergeArchive(Arc,&DataIO,false,Command))
       {
-        ErrHandler.SetErrorCode(RAR_WARNING);
+        ErrHandler.SetErrorCode(WARNING);
         return(false);
       }
       SignatureFound=false;
@@ -206,9 +237,9 @@
       if (Arc.EndArcHead.Flags & EARC_NEXT_VOLUME)
       {
 #ifndef NOVOLUME
-        if (!MergeArchive(Arc,NULL,false,Command))
+        if (!MergeArchive(Arc,&DataIO,false,Command))
         {
-          ErrHandler.SetErrorCode(RAR_WARNING);
+          ErrHandler.SetErrorCode(WARNING);
           return(false);
         }
         SignatureFound=false;
@@ -352,7 +383,7 @@
 #ifdef RARDLL
       Cmd->DllError=ERAR_BAD_DATA;
 #endif
-      ErrHandler.SetErrorCode(RAR_WARNING);
+      ErrHandler.SetErrorCode(OPEN_ERROR);
     }
     ExactMatch=false;
   }
@@ -370,7 +401,7 @@
 #ifdef RARDLL
         if (*Cmd->Password==0)
           if (Cmd->Callback==NULL ||
-              Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LONG)Cmd->Password,sizeof(Cmd->Password))==-1)
+              Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LPARAM)Cmd->Password,sizeof(Cmd->Password))==-1)
             return(false);
         strcpy(Password,Cmd->Password);
 
@@ -390,7 +421,7 @@
           switch(Cmd->AllYes ? 1:Ask(St(MYesNoAll)))
           {
             case -1:
-              ErrHandler.Exit(RAR_USER_BREAK);
+              ErrHandler.Exit(USER_BREAK);
             case 2:
               if (!GetPassword(PASSWORD_FILE,ArcFileName,Password,sizeof(Password)))
               {
@@ -488,7 +519,7 @@
       if (Length>0)
       {
         wchar ArcPathW[NM];
-        CharToWide(Cmd->ArcPath,ArcPathW);
+        GetWideName(Cmd->ArcPath,Cmd->ArcPathW,ArcPathW);
         Length=strlenw(ArcPathW);
       }
       ExtrNameW+=Length;
@@ -518,7 +549,16 @@
       if (FindFile::FastFind(DestFileName,DestNameW,&FD))
       {
         if (FD.mtime >= Arc.NewLhd.mtime)
-          ExtrFile=false;
+        {
+          // If directory already exists and its modification time is newer 
+          // than start of extraction, it is likely it was created 
+          // when creating a path to one of already extracted items. 
+          // In such case we'll better update its time even if archived 
+          // directory is older.
+
+          if (!FD.IsDir || FD.mtime<StartTime)
+            ExtrFile=false;
+        }
       }
       else
         if (Cmd->FreshFiles)
@@ -528,7 +568,7 @@
     // skip encrypted file if no password is specified
     if ((Arc.NewLhd.Flags & LHD_PASSWORD)!=0 && *Password==0)
     {
-      ErrHandler.SetErrorCode(RAR_WARNING);
+      ErrHandler.SetErrorCode(WARNING);
 #ifdef RARDLL
       Cmd->DllError=ERAR_MISSING_PASSWORD;
 #endif
@@ -566,7 +606,7 @@
 #endif
 #endif
       ExtrFile=false;
-      ErrHandler.SetErrorCode(RAR_WARNING);
+      ErrHandler.SetErrorCode(WARNING);
 #ifdef RARDLL
       Cmd->DllError=ERAR_UNKNOWN_FORMAT;
 #endif
@@ -630,16 +670,16 @@
 #ifdef RARDLL
             Cmd->DllError=ERAR_ECREATE;
 #endif
-            ErrHandler.SetErrorCode(RAR_CREATE_ERROR);
+            ErrHandler.SetErrorCode(CREATE_ERROR);
           }
         if (PrevExtracted)
         {
 #if defined(_WIN_32) && !defined(_WIN_CE) && !defined(SFX_MODULE)
           if (Cmd->SetCompressedAttr &&
               (Arc.NewLhd.FileAttr & FILE_ATTRIBUTE_COMPRESSED)!=0 && WinNT())
-            SetFileCompression(DestFileName,DestFileNameW,true);
+            SetFileCompression(DestFileName,DestNameW,true);
 #endif
-          SetDirTime(DestFileName,
+          SetDirTime(DestFileName,DestNameW,
             Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime,
             Cmd->xctime==EXTTIME_NONE ? NULL:&Arc.NewLhd.ctime,
             Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime);
@@ -663,7 +703,7 @@
             if (!UserReject)
             {
               ErrHandler.CreateErrorMsg(Arc.FileName,DestFileName);
-              ErrHandler.SetErrorCode(RAR_CREATE_ERROR);
+              ErrHandler.SetErrorCode(CREATE_ERROR);
 #ifdef RARDLL
               Cmd->DllError=ERAR_ECREATE;
 #endif
@@ -796,7 +836,7 @@
             Log(BadArcName,St(MCRCFailed),ArcFileName);
           }
           BrokenFile=true;
-          ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+          ErrHandler.SetErrorCode(CRC_ERROR);
 #ifdef RARDLL
           Cmd->DllError=ERAR_BAD_DATA;
 #endif
diff -uNr unrar/extract.hpp unrar/extract.hpp
--- unrar/extract.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/extract.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -7,6 +7,7 @@
 {
   private:
     EXTRACT_ARC_CODE ExtractArchive(CommandData *Cmd);
+    RarTime StartTime; // time when extraction started
 
     ComprDataIO DataIO;
     Unpack *Unp;
diff -uNr unrar/filcreat.cpp unrar/filcreat.cpp
--- unrar/filcreat.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/filcreat.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -30,7 +30,7 @@
 #endif
     if (Cmd->AllYes || Mode==OVERWRITE_ALL)
       break;
-    if (Mode==OVERWRITE_ASK)
+    if (Mode==OVERWRITE_DEFAULT || Mode==OVERWRITE_FORCE_ASK)
     {
       eprintf(St(MFileExists),Name);
       int Choice=Ask(St(MYesNoAllRenQ));
@@ -78,7 +78,7 @@
         continue;
       }
       if (Choice==6)
-        ErrHandler.Exit(RAR_USER_BREAK);
+        ErrHandler.Exit(USER_BREAK);
     }
     if (Mode==OVERWRITE_AUTORENAME)
     {
@@ -88,7 +88,7 @@
           *NameW=0;
       }
       else
-        Mode=OVERWRITE_ASK;
+        Mode=OVERWRITE_DEFAULT;
       continue;
     }
   }
diff -uNr unrar/file.cpp unrar/file.cpp
--- unrar/file.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/file.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -121,7 +121,7 @@
 void File::TOpen(const char *Name,const wchar *NameW)
 {
   if (!WOpen(Name,NameW))
-    ErrHandler.Exit(RAR_OPEN_ERROR);
+    ErrHandler.Exit(OPEN_ERROR);
 }
 #endif
 
@@ -135,14 +135,15 @@
 }
 
 
-bool File::Create(const char *Name,const wchar *NameW)
+bool File::Create(const char *Name,const wchar *NameW,bool ShareRead)
 {
 #ifdef _WIN_32
+  DWORD ShareMode=(ShareRead || File::OpenShared) ? FILE_SHARE_READ:0;
   if (WinNT() && NameW!=NULL && *NameW!=0)
-    hFile=CreateFileW(NameW,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ,NULL,
+    hFile=CreateFileW(NameW,GENERIC_READ|GENERIC_WRITE,ShareMode,NULL,
                       CREATE_ALWAYS,0,NULL);
   else
-    hFile=CreateFile(Name,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ,NULL,
+    hFile=CreateFile(Name,GENERIC_READ|GENERIC_WRITE,ShareMode,NULL,
                      CREATE_ALWAYS,0,NULL);
 #else
   hFile=fopen(Name,CREATEBINARY);
@@ -176,19 +177,19 @@
 
 
 #if !defined(SHELL_EXT) && !defined(SFX_MODULE)
-void File::TCreate(const char *Name,const wchar *NameW)
+void File::TCreate(const char *Name,const wchar *NameW,bool ShareRead)
 {
-  if (!WCreate(Name,NameW))
-    ErrHandler.Exit(RAR_FATAL_ERROR);
+  if (!WCreate(Name,NameW,ShareRead))
+    ErrHandler.Exit(FATAL_ERROR);
 }
 #endif
 
 
-bool File::WCreate(const char *Name,const wchar *NameW)
+bool File::WCreate(const char *Name,const wchar *NameW,bool ShareRead)
 {
-  if (Create(Name,NameW))
+  if (Create(Name,NameW,ShareRead))
     return(true);
-  ErrHandler.SetErrorCode(RAR_CREATE_ERROR);
+  ErrHandler.SetErrorCode(CREATE_ERROR);
   ErrHandler.CreateErrorMsg(Name);
   return(false);
 }
@@ -248,15 +249,21 @@
 }
 
 
-bool File::Rename(const char *NewName)
+bool File::Rename(const char *NewName,const wchar *NewNameW)
 {
+  // we do not need to rename if names are already same
   bool Success=strcmp(FileName,NewName)==0;
+  if (Success && *FileNameW!=0 && *NullToEmpty(NewNameW)!=0)
+    Success=strcmpw(FileNameW,NewNameW)==0;
+
   if (!Success)
-    Success=rename(FileName,NewName)==0;
+    Success=RenameFile(FileName,FileNameW,NewName,NewNameW);
+
   if (Success)
   {
+    // renamed successfully, storing the new name
     strcpy(FileName,NewName);
-    *FileNameW=0;
+    strcpyw(FileNameW,NullToEmpty(NewNameW));
   }
   return(Success);
 }
@@ -288,11 +295,12 @@
 #endif
   while (1)
   {
-    bool Success;
+    bool Success=false;
 #ifdef _WIN_32
-    DWORD Written;
+    DWORD Written=0;
     if (HandleType!=FILE_HANDLENORMAL)
     {
+      // writing to stdout can fail in old Windows if data block is too large
       const int MaxSize=0x4000;
       for (int I=0;I<Size;I+=MaxSize)
         if (!(Success=WriteFile(hFile,(byte *)Data+I,Min(Size-I,MaxSize),&Written,NULL)))
@@ -333,7 +341,8 @@
 
 int File::Read(void *Data,int Size)
 {
-  Int64 FilePos;
+  Int64 FilePos=0; //initialized only to suppress some compilers warning
+
   if (IgnoreReadErrors)
     FilePos=Tell();
   int ReadSize;
diff -uNr unrar/filefn.cpp unrar/filefn.cpp
--- unrar/filefn.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/filefn.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -31,9 +31,9 @@
   return(errno==ENOENT ? MKDIR_BADPATH:MKDIR_ERROR);
 #endif
 #ifdef _UNIX
-  int prevmask=umask(0);
+//  int prevmask=umask(0);
   int ErrCode=Name==NULL ? -1:mkdir(Name,(mode_t)Attr);
-  umask(prevmask);
+//  umask(prevmask);
   if (ErrCode==-1)
     return(errno==ENOENT ? MKDIR_BADPATH:MKDIR_ERROR);
   return(MKDIR_SUCCESS);
@@ -109,7 +109,7 @@
 }
 
 
-void SetDirTime(const char *Name,RarTime *ftm,RarTime *ftc,RarTime *fta)
+void SetDirTime(const char *Name,const wchar *NameW,RarTime *ftm,RarTime *ftc,RarTime *fta)
 {
 #ifdef _WIN_32
   if (!WinNT())
@@ -119,11 +119,14 @@
   bool sc=ftc!=NULL && ftc->IsSet();
   bool sa=fta!=NULL && fta->IsSet();
 
-  unsigned int DirAttr=GetFileAttr(Name);
+  unsigned int DirAttr=GetFileAttr(Name,NameW);
   bool ResetAttr=(DirAttr!=0xffffffff && (DirAttr & FA_RDONLY)!=0);
   if (ResetAttr)
-    SetFileAttr(Name,NULL,0);
-  HANDLE hFile=CreateFile(Name,GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,
+    SetFileAttr(Name,NameW,0);
+
+  wchar DirNameW[NM];
+  GetWideName(Name,NameW,DirNameW);
+  HANDLE hFile=CreateFileW(DirNameW,GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,
                           NULL,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,NULL);
   if (hFile==INVALID_HANDLE_VALUE)
     return;
@@ -137,7 +140,7 @@
   SetFileTime(hFile,sc ? &fc:NULL,sa ? &fa:NULL,sm ? &fm:NULL);
   CloseHandle(hFile);
   if (ResetAttr)
-    SetFileAttr(Name,NULL,DirAttr);
+    SetFileAttr(Name,NameW,DirAttr);
 #endif
 #if defined(_UNIX) || defined(_EMX)
   File::SetCloseFileTimeByName(Name,ftm,fta);
@@ -455,7 +458,7 @@
 #ifndef SFX_MODULE
 char *MkTemp(char *Name)
 {
-  int Length=strlen(Name);
+  size_t Length=strlen(Name);
   if (Length<=6)
     return(NULL);
   int Random=clock();
@@ -550,7 +553,7 @@
 }
 
 
-#if defined(_WIN_32) && !defined(_WIN_CE)
+#if defined(_WIN_32) && !defined(_WIN_CE) && !defined(SFX_MODULE)
 bool SetFileCompression(char *Name,wchar *NameW,bool State)
 {
   wchar FileNameW[NM];
@@ -568,3 +571,9 @@
   return(RetCode!=0);
 }
 #endif
+
+
+
+
+
+
diff -uNr unrar/filefn.hpp unrar/filefn.hpp
--- unrar/filefn.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/filefn.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -5,7 +5,7 @@
 
 MKDIR_CODE MakeDir(const char *Name,const wchar *NameW,uint Attr);
 bool CreatePath(const char *Path,const wchar *PathW,bool SkipLastName);
-void SetDirTime(const char *Name,RarTime *ftm,RarTime *ftc,RarTime *fta);
+void SetDirTime(const char *Name,const wchar *NameW,RarTime *ftm,RarTime *ftc,RarTime *fta);
 bool IsRemovable(const char *Name);
 Int64 GetFreeDisk(const char *Name);
 bool FileExist(const char *Name,const wchar *NameW=NULL);
@@ -38,4 +38,7 @@
 bool SetFileCompression(char *Name,wchar *NameW,bool State);
 #endif
 
+
+
+
 #endif
diff -uNr unrar/file.hpp unrar/file.hpp
--- unrar/file.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/file.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -56,13 +56,13 @@
     bool Open(const char *Name,const wchar *NameW=NULL,bool OpenShared=false,bool Update=false);
     void TOpen(const char *Name,const wchar *NameW=NULL);
     bool WOpen(const char *Name,const wchar *NameW=NULL);
-    bool Create(const char *Name,const wchar *NameW=NULL);
-    void TCreate(const char *Name,const wchar *NameW=NULL);
-    bool WCreate(const char *Name,const wchar *NameW=NULL);
+    bool Create(const char *Name,const wchar *NameW=NULL,bool ShareRead=true);
+    void TCreate(const char *Name,const wchar *NameW=NULL,bool ShareRead=true);
+    bool WCreate(const char *Name,const wchar *NameW=NULL,bool ShareRead=true);
     bool Close();
     void Flush();
     bool Delete();
-    bool Rename(const char *NewName);
+    bool Rename(const char *NewName,const wchar *NewNameW=NULL);
     void Write(const void *Data,int Size);
     int Read(void *Data,int Size);
     int DirectRead(void *Data,int Size);
diff -uNr unrar/filestr.cpp unrar/filestr.cpp
--- unrar/filestr.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/filestr.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -3,7 +3,8 @@
 static bool IsUnicode(byte *Data,int Size);
 
 bool ReadTextFile(char *Name,StringList *List,bool Config,bool AbortOnError,
-                  RAR_CHARSET SrcCharset,bool Unquote,bool SkipComments)
+                  RAR_CHARSET SrcCharset,bool Unquote,bool SkipComments,
+                  bool ExpandEnvStr)
 {
   char FileName[NM];
   if (Config)
@@ -19,7 +20,7 @@
     if (!OpenCode)
     {
       if (AbortOnError)
-        ErrHandler.Exit(RAR_OPEN_ERROR);
+        ErrHandler.Exit(OPEN_ERROR);
       return(false);
     }
   }
@@ -79,7 +80,28 @@
           CurStr++;
         }
         WideToChar(CurStr,&AnsiName[0],AnsiName.Size());
-        List->AddString(&AnsiName[0],CurStr);
+
+        bool Expanded=false;
+#if defined(_WIN_32) && !defined(_WIN_CE)
+        if (ExpandEnvStr && *CurStr=='%')
+        {
+          // expanding environment variables in Windows version
+
+          char ExpName[NM];
+          wchar ExpNameW[NM];
+          *ExpNameW=0;
+          int ret,retw=1;
+          ret=ExpandEnvironmentStrings(&AnsiName[0],ExpName,ASIZE(ExpName));
+          if (ret!=0 && WinNT())
+            retw=ExpandEnvironmentStringsW(CurStr,ExpNameW,ASIZE(ExpNameW));
+          Expanded=ret!=0 && ret<ASIZE(ExpName) &&
+                   retw!=0 && retw<ASIZE(ExpNameW);
+          if (Expanded)
+            List->AddString(ExpName,ExpNameW);
+        }
+#endif
+        if (!Expanded)
+          List->AddString(&AnsiName[0],CurStr);
       }
       CurStr=NextStr+1;
       while (*CurStr=='\r' || *CurStr=='\n')
@@ -112,7 +134,7 @@
       {
         if (Unquote && *CurStr=='\"')
         {
-          int Length=strlen(CurStr);
+          size_t Length=strlen(CurStr);
           if (CurStr[Length-1]=='\"')
           {
             CurStr[Length-1]=0;
@@ -123,7 +145,22 @@
         if (SrcCharset==RCH_OEM)
           OemToChar(CurStr,CurStr);
 #endif
-        List->AddString(CurStr);
+
+        bool Expanded=false;
+#if defined(_WIN_32) && !defined(_WIN_CE)
+        if (ExpandEnvStr && *CurStr=='%')
+        {
+          // expanding environment variables in Windows version
+
+          char ExpName[NM];
+          int ret=ExpandEnvironmentStrings(CurStr,ExpName,ASIZE(ExpName));
+          Expanded=ret!=0 && ret<ASIZE(ExpName);
+          if (Expanded)
+            List->AddString(ExpName);
+        }
+#endif
+        if (!Expanded)
+          List->AddString(CurStr);
       }
       CurStr=NextStr+1;
       while (*CurStr=='\r' || *CurStr=='\n')
diff -uNr unrar/filestr.hpp unrar/filestr.hpp
--- unrar/filestr.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/filestr.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -3,6 +3,7 @@
 
 bool ReadTextFile(char *Name,StringList *List,bool Config,
                   bool AbortOnError=false,RAR_CHARSET SrcCharset=RCH_DEFAULT,
-                  bool Unquote=false,bool SkipComments=false);
+                  bool Unquote=false,bool SkipComments=false,
+                  bool ExpandEnvStr=false);
 
 #endif
diff -uNr unrar/find.cpp unrar/find.cpp
--- unrar/find.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/find.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -4,7 +4,7 @@
 {
   *FindMask=0;
   *FindMaskW=0;
-  FirstCall=TRUE;
+  FirstCall=true;
 #ifdef _WIN_32
   hFind=INVALID_HANDLE_VALUE;
 #else
@@ -30,7 +30,7 @@
   strcpy(FindFile::FindMask,FindMask);
   if (*FindMaskW==0)
     CharToWide(FindMask,FindMaskW);
-  FirstCall=TRUE;
+  FirstCall=true;
 }
 
 
@@ -41,7 +41,7 @@
   strcpyw(FindFile::FindMaskW,FindMaskW);
   if (*FindMask==0)
     WideToChar(FindMaskW,FindMask);
-  FirstCall=TRUE;
+  FirstCall=true;
 }
 
 
@@ -120,8 +120,9 @@
     CharToWide(fd->Name,fd->NameW);
 #endif
 #endif
+  fd->Flags=0;
   fd->IsDir=IsDir(fd->FileAttr);
-  FirstCall=FALSE;
+  FirstCall=false;
   char *Name=PointToName(fd->Name);
   if (strcmp(Name,".")==0 || strcmp(Name,"..")==0)
     return(Next(fd));
@@ -185,6 +186,7 @@
     CharToWide(fd->Name,fd->NameW);
 #endif
 #endif
+  fd->Flags=0;
   fd->IsDir=IsDir(fd->FileAttr);
   return(true);
 }
@@ -290,6 +292,7 @@
     }
   }
 #endif
+  fd->Flags=0;
   return(hFind);
 }
 #endif
diff -uNr unrar/find.hpp unrar/find.hpp
--- unrar/find.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/find.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -1,6 +1,10 @@
 #ifndef _RAR_FINDDATA_
 #define _RAR_FINDDATA_
 
+enum FINDDATA_FLAGS {
+  FDDF_SECONDDIR=1  // second entry of directory in SCAN_GETDIRSTWICE ScanTree mode
+};
+
 struct FindData
 {
   char Name[NM];
@@ -18,6 +22,7 @@
   FILETIME ftLastAccessTime; 
   FILETIME ftLastWriteTime; 
 #endif
+  uint Flags;
   bool Error;
 };
 
@@ -30,7 +35,7 @@
 
     char FindMask[NM];
     wchar FindMaskW[NM];
-    int FirstCall;
+    bool FirstCall;
 #ifdef _WIN_32
     HANDLE hFind;
 #else
diff -uNr unrar/headers.hpp unrar/headers.hpp
--- unrar/headers.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/headers.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -65,9 +65,9 @@
 #define  LONG_BLOCK         0x8000
 
 #define  EARC_NEXT_VOLUME   0x0001 // not last volume
-#define  EARC_DATACRC       0x0002
-#define  EARC_REVSPACE      0x0004
-#define  EARC_VOLNUMBER     0x0008
+#define  EARC_DATACRC       0x0002 // store CRC32 of RAR archive (now used only in volumes)
+#define  EARC_REVSPACE      0x0004 // reserve space for end of REV file 7 byte record
+#define  EARC_VOLNUMBER     0x0008 // store a number of current volume
 
 enum HEADER_TYPE {
   MARK_HEAD=0x72,MAIN_HEAD=0x73,FILE_HEAD=0x74,COMM_HEAD=0x75,AV_HEAD=0x76,
@@ -218,11 +218,13 @@
 
 struct EndArcHeader:BaseBlock
 {
-  uint ArcDataCRC;
-  ushort VolNumber;
+  uint ArcDataCRC;  // optional archive CRC32
+  ushort VolNumber; // optional current volume number
 };
 
 
+// SubBlockHeader and its successors were used in RAR 2.x format.
+// RAR 3.x uses FileHeader with NEWSUB_HEAD HeadType for subblocks.
 struct SubBlockHeader:BlockHeader
 {
   ushort SubType;
diff -uNr unrar/license.txt unrar/license.txt
--- unrar/license.txt	1970-01-01 01:00:00.000000000 +0100
+++ unrar/license.txt	2006-04-04 19:13:44.000000000 +0200
@@ -0,0 +1,40 @@
+ ******    *****   ******   UnRAR - free utility for RAR archives
+ **   **  **   **  **   **  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ******   *******  ******    License for use and distribution of
+ **   **  **   **  **   **   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ **   **  **   **  **   **         FREE portable version
+                                   ~~~~~~~~~~~~~~~~~~~~~
+
+      The source code of UnRAR utility is freeware. This means:
+
+   1. All copyrights to RAR and the utility UnRAR are exclusively
+      owned by the author - Alexander Roshal.
+
+   2. The UnRAR sources may be used in any software to handle RAR
+      archives without limitations free of charge, but cannot be used
+      to re-create the RAR compression algorithm, which is proprietary.
+      Distribution of modified UnRAR sources in separate form or as a
+      part of other software is permitted, provided that it is clearly
+      stated in the documentation and source comments that the code may
+      not be used to develop a RAR (WinRAR) compatible archiver.
+
+   3. The UnRAR utility may be freely distributed. It is allowed
+      to distribute UnRAR inside of other software packages.
+
+   4. THE RAR ARCHIVER AND THE UnRAR UTILITY ARE DISTRIBUTED "AS IS".
+      NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED.  YOU USE AT 
+      YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS, 
+      DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING
+      OR MISUSING THIS SOFTWARE.
+
+   5. Installing and using the UnRAR utility signifies acceptance of
+      these terms and conditions of the license.
+
+   6. If you don't agree with terms of the license you must remove
+      UnRAR files from your storage devices and cease to use the
+      utility.
+
+      Thank you for your interest in RAR and UnRAR.
+
+
+                                            Alexander L. Roshal
\ Kein Zeilenumbruch am Dateiende.
diff -uNr unrar/LICENSE.txt unrar/LICENSE.txt
--- unrar/LICENSE.txt	2008-02-26 14:28:59.000000000 +0100
+++ unrar/LICENSE.txt	1970-01-01 01:00:00.000000000 +0100
@@ -1,41 +0,0 @@
- ******    *****   ******   unRAR - free utility for RAR archives
- **   **  **   **  **   **  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ******   *******  ******    License for use and distribution of
- **   **  **   **  **   **   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- **   **  **   **  **   **         FREE portable version
-                                   ~~~~~~~~~~~~~~~~~~~~~
-
-      The source code of unRAR utility is freeware. This means:
-
-   1. All copyrights to RAR and the utility unRAR are exclusively
-      owned by the author - Eugene Roshal.
-
-   2. The unRAR sources may be used in any software to handle RAR
-      archives without limitations free of charge, but cannot be used
-      to re-create the RAR compression algorithm, which is proprietary.
-      Distribution of modified unRAR sources in separate form or as a
-      part of other software is permitted, provided that it is clearly
-      stated in the documentation and source comments that the code may
-      not be used to develop a RAR (WinRAR) compatible archiver.
-
-   3. The unRAR utility may be freely distributed. No person or company 
-      may charge a fee for the distribution of unRAR without written
-      permission from the copyright holder.
-
-   4. THE RAR ARCHIVER AND THE UNRAR UTILITY ARE DISTRIBUTED "AS IS".
-      NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED.  YOU USE AT 
-      YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS, 
-      DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING
-      OR MISUSING THIS SOFTWARE.
-
-   5. Installing and using the unRAR utility signifies acceptance of
-      these terms and conditions of the license.
-
-   6. If you don't agree with terms of the license you must remove
-      unRAR files from your storage devices and cease to use the
-      utility.
-
-      Thank you for your interest in RAR and unRAR.
-
-
-                                            Eugene Roshal
\ Kein Zeilenumbruch am Dateiende.
diff -uNr unrar/list.cpp unrar/list.cpp
--- unrar/list.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/list.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -270,13 +270,20 @@
 void ListSymLink(Archive &Arc)
 {
   if (Arc.NewLhd.HostOS==HOST_UNIX && (Arc.NewLhd.FileAttr & 0xF000)==0xA000)
-  {
-    char FileName[NM];
-    int DataSize=Min(Arc.NewLhd.PackSize,sizeof(FileName)-1);
-    Arc.Read(FileName,DataSize);
-    FileName[DataSize]=0;
-    mprintf("\n%22s %s","-->",FileName);
-  }
+    if ((Arc.NewLhd.Flags & LHD_PASSWORD)==0)
+    {
+      char FileName[NM];
+      int DataSize=Min(Arc.NewLhd.PackSize,sizeof(FileName)-1);
+      Arc.Read(FileName,DataSize);
+      FileName[DataSize]=0;
+      mprintf("\n%22s %s","-->",FileName);
+    }
+    else
+    {
+      // Link data are encrypted. We would need to ask for password
+      // and initialize decryption routine to display the link target.
+      mprintf("\n%22s %s","-->","*<-?->");
+    }
 }
 
 
diff -uNr unrar/loclang.hpp unrar/loclang.hpp
--- unrar/loclang.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/loclang.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -1,5 +1,6 @@
 #define   MYesNo             "_Yes_No"
 #define   MYesNoAll          "_Yes_No_All"
+#define   MYesNoAllQ         "_Yes_No_All_nEver_Quit"
 #define   MYesNoAllRenQ      "_Yes_No_All_nEver_Rename_Quit"
 #define   MContinueQuit      "_Continue_Quit"
 #define   MRetryAbort        "_Retry_Abort"
@@ -63,7 +64,9 @@
 #define   MCHelpSwCU         "\n  cu            Convert names to upper case"
 #define   MCHelpSwDF         "\n  df            Delete files after archiving"
 #define   MCHelpSwDH         "\n  dh            Open shared files"
+#define   MCHelpSwDR         "\n  dr            Delete files to Recycle Bin"
 #define   MCHelpSwDS         "\n  ds            Disable name sort for solid archive"
+#define   MCHelpSwDW         "\n  dw            Wipe files after archiving"
 #define   MCHelpSwEa         "\n  e[+]<attr>    Set file exclude and include attributes"
 #define   MCHelpSwED         "\n  ed            Do not add empty directories"
 #define   MCHelpSwEE         "\n  ee            Do not save and extract extended attributes"
@@ -91,8 +94,7 @@
 #define   MCHelpSwN          "\n  n<file>       Include only specified file"
 #define   MCHelpSwNa         "\n  n@            Read file names to include from stdin"
 #define   MCHelpSwNal        "\n  n@<list>      Include files in specified list file"
-#define   MCHelpSwOp         "\n  o+            Overwrite existing files"
-#define   MCHelpSwOm         "\n  o-            Do not overwrite existing files"
+#define   MCHelpSwO          "\n  o[+|-]        Set the overwrite mode"
 #define   MCHelpSwOC         "\n  oc            Set NTFS Compressed attribute"
 #define   MCHelpSwOL         "\n  ol            Save symbolic links as the link instead of the file"
 #define   MCHelpSwOR         "\n  or            Rename files automatically"
@@ -347,3 +349,4 @@
 #define   MCannotDelete      "\nCannot delete %s"
 #define   MCalcCRC           "\nCalculating the control sum"
 #define   MTooLargeSFXArc    "\nWARNING: Too large SFX archive. Windows cannot run the executable file exceeding 4 GB."
+#define   MCalcCRCAllVol     "\nCalculating control sums of all volumes."
diff -uNr unrar/makefile.bcc unrar/makefile.bcc
--- unrar/makefile.bcc	1970-01-01 01:00:00.000000000 +0100
+++ unrar/makefile.bcc	2007-06-30 21:00:38.000000000 +0200
@@ -0,0 +1,501 @@
+.AUTODEPEND
+
+basepath    = $(BASEPATHCC)
+binpath     = $(basepath)\bin
+libpath     = $(basepath)\lib
+rarpath     = .
+incpath     = $(basepath)\include;$(rarpath)
+
+cc    = $(binpath)\bcc32
+link  = $(binpath)\ilink32
+
+objpath     = .
+guiopt      = -WC -H=$(objpath)\rar.csm
+
+!ifndef RARDLL
+!ifndef GUI
+guiopt=$(guiopt) -x-
+!endif
+!ifdef SFX_MODULE
+guiopt=$(guiopt) -x-
+!endif
+!endif
+
+!ifdef DEBUG
+optdeb=-Od -k -vi- -DDEBUG
+!else
+# -O is not safe to use with -pr and int64 return values, so let's turn it off
+optdeb=-O1 -O- -k-
+#optdeb=-Ob -Oe -Og -Oi -Ol -Om -Op -OS -Ov -Z -Oc
+!endif
+
+
+optunrar=-DUNRAR
+linkdest=unrar.exe
+
+!ifdef SFX_MODULE
+optunrar=-DUNRAR -DSFX_MODULE
+linkdest=sfx.exe
+!endif
+
+linkopt = -L$(libpath) -ap -c -v -s -V4.0 -Gn
+compopt = -P -c -I$(incpath) -R -v -vi -w-pch -w-par -K -f-\
+          -ff- -a4 -pr -RT- $(optdeb) $(guiopt) $(optunrar) -d -w-8072
+
+!ifdef RARDLL
+SILENT=true
+linkdest=unrar.dll
+linkopt=$(linkopt) -Tpd
+compopt=$(compopt) -DRARDLL
+!else
+linkopt=$(linkopt) -Tpe -B:0x400000 
+!endif
+
+!ifdef SILENT
+compopt=$(compopt) -DSILENT
+!endif
+
+
+rar: $(linkdest)
+
+Dep_SFX= \
+   $(objpath)\strlist.obj\
+   $(objpath)\strfn.obj\
+   $(objpath)\pathfn.obj\
+   $(objpath)\cmddata.obj\
+   $(objpath)\consio.obj\
+   $(objpath)\int64.obj\
+   $(objpath)\savepos.obj\
+   $(objpath)\file.obj\
+   $(objpath)\filefn.obj\
+   $(objpath)\filcreat.obj\
+   $(objpath)\sha1.obj\
+   $(objpath)\archive.obj\
+   $(objpath)\arcread.obj\
+   $(objpath)\unicode.obj\
+   $(objpath)\system.obj\
+   $(objpath)\isnt.obj\
+   $(objpath)\crc.obj\
+   $(objpath)\crypt.obj\
+   $(objpath)\rijndael.obj\
+   $(objpath)\rawread.obj\
+   $(objpath)\encname.obj\
+   $(objpath)\resource.obj\
+   $(objpath)\match.obj\
+   $(objpath)\find.obj\
+   $(objpath)\timefn.obj\
+   $(objpath)\getbits.obj\
+   $(objpath)\rarvm.obj\
+   $(objpath)\rdwrfn.obj\
+   $(objpath)\options.obj\
+   $(objpath)\ulinks.obj\
+   $(objpath)\errhnd.obj\
+   $(objpath)\volume.obj\
+   $(objpath)\rs.obj\
+   $(objpath)\recvol.obj\
+   $(objpath)\extinfo.obj\
+   $(objpath)\extract.obj\
+   $(objpath)\unpack.obj\
+   $(objpath)\rar.obj\
+   $(objpath)\global.obj
+
+Dep_Unrar = \
+   $(objpath)\filestr.obj\
+   $(objpath)\scantree.obj
+
+Dep_Dll = \
+   $(objpath)\dll.obj
+
+#Dep_SFXOnly = $(objpath)\rtl.obj
+
+!ifndef GUI
+!ifndef SILENT
+Dep_Console = \
+   $(objpath)\list.obj
+!endif
+!endif
+
+!ifdef SFX_MODULE
+Dep = $(Dep_SFX) $(Dep_SFXOnly)
+!else
+Dep = $(Dep_SFX) $(Dep_Unrar)
+!endif
+
+!ifndef GUI
+Dep = $(Dep) $(Dep_Console)
+!endif
+
+!ifdef RARDLL
+Dep = $(Dep) $(Dep_Dll)
+!endif
+
+!ifdef GUI
+$(linkdest) : $(Dep)
+  echo Done
+!else
+$(linkdest) : $(Dep)
+  $(link) @&&|
+ $(linkopt) +
+#!ifdef SFX_MODULE
+#$(objpath)\dummy.obj+
+#$(objpath)\ll.obj+
+#$(objpath)\rtl.obj+
+#!else
+!ifdef RARDLL
+$(libpath)\c0d32.obj+
+!else
+$(libpath)\c0x32.obj+
+!endif
+#!endif
+$(objpath)\strlist.obj+
+$(objpath)\strfn.obj+
+$(objpath)\pathfn.obj+
+$(objpath)\int64.obj+
+$(objpath)\savepos.obj+
+$(objpath)\global.obj+
+$(objpath)\file.obj+
+$(objpath)\filefn.obj+
+$(objpath)\filcreat.obj+
+$(objpath)\sha1.obj+
+$(objpath)\archive.obj+
+$(objpath)\arcread.obj+
+$(objpath)\unicode.obj+
+$(objpath)\system.obj+
+$(objpath)\isnt.obj+
+$(objpath)\crc.obj+
+$(objpath)\crypt.obj+
+$(objpath)\rijndael.obj+
+$(objpath)\rawread.obj+
+$(objpath)\encname.obj+
+$(objpath)\resource.obj+
+$(objpath)\match.obj+
+$(objpath)\find.obj+
+!ifndef SFX_MODULE
+$(objpath)\filestr.obj+
+$(objpath)\scantree.obj+
+!endif
+$(objpath)\timefn.obj+
+$(objpath)\getbits.obj+
+$(objpath)\rarvm.obj+
+$(objpath)\rdwrfn.obj+
+$(objpath)\consio.obj+
+$(objpath)\cmddata.obj+
+$(objpath)\options.obj+
+$(objpath)\ulinks.obj+
+$(objpath)\volume.obj+
+$(objpath)\extinfo.obj+
+$(objpath)\extract.obj+
+$(objpath)\rs.obj+
+$(objpath)\recvol.obj+
+!ifndef SILENT
+!ifndef GUI
+$(objpath)\list.obj+
+!endif
+!endif
+!ifdef RARDLL
+$(objpath)\dll.obj+
+!endif
+$(objpath)\errhnd.obj+
+$(objpath)\unpack.obj+
+$(objpath)\rar.obj
+$<,$*
+$(libpath)\cw32.lib+
+$(libpath)\import32.lib
+!ifdef RARDLL
+$(rarpath)\dll.def
+!else
+
+!endif
+|
+!endif
+
+$(objpath)\rar.obj :  $(rarpath)\rar.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\rar.cpp
+|
+
+$(objpath)\strlist.obj :  $(rarpath)\strlist.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\strlist.cpp
+|
+
+$(objpath)\strfn.obj :  $(rarpath)\strfn.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\strfn.cpp
+|
+
+$(objpath)\pathfn.obj :  $(rarpath)\pathfn.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\pathfn.cpp
+|
+
+$(objpath)\int64.obj :  $(rarpath)\int64.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\int64.cpp
+|
+
+$(objpath)\savepos.obj :  $(rarpath)\savepos.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\savepos.cpp
+|
+
+$(objpath)\global.obj :  $(rarpath)\global.cpp
+  $(cc) -q @&&|
+ $(compopt) -H- -o$@ $(rarpath)\global.cpp
+|
+
+$(objpath)\file.obj :  $(rarpath)\file.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\file.cpp
+|
+
+$(objpath)\filefn.obj :  $(rarpath)\filefn.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\filefn.cpp
+|
+
+$(objpath)\filestr.obj :  $(rarpath)\filestr.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\filestr.cpp
+|
+
+$(objpath)\filcreat.obj :  $(rarpath)\filcreat.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\filcreat.cpp
+|
+
+$(objpath)\sha1.obj :  $(rarpath)\sha1.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\sha1.cpp
+|
+
+$(objpath)\ec.obj :  $(rarpath)\ec.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\ec.cpp
+|
+
+$(objpath)\av.obj :  $(rarpath)\av.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\av.cpp
+|
+
+$(objpath)\archive.obj :  $(rarpath)\archive.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\archive.cpp
+|
+
+$(objpath)\arcread.obj :  $(rarpath)\arcread.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\arcread.cpp
+|
+
+$(objpath)\unicode.obj :  $(rarpath)\unicode.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\unicode.cpp
+|
+
+$(objpath)\system.obj :  $(rarpath)\system.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\system.cpp
+|
+
+$(objpath)\isnt.obj :  $(rarpath)\isnt.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\isnt.cpp
+|
+
+$(objpath)\crc.obj :  $(rarpath)\crc.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\crc.cpp
+|
+
+$(objpath)\crypt.obj :  $(rarpath)\crypt.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\crypt.cpp
+|
+
+$(objpath)\rijndael.obj :  $(rarpath)\rijndael.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\rijndael.cpp
+|
+
+$(objpath)\rawread.obj :  $(rarpath)\rawread.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\rawread.cpp
+|
+
+$(objpath)\rawwrite.obj :  $(rarpath)\rawwrite.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\rawwrite.cpp
+|
+
+$(objpath)\encname.obj :  $(rarpath)\encname.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\encname.cpp
+|
+
+$(objpath)\resource.obj :  $(rarpath)\resource.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\resource.cpp
+|
+
+$(objpath)\match.obj :  $(rarpath)\match.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\match.cpp
+|
+
+$(objpath)\find.obj :  $(rarpath)\find.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\find.cpp
+|
+
+$(objpath)\scantree.obj :  $(rarpath)\scantree.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\scantree.cpp
+|
+
+$(objpath)\timefn.obj :  $(rarpath)\timefn.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\timefn.cpp
+|
+
+$(objpath)\getbits.obj :  $(rarpath)\getbits.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\getbits.cpp
+|
+
+$(objpath)\rarvm.obj :  $(rarpath)\rarvm.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\rarvm.cpp
+|
+
+$(objpath)\putbits.obj :  $(rarpath)\putbits.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\putbits.cpp
+|
+
+$(objpath)\pack.obj :  $(rarpath)\pack.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\pack.cpp
+|
+
+$(objpath)\packbord.obj :  $(rarpath)\packbord.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\packbord.cpp
+|
+
+$(objpath)\packanlz.obj :  $(rarpath)\packanlz.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\packanlz.cpp
+|
+
+$(objpath)\cblock.obj :  $(rarpath)\cblock.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\cblock.cpp
+|
+
+$(objpath)\add.obj :  $(rarpath)\add.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\add.cpp
+|
+
+$(objpath)\addlist.obj :  $(rarpath)\addlist.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\addlist.cpp
+|
+
+$(objpath)\procarc.obj :  $(rarpath)\procarc.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\procarc.cpp
+|
+
+$(objpath)\sfx.obj :  $(rarpath)\sfx.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\sfx.cpp
+|
+
+$(objpath)\comment.obj :  $(rarpath)\comment.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\comment.cpp
+|
+
+$(objpath)\rs.obj :  $(rarpath)\rs.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\rs.cpp
+|
+
+$(objpath)\recvol.obj :  $(rarpath)\recvol.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\recvol.cpp
+|
+
+$(objpath)\repair.obj :  $(rarpath)\repair.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\repair.cpp
+|
+
+$(objpath)\rdwrfn.obj :  $(rarpath)\rdwrfn.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\rdwrfn.cpp
+|
+
+$(objpath)\consio.obj :  $(rarpath)\consio.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\consio.cpp
+|
+
+$(objpath)\cmddata.obj :  $(rarpath)\cmddata.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\cmddata.cpp
+|
+
+$(objpath)\options.obj :  $(rarpath)\options.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\options.cpp
+|
+
+$(objpath)\ulinks.obj :  $(rarpath)\ulinks.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\ulinks.cpp
+|
+
+$(objpath)\errhnd.obj :  $(rarpath)\errhnd.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\errhnd.cpp
+|
+
+$(objpath)\volume.obj :  $(rarpath)\volume.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\volume.cpp
+|
+
+$(objpath)\extinfo.obj :  $(rarpath)\extinfo.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\extinfo.cpp
+|
+
+
+$(objpath)\extract.obj :  $(rarpath)\extract.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\extract.cpp
+|
+
+$(objpath)\list.obj :  $(rarpath)\list.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\list.cpp
+|
+
+$(objpath)\rtl.obj :  $(rarpath)\rtl.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\rtl.cpp
+|
+
+$(objpath)\unpack.obj :  $(rarpath)\unpack.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\unpack.cpp
+|
+
+$(objpath)\dll.obj :  $(rarpath)\dll.cpp
+  $(cc) -q @&&|
+ $(compopt) -o$@ $(rarpath)\dll.cpp
+|
\ Kein Zeilenumbruch am Dateiende.
diff -uNr unrar/makefile.cygmin unrar/makefile.cygmin
--- unrar/makefile.cygmin	1970-01-01 01:00:00.000000000 +0100
+++ unrar/makefile.cygmin	2007-03-05 06:59:50.000000000 +0100
@@ -0,0 +1,54 @@
+#
+# Makefile for cygmin/mingw - unrar
+#
+# Note: you have to 'make clean' before you can build
+#	the sfx module
+#
+
+# POSIX using Cygmin GCC 3.3.1
+#CXX = g++
+#CXXFLAGS = -O2 -Wno-deprecated 
+#DEFINES = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DLITTLE_ENDIAN
+
+# Win32 using Cygmin GCC 3.3.1
+CXX = g++ -mno-cygwin
+CXXFLAGS = -O2 -Wno-deprecated 
+DEFINES = -D_MSC_VER -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
+
+# Win32 using Mingw32 GCC 3.3.2
+#CXX = g++
+#CXXFLAGS = -O2 -Wno-deprecated 
+#DEFINES = -D_MSC_VER -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
+
+##########################
+
+COMPILE=$(CXX) $(CXXFLAGS) $(DEFINES)
+LINK=$(CXX)
+
+UNRAR_OBJ=filestr.o recvol.o rs.o scantree.o
+
+OBJECTS=rar.o strlist.o strfn.o pathfn.o int64.o savepos.o global.o \
+       	file.o filefn.o filcreat.o archive.o arcread.o unicode.o \
+	system.o isnt.o crypt.o crc.o rawread.o encname.o \
+	resource.o match.o timefn.o rdwrfn.o consio.o options.o \
+	ulinks.o errhnd.o rarvm.o rijndael.o getbits.o sha1.o \
+	extinfo.o extract.o volume.o list.o find.o unpack.o cmddata.o
+
+.cpp.o:
+	$(COMPILE) -D$(WHAT) -c $<
+
+all:	unrar
+
+clean:
+	@rm -f *.o *.bak *~
+
+unrar:	WHAT=UNRAR
+unrar:	$(OBJECTS) $(UNRAR_OBJ)
+	@rm -f makeunrar
+	$(LINK) -Wl,-s -o unrar $(LDFLAGS) $(OBJECTS) $(UNRAR_OBJ) $(LIBS)	
+
+sfx:	WHAT=SFX_MODULE
+sfx:	$(OBJECTS)
+	@rm -f default.sfx
+	$(LINK) -Wl,-s -o default.sfx $(LDFLAGS) $(OBJECTS) -DSFX_MODULE 
+
diff -uNr unrar/makefile.dj unrar/makefile.dj
--- unrar/makefile.dj	1970-01-01 01:00:00.000000000 +0100
+++ unrar/makefile.dj	2007-09-10 12:27:02.000000000 +0200
@@ -0,0 +1,50 @@
+#
+# Makefile for DJGPP - unrar
+#
+# Note: you have to 'make clean' before you can build
+#	the sfx module
+#
+
+# DOS32 using DJGPP 2.03 Patchlevel 2 and GCC 2.95.3
+CXX = gpp
+CXXFLAGS = -O2 -Wno-deprecated
+#DEFINES = -D_MSC_VER -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+
+##########################
+
+.PHONY: all clean veryclean
+
+COMPILE=$(CXX) $(CXXFLAGS) $(DEFINES)
+LINK=$(CXX)
+
+UNRAR_OBJ=filestr.o recvol.o rs.o scantree.o
+
+OBJECTS=rar.o strlist.o strfn.o pathfn.o int64.o savepos.o global.o \
+	file.o filefn.o filcreat.o archive.o arcread.o unicode.o \
+	system.o isnt.o crypt.o crc.o rawread.o encname.o \
+	resource.o match.o timefn.o rdwrfn.o consio.o options.o \
+	ulinks.o errhnd.o rarvm.o rijndael.o getbits.o sha1.o \
+	extinfo.o extract.o volume.o list.o find.o unpack.o cmddata.o
+
+.cpp.o:
+	$(COMPILE) -D$(WHAT) -c $<
+
+all:	unrar
+
+unrar:	WHAT=UNRAR
+unrar:	$(OBJECTS) $(UNRAR_OBJ)
+	$(LINK) -Wl,-s -o unrar.exe $(LDFLAGS) $(OBJECTS) $(UNRAR_OBJ) $(LIBS)
+	exe2coff unrar.exe
+	cp -u $(DJDIR)/bin/cwsdstub.exe .
+	copy /b cwsdstub.exe+unrar unrar.exe
+	-upx --ultra-brute unrar.exe
+
+sfx:	WHAT=SFX_MODULE
+sfx:	$(OBJECTS)
+	$(LINK) -Wl,-s -o default.sfx $(LDFLAGS) $(OBJECTS) -DSFX_MODULE
+
+clean:
+	$(RM) $(OBJECTS) $(UNRAR_OBJ)
+
+veryclean: clean
+	$(RM) unrar.exe default.sfx cwsdstub.exe unrar
diff -uNr unrar/makefile.dmc unrar/makefile.dmc
--- unrar/makefile.dmc	1970-01-01 01:00:00.000000000 +0100
+++ unrar/makefile.dmc	2005-01-22 16:22:54.000000000 +0100
@@ -0,0 +1,54 @@
+# Makefile for Digital Mars C++ Compiler
+# http://www.rarlab.com
+# http://www.digitalmars.com
+#
+# DEFINES: UNRAR RARDLL GUI SFX_MODULE SILENT
+
+NAME = unrar
+EXT = exe
+
+CPP = dmc
+
+LINK = link
+
+# --------------
+# Release Build
+# --------------
+DEFINES = -DNDEBUG -D_MSC_VER -DUNRAR
+CPPFLAGS = -o+all -ff -Nc -g- -Ae
+LNKFLAGS = /EXETYPE:NT /MACHINE:i386 /SUBSYSTEM:CONSOLE /NOLOGO /NODEBUG /NOCODEVIEW /PACKFUNCTIONS
+
+# --------------
+# Debug Build
+# --------------
+#DEFINES = -D_DEBUG -D_MSC_VER -DUNRAR
+#CPPFLAGS = -o+none -Nc -S -gf -Ae
+#LNKFLAGS = /EXETYPE:NT /MACHINE:i386 /SUBSYSTEM:CONSOLE /NOLOGO /DEBUG
+
+OBJ = rar.obj strlist.obj strfn.obj pathfn.obj int64.obj savepos.obj global.obj \
+       	file.obj filefn.obj filcreat.obj archive.obj arcread.obj unicode.obj \
+	system.obj isnt.obj crypt.obj crc.obj rawread.obj encname.obj \
+	resource.obj match.obj timefn.obj rdwrfn.obj consio.obj options.obj \
+	ulinks.obj errhnd.obj rarvm.obj rijndael.obj getbits.obj sha1.obj \
+	extinfo.obj extract.obj volume.obj find.obj unpack.obj cmddata.obj \
+	filestr.obj recvol.obj rs.obj scantree.obj \
+	list.obj \
+#	dll.obj \
+
+LIB = kernel32.lib+user32.lib+advapi32.lib
+
+#DEF = dll.def
+
+link: $(OBJ)
+	$(LINK) $(LNKFLAGS) $(OBJ), $(NAME).$(EXT), $(NAME).map, $(LIB), $(DEF)
+
+.c.obj:
+	$(CPP) $(CPPFLAGS) $(DEFINES) -c $< -o $@
+
+.cpp.obj:
+	$(CPP) $(CPPFLAGS) $(DEFINES) -c $< -o $@
+
+clean:
+	del $(OBJ)
+	del $(NAME).$(EXT)
+	del $(NAME).map
diff -uNr unrar/makefile.msc unrar/makefile.msc
--- unrar/makefile.msc	1970-01-01 01:00:00.000000000 +0100
+++ unrar/makefile.msc	2002-03-15 20:34:16.000000000 +0100
@@ -0,0 +1,564 @@
+# Microsoft Developer Studio Generated NMAKE File, Based on unrar.dsp
+!IF "$(CFG)" == ""
+CFG=unrar - Win32 Release
+!MESSAGE No configuration specified. Defaulting to unrar - Win32 Release.
+!ENDIF 
+
+!IF "$(CFG)" != "unrar - Win32 Release" && "$(CFG)" != "unrar - Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "unrar.mak" CFG="unrar - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "unrar - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "unrar - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+!ERROR An invalid configuration is specified.
+!ENDIF 
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE 
+NULL=nul
+!ENDIF 
+
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "unrar - Win32 Release"
+
+OUTDIR=.\Release
+INTDIR=.\Release
+# Begin Custom Macros
+OutDir=.\Release
+# End Custom Macros
+
+ALL : "$(OUTDIR)\unrar.exe"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\archive.obj"
+	-@erase "$(INTDIR)\arcread.obj"
+	-@erase "$(INTDIR)\cmddata.obj"
+	-@erase "$(INTDIR)\consio.obj"
+	-@erase "$(INTDIR)\crc.obj"
+	-@erase "$(INTDIR)\crypt.obj"
+	-@erase "$(INTDIR)\encname.obj"
+	-@erase "$(INTDIR)\errhnd.obj"
+	-@erase "$(INTDIR)\extinfo.obj"
+	-@erase "$(INTDIR)\extract.obj"
+	-@erase "$(INTDIR)\filcreat.obj"
+	-@erase "$(INTDIR)\file.obj"
+	-@erase "$(INTDIR)\filefn.obj"
+	-@erase "$(INTDIR)\filestr.obj"
+	-@erase "$(INTDIR)\find.obj"
+	-@erase "$(INTDIR)\getbits.obj"
+	-@erase "$(INTDIR)\global.obj"
+	-@erase "$(INTDIR)\int64.obj"
+	-@erase "$(INTDIR)\isnt.obj"
+	-@erase "$(INTDIR)\list.obj"
+	-@erase "$(INTDIR)\match.obj"
+	-@erase "$(INTDIR)\options.obj"
+	-@erase "$(INTDIR)\pathfn.obj"
+	-@erase "$(INTDIR)\rar.obj"
+	-@erase "$(INTDIR)\rarvm.obj"
+	-@erase "$(INTDIR)\rawread.obj"
+	-@erase "$(INTDIR)\rdwrfn.obj"
+	-@erase "$(INTDIR)\recvol.obj"
+	-@erase "$(INTDIR)\resource.obj"
+	-@erase "$(INTDIR)\rijndael.obj"
+	-@erase "$(INTDIR)\rs.obj"
+	-@erase "$(INTDIR)\savepos.obj"
+	-@erase "$(INTDIR)\scantree.obj"
+	-@erase "$(INTDIR)\sha1.obj"
+	-@erase "$(INTDIR)\strfn.obj"
+	-@erase "$(INTDIR)\strlist.obj"
+	-@erase "$(INTDIR)\system.obj"
+	-@erase "$(INTDIR)\timefn.obj"
+	-@erase "$(INTDIR)\ulinks.obj"
+	-@erase "$(INTDIR)\unicode.obj"
+	-@erase "$(INTDIR)\unpack.obj"
+	-@erase "$(INTDIR)\vc60.idb"
+	-@erase "$(INTDIR)\volume.obj"
+	-@erase "$(OUTDIR)\unrar.exe"
+	-@erase "$(OUTDIR)\unrar.map"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "UNRAR" /Fp"$(INTDIR)\unrar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\unrar.bsc" 
+BSC32_SBRS= \
+	
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\unrar.pdb" /map:"$(INTDIR)\unrar.map" /machine:I386 /out:"$(OUTDIR)\unrar.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\rar.obj" \
+	"$(INTDIR)\strlist.obj" \
+	"$(INTDIR)\strfn.obj" \
+	"$(INTDIR)\pathfn.obj" \
+	"$(INTDIR)\int64.obj" \
+	"$(INTDIR)\savepos.obj" \
+	"$(INTDIR)\global.obj" \
+	"$(INTDIR)\file.obj" \
+	"$(INTDIR)\filefn.obj" \
+	"$(INTDIR)\filcreat.obj" \
+	"$(INTDIR)\archive.obj" \
+	"$(INTDIR)\arcread.obj" \
+	"$(INTDIR)\unicode.obj" \
+	"$(INTDIR)\system.obj" \
+	"$(INTDIR)\isnt.obj" \
+	"$(INTDIR)\crypt.obj" \
+	"$(INTDIR)\crc.obj" \
+	"$(INTDIR)\rawread.obj" \
+	"$(INTDIR)\encname.obj" \
+	"$(INTDIR)\resource.obj" \
+	"$(INTDIR)\match.obj" \
+	"$(INTDIR)\timefn.obj" \
+	"$(INTDIR)\rdwrfn.obj" \
+	"$(INTDIR)\consio.obj" \
+	"$(INTDIR)\options.obj" \
+	"$(INTDIR)\ulinks.obj" \
+	"$(INTDIR)\errhnd.obj" \
+	"$(INTDIR)\rarvm.obj" \
+	"$(INTDIR)\rijndael.obj" \
+	"$(INTDIR)\getbits.obj" \
+	"$(INTDIR)\sha1.obj" \
+	"$(INTDIR)\extinfo.obj" \
+	"$(INTDIR)\extract.obj" \
+	"$(INTDIR)\volume.obj" \
+	"$(INTDIR)\list.obj" \
+	"$(INTDIR)\find.obj" \
+	"$(INTDIR)\unpack.obj" \
+	"$(INTDIR)\cmddata.obj" \
+	"$(INTDIR)\filestr.obj" \
+	"$(INTDIR)\recvol.obj" \
+	"$(INTDIR)\rs.obj" \
+	"$(INTDIR)\scantree.obj"
+
+"$(OUTDIR)\unrar.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "unrar - Win32 Debug"
+
+OUTDIR=.\Debug
+INTDIR=.\Debug
+# Begin Custom Macros
+OutDir=.\Debug
+# End Custom Macros
+
+ALL : "$(OUTDIR)\unrar.exe"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\archive.obj"
+	-@erase "$(INTDIR)\arcread.obj"
+	-@erase "$(INTDIR)\cmddata.obj"
+	-@erase "$(INTDIR)\consio.obj"
+	-@erase "$(INTDIR)\crc.obj"
+	-@erase "$(INTDIR)\crypt.obj"
+	-@erase "$(INTDIR)\encname.obj"
+	-@erase "$(INTDIR)\errhnd.obj"
+	-@erase "$(INTDIR)\extinfo.obj"
+	-@erase "$(INTDIR)\extract.obj"
+	-@erase "$(INTDIR)\filcreat.obj"
+	-@erase "$(INTDIR)\file.obj"
+	-@erase "$(INTDIR)\filefn.obj"
+	-@erase "$(INTDIR)\filestr.obj"
+	-@erase "$(INTDIR)\find.obj"
+	-@erase "$(INTDIR)\getbits.obj"
+	-@erase "$(INTDIR)\global.obj"
+	-@erase "$(INTDIR)\int64.obj"
+	-@erase "$(INTDIR)\isnt.obj"
+	-@erase "$(INTDIR)\list.obj"
+	-@erase "$(INTDIR)\match.obj"
+	-@erase "$(INTDIR)\options.obj"
+	-@erase "$(INTDIR)\pathfn.obj"
+	-@erase "$(INTDIR)\rar.obj"
+	-@erase "$(INTDIR)\rarvm.obj"
+	-@erase "$(INTDIR)\rawread.obj"
+	-@erase "$(INTDIR)\rdwrfn.obj"
+	-@erase "$(INTDIR)\recvol.obj"
+	-@erase "$(INTDIR)\resource.obj"
+	-@erase "$(INTDIR)\rijndael.obj"
+	-@erase "$(INTDIR)\rs.obj"
+	-@erase "$(INTDIR)\savepos.obj"
+	-@erase "$(INTDIR)\scantree.obj"
+	-@erase "$(INTDIR)\sha1.obj"
+	-@erase "$(INTDIR)\strfn.obj"
+	-@erase "$(INTDIR)\strlist.obj"
+	-@erase "$(INTDIR)\system.obj"
+	-@erase "$(INTDIR)\timefn.obj"
+	-@erase "$(INTDIR)\ulinks.obj"
+	-@erase "$(INTDIR)\unicode.obj"
+	-@erase "$(INTDIR)\unpack.obj"
+	-@erase "$(INTDIR)\vc60.idb"
+	-@erase "$(INTDIR)\vc60.pdb"
+	-@erase "$(INTDIR)\volume.obj"
+	-@erase "$(OUTDIR)\unrar.exe"
+	-@erase "$(OUTDIR)\unrar.ilk"
+	-@erase "$(OUTDIR)\unrar.pdb"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP_PROJ=/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "UNRAR" /Fp"$(INTDIR)\unrar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ  /c 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\unrar.bsc" 
+BSC32_SBRS= \
+	
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\unrar.pdb" /debug /machine:I386 /out:"$(OUTDIR)\unrar.exe" /pdbtype:sept 
+LINK32_OBJS= \
+	"$(INTDIR)\rar.obj" \
+	"$(INTDIR)\strlist.obj" \
+	"$(INTDIR)\strfn.obj" \
+	"$(INTDIR)\pathfn.obj" \
+	"$(INTDIR)\int64.obj" \
+	"$(INTDIR)\savepos.obj" \
+	"$(INTDIR)\global.obj" \
+	"$(INTDIR)\file.obj" \
+	"$(INTDIR)\filefn.obj" \
+	"$(INTDIR)\filcreat.obj" \
+	"$(INTDIR)\archive.obj" \
+	"$(INTDIR)\arcread.obj" \
+	"$(INTDIR)\unicode.obj" \
+	"$(INTDIR)\system.obj" \
+	"$(INTDIR)\isnt.obj" \
+	"$(INTDIR)\crypt.obj" \
+	"$(INTDIR)\crc.obj" \
+	"$(INTDIR)\rawread.obj" \
+	"$(INTDIR)\encname.obj" \
+	"$(INTDIR)\resource.obj" \
+	"$(INTDIR)\match.obj" \
+	"$(INTDIR)\timefn.obj" \
+	"$(INTDIR)\rdwrfn.obj" \
+	"$(INTDIR)\consio.obj" \
+	"$(INTDIR)\options.obj" \
+	"$(INTDIR)\ulinks.obj" \
+	"$(INTDIR)\errhnd.obj" \
+	"$(INTDIR)\rarvm.obj" \
+	"$(INTDIR)\rijndael.obj" \
+	"$(INTDIR)\getbits.obj" \
+	"$(INTDIR)\sha1.obj" \
+	"$(INTDIR)\extinfo.obj" \
+	"$(INTDIR)\extract.obj" \
+	"$(INTDIR)\volume.obj" \
+	"$(INTDIR)\list.obj" \
+	"$(INTDIR)\find.obj" \
+	"$(INTDIR)\unpack.obj" \
+	"$(INTDIR)\cmddata.obj" \
+	"$(INTDIR)\filestr.obj" \
+	"$(INTDIR)\recvol.obj" \
+	"$(INTDIR)\rs.obj" \
+	"$(INTDIR)\scantree.obj"
+
+"$(OUTDIR)\unrar.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF 
+
+.c{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.c{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+
+!IF "$(NO_EXTERNAL_DEPS)" != "1"
+!IF EXISTS("msc.dep")
+!INCLUDE "msc.dep"
+!ELSE 
+!MESSAGE Warning: cannot find "msc.dep"
+!ENDIF 
+!ENDIF 
+
+
+!IF "$(CFG)" == "unrar - Win32 Release" || "$(CFG)" == "unrar - Win32 Debug"
+SOURCE=.\archive.cpp
+
+"$(INTDIR)\archive.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\arcread.cpp
+
+"$(INTDIR)\arcread.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\cmddata.cpp
+
+"$(INTDIR)\cmddata.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\consio.cpp
+
+"$(INTDIR)\consio.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\crc.cpp
+
+"$(INTDIR)\crc.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\crypt.cpp
+
+"$(INTDIR)\crypt.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\encname.cpp
+
+"$(INTDIR)\encname.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\errhnd.cpp
+
+"$(INTDIR)\errhnd.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\extinfo.cpp
+
+"$(INTDIR)\extinfo.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\extract.cpp
+
+"$(INTDIR)\extract.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\filcreat.cpp
+
+"$(INTDIR)\filcreat.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\file.cpp
+
+"$(INTDIR)\file.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\filefn.cpp
+
+"$(INTDIR)\filefn.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\filestr.cpp
+
+"$(INTDIR)\filestr.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\find.cpp
+
+"$(INTDIR)\find.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\getbits.cpp
+
+"$(INTDIR)\getbits.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\global.cpp
+
+"$(INTDIR)\global.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\int64.cpp
+
+"$(INTDIR)\int64.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\isnt.cpp
+
+"$(INTDIR)\isnt.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\list.cpp
+
+"$(INTDIR)\list.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\match.cpp
+
+"$(INTDIR)\match.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\options.cpp
+
+"$(INTDIR)\options.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\pathfn.cpp
+
+"$(INTDIR)\pathfn.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\rar.cpp
+
+"$(INTDIR)\rar.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\rarvm.cpp
+
+"$(INTDIR)\rarvm.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\rawread.cpp
+
+"$(INTDIR)\rawread.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\rdwrfn.cpp
+
+"$(INTDIR)\rdwrfn.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\recvol.cpp
+
+"$(INTDIR)\recvol.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\resource.cpp
+
+"$(INTDIR)\resource.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\rijndael.cpp
+
+"$(INTDIR)\rijndael.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\rs.cpp
+
+"$(INTDIR)\rs.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\savepos.cpp
+
+"$(INTDIR)\savepos.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\scantree.cpp
+
+"$(INTDIR)\scantree.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\sha1.cpp
+
+"$(INTDIR)\sha1.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\strfn.cpp
+
+"$(INTDIR)\strfn.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\strlist.cpp
+
+"$(INTDIR)\strlist.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\system.cpp
+
+"$(INTDIR)\system.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\timefn.cpp
+
+"$(INTDIR)\timefn.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\ulinks.cpp
+
+"$(INTDIR)\ulinks.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\unicode.cpp
+
+"$(INTDIR)\unicode.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\unpack.cpp
+
+"$(INTDIR)\unpack.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\volume.cpp
+
+"$(INTDIR)\volume.obj" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+
+!ENDIF 
+
diff -uNr unrar/makefile.unix unrar/makefile.unix
--- unrar/makefile.unix	1970-01-01 01:00:00.000000000 +0100
+++ unrar/makefile.unix	2008-10-09 15:43:06.000000000 +0200
@@ -0,0 +1,148 @@
+#
+# Makefile for UNIX - unrar
+#
+# Note: you have to 'make clean' before you can build
+#	the sfx module
+#
+
+# Linux using GCC
+#CXX=g++
+#CXXFLAGS=-O2
+DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+STRIP=strip
+DESTDIR=/usr
+
+# Linux using LCC
+#CXX=lcc
+#CXXFLAGS=-O2
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+#STRIP=strip
+#DESTDIR=/usr
+
+# HP UX using aCC
+#CXX=aCC
+#CXXFLAGS=-AA +O2 +Onolimit
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+#STRIP=strip
+#DESTDIR=/usr
+
+# IRIX using GCC
+#CXX=g++
+#CXXFLAGS=-O2 
+#DEFINES=-DBIG_ENDIAN -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_BSD_COMPAT -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1
+#STRIP=strip
+#DESTDIR=/usr
+
+# IRIX using MIPSPro (experimental)
+#CXX=CC
+#CXXFLAGS=-O2 -mips3 -woff 1234,1156,3284 -LANG:std
+#DEFINES=-DBIG_ENDIAN -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_BSD_COMPAT -DNATIVE_INT64 -DInt64=int64_t
+#STRIP=strip
+#DESTDIR=/usr
+
+# AIX using xlC (IBM VisualAge C++ 5.0)
+#CXX=xlC
+#CXXFLAGS=-O -qinline -qro -qroconst -qmaxmem=16384 -qcpluscmt
+#DEFINES=-D_LARGE_FILES -D_LARGE_FILE_API
+#LIBS=-lbsd
+#STRIP=strip
+#DESTDIR=/usr
+
+# Solaris using CC (SUN Forte Developer 7 C++)
+#CXX=CC
+#CXXFLAGS=-xO2 -xbuiltin=%all -xinline=%auto
+#DEFINES=-DBIG_ENDIAN -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+#STRIP=strip
+#DESTDIR=/usr
+
+# Solaris using GCC (optimized for UltraSPARC 1 CPU)
+#CXX=g++
+#CXXFLAGS=-O3 -mcpu=v9 -mtune=ultrasparc -m32
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+#STRIP=/usr/ccs/bin/strip
+#DESTDIR=/usr
+
+# Tru64 5.1B using GCC3
+#CXX=g++
+#CXXFLAGS=-O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_XOPEN_SOURCE=500
+#STRIP=strip
+#LDFLAGS=-rpath /usr/local/gcc/lib
+#DESTDIR=/usr
+
+# Tru64 5.1B using DEC C++
+#CXX=cxx
+#CXXFLAGS=-O4 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DNATIVE_INT64 -DInt64=long
+#STRIP=strip
+#LDFLAGS=
+#DESTDIR=/usr
+
+# QNX 6.x using GCC
+#CXX=g++
+#CXXFLAGS=-O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fexceptions
+#STRIP=strip
+#LDFLAGS=-fexceptions
+#DESTDIR=/usr
+
+# Cross-compile
+# Linux using arm-linux-g++
+#CXX=arm-linux-g++
+#CXXFLAGS=-O2
+#DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+#STRIP=arm-linux-strip
+#LDFLAGS=-static
+#DESTDIR=/usr
+
+##########################
+
+COMPILE=$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES)
+LINK=$(CXX)
+
+WHAT=UNRAR
+
+UNRAR_OBJ=filestr.o recvol.o rs.o scantree.o
+LIB_OBJ=filestr.o scantree.o dll.o
+
+OBJECTS=rar.o strlist.o strfn.o pathfn.o int64.o savepos.o global.o file.o filefn.o filcreat.o \
+	archive.o arcread.o unicode.o system.o isnt.o crypt.o crc.o rawread.o encname.o \
+	resource.o match.o timefn.o rdwrfn.o consio.o options.o ulinks.o errhnd.o rarvm.o \
+	rijndael.o getbits.o sha1.o extinfo.o extract.o volume.o list.o find.o unpack.o cmddata.o
+
+.cpp.o:
+	$(COMPILE) -D$(WHAT) -c $<
+
+all:	unrar
+
+install:	install-unrar
+
+uninstall:	uninstall-unrar
+
+clean:
+	@rm -f *.o *.bak *~
+
+unrar:	$(OBJECTS) $(UNRAR_OBJ)
+	@rm -f unrar
+	$(LINK) -o unrar $(LDFLAGS) $(OBJECTS) $(UNRAR_OBJ) $(LIBS)	
+	$(STRIP) unrar
+
+sfx:	WHAT=SFX_MODULE
+sfx:	$(OBJECTS)
+	@rm -f default.sfx
+	$(LINK) -o default.sfx $(LDFLAGS) $(OBJECTS)
+	$(STRIP) default.sfx
+
+lib:	WHAT=RARDLL
+lib:	$(OBJECTS) $(LIB_OBJ)
+	@rm -f libunrar.so
+	$(LINK) -shared -o libunrar.so $(LDFLAGS) $(OBJECTS) $(LIB_OBJ)
+
+install-unrar:
+			install unrar $(DESTDIR)/bin
+
+uninstall-unrar:
+			rm -f $(DESTDIR)/bunrar
+
+install-lib:
+		install libunrar.so $(DESTDIR)/lib
+
+uninstall-lib:
+		rm -f $(DESTDIR)/lib/libunrar.so
diff -uNr unrar/match.cpp unrar/match.cpp
--- unrar/match.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/match.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -5,15 +5,15 @@
 
 static int mstricompc(const char *Str1,const char *Str2,bool ForceCase);
 static int mstricompcw(const wchar *Str1,const wchar *Str2,bool ForceCase);
-static int mstrnicompc(const char *Str1,const char *Str2,int N,bool ForceCase);
-static int mstrnicompcw(const wchar *Str1,const wchar *Str2,int N,bool ForceCase);
+static int mstrnicompc(const char *Str1,const char *Str2,size_t N,bool ForceCase);
+static int mstrnicompcw(const wchar *Str1,const wchar *Str2,size_t N,bool ForceCase);
 
 inline uint toupperc(byte ch,bool ForceCase)
 {
   if (ForceCase)
     return(ch);
 #ifdef _WIN_32
-  return((uint)CharUpper((LPTSTR)(ch)));
+  return((uint)(LPARAM)CharUpper((LPTSTR)(ch)));
 #elif defined(_UNIX)
   return(ch);
 #else
@@ -42,7 +42,7 @@
   
   if (CmpPath!=MATCH_NAMES)
   {
-    int WildLength=strlen(Wildcard);
+    size_t WildLength=strlen(Wildcard);
     if (CmpPath!=MATCH_EXACTPATH && mstrnicompc(Wildcard,Name,WildLength,ForceCase)==0)
     {
       char NextCh=Name[WildLength];
@@ -71,8 +71,12 @@
   }
   char *Name1=PointToName(Wildcard);
   char *Name2=PointToName(Name);
+
+  // always return false for RAR temporary files to exclude them
+  // from archiving operations
   if (mstrnicompc("__rar_",Name2,6,false)==0)
     return(false);
+
   return(match(Name1,Name2,ForceCase));
 }
 
@@ -86,7 +90,7 @@
 
   if (CmpPath!=MATCH_NAMES)
   {
-    int WildLength=strlenw(Wildcard);
+    size_t WildLength=strlenw(Wildcard);
     if (CmpPath!=MATCH_EXACTPATH && mstrnicompcw(Wildcard,Name,WildLength,ForceCase)==0)
     {
       wchar NextCh=Name[WildLength];
@@ -113,8 +117,12 @@
   }
   wchar *Name1=PointToName(Wildcard);
   wchar *Name2=PointToName(Name);
+
+  // always return false for RAR temporary files to exclude them
+  // from archiving operations
   if (mstrnicompcw(L"__rar_",Name2,6,false)==0)
     return(false);
+
   return(match(Name1,Name2,ForceCase));
 }
 #endif
@@ -236,7 +244,7 @@
 #endif
 
 
-int mstrnicompc(const char *Str1,const char *Str2,int N,bool ForceCase)
+int mstrnicompc(const char *Str1,const char *Str2,size_t N,bool ForceCase)
 {
   if (ForceCase)
     return(strncmp(Str1,Str2,N));
@@ -249,7 +257,7 @@
 
 
 #ifndef SFX_MODULE
-int mstrnicompcw(const wchar *Str1,const wchar *Str2,int N,bool ForceCase)
+int mstrnicompcw(const wchar *Str1,const wchar *Str2,size_t N,bool ForceCase)
 {
   if (ForceCase)
     return(strncmpw(Str1,Str2,N));
diff -uNr unrar/match.hpp unrar/match.hpp
--- unrar/match.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/match.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -1,7 +1,22 @@
 #ifndef _RAR_MATCH_
 #define _RAR_MATCH_
 
-enum {MATCH_NAMES,MATCH_PATH,MATCH_EXACTPATH,MATCH_SUBPATH,MATCH_WILDSUBPATH};
+enum {
+   MATCH_NAMES,        // Compare names only.
+
+   MATCH_PATH,         // Compares names and paths. Both must match exactly.
+                       // Unlike MATCH_EXACTPATH, also matches names if
+                       // mask contains path only and this path is a part
+                       // of name path.
+
+   MATCH_EXACTPATH,    // Compares names and paths. Both must match exactly.
+
+   MATCH_SUBPATH,      // Names must be the same, but path in mask is allowed
+                       // to be only a part of name path.
+
+   MATCH_WILDSUBPATH   // Works as MATCH_SUBPATH if mask contains wildcards
+                       // and as MATCH_PATH otherwise.
+};
 
 #define MATCH_MODEMASK           0x0000ffff
 #define MATCH_FORCECASESENSITIVE 0x80000000
diff -uNr unrar/options.cpp unrar/options.cpp
--- unrar/options.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/options.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -16,7 +16,7 @@
 {
   memset(this,0,sizeof(RAROptions));
   WinSize=0x400000;
-  Overwrite=OVERWRITE_ASK;
+  Overwrite=OVERWRITE_DEFAULT;
   Method=3;
   MsgStream=MSG_STDOUT;
   ConvertNames=NAMES_ORIGINALCASE;
diff -uNr unrar/options.hpp unrar/options.hpp
--- unrar/options.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/options.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -17,8 +17,13 @@
 };
 enum {NAMES_ORIGINALCASE,NAMES_UPPERCASE,NAMES_LOWERCASE};
 enum MESSAGE_TYPE {MSG_STDOUT,MSG_STDERR,MSG_ERRONLY,MSG_NULL};
+
 enum OVERWRITE_MODE {
-  OVERWRITE_ASK,OVERWRITE_ALL,OVERWRITE_NONE,OVERWRITE_AUTORENAME
+  OVERWRITE_DEFAULT, // ask for extraction, silently overwrite for archiving
+  OVERWRITE_ALL,
+  OVERWRITE_NONE,
+  OVERWRITE_AUTORENAME,
+  OVERWRITE_FORCE_ASK
 };
 
 enum RAR_CHARSET { RCH_DEFAULT=0,RCH_ANSI,RCH_OEM,RCH_UNICODE };
@@ -54,6 +59,7 @@
     RAR_CHARSET CommentCharset;
     RAR_CHARSET FilelistCharset;
     char ArcPath[NM];
+    wchar ArcPathW[NM];
     char Password[MAXPASSWORD];
     bool EncryptHeaders;
     char LogName[NM];
@@ -133,7 +139,7 @@
     wchar DllDestNameW[NM];
     int DllOpMode;
     int DllError;
-    LONG UserData;
+    LPARAM UserData;
     UNRARCALLBACK Callback;
     CHANGEVOLPROC ChangeVolProc;
     PROCESSDATAPROC ProcessDataProc;
diff -uNr unrar/os2ea.cpp unrar/os2ea.cpp
--- unrar/os2ea.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/os2ea.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -13,14 +13,14 @@
   if (Arc.HeaderCRC!=Arc.EAHead.HeadCRC)
   {
     Log(Arc.FileName,St(MEABroken),FileName);
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return;
   }
 
   if (Arc.EAHead.Method<0x31 || Arc.EAHead.Method>0x35 || Arc.EAHead.UnpVer>PACK_VER)
   {
     Log(Arc.FileName,St(MEAUnknHeader),FileName);
-    ErrHandler.SetErrorCode(RAR_WARNING);
+    ErrHandler.SetErrorCode(WARNING);
     return;
   }
 
@@ -46,7 +46,7 @@
   if (Arc.EAHead.EACRC!=~DataIO.UnpFileCRC)
   {
     Log(Arc.FileName,St(MEABroken),FileName);
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return;
   }
 
@@ -55,7 +55,7 @@
   if (DosSetPathInfo((unsigned char *)FileName,2,&EAOP2,sizeof(EAOP2),0x10)!=0)
   {
     Log(Arc.FileName,St(MCannotSetEA),FileName);
-    ErrHandler.SetErrorCode(RAR_WARNING);
+    ErrHandler.SetErrorCode(WARNING);
   }
   File::SetCloseFileTimeByName(FileName,&Arc.NewLhd.mtime,&Arc.NewLhd.atime);
   mprintf(St(MShowEA));
@@ -86,7 +86,7 @@
   if (DosSetPathInfo((unsigned char *)FileName,2,&EAOP2,sizeof(EAOP2),0x10)!=0)
   {
     Log(Arc.FileName,St(MCannotSetEA),FileName);
-    ErrHandler.SetErrorCode(RAR_WARNING);
+    ErrHandler.SetErrorCode(WARNING);
   }
   File::SetCloseFileTimeByName(FileName,&Arc.NewLhd.mtime,&Arc.NewLhd.atime);
   mprintf(St(MShowEA));
diff -uNr unrar/os.hpp unrar/os.hpp
--- unrar/os.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/os.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -33,6 +33,7 @@
 #include <prsht.h>
 
 #ifndef _WIN_CE
+  #include <shellapi.h>
   #include <shlobj.h>
   #include <winioctl.h>
 #endif
@@ -213,7 +214,7 @@
 
 #endif
 
-typedef const char* MSGID;
+  typedef const char* MSGID;
 
 #define safebuf static
 
diff -uNr unrar/pathfn.cpp unrar/pathfn.cpp
--- unrar/pathfn.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/pathfn.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -29,6 +29,8 @@
 }
 
 
+
+
 char* ConvertPath(const char *SrcPath,char *DestPath)
 {
   const char *DestPtr=SrcPath;
@@ -325,6 +327,26 @@
 #endif
 
 
+#if defined(_WIN_32) && !defined(_WIN_CE) && !defined(SFX_MODULE)
+void GetRarDataPath(char *Path)
+{
+  *Path=0;
+
+  HKEY hKey;
+  if (RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\WinRAR\\Paths",0,
+                   KEY_QUERY_VALUE,&hKey)==ERROR_SUCCESS)
+  {
+    DWORD DataSize=NM,Type;
+    RegQueryValueEx(hKey,"AppData",0,&Type,(BYTE *)Path,&DataSize);
+    RegCloseKey(hKey);
+  }
+
+  if (*Path==0 || !FileExist(Path))
+    GetAppDataPath(Path);
+}
+#endif
+
+
 #ifndef SFX_MODULE
 bool EnumConfigPaths(char *Path,int Number)
 {
@@ -348,18 +370,16 @@
   RemoveNameFromPath(Path);
   return(true);
 #elif defined(_UNIX)
+  static const char *AltPath[]={
+    "/etc","/etc/rar","/usr/lib","/usr/local/lib","/usr/local/etc"
+  };
   if (Number==0)
   {
     char *EnvStr=getenv("HOME");
-    if (EnvStr==NULL)
-      return(false);
-    strncpy(Path,EnvStr,NM-1);
+    strncpy(Path, (EnvStr==NULL) ? AltPath[0] : EnvStr, NM-1);
     Path[NM-1]=0;
     return(true);
   }
-  static const char *AltPath[]={
-    "/etc","/etc/rar","/usr/lib","/usr/local/lib","/usr/local/etc"
-  };
   Number--;
   if (Number<0 || Number>=sizeof(AltPath)/sizeof(AltPath[0]))
     return(false);
@@ -370,7 +390,7 @@
   if (Number<0 || Number>1)
     return(false);
   if (Number==0)
-    GetAppDataPath(Path);
+    GetRarDataPath(Path);
   else
   {
     GetModuleFileName(NULL,Path,NM);
@@ -388,6 +408,7 @@
 #ifndef SFX_MODULE
 void GetConfigName(const char *Name,char *FullName,bool CheckExist)
 {
+  *FullName=0;
   for (int I=0;EnumConfigPaths(FullName,I);I++)
   {
     AddEndSlash(FullName);
@@ -399,19 +420,29 @@
 #endif
 
 
-// returns a pointer to rightmost digit of volume number
+// Returns a pointer to rightmost digit of volume number.
 char* GetVolNumPart(char *ArcName)
 {
+  // Pointing to last name character.
   char *ChPtr=ArcName+strlen(ArcName)-1;
+
+  // Skipping the archive extension.
   while (!isdigit(*ChPtr) && ChPtr>ArcName)
     ChPtr--;
+
+  // Skipping the numeric part of name.
   char *NumPtr=ChPtr;
   while (isdigit(*NumPtr) && NumPtr>ArcName)
     NumPtr--;
+
+  // Searching for first numeric part in names like name.part##of##.rar.
+  // Stop search on the first dot.
   while (NumPtr>ArcName && *NumPtr!='.')
   {
     if (isdigit(*NumPtr))
     {
+      // Validate the first numeric part only if it has a dot somwhere 
+      // before it.
       char *Dot=strchrd(PointToName(ArcName),'.');
       if (Dot!=NULL && Dot<NumPtr)
         ChPtr=NumPtr;
@@ -423,7 +454,7 @@
 }
 
 
-void NextVolumeName(char *ArcName,bool OldNumbering)
+void NextVolumeName(char *ArcName,wchar *ArcNameW,uint MaxLength,bool OldNumbering)
 {
   char *ChPtr;
   if ((ChPtr=GetExt(ArcName))==NULL)
@@ -469,6 +500,29 @@
           ChPtr--;
         }
     }
+  if (ArcNameW!=NULL && *ArcNameW!=0)
+  {
+    // Copy incremented trailing low ASCII volume name part to Unicode name.
+    // It is simpler than implementing Unicode version of entire function.
+    char *NumPtr=GetVolNumPart(ArcName);
+
+    // moving to first digit in volume number
+    while (NumPtr>ArcName && isdigit(*NumPtr) && isdigit(*(NumPtr-1)))
+      NumPtr--;
+
+    // also copy the first character before volume number,
+    // because it can be changed when going from .r99 to .s00
+    if (NumPtr>ArcName)
+      NumPtr--;
+
+    int CharsToCopy=strlen(ArcName)-(NumPtr-ArcName);
+    int DestPos=strlenw(ArcNameW)-CharsToCopy;
+    if (DestPos>=0)
+    {
+      CharToWide(NumPtr,ArcNameW+DestPos,MaxLength-DestPos-1);
+      ArcNameW[MaxLength-1]=0;
+    }
+  }
 }
 
 
@@ -579,7 +633,22 @@
 {
   char PathOnly[NM];
   GetFilePath(Path,PathOnly,ASIZE(PathOnly));
-  if (IsWildcard(PathOnly))
+  if (IsWildcard(PathOnly,NULL))
+    return(true);
+#if defined(_WIN_32) || defined(_EMX)
+  return(Path[0]=='\\' && Path[1]=='\\' ||
+         IsDiskLetter(Path) && IsPathDiv(Path[2]));
+#else
+  return(IsPathDiv(Path[0]));
+#endif
+}
+
+
+bool IsFullPath(const wchar *Path)
+{
+  wchar PathOnly[NM];
+  GetFilePath(Path,PathOnly,ASIZE(PathOnly));
+  if (IsWildcard(NULL,PathOnly))
     return(true);
 #if defined(_WIN_32) || defined(_EMX)
   return(Path[0]=='\\' && Path[1]=='\\' ||
@@ -597,6 +666,13 @@
 }
 
 
+bool IsDiskLetter(const wchar *Path)
+{
+  int Letter=etoupper(Path[0]);
+  return(Letter>='A' && Letter<='Z' && IsDriveDiv(Path[1]));
+}
+
+
 void GetPathRoot(const char *Path,char *Root)
 {
   *Root=0;
@@ -608,7 +684,7 @@
       const char *Slash=strchr(Path+2,'\\');
       if (Slash!=NULL)
       {
-        int Length;
+        size_t Length;
         if ((Slash=strchr(Slash+1,'\\'))!=NULL)
           Length=Slash-Path+1;
         else
diff -uNr unrar/pathfn.hpp unrar/pathfn.hpp
--- unrar/pathfn.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/pathfn.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -24,17 +24,20 @@
 void RemoveNameFromPath(char *Path);
 void RemoveNameFromPath(wchar *Path);
 void GetAppDataPath(char *Path);
+void GetRarDataPath(char *Path);
 bool EnumConfigPaths(char *Path,int Number);
 void GetConfigName(const char *Name,char *FullName,bool CheckExist);
 char* GetVolNumPart(char *ArcName);
-void NextVolumeName(char *ArcName,bool OldNumbering);
+void NextVolumeName(char *ArcName,wchar *ArcNameW,uint MaxLength,bool OldNumbering);
 bool IsNameUsable(const char *Name);
 void MakeNameUsable(char *Name,bool Extended);
 char* UnixSlashToDos(char *SrcName,char *DestName=NULL,uint MaxLength=NM);
 char* DosSlashToUnix(char *SrcName,char *DestName=NULL,uint MaxLength=NM);
 wchar* UnixSlashToDos(wchar *SrcName,wchar *DestName=NULL,uint MaxLength=NM);
 bool IsFullPath(const char *Path);
+bool IsFullPath(const wchar *Path);
 bool IsDiskLetter(const char *Path);
+bool IsDiskLetter(const wchar *Path);
 void GetPathRoot(const char *Path,char *Root);
 int ParseVersionFileName(char *Name,wchar *NameW,bool Truncate);
 char* VolNameToFirstName(const char *VolName,char *FirstName,bool NewNumbering);
diff -uNr unrar/rar.cpp unrar/rar.cpp
--- unrar/rar.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/rar.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -118,12 +118,12 @@
 #ifdef ENABLE_BAD_ALLOC
   catch (bad_alloc)
   {
-    ErrHandler.SetErrorCode(RAR_MEMORY_ERROR);
+    ErrHandler.SetErrorCode(MEMORY_ERROR);
   }
 #endif
   catch (...)
   {
-    ErrHandler.SetErrorCode(RAR_FATAL_ERROR);
+    ErrHandler.SetErrorCode(FATAL_ERROR);
   }
 #endif
   File::RemoveCreated();
diff -uNr unrar/rarvm.cpp unrar/rarvm.cpp
--- unrar/rarvm.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/rarvm.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -180,6 +180,7 @@
   while (1)
   {
 #ifndef NORARVM
+    // Get addresses to quickly access operands.
     uint *Op1=GetOperand(&Cmd->Op1);
     uint *Op2=GetOperand(&Cmd->Op2);
 #endif
@@ -536,6 +537,7 @@
   InitBitInput();
   memcpy(InBuf,Code,Min(CodeSize,BitInput::MAX_SIZE));
 
+  // Calculate the single byte XOR checksum to check validity of VM code.
   byte XorSum=0;
   for (int I=1;I<CodeSize;I++)
     XorSum^=Code[I];
@@ -543,12 +545,13 @@
   faddbits(8);
 
   Prg->CmdCount=0;
-  if (XorSum==Code[0])
+  if (XorSum==Code[0]) // VM code is valid if equal.
   {
 #ifdef VM_STANDARDFILTERS
     VM_StandardFilters FilterType=IsStandardFilter(Code,CodeSize);
     if (FilterType!=VMSF_NONE)
     {
+      // VM code is found among standard filters.
       Prg->Cmd.Add(1);
       VM_PreparedCommand *CurCmd=&Prg->Cmd[Prg->CmdCount++];
       CurCmd->OpCode=VM_STANDARD;
@@ -562,9 +565,9 @@
     uint DataFlag=fgetbits();
     faddbits(1);
 
-/* Read static data contained in DB operators. This data cannot be changed,
-   it is a part of VM code, not a filter parameter.
-*/
+    // Read static data contained in DB operators. This data cannot be
+    // changed, it is a part of VM code, not a filter parameter.
+
     if (DataFlag&0x8000)
     {
       int DataSize=ReadData(*this)+1;
@@ -603,13 +606,14 @@
       CurCmd->Op1.Addr=CurCmd->Op2.Addr=NULL;
       if (OpNum>0)
       {
-        DecodeArg(CurCmd->Op1,CurCmd->ByteMode);
+        DecodeArg(CurCmd->Op1,CurCmd->ByteMode); // reading the first operand
         if (OpNum==2)
-          DecodeArg(CurCmd->Op2,CurCmd->ByteMode);
+          DecodeArg(CurCmd->Op2,CurCmd->ByteMode); // reading the second operand
         else
         {
           if (CurCmd->Op1.Type==VM_OPINT && (VM_CmdFlags[CurCmd->OpCode]&(VMCF_JUMP|VMCF_PROC)))
           {
+            // Calculating jump distance.
             int Distance=CurCmd->Op1.Data;
             if (Distance>=256)
               Distance-=256;
@@ -632,6 +636,8 @@
       Prg->CmdCount++;
     }
   }
+
+  // Adding RET command at the end of program.
   Prg->Cmd.Add(1);
   VM_PreparedCommand *CurCmd=&Prg->Cmd[Prg->CmdCount++];
   CurCmd->OpCode=VM_RET;
@@ -639,6 +645,11 @@
   CurCmd->Op2.Addr=&CurCmd->Op2.Data;
   CurCmd->Op1.Type=CurCmd->Op2.Type=VM_OPNONE;
 
+  // If operand 'Addr' field has not been set by DecodeArg calls above,
+  // let's set it to point to operand 'Data' field. It is necessary for
+  // VM_OPINT type operands (usual integers) or maybe if something was 
+  // not set properly for other operands. 'Addr' field is required
+  // for quicker addressing of operand data.
   for (int I=0;I<Prg->CmdCount;I++)
   {
     VM_PreparedCommand *Cmd=&Prg->Cmd[I];
@@ -660,31 +671,33 @@
   uint Data=fgetbits();
   if (Data & 0x8000)
   {
-    Op.Type=VM_OPREG;
-    Op.Data=(Data>>12)&7;
-    Op.Addr=&R[Op.Data];
-    faddbits(4);
+    Op.Type=VM_OPREG;     // Operand is register (R[0]..R[7])
+    Op.Data=(Data>>12)&7; // Register number
+    Op.Addr=&R[Op.Data];  // Register address
+    faddbits(4);          // 1 flag bit and 3 register number bits 
   }
   else
     if ((Data & 0xc000)==0)
     {
-      Op.Type=VM_OPINT;
+      Op.Type=VM_OPINT;   // Operand is integer
       if (ByteMode)
       {
-        Op.Data=(Data>>6) & 0xff;
+        Op.Data=(Data>>6) & 0xff;  // Byte integer.
         faddbits(10);
       }
       else
       {
         faddbits(2);
-        Op.Data=ReadData(*this);
+        Op.Data=ReadData(*this);   // 32 bit integer.
       }
     }
     else
     {
+      // Operand is data addressed by register data, base address or both.
       Op.Type=VM_OPREGMEM;
       if ((Data & 0x2000)==0)
       {
+        // Base address is zero, just use the address from register.
         Op.Data=(Data>>10)&7;
         Op.Addr=&R[Op.Data];
         Op.Base=0;
@@ -694,16 +707,18 @@
       {
         if ((Data & 0x1000)==0)
         {
+          // Use both register and base address.
           Op.Data=(Data>>9)&7;
           Op.Addr=&R[Op.Data];
           faddbits(7);
         }
         else
         {
+          // Use base address only. Access memory by fixed address.
           Op.Data=0;
           faddbits(4);
         }
-        Op.Base=ReadData(*this);
+        Op.Base=ReadData(*this); // Read base address.
       }
     }
 }
@@ -761,6 +776,9 @@
   for (int I=0;I<CodeSize;I++)
   {
     VM_PreparedCommand *Cmd=Code+I;
+
+    // Replace universal opcodes with faster byte or word only processing
+    // opcodes.
     switch(Cmd->OpCode)
     {
       case VM_MOV:
@@ -772,6 +790,11 @@
     }
     if ((VM_CmdFlags[Cmd->OpCode] & VMCF_CHFLAGS)==0)
       continue;
+
+    // If we do not have jump commands between the current operation
+    // and next command which will modify processor flags, we can replace
+    // the current command with faster version which does not need to
+    // modify flags.
     bool FlagsRequired=false;
     for (int J=I+1;J<CodeSize;J++)
     {
@@ -784,6 +807,10 @@
       if (Flags & VMCF_CHFLAGS)
         break;
     }
+
+    // Below we'll replace universal opcodes with faster byte or word only 
+    // processing opcodes, which also do not modify processor flags to
+    // provide better performance.
     if (FlagsRequired)
       continue;
     switch(Cmd->OpCode)
@@ -817,7 +844,7 @@
     int Length;
     uint CRC;
     VM_StandardFilters Type;
-  } StdList[]={
+  } static StdList[]={
     53, 0xad576887, VMSF_E8,
     57, 0x3cd7e57e, VMSF_E8E9,
    120, 0x3769893f, VMSF_ITANIUM,
@@ -931,9 +958,8 @@
         if (DataSize>=VM_GLOBALMEMADDR/2)
           break;
 
-// bytes from same channels are grouped to continual data blocks,
-// so we need to place them back to their interleaving positions
-
+        // Bytes from same channels are grouped to continual data blocks,
+        // so we need to place them back to their interleaving positions.
         for (int CurChannel=0;CurChannel<Channels;CurChannel++)
         {
           byte PrevByte=0;
diff -uNr unrar/rdwrfn.cpp unrar/rdwrfn.cpp
--- unrar/rdwrfn.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/rdwrfn.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -59,13 +59,13 @@
       RetCode=SrcFile->Read(ReadAddr,ReadSize);
       FileHeader *hd=SubHead!=NULL ? SubHead:&SrcArc->NewLhd;
       if (hd->Flags & LHD_SPLIT_AFTER)
-        PackedCRC=CRC(PackedCRC,ReadAddr,ReadSize);
+        PackedCRC=CRC(PackedCRC,ReadAddr,RetCode);
     }
     CurUnpRead+=RetCode;
     TotalRead+=RetCode;
 #ifndef NOVOLUME
-    // these variable are not used below in NOVOLUME mode, so it is better
-    // to exclude these commands to avoid compiler warnings
+    // These variable are not used in NOVOLUME mode, so it is better
+    // to exclude commands below to avoid compiler warnings.
     ReadAddr+=RetCode;
     Count-=RetCode;
 #endif
@@ -118,8 +118,8 @@
   if (Cmd->DllOpMode!=RAR_SKIP)
   {
     if (Cmd->Callback!=NULL &&
-        Cmd->Callback(UCM_PROCESSDATA,Cmd->UserData,(LONG)Addr,Count)==-1)
-      ErrHandler.Exit(RAR_USER_BREAK);
+        Cmd->Callback(UCM_PROCESSDATA,Cmd->UserData,(LPARAM)Addr,Count)==-1)
+      ErrHandler.Exit(USER_BREAK);
     if (Cmd->ProcessDataProc!=NULL)
     {
 #if defined(_WIN_32) && !defined(_MSC_VER) && !defined(__MINGW32__)
@@ -130,7 +130,7 @@
       _ESP=_EBX;
 #endif
       if (RetCode==0)
-        ErrHandler.Exit(RAR_USER_BREAK);
+        ErrHandler.Exit(USER_BREAK);
     }
   }
 #endif
@@ -169,19 +169,21 @@
 {
   if (ShowProgress && SrcFile!=NULL)
   {
-    Archive *SrcArc=(Archive *)SrcFile;
-    RAROptions *Cmd=SrcArc->GetRAROptions();
     if (TotalArcSize!=0)
+    {
+      // important when processing several archives or multivolume archive
       ArcSize=TotalArcSize;
-    ArcPos+=ProcessedArcSize;
-    if (!SrcArc->Volume)
+      ArcPos+=ProcessedArcSize;
+    }
+
+    Archive *SrcArc=(Archive *)SrcFile;
+    RAROptions *Cmd=SrcArc->GetRAROptions();
+
+    int CurPercent=ToPercent(ArcPos,ArcSize);
+    if (!Cmd->DisablePercentage && CurPercent!=LastPercent)
     {
-      int CurPercent=ToPercent(ArcPos,ArcSize);
-      if (!Cmd->DisablePercentage && CurPercent!=LastPercent)
-      {
-        mprintf("\b\b\b\b%3d%%",CurPercent);
-        LastPercent=CurPercent;
-      }
+      mprintf("\b\b\b\b%3d%%",CurPercent);
+      LastPercent=CurPercent;
     }
   }
 }
diff -uNr unrar/rdwrfn.hpp unrar/rdwrfn.hpp
--- unrar/rdwrfn.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/rdwrfn.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -72,7 +72,12 @@
     Int64 TotalPackRead;
     Int64 UnpArcSize;
     Int64 CurPackRead,CurPackWrite,CurUnpRead,CurUnpWrite;
-    Int64 ProcessedArcSize,TotalArcSize;
+
+    // Size of already processed archives.
+    // Used to calculate the total operation progress.
+    Int64 ProcessedArcSize;
+
+    Int64 TotalArcSize;
 
     uint PackFileCRC,UnpFileCRC,PackedCRC;
 
diff -uNr unrar/readme.txt unrar/readme.txt
--- unrar/readme.txt	1970-01-01 01:00:00.000000000 +0100
+++ unrar/readme.txt	2007-09-10 13:40:10.000000000 +0200
@@ -0,0 +1,63 @@
+
+                       Portable UnRAR version
+
+
+   1. General
+
+   This package includes freeware Unrar C++ source and a few makefiles
+   (makefile.bcc, makefile.msc+msc.dep, makefile.unix). Unrar source
+   is subset of RAR and generated from RAR source automatically,
+   by a small program removing blocks like '#ifndef UNRAR ... #endif'.
+   Such method is not perfect and you may find some RAR related
+   stuff unnecessary in Unrar, especially in header files.
+
+   If you wish to port Unrar to a new platform, you may need to edit
+   '#define LITTLE_ENDIAN' in os.hpp and data type definitions
+   in rartypes.hpp.
+
+   if computer architecture does not allow not aligned data access,
+   you need to undefine ALLOW_NOT_ALIGNED_INT and define
+   STRICT_ALIGNMENT_REQUIRED in os.h. Note that it will increase memory
+   requirements.
+
+   If you use Borland C++ makefile (makefile.bcc), you need to define
+   BASEPATHCC environment (or makefile) variable containing
+   the path to Borland C++ installation.
+
+   Makefile.unix contains numerous compiler option sets.
+   GCC Linux is selected by default. If you need to compile Unrar
+   for other platforms, uncomment corresponding lines.
+
+
+   2. Unrar binaries
+
+   If you compiled Unrar for OS, which is not present in "Downloads"
+   and "RAR extras" on www.rarlab.com, we will appreciate if you send
+   us the compiled executable to place it to our site.
+
+
+   3. Acknowledgements
+
+   This source includes parts of code written by the following authors:
+
+   Dmitry Shkarin     PPMII v.H text compression
+   Dmitry Subbotin    Carryless rangecoder
+   Szymon Stefanek    AES encryption
+   Brian Gladman      AES encryption
+   Steve Reid         SHA-1 hash function
+   Marcus Herbert     makefile.unix file
+   Tomasz Klim        fixes for libunrar.so
+   Robert Riebisch    makefile.dj and patches for DJGPP
+
+
+   4. Legal stuff
+
+   Unrar source may be used in any software to handle RAR archives
+   without limitations free of charge, but cannot be used to re-create
+   the RAR compression algorithm, which is proprietary. Distribution
+   of modified Unrar source in separate form or as a part of other
+   software is permitted, provided that it is clearly stated in
+   the documentation and source comments that the code may not be used
+   to develop a RAR (WinRAR) compatible archiver.
+
+   More detailed license text is available in license.txt.
diff -uNr unrar/README.txt unrar/README.txt
--- unrar/README.txt	2008-02-26 14:28:59.000000000 +0100
+++ unrar/README.txt	1970-01-01 01:00:00.000000000 +0100
@@ -1,64 +0,0 @@
-
-                       Portable UnRAR version
-
-
-   1. General
-
-   This package includes freeware Unrar C++ source and a few makefiles
-   (makefile.bcc, makefile.msc+msc.dep, makefile.unix). Unrar source
-   is subset of RAR and generated from RAR source automatically,
-   by a small program removing blocks like '#ifndef UNRAR ... #endif'.
-   Such method is not perfect and you may find some RAR related
-   stuff unnecessary in Unrar, especially in header files.
-
-   If you wish to port Unrar to a new platform, you may need to edit
-   '#define LITTLE_ENDIAN' in os.hpp and data type definitions
-   in rartypes.hpp.
-
-   It is important to provide 1 byte alignment for structures
-   in model.hpp. Now it contains '#pragma pack(1)' directive,
-   but your compiler may require something else. Though Unrar
-   should work with other model.hpp alignments, its memory 
-   requirements may increase significantly. Alignment in other
-   modules is not important.
-
-   If you use Borland C++ makefile (makefile.bcc), you need to define
-   BASEPATHCC environment (or makefile) variable containing
-   the path to Borland C++ installation.
-
-   Makefile.unix contains both Linux and IRIX compiler option sets.
-   Linux is selected by default. If you need to compile Unrar for IRIX,
-   just uncomment corresponding lines.
-
-
-   2. Unrar binaries
-
-   If you compiled Unrar for OS, which is not present in "Downloads"
-   and "RAR extras" on www.rarlab.com, we will appreciate if you send
-   us the compiled executable to place it to our site.
-
-
-   3. Acknowledgements
-
-   This source includes parts of code written by the following authors:
-
-   Dmitry Shkarin     PPMII text compression
-   Dmitry Subbotin    Carryless rangecoder
-   Szymon Stefanek    AES encryption
-   Brian Gladman      AES encryption
-   Steve Reid         SHA-1 hash function
-   Marcus Herbert     makefile.unix file
-   Tomasz Klim        fixes for libunrar.so
-
-
-   4. Legal stuff
-
-   Unrar source may be used in any software to handle RAR archives
-   without limitations free of charge, but cannot be used to re-create
-   the RAR compression algorithm, which is proprietary. Distribution
-   of modified Unrar source in separate form or as a part of other
-   software is permitted, provided that it is clearly stated in
-   the documentation and source comments that the code may not be used
-   to develop a RAR (WinRAR) compatible archiver.
-
-   More detailed license text is available in license.txt.
diff -uNr unrar/recvol.cpp unrar/recvol.cpp
--- unrar/recvol.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/recvol.cpp	2008-10-24 06:44:48.000000000 +0200
@@ -79,6 +79,11 @@
 #ifndef SILENT
   Int64 RecFileSize=0;
 #endif
+
+#ifndef SILENT
+  mprintf(St(MCalcCRCAllVol));
+#endif
+
   FindFile Find;
   Find.SetMask(RecVolMask);
   struct FindData RecData;
@@ -236,7 +241,7 @@
 #endif
     }
     SrcFile[CurArcNum]=(File*)NewFile;
-    NextVolumeName(ArcName,!NewNumbering);
+    NextVolumeName(ArcName,ArcNameW,ASIZE(ArcName),!NewNumbering);
   }
 
 #ifndef SILENT
diff -uNr unrar/scantree.cpp unrar/scantree.cpp
--- unrar/scantree.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/scantree.cpp	2008-10-24 06:44:47.000000000 +0200
@@ -7,6 +7,8 @@
   ScanTree::GetLinks=GetLinks;
   ScanTree::GetDirs=GetDirs;
 
+  ScanEntireDisk=false;
+
   SetAllMaskDepth=0;
   *CurMask=0;
   *CurMaskW=0;
@@ -57,6 +59,7 @@
 
 bool ScanTree::PrepareMasks()
 {
+  ScanEntireDisk=false;
   if (!FileMasks->GetString(CurMask,CurMaskW,sizeof(CurMask)))
     return(false);
   CurMask[ASIZE(CurMask)-1]=0;
@@ -64,6 +67,12 @@
 #ifdef _WIN_32
   UnixSlashToDos(CurMask);
 #endif
+
+  // We wish to scan entire disk if mask like c:\ is specified
+  // regardless of recursion mode. Use c:\*.* mask when need to scan only 
+  // the root directory.
+  ScanEntireDisk=IsDiskLetter(CurMask) && IsPathDiv(CurMask[2]) && CurMask[3]==0;
+
   char *Name=PointToName(CurMask);
   if (*Name==0)
     strcat(CurMask,MASKALL);
@@ -116,7 +125,7 @@
     bool FindCode=!Wildcards && FindFile::FastFind(CurMask,CurMaskW,FindData,GetLinks);
     bool IsDir=FindCode && FindData->IsDir;
     bool SearchAll=!IsDir && (Depth>0 || Recurse==RECURSE_ALWAYS ||
-                   Wildcards && Recurse==RECURSE_WILDCARDS);
+                   Wildcards && Recurse==RECURSE_WILDCARDS || ScanEntireDisk);
     if (Depth==0)
       SearchAllInRoot=SearchAll;
     if (SearchAll || Wildcards)
@@ -234,7 +243,10 @@
     }
     if (GetDirs==SCAN_GETDIRSTWICE &&
         FindFile::FastFind(DirName,DirNameW,FindData,GetLinks) && FindData->IsDir)
+    {
+      FindData->Flags|=FDDF_SECONDDIR;
       return(Error ? SCAN_ERROR:SCAN_SUCCESS);
+    }
     return(Error ? SCAN_ERROR:SCAN_NEXT);
   }
 
diff -uNr unrar/scantree.hpp unrar/scantree.hpp
--- unrar/scantree.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/scantree.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -26,6 +26,9 @@
     int GetDirs;
     int Errors;
 
+    // set when processing paths like c:\ (root directory without wildcards)
+    bool ScanEntireDisk;
+
     char CurMask[NM];
     wchar CurMaskW[NM];
     char OrigCurMask[NM];
diff -uNr unrar/strfn.cpp unrar/strfn.cpp
--- unrar/strfn.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/strfn.cpp	2008-10-24 06:44:48.000000000 +0200
@@ -86,7 +86,7 @@
 
 char* RemoveEOL(char *Str)
 {
-  for (int I=strlen(Str)-1;I>=0 && (Str[I]=='\r' || Str[I]=='\n' || Str[I]==' ' || Str[I]=='\t');I--)
+  for (int I=(int)strlen(Str)-1;I>=0 && (Str[I]=='\r' || Str[I]=='\n' || Str[I]==' ' || Str[I]=='\t');I--)
     Str[I]=0;
   return(Str);
 }
@@ -94,7 +94,7 @@
 
 char* RemoveLF(char *Str)
 {
-  for (int I=strlen(Str)-1;I>=0 && (Str[I]=='\r' || Str[I]=='\n');I--)
+  for (int I=(int)strlen(Str)-1;I>=0 && (Str[I]=='\r' || Str[I]=='\n');I--)
     Str[I]=0;
   return(Str);
 }
@@ -103,7 +103,8 @@
 unsigned int loctolower(byte ch)
 {
 #ifdef _WIN_32
-  return((int)CharLower((LPTSTR)ch));
+  // convert to LPARAM first to avoid a warning in 64 bit mode
+  return((int)(LPARAM)CharLower((LPTSTR)ch));
 #else
   return(tolower(ch));
 #endif
@@ -113,7 +114,8 @@
 unsigned int loctoupper(byte ch)
 {
 #ifdef _WIN_32
-  return((int)CharUpper((LPTSTR)ch));
+  // convert to LPARAM first to avoid a warning in 64 bit mode
+  return((int)(LPARAM)CharUpper((LPTSTR)ch));
 #else
   return(toupper(ch));
 #endif
diff -uNr unrar/strlist.cpp unrar/strlist.cpp
--- unrar/strlist.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/strlist.cpp	2008-10-24 06:44:48.000000000 +0200
@@ -31,7 +31,7 @@
 unsigned int StringList::AddString(const char *Str,const wchar *StrW)
 {
   int PrevSize=StringData.Size();
-  StringData.Add(strlen(Str)+1);
+  StringData.Add((int)(strlen(Str)+1));
   strcpy(&StringData[PrevSize],Str);
   if (StrW!=NULL && *StrW!=0)
   {
diff -uNr unrar/timefn.cpp unrar/timefn.cpp
--- unrar/timefn.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/timefn.cpp	2008-10-24 06:44:48.000000000 +0200
@@ -248,7 +248,6 @@
 #endif
 
 
-#ifndef SFX_MODULE
 void RarTime::SetCurrentTime()
 {
 #ifdef _WIN_32
@@ -263,7 +262,6 @@
   *this=st;
 #endif
 }
-#endif
 
 
 #if !defined(SFX_MODULE) && !defined(_WIN_CE)
diff -uNr unrar/ulinks.cpp unrar/ulinks.cpp
--- unrar/ulinks.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/ulinks.cpp	2008-10-24 06:44:48.000000000 +0200
@@ -20,7 +20,7 @@
         else
         {
           Log(Arc.FileName,St(MErrCreateLnk),DestName);
-          ErrHandler.SetErrorCode(RAR_WARNING);
+          ErrHandler.SetErrorCode(WARNING);
         }
     }
     int NameSize=Min(DataSize,strlen(FileName));
diff -uNr unrar/unicode.cpp unrar/unicode.cpp
--- unrar/unicode.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/unicode.cpp	2008-10-24 06:44:48.000000000 +0200
@@ -16,7 +16,10 @@
 #else
 #ifdef MBFUNCTIONS
 
-  if (wcstombs(Dest,Src,DestSize)==(size_t)-1)
+  size_t ResultingSize=wcstombs(Dest,Src,DestSize);
+  if (ResultingSize==(size_t)-1)
+    RetCode=false;
+  if (ResultingSize==0 && *Src!=0)
     RetCode=false;
 
   if ((!RetCode || *Dest==0 && *Src!=0) && DestSize>NM && strlenw(Src)<NM)
@@ -66,7 +69,10 @@
 #else
 #ifdef MBFUNCTIONS
 
-  if (mbstowcs(Dest,Src,DestSize)==(size_t)-1)
+  size_t ResultingSize=mbstowcs(Dest,Src,DestSize);
+  if (ResultingSize==(size_t)-1)
+    RetCode=false;
+  if (ResultingSize==0 && *Src!=0)
     RetCode=false;
 
   if ((!RetCode || *Dest==0 && *Src!=0) && DestSize>NM && strlen(Src)<NM)
@@ -241,11 +247,11 @@
 }
 
 
-wchar* strncpyw(wchar *dest,const wchar *src,int n)
+wchar* strncpyw(wchar *dest,const wchar *src,size_t n)
 {
   do {
     *(dest++)=*src;
-  } while (*(src++)!=0 && --n > 0);
+  } while (*(src++)!=0 && (int)(--n) > 0);
   return(dest);
 }
 
@@ -257,11 +263,11 @@
 
 
 #ifndef SFX_MODULE
-wchar* strncatw(wchar *dest,const wchar *src,int n)
+wchar* strncatw(wchar *dest,const wchar *src,size_t n)
 {
   dest+=strlenw(dest);
   while (true)
-    if (--n<0)
+    if ((int)(--n)<0)
     {
       *dest=0;
       break;
@@ -287,9 +293,9 @@
 }
 
 
-int strncmpw(const wchar *s1,const wchar *s2,int n)
+int strncmpw(const wchar *s1,const wchar *s2,size_t n)
 {
-  while (n-->0)
+  while ((int)(n--)>0)
   {
     if (*s1<*s2)
       return(-1);
@@ -316,7 +322,7 @@
 
 
 #if !defined(SFX_MODULE) && !defined(_WIN_CE)
-inline int strnicmpw_w2c(const wchar *s1,const wchar *s2,int n)
+inline int strnicmpw_w2c(const wchar *s1,const wchar *s2,size_t n)
 {
   wchar Wide1[NM*2],Wide2[NM*2];
   strncpyw(Wide1,s1,sizeof(Wide1)/sizeof(Wide1[0])-1);
@@ -332,7 +338,7 @@
 
 
 #ifndef SFX_MODULE
-int strnicmpw(const wchar *s1,const wchar *s2,int n)
+int strnicmpw(const wchar *s1,const wchar *s2,size_t n)
 {
   return(strnicmpw_w2c(s1,s2,n));
 }
@@ -395,6 +401,20 @@
 
 
 #ifndef SFX_MODULE
+wchar* strdupw(const wchar *Str)
+{
+  if (Str==NULL)
+    return(NULL);
+  wchar *n=(wchar *)malloc((strlenw(Str)+1)*sizeof(wchar));
+  if (n==NULL)
+    return(NULL);
+  strcpyw(n,Str);
+  return(n);
+}
+#endif
+
+
+#ifndef SFX_MODULE
 int toupperw(int ch)
 {
   return((ch<128) ? loctoupper(ch):ch);
diff -uNr unrar/unicode.hpp unrar/unicode.hpp
--- unrar/unicode.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/unicode.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -28,18 +28,19 @@
 
 int strlenw(const wchar *str);
 wchar* strcpyw(wchar *dest,const wchar *src);
-wchar* strncpyw(wchar *dest,const wchar *src,int n);
+wchar* strncpyw(wchar *dest,const wchar *src,size_t n);
 wchar* strcatw(wchar *dest,const wchar *src);
-wchar* strncatw(wchar *dest,const wchar *src,int n);
+wchar* strncatw(wchar *dest,const wchar *src,size_t n);
 int strcmpw(const wchar *s1,const wchar *s2);
-int strncmpw(const wchar *s1,const wchar *s2,int n);
+int strncmpw(const wchar *s1,const wchar *s2,size_t n);
 int stricmpw(const wchar *s1,const wchar *s2);
-int strnicmpw(const wchar *s1,const wchar *s2,int n);
+int strnicmpw(const wchar *s1,const wchar *s2,size_t n);
 wchar *strchrw(const wchar *s,int c);
 wchar* strrchrw(const wchar *s,int c);
 wchar* strpbrkw(const wchar *s1,const wchar *s2);
 wchar* strlowerw(wchar *Str);
 wchar* strupperw(wchar *Str);
+wchar* strdupw(const wchar *Str);
 int toupperw(int ch);
 int atoiw(const wchar *s);
 
diff -uNr unrar/unpack.cpp unrar/unpack.cpp
--- unrar/unpack.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/unpack.cpp	2008-10-24 06:44:48.000000000 +0200
@@ -262,6 +262,11 @@
           }
           if (Failed)
             break;
+
+#ifdef _MSC_VER
+  // avoid a warning about uninitialized 'Length' variable
+  #pragma warning( disable : 4701 )
+#endif
           CopyString(Length+32,Distance+2);
           continue;
         }
diff -uNr unrar/uowners.cpp unrar/uowners.cpp
--- unrar/uowners.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/uowners.cpp	2008-10-24 06:44:48.000000000 +0200
@@ -5,7 +5,7 @@
   if (Arc.HeaderCRC!=Arc.UOHead.HeadCRC)
   {
     Log(Arc.FileName,St(MOwnersBroken),FileName);
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return;
   }
 
@@ -13,7 +13,7 @@
   if ((pw=getpwnam(Arc.UOHead.OwnerName))==NULL)
   {
     Log(Arc.FileName,St(MErrGetOwnerID),Arc.UOHead.OwnerName);
-    ErrHandler.SetErrorCode(RAR_WARNING);
+    ErrHandler.SetErrorCode(WARNING);
     return;
   }
   uid_t OwnerID=pw->pw_uid;
@@ -22,7 +22,7 @@
   if ((gr=getgrnam(Arc.UOHead.GroupName))==NULL)
   {
     Log(Arc.FileName,St(MErrGetGroupID),Arc.UOHead.GroupName);
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return;
   }
   uint Attr=GetFileAttr(FileName,NULL);
@@ -34,7 +34,7 @@
 #endif
   {
     Log(Arc.FileName,St(MSetOwnersError),FileName);
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CREATE_ERROR);
   }
   SetFileAttr(FileName,NULL,Attr);
 }
@@ -53,7 +53,7 @@
   if ((pw=getpwnam(OwnerName))==NULL)
   {
     Log(Arc.FileName,St(MErrGetOwnerID),OwnerName);
-    ErrHandler.SetErrorCode(RAR_WARNING);
+    ErrHandler.SetErrorCode(WARNING);
     return;
   }
   uid_t OwnerID=pw->pw_uid;
@@ -62,7 +62,7 @@
   if ((gr=getgrnam(GroupName))==NULL)
   {
     Log(Arc.FileName,St(MErrGetGroupID),GroupName);
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return;
   }
   uint Attr=GetFileAttr(FileName,NULL);
@@ -74,7 +74,7 @@
 #endif
   {
     Log(Arc.FileName,St(MSetOwnersError),FileName);
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CREATE_ERROR);
   }
   SetFileAttr(FileName,NULL,Attr);
 }
diff -uNr unrar/version.hpp unrar/version.hpp
--- unrar/version.hpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/version.hpp	2008-10-24 06:44:48.000000000 +0200
@@ -1,6 +1,6 @@
 #define RARVER_MAJOR     3
-#define RARVER_MINOR    71
-#define RARVER_BETA      1
-#define RARVER_DAY      10
+#define RARVER_MINOR    80
+#define RARVER_BETA      0
+#define RARVER_DAY      16
 #define RARVER_MONTH     9
-#define RARVER_YEAR   2007
+#define RARVER_YEAR   2008
diff -uNr unrar/volume.cpp unrar/volume.cpp
--- unrar/volume.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/volume.cpp	2008-10-24 06:44:48.000000000 +0200
@@ -19,39 +19,17 @@
   }
 
   Int64 PosBeforeClose=Arc.Tell();
+
+  if (DataIO!=NULL)
+    DataIO->ProcessedArcSize+=Arc.FileLength();
+
   Arc.Close();
 
   char NextName[NM];
   wchar NextNameW[NM];
-  *NextNameW=0;
   strcpy(NextName,Arc.FileName);
-  NextVolumeName(NextName,(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat);
-
-  if (*Arc.FileNameW!=0)
-  {
-    // Copy incremented trailing low ASCII volume name part to Unicode name.
-    // It is simpler than also implementing Unicode version of NextVolumeName.
-
-    strcpyw(NextNameW,Arc.FileNameW);
-    char *NumPtr=GetVolNumPart(NextName);
-
-    // moving to first digit in volume number
-    while (NumPtr>NextName && isdigit(*NumPtr) && isdigit(*(NumPtr-1)))
-      NumPtr--;
-
-    // also copy the first character before volume number,
-    // because it can be changed when going from .r99 to .s00
-    if (NumPtr>NextName)
-      NumPtr--;
-
-    int CharsToCopy=strlen(NextName)-(NumPtr-NextName);
-    int DestPos=strlenw(NextNameW)-CharsToCopy;
-    if (DestPos>0)
-    {
-      CharToWide(NumPtr,NextNameW+DestPos,ASIZE(NextNameW)-DestPos-1);
-      NextNameW[ASIZE(NextNameW)-1]=0;
-    }
-  }
+  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;
@@ -60,22 +38,33 @@
 
   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);
-      NextVolumeName(AltNextName,true);
+      strcpyw(AltNextNameW,Arc.FileNameW);
+      NextVolumeName(AltNextName,AltNextNameW,ASIZE(AltNextName),true);
       OldSchemeTested=true;
-      if (Arc.Open(AltNextName))
+      if (Arc.Open(AltNextName,AltNextNameW))
       {
         strcpy(NextName,AltNextName);
-        *NextNameW=0;
+        strcpyw(NextNameW,AltNextNameW);
         break;
       }
     }
 #ifdef RARDLL
     if (Cmd->Callback==NULL && Cmd->ChangeVolProc==NULL ||
-        Cmd->Callback!=NULL && Cmd->Callback(UCM_CHANGEVOLUME,Cmd->UserData,(LONG)NextName,RAR_VOL_ASK)==-1)
+        Cmd->Callback!=NULL && Cmd->Callback(UCM_CHANGEVOLUME,Cmd->UserData,(LPARAM)NextName,RAR_VOL_ASK)==-1)
     {
       Cmd->DllError=ERAR_EOPEN;
       FailedOpen=true;
@@ -123,6 +112,7 @@
       FailedOpen=true;
       break;
     }
+
 #endif // RARDLL
     *NextNameW=0;
   }
@@ -138,7 +128,7 @@
   Arc.CheckArc(true);
 #ifdef RARDLL
   if (Cmd->Callback!=NULL &&
-      Cmd->Callback(UCM_CHANGEVOLUME,Cmd->UserData,(LONG)NextName,RAR_VOL_NOTIFY)==-1)
+      Cmd->Callback(UCM_CHANGEVOLUME,Cmd->UserData,(LPARAM)NextName,RAR_VOL_NOTIFY)==-1)
     return(false);
   if (Cmd->ChangeVolProc!=NULL)
   {
@@ -197,8 +187,13 @@
     }
 #ifdef SFX_MODULE
     DataIO->UnpArcSize=Arc.FileLength();
-    DataIO->CurUnpRead=0;
 #endif
+    
+    // Reset the size of packed data read from current volume. It is used
+    // to display the total progress and preceding volumes are already
+    // compensated with ProcessedArcSize, so we need to reset this variable.
+    DataIO->CurUnpRead=0;
+
     DataIO->PackedCRC=0xffffffff;
 //    DataIO->SetFiles(&Arc,NULL);
   }
diff -uNr unrar/win32acl.cpp unrar/win32acl.cpp
--- unrar/win32acl.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/win32acl.cpp	2008-10-24 06:44:48.000000000 +0200
@@ -15,14 +15,14 @@
   if (Arc.HeaderCRC!=Arc.EAHead.HeadCRC)
   {
     Log(Arc.FileName,St(MACLBroken),FileName);
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return;
   }
 
   if (Arc.EAHead.Method<0x31 || Arc.EAHead.Method>0x35 || Arc.EAHead.UnpVer>PACK_VER)
   {
     Log(Arc.FileName,St(MACLUnknown),FileName);
-    ErrHandler.SetErrorCode(RAR_WARNING);
+    ErrHandler.SetErrorCode(WARNING);
     return;
   }
 
@@ -41,7 +41,7 @@
   if (Arc.EAHead.EACRC!=~DataIO.UnpFileCRC)
   {
     Log(Arc.FileName,St(MACLBroken),FileName);
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return;
   }
 
@@ -61,7 +61,7 @@
   {
     Log(Arc.FileName,St(MACLSetError),FileName);
     ErrHandler.SysErrMsg();
-    ErrHandler.SetErrorCode(RAR_WARNING);
+    ErrHandler.SetErrorCode(WARNING);
   }
 }
 #endif
@@ -94,7 +94,7 @@
   {
     Log(Arc.FileName,St(MACLSetError),FileName);
     ErrHandler.SysErrMsg();
-    ErrHandler.SetErrorCode(RAR_WARNING);
+    ErrHandler.SetErrorCode(WARNING);
   }
 }
 
diff -uNr unrar/win32stm.cpp unrar/win32stm.cpp
--- unrar/win32stm.cpp	2008-02-26 14:28:59.000000000 +0100
+++ unrar/win32stm.cpp	2008-10-24 06:44:48.000000000 +0200
@@ -12,7 +12,7 @@
 #ifndef SILENT
     Log(Arc.FileName,St(MStreamBroken),FileName);
 #endif
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return;
   }
 
@@ -21,7 +21,7 @@
 #ifndef SILENT
     Log(Arc.FileName,St(MStreamUnknown),FileName);
 #endif
-    ErrHandler.SetErrorCode(RAR_WARNING);
+    ErrHandler.SetErrorCode(WARNING);
     return;
   }
 
@@ -39,7 +39,7 @@
 #ifndef SILENT
     Log(Arc.FileName,St(MStreamBroken),FileName);
 #endif
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return;
   }
 
@@ -72,7 +72,7 @@
 #ifndef SILENT
       Log(Arc.FileName,St(MStreamBroken),StreamName);
 #endif
-      ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+      ErrHandler.SetErrorCode(CRC_ERROR);
     }
     else
       CurFile.Close();
@@ -115,7 +115,7 @@
 #if !defined(SILENT) && !defined(SFX_MODULE)
     Log(Arc.FileName,St(MStreamBroken),FileName);
 #endif
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return;
   }
 
@@ -127,7 +127,7 @@
 #if !defined(SILENT) && !defined(SFX_MODULE)
     Log(Arc.FileName,St(MStreamBroken),FileName);
 #endif
-    ErrHandler.SetErrorCode(RAR_CRC_ERROR);
+    ErrHandler.SetErrorCode(CRC_ERROR);
     return;
   }
 
