Files
nsis-plugin-ns7zip/versions/25.01-bundle/CPP/7zip/UI/NSIS/MainAr.cpp
T
Simone 8968d0fd0c feat(25.01): add bundle wrapper directory with NSIS sources and vendor symlinks
Mirror the 26.00-bundle / 26.01-bundle approach for 25.01:

- versions/25.01-bundle/CPP/7zip/Bundles/Nsis7z/: project-owned NSIS plugin
  wrapper sources (api.h, nsis7z.cpp, pluginapi.*, resource.*, StdAfx*,
  Nsis7z.sln, Nsis7z.vcxproj, Nsis7z.vcxproj.filters, Nsis7z_vs2026.vcxproj).
- versions/25.01-bundle/CPP/7zip/UI/NSIS/: NSIS UI sources; StdAfx.h patched
  to use relative include path and MinGW-compatible Windows.h guard (the
  upstream 25.01 file used an absolute path incompatible with the bundle layout).
- versions/25.01-bundle/CPP/7zip/LzmaDec_gcc.mak: forwarding stub.
- versions/25.01-bundle/{C,Asm} and CPP sub-trees: symlinks into versions/25.01/.
- tools/linux/setup_25_01_bundle_symlinks.py: idempotent symlink-recreation script.
2026-05-03 01:38:45 +02:00

110 lines
2.5 KiB
C++

// MainAr.cpp
#include "StdAfx.h"
// #include <locale.h>
#include "../../../Common/Common.h"
#include "Windows/ErrorMsg.h"
#include "Common/StdOutStream.h"
#include "Common/NewHandler.h"
#include "Common/MyException.h"
#include "Common/StringConvert.h"
#include "../Common/ExitCode.h"
#include "../Common/ArchiveCommandLine.h"
#include "ExtractCallbackConsole.h"
#include "NSISBreak.h"
using namespace NWindows;
#ifdef _WIN32
#pragma warning(disable : 4996)
#ifndef _UNICODE
bool g_IsNT = false;
#endif
#if !defined(_UNICODE) || !defined(_WIN64)
static inline bool IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
#endif
#endif
void DoInitialize()
{
#ifdef _WIN32
#ifdef _UNICODE
#ifndef _WIN64
if (!IsItWindowsNT())
{
//(*g_StdStream) << "This program requires Windows NT/2000/2003/2008/XP/Vista";
// return NExitCode::kFatalError;
return;
}
#endif
#else
g_IsNT = IsItWindowsNT();
#endif
#endif
}
extern int DoExtractArchive(UString archive, UString targetDir, bool overwrite, bool extractPathes, ExtractProgressHandler epc, const UStringVector& skipPatterns);
extern int DoExtractArchiveWithFile(UString archive, UString targetDir, bool overwrite, bool extractPathes, ExtractProgressWithFileHandler epc, const UStringVector& skipPatterns);
int DoExtract(LPTSTR archive, LPTSTR dir, bool overwrite, bool expath, ExtractProgressHandler epc, const UStringVector& skipPatterns)
{
if (!archive || !dir) return -1;
int res = 0;
try
{
#ifdef UNICODE
UString uarchive(archive);
UString udir(dir);
#else
UString uarchive = MultiByteToUnicodeString(AString(archive));
UString udir = MultiByteToUnicodeString(AString(dir));
#endif
res = DoExtractArchive(uarchive, udir, overwrite, expath, epc, skipPatterns);
}
catch(...)
{
return -1;
}
return res;
}
int DoExtractWithFile(LPTSTR archive, LPTSTR dir, bool overwrite, bool expath, ExtractProgressWithFileHandler epc, const UStringVector& skipPatterns)
{
if (!archive || !dir) return -1;
int res = 0;
try
{
#ifdef UNICODE
UString uarchive(archive);
UString udir(dir);
#else
UString uarchive = MultiByteToUnicodeString(AString(archive));
UString udir = MultiByteToUnicodeString(AString(dir));
#endif
res = DoExtractArchiveWithFile(uarchive, udir, overwrite, expath, epc, skipPatterns);
}
catch(...)
{
return -1;
}
return res;
}