Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2009-08-17 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:16:00 +0300
commitc99f3ebdd639c2adb03d8b44001b10af18516504 (patch)
tree92aaf34e5edbd7287c3f55037190da75ab0a8000 /CPP/7zip/Bundles/SFXSetup
parent829409452d85cd6dd9dfc9151f109d6e13a2bb1c (diff)
9.06 beta
Diffstat (limited to 'CPP/7zip/Bundles/SFXSetup')
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp12
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/ExtractCallback.h8
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp31
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/Main.cpp55
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/SFXSetup.dsp12
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/makefile1
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/resource.h2
-rwxr-xr-xCPP/7zip/Bundles/SFXSetup/resource.rc2
8 files changed, 60 insertions, 63 deletions
diff --git a/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp b/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp
index 8ebe2504..a28e82d3 100755
--- a/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp
+++ b/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp
@@ -36,7 +36,7 @@ void CExtractCallbackImp::Init(IInArchive *archiveHandler,
HRESULT CExtractCallbackImp::Open_CheckBreak()
{
#ifndef _NO_PROGRESS
- return ProgressDialog.ProgressSynch.ProcessStopAndPause();
+ return ProgressDialog.Sync.ProcessStopAndPause();
#else
return S_OK;
#endif
@@ -50,7 +50,7 @@ HRESULT CExtractCallbackImp::Open_SetTotal(const UInt64 * /* numFiles */, const
HRESULT CExtractCallbackImp::Open_SetCompleted(const UInt64 * /* numFiles */, const UInt64 * /* numBytes */)
{
#ifndef _NO_PROGRESS
- return ProgressDialog.ProgressSynch.ProcessStopAndPause();
+ return ProgressDialog.Sync.ProcessStopAndPause();
#else
return S_OK;
#endif
@@ -59,7 +59,7 @@ HRESULT CExtractCallbackImp::Open_SetCompleted(const UInt64 * /* numFiles */, co
STDMETHODIMP CExtractCallbackImp::SetTotal(UInt64 size)
{
#ifndef _NO_PROGRESS
- ProgressDialog.ProgressSynch.SetProgress(size, 0);
+ ProgressDialog.Sync.SetProgress(size, 0);
#endif
return S_OK;
}
@@ -67,9 +67,9 @@ STDMETHODIMP CExtractCallbackImp::SetTotal(UInt64 size)
STDMETHODIMP CExtractCallbackImp::SetCompleted(const UInt64 *completeValue)
{
#ifndef _NO_PROGRESS
- RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause());
+ RINOK(ProgressDialog.Sync.ProcessStopAndPause());
if (completeValue != NULL)
- ProgressDialog.ProgressSynch.SetPos(*completeValue);
+ ProgressDialog.Sync.SetPos(*completeValue);
#endif
return S_OK;
}
@@ -89,7 +89,7 @@ STDMETHODIMP CExtractCallbackImp::GetStream(UInt32 index,
ISequentialOutStream **outStream, Int32 askExtractMode)
{
#ifndef _NO_PROGRESS
- if (ProgressDialog.ProgressSynch.GetStopped())
+ if (ProgressDialog.Sync.GetStopped())
return E_ABORT;
#endif
_outFileStream.Release();
diff --git a/CPP/7zip/Bundles/SFXSetup/ExtractCallback.h b/CPP/7zip/Bundles/SFXSetup/ExtractCallback.h
index 4f4258bc..c78ff22b 100755
--- a/CPP/7zip/Bundles/SFXSetup/ExtractCallback.h
+++ b/CPP/7zip/Bundles/SFXSetup/ExtractCallback.h
@@ -1,7 +1,7 @@
// ExtractCallback.h
-#ifndef __EXTRACTCALLBACK_H
-#define __EXTRACTCALLBACK_H
+#ifndef __EXTRACT_CALLBACK_H
+#define __EXTRACT_CALLBACK_H
#include "resource.h"
@@ -66,9 +66,9 @@ public:
UInt32 defaultAttributes);
#ifndef _NO_PROGRESS
- HRESULT StartProgressDialog(const UString &title)
+ HRESULT StartProgressDialog(const UString &title, NWindows::CThread &thread)
{
- ProgressDialog.Create(title, 0);
+ ProgressDialog.Create(title, thread, 0);
{
#ifdef LANG
ProgressDialog.SetText(LangLoadString(IDS_PROGRESS_EXTRACTING, 0x02000890));
diff --git a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp
index e5353c21..cc561090 100755
--- a/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp
+++ b/CPP/7zip/Bundles/SFXSetup/ExtractEngine.cpp
@@ -19,9 +19,6 @@ static LPCWSTR kCantOpenArchive = L"Can not open the file as archive";
struct CThreadExtracting
{
- #ifndef _NO_PROGRESS
- bool ShowProgress;
- #endif
CCodecs *Codecs;
UString FileName;
UString DestFolder;
@@ -33,7 +30,7 @@ struct CThreadExtracting
HRESULT Result;
UString ErrorMessage;
- void Process()
+ void Process2()
{
NFile::NFind::CFileInfoW fi;
if (!fi.Find(FileName))
@@ -67,15 +64,19 @@ struct CThreadExtracting
ExtractCallbackSpec->Init(ArchiveLink.GetArchive(), dirPath, L"Default", fi.MTime, 0);
- #ifndef _NO_PROGRESS
- if (ShowProgress)
- ExtractCallbackSpec->ProgressDialog.WaitCreating();
- #endif
Result = ArchiveLink.GetArchive()->Extract(0, (UInt32)-1 , BoolToInt(false), ExtractCallback);
- #ifndef _NO_PROGRESS
- if (ShowProgress)
- ExtractCallbackSpec->ProgressDialog.MyClose();
- #endif
+ }
+
+ void Process()
+ {
+ try
+ {
+ #ifndef _NO_PROGRESS
+ CProgressCloser closer(ExtractCallbackSpec->ProgressDialog);
+ #endif
+ Process2();
+ }
+ catch(...) { Result = E_FAIL; }
}
static THREAD_FUNC_DECL MyThreadFunction(void *param)
@@ -100,9 +101,9 @@ HRESULT ExtractArchive(CCodecs *codecs,const UString &fileName, const UString &d
#ifndef _NO_PROGRESS
- t.ShowProgress = showProgress;
if (showProgress)
{
+ t.ExtractCallbackSpec->ProgressDialog.IconID = IDI_ICON;
NWindows::CThread thread;
RINOK(thread.Create(CThreadExtracting::MyThreadFunction, &t));
@@ -112,13 +113,13 @@ HRESULT ExtractArchive(CCodecs *codecs,const UString &fileName, const UString &d
#else
title = NWindows::MyLoadStringW(IDS_PROGRESS_EXTRACTING);
#endif
- t.ExtractCallbackSpec->StartProgressDialog(title);
+ t.ExtractCallbackSpec->StartProgressDialog(title, thread);
}
else
#endif
{
- t.Process();
+ t.Process2();
}
errorMessage = t.ErrorMessage;
diff --git a/CPP/7zip/Bundles/SFXSetup/Main.cpp b/CPP/7zip/Bundles/SFXSetup/Main.cpp
index ece6e3de..80e23c4e 100755
--- a/CPP/7zip/Bundles/SFXSetup/Main.cpp
+++ b/CPP/7zip/Bundles/SFXSetup/Main.cpp
@@ -2,7 +2,7 @@
#include "StdAfx.h"
-#include <initguid.h>
+#include "Common/MyInitGuid.h"
#include "Common/CommandLineParser.h"
#include "Common/StringConvert.h"
@@ -12,6 +12,7 @@
#include "Windows/FileDir.h"
#include "Windows/FileFind.h"
#include "Windows/FileIO.h"
+#include "Windows/NtCheck.h"
#include "Windows/ResourceString.h"
#include "../../UI/Explorer/MyMessages.h"
@@ -38,8 +39,8 @@ static bool ReadDataString(LPCWSTR fileName, LPCSTR startID,
const int kBufferSize = (1 << 12);
Byte buffer[kBufferSize];
- int signatureStartSize = lstrlenA(startID);
- int signatureEndSize = lstrlenA(endID);
+ int signatureStartSize = MyStringLen(startID);
+ int signatureEndSize = MyStringLen(endID);
UInt32 numBytesPrev = 0;
bool writeMode = false;
@@ -103,37 +104,32 @@ public:
} g_CInstallIDInit;
+#ifndef UNDER_CE
class CCurrentDirRestorer
{
CSysString m_CurrentDirectory;
public:
- CCurrentDirRestorer()
- { NFile::NDirectory::MyGetCurrentDirectory(m_CurrentDirectory); }
- ~CCurrentDirRestorer()
- { RestoreDirectory();}
- bool RestoreDirectory()
- { return BOOLToBool(::SetCurrentDirectory(m_CurrentDirectory)); }
+ CCurrentDirRestorer() { NFile::NDirectory::MyGetCurrentDirectory(m_CurrentDirectory); }
+ ~CCurrentDirRestorer() { RestoreDirectory();}
+ bool RestoreDirectory() { return BOOLToBool(::SetCurrentDirectory(m_CurrentDirectory)); }
};
-
-#ifndef _UNICODE
-bool g_IsNT = false;
-static inline bool IsItWindowsNT()
-{
- OSVERSIONINFO versionInfo;
- versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
- return false;
- return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
#endif
-int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /* lpCmdLine */,int /* nCmdShow */)
+#define NT_CHECK_FAIL_ACTION ShowErrorMessage(L"Unsupported Windows version"); return 1;
+
+int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
+ #ifdef UNDER_CE
+ LPWSTR
+ #else
+ LPSTR
+ #endif
+ /* lpCmdLine */,int /* nCmdShow */)
{
g_hInstance = (HINSTANCE)hInstance;
- #ifndef _UNICODE
- g_IsNT = IsItWindowsNT();
- #endif
- InitCommonControls();
+
+ NT_CHECK
+
+ // InitCommonControls();
UString archiveName, switches;
#ifdef _SHELL_EXECUTE
@@ -235,10 +231,11 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /
}
}
+ #ifndef UNDER_CE
CCurrentDirRestorer currentDirRestorer;
-
if (!SetCurrentDirectory(tempDir.GetPath()))
return 1;
+ #endif
HANDLE hProcess = 0;
#ifdef _SHELL_EXECUTE
@@ -247,7 +244,11 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /
CSysString filePath = GetSystemString(executeFile);
SHELLEXECUTEINFO execInfo;
execInfo.cbSize = sizeof(execInfo);
- execInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_DDEWAIT;
+ execInfo.fMask = SEE_MASK_NOCLOSEPROCESS
+ #ifndef UNDER_CE
+ | SEE_MASK_FLAG_DDEWAIT
+ #endif
+ ;
execInfo.hwnd = NULL;
execInfo.lpVerb = NULL;
execInfo.lpFile = filePath;
diff --git a/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp b/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp
index 1f5d99cb..61ec0470 100755
--- a/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp
+++ b/CPP/7zip/Bundles/SFXSetup/SFXSetup.dsp
@@ -619,25 +619,21 @@ SOURCE=..\..\UI\Common\OpenArchive.h
# Begin Group "File Manager"
# PROP Default_Filter ""
-# Begin Group "Dialog"
-
-# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\..\UI\FileManager\ProgressDialog.cpp
+SOURCE=..\..\UI\FileManager\FormatUtils.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\UI\FileManager\ProgressDialog.h
+SOURCE=..\..\UI\FileManager\FormatUtils.h
# End Source File
-# End Group
# Begin Source File
-SOURCE=..\..\UI\FileManager\FormatUtils.cpp
+SOURCE=..\..\UI\FileManager\ProgressDialog.cpp
# End Source File
# Begin Source File
-SOURCE=..\..\UI\FileManager\FormatUtils.h
+SOURCE=..\..\UI\FileManager\ProgressDialog.h
# End Source File
# End Group
# Begin Group "C"
diff --git a/CPP/7zip/Bundles/SFXSetup/makefile b/CPP/7zip/Bundles/SFXSetup/makefile
index 44ffc9c6..a3c2b12c 100755
--- a/CPP/7zip/Bundles/SFXSetup/makefile
+++ b/CPP/7zip/Bundles/SFXSetup/makefile
@@ -1,5 +1,4 @@
PROG = 7zS.sfx
-LIBS = $(LIBS) user32.lib oleaut32.lib shell32.lib ole32.lib comctl32.lib
CFLAGS = $(CFLAGS) -I ../../../ \
-DNO_REGISTRY \
-DEXTRACT_ONLY \
diff --git a/CPP/7zip/Bundles/SFXSetup/resource.h b/CPP/7zip/Bundles/SFXSetup/resource.h
index 2c7e5a22..58cd13cb 100755
--- a/CPP/7zip/Bundles/SFXSetup/resource.h
+++ b/CPP/7zip/Bundles/SFXSetup/resource.h
@@ -1,4 +1,4 @@
-#define IDI_ICON3 159
+#define IDI_ICON 1
#define IDS_EXTRACTION_ERROR_TITLE 7
#define IDS_EXTRACTION_ERROR_MESSAGE 8
diff --git a/CPP/7zip/Bundles/SFXSetup/resource.rc b/CPP/7zip/Bundles/SFXSetup/resource.rc
index 85c24f0b..8ccdcf2c 100755
--- a/CPP/7zip/Bundles/SFXSetup/resource.rc
+++ b/CPP/7zip/Bundles/SFXSetup/resource.rc
@@ -3,7 +3,7 @@
MY_VERSION_INFO_APP("7z Setup SFX", "7zS.sfx")
-IDI_ICON3 ICON "setup.ico"
+IDI_ICON ICON "setup.ico"
STRINGTABLE
BEGIN