diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2011-04-11 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:05 +0300 |
commit | 35596517f203f1c4970413b3b5b2e216b849e462 (patch) | |
tree | 93240df3eb4ddbd8eebbe6a5fc65e93f2ccb6495 /CPP/7zip/Bundles | |
parent | de4f8c22fe4b9e59b60495b84db2e81de50999a9 (diff) |
9.219.21
Diffstat (limited to 'CPP/7zip/Bundles')
22 files changed, 176 insertions, 89 deletions
diff --git a/CPP/7zip/Bundles/Alone/Alone.dsp b/CPP/7zip/Bundles/Alone/Alone.dsp index e6328f7e..5e0e3e51 100755 --- a/CPP/7zip/Bundles/Alone/Alone.dsp +++ b/CPP/7zip/Bundles/Alone/Alone.dsp @@ -1771,14 +1771,6 @@ SOURCE=..\..\UI\Common\UpdateProduce.cpp SOURCE=..\..\UI\Common\UpdateProduce.h # End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\WorkDir.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\UI\Common\WorkDir.h -# End Source File # End Group # Begin Group "Crypto" diff --git a/CPP/7zip/Bundles/Alone/makefile b/CPP/7zip/Bundles/Alone/makefile index 862d695a..a99c61ec 100755 --- a/CPP/7zip/Bundles/Alone/makefile +++ b/CPP/7zip/Bundles/Alone/makefile @@ -90,7 +90,6 @@ UI_COMMON_OBJS = \ $O\UpdateCallback.obj \ $O\UpdatePair.obj \ $O\UpdateProduce.obj \ - $O\WorkDir.obj \ AR_OBJS = \ $O\Bz2Handler.obj \ diff --git a/CPP/7zip/Bundles/Alone7z/makefile b/CPP/7zip/Bundles/Alone7z/makefile index 2aefcbd0..8de884f7 100755 --- a/CPP/7zip/Bundles/Alone7z/makefile +++ b/CPP/7zip/Bundles/Alone7z/makefile @@ -88,7 +88,6 @@ UI_COMMON_OBJS = \ $O\UpdateCallback.obj \ $O\UpdatePair.obj \ $O\UpdateProduce.obj \ - $O\WorkDir.obj \ AR_OBJS = \ $O\LzmaHandler.obj \ diff --git a/CPP/7zip/Bundles/Fm/FM.dsp b/CPP/7zip/Bundles/Fm/FM.dsp index 44cc6398..dded8b1d 100755 --- a/CPP/7zip/Bundles/Fm/FM.dsp +++ b/CPP/7zip/Bundles/Fm/FM.dsp @@ -613,6 +613,14 @@ SOURCE=..\..\Common\FileStreams.h # End Source File # Begin Source File +SOURCE=..\..\Common\MethodProps.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Common\MethodProps.h +# End Source File +# Begin Source File + SOURCE=..\..\Common\ProgressUtils.cpp # End Source File # Begin Source File diff --git a/CPP/7zip/Bundles/Fm/makefile b/CPP/7zip/Bundles/Fm/makefile index 02ee7af1..b8f9133f 100755 --- a/CPP/7zip/Bundles/Fm/makefile +++ b/CPP/7zip/Bundles/Fm/makefile @@ -181,6 +181,7 @@ AR_OBJS = \ $O\SplitHandler.obj \ $O\SquashfsHandler.obj \ $O\SwfHandler.obj \ + $O\UefiHandler.obj \ $O\VhdHandler.obj \ $O\XarHandler.obj \ $O\XzHandler.obj \ diff --git a/CPP/7zip/Bundles/Fm/resource.rc b/CPP/7zip/Bundles/Fm/resource.rc index c2aab047..dd2058a1 100755 --- a/CPP/7zip/Bundles/Fm/resource.rc +++ b/CPP/7zip/Bundles/Fm/resource.rc @@ -3,5 +3,5 @@ STRINGTABLE BEGIN - 100 "7z zip bz2 bzip2 tbz2 tbz rar arj z taz lzh lha cab iso 001 rpm deb cpio tar gz gzip tgz tpz4 wim swm lzma dmg hfs xar vhd fat ntfs xz" + 100 "7z zip rar 001 cab iso xz txz lzma tar cpio bz2 bzip2 tbz2 tbz gz gzip tgz tpz z taz lzh lha rpm deb arj vhd wim swm fat ntfs dmg hfs xar squashfs" END diff --git a/CPP/7zip/Bundles/Format7z/makefile b/CPP/7zip/Bundles/Format7z/makefile index d3609f7b..3b04c5e7 100755 --- a/CPP/7zip/Bundles/Format7z/makefile +++ b/CPP/7zip/Bundles/Format7z/makefile @@ -109,7 +109,6 @@ CRYPTO_OBJS = \ $O\7zAesRegister.obj \ $O\MyAes.obj \ $O\RandGen.obj \ - $O\Sha1.obj \ C_OBJS = \ $O\Alloc.obj \ diff --git a/CPP/7zip/Bundles/Format7zExtract/makefile b/CPP/7zip/Bundles/Format7zExtract/makefile index fb76cbc0..5598adc2 100755 --- a/CPP/7zip/Bundles/Format7zExtract/makefile +++ b/CPP/7zip/Bundles/Format7zExtract/makefile @@ -26,6 +26,7 @@ WIN_OBJS = \ $O\LimitedStreams.obj \ $O\LockedStream.obj \ $O\MethodId.obj \ + $O\MethodProps.obj \ $O\OutBuffer.obj \ $O\ProgressUtils.obj \ $O\StreamBinder.obj \ diff --git a/CPP/7zip/Bundles/Format7zF/Format7z.dsp b/CPP/7zip/Bundles/Format7zF/Format7z.dsp index b13ea42a..5bf1277d 100755 --- a/CPP/7zip/Bundles/Format7zF/Format7z.dsp +++ b/CPP/7zip/Bundles/Format7zF/Format7z.dsp @@ -2436,6 +2436,10 @@ SOURCE=..\..\Archive\SwfHandler.cpp # End Source File # Begin Source File +SOURCE=..\..\Archive\UefiHandler.cpp +# End Source File +# Begin Source File + SOURCE=..\..\Archive\VhdHandler.cpp # End Source File # Begin Source File diff --git a/CPP/7zip/Bundles/Format7zF/makefile b/CPP/7zip/Bundles/Format7zF/makefile index 11c74872..2601f1d6 100755 --- a/CPP/7zip/Bundles/Format7zF/makefile +++ b/CPP/7zip/Bundles/Format7zF/makefile @@ -79,6 +79,7 @@ AR_OBJS = \ $O\SplitHandler.obj \ $O\SwfHandler.obj \ $O\SquashfsHandler.obj \ + $O\UefiHandler.obj \ $O\VhdHandler.obj \ $O\XarHandler.obj \ $O\XzHandler.obj \ diff --git a/CPP/7zip/Bundles/Format7zF/resource.rc b/CPP/7zip/Bundles/Format7zF/resource.rc index df492020..1caf7301 100755 --- a/CPP/7zip/Bundles/Format7zF/resource.rc +++ b/CPP/7zip/Bundles/Format7zF/resource.rc @@ -1,6 +1,6 @@ #include "../../MyVersionInfo.rc" -MY_VERSION_INFO_DLL("7z Standalone Plugin", "7za") +MY_VERSION_INFO_DLL("7z Plugin", "7z") 0 ICON "../../Archive/Icons/7z.ico" @@ -33,5 +33,5 @@ MY_VERSION_INFO_DLL("7z Standalone Plugin", "7za") STRINGTABLE BEGIN - 100 "7z:0 zip:1 bz2:2 bzip2:2 tbz2:2 tbz:2 rar:3 arj:4 z:5 taz:5 lzh:6 lha:6 cab:7 iso:8 001:9 rpm:10 deb:11 cpio:12 tar:13 gz:14 gzip:14 tgz:14 tpz:14 wim:15 swm:15 lzma:16 dmg:17 hfs:18 xar:19 vhd:20 fat:21 ntfs:22 xz:23 txz:23 squashfs:24" + 100 "7z:0 zip:1 rar:3 001:9 cab:7 iso:8 xz:23 txz:23 lzma:16 tar:13 cpio:12 bz2:2 bzip2:2 tbz2:2 tbz:2 gz:14 gzip:14 tgz:14 tpz:14 z:5 taz:5 lzh:6 lha:6 rpm:10 deb:11 arj:4 vhd:20 wim:15 swm:15 fat:21 ntfs:22 dmg:17 hfs:18 xar:19 squashfs:24" END diff --git a/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp b/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp index efda09d7..e0f4dcba 100755 --- a/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp +++ b/CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp @@ -49,6 +49,8 @@ enum Enum { kHelp1 = 0, kHelp2, + kMethod, + kLevel, kAlgo, kDict, kFb, @@ -69,6 +71,8 @@ static const CSwitchForm kSwitchForms[] = { { L"?", NSwitchType::kSimple, false }, { L"H", NSwitchType::kSimple, false }, + { L"MM", NSwitchType::kUnLimitedPostString, false, 1 }, + { L"X", NSwitchType::kUnLimitedPostString, false, 1 }, { L"A", NSwitchType::kUnLimitedPostString, false, 1 }, { L"D", NSwitchType::kUnLimitedPostString, false, 1 }, { L"FB", NSwitchType::kUnLimitedPostString, false, 1 }, @@ -186,7 +190,7 @@ int main2(int numArgs, const char *args[]) IncorrectCommand(); } - if(parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs) + if (parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs) { PrintHelp(); return 0; @@ -198,21 +202,38 @@ int main2(int numArgs, const char *args[]) IncorrectCommand(); const UString &command = nonSwitchStrings[paramIndex++]; + CObjectVector<CProperty> props; bool dictDefined = false; - UInt32 dict = (UInt32)-1; - if(parser[NKey::kDict].ThereIs) + UInt32 dict = (UInt32)(Int32)-1; + if (parser[NKey::kDict].ThereIs) { UInt32 dicLog; - if (!GetNumber(parser[NKey::kDict].PostStrings[0], dicLog)) + const UString &s = parser[NKey::kDict].PostStrings[0]; + if (!GetNumber(s, dicLog)) IncorrectCommand(); dict = 1 << dicLog; dictDefined = true; + CProperty prop; + prop.Name = L"d"; + prop.Value = s; + props.Add(prop); + } + if (parser[NKey::kLevel].ThereIs) + { + UInt32 level = 5; + const UString &s = parser[NKey::kLevel].PostStrings[0]; + if (!GetNumber(s, level)) + IncorrectCommand(); + CProperty prop; + prop.Name = L"x"; + prop.Value = s; + props.Add(prop); } UString mf = L"BT4"; if (parser[NKey::kMatchFinder].ThereIs) mf = parser[NKey::kMatchFinder].PostStrings[0]; - UInt32 numThreads = (UInt32)-1; + UInt32 numThreads = (UInt32)(Int32)-1; #ifndef _7ZIP_ST if (parser[NKey::kMultiThread].ThereIs) @@ -224,9 +245,24 @@ int main2(int numArgs, const char *args[]) else if (!GetNumber(s, numThreads)) IncorrectCommand(); + CProperty prop; + prop.Name = L"mt"; + prop.Value = s; + props.Add(prop); } #endif + if (parser[NKey::kMethod].ThereIs) + { + UString s = parser[NKey::kMethod].PostStrings[0]; + if (s.IsEmpty() || s[0] != '=') + IncorrectCommand(); + CProperty prop; + prop.Name = L"m"; + prop.Value = s.Mid(1); + props.Add(prop); + } + if (command.CompareNoCase(L"b") == 0) { const UInt32 kNumDefaultItereations = 1; @@ -236,10 +272,19 @@ int main2(int numArgs, const char *args[]) if (!GetNumber(nonSwitchStrings[paramIndex++], numIterations)) numIterations = kNumDefaultItereations; } - return LzmaBenchCon(stderr, numIterations, numThreads, dict); + HRESULT res = BenchCon(props, numIterations, stderr); + if (res != S_OK) + { + if (res != E_ABORT) + { + PrintMessage("Benchmark Error"); + return 1; + } + } + return 0; } - if (numThreads == (UInt32)-1) + if (numThreads == (UInt32)(Int32)-1) numThreads = 1; bool encodeMode = false; @@ -267,7 +312,7 @@ int main2(int numArgs, const char *args[]) const UString &inputName = nonSwitchStrings[paramIndex++]; inStreamSpec = new CInFileStream; inStream = inStreamSpec; - if (!inStreamSpec->Open(GetSystemString(inputName))) + if (!inStreamSpec->Open(us2fs(inputName))) { fprintf(stderr, "\nError: can not open input file %s\n", (const char *)GetOemString(inputName)); @@ -289,7 +334,7 @@ int main2(int numArgs, const char *args[]) const UString &outputName = nonSwitchStrings[paramIndex++]; outStreamSpec = new COutFileStream; outStream = outStreamSpec; - if (!outStreamSpec->Create(GetSystemString(outputName), true)) + if (!outStreamSpec->Create(us2fs(outputName), true)) { fprintf(stderr, "\nError: can not open output file %s\n", (const char *)GetOemString(outputName)); @@ -398,7 +443,7 @@ int main2(int numArgs, const char *args[]) if (!GetNumber(parser[NKey::kMc].PostStrings[0], mc)) IncorrectCommand(); - PROPID propIDs[] = + const PROPID propIDs[] = { NCoderPropID::kDictionarySize, NCoderPropID::kPosStateBits, @@ -512,7 +557,7 @@ int main2(int numArgs, const char *args[]) int MY_CDECL main(int numArgs, const char *args[]) { try { return main2(numArgs, args); } - catch(const char *s) + catch (const char *s) { fprintf(stderr, "\nError: %s\n", s); return 1; diff --git a/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp b/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp index e171539d..6111aa7e 100755 --- a/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp +++ b/CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp @@ -132,6 +132,14 @@ SOURCE=..\..\..\Windows\FileIO.h # End Source File # Begin Source File +SOURCE=..\..\..\Windows\PropVariant.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\Windows\PropVariant.h +# End Source File +# Begin Source File + SOURCE=..\..\..\Windows\Synchronization.cpp # End Source File # Begin Source File @@ -280,6 +288,14 @@ SOURCE=..\..\Common\FilterCoder.h # End Source File # Begin Source File +SOURCE=..\..\Common\MethodProps.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Common\MethodProps.h +# End Source File +# Begin Source File + SOURCE=..\..\Common\StreamUtils.cpp # End Source File # Begin Source File diff --git a/CPP/7zip/Bundles/LzmaCon/makefile b/CPP/7zip/Bundles/LzmaCon/makefile index 4a76bbde..35d031af 100755 --- a/CPP/7zip/Bundles/LzmaCon/makefile +++ b/CPP/7zip/Bundles/LzmaCon/makefile @@ -21,6 +21,7 @@ COMMON_OBJS = \ WIN_OBJS = \ $O\FileIO.obj \ + $O\PropVariant.obj \ $O\System.obj 7ZIP_COMMON_OBJS = \ @@ -28,6 +29,7 @@ WIN_OBJS = \ $O\CreateCoder.obj \ $O\FileStreams.obj \ $O\FilterCoder.obj \ + $O\MethodProps.obj \ $O\OutBuffer.obj \ $O\StreamUtils.obj \ diff --git a/CPP/7zip/Bundles/LzmaCon/makefile.gcc b/CPP/7zip/Bundles/LzmaCon/makefile.gcc index 32c85f15..0f9f498c 100755 --- a/CPP/7zip/Bundles/LzmaCon/makefile.gcc +++ b/CPP/7zip/Bundles/LzmaCon/makefile.gcc @@ -30,15 +30,18 @@ OBJS = \ CWrappers.o \ FileStreams.o \ FilterCoder.o \ + MethodProps.o \ StreamUtils.o \ $(FILE_IO).o \ CommandLineParser.o \ CRC.o \ IntToString.o \ MyString.o \ + MyVector.o \ + MyWindows.o \ StringConvert.o \ StringToInt.o \ - MyVector.o \ + PropVariant.o \ 7zCrc.o \ 7zCrcOpt.o \ Alloc.o \ @@ -89,6 +92,9 @@ FileStreams.o: ../../Common/FileStreams.cpp FilterCoder.o: ../../Common/FilterCoder.cpp $(CXX) $(CFLAGS) ../../Common/FilterCoder.cpp +MethodProps.o: ../../Common/MethodProps.cpp + $(CXX) $(CFLAGS) ../../Common/MethodProps.cpp + StreamUtils.o: ../../Common/StreamUtils.cpp $(CXX) $(CFLAGS) ../../Common/StreamUtils.cpp @@ -102,23 +108,26 @@ CommandLineParser.o: ../../../Common/CommandLineParser.cpp CRC.o: ../../../Common/CRC.cpp $(CXX) $(CFLAGS) ../../../Common/CRC.cpp -MyWindows.o: ../../../Common/MyWindows.cpp - $(CXX) $(CFLAGS) ../../../Common/MyWindows.cpp - IntToString.o: ../../../Common/IntToString.cpp $(CXX) $(CFLAGS) ../../../Common/IntToString.cpp MyString.o: ../../../Common/MyString.cpp $(CXX) $(CFLAGS) ../../../Common/MyString.cpp +MyVector.o: ../../../Common/MyVector.cpp + $(CXX) $(CFLAGS) ../../../Common/MyVector.cpp + +MyWindows.o: ../../../Common/MyWindows.cpp + $(CXX) $(CFLAGS) ../../../Common/MyWindows.cpp + StringConvert.o: ../../../Common/StringConvert.cpp $(CXX) $(CFLAGS) ../../../Common/StringConvert.cpp StringToInt.o: ../../../Common/StringToInt.cpp $(CXX) $(CFLAGS) ../../../Common/StringToInt.cpp -MyVector.o: ../../../Common/MyVector.cpp - $(CXX) $(CFLAGS) ../../../Common/MyVector.cpp +PropVariant.o: ../../../Windows/PropVariant.cpp + $(CXX) $(CFLAGS) ../../../Windows/PropVariant.cpp 7zCrc.o: ../../../../C/7zCrc.c $(CXX_C) $(CFLAGS) ../../../../C/7zCrc.c diff --git a/CPP/7zip/Bundles/SFXCon/Main.cpp b/CPP/7zip/Bundles/SFXCon/Main.cpp index b136ae7c..3e9a8162 100755 --- a/CPP/7zip/Bundles/SFXCon/Main.cpp +++ b/CPP/7zip/Bundles/SFXCon/Main.cpp @@ -11,6 +11,7 @@ #include "Windows/DLL.h" #include "Windows/FileDir.h" #endif +#include "Windows/FileName.h" #include "../../UI/Common/ExitCode.h" #include "../../UI/Common/Extract.h" @@ -25,6 +26,9 @@ using namespace NWindows; using namespace NFile; using namespace NCommandLineParser; +#ifdef _WIN32 +HINSTANCE g_hInstance = 0; +#endif int g_CodePage = -1; extern CStdOutStream *g_StdStream; @@ -261,12 +265,11 @@ int Main2( #ifdef _WIN32 - UString arcPath; + FString arcPath; { - UString path; - NDLL::MyGetModuleFileName(NULL, path); - int fileNamePartStartIndex; - if (!NDirectory::MyGetFullPathName(path, arcPath, fileNamePartStartIndex)) + FString path; + NDLL::MyGetModuleFileName(path); + if (!NDirectory::MyGetFullPathName(path, arcPath)) { g_StdOut << "GetFullPathName Error"; return NExitCode::kFatalError; @@ -291,7 +294,7 @@ int Main2( PrintHelpAndExit(); } - if(parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs) + if (parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs) { PrintHelp(); return 0; @@ -330,23 +333,23 @@ int Main2( bool passwordEnabled = parser[NKey::kPassword].ThereIs; UString password; - if(passwordEnabled) + if (passwordEnabled) password = parser[NKey::kPassword].PostStrings[0]; if (!NFind::DoesFileExist(arcPath)) throw kCantFindSFX; - UString outputDir; + FString outputDir; if (parser[NKey::kOutputDir].ThereIs) { - outputDir = parser[NKey::kOutputDir].PostStrings[0]; + outputDir = us2fs(parser[NKey::kOutputDir].PostStrings[0]); NName::NormalizeDirPathPrefix(outputDir); } { UStringVector v1, v2; - v1.Add(arcPath); - v2.Add(arcPath); + v1.Add(fs2us(arcPath)); + v2.Add(fs2us(arcPath)); const NWildcard::CCensorNode &wildcardCensorHead = wildcardCensor.Pairs.Front().Head; @@ -362,7 +365,7 @@ int Main2( if (result != S_OK) throw CSystemException(result); - if(command.CommandType != NCommandType::kList) + if (command.CommandType != NCommandType::kList) { CExtractCallbackConsole *ecs = new CExtractCallbackConsole; CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs; diff --git a/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp b/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp index a28e82d3..9b733da0 100755 --- a/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp +++ b/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp @@ -6,6 +6,7 @@ #include "Windows/FileDir.h" #include "Windows/FileFind.h" +#include "Windows/FileName.h" #include "Windows/PropVariant.h" #include "ExtractCallback.h" @@ -18,7 +19,7 @@ static LPCWSTR kCantOpenFile = L"Can not open output file"; static LPCWSTR kUnsupportedMethod = L"Unsupported Method"; void CExtractCallbackImp::Init(IInArchive *archiveHandler, - const UString &directoryPath, + const FString &directoryPath, const UString &itemDefaultName, const FILETIME &defaultMTime, UInt32 defaultAttributes) @@ -76,12 +77,12 @@ STDMETHODIMP CExtractCallbackImp::SetCompleted(const UInt64 *completeValue) void CExtractCallbackImp::CreateComplexDirectory(const UStringVector &dirPathParts) { - UString fullPath = _directoryPath; - for(int i = 0; i < dirPathParts.Size(); i++) + FString fullPath = _directoryPath; + for (int i = 0; i < dirPathParts.Size(); i++) { - fullPath += dirPathParts[i]; + fullPath += us2fs(dirPathParts[i]); NDirectory::MyCreateDirectory(fullPath); - fullPath += NName::kDirDelimiter; + fullPath += FCHAR_PATH_SEPARATOR; } } @@ -153,7 +154,7 @@ STDMETHODIMP CExtractCallbackImp::GetStream(UInt32 index, CreateComplexDirectory(pathParts); } - UString fullProcessedPath = _directoryPath + processedPath; + FString fullProcessedPath = _directoryPath + us2fs(processedPath); if (_processedFileInfo.IsDir) { @@ -166,7 +167,7 @@ STDMETHODIMP CExtractCallbackImp::GetStream(UInt32 index, return S_OK; } - NFind::CFileInfoW fileInfo; + NFind::CFileInfo fileInfo; if (fileInfo.Find(fullProcessedPath)) { if (!NDirectory::DeleteFileAlways(fullProcessedPath)) diff --git a/CPP/7zip/Bundles/SFXSetup/ExtractCallback.h b/CPP/7zip/Bundles/SFXSetup/ExtractCallback.h index c78ff22b..128988f9 100755 --- a/CPP/7zip/Bundles/SFXSetup/ExtractCallback.h +++ b/CPP/7zip/Bundles/SFXSetup/ExtractCallback.h @@ -31,9 +31,9 @@ public: private: CMyComPtr<IInArchive> _archiveHandler; - UString _directoryPath; + FString _directoryPath; UString _filePath; - UString _diskFilePath; + FString _diskFilePath; bool _extractMode; struct CProcessedFileInfo @@ -60,7 +60,7 @@ public: UString _message; void Init(IInArchive *archiveHandler, - const UString &directoryPath, + const FString &directoryPath, const UString &itemDefaultName, const FILETIME &defaultMTime, UInt32 defaultAttributes); diff --git a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp index cc561090..8f830de5 100755 --- a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp +++ b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp @@ -3,6 +3,7 @@ #include "StdAfx.h" #include "Windows/FileDir.h" +#include "Windows/FileName.h" #include "Windows/Thread.h" #include "../../UI/Common/OpenArchive.h" @@ -20,8 +21,8 @@ static LPCWSTR kCantOpenArchive = L"Can not open the file as archive"; struct CThreadExtracting { CCodecs *Codecs; - UString FileName; - UString DestFolder; + FString FileName; + FString DestFolder; CExtractCallbackImp *ExtractCallbackSpec; CMyComPtr<IArchiveExtractCallback> ExtractCallback; @@ -32,7 +33,7 @@ struct CThreadExtracting void Process2() { - NFile::NFind::CFileInfoW fi; + NFile::NFind::CFileInfo fi; if (!fi.Find(FileName)) { ErrorMessage = kCantFindArchive; @@ -40,7 +41,7 @@ struct CThreadExtracting return; } - Result = ArchiveLink.Open2(Codecs, CIntVector(), false, NULL, FileName, ExtractCallbackSpec); + Result = ArchiveLink.Open2(Codecs, CIntVector(), false, NULL, fs2us(FileName), ExtractCallbackSpec); if (Result != S_OK) { if (Result != S_OK) @@ -48,7 +49,7 @@ struct CThreadExtracting return; } - UString dirPath = DestFolder; + FString dirPath = DestFolder; NFile::NName::NormalizeDirPathPrefix(dirPath); if (!NFile::NDirectory::CreateComplexDirectory(dirPath)) @@ -57,7 +58,7 @@ struct CThreadExtracting #ifdef LANG 0x02000603, #endif - dirPath); + fs2us(dirPath)); Result = E_FAIL; return; } @@ -86,7 +87,7 @@ struct CThreadExtracting } }; -HRESULT ExtractArchive(CCodecs *codecs,const UString &fileName, const UString &destFolder, +HRESULT ExtractArchive(CCodecs *codecs, const FString &fileName, const FString &destFolder, bool showProgress, bool &isCorrupt, UString &errorMessage) { isCorrupt = false; diff --git a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h index 56d69686..295d77b9 100755 --- a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h +++ b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.h @@ -1,11 +1,11 @@ // ExtractEngine.h -#ifndef __EXTRACTENGINE_H -#define __EXTRACTENGINE_H +#ifndef __EXTRACT_ENGINE_H +#define __EXTRACT_ENGINE_H #include "../../UI/Common/LoadCodecs.h" -HRESULT ExtractArchive(CCodecs *codecs, const UString &fileName, const UString &destFolder, - bool showProgress, bool &isCorrupt, UString &errorMessage); +HRESULT ExtractArchive(CCodecs *codecs, const FString &fileName, const FString &destFolder, + bool showProgress, bool &isCorrupt, UString &errorMessage); #endif diff --git a/CPP/7zip/Bundles/SFXSetup/Main.cpp b/CPP/7zip/Bundles/SFXSetup/Main.cpp index 80e23c4e..008c0e42 100755 --- a/CPP/7zip/Bundles/SFXSetup/Main.cpp +++ b/CPP/7zip/Bundles/SFXSetup/Main.cpp @@ -12,6 +12,7 @@ #include "Windows/FileDir.h" #include "Windows/FileFind.h" #include "Windows/FileIO.h" +#include "Windows/FileName.h" #include "Windows/NtCheck.h" #include "Windows/ResourceString.h" @@ -25,11 +26,11 @@ using namespace NWindows; HINSTANCE g_hInstance; -static LPCTSTR kTempDirPrefix = TEXT("7zS"); +static CFSTR kTempDirPrefix = FTEXT("7zS"); #define _SHELL_EXECUTE -static bool ReadDataString(LPCWSTR fileName, LPCSTR startID, +static bool ReadDataString(CFSTR fileName, LPCSTR startID, LPCSTR endID, AString &stringResult) { stringResult.Empty(); @@ -107,11 +108,11 @@ public: #ifndef UNDER_CE class CCurrentDirRestorer { - CSysString m_CurrentDirectory; + FString m_CurrentDirectory; public: CCurrentDirRestorer() { NFile::NDirectory::MyGetCurrentDirectory(m_CurrentDirectory); } ~CCurrentDirRestorer() { RestoreDirectory();} - bool RestoreDirectory() { return BOOLToBool(::SetCurrentDirectory(m_CurrentDirectory)); } + bool RestoreDirectory() const { return NFile::NDirectory::MySetCurrentDirectory(m_CurrentDirectory); } }; #endif @@ -137,8 +138,8 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, #endif NCommandLineParser::SplitCommandLine(GetCommandLineW(), archiveName, switches); - UString fullPath; - NDLL::MyGetModuleFileName(g_hInstance, fullPath); + FString fullPath; + NDLL::MyGetModuleFileName(fullPath); switches.Trim(); bool assumeYes = false; @@ -191,7 +192,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, #endif } - NFile::NDirectory::CTempDirectory tempDir; + NFile::NDirectory::CTempDir tempDir; if (!tempDir.Create(kTempDirPrefix)) { if (!assumeYes) @@ -208,7 +209,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, return 1; } - UString tempDirPath = GetUnicodeString(tempDir.GetPath()); + FString tempDirPath = tempDir.GetPath(); { bool isCorrupt = false; UString errorMessage; @@ -233,7 +234,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, #ifndef UNDER_CE CCurrentDirRestorer currentDirRestorer; - if (!SetCurrentDirectory(tempDir.GetPath())) + if (!NFile::NDirectory::MySetCurrentDirectory(tempDir.GetPath())) return 1; #endif @@ -281,7 +282,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, if (appLaunched.IsEmpty()) { appLaunched = L"setup.exe"; - if (!NFile::NFind::DoesFileExist(GetSystemString(appLaunched))) + if (!NFile::NFind::DoesFileExist(us2fs(appLaunched))) { if (!assumeYes) ShowErrorMessage(L"Can not find setup.exe"); @@ -290,12 +291,12 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, } { - UString s2 = tempDirPath; + FString s2 = tempDirPath; NFile::NName::NormalizeDirPathPrefix(s2); - appLaunched.Replace(L"%%T" WSTRING_PATH_SEPARATOR, s2); + appLaunched.Replace(L"%%T" WSTRING_PATH_SEPARATOR, fs2us(s2)); } - appLaunched.Replace(L"%%T", tempDirPath); + appLaunched.Replace(L"%%T", fs2us(tempDirPath)); if (!switches.IsEmpty()) { diff --git a/CPP/7zip/Bundles/SFXWin/Main.cpp b/CPP/7zip/Bundles/SFXWin/Main.cpp index ec5098dd..bb7318a1 100755 --- a/CPP/7zip/Bundles/SFXWin/Main.cpp +++ b/CPP/7zip/Bundles/SFXWin/Main.cpp @@ -41,7 +41,7 @@ int APIENTRY WinMain2() UString password; bool assumeYes = false; bool outputFolderDefined = false; - UString outputFolder; + FString outputFolder; UStringVector commandStrings; NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings); @@ -57,7 +57,7 @@ int APIENTRY WinMain2() assumeYes = true; else if (s.Left(2).CompareNoCase(L"-o") == 0) { - outputFolder = s.Mid(2); + outputFolder = us2fs(s.Mid(2)); NWindows::NFile::NName::NormalizeDirPathPrefix(outputFolder); outputFolderDefined = !outputFolder.IsEmpty(); } @@ -67,12 +67,11 @@ int APIENTRY WinMain2() } } - UString path; - NWindows::NDLL::MyGetModuleFileName(g_hInstance, path); + FString path; + NWindows::NDLL::MyGetModuleFileName(path); - UString fullPath; - int fileNamePartStartIndex; - if (!NWindows::NFile::NDirectory::MyGetFullPathName(path, fullPath, fileNamePartStartIndex)) + FString fullPath; + if (!NWindows::NFile::NDirectory::MyGetFullPathName(path, fullPath)) { ShowErrorMessage(L"Error 1329484"); return 1; @@ -102,8 +101,15 @@ int APIENTRY WinMain2() #endif CExtractOptions eo; - eo.OutputDir = outputFolderDefined ? outputFolder : - fullPath.Left(fileNamePartStartIndex); + + FString dirPrefix; + if (!NWindows::NFile::NDirectory::GetOnlyDirPrefix(path, dirPrefix)) + { + ShowErrorMessage(L"Error 1329485"); + return 1; + } + + eo.OutputDir = outputFolderDefined ? outputFolder : dirPrefix; eo.YesToAll = assumeYes; eo.OverwriteMode = assumeYes ? NExtract::NOverwriteMode::kWithoutPrompt : @@ -112,8 +118,8 @@ int APIENTRY WinMain2() eo.TestMode = false; UStringVector v1, v2; - v1.Add(fullPath); - v2.Add(fullPath); + v1.Add(fs2us(fullPath)); + v2.Add(fs2us(fullPath)); NWildcard::CCensorNode wildcardCensor; wildcardCensor.AddItem(true, L"*", true, true, true); @@ -170,4 +176,3 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, return NExitCode::kFatalError; } } - |