MakeNSIS can now generate Unicode or Ansi installers based on a script attribute. SCons generates both Ansi and Unicode stubs and plugins.
The official plugins are now stored in architecture specific subdirectories under NSIS\Plugins. !AddPluginDir also gained a new (optional) architecture flag because MakeNSIS now stores separate plugin information for each target architecture. Storing plugins in the root of the Plugins directory is no longer supported. MinGW does not implement the unicode CRT startup functions so the entry point functions and linker parameters had to be changed. The unicode tools use the ansi entry point and a small helper function that calls into the real code: _tmain has full argc+argv emulation while wWinMain does not pass the command line parameters. The stubs do not use any CRT functions and have no CRT or unicode helper code, they call our entry point directly. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6269 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
8f330bbbdf
commit
7cc150c464
73 changed files with 936 additions and 713 deletions
|
@ -6,6 +6,11 @@
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#include <nsis/pluginapi.h> // nsis plugin
|
#include <nsis/pluginapi.h> // nsis plugin
|
||||||
|
|
||||||
|
#ifndef LWA_COLORKEY
|
||||||
|
# define LWA_COLORKEY 1
|
||||||
|
# define LWA_ALPHA 2
|
||||||
|
#endif
|
||||||
|
|
||||||
HINSTANCE g_hInstance;
|
HINSTANCE g_hInstance;
|
||||||
|
|
||||||
#define RESOLUTION 32 // 30 fps ;) (32? I like SHR more than iDIV ;)
|
#define RESOLUTION 32 // 30 fps ;) (32? I like SHR more than iDIV ;)
|
||||||
|
@ -120,7 +125,7 @@ void SetTransparentRegion(HWND myWnd)
|
||||||
GlobalFree(bmp_orig);
|
GlobalFree(bmp_orig);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call,
|
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call,
|
||||||
LPVOID lpReserved)
|
LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
g_hInstance = hInst;
|
g_hInstance = hInst;
|
||||||
|
|
|
@ -168,7 +168,7 @@ void __declspec(dllexport) destroy(HWND hwndParent, int string_size, TCHAR *vari
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
hInstance = hInst;
|
hInstance = hInst;
|
||||||
if (hwBanner && ul_reason_for_call == DLL_PROCESS_DETACH)
|
if (hwBanner && ul_reason_for_call == DLL_PROCESS_DETACH)
|
||||||
|
|
|
@ -111,8 +111,7 @@ NSISFunc(SetBg) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WNDCLASSEX wc = {
|
WNDCLASS wc = {
|
||||||
sizeof(WNDCLASSEX),
|
|
||||||
CS_VREDRAW|CS_HREDRAW,
|
CS_VREDRAW|CS_HREDRAW,
|
||||||
WndProc,
|
WndProc,
|
||||||
0,
|
0,
|
||||||
|
@ -123,9 +122,8 @@ NSISFunc(SetBg) {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
_T("NSISBGImage"),
|
_T("NSISBGImage"),
|
||||||
0
|
|
||||||
};
|
};
|
||||||
ATOM atomClass = RegisterClassEx(&wc);
|
ATOM atomClass = RegisterClass(&wc);
|
||||||
if (!atomClass) {
|
if (!atomClass) {
|
||||||
my_pushstring(_T("can't create window"));
|
my_pushstring(_T("can't create window"));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#define NSISFunction(funcname) void __declspec(dllexport) funcname(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
|
#define NSISFunction(funcname) void __declspec(dllexport) funcname(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) {
|
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,29 +24,31 @@ example = Split("""
|
||||||
extdll.inc
|
extdll.inc
|
||||||
""")
|
""")
|
||||||
|
|
||||||
Import('env plugin_env plugin_uenv')
|
Import('env plugin_env plugin_uenv GetArcSuffix PerformPluginExtrasDistOperationOnce')
|
||||||
|
|
||||||
unicodetarget = 'UNICODE' in env['CPPDEFINES']
|
unicodetarget = 'UNICODE' in env['CPPDEFINES']
|
||||||
lib_targetT = lib_target
|
plugin_envT = plugin_env
|
||||||
|
if unicodetarget:
|
||||||
|
plugin_envT = plugin_uenv
|
||||||
|
lib_targetT = lib_target + '-' + GetArcSuffix(plugin_envT, unicodetarget)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# build library
|
# build library
|
||||||
if unicodetarget:
|
|
||||||
lib_targetT = lib_targetT + 'W'
|
api_envT = plugin_envT.Clone()
|
||||||
api_uenv = plugin_uenv.Clone()
|
api_envT.Append(CPPPATH = ['#Source/exehead']) # For api.h
|
||||||
api_uenv.Append(CPPPATH = ['#Source/exehead'])
|
lib = api_envT.Library(lib_targetT, lib_files)
|
||||||
libW = api_uenv.Library(lib_targetT, lib_files)
|
|
||||||
lib = libW
|
|
||||||
else:
|
|
||||||
api_env = plugin_env.Clone()
|
|
||||||
api_env.Append(CPPPATH = ['#Source/exehead'])
|
|
||||||
libA = api_env.Library(lib_targetT, lib_files)
|
|
||||||
lib = libA
|
|
||||||
|
|
||||||
# distribute library, files and examples
|
# distribute library, files and examples
|
||||||
|
|
||||||
|
if PerformPluginExtrasDistOperationOnce(plugin_envT, unicodetarget):
|
||||||
|
env.DistributeExamples(api_files, path='Plugin/nsis')
|
||||||
|
env.DistributeExamples(example, path='Plugin')
|
||||||
|
|
||||||
if env['PLATFORM'] == 'win32':
|
if env['PLATFORM'] == 'win32':
|
||||||
env.DistributeExamples(lib, path='Plugin/nsis')
|
env.DistributeExamples(lib, path='Plugin/nsis')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
example += lib_files
|
example += lib_files
|
||||||
|
|
||||||
|
@ -56,20 +58,14 @@ else:
|
||||||
if env.has_key('PREFIX_PLUGINAPI_LIB'):
|
if env.has_key('PREFIX_PLUGINAPI_LIB'):
|
||||||
env.Distribute(lib, None, 'pluginapi_lib', '', 'nsis', 'pluginapi', 'pluginapi')
|
env.Distribute(lib, None, 'pluginapi_lib', '', 'nsis', 'pluginapi', 'pluginapi')
|
||||||
|
|
||||||
if not unicodetarget:
|
|
||||||
env.DistributeExamples(api_files, path='Plugin/nsis')
|
|
||||||
env.DistributeExamples(example, path='Plugin')
|
|
||||||
|
|
||||||
# make sure all the other plug-ins can use the library
|
# make sure all the other plug-ins can use the library
|
||||||
|
|
||||||
if unicodetarget:
|
if PerformPluginExtrasDistOperationOnce(plugin_envT, unicodetarget):
|
||||||
envT = plugin_uenv
|
env.Install('#$BUILD_PREFIX/api/nsis', api_files)
|
||||||
env.Install('#$BUILD_PREFIX/api/nsis', libW)
|
|
||||||
else:
|
|
||||||
envT = plugin_env
|
|
||||||
env.Install('#$BUILD_PREFIX/api/nsis', api_files + libA)
|
|
||||||
|
|
||||||
envT.Append(CPPPATH = ['#$BUILD_PREFIX/api'])
|
env.Install('#$BUILD_PREFIX/api/nsis', lib)
|
||||||
envT.Append(LIBPATH = ['#$BUILD_PREFIX/api/nsis'])
|
plugin_envT.Append(CPPPATH = ['#$BUILD_PREFIX/api'])
|
||||||
envT.Append(LIBS = [lib_targetT])
|
plugin_envT.Append(LIBPATH = ['#$BUILD_PREFIX/api/nsis'])
|
||||||
|
plugin_envT.Append(LIBS = [lib_targetT])
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ void __declspec(dllexport) myFunction(HWND hwndParent, int string_size,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
g_hInstance=hInst;
|
g_hInstance=hInst;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -22,19 +22,25 @@
|
||||||
#define _T(x) __T(x)
|
#define _T(x) __T(x)
|
||||||
#define _TEXT(x) __T(x)
|
#define _TEXT(x) __T(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _TCHAR_DEFINED
|
||||||
|
#define _TCHAR_DEFINED
|
||||||
|
#if !defined(_NATIVE_WCHAR_T_DEFINED) && !defined(_WCHAR_T_DEFINED)
|
||||||
|
typedef unsigned short TCHAR;
|
||||||
|
#else
|
||||||
typedef wchar_t TCHAR;
|
typedef wchar_t TCHAR;
|
||||||
typedef wchar_t _TUCHAR;
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// program
|
// program
|
||||||
#define _tmain wmain
|
|
||||||
#define _tWinMain wWinMain
|
|
||||||
#define _tenviron _wenviron
|
#define _tenviron _wenviron
|
||||||
#define __targv __wargv
|
#define __targv __wargv
|
||||||
|
|
||||||
// printfs
|
// printfs
|
||||||
#define _ftprintf fwprintf
|
#define _ftprintf fwprintf
|
||||||
#define _sntprintf _snwprintf
|
#define _sntprintf _snwprintf
|
||||||
#if defined(_MSC_VER) && (_MSC_VER<=1200)
|
#if (defined(_MSC_VER) && (_MSC_VER<=1310)) || defined(__MINGW32__)
|
||||||
# define _stprintf swprintf
|
# define _stprintf swprintf
|
||||||
#else
|
#else
|
||||||
# define _stprintf _swprintf
|
# define _stprintf _swprintf
|
||||||
|
@ -42,7 +48,11 @@ typedef wchar_t _TUCHAR;
|
||||||
#define _tprintf wprintf
|
#define _tprintf wprintf
|
||||||
#define _vftprintf vfwprintf
|
#define _vftprintf vfwprintf
|
||||||
#define _vsntprintf _vsnwprintf
|
#define _vsntprintf _vsnwprintf
|
||||||
#define _vstprintf _vswprintf
|
#if defined(_MSC_VER) && (_MSC_VER<=1310)
|
||||||
|
# define _vstprintf vswprintf
|
||||||
|
#else
|
||||||
|
# define _vstprintf _vswprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
// scanfs
|
// scanfs
|
||||||
#define _tscanf wscanf
|
#define _tscanf wscanf
|
||||||
|
@ -119,12 +129,13 @@ typedef wchar_t _TUCHAR;
|
||||||
#define _T(x) x
|
#define _T(x) x
|
||||||
#define _TEXT(x) x
|
#define _TEXT(x) x
|
||||||
#endif
|
#endif
|
||||||
typedef char TCHAR;
|
|
||||||
typedef unsigned char _TUCHAR;
|
#ifndef _TCHAR_DEFINED
|
||||||
|
#define _TCHAR_DEFINED
|
||||||
|
typedef char TCHAR;
|
||||||
|
#endif
|
||||||
|
|
||||||
// program
|
// program
|
||||||
#define _tmain main
|
|
||||||
#define _tWinMain WinMain
|
|
||||||
#define _tenviron environ
|
#define _tenviron environ
|
||||||
#define __targv __argv
|
#define __targv __argv
|
||||||
|
|
||||||
|
|
|
@ -656,11 +656,11 @@ LRESULT WINAPI WMCommandProc(HWND hWnd, UINT id, HWND hwndCtl, UINT codeNotify)
|
||||||
LPSHELLFOLDER sf;
|
LPSHELLFOLDER sf;
|
||||||
ULONG eaten;
|
ULONG eaten;
|
||||||
LPITEMIDLIST root;
|
LPITEMIDLIST root;
|
||||||
int ccRoot = (lstrlen(pField->pszRoot) * 2) + 2;
|
|
||||||
SHGetDesktopFolder(&sf);
|
SHGetDesktopFolder(&sf);
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
sf->ParseDisplayName(hConfigWindow, NULL, pField->pszRoot, &eaten, &root, NULL);
|
sf->ParseDisplayName(hConfigWindow, NULL, pField->pszRoot, &eaten, &root, NULL);
|
||||||
#else
|
#else
|
||||||
|
int ccRoot = (lstrlen(pField->pszRoot) * 2) + 2;
|
||||||
LPWSTR pwszRoot = (LPWSTR) MALLOC(ccRoot);
|
LPWSTR pwszRoot = (LPWSTR) MALLOC(ccRoot);
|
||||||
MultiByteToWideChar(CP_ACP, 0, pField->pszRoot, -1, pwszRoot, ccRoot);
|
MultiByteToWideChar(CP_ACP, 0, pField->pszRoot, -1, pwszRoot, ccRoot);
|
||||||
sf->ParseDisplayName(hConfigWindow, NULL, pwszRoot, &eaten, &root, NULL);
|
sf->ParseDisplayName(hConfigWindow, NULL, pwszRoot, &eaten, &root, NULL);
|
||||||
|
@ -1592,9 +1592,9 @@ extern "C" void __declspec(dllexport) show(HWND hwndParent, int string_size,
|
||||||
showCfgDlg();
|
showCfgDlg();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
extern "C" BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
m_hInstance=(HINSTANCE) hInst;
|
m_hInstance=hInst;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,7 @@ void __declspec(dllexport) LangDialog(HWND hwndParent, int string_size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
g_hInstance=hInst;
|
g_hInstance=hInst;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -80,6 +80,7 @@ int GetTLBVersion(tstring& filepath, DWORD& high, DWORD & low)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSIS_ENTRYPOINT_TMAIN
|
||||||
int _tmain(int argc, TCHAR* argv[])
|
int _tmain(int argc, TCHAR* argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// Unicode support by Jim Park & Olivier Marcoux
|
// Unicode support by Jim Park & Olivier Marcoux
|
||||||
|
|
||||||
|
#include "../../../Source/Platform.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
|
|
||||||
|
@ -15,7 +16,8 @@ void RegDll(TCHAR *file);
|
||||||
void RegTypeLib(TCHAR *file);
|
void RegTypeLib(TCHAR *file);
|
||||||
void DeleteFileOnReboot(TCHAR *pszFile);
|
void DeleteFileOnReboot(TCHAR *pszFile);
|
||||||
|
|
||||||
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
|
NSIS_ENTRYPOINT_GUINOCRT
|
||||||
|
EXTERN_C void NSISWinMainNOCRT()
|
||||||
{
|
{
|
||||||
TCHAR *cmdline;
|
TCHAR *cmdline;
|
||||||
TCHAR seekchar = _T(' ');
|
TCHAR seekchar = _T(' ');
|
||||||
|
@ -33,7 +35,6 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
|
||||||
if (*cmdline++ != _T('/'))
|
if (*cmdline++ != _T('/'))
|
||||||
{
|
{
|
||||||
ExitProcess(1);
|
ExitProcess(1);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*cmdline == _T('S'))
|
if (*cmdline == _T('S'))
|
||||||
|
@ -113,7 +114,6 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
|
||||||
}
|
}
|
||||||
|
|
||||||
ExitProcess(0);
|
ExitProcess(0);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SafeWow64EnableWow64FsRedirection(BOOL Wow64FsEnableRedirection)
|
void SafeWow64EnableWow64FsRedirection(BOOL Wow64FsEnableRedirection)
|
||||||
|
|
|
@ -13,6 +13,5 @@ libs = Split("""
|
||||||
""")
|
""")
|
||||||
|
|
||||||
Import('BuildUtil')
|
Import('BuildUtil')
|
||||||
Import('_tWinMain')
|
|
||||||
|
|
||||||
BuildUtil(target, files, libs, entry = _tWinMain, nodeflib = True, file_name = 'RegTool.bin')
|
BuildUtil(target, files, libs, entry = 'NSISWinMainNOCRT', nodeflib = True, file_name = 'RegTool.bin')
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#define NSISFunction(funcname) extern "C" void __declspec(dllexport) funcname(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
|
#define NSISFunction(funcname) extern "C" void __declspec(dllexport) funcname(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
|
||||||
|
|
||||||
extern "C" BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) {
|
extern "C" BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
// Unicode support by Jim Park -- 08/23/2007
|
// Unicode support by Jim Park -- 08/23/2007
|
||||||
|
|
||||||
#include <windows.h>
|
#include "../../Source/Platform.h"
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include "../ExDLL/nsis_tchar.h"
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
#define CBL(x) {x,_T(#x)}
|
#define CBL(x) {x,_T(#x)}
|
||||||
|
@ -231,10 +230,8 @@ BOOL CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int APIENTRY _tWinMain(HINSTANCE hInstance,
|
NSIS_ENTRYPOINT_GUINOCRT
|
||||||
HINSTANCE hPrevInstance,
|
EXTERN_C void NSISWinMainNOCRT()
|
||||||
LPTSTR lpCmdLine,
|
|
||||||
int nCmdShow)
|
|
||||||
{
|
{
|
||||||
InitCommonControls();
|
InitCommonControls();
|
||||||
|
|
||||||
|
@ -246,6 +243,5 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
);
|
);
|
||||||
|
|
||||||
ExitProcess(0);
|
ExitProcess(0);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ libs = Split("""
|
||||||
""")
|
""")
|
||||||
|
|
||||||
Import('BuildUtil')
|
Import('BuildUtil')
|
||||||
Import('_tWinMain')
|
|
||||||
|
|
||||||
BuildUtil(target, files, libs, res = res, resources = resources, entry = _tWinMain)
|
BuildUtil(target, files, libs, res = res, resources = resources, entry = 'NSISWinMainNOCRT')
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ docs = Split("""
|
||||||
""")
|
""")
|
||||||
|
|
||||||
Import('BuildUtil')
|
Import('BuildUtil')
|
||||||
Import('_tWinMain')
|
|
||||||
|
|
||||||
BuildUtil(
|
BuildUtil(
|
||||||
target,
|
target,
|
||||||
|
@ -53,7 +52,7 @@ BuildUtil(
|
||||||
libs,
|
libs,
|
||||||
res = res,
|
res = res,
|
||||||
resources = resources,
|
resources = resources,
|
||||||
entry = _tWinMain,
|
entry = None,
|
||||||
defines = ['RELEASE=2.3'],
|
defines = ['RELEASE=2.3'],
|
||||||
docs = docs,
|
docs = docs,
|
||||||
root_util = True
|
root_util = True
|
||||||
|
|
|
@ -42,7 +42,8 @@ NFINDREPLACE g_find;
|
||||||
extern NTOOLBAR g_toolbar;
|
extern NTOOLBAR g_toolbar;
|
||||||
int g_symbol_set_mode;
|
int g_symbol_set_mode;
|
||||||
|
|
||||||
int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, TCHAR *cmdParam, int cmdShow) {
|
NSIS_ENTRYPOINT_SIMPLEGUI
|
||||||
|
int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hOldInst,LPTSTR CmdLineParams,int ShowCmd) {
|
||||||
MSG msg;
|
MSG msg;
|
||||||
int status;
|
int status;
|
||||||
HACCEL haccel;
|
HACCEL haccel;
|
||||||
|
@ -50,7 +51,7 @@ int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, TCHAR *cmdParam, int
|
||||||
memset(&g_sdata,0,sizeof(NSCRIPTDATA));
|
memset(&g_sdata,0,sizeof(NSCRIPTDATA));
|
||||||
memset(&g_resize,0,sizeof(NRESIZEDATA));
|
memset(&g_resize,0,sizeof(NRESIZEDATA));
|
||||||
memset(&g_find,0,sizeof(NFINDREPLACE));
|
memset(&g_find,0,sizeof(NFINDREPLACE));
|
||||||
g_sdata.hInstance=GetModuleHandle(0);
|
g_sdata.hInstance=hInst;
|
||||||
g_sdata.symbols = NULL;
|
g_sdata.symbols = NULL;
|
||||||
g_sdata.sigint_event = CreateEvent(NULL, FALSE, FALSE, _T("makensis win32 signint event"));
|
g_sdata.sigint_event = CreateEvent(NULL, FALSE, FALSE, _T("makensis win32 signint event"));
|
||||||
RestoreSymbols();
|
RestoreSymbols();
|
||||||
|
@ -84,7 +85,6 @@ int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, TCHAR *cmdParam, int
|
||||||
if (g_sdata.sigint_event) CloseHandle(g_sdata.sigint_event);
|
if (g_sdata.sigint_event) CloseHandle(g_sdata.sigint_event);
|
||||||
FreeLibrary(hRichEditDLL);
|
FreeLibrary(hRichEditDLL);
|
||||||
FinalizeUpdate();
|
FinalizeUpdate();
|
||||||
ExitProcess(msg.wParam);
|
|
||||||
return msg.wParam;
|
return msg.wParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
#define MAKENSIS_H
|
#define MAKENSIS_H
|
||||||
|
|
||||||
#define _WIN32_IE 0x0400
|
#define _WIN32_IE 0x0400
|
||||||
|
#include "../../Source/Platform.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include "../ExDLL/nsis_tchar.h"
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#define _RICHEDIT_VER 0x0200
|
#define _RICHEDIT_VER 0x0200
|
||||||
#include <richedit.h>
|
#include <richedit.h>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
#define NSIS_UPDATE "http://nsis.sourceforge.net/update.php?version="
|
#define NSIS_UPDATE "http://nsis.sourceforge.net/update.php?version="
|
||||||
#define NSIS_DL_URL "http://nsis.sourceforge.net/download/"
|
#define NSIS_DL_URL "http://nsis.sourceforge.net/download/"
|
||||||
#define USAGE _T("Usage:\r\n\r\n - File | Load Script...\r\n - Drag the .nsi file into this window\r\n - Right click the .nsi file and choose \"Compile NSIS Script\"")
|
#define USAGE _T("Usage:\r\n\r\n - File | Load Script...\r\n - Drag the .nsi file into this window\r\n - Right click the .nsi file and choose \"Compile NSIS Script\"")
|
||||||
#define COPYRIGHT _T("Copyright © 2002 Robert Rainwater")
|
#define COPYRIGHT _T("Copyright (C) 2002 Robert Rainwater")
|
||||||
#define CONTRIB _T("Fritz Elfert, Justin Frankel, Amir Szekely, Sunil Kamath, Joost Verburg")
|
#define CONTRIB _T("Fritz Elfert, Justin Frankel, Amir Szekely, Sunil Kamath, Joost Verburg")
|
||||||
#define DOCPATH "http://nsis.sourceforge.net/Docs/"
|
#define DOCPATH "http://nsis.sourceforge.net/Docs/"
|
||||||
#define LOCALDOCS _T("\\NSIS.chm")
|
#define LOCALDOCS _T("\\NSIS.chm")
|
||||||
|
@ -144,7 +144,6 @@ int compressor_strings[] = {IDS_SCRIPT,
|
||||||
|
|
||||||
extern const TCHAR* NSISW_VERSION;
|
extern const TCHAR* NSISW_VERSION;
|
||||||
|
|
||||||
int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, TCHAR *cmdParam, int cmdShow);
|
|
||||||
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
DWORD WINAPI MakeNSISProc(LPVOID p);
|
DWORD WINAPI MakeNSISProc(LPVOID p);
|
||||||
BOOL CALLBACK DialogResize(HWND hWnd, LPARAM /* unused*/);
|
BOOL CALLBACK DialogResize(HWND hWnd, LPARAM /* unused*/);
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
Unicode support by Jim Park -- 08/17/2007
|
Unicode support by Jim Park -- 08/17/2007
|
||||||
*/
|
*/
|
||||||
#include "makensisw.h"
|
#include "makensisw.h"
|
||||||
#define REALSTR(x) #x
|
#define TSTRINGIFY_(x) _T(#x)
|
||||||
#define STR(x) REALSTR(x)
|
#define TSTRINGIFY(x) TSTRINGIFY_(x)
|
||||||
|
|
||||||
#ifdef RELEASE
|
#ifdef RELEASE
|
||||||
const TCHAR *NSISW_VERSION = _T("MakeNSISW ") _T(STR(RELEASE)) _T(" (NSIS Compiler Interface)");
|
const TCHAR *NSISW_VERSION = _T("MakeNSISW ") TSTRINGIFY(RELEASE) _T(" (NSIS Compiler Interface)");
|
||||||
#else
|
#else
|
||||||
const TCHAR *NSISW_VERSION = _T("MakeNSISW ") __TDATE__;
|
const TCHAR *NSISW_VERSION = _T("MakeNSISW ") __TDATE__;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,10 +49,10 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||||
return DefWindowProc(hwnd,uMsg,wParam,lParam);
|
return DefWindowProc(hwnd,uMsg,wParam,lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
g_hInstance=hInst;
|
g_hInstance=hInst;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(dllexport) show(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
|
void __declspec(dllexport) show(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
|
||||||
|
|
|
@ -427,10 +427,10 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
g_hInstance=hInst;
|
g_hInstance=hInst;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddFolderFromReg(int nFolder)
|
void AddFolderFromReg(int nFolder)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1229,11 +1229,11 @@ failure is raised if _osplatform is not set. The assertion is reported by
|
||||||
the same means as used for the _RPT0 macro. This leads to an endless recursion.
|
the same means as used for the _RPT0 macro. This leads to an endless recursion.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
g_hInstance=(HINSTANCE)hInst;
|
g_hInstance=hInst;
|
||||||
|
|
||||||
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
|
if (DLL_PROCESS_ATTACH == fdwReason)
|
||||||
{
|
{
|
||||||
// change the protection of return command
|
// change the protection of return command
|
||||||
VirtualProtect(&retexpr, sizeof(retexpr), PAGE_EXECUTE_READWRITE, (PDWORD)&LastStackPlace);
|
VirtualProtect(&retexpr, sizeof(retexpr), PAGE_EXECUTE_READWRITE, (PDWORD)&LastStackPlace);
|
||||||
|
|
|
@ -18,10 +18,9 @@ libs = Split("""
|
||||||
""")
|
""")
|
||||||
|
|
||||||
Import('BuildUtil env')
|
Import('BuildUtil env')
|
||||||
Import('_tWinMain')
|
|
||||||
|
|
||||||
code = env.Object(code)
|
code = env.Object(code)
|
||||||
|
|
||||||
for ui in uis:
|
for ui in uis:
|
||||||
ui = BuildUtil(ui, [code], libs, entry = _tWinMain, res = ui + '.rc', contrib = True, path = 'UIs')
|
ui = BuildUtil(ui, [code], libs, res = ui + '.rc', contrib = True, path = 'UIs')
|
||||||
env.Alias('UIs', ui)
|
env.Alias('UIs', ui)
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
//
|
//
|
||||||
// Unicode support by Jim Park -- 08/10/2007
|
// Unicode support by Jim Park -- 08/10/2007
|
||||||
|
|
||||||
|
#include "../../Source/Platform.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include "../ExDLL/nsis_tchar.h"
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
HINSTANCE g_hInstance;
|
HINSTANCE g_hInstance;
|
||||||
HWND m_curwnd;
|
HWND m_curwnd;
|
||||||
|
|
||||||
TCHAR* windows[] = {
|
const TCHAR* windows[] = {
|
||||||
MAKEINTRESOURCE(IDD_LICENSE),
|
MAKEINTRESOURCE(IDD_LICENSE),
|
||||||
MAKEINTRESOURCE(IDD_SELCOM),
|
MAKEINTRESOURCE(IDD_SELCOM),
|
||||||
MAKEINTRESOURCE(IDD_DIR),
|
MAKEINTRESOURCE(IDD_DIR),
|
||||||
|
@ -76,29 +76,16 @@ BOOL CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int APIENTRY _tWinMain(HINSTANCE hInstance,
|
NSIS_ENTRYPOINT_SIMPLEGUI
|
||||||
HINSTANCE hPrevInstance,
|
int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hOldInst,LPTSTR CmdLineParams,int ShowCmd)
|
||||||
LPTSTR lpCmdLine,
|
|
||||||
int nCmdShow)
|
|
||||||
{
|
{
|
||||||
InitCommonControls();
|
InitCommonControls();
|
||||||
|
g_hInstance = hInst;
|
||||||
LoadLibrary(_T("RichEd32.dll"));
|
LoadLibrary(_T("RichEd32.dll"));
|
||||||
|
return DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_INST),0,DialogProc);
|
||||||
g_hInstance = GetModuleHandle(0);
|
|
||||||
|
|
||||||
DialogBox(
|
|
||||||
GetModuleHandle(0),
|
|
||||||
MAKEINTRESOURCE(IDD_INST),
|
|
||||||
0,
|
|
||||||
DialogProc
|
|
||||||
);
|
|
||||||
|
|
||||||
ExitProcess(0);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ void __declspec(dllexport) GetOriginalAccountType(HWND hwndParent, int string_si
|
||||||
pushstring(GetAccountTypeHelper(FALSE));
|
pushstring(GetAccountTypeHelper(FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,10 @@ inline bool ISSINGLESWITCHCHAR(const TCHAR c) { return ( OPT_CHAR==(c) || (OPT_C
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "../../../../Source/Platform.h"
|
||||||
|
NSIS_ENTRYPOINT_TMAIN
|
||||||
|
#endif
|
||||||
int _tmain( int argc, TCHAR * argv[] ) {
|
int _tmain( int argc, TCHAR * argv[] ) {
|
||||||
tout << _T("GenPat v3.1\n");
|
tout << _T("GenPat v3.1\n");
|
||||||
tout << _T("===========\n\n(c) 2001-2005 Van de Sande Productions\n");
|
tout << _T("===========\n\n(c) 2001-2005 Van de Sande Productions\n");
|
||||||
|
|
|
@ -174,7 +174,7 @@ void __declspec(dllexport) GetFileMD5(HWND hwndParent, int string_size,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) {
|
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) {
|
||||||
g_hInstance=hInst;
|
g_hInstance=hInst;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,8 +593,8 @@ void __declspec(dllexport) Show(HWND hwndParent, int string_size, TCHAR *variabl
|
||||||
SetWindowLongPtr(hwndParent, DWLP_DLGPROC, (LONG_PTR) g_dialog.parentOriginalWndproc);
|
SetWindowLongPtr(hwndParent, DWLP_DLGPROC, (LONG_PTR) g_dialog.parentOriginalWndproc);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
g_hInstance = (HINSTANCE) hInst;
|
g_hInstance = hInst;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ void ExecScript(BOOL log);
|
||||||
void LogMessage(const TCHAR *pStr, BOOL bOEM);
|
void LogMessage(const TCHAR *pStr, BOOL bOEM);
|
||||||
TCHAR *my_strstr(TCHAR *a, TCHAR *b);
|
TCHAR *my_strstr(TCHAR *a, TCHAR *b);
|
||||||
unsigned int my_atoi(TCHAR *s);
|
unsigned int my_atoi(TCHAR *s);
|
||||||
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow);
|
int WINAPI AsExeWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow);
|
||||||
|
|
||||||
void __declspec(dllexport) Exec(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop) {
|
void __declspec(dllexport) Exec(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop) {
|
||||||
g_hwndParent=hwndParent;
|
g_hwndParent=hwndParent;
|
||||||
|
@ -67,7 +67,7 @@ void __declspec(dllexport) ExecToStack(HWND hwndParent, int string_size, TCHAR *
|
||||||
}
|
}
|
||||||
|
|
||||||
HINSTANCE g_hInst;
|
HINSTANCE g_hInst;
|
||||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) {
|
BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) {
|
||||||
g_hInst = hInst;
|
g_hInst = hInst;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ void ExecScript(int log) {
|
||||||
// WinMain will have the address of the WinMain function in memory.
|
// WinMain will have the address of the WinMain function in memory.
|
||||||
// Getting the difference gets you the relative location of the
|
// Getting the difference gets you the relative location of the
|
||||||
// WinMain function.
|
// WinMain function.
|
||||||
pNTHeaders->OptionalHeader.AddressOfEntryPoint = (DWORD)_tWinMain - (DWORD)g_hInst;
|
pNTHeaders->OptionalHeader.AddressOfEntryPoint = (DWORD_PTR)AsExeWinMain - (DWORD_PTR)g_hInst;
|
||||||
UnmapViewOfFile(pMapView);
|
UnmapViewOfFile(pMapView);
|
||||||
}
|
}
|
||||||
CloseHandle(hMapping);
|
CloseHandle(hMapping);
|
||||||
|
@ -476,12 +476,12 @@ unsigned int my_atoi(TCHAR *s) {
|
||||||
return (int)v;
|
return (int)v;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
|
int WINAPI AsExeWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
|
||||||
{
|
{
|
||||||
DWORD Ret;
|
DWORD Ret;
|
||||||
STARTUPINFO si = {0};
|
STARTUPINFO si = {0};
|
||||||
PROCESS_INFORMATION pi = {0};
|
PROCESS_INFORMATION pi = {0};
|
||||||
TCHAR command_line[1024];
|
TCHAR command_line[1024]; //BUGBUG
|
||||||
TCHAR seekchar=_T(' ');
|
TCHAR seekchar=_T(' ');
|
||||||
TCHAR *cmdline;
|
TCHAR *cmdline;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
|
||||||
|
#include "../../Source/Platform.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -66,13 +68,12 @@ const TCHAR *g_options=_T("");//_T("/V3");
|
||||||
|
|
||||||
static BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static BOOL CALLBACK DlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,
|
NSIS_ENTRYPOINT_SIMPLEGUI
|
||||||
LPTSTR lpszCmdParam, int nCmdShow)
|
int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hOldInst,LPTSTR CmdLineParams,int ShowCmd)
|
||||||
{
|
{
|
||||||
g_hInstance=hInstance;
|
|
||||||
|
|
||||||
InitCommonControls();
|
InitCommonControls();
|
||||||
return DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG1),GetDesktopWindow(),DlgProc);
|
g_hInstance=hInst;
|
||||||
|
return DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_DIALOG1),0,DlgProc);
|
||||||
}
|
}
|
||||||
TCHAR tempzip_path[1024];
|
TCHAR tempzip_path[1024];
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,9 @@ Adds another include directory to the include directories list. This list is sea
|
||||||
|
|
||||||
\S1{addplugindir} !addplugindir
|
\S1{addplugindir} !addplugindir
|
||||||
|
|
||||||
\c directory
|
\c [/x86-ansi | /x86-unicode] directory
|
||||||
|
|
||||||
Causes the NSIS compiler to scan the given directory for plug-in DLLs.
|
Causes the NSIS compiler to scan the given directory for plug-in DLLs. If you don't specify the plug-in architecture it is assumed to match the current target architecture. If the architecture does not match the installer will probably crash!
|
||||||
|
|
||||||
\c !addplugindir myplugin
|
\c !addplugindir myplugin
|
||||||
\c MyPlugin::SomeFunction
|
\c MyPlugin::SomeFunction
|
||||||
|
|
|
@ -87,22 +87,11 @@ This command sets the overwrite flag which is used by the \R{file}{File} command
|
||||||
\c File program.cfg # config file we don't want to overwrite
|
\c File program.cfg # config file we don't want to overwrite
|
||||||
\c SetOverwrite on
|
\c SetOverwrite on
|
||||||
|
|
||||||
\S2{atargetminimalos} TargetMinimalOS
|
\S2{aunicodetarget} Unicode
|
||||||
|
|
||||||
\c X.Y
|
\c true|\\<b\\>false\\</b\\>
|
||||||
|
|
||||||
This command sets the minimal OS version of the target Windows system required in order to run the installer. This will NOT make the installer test for OS compatibility, but it will indicate which Windows APIs will be available for use by the installer program. The installer will not be able to execute on older systems.
|
Generate a \R{intro-unicode}{Unicode installer}. It can only be used outside of sections and functions and before any data is compressed.
|
||||||
|
|
||||||
In particular, if you indicate a minimal OS of 5.0 or more, MakeNSIS will generate a \R{intro-unicode}{Unicode installer} (as Windows 2000 and more recent are Unicode fully-compatible OSes).
|
|
||||||
|
|
||||||
|
|
||||||
\c TargetMinimalOS 4.0 ; target Windows 9x/NT4 or more recent (Default)
|
|
||||||
\c TargetMinimalOS 5.0 ; target Windows 2000 or more recent / make a Unicode installer
|
|
||||||
\c TargetMinimalOS 5.1 ; target Windows XP or more recent / make a Unicode installer
|
|
||||||
\c TargetMinimalOS 6.0 ; target Windows Vista or more recent / make a Unicode installer
|
|
||||||
\c TargetMinimalOS 6.1 ; target Windows Seven or more recent / make a Unicode installer
|
|
||||||
|
|
||||||
Check the various \W{http://msdn.microsoft.com/en-us/library/ms724833.aspx}{version numbers of Windows}.
|
|
||||||
|
|
||||||
\S1{versioninfo} Version Information
|
\S1{versioninfo} Version Information
|
||||||
|
|
||||||
|
|
|
@ -152,8 +152,8 @@ The NSIS script format and the format used for interface dialogs are easy, docum
|
||||||
|
|
||||||
\H{intro-unicode} Unicode installers
|
\H{intro-unicode} Unicode installers
|
||||||
|
|
||||||
Starting with MakeNSIS v?.??, you can choose to create Unicode installers by using \R{atargetminimalos}{TargetMinimalOS} with a value greater than or equal to 5.0.
|
Starting with MakeNSIS v3.0 you can choose to create Unicode installers by setting the \R{aunicodetarget}{Unicode} attribute.
|
||||||
These installers will work only under Windows 2000 or more recent (depending on the value you chose), but they will allow you to display your installer in any Unicode language supported by the OS.
|
These installers will not work on Windows 95/98/ME but they will allow you to display your installer in any Unicode language supported by the OS.
|
||||||
|
|
||||||
When building a Unicode installer, NSIS variables can hold Unicode characters (0000-FFFF). There should be no need to modify your existing scripts.
|
When building a Unicode installer, NSIS variables can hold Unicode characters (0000-FFFF). There should be no need to modify your existing scripts.
|
||||||
If you want to read/write Unicode files, specific instructions have been added to read/write UTF-16LE strings from/to disk.
|
If you want to read/write Unicode files, specific instructions have been added to read/write UTF-16LE strings from/to disk.
|
||||||
|
|
|
@ -7,7 +7,7 @@ The NSIS development kit installer sets up your computer so that you can compile
|
||||||
|
|
||||||
If you want to use MakeNSIS on the command line, the syntax of the makensis command is:
|
If you want to use MakeNSIS on the command line, the syntax of the makensis command is:
|
||||||
|
|
||||||
\c makensis [option | script.nsi | - [...]]
|
\c makensis [ option | script.nsi | - ] [...]
|
||||||
|
|
||||||
\S1{usagereference} Options
|
\S1{usagereference} Options
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
;NSIS Setup Script
|
;NSIS Setup Script
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
|
!ifdef VER_MAJOR & VER_MINOR
|
||||||
|
!define /ifndef VER_REVISION 0
|
||||||
|
!define /ifndef VER_BUILD 0
|
||||||
|
!endif
|
||||||
|
|
||||||
!ifndef VERSION
|
!ifndef VERSION
|
||||||
!define VERSION 'anonymous-build'
|
!define VERSION 'anonymous-build'
|
||||||
!endif
|
!endif
|
||||||
|
@ -14,6 +19,7 @@
|
||||||
OutFile ..\nsis-${VERSION}-setup.exe
|
OutFile ..\nsis-${VERSION}-setup.exe
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
Unicode true
|
||||||
SetCompressor /SOLID lzma
|
SetCompressor /SOLID lzma
|
||||||
|
|
||||||
InstType "Full"
|
InstType "Full"
|
||||||
|
@ -34,15 +40,6 @@ RequestExecutionLevel admin
|
||||||
!include "Memento.nsh"
|
!include "Memento.nsh"
|
||||||
!include "WordFunc.nsh"
|
!include "WordFunc.nsh"
|
||||||
|
|
||||||
;--------------------------------
|
|
||||||
;Functions
|
|
||||||
|
|
||||||
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
|
|
||||||
|
|
||||||
!insertmacro VersionCompare
|
|
||||||
|
|
||||||
!endif
|
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
;Definitions
|
;Definitions
|
||||||
|
|
||||||
|
@ -101,9 +98,23 @@ Page custom PageReinstall PageLeaveReinstall
|
||||||
|
|
||||||
!insertmacro MUI_LANGUAGE "English"
|
!insertmacro MUI_LANGUAGE "English"
|
||||||
|
|
||||||
|
;--------------------------------
|
||||||
|
;Version information
|
||||||
|
|
||||||
|
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
|
||||||
|
VIProductVersion ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_BUILD}
|
||||||
|
VIAddVersionKey "FileVersion" "${VERSION}"
|
||||||
|
VIAddVersionKey "FileDescription" "NSIS Setup"
|
||||||
|
!endif
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
;Installer Sections
|
;Installer Sections
|
||||||
|
|
||||||
|
!macro InstallPlugin pi
|
||||||
|
File "/oname=$InstDir\Plugins\x86-ansi\${pi}.dll" ..\Plugins\x86-ansi\${pi}.dll
|
||||||
|
File "/oname=$InstDir\Plugins\x86-unicode\${pi}.dll" ..\Plugins\x86-unicode\${pi}.dll
|
||||||
|
!macroend
|
||||||
|
|
||||||
${MementoSection} "NSIS Core Files (required)" SecCore
|
${MementoSection} "NSIS Core Files (required)" SecCore
|
||||||
|
|
||||||
SetDetailsPrint textonly
|
SetDetailsPrint textonly
|
||||||
|
@ -136,13 +147,18 @@ ${MementoSection} "NSIS Core Files (required)" SecCore
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Stubs
|
SetOutPath $INSTDIR\Stubs
|
||||||
File ..\Stubs\bzip2
|
|
||||||
File ..\Stubs\bzip2_solid
|
|
||||||
File ..\Stubs\lzma
|
|
||||||
File ..\Stubs\lzma_solid
|
|
||||||
File ..\Stubs\zlib
|
|
||||||
File ..\Stubs\zlib_solid
|
|
||||||
File ..\Stubs\uninst
|
File ..\Stubs\uninst
|
||||||
|
!macro InstallStub stub
|
||||||
|
File ..\Stubs\${stub}-x86-ansi
|
||||||
|
File ..\Stubs\${stub}-x86-unicode
|
||||||
|
!macroend
|
||||||
|
!insertmacro InstallStub bzip2
|
||||||
|
!insertmacro InstallStub bzip2_solid
|
||||||
|
!insertmacro InstallStub lzma
|
||||||
|
!insertmacro InstallStub lzma_solid
|
||||||
|
!insertmacro InstallStub zlib
|
||||||
|
!insertmacro InstallStub zlib_solid
|
||||||
|
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Include
|
SetOutPath $INSTDIR\Include
|
||||||
File ..\Include\WinMessages.nsh
|
File ..\Include\WinMessages.nsh
|
||||||
|
@ -198,8 +214,9 @@ ${MementoSection} "NSIS Core Files (required)" SecCore
|
||||||
File ..\Bin\LibraryLocal.exe
|
File ..\Bin\LibraryLocal.exe
|
||||||
File ..\Bin\RegTool.bin
|
File ..\Bin\RegTool.bin
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
CreateDirectory $INSTDIR\Plugins\x86-ansi
|
||||||
File ..\Plugins\TypeLib.dll
|
CreateDirectory $INSTDIR\Plugins\x86-unicode
|
||||||
|
!insertmacro InstallPlugin TypeLib
|
||||||
|
|
||||||
ReadRegStr $R0 HKCR ".nsi" ""
|
ReadRegStr $R0 HKCR ".nsi" ""
|
||||||
StrCmp $R0 "NSISFile" 0 +2
|
StrCmp $R0 "NSISFile" 0 +2
|
||||||
|
@ -284,7 +301,7 @@ ${MementoSection} "Script Examples" SecExample
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Examples\Plugin\nsis
|
SetOutPath $INSTDIR\Examples\Plugin\nsis
|
||||||
File ..\Examples\Plugin\nsis\pluginapi.h
|
File ..\Examples\Plugin\nsis\pluginapi.h
|
||||||
File /nonfatal ..\Examples\Plugin\nsis\pluginapi.lib
|
File /nonfatal ..\Examples\Plugin\nsis\pluginapi*.lib
|
||||||
File ..\Examples\Plugin\nsis\api.h
|
File ..\Examples\Plugin\nsis\api.h
|
||||||
File ..\Examples\Plugin\nsis\nsis_tchar.h
|
File ..\Examples\Plugin\nsis\nsis_tchar.h
|
||||||
|
|
||||||
|
@ -488,8 +505,7 @@ ${MementoSection} "Banner" SecPluginsBanner
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin Banner
|
||||||
File ..\Plugins\Banner.dll
|
|
||||||
SetOutPath $INSTDIR\Docs\Banner
|
SetOutPath $INSTDIR\Docs\Banner
|
||||||
File ..\Docs\Banner\Readme.txt
|
File ..\Docs\Banner\Readme.txt
|
||||||
SetOutPath $INSTDIR\Examples\Banner
|
SetOutPath $INSTDIR\Examples\Banner
|
||||||
|
@ -503,8 +519,7 @@ ${MementoSection} "Language DLL" SecPluginsLangDLL
|
||||||
SetDetailsPrint listonly
|
SetDetailsPrint listonly
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin LangDLL
|
||||||
File ..\Plugins\LangDLL.dll
|
|
||||||
${MementoSectionEnd}
|
${MementoSectionEnd}
|
||||||
|
|
||||||
${MementoSection} "nsExec" SecPluginsnsExec
|
${MementoSection} "nsExec" SecPluginsnsExec
|
||||||
|
@ -515,8 +530,7 @@ ${MementoSection} "nsExec" SecPluginsnsExec
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin nsExec
|
||||||
File ..\Plugins\nsExec.dll
|
|
||||||
SetOutPath $INSTDIR\Docs\nsExec
|
SetOutPath $INSTDIR\Docs\nsExec
|
||||||
File ..\Docs\nsExec\nsExec.txt
|
File ..\Docs\nsExec\nsExec.txt
|
||||||
SetOutPath $INSTDIR\Examples\nsExec
|
SetOutPath $INSTDIR\Examples\nsExec
|
||||||
|
@ -531,8 +545,7 @@ ${MementoSection} "Splash" SecPluginsSplash
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin splash
|
||||||
File ..\Plugins\splash.dll
|
|
||||||
SetOutPath $INSTDIR\Docs\Splash
|
SetOutPath $INSTDIR\Docs\Splash
|
||||||
File ..\Docs\Splash\splash.txt
|
File ..\Docs\Splash\splash.txt
|
||||||
SetOutPath $INSTDIR\Examples\Splash
|
SetOutPath $INSTDIR\Examples\Splash
|
||||||
|
@ -547,8 +560,7 @@ ${MementoSection} "AdvSplash" SecPluginsSplashT
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin advsplash
|
||||||
File ..\Plugins\advsplash.dll
|
|
||||||
SetOutPath $INSTDIR\Docs\AdvSplash
|
SetOutPath $INSTDIR\Docs\AdvSplash
|
||||||
File ..\Docs\AdvSplash\advsplash.txt
|
File ..\Docs\AdvSplash\advsplash.txt
|
||||||
SetOutPath $INSTDIR\Examples\AdvSplash
|
SetOutPath $INSTDIR\Examples\AdvSplash
|
||||||
|
@ -563,8 +575,7 @@ ${MementoSection} "BgImage" SecPluginsBgImage
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin BgImage
|
||||||
File ..\Plugins\BgImage.dll
|
|
||||||
SetOutPath $INSTDIR\Docs\BgImage
|
SetOutPath $INSTDIR\Docs\BgImage
|
||||||
File ..\Docs\BgImage\BgImage.txt
|
File ..\Docs\BgImage\BgImage.txt
|
||||||
SetOutPath $INSTDIR\Examples\BgImage
|
SetOutPath $INSTDIR\Examples\BgImage
|
||||||
|
@ -579,8 +590,7 @@ ${MementoSection} "InstallOptions" SecPluginsIO
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin InstallOptions
|
||||||
File ..\Plugins\InstallOptions.dll
|
|
||||||
SetOutPath $INSTDIR\Docs\InstallOptions
|
SetOutPath $INSTDIR\Docs\InstallOptions
|
||||||
File ..\Docs\InstallOptions\Readme.html
|
File ..\Docs\InstallOptions\Readme.html
|
||||||
File ..\Docs\InstallOptions\Changelog.txt
|
File ..\Docs\InstallOptions\Changelog.txt
|
||||||
|
@ -603,8 +613,7 @@ ${MementoSection} "nsDialogs" SecPluginsDialogs
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin nsDialogs
|
||||||
File ..\Plugins\nsDialogs.dll
|
|
||||||
SetOutPath $INSTDIR\Examples\nsDialogs
|
SetOutPath $INSTDIR\Examples\nsDialogs
|
||||||
File ..\Examples\nsDialogs\example.nsi
|
File ..\Examples\nsDialogs\example.nsi
|
||||||
File ..\Examples\nsDialogs\InstallOptions.nsi
|
File ..\Examples\nsDialogs\InstallOptions.nsi
|
||||||
|
@ -624,8 +633,7 @@ ${MementoSection} "Math" SecPluginsMath
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin Math
|
||||||
File ..\Plugins\Math.dll
|
|
||||||
SetOutPath $INSTDIR\Docs\Math
|
SetOutPath $INSTDIR\Docs\Math
|
||||||
File ..\Docs\Math\Math.txt
|
File ..\Docs\Math\Math.txt
|
||||||
SetOutPath $INSTDIR\Examples\Math
|
SetOutPath $INSTDIR\Examples\Math
|
||||||
|
@ -644,8 +652,7 @@ ${MementoSection} "NSISdl" SecPluginsNSISDL
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin nsisdl
|
||||||
File ..\Plugins\nsisdl.dll
|
|
||||||
SetOutPath $INSTDIR\Docs\NSISdl
|
SetOutPath $INSTDIR\Docs\NSISdl
|
||||||
File ..\Docs\NSISdl\ReadMe.txt
|
File ..\Docs\NSISdl\ReadMe.txt
|
||||||
File ..\Docs\NSISdl\License.txt
|
File ..\Docs\NSISdl\License.txt
|
||||||
|
@ -659,8 +666,7 @@ ${MementoSection} "System" SecPluginsSystem
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin System
|
||||||
File ..\Plugins\System.dll
|
|
||||||
SetOutPath $INSTDIR\Docs\System
|
SetOutPath $INSTDIR\Docs\System
|
||||||
File ..\Docs\System\System.html
|
File ..\Docs\System\System.html
|
||||||
File ..\Docs\System\WhatsNew.txt
|
File ..\Docs\System\WhatsNew.txt
|
||||||
|
@ -679,8 +685,7 @@ ${MementoSection} "StartMenu" SecPluginsStartMenu
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin StartMenu
|
||||||
File ..\Plugins\StartMenu.dll
|
|
||||||
SetOutPath $INSTDIR\Docs\StartMenu
|
SetOutPath $INSTDIR\Docs\StartMenu
|
||||||
File ..\Docs\StartMenu\Readme.txt
|
File ..\Docs\StartMenu\Readme.txt
|
||||||
SetOutPath $INSTDIR\Examples\StartMenu
|
SetOutPath $INSTDIR\Examples\StartMenu
|
||||||
|
@ -695,8 +700,7 @@ ${MementoSection} "UserInfo" SecPluginsUserInfo
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin UserInfo
|
||||||
File ..\Plugins\UserInfo.dll
|
|
||||||
SetOutPath $INSTDIR\Examples\UserInfo
|
SetOutPath $INSTDIR\Examples\UserInfo
|
||||||
File ..\Examples\UserInfo\UserInfo.nsi
|
File ..\Examples\UserInfo\UserInfo.nsi
|
||||||
${MementoSectionEnd}
|
${MementoSectionEnd}
|
||||||
|
@ -709,8 +713,7 @@ ${MementoSection} "Dialer" SecPluginsDialer
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin Dialer
|
||||||
File ..\Plugins\Dialer.dll
|
|
||||||
SetOutPath $INSTDIR\Docs\Dialer
|
SetOutPath $INSTDIR\Docs\Dialer
|
||||||
File ..\Docs\Dialer\Dialer.txt
|
File ..\Docs\Dialer\Dialer.txt
|
||||||
${MementoSectionEnd}
|
${MementoSectionEnd}
|
||||||
|
@ -723,8 +726,7 @@ ${MementoSection} "VPatch" SecPluginsVPatch
|
||||||
|
|
||||||
SectionIn 1
|
SectionIn 1
|
||||||
|
|
||||||
SetOutPath $INSTDIR\Plugins
|
!insertmacro InstallPlugin VPatch
|
||||||
File ..\Plugins\VPatch.dll
|
|
||||||
SetOutPath $INSTDIR\Examples\VPatch
|
SetOutPath $INSTDIR\Examples\VPatch
|
||||||
File ..\Examples\VPatch\example.nsi
|
File ..\Examples\VPatch\example.nsi
|
||||||
File ..\Examples\VPatch\oldfile.txt
|
File ..\Examples\VPatch\oldfile.txt
|
||||||
|
@ -807,7 +809,7 @@ Section -post
|
||||||
WriteRegStr HKLM "${MEMENTO_REGISTRY_KEY}" "DisplayVersion" "${VERSION}"
|
WriteRegStr HKLM "${MEMENTO_REGISTRY_KEY}" "DisplayVersion" "${VERSION}"
|
||||||
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
|
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
|
||||||
WriteRegDWORD HKLM "${MEMENTO_REGISTRY_KEY}" "VersionMajor" "${VER_MAJOR}"
|
WriteRegDWORD HKLM "${MEMENTO_REGISTRY_KEY}" "VersionMajor" "${VER_MAJOR}"
|
||||||
WriteRegDWORD HKLM "${MEMENTO_REGISTRY_KEY}" "VersionMinor" "${VER_MINOR}.${VER_REVISION}"
|
WriteRegDWORD HKLM "${MEMENTO_REGISTRY_KEY}" "VersionMinor" "${VER_MINOR}"
|
||||||
!endif
|
!endif
|
||||||
WriteRegStr HKLM "${MEMENTO_REGISTRY_KEY}" "URLInfoAbout" "http://nsis.sourceforge.net/"
|
WriteRegStr HKLM "${MEMENTO_REGISTRY_KEY}" "URLInfoAbout" "http://nsis.sourceforge.net/"
|
||||||
WriteRegStr HKLM "${MEMENTO_REGISTRY_KEY}" "HelpLink" "http://nsis.sourceforge.net/Support"
|
WriteRegStr HKLM "${MEMENTO_REGISTRY_KEY}" "HelpLink" "http://nsis.sourceforge.net/Support"
|
||||||
|
@ -871,15 +873,15 @@ Var ReinstallPageCheck
|
||||||
Function PageReinstall
|
Function PageReinstall
|
||||||
|
|
||||||
ReadRegStr $R0 HKLM "Software\NSIS" ""
|
ReadRegStr $R0 HKLM "Software\NSIS" ""
|
||||||
|
ReadRegStr $R1 HKLM "${MEMENTO_REGISTRY_KEY}" "UninstallString"
|
||||||
|
${IfThen} "$R0$R1" == "" ${|} Abort ${|}
|
||||||
|
|
||||||
${If} $R0 == ""
|
StrCpy $R4 "older"
|
||||||
Abort
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
ReadRegDWORD $R0 HKLM "Software\NSIS" "VersionMajor"
|
ReadRegDWORD $R0 HKLM "Software\NSIS" "VersionMajor"
|
||||||
ReadRegDWORD $R1 HKLM "Software\NSIS" "VersionMinor"
|
ReadRegDWORD $R1 HKLM "Software\NSIS" "VersionMinor"
|
||||||
ReadRegDWORD $R2 HKLM "Software\NSIS" "VersionRevision"
|
ReadRegDWORD $R2 HKLM "Software\NSIS" "VersionRevision"
|
||||||
ReadRegDWORD $R3 HKLM "Software\NSIS" "VersionBuild"
|
ReadRegDWORD $R3 HKLM "Software\NSIS" "VersionBuild"
|
||||||
|
${IfThen} $R0 = 0 ${|} StrCpy $R4 "unknown" ${|} ; Anonymous builds have no version number
|
||||||
StrCpy $R0 $R0.$R1.$R2.$R3
|
StrCpy $R0 $R0.$R1.$R2.$R3
|
||||||
|
|
||||||
${VersionCompare} ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_BUILD} $R0 $R0
|
${VersionCompare} ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_BUILD} $R0 $R0
|
||||||
|
@ -890,7 +892,7 @@ Function PageReinstall
|
||||||
!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
|
!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
|
||||||
StrCpy $R0 "2"
|
StrCpy $R0 "2"
|
||||||
${ElseIf} $R0 == 1
|
${ElseIf} $R0 == 1
|
||||||
StrCpy $R1 "An older version of NSIS is installed on your system. It's recommended that you uninstall the current version before installing. Select the operation you want to perform and click Next to continue."
|
StrCpy $R1 "An $R4 version of NSIS is installed on your system. It's recommended that you uninstall the current version before installing. Select the operation you want to perform and click Next to continue."
|
||||||
StrCpy $R2 "Uninstall before installing"
|
StrCpy $R2 "Uninstall before installing"
|
||||||
StrCpy $R3 "Do not uninstall"
|
StrCpy $R3 "Do not uninstall"
|
||||||
!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install NSIS."
|
!insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install NSIS."
|
||||||
|
@ -952,31 +954,36 @@ Function PageLeaveReinstall
|
||||||
StrCmp $R0 "1" 0 +2
|
StrCmp $R0 "1" 0 +2
|
||||||
StrCmp $R1 "1" reinst_uninstall reinst_done
|
StrCmp $R1 "1" reinst_uninstall reinst_done
|
||||||
|
|
||||||
StrCmp $R0 "2" 0 +3
|
StrCmp $R0 "2" 0 reinst_done
|
||||||
StrCmp $R1 "1" reinst_done reinst_uninstall
|
StrCmp $R1 "1" reinst_done reinst_uninstall
|
||||||
|
|
||||||
reinst_uninstall:
|
reinst_uninstall:
|
||||||
ReadRegStr $R1 HKLM "${MEMENTO_REGISTRY_KEY}" "UninstallString"
|
ReadRegStr $R1 HKLM "${MEMENTO_REGISTRY_KEY}" "UninstallString"
|
||||||
|
|
||||||
;Run uninstaller
|
;Run uninstaller
|
||||||
HideWindow
|
HideWindow
|
||||||
|
|
||||||
ClearErrors
|
ClearErrors
|
||||||
ExecWait '$R1 _?=$INSTDIR'
|
ExecWait '$R1 _?=$INSTDIR'
|
||||||
|
|
||||||
|
BringToFront
|
||||||
|
|
||||||
IfErrors no_remove_uninstaller
|
IfErrors no_remove_uninstaller
|
||||||
IfFileExists "$INSTDIR\Bin\makensis.exe" no_remove_uninstaller
|
IfFileExists "$INSTDIR\Bin\makensis.exe" no_remove_uninstaller
|
||||||
|
|
||||||
Delete $R1
|
Delete $R1
|
||||||
RMDir $INSTDIR
|
RMDir $INSTDIR
|
||||||
|
StrCpy $R1 ""
|
||||||
|
|
||||||
no_remove_uninstaller:
|
no_remove_uninstaller:
|
||||||
|
|
||||||
|
StrCmp "" $R1 0 +3
|
||||||
|
MessageBox MB_ICONEXCLAMATION "Unable to uninstall!"
|
||||||
|
Abort
|
||||||
|
|
||||||
StrCmp $R0 "2" 0 +2
|
StrCmp $R0 "2" 0 +2
|
||||||
Quit
|
Quit
|
||||||
|
|
||||||
BringToFront
|
|
||||||
|
|
||||||
reinst_done:
|
reinst_done:
|
||||||
|
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
|
@ -4,7 +4,7 @@ Import('defenv')
|
||||||
|
|
||||||
### flags
|
### flags
|
||||||
|
|
||||||
defenv['ENTRY_FLAG'] = lambda x: ''
|
defenv['ENTRY_FLAG'] = lambda x,u: ''
|
||||||
defenv['MAP_FLAG'] = ''
|
defenv['MAP_FLAG'] = ''
|
||||||
defenv['EXCEPTION_FLAG'] = ''
|
defenv['EXCEPTION_FLAG'] = ''
|
||||||
defenv['NODEFLIBS_FLAG'] = ''
|
defenv['NODEFLIBS_FLAG'] = ''
|
||||||
|
@ -12,6 +12,7 @@ defenv['C_FLAG'] = ''
|
||||||
defenv['CPP_FLAG'] = ''
|
defenv['CPP_FLAG'] = ''
|
||||||
defenv['CPP_REQUIRES_STDLIB'] = 0
|
defenv['CPP_REQUIRES_STDLIB'] = 0
|
||||||
defenv['SUBSYS_CON'] = ''
|
defenv['SUBSYS_CON'] = ''
|
||||||
|
defenv['SUBSYS_WIN'] = ''
|
||||||
defenv['MSVCRT_FLAG'] = ''
|
defenv['MSVCRT_FLAG'] = ''
|
||||||
defenv['STDCALL'] = ''
|
defenv['STDCALL'] = ''
|
||||||
|
|
||||||
|
@ -19,15 +20,23 @@ defenv['STDCALL'] = ''
|
||||||
|
|
||||||
defenv.Append(CPPDEFINES = [('NSISCALL', '$STDCALL')])
|
defenv.Append(CPPDEFINES = [('NSISCALL', '$STDCALL')])
|
||||||
|
|
||||||
|
### unicode
|
||||||
|
tdefenv = defenv.Clone()
|
||||||
|
if tdefenv['UNICODE']:
|
||||||
|
tdefenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||||
|
|
||||||
### stub environment
|
### stub environment
|
||||||
|
|
||||||
stub_env = defenv.Clone()
|
stub_env = defenv.Clone()
|
||||||
|
|
||||||
stub_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
stub_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||||
|
|
||||||
|
stub_uenv = stub_env.Clone()
|
||||||
|
stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||||
|
|
||||||
### makensis environment
|
### makensis environment
|
||||||
|
|
||||||
makensis_env = defenv.Clone()
|
makensis_env = tdefenv.Clone()
|
||||||
|
|
||||||
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||||
|
|
||||||
|
@ -35,13 +44,16 @@ makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||||
|
|
||||||
plugin_env = defenv.Clone(no_import_lib = 1)
|
plugin_env = defenv.Clone(no_import_lib = 1)
|
||||||
|
|
||||||
|
plugin_uenv = plugin_env.Clone()
|
||||||
|
plugin_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||||
|
|
||||||
### util environment
|
### util environment
|
||||||
|
|
||||||
util_env = defenv.Clone()
|
util_env = tdefenv.Clone()
|
||||||
|
|
||||||
### cross-platform util environment
|
### cross-platform util environment
|
||||||
|
|
||||||
cp_util_env = util_env.Clone()
|
cp_util_env = tdefenv.Clone()
|
||||||
|
|
||||||
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||||
|
|
||||||
|
@ -53,4 +65,4 @@ test_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||||
|
|
||||||
# return
|
# return
|
||||||
|
|
||||||
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_env plugin_env')
|
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_uenv plugin_uenv')
|
||||||
|
|
|
@ -14,9 +14,9 @@ def cross_env(env):
|
||||||
|
|
||||||
### flags
|
### flags
|
||||||
|
|
||||||
def entry(x):
|
def entry(x,u):
|
||||||
if x == 'WinMain':
|
if x == 'NSISWinMainNOCRT':
|
||||||
x = '_WinMain@16'
|
x = '_' + x
|
||||||
elif x == 'DllMain':
|
elif x == 'DllMain':
|
||||||
x = '_DllMain@12'
|
x = '_DllMain@12'
|
||||||
return '-Wl,-e%s' % x
|
return '-Wl,-e%s' % x
|
||||||
|
@ -30,6 +30,7 @@ defenv['CPP_FLAG'] = '-xc++'
|
||||||
defenv['ALIGN_FLAG'] = '-Wl,--file-alignment,512'
|
defenv['ALIGN_FLAG'] = '-Wl,--file-alignment,512'
|
||||||
defenv['CPP_REQUIRES_STDLIB'] = 1
|
defenv['CPP_REQUIRES_STDLIB'] = 1
|
||||||
defenv['SUBSYS_CON'] = '-Wl,--subsystem,console'
|
defenv['SUBSYS_CON'] = '-Wl,--subsystem,console'
|
||||||
|
defenv['SUBSYS_WIN'] = '-Wl,--subsystem,windows'
|
||||||
defenv['MSVCRT_FLAG'] = ''
|
defenv['MSVCRT_FLAG'] = ''
|
||||||
defenv['STDCALL'] = '"__attribute__((__stdcall__))"'
|
defenv['STDCALL'] = '"__attribute__((__stdcall__))"'
|
||||||
|
|
||||||
|
@ -66,6 +67,11 @@ def TestStrip(ctx):
|
||||||
if defenv['DEBUG']:
|
if defenv['DEBUG']:
|
||||||
defenv.Append(CCFLAGS = '-g')
|
defenv.Append(CCFLAGS = '-g')
|
||||||
|
|
||||||
|
### unicode
|
||||||
|
tdefenv = defenv.Clone()
|
||||||
|
if tdefenv['UNICODE']:
|
||||||
|
tdefenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||||
|
|
||||||
### stub environment
|
### stub environment
|
||||||
|
|
||||||
stub_env = defenv.Clone()
|
stub_env = defenv.Clone()
|
||||||
|
@ -84,12 +90,14 @@ if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_W32']:
|
||||||
stub_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables
|
stub_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables
|
||||||
stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no standard libraries
|
stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no standard libraries
|
||||||
stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
|
stub_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
|
||||||
stub_env.Append(LINKFLAGS = ['-Wl,-e,_WinMain@16']) # entry point
|
|
||||||
stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
|
stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
|
||||||
|
|
||||||
|
stub_uenv = stub_env.Clone()
|
||||||
|
stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||||
|
|
||||||
### makensis environment
|
### makensis environment
|
||||||
|
|
||||||
makensis_env = defenv.Clone()
|
makensis_env = tdefenv.Clone()
|
||||||
|
|
||||||
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||||
|
|
||||||
|
@ -122,12 +130,18 @@ plugin_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
|
||||||
plugin_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
|
plugin_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
|
||||||
plugin_env.Append(LINKFLAGS = ['-static-libgcc']) # remove libgcc*.dll dependency
|
plugin_env.Append(LINKFLAGS = ['-static-libgcc']) # remove libgcc*.dll dependency
|
||||||
|
|
||||||
|
plugin_uenv = plugin_env.Clone()
|
||||||
|
plugin_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||||
|
|
||||||
### cross-platform util environment
|
### cross-platform util environment
|
||||||
|
|
||||||
cp_util_env = defenv.Clone()
|
cp_util_env = tdefenv.Clone()
|
||||||
|
|
||||||
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||||
|
|
||||||
|
if cp_util_env['PLATFORM'] == 'win32':
|
||||||
|
cp_util_env.Append(LINKFLAGS = ['$ALIGN_FLAG'])
|
||||||
|
|
||||||
if not defenv['DEBUG']:
|
if not defenv['DEBUG']:
|
||||||
cp_util_env.Append(CCFLAGS = ['-O2']) # optimize
|
cp_util_env.Append(CCFLAGS = ['-O2']) # optimize
|
||||||
cp_util_env.Append(CCFLAGS = ['-Wall']) # all warnings
|
cp_util_env.Append(CCFLAGS = ['-Wall']) # all warnings
|
||||||
|
@ -145,6 +159,7 @@ cross_env(util_env)
|
||||||
util_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables
|
util_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables
|
||||||
util_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
|
util_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
|
||||||
|
|
||||||
|
|
||||||
conf = FlagsConfigure(util_env)
|
conf = FlagsConfigure(util_env)
|
||||||
if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_W32']:
|
if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_W32']:
|
||||||
util_env.Append(LINKFLAGS = ['-s']) # strip
|
util_env.Append(LINKFLAGS = ['-s']) # strip
|
||||||
|
@ -177,6 +192,8 @@ conf.Finish()
|
||||||
#
|
#
|
||||||
|
|
||||||
stub_env.Append(LINKFLAGS = ['-T', File('linker_script').rfile()])
|
stub_env.Append(LINKFLAGS = ['-T', File('linker_script').rfile()])
|
||||||
|
stub_uenv.Append(LINKFLAGS = ['-T', File('linker_script').rfile()])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# GCC requires some functions from the CRT to be present, if certain
|
# GCC requires some functions from the CRT to be present, if certain
|
||||||
|
@ -314,4 +331,4 @@ if makensis_env['PLATFORM'] == 'hpux':
|
||||||
|
|
||||||
### return
|
### return
|
||||||
|
|
||||||
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_env plugin_env')
|
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_uenv plugin_uenv')
|
||||||
|
|
|
@ -4,7 +4,7 @@ Import('defenv')
|
||||||
|
|
||||||
### flags
|
### flags
|
||||||
|
|
||||||
defenv['ENTRY_FLAG'] = lambda x: ''
|
defenv['ENTRY_FLAG'] = lambda x,u: ''
|
||||||
defenv['MAP_FLAG'] = ''
|
defenv['MAP_FLAG'] = ''
|
||||||
defenv['EXCEPTION_FLAG'] = ''
|
defenv['EXCEPTION_FLAG'] = ''
|
||||||
defenv['NODEFLIBS_FLAG'] = ''
|
defenv['NODEFLIBS_FLAG'] = ''
|
||||||
|
@ -12,6 +12,7 @@ defenv['C_FLAG'] = ''
|
||||||
defenv['CPP_FLAG'] = ''
|
defenv['CPP_FLAG'] = ''
|
||||||
defenv['CPP_REQUIRES_STDLIB'] = 0
|
defenv['CPP_REQUIRES_STDLIB'] = 0
|
||||||
defenv['SUBSYS_CON'] = ''
|
defenv['SUBSYS_CON'] = ''
|
||||||
|
defenv['SUBSYS_WIN'] = ''
|
||||||
defenv['MSVCRT_FLAG'] = ''
|
defenv['MSVCRT_FLAG'] = ''
|
||||||
defenv['STDCALL'] = ''
|
defenv['STDCALL'] = ''
|
||||||
|
|
||||||
|
@ -19,15 +20,22 @@ defenv['STDCALL'] = ''
|
||||||
|
|
||||||
defenv.Append(CPPDEFINES = [('NSISCALL', '$STDCALL')])
|
defenv.Append(CPPDEFINES = [('NSISCALL', '$STDCALL')])
|
||||||
|
|
||||||
|
### unicode
|
||||||
|
tdefenv = defenv.Clone()
|
||||||
|
if tdefenv['UNICODE']:
|
||||||
|
tdefenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||||
|
|
||||||
### stub environment
|
### stub environment
|
||||||
|
|
||||||
stub_env = defenv.Clone()
|
stub_env = defenv.Clone()
|
||||||
|
|
||||||
stub_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
stub_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||||
|
|
||||||
|
stub_uenv = stub_env.Clone()
|
||||||
|
stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||||
|
|
||||||
### makensis environment
|
### makensis environment
|
||||||
|
|
||||||
makensis_env = defenv.Clone()
|
makensis_env = tdefenv.Clone()
|
||||||
|
|
||||||
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
makensis_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||||
|
|
||||||
|
@ -107,13 +115,16 @@ makensis_conf.Finish()
|
||||||
|
|
||||||
plugin_env = defenv.Clone(no_import_lib = 1)
|
plugin_env = defenv.Clone(no_import_lib = 1)
|
||||||
|
|
||||||
|
plugin_uenv = plugin_env.Clone()
|
||||||
|
plugin_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||||
|
|
||||||
### util environment
|
### util environment
|
||||||
|
|
||||||
util_env = defenv.Clone()
|
util_env = tdefenv.Clone()
|
||||||
|
|
||||||
### cross-platform util environment
|
### cross-platform util environment
|
||||||
|
|
||||||
cp_util_env = util_env.Clone()
|
cp_util_env = tdefenv.Clone()
|
||||||
|
|
||||||
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
cp_util_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||||
|
|
||||||
|
@ -125,4 +136,4 @@ test_env.Append(CPPPATH = ['#$BUILD_CONFIG'])
|
||||||
|
|
||||||
# return
|
# return
|
||||||
|
|
||||||
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_env plugin_env')
|
Return('stub_env makensis_env plugin_env util_env cp_util_env test_env stub_uenv plugin_uenv')
|
||||||
|
|
|
@ -10,13 +10,19 @@ if SCons.__version__ == '1.3.0':
|
||||||
# force inclusion of Platform SDK, sometimes ignored by SCons 1.3.0 due to environment contamination
|
# force inclusion of Platform SDK, sometimes ignored by SCons 1.3.0 due to environment contamination
|
||||||
defenv.Tool('mssdk')
|
defenv.Tool('mssdk')
|
||||||
|
|
||||||
defenv['ENTRY_FLAG'] = lambda x: '/entry:' + x
|
def entry(x,u):
|
||||||
|
if x == 'WinMain' and u:
|
||||||
|
x = 'w' + x
|
||||||
|
return '/entry:' + x
|
||||||
|
|
||||||
|
defenv['ENTRY_FLAG'] = entry
|
||||||
defenv['MAP_FLAG'] = '/map'
|
defenv['MAP_FLAG'] = '/map'
|
||||||
defenv['NODEFLIBS_FLAG'] = '/NODEFAULTLIB'
|
defenv['NODEFLIBS_FLAG'] = '/NODEFAULTLIB'
|
||||||
defenv['C_FLAG'] = '/TC'
|
defenv['C_FLAG'] = '/TC'
|
||||||
defenv['CPP_FLAG'] = '/TP'
|
defenv['CPP_FLAG'] = '/TP'
|
||||||
defenv['CPP_REQUIRES_STDLIB'] = 0
|
defenv['CPP_REQUIRES_STDLIB'] = 0
|
||||||
defenv['SUBSYS_CON'] = '/subsystem:console'
|
defenv['SUBSYS_CON'] = '/subsystem:console'
|
||||||
|
defenv['SUBSYS_WIN'] = '/subsystem:windows'
|
||||||
defenv['MSVCRT_FLAG'] = '/MD'
|
defenv['MSVCRT_FLAG'] = '/MD'
|
||||||
defenv['STDCALL'] = '__stdcall'
|
defenv['STDCALL'] = '__stdcall'
|
||||||
|
|
||||||
|
@ -112,9 +118,7 @@ stub_env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no default libraries
|
||||||
stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
|
stub_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
|
||||||
|
|
||||||
stub_uenv = stub_env.Clone()
|
stub_uenv = stub_env.Clone()
|
||||||
stub_uenv.Append(LINKFLAGS = ['/entry:wWinMain']) # Unicode entry point
|
|
||||||
stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
stub_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
|
||||||
stub_env.Append(LINKFLAGS = ['/entry:WinMain']) # ANSI entry point
|
|
||||||
|
|
||||||
### makensis environment
|
### makensis environment
|
||||||
|
|
||||||
|
@ -228,28 +232,19 @@ def add_file(file):
|
||||||
|
|
||||||
conf = stub_env.Configure()
|
conf = stub_env.Configure()
|
||||||
|
|
||||||
if defenv['UNICODE']:
|
int64test = """
|
||||||
int64test = """
|
#include <windows.h>
|
||||||
#include <windows.h>
|
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow) {
|
||||||
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPTSTR lpszCmdParam, int nCmdShow) {
|
ULARGE_INTEGER *i = 0;
|
||||||
ULARGE_INTEGER *i = 0;
|
return (int)(i->QuadPart >> 10);
|
||||||
return (int)(i->QuadPart >> 10);
|
}
|
||||||
}
|
"""
|
||||||
"""
|
|
||||||
else:
|
|
||||||
int64test = """
|
|
||||||
#include <windows.h>
|
|
||||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow) {
|
|
||||||
ULARGE_INTEGER *i = 0;
|
|
||||||
return (int)(i->QuadPart >> 10);
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
if not conf.TryLink(int64test, '.c'):
|
if not conf.TryLink(int64test, '.c'):
|
||||||
stub_env.Append(CPPDEFINES = ['_NSIS_NO_INT64_SHR'])
|
stub_env.Append(CPPDEFINES = ['_NSIS_NO_INT64_SHR'])
|
||||||
stub_uenv.Append(CPPDEFINES = ['_NSIS_NO_INT64_SHR'])
|
stub_uenv.Append(CPPDEFINES = ['_NSIS_NO_INT64_SHR'])
|
||||||
|
|
||||||
conf.Finish()
|
conf.Finish()
|
||||||
|
|
||||||
#
|
#
|
||||||
# MSVC 2005 requires the memset CRT function to be present
|
# MSVC 2005 requires the memset CRT function to be present
|
||||||
|
@ -260,7 +255,7 @@ conf = defenv.Configure(custom_tests = { 'CheckRequirement' : check_requirement
|
||||||
if conf.CheckRequirement('memset', 'char c[128] = "test";'):
|
if conf.CheckRequirement('memset', 'char c[128] = "test";'):
|
||||||
add_file('memset.c')
|
add_file('memset.c')
|
||||||
|
|
||||||
conf.Finish()
|
conf.Finish()
|
||||||
|
|
||||||
### return
|
### return
|
||||||
|
|
||||||
|
|
161
SConstruct
161
SConstruct
|
@ -204,13 +204,11 @@ if 'NSIS_CONFIG_CONST_DATA_PATH' in defenv['NSIS_CPPDEFINES']:
|
||||||
# Need this early for the config header files to be placed in
|
# Need this early for the config header files to be placed in
|
||||||
|
|
||||||
if defenv['UNICODE']:
|
if defenv['UNICODE']:
|
||||||
_tWinMain = 'wWinMain'
|
|
||||||
if defenv['DEBUG']:
|
if defenv['DEBUG']:
|
||||||
defenv.Replace(BUILD_PREFIX = 'build/udebug')
|
defenv.Replace(BUILD_PREFIX = 'build/udebug')
|
||||||
else:
|
else:
|
||||||
defenv.Replace(BUILD_PREFIX = 'build/urelease')
|
defenv.Replace(BUILD_PREFIX = 'build/urelease')
|
||||||
else:
|
else:
|
||||||
_tWinMain = 'WinMain'
|
|
||||||
if defenv['DEBUG']:
|
if defenv['DEBUG']:
|
||||||
defenv.Replace(BUILD_PREFIX = 'build/debug')
|
defenv.Replace(BUILD_PREFIX = 'build/debug')
|
||||||
else:
|
else:
|
||||||
|
@ -278,6 +276,50 @@ f.write('#define NSIS_VERSION _T("v%s")\n' % defenv['VERSION'])
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####### Common Functions ###
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
def SafeFile(f):
|
||||||
|
from types import StringType
|
||||||
|
|
||||||
|
if isinstance(f, StringType):
|
||||||
|
return File(f)
|
||||||
|
|
||||||
|
return f
|
||||||
|
|
||||||
|
def MakeFileList(files):
|
||||||
|
return Flatten(File(files))
|
||||||
|
|
||||||
|
def AddEnvStandardFlags(env, defines=None, flags=None, libs=None, entry=None, nodeflib=None):
|
||||||
|
if defines:
|
||||||
|
env.Append(CPPDEFINES = defines)
|
||||||
|
if flags:
|
||||||
|
env.Append(CCFLAGS = flags)
|
||||||
|
if libs:
|
||||||
|
env.Append(LIBS = libs)
|
||||||
|
|
||||||
|
if entry:
|
||||||
|
unicodestr = "None"
|
||||||
|
if 'UNICODE' in env['CPPDEFINES']:
|
||||||
|
unicodestr = "True"
|
||||||
|
env.Append(LINKFLAGS = ['${ENTRY_FLAG("%s",%s)}' % (entry,unicodestr)])
|
||||||
|
|
||||||
|
if nodeflib:
|
||||||
|
env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no default libraries
|
||||||
|
|
||||||
|
def AppendRES(env, source, res, resources):
|
||||||
|
if res:
|
||||||
|
target = MakeFileList(res)[0].name.replace('.rc', '-rc')
|
||||||
|
target_res = env.RES(target, res)
|
||||||
|
if resources:
|
||||||
|
env.Depends(target_res, resources)
|
||||||
|
source.append(target_res)
|
||||||
|
|
||||||
|
def CleanMap(env, target, target_name):
|
||||||
|
env.Clean(target, File(target_name + '.map'))
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
####### Functions ###
|
####### Functions ###
|
||||||
######################################################################
|
######################################################################
|
||||||
|
@ -294,17 +336,6 @@ defenv.Execute(Delete('$ZIPDISTDIR'))
|
||||||
defenv.Execute(Delete('$INSTDISTDIR'))
|
defenv.Execute(Delete('$INSTDISTDIR'))
|
||||||
defenv.Execute(Delete('$TESTDISTDIR'))
|
defenv.Execute(Delete('$TESTDISTDIR'))
|
||||||
|
|
||||||
def SafeFile(f):
|
|
||||||
from types import StringType
|
|
||||||
|
|
||||||
if isinstance(f, StringType):
|
|
||||||
return File(f)
|
|
||||||
|
|
||||||
return f
|
|
||||||
|
|
||||||
def MakeFileList(files):
|
|
||||||
return Flatten(File(files))
|
|
||||||
|
|
||||||
def Distribute(files, names, component, path, subpath, alias, install_alias=None):
|
def Distribute(files, names, component, path, subpath, alias, install_alias=None):
|
||||||
from types import StringType
|
from types import StringType
|
||||||
|
|
||||||
|
@ -347,8 +378,8 @@ def DistributeW32Bin(files, names=[], path='', alias=None):
|
||||||
def DistributeStubs(files, names=[], path='', alias=None):
|
def DistributeStubs(files, names=[], path='', alias=None):
|
||||||
return defenv.Distribute(files, names, 'data', 'Stubs', path, alias, 'stubs')
|
return defenv.Distribute(files, names, 'data', 'Stubs', path, alias, 'stubs')
|
||||||
|
|
||||||
def DistributePlugin(files, names=[], path='', alias=None):
|
def DistributePlugin(files, names=[], arcsubpath='', alias=None):
|
||||||
return defenv.Distribute(files, names, 'data', 'Plugins', path, alias, 'plugins')
|
return defenv.Distribute(files, names, 'data', 'Plugins', arcsubpath, alias, 'plugins')
|
||||||
|
|
||||||
def DistributeContrib(files, names=[], path='', alias=None):
|
def DistributeContrib(files, names=[], path='', alias=None):
|
||||||
return defenv.Distribute(files, names, 'data', 'Contrib', path, alias, 'contrib')
|
return defenv.Distribute(files, names, 'data', 'Contrib', path, alias, 'contrib')
|
||||||
|
@ -400,6 +431,12 @@ defenv.DistributeExamples = DistributeExamples
|
||||||
defenv.Sign = Sign
|
defenv.Sign = Sign
|
||||||
defenv.TestScript = TestScript
|
defenv.TestScript = TestScript
|
||||||
|
|
||||||
|
def DistributeExtras(env, target, examples, docs):
|
||||||
|
if examples:
|
||||||
|
env.DistributeExamples(examples, path=target)
|
||||||
|
if docs:
|
||||||
|
env.DistributeDocs(docs, path=target)
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
####### Environments ###
|
####### Environments ###
|
||||||
######################################################################
|
######################################################################
|
||||||
|
@ -464,6 +501,19 @@ plugin_uenv = envs[7]
|
||||||
|
|
||||||
Export('stub_env makensis_env plugin_env plugin_uenv util_env cp_util_env test_env')
|
Export('stub_env makensis_env plugin_env plugin_uenv util_env cp_util_env test_env')
|
||||||
|
|
||||||
|
def GetArcCPU(env):
|
||||||
|
if (not env.has_key('TARGET_ARCH')) or env['TARGET_ARCH'] == 'x86':
|
||||||
|
return 'x86'
|
||||||
|
return env['TARGET_ARCH']
|
||||||
|
|
||||||
|
def GetArcSuffix(env, unicode = None):
|
||||||
|
if unicode is None:
|
||||||
|
unicode = 'UNICODE' in env['CPPDEFINES']
|
||||||
|
suff = '-unicode'
|
||||||
|
if not unicode:
|
||||||
|
suff = '-ansi'
|
||||||
|
return GetArcCPU(env) + suff
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
####### Distribution ###
|
####### Distribution ###
|
||||||
######################################################################
|
######################################################################
|
||||||
|
@ -533,11 +583,13 @@ def BuildStub(compression, solid, unicode):
|
||||||
if solid:
|
if solid:
|
||||||
suffix = '_solid'
|
suffix = '_solid'
|
||||||
if unicode:
|
if unicode:
|
||||||
suffix += '.5_0'
|
|
||||||
env = stub_uenv.Clone()
|
env = stub_uenv.Clone()
|
||||||
else:
|
else:
|
||||||
env = stub_env.Clone()
|
env = stub_env.Clone()
|
||||||
|
|
||||||
|
suffix = suffix + '-' + GetArcSuffix(env, unicode)
|
||||||
|
|
||||||
|
AddEnvStandardFlags(env, entry='NSISWinMainNOCRT')
|
||||||
|
|
||||||
build_dir = '$BUILD_PREFIX/stub_%s%s' % (compression, suffix)
|
build_dir = '$BUILD_PREFIX/stub_%s%s' % (compression, suffix)
|
||||||
|
|
||||||
|
@ -559,8 +611,9 @@ for stub in stubs:
|
||||||
BuildStub(stub, False, True)
|
BuildStub(stub, False, True)
|
||||||
BuildStub(stub, True, True)
|
BuildStub(stub, True, True)
|
||||||
|
|
||||||
BuildStub(stub, False, False)
|
if GetArcCPU(defenv)=='x86':
|
||||||
BuildStub(stub, True, False)
|
BuildStub(stub, False, False)
|
||||||
|
BuildStub(stub, True, False)
|
||||||
|
|
||||||
defenv.DistributeStubs('Source/exehead/uninst.ico',names='uninst')
|
defenv.DistributeStubs('Source/exehead/uninst.ico',names='uninst')
|
||||||
|
|
||||||
|
@ -582,52 +635,21 @@ if defenv['PLATFORM'] == 'win32':
|
||||||
else:
|
else:
|
||||||
defenv.DistributeBin(makensis, alias='install-compiler')
|
defenv.DistributeBin(makensis, alias='install-compiler')
|
||||||
|
|
||||||
######################################################################
|
|
||||||
####### Common Functions ###
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
def AddEnvStandardFlags(env, defines, flags, libs, entry, nodeflib):
|
|
||||||
if defines:
|
|
||||||
env.Append(CPPDEFINES = defines)
|
|
||||||
if flags:
|
|
||||||
env.Append(CCFLAGS = flags)
|
|
||||||
if libs:
|
|
||||||
env.Append(LIBS = libs)
|
|
||||||
|
|
||||||
if entry:
|
|
||||||
env.Append(LINKFLAGS = ['${ENTRY_FLAG("%s")}' % entry])
|
|
||||||
|
|
||||||
if nodeflib:
|
|
||||||
env.Append(LINKFLAGS = ['$NODEFLIBS_FLAG']) # no default libraries
|
|
||||||
|
|
||||||
def AppendRES(env, source, res, resources):
|
|
||||||
if res:
|
|
||||||
target = MakeFileList(res)[0].name.replace('.rc', '-rc')
|
|
||||||
target_res = env.RES(target, res)
|
|
||||||
if resources:
|
|
||||||
env.Depends(target_res, resources)
|
|
||||||
source.append(target_res)
|
|
||||||
|
|
||||||
def CleanMap(env, target, target_name):
|
|
||||||
env.Clean(target, File(target_name + '.map'))
|
|
||||||
|
|
||||||
def DistributeExtras(env, target, examples, docs):
|
|
||||||
if examples:
|
|
||||||
env.DistributeExamples(examples, path=target)
|
|
||||||
if docs:
|
|
||||||
env.DistributeDocs(docs, path=target)
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
####### Plug-ins ###
|
####### Plug-ins ###
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
def PerformPluginExtrasDistOperationOnce(env, unicode):
|
||||||
|
#SCons does not like it if you install the same file multiple times
|
||||||
|
return GetArcCPU(defenv)==GetArcCPU(env) and (defenv['UNICODE']==unicode)
|
||||||
|
|
||||||
def BuildPluginWorker(target, source, libs, examples = None, docs = None,
|
def BuildPluginWorker(target, source, libs, examples = None, docs = None,
|
||||||
entry = 'DllMain', res = None, resources = None,
|
entry = 'DllMain', res = None, resources = None,
|
||||||
defines = None, flags = None, nodeflib = True,
|
defines = None, flags = None, nodeflib = True,
|
||||||
cppused = False, unicode = False):
|
cppused = False, unicode = False):
|
||||||
|
basename = target
|
||||||
if unicode:
|
if unicode:
|
||||||
env = plugin_uenv.Clone()
|
env = plugin_uenv.Clone()
|
||||||
target = target + 'W'
|
|
||||||
else:
|
else:
|
||||||
env = plugin_env.Clone()
|
env = plugin_env.Clone()
|
||||||
|
|
||||||
|
@ -650,10 +672,10 @@ def BuildPluginWorker(target, source, libs, examples = None, docs = None,
|
||||||
if str(i)[-4:].lower() == '.dll':
|
if str(i)[-4:].lower() == '.dll':
|
||||||
plugin = i
|
plugin = i
|
||||||
break
|
break
|
||||||
env.DistributePlugin(plugin)
|
env.DistributePlugin(plugin, arcsubpath = GetArcSuffix(env, unicode))
|
||||||
|
|
||||||
if not unicode: # distribute extras only for ANSI builds
|
if PerformPluginExtrasDistOperationOnce(env, unicode): # only distribute extras once
|
||||||
DistributeExtras(env, target, examples, docs)
|
DistributeExtras(env, basename, examples, docs)
|
||||||
|
|
||||||
def BuildPlugin(target, source, libs, examples = None, docs = None,
|
def BuildPlugin(target, source, libs, examples = None, docs = None,
|
||||||
entry = 'DllMain', res = None, resources = None,
|
entry = 'DllMain', res = None, resources = None,
|
||||||
|
@ -663,20 +685,22 @@ def BuildPlugin(target, source, libs, examples = None, docs = None,
|
||||||
BuildPluginWorker(target, source, libs, examples, docs, entry, res, resources, defines, flags, nodeflib, cppused, unicodetarget)
|
BuildPluginWorker(target, source, libs, examples, docs, entry, res, resources, defines, flags, nodeflib, cppused, unicodetarget)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for plugin in plugin_libs + plugins:
|
for plugin in plugin_libs + plugins:
|
||||||
if plugin in defenv['SKIPPLUGINS']:
|
if plugin in defenv['SKIPPLUGINS']:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
srcpath = 'Contrib/' + plugin
|
srcpath = 'Contrib/' + plugin
|
||||||
build_dir = '$BUILD_PREFIX/' + plugin
|
build_dir = '$BUILD_PREFIX/' + plugin
|
||||||
pvariants = [{'suff':'', 'e':plugin_env.Clone()}]
|
pvariants = [{'e':plugin_env.Clone()}] # BUGBUG64: Only build unicode plugins
|
||||||
if defenv['UNICODE']:
|
if defenv['UNICODE']:
|
||||||
pvariants += [{'suff':'W', 'e':plugin_uenv.Clone()}]
|
pvariants += [{'e':plugin_uenv.Clone()}]
|
||||||
for pvariant in pvariants:
|
for pvariant in pvariants:
|
||||||
exports = {'BuildPlugin' : BuildPlugin, 'env' : pvariant['e']}
|
exports = {
|
||||||
vdir = build_dir + pvariant['suff']
|
'env' : pvariant['e'],
|
||||||
|
'BuildPlugin' : BuildPlugin, 'GetArcSuffix' : GetArcSuffix,
|
||||||
|
'PerformPluginExtrasDistOperationOnce' : PerformPluginExtrasDistOperationOnce
|
||||||
|
}
|
||||||
|
vdir = build_dir + '/' + GetArcSuffix(pvariant['e'])
|
||||||
defenv.SConscript(dirs = srcpath, variant_dir = vdir, duplicate = False, exports = exports)
|
defenv.SConscript(dirs = srcpath, variant_dir = vdir, duplicate = False, exports = exports)
|
||||||
|
|
||||||
|
|
||||||
|
@ -696,14 +720,17 @@ def BuildUtilEnv(defines = None, flags = None, libs = None,
|
||||||
else:
|
else:
|
||||||
env = cp_util_env.Clone()
|
env = cp_util_env.Clone()
|
||||||
platform = env['PLATFORM']
|
platform = env['PLATFORM']
|
||||||
|
cli = True
|
||||||
if cli:
|
|
||||||
env.Append(LINKFLAGS = env['SUBSYS_CON'])
|
|
||||||
|
|
||||||
if libs and 'z' in libs:
|
if libs and 'z' in libs:
|
||||||
libs.remove('z')
|
libs.remove('z')
|
||||||
AddZLib(env, platform)
|
AddZLib(env, platform)
|
||||||
|
|
||||||
|
if cli:
|
||||||
|
env.Append(LINKFLAGS = env['SUBSYS_CON'])
|
||||||
|
else:
|
||||||
|
env.Append(LINKFLAGS = env['SUBSYS_WIN'])
|
||||||
|
|
||||||
AddEnvStandardFlags(env, defines, flags, libs, entry, nodeflib)
|
AddEnvStandardFlags(env, defines, flags, libs, entry, nodeflib)
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
@ -751,7 +778,7 @@ for util in utils:
|
||||||
|
|
||||||
path = 'Contrib/' + util
|
path = 'Contrib/' + util
|
||||||
build_dir = '$BUILD_PREFIX/' + util
|
build_dir = '$BUILD_PREFIX/' + util
|
||||||
exports = {'BuildUtil' : BuildUtil, 'BuildUtilEnv' : BuildUtilEnv, 'env' : util_env, '_tWinMain' : _tWinMain}
|
exports = {'BuildUtil' : BuildUtil, 'BuildUtilEnv' : BuildUtilEnv, 'env' : util_env}
|
||||||
|
|
||||||
defenv.SConscript(dirs = path, variant_dir = build_dir, duplicate = False, exports = exports)
|
defenv.SConscript(dirs = path, variant_dir = build_dir, duplicate = False, exports = exports)
|
||||||
|
|
||||||
|
|
|
@ -21,13 +21,16 @@
|
||||||
|
|
||||||
// #include "StdAfx.h"
|
// #include "StdAfx.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef _WIN32
|
||||||
# include <objbase.h>
|
|
||||||
# include <initguid.h>
|
# include <initguid.h>
|
||||||
|
# include <objbase.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INITGUID
|
||||||
|
# define INITGUID
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../Platform.h"
|
#include "../Platform.h"
|
||||||
|
|
||||||
#define INITGUID
|
|
||||||
#include "7zip/ICoder.h"
|
#include "7zip/ICoder.h"
|
||||||
#include "7zip/Compress/LZ/IMatchFinder.h"
|
#include "7zip/Compress/LZ/IMatchFinder.h"
|
||||||
|
|
|
@ -47,14 +47,14 @@ inline bool operator==(REFGUID g1, REFGUID g2)
|
||||||
inline bool operator!=(REFGUID g1, REFGUID g2) { return !(g1 == g2); }
|
inline bool operator!=(REFGUID g1, REFGUID g2) { return !(g1 == g2); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // GUID_DEFINED
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define MY_EXTERN_C extern "C"
|
#define MY_EXTERN_C extern "C"
|
||||||
#else
|
#else
|
||||||
#define MY_EXTERN_C extern
|
#define MY_EXTERN_C extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // GUID_DEFINED
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEFINE_GUID
|
#ifdef DEFINE_GUID
|
||||||
#undef DEFINE_GUID
|
#undef DEFINE_GUID
|
||||||
|
|
|
@ -603,7 +603,7 @@ BYTE* CDialogTemplate::Save(DWORD& dwSize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write class variant length array
|
// Write class variant length array
|
||||||
WCHAR *szClass = m_vItems[i]->szClass;
|
const WCHAR *szClass = m_vItems[i]->szClass;
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
if (!IS_INTRESOURCE(szClass) && m_build_unicode && !_wcsicmp(szClass, L"RichEdit20A"))
|
if (!IS_INTRESOURCE(szClass) && m_build_unicode && !_wcsicmp(szClass, L"RichEdit20A"))
|
||||||
szClass = L"RichEdit20W"; // transmute ANSI RichEdit control into Unicode RichEdit
|
szClass = L"RichEdit20W"; // transmute ANSI RichEdit control into Unicode RichEdit
|
||||||
|
|
|
@ -108,7 +108,7 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
|
||||||
#define _snprintf snprintf
|
#define _snprintf snprintf
|
||||||
#define _vsnprintf vsnprintf
|
#define _vsnprintf vsnprintf
|
||||||
|
|
||||||
#endif
|
#endif // ?WIN32
|
||||||
|
|
||||||
#ifndef INT_MAX
|
#ifndef INT_MAX
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -121,6 +121,17 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
|
||||||
# define ULONG_PTR unsigned long
|
# define ULONG_PTR unsigned long
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include <algorithm>
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER <= 1200
|
||||||
|
#define STD_MIN std::_MIN
|
||||||
|
#define STD_MAX std::_MAX
|
||||||
|
#else
|
||||||
|
#define STD_MIN (std::min) // This works even when windows.h defines min/max
|
||||||
|
#define STD_MAX (std::max)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _countof
|
#ifdef _countof
|
||||||
#define COUNTOF _countof
|
#define COUNTOF _countof
|
||||||
#else
|
#else
|
||||||
|
@ -724,6 +735,9 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
|
||||||
# define IMAGE_DIRECTORY_ENTRY_EXPORT 0
|
# define IMAGE_DIRECTORY_ENTRY_EXPORT 0
|
||||||
# define IMAGE_SIZEOF_SHORT_NAME 8
|
# define IMAGE_SIZEOF_SHORT_NAME 8
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE
|
||||||
|
#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
|
||||||
|
#endif
|
||||||
|
|
||||||
// structures
|
// structures
|
||||||
|
|
||||||
|
@ -860,7 +874,6 @@ typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
|
||||||
# define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x0b01
|
# define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x0b01
|
||||||
# define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x0b02
|
# define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x0b02
|
||||||
#endif
|
#endif
|
||||||
#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
|
|
||||||
typedef struct _IMAGE_NT_HEADERS {
|
typedef struct _IMAGE_NT_HEADERS {
|
||||||
DWORD Signature;
|
DWORD Signature;
|
||||||
IMAGE_FILE_HEADER FileHeader;
|
IMAGE_FILE_HEADER FileHeader;
|
||||||
|
@ -912,4 +925,41 @@ typedef struct tagVS_FIXEDFILEINFO {
|
||||||
# pragma pack()
|
# pragma pack()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// MinGW does not implement the unicode CRT startup functions
|
||||||
|
#if (defined(_UNICODE) && defined(_WIN32)) && defined(__MINGW32__)
|
||||||
|
# define NSIS_ENTRYPOINT_TMAIN \
|
||||||
|
int _tmain(int argc,WCHAR**argv); \
|
||||||
|
EXTERN_C int main(int ac,char**cav) { \
|
||||||
|
WCHAR**av=CommandLineToArgvW(GetCommandLineW(),&ac); \
|
||||||
|
if (!av) { \
|
||||||
|
_tprintf(_T("wmain: Error %u\n"),ac = GetLastError()); \
|
||||||
|
return ac; \
|
||||||
|
} \
|
||||||
|
ac = _tmain(ac,av); \
|
||||||
|
/*LEAK: LocalFree(av);*/ \
|
||||||
|
return ac; \
|
||||||
|
}
|
||||||
|
# define NSIS_ENTRYPOINT_SIMPLEGUI \
|
||||||
|
int WINAPI _tWinMain(HINSTANCE hI,HINSTANCE hOld,LPTSTR cl,int sc); \
|
||||||
|
EXTERN_C int WINAPI WinMain(HINSTANCE hI,HINSTANCE hOld,char*cl,int sc) \
|
||||||
|
{return _tWinMain(hI,0,0,sc);}
|
||||||
|
# ifdef __cplusplus
|
||||||
|
# define NSIS_ENTRYPOINT_GUINOCRT \
|
||||||
|
EXTERN_C void NSISWinMainNOCRT(); \
|
||||||
|
int WINAPI WinMain(HINSTANCE hI,HINSTANCE hOld,char*cl,int sc) \
|
||||||
|
{NSISWinMainNOCRT();return 0;}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#ifndef NSIS_ENTRYPOINT_TMAIN
|
||||||
|
# define NSIS_ENTRYPOINT_TMAIN
|
||||||
|
#endif
|
||||||
|
#ifndef NSIS_ENTRYPOINT_SIMPLEGUI // _tWinMain with valid hInstance, calls ExitProcess
|
||||||
|
# define NSIS_ENTRYPOINT_SIMPLEGUI
|
||||||
|
#endif
|
||||||
|
#ifndef NSIS_ENTRYPOINT_GUINOCRT
|
||||||
|
# define NSIS_ENTRYPOINT_GUINOCRT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,7 +40,52 @@ using namespace std;
|
||||||
|
|
||||||
extern FILE *g_output;
|
extern FILE *g_output;
|
||||||
|
|
||||||
void Plugins::FindCommands(const tstring &path, bool displayInfo)
|
namespace {
|
||||||
|
|
||||||
|
template <class C, class K>
|
||||||
|
bool contains(const C& cntnr, const K& key)
|
||||||
|
{
|
||||||
|
return cntnr.find(key) != cntnr.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class C, class K>
|
||||||
|
const typename C::const_iterator get_iterator(const C& cntnr, const K& key)
|
||||||
|
{
|
||||||
|
assert( contains(cntnr, key) );
|
||||||
|
return cntnr.find(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class C, class K>
|
||||||
|
typename C::const_iterator::value_type get_value(const C& cntnr, const K& key)
|
||||||
|
{
|
||||||
|
return *get_iterator(cntnr,key);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class C, class K>
|
||||||
|
typename C::value_type::second_type get_paired_value(const C& cntnr, const K& key)
|
||||||
|
{
|
||||||
|
return get_iterator(cntnr,key)->second;
|
||||||
|
}
|
||||||
|
template <class V,class C, class K>
|
||||||
|
V get_paired_value(const C& cntnr, const K& key, const V& defval)
|
||||||
|
{
|
||||||
|
typename C::const_iterator it = cntnr.find(key);
|
||||||
|
return cntnr.end() == it ? defval : it->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline tstring GetDllName(const tstring&command)
|
||||||
|
{
|
||||||
|
return get_string_prefix(command, _T("::"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void PrintCommandSig(const tstring sig)
|
||||||
|
{
|
||||||
|
_ftprintf(g_output, _T(" + %s\n"), sig.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Plugins::AddPluginsDir(const tstring &path, bool displayInfo)
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<dir_reader> dr( new_dir_reader() );
|
boost::scoped_ptr<dir_reader> dr( new_dir_reader() );
|
||||||
dr->read(path);
|
dr->read(path);
|
||||||
|
@ -71,11 +116,10 @@ struct NSISException : public NSISExceptionInner
|
||||||
namespace {
|
namespace {
|
||||||
// This function slurps the whole file into the vector.
|
// This function slurps the whole file into the vector.
|
||||||
// Modified so the huge vector isn't returned by value.
|
// Modified so the huge vector isn't returned by value.
|
||||||
void read_file(const tstring& filename, vector<unsigned char>& data) {
|
void read_file(const tstring& filename, vector<unsigned char>& data)
|
||||||
|
{
|
||||||
FILE*file = FOPEN(filename.c_str(), ("rb"));
|
FILE*file = FOPEN(filename.c_str(), ("rb"));
|
||||||
|
|
||||||
if (!file) throw NSISException(_T("Can't open file '") + filename + _T("'"));
|
if (!file) throw NSISException(_T("Can't open file '") + filename + _T("'"));
|
||||||
|
|
||||||
MANAGE_WITH(file, fclose);
|
MANAGE_WITH(file, fclose);
|
||||||
bool succ = false;
|
bool succ = false;
|
||||||
|
|
||||||
|
@ -104,9 +148,10 @@ void Plugins::GetExports(const tstring &pathToDll, bool displayInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
tstring dllName = remove_file_extension(get_file_name(pathToDll));
|
tstring dllName = remove_file_extension(get_file_name(pathToDll));
|
||||||
#ifdef _UNICODE
|
if (DllHasDataHandle(dllName))
|
||||||
bool unicodeDll = dllName[dllName.size()-1] == 'W';
|
{
|
||||||
#endif
|
m_dllname_conflicts.insert(dllName);
|
||||||
|
}
|
||||||
|
|
||||||
FIX_ENDIAN_INT16_INPLACE(NTHeaders->FileHeader.Characteristics);
|
FIX_ENDIAN_INT16_INPLACE(NTHeaders->FileHeader.Characteristics);
|
||||||
if (NTHeaders->FileHeader.Characteristics & IMAGE_FILE_DLL)
|
if (NTHeaders->FileHeader.Characteristics & IMAGE_FILE_DLL)
|
||||||
|
@ -135,19 +180,16 @@ void Plugins::GetExports(const tstring &pathToDll, bool displayInfo)
|
||||||
LPDWORD names = (LPDWORD)((ULONG_PTR)exports + na - ExportDirVA);
|
LPDWORD names = (LPDWORD)((ULONG_PTR)exports + na - ExportDirVA);
|
||||||
for (DWORD j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++)
|
for (DWORD j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++)
|
||||||
{
|
{
|
||||||
|
if (0 == j) m_dllname_to_path[dllName] = pathToDll;
|
||||||
|
|
||||||
const string name = string((char*)exports + FIX_ENDIAN_INT32(names[j]) - ExportDirVA);
|
const string name = string((char*)exports + FIX_ENDIAN_INT32(names[j]) - ExportDirVA);
|
||||||
const tstring signature = dllName + _T("::") + tstring(CtoTString(name));
|
const tstring canoniccmd = dllName + _T("::") + tstring(CtoTString(name));
|
||||||
const tstring lcsig = lowercase(signature);
|
|
||||||
m_command_to_path[lcsig] = pathToDll;
|
|
||||||
m_command_lowercase_to_command[lcsig] = signature;
|
|
||||||
#ifdef _UNICODE
|
|
||||||
const tstring lcsigA = lowercase(dllName.substr(0,dllName.size()-1) + _T("::") + tstring(CtoTString(name)));
|
|
||||||
if (unicodeDll && m_command_to_path.find(lcsigA) != m_command_to_path.end())
|
|
||||||
m_unicode_variant[lcsigA] = signature;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if (displayInfo)
|
if (displayInfo)
|
||||||
_ftprintf(g_output, _T(" - %s\n"), signature.c_str());
|
{
|
||||||
|
bool hadCmd = contains(m_commands, canoniccmd);
|
||||||
|
if (!hadCmd) PrintCommandSig(canoniccmd);
|
||||||
|
}
|
||||||
|
m_commands.insert(canoniccmd);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -155,59 +197,54 @@ void Plugins::GetExports(const tstring &pathToDll, bool displayInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Plugins::IsPluginCommand(const tstring& token) const {
|
int Plugins::GetDllDataHandle(bool uninst, const tstring& command) const
|
||||||
return m_command_to_path.find(lowercase(token)) != m_command_to_path.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
template <class Key, class Value>
|
|
||||||
Value get_value(const map<Key, Value>& the_map,
|
|
||||||
const Key& key)
|
|
||||||
{
|
{
|
||||||
assert(the_map.find(key) != the_map.end());
|
const tstring dllname = GetDllName(command);
|
||||||
return the_map.find(key)->second;
|
if (uninst)
|
||||||
|
return get_paired_value(m_dllname_to_unst_datahandle, dllname, -1);
|
||||||
|
else
|
||||||
|
return get_paired_value(m_dllname_to_inst_datahandle, dllname, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Key, class Value>
|
void Plugins::SetDllDataHandle(bool uninst, tstring&canoniccmd, int dataHandle)
|
||||||
Value get_value(const map<Key, Value>& the_map,
|
|
||||||
const Key& key,
|
|
||||||
const Value& defaultValue)
|
|
||||||
{
|
{
|
||||||
if (the_map.find(key) == the_map.end())
|
const tstring dllname = GetDllName(canoniccmd);
|
||||||
return defaultValue;
|
if (uninst)
|
||||||
return the_map.find(key)->second;
|
m_dllname_to_unst_datahandle[dllname] = dataHandle;
|
||||||
}
|
else
|
||||||
|
m_dllname_to_inst_datahandle[dllname] = dataHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
tstring Plugins::NormalizedCommand(const tstring& command) const {
|
bool Plugins::DllHasDataHandle(const tstring& dllnamelowercase) const
|
||||||
return get_value(m_command_lowercase_to_command, lowercase(command));
|
|
||||||
}
|
|
||||||
|
|
||||||
tstring Plugins::UseUnicodeVariant(const tstring& command) const {
|
|
||||||
return get_value(m_unicode_variant, lowercase(command), command);
|
|
||||||
}
|
|
||||||
|
|
||||||
int Plugins::GetPluginHandle(bool uninst, const tstring& command) const {
|
|
||||||
if (uninst) {
|
|
||||||
return get_value(m_command_to_uninstall_data_handle, command, -1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return get_value(m_command_to_data_handle, command, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tstring Plugins::GetPluginPath(const tstring& command) const {
|
|
||||||
return get_value(m_command_to_path, lowercase(command));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Plugins::SetDllDataHandle(bool uninst, const tstring& command, int dataHandle)
|
|
||||||
{
|
{
|
||||||
if (uninst) {
|
int h = GetDllDataHandle(false, dllnamelowercase);
|
||||||
m_command_to_uninstall_data_handle[command] = dataHandle;
|
if (-1 == h) h = GetDllDataHandle(true, dllnamelowercase);
|
||||||
}
|
return -1 != h;
|
||||||
else {
|
|
||||||
m_command_to_data_handle[command] = dataHandle;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Plugins::Initialize(const TCHAR*arcsubdir, bool displayInfo)
|
||||||
|
{
|
||||||
|
if (m_initialized) return true;
|
||||||
|
m_initialized = true;
|
||||||
|
|
||||||
|
AddPluginsDir(tstring(arcsubdir), displayInfo);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Plugins::GetCommandInfo(const tstring&command, tstring&canoniccmd, tstring&dllPath)
|
||||||
|
{
|
||||||
|
const tstring dllname = GetDllName(command);
|
||||||
|
dllPath = get_paired_value(m_dllname_to_path, dllname);
|
||||||
|
canoniccmd = get_value(m_commands, command);
|
||||||
|
return !contains(m_dllname_conflicts, dllname);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Plugins::IsPluginCommand(const tstring& token) const
|
||||||
|
{
|
||||||
|
return contains(m_commands, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,35 +13,59 @@
|
||||||
* This software is provided 'as-is', without any express or implied
|
* This software is provided 'as-is', without any express or implied
|
||||||
* warranty.
|
* warranty.
|
||||||
*
|
*
|
||||||
* Unicode support by Jim Park -- 08/21/2007
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __X18_PLUGINS_H
|
#ifndef NSIS_EXEHEADPLUGINS_H
|
||||||
#define __X18_PLUGINS_H
|
#define NSIS_EXEHEADPLUGINS_H
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <set>
|
||||||
#include "tstring.h"
|
#include "tstring.h"
|
||||||
|
|
||||||
|
namespace STLHelpers
|
||||||
|
{
|
||||||
|
template<class S, class C>
|
||||||
|
struct string_nocasecmpless : std::binary_function<S, S, bool>
|
||||||
|
{
|
||||||
|
struct cmp : public std::binary_function<C, C, bool>
|
||||||
|
{
|
||||||
|
bool operator() (const C&a, const C&b) const
|
||||||
|
{
|
||||||
|
return tolower(a) < tolower(b);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
bool operator() (const S&a,const S&b) const
|
||||||
|
{
|
||||||
|
return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end(), cmp());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
class Plugins
|
class Plugins
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void FindCommands(const tstring& path, bool displayInfo);
|
typedef STLHelpers::string_nocasecmpless<tstring, tstring::value_type> strnocasecmp;
|
||||||
|
|
||||||
|
Plugins() : m_initialized(false) {}
|
||||||
|
|
||||||
|
bool Initialize(const TCHAR*arcsubdir, bool displayInfo);
|
||||||
|
void AddPluginsDir(const tstring& path, bool displayInfo);
|
||||||
bool IsPluginCommand(const tstring& command) const;
|
bool IsPluginCommand(const tstring& command) const;
|
||||||
tstring NormalizedCommand(const tstring& command) const;
|
bool GetCommandInfo(const tstring&command, tstring&canoniccmd, tstring&dllPath);
|
||||||
int GetPluginHandle(bool uninst, const tstring& command) const;
|
int GetDllDataHandle(bool uninst, const tstring& command) const;
|
||||||
tstring GetPluginPath(const tstring& command) const;
|
void SetDllDataHandle(bool uninst, tstring&canoniccmd, int dataHandle);
|
||||||
tstring UseUnicodeVariant(const tstring& lcsig) const;
|
|
||||||
void SetDllDataHandle(bool uninst, const tstring& command, int dataHandle);
|
|
||||||
|
|
||||||
private: // methods
|
private: // methods
|
||||||
void GetExports(const tstring &pathToDll, bool displayInfo);
|
void GetExports(const tstring &pathToDll, bool displayInfo);
|
||||||
|
bool DllHasDataHandle(const tstring& dllnamelowercase) const;
|
||||||
|
|
||||||
private: // data members
|
private: // data members
|
||||||
std::map<tstring, tstring> m_command_lowercase_to_command;
|
std::set<tstring, strnocasecmp> m_commands;
|
||||||
std::map<tstring, tstring> m_command_to_path;
|
std::map<tstring, tstring, strnocasecmp> m_dllname_to_path;
|
||||||
std::map<tstring, tstring> m_unicode_variant;
|
std::map<tstring, int, strnocasecmp> m_dllname_to_inst_datahandle;
|
||||||
std::map<tstring, int> m_command_to_data_handle;
|
std::map<tstring, int, strnocasecmp> m_dllname_to_unst_datahandle;
|
||||||
std::map<tstring, int> m_command_to_uninstall_data_handle;
|
std::set<tstring, strnocasecmp> m_dllname_conflicts;
|
||||||
|
bool m_initialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -156,7 +156,7 @@ CResourceEditor::~CResourceEditor() {
|
||||||
|
|
||||||
// Adds/Replaces/Removes a resource.
|
// Adds/Replaces/Removes a resource.
|
||||||
// If lpData is 0 UpdateResource removes the resource.
|
// If lpData is 0 UpdateResource removes the resource.
|
||||||
bool CResourceEditor::UpdateResourceW(WCHAR* szType, WCHAR* szName, LANGID wLanguage, BYTE* lpData, DWORD dwSize) {
|
bool CResourceEditor::UpdateResourceW(const WCHAR* szType, WCHAR* szName, LANGID wLanguage, BYTE* lpData, DWORD dwSize) {
|
||||||
CResourceDirectory* nameDir = 0;
|
CResourceDirectory* nameDir = 0;
|
||||||
CResourceDirectory* langDir = 0;
|
CResourceDirectory* langDir = 0;
|
||||||
CResourceDataEntry* data = 0;
|
CResourceDataEntry* data = 0;
|
||||||
|
@ -224,15 +224,14 @@ static WCHAR* ResStringToUnicode(const char *szString) {
|
||||||
else
|
else
|
||||||
return wcsdup_fromTchar(szString, CP_ACP);
|
return wcsdup_fromTchar(szString, CP_ACP);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void FreeUnicodeResString(WCHAR* szwString) {
|
static void FreeUnicodeResString(WCHAR* szwString) {
|
||||||
if (!IS_INTRESOURCE(szwString))
|
if (!IS_INTRESOURCE(szwString))
|
||||||
free(szwString);
|
free(szwString);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool CResourceEditor::UpdateResource(const TCHAR* szType, WORD szName, LANGID wLanguage, BYTE* lpData, DWORD dwSize) {
|
||||||
bool CResourceEditor::UpdateResource(TCHAR* szType, WORD szName, LANGID wLanguage, BYTE* lpData, DWORD dwSize) {
|
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
return UpdateResourceW(szType, MAKEINTRESOURCEW(szName), wLanguage, lpData, dwSize);
|
return UpdateResourceW(szType, MAKEINTRESOURCEW(szName), wLanguage, lpData, dwSize);
|
||||||
#else
|
#else
|
||||||
|
@ -245,7 +244,7 @@ bool CResourceEditor::UpdateResource(TCHAR* szType, WORD szName, LANGID wLanguag
|
||||||
|
|
||||||
// Returns a copy of the requested resource
|
// Returns a copy of the requested resource
|
||||||
// Returns 0 if the requested resource can't be found
|
// Returns 0 if the requested resource can't be found
|
||||||
BYTE* CResourceEditor::GetResourceW(WCHAR* szType, WCHAR* szName, LANGID wLanguage) {
|
BYTE* CResourceEditor::GetResourceW(const WCHAR* szType, WCHAR* szName, LANGID wLanguage) {
|
||||||
if (!m_bKeepData)
|
if (!m_bKeepData)
|
||||||
throw runtime_error("Can't GetResource() when bKeepData is false");
|
throw runtime_error("Can't GetResource() when bKeepData is false");
|
||||||
|
|
||||||
|
@ -277,7 +276,7 @@ BYTE* CResourceEditor::GetResourceW(WCHAR* szType, WCHAR* szName, LANGID wLangua
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BYTE* CResourceEditor::GetResource(TCHAR* szType, WORD szName, LANGID wLanguage) {
|
BYTE* CResourceEditor::GetResource(const TCHAR* szType, WORD szName, LANGID wLanguage) {
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
return GetResourceW(szType, MAKEINTRESOURCEW(szName), wLanguage);
|
return GetResourceW(szType, MAKEINTRESOURCEW(szName), wLanguage);
|
||||||
#else
|
#else
|
||||||
|
@ -290,7 +289,7 @@ BYTE* CResourceEditor::GetResource(TCHAR* szType, WORD szName, LANGID wLanguage)
|
||||||
|
|
||||||
// Returns the size of the requested resource
|
// Returns the size of the requested resource
|
||||||
// Returns -1 if the requested resource can't be found
|
// Returns -1 if the requested resource can't be found
|
||||||
int CResourceEditor::GetResourceSizeW(WCHAR* szType, WCHAR* szName, LANGID wLanguage) {
|
int CResourceEditor::GetResourceSizeW(const WCHAR* szType, WCHAR* szName, LANGID wLanguage) {
|
||||||
CResourceDirectory* nameDir = 0;
|
CResourceDirectory* nameDir = 0;
|
||||||
CResourceDirectory* langDir = 0;
|
CResourceDirectory* langDir = 0;
|
||||||
CResourceDataEntry* data = 0;
|
CResourceDataEntry* data = 0;
|
||||||
|
@ -316,7 +315,7 @@ int CResourceEditor::GetResourceSizeW(WCHAR* szType, WCHAR* szName, LANGID wLang
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CResourceEditor::GetResourceSize(TCHAR* szType, WORD szName, LANGID wLanguage) {
|
int CResourceEditor::GetResourceSize(const TCHAR* szType, WORD szName, LANGID wLanguage) {
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
return GetResourceSizeW(szType, MAKEINTRESOURCEW(szName), wLanguage);
|
return GetResourceSizeW(szType, MAKEINTRESOURCEW(szName), wLanguage);
|
||||||
#else
|
#else
|
||||||
|
@ -329,7 +328,7 @@ int CResourceEditor::GetResourceSize(TCHAR* szType, WORD szName, LANGID wLanguag
|
||||||
|
|
||||||
// Returns the offset of the requested resource in the original PE
|
// Returns the offset of the requested resource in the original PE
|
||||||
// Returns -1 if the requested resource can't be found
|
// Returns -1 if the requested resource can't be found
|
||||||
DWORD CResourceEditor::GetResourceOffsetW(WCHAR* szType, WCHAR* szName, LANGID wLanguage) {
|
DWORD CResourceEditor::GetResourceOffsetW(const WCHAR* szType, WCHAR* szName, LANGID wLanguage) {
|
||||||
CResourceDirectory* nameDir = 0;
|
CResourceDirectory* nameDir = 0;
|
||||||
CResourceDirectory* langDir = 0;
|
CResourceDirectory* langDir = 0;
|
||||||
CResourceDataEntry* data = 0;
|
CResourceDataEntry* data = 0;
|
||||||
|
@ -355,7 +354,7 @@ DWORD CResourceEditor::GetResourceOffsetW(WCHAR* szType, WCHAR* szName, LANGID w
|
||||||
return DWORD(-1);
|
return DWORD(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD CResourceEditor::GetResourceOffset(TCHAR* szType, WORD szName, LANGID wLanguage) {
|
DWORD CResourceEditor::GetResourceOffset(const TCHAR* szType, WORD szName, LANGID wLanguage) {
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
return GetResourceOffsetW(szType, MAKEINTRESOURCEW(szName), wLanguage);
|
return GetResourceOffsetW(szType, MAKEINTRESOURCEW(szName), wLanguage);
|
||||||
#else
|
#else
|
||||||
|
@ -858,7 +857,7 @@ int CResourceDirectory::CountEntries() {
|
||||||
// Returns the index of a directory entry with the specified name
|
// Returns the index of a directory entry with the specified name
|
||||||
// Name can be a string or an id
|
// Name can be a string or an id
|
||||||
// Returns -1 if can not be found
|
// Returns -1 if can not be found
|
||||||
int CResourceDirectory::Find(WCHAR* szName) {
|
int CResourceDirectory::Find(const WCHAR* szName) {
|
||||||
if (IS_INTRESOURCE(szName))
|
if (IS_INTRESOURCE(szName))
|
||||||
return Find((WORD) (ULONG_PTR) szName);
|
return Find((WORD) (ULONG_PTR) szName);
|
||||||
else
|
else
|
||||||
|
@ -934,7 +933,7 @@ void CResourceDirectory::Destroy() {
|
||||||
// Construction/Destruction
|
// Construction/Destruction
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
CResourceDirectoryEntry::CResourceDirectoryEntry(WCHAR* szName, CResourceDirectory* rdSubDir) {
|
CResourceDirectoryEntry::CResourceDirectoryEntry(const WCHAR* szName, CResourceDirectory* rdSubDir) {
|
||||||
if (IS_INTRESOURCE(szName)) {
|
if (IS_INTRESOURCE(szName)) {
|
||||||
m_bHasName = false;
|
m_bHasName = false;
|
||||||
m_szName = 0;
|
m_szName = 0;
|
||||||
|
@ -948,7 +947,7 @@ CResourceDirectoryEntry::CResourceDirectoryEntry(WCHAR* szName, CResourceDirecto
|
||||||
m_rdSubDir = rdSubDir;
|
m_rdSubDir = rdSubDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
CResourceDirectoryEntry::CResourceDirectoryEntry(WCHAR* szName, CResourceDataEntry* rdeData) {
|
CResourceDirectoryEntry::CResourceDirectoryEntry(const WCHAR* szName, CResourceDataEntry* rdeData) {
|
||||||
if (IS_INTRESOURCE(szName)) {
|
if (IS_INTRESOURCE(szName)) {
|
||||||
m_bHasName = false;
|
m_bHasName = false;
|
||||||
m_szName = 0;
|
m_szName = 0;
|
||||||
|
|
|
@ -114,10 +114,10 @@ public:
|
||||||
CResourceEditor(BYTE* pbPE, int iSize, bool bKeepData = true);
|
CResourceEditor(BYTE* pbPE, int iSize, bool bKeepData = true);
|
||||||
virtual ~CResourceEditor();
|
virtual ~CResourceEditor();
|
||||||
|
|
||||||
bool UpdateResource (TCHAR* szType, WORD szName, LANGID wLanguage, BYTE* lpData, DWORD dwSize);
|
bool UpdateResource (const TCHAR* szType, WORD szName, LANGID wLanguage, BYTE* lpData, DWORD dwSize);
|
||||||
BYTE* GetResource (TCHAR* szType, WORD szName, LANGID wLanguage);
|
BYTE* GetResource (const TCHAR* szType, WORD szName, LANGID wLanguage);
|
||||||
int GetResourceSize (TCHAR* szType, WORD szName, LANGID wLanguage);
|
int GetResourceSize (const TCHAR* szType, WORD szName, LANGID wLanguage);
|
||||||
DWORD GetResourceOffset(TCHAR* szType, WORD szName, LANGID wLanguage);
|
DWORD GetResourceOffset(const TCHAR* szType, WORD szName, LANGID wLanguage);
|
||||||
void FreeResource(BYTE* pbResource);
|
void FreeResource(BYTE* pbResource);
|
||||||
|
|
||||||
// The section name must be in ASCII.
|
// The section name must be in ASCII.
|
||||||
|
@ -135,10 +135,10 @@ public:
|
||||||
DWORD *pdwSectionIndex = NULL
|
DWORD *pdwSectionIndex = NULL
|
||||||
);
|
);
|
||||||
private:
|
private:
|
||||||
bool UpdateResourceW(WCHAR* szType, WCHAR* szName, LANGID wLanguage, BYTE* lpData, DWORD dwSize);
|
bool UpdateResourceW(const WCHAR* szType, WCHAR* szName, LANGID wLanguage, BYTE* lpData, DWORD dwSize);
|
||||||
BYTE* GetResourceW(WCHAR* szType, WCHAR* szName, LANGID wLanguage);
|
BYTE* GetResourceW(const WCHAR* szType, WCHAR* szName, LANGID wLanguage);
|
||||||
int GetResourceSizeW(WCHAR* szType, WCHAR* szName, LANGID wLanguage);
|
int GetResourceSizeW(const WCHAR* szType, WCHAR* szName, LANGID wLanguage);
|
||||||
DWORD GetResourceOffsetW(WCHAR* szType, WCHAR* szName, LANGID wLanguage);
|
DWORD GetResourceOffsetW(const WCHAR* szType, WCHAR* szName, LANGID wLanguage);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BYTE* m_pbPE;
|
BYTE* m_pbPE;
|
||||||
|
@ -172,7 +172,7 @@ public:
|
||||||
void AddEntry(CResourceDirectoryEntry* entry);
|
void AddEntry(CResourceDirectoryEntry* entry);
|
||||||
void RemoveEntry(int i);
|
void RemoveEntry(int i);
|
||||||
int CountEntries();
|
int CountEntries();
|
||||||
int Find(WCHAR* szName);
|
int Find(const WCHAR* szName);
|
||||||
int Find(WORD wId);
|
int Find(WORD wId);
|
||||||
|
|
||||||
DWORD GetSize();
|
DWORD GetSize();
|
||||||
|
@ -188,8 +188,8 @@ private:
|
||||||
|
|
||||||
class CResourceDirectoryEntry {
|
class CResourceDirectoryEntry {
|
||||||
public:
|
public:
|
||||||
CResourceDirectoryEntry(WCHAR* szName, CResourceDirectory* rdSubDir);
|
CResourceDirectoryEntry(const WCHAR* szName, CResourceDirectory* rdSubDir);
|
||||||
CResourceDirectoryEntry(WCHAR* szName, CResourceDataEntry* rdeData);
|
CResourceDirectoryEntry(const WCHAR* szName, CResourceDataEntry* rdeData);
|
||||||
virtual ~CResourceDirectoryEntry();
|
virtual ~CResourceDirectoryEntry();
|
||||||
|
|
||||||
bool HasName();
|
bool HasName();
|
||||||
|
|
127
Source/build.cpp
127
Source/build.cpp
|
@ -41,12 +41,13 @@
|
||||||
#include "ResourceVersionInfo.h"
|
#include "ResourceVersionInfo.h"
|
||||||
#include "tstring.h"
|
#include "tstring.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
# include <locale.h>
|
# include <locale.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <stdarg.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cassert> // for assert
|
#include <cassert> // for assert
|
||||||
|
@ -57,12 +58,6 @@
|
||||||
return rc; \
|
return rc; \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
const LONG available_stub_variants[] =
|
|
||||||
{
|
|
||||||
0x00000000, // classic ANSI stub
|
|
||||||
0x00050000 // Unicode stub for Windows 2000 and more recent (5.0+)
|
|
||||||
};
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace { // begin anonymous namespace
|
namespace { // begin anonymous namespace
|
||||||
|
@ -135,9 +130,8 @@ CEXEBuild::CEXEBuild() :
|
||||||
definedlist.add(_T("NSIS_PACKEDVERSION"), NSIS_PACKEDVERSION);
|
definedlist.add(_T("NSIS_PACKEDVERSION"), NSIS_PACKEDVERSION);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
target_minimal_OS=0;
|
|
||||||
build_unicode=false;
|
build_unicode=false;
|
||||||
definedlist.add(_T("NSIS_CHAR_SIZE"), _T("1")); // this can change after a TargetMinimalOS instruction is found
|
m_target_type=TARGET_X86ANSI;
|
||||||
|
|
||||||
// automatically generated header file containing all defines
|
// automatically generated header file containing all defines
|
||||||
#include <nsis-defines.h>
|
#include <nsis-defines.h>
|
||||||
|
@ -269,7 +263,7 @@ CEXEBuild::CEXEBuild() :
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||||
build_plugin_unload=0;
|
build_plugin_unload=0;
|
||||||
plugins_processed=0;
|
m_pPlugins=0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
last_used_lang=NSIS_DEFAULT_LANG;
|
last_used_lang=NSIS_DEFAULT_LANG;
|
||||||
|
@ -441,6 +435,8 @@ CEXEBuild::CEXEBuild() :
|
||||||
set_uninstall_mode(0);
|
set_uninstall_mode(0);
|
||||||
|
|
||||||
set_code_type_predefines();
|
set_code_type_predefines();
|
||||||
|
|
||||||
|
set_target_architecture_predefines();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXEBuild::initialize(const TCHAR *makensis_path)
|
void CEXEBuild::initialize(const TCHAR *makensis_path)
|
||||||
|
@ -1802,7 +1798,7 @@ int CEXEBuild::AddVersionInfo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("Error adding version information: %s\n"), CtoTString(err.what()));
|
ERROR_MSG(_T("Error adding version information: %s\n"), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2208,7 +2204,7 @@ again:
|
||||||
SCRIPT_MSG(_T("Done!\n"));
|
SCRIPT_MSG(_T("Done!\n"));
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("\nError: %s\n"), CtoTString(err.what()));
|
ERROR_MSG(_T("\nError: %s\n"), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2330,7 +2326,7 @@ int CEXEBuild::SetVarsSection()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("\nError: %s\n"), CtoTString(err.what()));
|
ERROR_MSG(_T("\nError: %s\n"), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2351,7 +2347,7 @@ int CEXEBuild::SetManifest()
|
||||||
res_editor->UpdateResource(MAKEINTRESOURCE(24), 1, NSIS_DEFAULT_LANG, (LPBYTE) manifest.c_str(), manifest.length());
|
res_editor->UpdateResource(MAKEINTRESOURCE(24), 1, NSIS_DEFAULT_LANG, (LPBYTE) manifest.c_str(), manifest.length());
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("Error setting manifest: %s\n"), CtoTString(err.what()));
|
ERROR_MSG(_T("Error setting manifest: %s\n"), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2368,7 +2364,7 @@ int CEXEBuild::UpdatePEHeader()
|
||||||
// terminal services aware
|
// terminal services aware
|
||||||
headers->OptionalHeader.DllCharacteristics |= IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE;
|
headers->OptionalHeader.DllCharacteristics |= IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE;
|
||||||
} catch (std::runtime_error& err) {
|
} catch (std::runtime_error& err) {
|
||||||
ERROR_MSG(_T("Error updating PE headers: %s\n"), CtoTString(err.what()));
|
ERROR_MSG(_T("Error updating PE headers: %s\n"), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2569,7 +2565,7 @@ int CEXEBuild::write_output(void)
|
||||||
close_res_editor();
|
close_res_editor();
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("\nError: %s\n"), CtoTString(err.what()));
|
ERROR_MSG(_T("\nError: %s\n"), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3418,24 +3414,31 @@ void CEXEBuild::notify(notify_e code, const TCHAR *data) const
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Added by Ximon Eighteen 5th August 2002
|
|
||||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||||
void CEXEBuild::build_plugin_table(void)
|
int CEXEBuild::initialize_default_plugins(bool newtargetarc)
|
||||||
{
|
{
|
||||||
if (plugins_processed)
|
if (!m_pPlugins)
|
||||||
return;
|
{
|
||||||
plugins_processed=1;
|
plugin_used = uninst_plugin_used = false;
|
||||||
|
newtargetarc = true;
|
||||||
|
}
|
||||||
|
if (!newtargetarc) return PS_OK;
|
||||||
|
|
||||||
|
m_pPlugins = &m_plugins[m_target_type];
|
||||||
|
|
||||||
plugin_used = false;
|
|
||||||
uninst_plugin_used = false;
|
|
||||||
tstring searchPath = definedlist.find(_T("NSISDIR"));
|
tstring searchPath = definedlist.find(_T("NSISDIR"));
|
||||||
searchPath += PLATFORM_PATH_SEPARATOR_STR _T("Plugins");
|
searchPath += PLATFORM_PATH_SEPARATOR_STR _T("Plugins") PLATFORM_PATH_SEPARATOR_STR;
|
||||||
INFO_MSG(_T("Processing plugin dlls: \"%s") PLATFORM_PATH_SEPARATOR_STR _T("*.dll\"\n"),searchPath.c_str());
|
searchPath += get_target_suffix();
|
||||||
m_plugins.FindCommands(searchPath, display_info?true:false);
|
|
||||||
INFO_MSG(_T("\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
#define FLAG_OFFSET(flag) (FIELD_OFFSET(exec_flags_t, flag)/sizeof(int))
|
SCRIPT_MSG(_T("Processing default plugins: \"%s") PLATFORM_PATH_SEPARATOR_STR _T("*.dll\"\n"), searchPath.c_str());
|
||||||
|
if (!m_pPlugins->Initialize(searchPath.c_str(), !!display_script))
|
||||||
|
{
|
||||||
|
ERROR_MSG(_T("Error initializing default plugins!\n"));
|
||||||
|
return PS_ERROR;
|
||||||
|
}
|
||||||
|
SCRIPT_MSG(_T("\n"));
|
||||||
|
return PS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
int CEXEBuild::add_plugins_dir_initializer(void)
|
int CEXEBuild::add_plugins_dir_initializer(void)
|
||||||
{
|
{
|
||||||
|
@ -3634,14 +3637,11 @@ void CEXEBuild::VerifyDeclaredUserVarRefs(UserVarsStringList *pVarsStringList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _UNICODE
|
void CEXEBuild::set_target_architecture_predefines()
|
||||||
int CEXEBuild::set_target_minimal_OS(int major, int minor)
|
|
||||||
{
|
{
|
||||||
target_minimal_OS = MAKELONG(minor,major);
|
|
||||||
build_unicode = major>=5;
|
|
||||||
definedlist.del(_T("NSIS_UNICODE"));
|
definedlist.del(_T("NSIS_UNICODE"));
|
||||||
definedlist.del(_T("NSIS_CHAR_SIZE"));
|
definedlist.del(_T("NSIS_CHAR_SIZE"));
|
||||||
if (build_unicode) // update defines depending on target installer type
|
if (build_unicode)
|
||||||
{
|
{
|
||||||
definedlist.add(_T("NSIS_UNICODE"));
|
definedlist.add(_T("NSIS_UNICODE"));
|
||||||
definedlist.add(_T("NSIS_CHAR_SIZE"), _T("2"));
|
definedlist.add(_T("NSIS_CHAR_SIZE"), _T("2"));
|
||||||
|
@ -3650,7 +3650,31 @@ int CEXEBuild::set_target_minimal_OS(int major, int minor)
|
||||||
{
|
{
|
||||||
definedlist.add(_T("NSIS_CHAR_SIZE"), _T("1"));
|
definedlist.add(_T("NSIS_CHAR_SIZE"), _T("1"));
|
||||||
}
|
}
|
||||||
return load_stub();
|
}
|
||||||
|
|
||||||
|
int CEXEBuild::change_target_architecture()
|
||||||
|
{
|
||||||
|
if (build_compressor_set)
|
||||||
|
{
|
||||||
|
ERROR_MSG(_T("Error: Can't change target architecture after data already got compressed!\n"));
|
||||||
|
return PS_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_target_type = build_unicode ? TARGET_X86UNICODE : TARGET_X86ANSI;
|
||||||
|
set_target_architecture_predefines();
|
||||||
|
|
||||||
|
int ec = load_stub();
|
||||||
|
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||||
|
if (PS_OK==ec) ec = initialize_default_plugins(true);
|
||||||
|
#endif
|
||||||
|
return ec;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _UNICODE
|
||||||
|
int CEXEBuild::set_target_charset(bool unicode)
|
||||||
|
{
|
||||||
|
build_unicode = unicode;
|
||||||
|
return change_target_architecture();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3661,26 +3685,29 @@ int CEXEBuild::set_compressor(const tstring& compressor, const bool solid) {
|
||||||
return load_stub();
|
return load_stub();
|
||||||
}
|
}
|
||||||
|
|
||||||
tstring CEXEBuild::get_stub_variant_suffix()
|
CEXEBuild::TARGETTYPE CEXEBuild::get_target_type(const TCHAR*s) const
|
||||||
{
|
{
|
||||||
LONG variant = 0;
|
for(int i = CEXEBuild::TARGETFIRST; i < CEXEBuild::TARGETCOUNT; ++i)
|
||||||
for (unsigned int index = 0; index < COUNTOF(available_stub_variants); index++)
|
{
|
||||||
{
|
CEXEBuild::TARGETTYPE tt = (CEXEBuild::TARGETTYPE) i;
|
||||||
if (target_minimal_OS >= available_stub_variants[index])
|
if (!_tcsicmp(get_target_suffix(tt),s)) return tt;
|
||||||
variant = available_stub_variants[index];
|
}
|
||||||
else
|
return TARGET_UNKNOWN;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
if (variant == 0)
|
const TCHAR* CEXEBuild::get_target_suffix(CEXEBuild::TARGETTYPE tt) const
|
||||||
return tstring();
|
{
|
||||||
TCHAR buf[32];
|
switch(tt)
|
||||||
_stprintf(buf, _T(".%d_%d"), HIWORD(variant), LOWORD(variant));
|
{
|
||||||
return tstring(buf);
|
case TARGET_X86ANSI :return _T("x86-ansi");
|
||||||
|
case TARGET_X86UNICODE:return _T("x86-unicode");
|
||||||
|
default:return _T("?");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CEXEBuild::load_stub()
|
int CEXEBuild::load_stub()
|
||||||
{
|
{
|
||||||
return update_exehead(stub_filename+get_stub_variant_suffix(), &m_exehead_original_size);
|
return update_exehead(stub_filename+_T("-")+get_target_suffix(), &m_exehead_original_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CEXEBuild::update_exehead(const tstring& file, size_t *size/*=NULL*/) {
|
int CEXEBuild::update_exehead(const tstring& file, size_t *size/*=NULL*/) {
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "mmap.h"
|
#include "mmap.h"
|
||||||
#include "manifest.h"
|
#include "manifest.h"
|
||||||
#include "icon.h"
|
#include "icon.h"
|
||||||
|
#include <memory.h>
|
||||||
|
|
||||||
#include "exehead/fileform.h"
|
#include "exehead/fileform.h"
|
||||||
#include "exehead/config.h"
|
#include "exehead/config.h"
|
||||||
|
@ -48,7 +49,6 @@
|
||||||
#include "czlib.h"
|
#include "czlib.h"
|
||||||
#include "cbzip2.h"
|
#include "cbzip2.h"
|
||||||
#include "clzma.h"
|
#include "clzma.h"
|
||||||
|
|
||||||
#endif//NSIS_CONFIG_COMPRESSION_SUPPORT
|
#endif//NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||||
|
@ -70,10 +70,10 @@
|
||||||
#define TP_ALL (TP_CODE | TP_PG)
|
#define TP_ALL (TP_CODE | TP_PG)
|
||||||
|
|
||||||
enum notify_e {
|
enum notify_e {
|
||||||
MAKENSIS_NOTIFY_SCRIPT,
|
MAKENSIS_NOTIFY_SCRIPT, // main nsi file(s)
|
||||||
MAKENSIS_NOTIFY_WARNING,
|
MAKENSIS_NOTIFY_WARNING,
|
||||||
MAKENSIS_NOTIFY_ERROR,
|
MAKENSIS_NOTIFY_ERROR,
|
||||||
MAKENSIS_NOTIFY_OUTPUT
|
MAKENSIS_NOTIFY_OUTPUT // generated .exe file
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PAGE_CUSTOM 0
|
#define PAGE_CUSTOM 0
|
||||||
|
@ -84,26 +84,31 @@ enum notify_e {
|
||||||
#define PAGE_UNINSTCONFIRM 5
|
#define PAGE_UNINSTCONFIRM 5
|
||||||
#define PAGE_COMPLETED 6
|
#define PAGE_COMPLETED 6
|
||||||
|
|
||||||
|
#define FLAG_OFFSET(flag) (FIELD_OFFSET(exec_flags_t, flag)/sizeof(int))
|
||||||
|
|
||||||
class CEXEBuild {
|
class CEXEBuild {
|
||||||
public:
|
public:
|
||||||
CEXEBuild();
|
CEXEBuild();
|
||||||
void initialize(const TCHAR *makensis_path);
|
void initialize(const TCHAR *makensis_path);
|
||||||
~CEXEBuild();
|
~CEXEBuild();
|
||||||
|
|
||||||
// to add a warning to the compiler's warning list.
|
void warning(const TCHAR *s, ...); // to add a warning to the compiler's warning list.
|
||||||
void warning(const TCHAR *s, ...);
|
void warning_fl(const TCHAR *s, ...); // warning with file name and line count
|
||||||
// warning with file name and line count
|
void ERROR_MSG(const TCHAR *s, ...) const;
|
||||||
void warning_fl(const TCHAR *s, ...);
|
void SCRIPT_MSG(const TCHAR *s, ...) const;
|
||||||
|
void INFO_MSG(const TCHAR *s, ...) const;
|
||||||
// to add a defined thing.
|
|
||||||
void define(const TCHAR *p, const TCHAR *v=TEXT(""));
|
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
|
||||||
// Added by Ximon Eighteen 5th August 2002
|
|
||||||
void build_plugin_table(void);
|
|
||||||
int plugins_processed;
|
|
||||||
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
TARGETFIRST,
|
||||||
|
TARGET_X86ANSI = TARGETFIRST,
|
||||||
|
TARGET_X86UNICODE,
|
||||||
|
TARGET_UNKNOWN,
|
||||||
|
TARGETCOUNT = (TARGET_UNKNOWN-TARGETFIRST)
|
||||||
|
} TARGETTYPE;
|
||||||
|
TARGETTYPE m_target_type;
|
||||||
|
TARGETTYPE get_target_type(const TCHAR*s) const;
|
||||||
|
const TCHAR* get_target_suffix(CEXEBuild::TARGETTYPE tt) const;
|
||||||
|
const TCHAR* get_target_suffix() const {return get_target_suffix(m_target_type);}
|
||||||
|
|
||||||
void set_default_output_filename(const tstring& filename);
|
void set_default_output_filename(const tstring& filename);
|
||||||
|
|
||||||
|
@ -119,6 +124,7 @@ class CEXEBuild {
|
||||||
|
|
||||||
DefineList definedlist; // List of identifiers marked as "defined" like
|
DefineList definedlist; // List of identifiers marked as "defined" like
|
||||||
// C++ macro definitions such as _UNICODE.
|
// C++ macro definitions such as _UNICODE.
|
||||||
|
void define(const TCHAR *p, const TCHAR *v=TEXT("")); // to add a defined thing.
|
||||||
|
|
||||||
int display_errors;
|
int display_errors;
|
||||||
int display_script;
|
int display_script;
|
||||||
|
@ -138,9 +144,8 @@ class CEXEBuild {
|
||||||
int prepare_uninstaller();
|
int prepare_uninstaller();
|
||||||
int pack_exe_header();
|
int pack_exe_header();
|
||||||
|
|
||||||
int set_target_minimal_OS(int major, int minor);
|
int set_target_charset(bool unicode);
|
||||||
int set_compressor(const tstring& compressor, const bool solid);
|
int set_compressor(const tstring& compressor, const bool solid);
|
||||||
tstring get_stub_variant_suffix();
|
|
||||||
int load_stub();
|
int load_stub();
|
||||||
int update_exehead(const tstring& file, size_t *size=NULL);
|
int update_exehead(const tstring& file, size_t *size=NULL);
|
||||||
void update_exehead(const unsigned char *new_exehead, size_t new_size);
|
void update_exehead(const unsigned char *new_exehead, size_t new_size);
|
||||||
|
@ -148,6 +153,7 @@ class CEXEBuild {
|
||||||
// tokens.cpp
|
// tokens.cpp
|
||||||
bool is_valid_token(TCHAR *s);
|
bool is_valid_token(TCHAR *s);
|
||||||
int get_commandtoken(TCHAR *s, int *np, int *op, int *pos);
|
int get_commandtoken(TCHAR *s, int *np, int *op, int *pos);
|
||||||
|
const TCHAR* get_commandtoken_name(int tok);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current "state" by looking at whether it is in a
|
* Returns the current "state" by looking at whether it is in a
|
||||||
|
@ -210,17 +216,11 @@ class CEXEBuild {
|
||||||
bool inside_comment;
|
bool inside_comment;
|
||||||
int multiple_entries_instruction; // 1 (true) or 0 (false)
|
int multiple_entries_instruction; // 1 (true) or 0 (false)
|
||||||
|
|
||||||
void ERROR_MSG(const TCHAR *s, ...) const;
|
|
||||||
void SCRIPT_MSG(const TCHAR *s, ...) const;
|
|
||||||
void INFO_MSG(const TCHAR *s, ...) const;
|
|
||||||
|
|
||||||
DefineList *searchParseString(const TCHAR *source_string, LineParser *line, int parmOffs, bool ignCase, bool noErrors);
|
DefineList *searchParseString(const TCHAR *source_string, LineParser *line, int parmOffs, bool ignCase, bool noErrors);
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
|
||||||
int add_plugins_dir_initializer(void);
|
|
||||||
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
|
||||||
|
|
||||||
// build.cpp functions used mostly by script.cpp
|
// build.cpp functions used mostly by script.cpp
|
||||||
|
void set_target_architecture_predefines();
|
||||||
|
int change_target_architecture();
|
||||||
void set_code_type_predefines(const TCHAR *value = NULL);
|
void set_code_type_predefines(const TCHAR *value = NULL);
|
||||||
int getcurdbsize();
|
int getcurdbsize();
|
||||||
int add_section(const TCHAR *secname, const TCHAR *defname, int expand=0);
|
int add_section(const TCHAR *secname, const TCHAR *defname, int expand=0);
|
||||||
|
@ -244,11 +244,12 @@ class CEXEBuild {
|
||||||
int preprocess_string(TCHAR *out, const TCHAR *in, WORD codepage=CP_ACP);
|
int preprocess_string(TCHAR *out, const TCHAR *in, WORD codepage=CP_ACP);
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||||
// Added by Ximon Eighteen 5th August 2002
|
int add_plugins_dir_initializer(void);
|
||||||
Plugins m_plugins;
|
int initialize_default_plugins(bool newtargetarc = false);
|
||||||
|
Plugins m_plugins[TARGETCOUNT], *m_pPlugins;
|
||||||
bool plugin_used;
|
bool plugin_used;
|
||||||
bool uninst_plugin_used;
|
bool uninst_plugin_used;
|
||||||
int build_plugin_unload;
|
int build_plugin_unload; // TOK_SETPLUGINUNLOAD
|
||||||
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
||||||
|
|
||||||
// build.cpp functions used mostly within build.cpp
|
// build.cpp functions used mostly within build.cpp
|
||||||
|
@ -324,7 +325,7 @@ class CEXEBuild {
|
||||||
* variable 'name' for a given language ID.
|
* variable 'name' for a given language ID.
|
||||||
*
|
*
|
||||||
* @return If the language id, the variable name or string is invalid, it will
|
* @return If the language id, the variable name or string is invalid, it will
|
||||||
* return aPS_ERROR. If this function call is overwriting a set user string,
|
* return a PS_ERROR. If this function call is overwriting a set user string,
|
||||||
* this will return a PS_WARNING.
|
* this will return a PS_WARNING.
|
||||||
*/
|
*/
|
||||||
int SetLangString(TCHAR *name, LANGID lang, const TCHAR *str, BOOL unicode);
|
int SetLangString(TCHAR *name, LANGID lang, const TCHAR *str, BOOL unicode);
|
||||||
|
@ -336,7 +337,7 @@ class CEXEBuild {
|
||||||
* Sets the user string to the specific NLF_STRINGS id.
|
* Sets the user string to the specific NLF_STRINGS id.
|
||||||
*
|
*
|
||||||
* @return If the id is invalid or the string is not valid, it will return
|
* @return If the id is invalid or the string is not valid, it will return
|
||||||
* aPS_ERROR. If this function call is overwriting a set user string,
|
* a PS_ERROR. If this function call is overwriting a set user string,
|
||||||
* this will return a PS_WARNING.
|
* this will return a PS_WARNING.
|
||||||
*/
|
*/
|
||||||
int SetInnerString(int id, TCHAR *str);
|
int SetInnerString(int id, TCHAR *str);
|
||||||
|
@ -403,8 +404,7 @@ class CEXEBuild {
|
||||||
int build_compress_dict_size;
|
int build_compress_dict_size;
|
||||||
|
|
||||||
bool no_space_texts;
|
bool no_space_texts;
|
||||||
LONG target_minimal_OS;
|
bool build_unicode;// generate installer with unicode exehead?
|
||||||
bool build_unicode;
|
|
||||||
|
|
||||||
bool has_called_write_output;
|
bool has_called_write_output;
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,7 @@ typedef unsigned short UInt16;
|
||||||
|
|
||||||
#ifndef EXEHEAD
|
#ifndef EXEHEAD
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#define BZALLOC(items) malloc(items)
|
#define BZALLOC(items) malloc(items)
|
||||||
#define BZFREE(addr) { if (addr) free(addr); }
|
#define BZFREE(addr) { if (addr) free(addr); }
|
||||||
#define mini_memcpy memcpy
|
#define mini_memcpy memcpy
|
||||||
|
|
|
@ -56,7 +56,8 @@ TCHAR *ValidateTempDir()
|
||||||
|
|
||||||
void *g_SHGetFolderPath;
|
void *g_SHGetFolderPath;
|
||||||
|
|
||||||
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPTSTR lpszCmdParam, int nCmdShow)
|
NSIS_ENTRYPOINT_GUINOCRT
|
||||||
|
EXTERN_C void NSISWinMainNOCRT()
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const TCHAR *m_Err = _LANG_ERRORWRITINGTEMP;
|
const TCHAR *m_Err = _LANG_ERRORWRITINGTEMP;
|
||||||
|
@ -307,7 +308,6 @@ end:
|
||||||
{
|
{
|
||||||
my_MessageBox(m_Err, MB_OK | MB_ICONSTOP | (IDOK << 21));
|
my_MessageBox(m_Err, MB_OK | MB_ICONSTOP | (IDOK << 21));
|
||||||
ExitProcess(2);
|
ExitProcess(2);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NSIS_SUPPORT_REBOOT
|
#ifdef NSIS_SUPPORT_REBOOT
|
||||||
|
@ -341,7 +341,6 @@ end:
|
||||||
ret = g_exec_flags.errlvl;
|
ret = g_exec_flags.errlvl;
|
||||||
|
|
||||||
ExitProcess(ret);
|
ExitProcess(ret);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NSISCALL CleanUp()
|
void NSISCALL CleanUp()
|
||||||
|
|
|
@ -59,6 +59,8 @@ env.Append(CPPDEFINES = ['_WIN32_IE=0x0500'])
|
||||||
|
|
||||||
if 'NSIS_CONFIG_LOG_STDOUT' in env['NSIS_CPPDEFINES']:
|
if 'NSIS_CONFIG_LOG_STDOUT' in env['NSIS_CPPDEFINES']:
|
||||||
env.Append(LINKFLAGS = env['SUBSYS_CON'])
|
env.Append(LINKFLAGS = env['SUBSYS_CON'])
|
||||||
|
else:
|
||||||
|
env.Append(LINKFLAGS = env['SUBSYS_WIN'])
|
||||||
|
|
||||||
### Compression specific configuration
|
### Compression specific configuration
|
||||||
|
|
||||||
|
|
|
@ -714,7 +714,7 @@ skipPage:
|
||||||
#include <richedit.h>
|
#include <richedit.h>
|
||||||
#undef _RICHEDIT_VER
|
#undef _RICHEDIT_VER
|
||||||
static DWORD dwRead;
|
static DWORD dwRead;
|
||||||
DWORD CALLBACK StreamLicense(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
|
DWORD CALLBACK StreamLicense(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
|
||||||
{
|
{
|
||||||
lstrcpyn((LPTSTR)pbBuff,(LPTSTR)(dwCookie+dwRead),cb/sizeof(TCHAR));
|
lstrcpyn((LPTSTR)pbBuff,(LPTSTR)(dwCookie+dwRead),cb/sizeof(TCHAR));
|
||||||
*pcb=lstrlen((LPTSTR)pbBuff)*sizeof(TCHAR);
|
*pcb=lstrlen((LPTSTR)pbBuff)*sizeof(TCHAR);
|
||||||
|
@ -723,11 +723,11 @@ DWORD CALLBACK StreamLicense(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
|
||||||
}
|
}
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
// on-the-fly conversion of Unicode to ANSI (because Windows doesn't recognize Unicode RTF data)
|
// on-the-fly conversion of Unicode to ANSI (because Windows doesn't recognize Unicode RTF data)
|
||||||
DWORD CALLBACK StreamLicenseRTF(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
|
DWORD CALLBACK StreamLicenseRTF(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
|
||||||
{
|
{
|
||||||
size_t len = lstrlen(((LPWSTR) dwCookie)+dwRead);
|
size_t len = lstrlen(((LPWSTR) dwCookie)+dwRead);
|
||||||
len = min(len, cb/sizeof(WCHAR));
|
len = min(len, cb/sizeof(WCHAR));
|
||||||
*pcb=WideCharToMultiByte(CP_ACP,0,((LPWSTR) dwCookie)+dwRead,len,pbBuff,cb,NULL,NULL);
|
*pcb=WideCharToMultiByte(CP_ACP,0,((LPWSTR) dwCookie)+dwRead,len,(char*)pbBuff,cb,NULL,NULL);
|
||||||
// RTF uses only ASCII characters, so we can assume "number of output bytes" = "number of source WChar consumed"
|
// RTF uses only ASCII characters, so we can assume "number of output bytes" = "number of source WChar consumed"
|
||||||
dwRead+=*pcb;
|
dwRead+=*pcb;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -49,7 +49,7 @@ NSIS_STRING g_usrvarssection[1];
|
||||||
# ifdef __GNUC__
|
# ifdef __GNUC__
|
||||||
// GCC does not treat g_usrvarssection as a bss section so we keep the size as small as possible.
|
// GCC does not treat g_usrvarssection as a bss section so we keep the size as small as possible.
|
||||||
// NSIS_STRING g_usrvarssection[31] is required to remove this hack but that really bloats the exehead.
|
// NSIS_STRING g_usrvarssection[31] is required to remove this hack but that really bloats the exehead.
|
||||||
char g_usrvarssection[1] __attribute__((section (NSIS_VARS_SECTION)));
|
TCHAR g_usrvarssection[1] __attribute__((section (NSIS_VARS_SECTION)));
|
||||||
const NSIS_STRING*const g_usrvarsstart = (const NSIS_STRING*const) g_usrvarssection;
|
const NSIS_STRING*const g_usrvarsstart = (const NSIS_STRING*const) g_usrvarssection;
|
||||||
# else
|
# else
|
||||||
# error Unknown compiler. You must implement the seperate PE section yourself.
|
# error Unknown compiler. You must implement the seperate PE section yourself.
|
||||||
|
|
|
@ -416,7 +416,7 @@ int generate_unicons_offsets(LPBYTE exeHeader, size_t exeHeaderSize, LPBYTE unin
|
||||||
catch (const exception& e)
|
catch (const exception& e)
|
||||||
{
|
{
|
||||||
if (g_display_errors)
|
if (g_display_errors)
|
||||||
PrintColorFmtMsg_ERR(_T("\nError generating uninstaller icon: %s -- failing!\n"), CtoTString(e.what()));
|
PrintColorFmtMsg_ERR(_T("\nError generating uninstaller icon: %s -- failing!\n"), CtoTStrParam(e.what()));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -751,7 +751,7 @@ int CEXEBuild::GenerateLangTables() {
|
||||||
#undef ADD_FONT
|
#undef ADD_FONT
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("\nError while applying font: %s\n"), CtoTString(err.what()));
|
ERROR_MSG(_T("\nError while applying font: %s\n"), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -814,7 +814,7 @@ int CEXEBuild::GenerateLangTables() {
|
||||||
#undef ADD_FONT
|
#undef ADD_FONT
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("\nError while applying NLF font/RTL: %s\n"), CtoTString(err.what()));
|
ERROR_MSG(_T("\nError while applying NLF font/RTL: %s\n"), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "utf.h"
|
||||||
|
|
||||||
#include <nsis-version.h>
|
#include <nsis-version.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -135,27 +136,29 @@ static void print_license()
|
||||||
static void print_usage()
|
static void print_usage()
|
||||||
{
|
{
|
||||||
_ftprintf(g_output,_T("Usage:\n")
|
_ftprintf(g_output,_T("Usage:\n")
|
||||||
_T(" makensis [option | script.nsi | - [...]]\n")
|
_T(" ") _T("makensis [ option | script.nsi | - ] [...]\n")
|
||||||
_T(" options are:\n")
|
_T("\n")
|
||||||
_T(" ") OPT_STR _T("CMDHELP item prints out help for 'item', or lists all commands\n")
|
_T("Options:\n")
|
||||||
_T(" ") OPT_STR _T("HDRINFO prints information about what options makensis was compiled with\n")
|
_T(" ") OPT_STR _T("CMDHELP item prints out help for 'item', or lists all commands\n")
|
||||||
_T(" ") OPT_STR _T("LICENSE prints the makensis software license\n")
|
_T(" ") OPT_STR _T("HDRINFO prints information about what options makensis was compiled with\n")
|
||||||
_T(" ") OPT_STR _T("VERSION prints the makensis version and exits\n")
|
_T(" ") OPT_STR _T("LICENSE prints the makensis software license\n")
|
||||||
_T(" ") OPT_STR _T("Px sets the compiler process priority, where x is 5=realtime,4=high,\n")
|
_T(" ") OPT_STR _T("VERSION prints the makensis version and exits\n")
|
||||||
_T(" ") _T(" 3=above normal,2=normal,1=below normal,0=idle\n")
|
_T(" ") OPT_STR _T("Px sets the compiler process priority, where x is 5=realtime,4=high,\n")
|
||||||
_T(" ") OPT_STR _T("Vx verbosity where x is 4=all,3=no script,2=no info,1=no warnings,0=none\n")
|
_T(" ") _T(" 3=above normal,2=normal,1=below normal,0=idle\n")
|
||||||
_T(" ") OPT_STR _T("Ofile specifies a text file to log compiler output (default is stdout)\n")
|
_T(" ") OPT_STR _T("Vx verbosity where x is 4=all,3=no script,2=no info,1=no warnings,0=none\n")
|
||||||
_T(" ") OPT_STR _T("PAUSE pauses after execution\n")
|
_T(" ") OPT_STR _T("Ofile specifies a text file to log compiler output (default is stdout)\n")
|
||||||
_T(" ") OPT_STR _T("NOCONFIG disables inclusion of <path to makensis.exe>") PLATFORM_PATH_SEPARATOR_STR _T("nsisconf.nsh\n")
|
_T(" ") OPT_STR _T("PAUSE pauses after execution\n")
|
||||||
_T(" ") OPT_STR _T("NOCD disabled the current directory change to that of the .nsi file\n")
|
_T(" ") OPT_STR _T("NOCONFIG disables inclusion of <path to makensis.exe>") PLATFORM_PATH_SEPARATOR_STR _T("nsisconf.nsh\n")
|
||||||
_T(" ") OPT_STR _T("Ddefine[=value] defines the symbol \"define\" for the script [to value]\n")
|
_T(" ") OPT_STR _T("NOCD disabled the current directory change to that of the .nsi file\n")
|
||||||
_T(" ") OPT_STR _T("Xscriptcmd executes scriptcmd in script (i.e. \"") OPT_STR _T("XOutFile poop.exe\")\n")
|
_T(" ") OPT_STR _T("Ddefine[=value] defines the symbol \"define\" for the script [to value]\n")
|
||||||
_T(" parameters are processed by order (") OPT_STR _T("Ddef ins.nsi != ins.nsi ") OPT_STR _T("Ddef)\n")
|
_T(" ") OPT_STR _T("Xscriptcmd executes scriptcmd in script (i.e. \"") OPT_STR _T("XOutFile poop.exe\")\n")
|
||||||
_T(" for script file name, you can use - to read from the standard input\n")
|
_T(" ") _T(" parameters are processed by order (") OPT_STR _T("Ddef ins.nsi != ins.nsi ") OPT_STR _T("Ddef)\n")
|
||||||
#ifdef _WIN32
|
_T("\n")
|
||||||
_T(" you can also use - as an option character: -PAUSE as well as /PAUSE\n")
|
_T("For script file name, you can use - to read from the standard input\n")
|
||||||
|
#ifdef _WIN32
|
||||||
|
_T("You can also use - as an option character: -PAUSE as well as /PAUSE\n")
|
||||||
#endif
|
#endif
|
||||||
_T(" you can use a double-dash to end options processing: makensis -- -ins.nsi\n"));
|
_T("You can use a double-dash to end options processing: makensis -- -ins.nsi\n"));
|
||||||
fflush(g_output);
|
fflush(g_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,26 +205,15 @@ static int process_config(CEXEBuild& build, tstring& conf)
|
||||||
FILE *cfg=FOPENTEXT2(conf.c_str(),"rt",&unicode);
|
FILE *cfg=FOPENTEXT2(conf.c_str(),"rt",&unicode);
|
||||||
if (cfg)
|
if (cfg)
|
||||||
{
|
{
|
||||||
if (build.display_script)
|
build.INFO_MSG(_T("Processing config: %s\n"), conf.c_str());
|
||||||
{
|
|
||||||
_ftprintf(g_output,_T("Processing config: \n"));
|
|
||||||
fflush(g_output);
|
|
||||||
}
|
|
||||||
int ret=build.process_script(cfg,(TCHAR*)conf.c_str(),unicode);
|
int ret=build.process_script(cfg,(TCHAR*)conf.c_str(),unicode);
|
||||||
fclose(cfg);
|
fclose(cfg);
|
||||||
if (ret != PS_OK && ret != PS_EOF)
|
if (ret != PS_OK && ret != PS_EOF)
|
||||||
{
|
{
|
||||||
if (build.display_errors)
|
build.ERROR_MSG(_T("Error in config on line %d -- aborting creation process\n"),build.linecnt);
|
||||||
{
|
|
||||||
PrintColorFmtMsg_ERR(_T("Error in config on line %d -- aborting creation process\n"),build.linecnt);
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (build.display_script)
|
build.SCRIPT_MSG(_T("\n")); // Extra newline to separate the config from the real script
|
||||||
{
|
|
||||||
_ftprintf(g_output,_T("\n"));
|
|
||||||
fflush(g_output);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -231,24 +223,13 @@ static int change_to_script_dir(CEXEBuild& build, tstring& script)
|
||||||
tstring dir = get_dir_name(get_full_path(script));
|
tstring dir = get_dir_name(get_full_path(script));
|
||||||
if (!dir.empty())
|
if (!dir.empty())
|
||||||
{
|
{
|
||||||
if (build.display_script)
|
build.SCRIPT_MSG(_T("Changing directory to: \"%s\"\n"),dir.c_str());
|
||||||
{
|
|
||||||
_ftprintf(g_output,_T("Changing directory to: \"%s\"\n"),dir.c_str());
|
|
||||||
fflush(g_output);
|
|
||||||
}
|
|
||||||
if (_tchdir(dir.c_str()))
|
if (_tchdir(dir.c_str()))
|
||||||
{
|
{
|
||||||
if (build.display_errors)
|
build.ERROR_MSG(_T("Error changing directory to \"%s\"\n"),dir.c_str());
|
||||||
{
|
|
||||||
PrintColorFmtMsg_ERR(_T("Error changing directory to \"%s\"\n"),dir.c_str());
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (build.display_script)
|
build.SCRIPT_MSG(_T("\n"));
|
||||||
{
|
|
||||||
_ftprintf(g_output,_T("\n"));
|
|
||||||
fflush(g_output);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -257,6 +238,7 @@ static int change_to_script_dir(CEXEBuild& build, tstring& script)
|
||||||
extern "C" void allow_unaligned_data_access();
|
extern "C" void allow_unaligned_data_access();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
NSIS_ENTRYPOINT_TMAIN
|
||||||
int _tmain(int argc, TCHAR **argv)
|
int _tmain(int argc, TCHAR **argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -277,8 +259,8 @@ int _tmain(int argc, TCHAR **argv)
|
||||||
int in_files=0;
|
int in_files=0;
|
||||||
|
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
#if (defined(_MSC_VER) && (_MSC_VER<=1200))
|
#ifndef _O_U8TEXT
|
||||||
const int _O_U8TEXT=0x40000; // BUGBUG: This is bogus
|
const int _O_U8TEXT=0x40000; // BUGBUG: This is bogus (Makensis will ONLY work on NT6)
|
||||||
#endif
|
#endif
|
||||||
_setmode(_fileno(stdout), _O_U8TEXT); // set stdout to UTF-8
|
_setmode(_fileno(stdout), _O_U8TEXT); // set stdout to UTF-8
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -292,7 +274,7 @@ int _tmain(int argc, TCHAR **argv)
|
||||||
}
|
}
|
||||||
catch (exception& err)
|
catch (exception& err)
|
||||||
{
|
{
|
||||||
PrintColorFmtMsg_ERR(_T("Error initalizing CEXEBuild: %s\n"), CtoTString(err.what()));
|
PrintColorFmtMsg_ERR(_T("Error initalizing CEXEBuild: %s\n"), CtoTStrParam(err.what()));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,18 +284,18 @@ int _tmain(int argc, TCHAR **argv)
|
||||||
fflush(g_output);
|
fflush(g_output);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (argc > 1 && IS_OPT(argv[tmpargpos]) && (argv[tmpargpos][1]==_T('v') || argv[tmpargpos][1]==_T('V')))
|
if (argc > 1 && IS_OPT(argv[tmpargpos]) && S7IsChEqualI('v',argv[tmpargpos][1]))
|
||||||
{
|
{
|
||||||
if (argv[tmpargpos][2] <= _T('2') && argv[tmpargpos][2] >= _T('0'))
|
if (argv[tmpargpos][2] <= _T('2') && argv[tmpargpos][2] >= _T('0'))
|
||||||
{
|
{
|
||||||
no_logo=1;
|
no_logo=1;
|
||||||
}
|
}
|
||||||
tmpargpos++;
|
tmpargpos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!no_logo)
|
if (!no_logo)
|
||||||
{
|
{
|
||||||
if (argc > tmpargpos && IS_OPT(argv[tmpargpos]) && (argv[tmpargpos][1]==_T('o') || argv[tmpargpos][1]==_T('O')) && argv[tmpargpos][2])
|
if (argc > tmpargpos && IS_OPT(argv[tmpargpos]) && S7IsChEqualI('o',argv[tmpargpos][1]) && argv[tmpargpos][2])
|
||||||
{
|
{
|
||||||
g_output=FOPENTEXT(argv[tmpargpos]+2,"w");
|
g_output=FOPENTEXT(argv[tmpargpos]+2,"w");
|
||||||
if (!g_output)
|
if (!g_output)
|
||||||
|
@ -335,21 +317,17 @@ int _tmain(int argc, TCHAR **argv)
|
||||||
in_files=1;
|
in_files=1;
|
||||||
else if (IS_OPT(argv[argpos]) && _tcscmp(argv[argpos], _T("-")) && !in_files)
|
else if (IS_OPT(argv[argpos]) && _tcscmp(argv[argpos], _T("-")) && !in_files)
|
||||||
{
|
{
|
||||||
if ((argv[argpos][1]==_T('D') || argv[argpos][1]==_T('d')) && argv[argpos][2])
|
if (S7IsChEqualI('d',argv[argpos][1]) && argv[argpos][2])
|
||||||
{
|
{
|
||||||
TCHAR *p=argv[argpos]+2;
|
TCHAR *p=argv[argpos]+2;
|
||||||
TCHAR *s=_tcsdup(p),*v;
|
TCHAR *s=_tcsdup(p),*v;
|
||||||
if (build.display_script)
|
build.SCRIPT_MSG(_T("Command line defined: \"%s\"\n"),p);
|
||||||
{
|
|
||||||
_ftprintf(g_output,_T("Command line defined: \"%s\"\n"),p);
|
|
||||||
fflush(g_output);
|
|
||||||
}
|
|
||||||
v=_tcsstr(s,_T("="));
|
v=_tcsstr(s,_T("="));
|
||||||
if (v) *v++=0;
|
if (v) *v++=0;
|
||||||
build.define(s,v?v:_T(""));
|
build.define(s,v?v:_T(""));
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
else if ((argv[argpos][1]==_T('X') || argv[argpos][1]==_T('x')) && argv[argpos][2])
|
else if (S7IsChEqualI('x',argv[argpos][1]) && argv[argpos][2])
|
||||||
{
|
{
|
||||||
if (build.process_oneline(argv[argpos]+2,_T("command line"),argpos+1) != PS_OK)
|
if (build.process_oneline(argv[argpos]+2,_T("command line"),argpos+1) != PS_OK)
|
||||||
{
|
{
|
||||||
|
@ -357,7 +335,7 @@ int _tmain(int argc, TCHAR **argv)
|
||||||
}
|
}
|
||||||
cmds_processed++;
|
cmds_processed++;
|
||||||
}
|
}
|
||||||
else if ((argv[argpos][1]==_T('O') || argv[argpos][1]==_T('o')) && argv[argpos][2])
|
else if (S7IsChEqualI('o',argv[argpos][1]) && argv[argpos][2])
|
||||||
{
|
{
|
||||||
if (!outputtried)
|
if (!outputtried)
|
||||||
{
|
{
|
||||||
|
@ -371,7 +349,7 @@ int _tmain(int argc, TCHAR **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!_tcsicmp(&argv[argpos][1],_T("NOCD"))) do_cd=0;
|
else if (!_tcsicmp(&argv[argpos][1],_T("NOCD"))) do_cd=0;
|
||||||
else if ((argv[argpos][1] == _T('V') || argv[argpos][1] == _T('v')) &&
|
else if (S7IsChEqualI('v',argv[argpos][1]) &&
|
||||||
argv[argpos][2] >= _T('0') && argv[argpos][2] <= _T('4') && !argv[argpos][3])
|
argv[argpos][2] >= _T('0') && argv[argpos][2] <= _T('4') && !argv[argpos][3])
|
||||||
{
|
{
|
||||||
int v=argv[argpos][2]-_T('0');
|
int v=argv[argpos][2]-_T('0');
|
||||||
|
@ -415,7 +393,7 @@ int _tmain(int argc, TCHAR **argv)
|
||||||
print_stub_info(build);
|
print_stub_info(build);
|
||||||
nousage++;
|
nousage++;
|
||||||
}
|
}
|
||||||
else if ((argv[argpos][1]==_T('P') || argv[argpos][1]==_T('p')) &&
|
else if (S7IsChEqualI('p',argv[argpos][1]) &&
|
||||||
argv[argpos][2] >= _T('0') && argv[argpos][2] <= _T('5') && !argv[argpos][3])
|
argv[argpos][2] >= _T('0') && argv[argpos][2] <= _T('5') && !argv[argpos][3])
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -504,11 +482,8 @@ int _tmain(int argc, TCHAR **argv)
|
||||||
fp=FOPENTEXT2(sfile,"rt",&unicode);
|
fp=FOPENTEXT2(sfile,"rt",&unicode);
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
if (build.display_errors)
|
sfile[_tcslen(sfile)-4]=0;
|
||||||
{
|
build.ERROR_MSG(_T("Can't open script \"%s\"\n"),sfile);
|
||||||
sfile[_tcslen(sfile)-4]=0;
|
|
||||||
PrintColorFmtMsg_ERR(_T("Can't open script \"%s\"\n"),sfile);
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -521,21 +496,14 @@ int _tmain(int argc, TCHAR **argv)
|
||||||
build.set_default_output_filename(remove_file_extension(sfile)+_T(".exe"));
|
build.set_default_output_filename(remove_file_extension(sfile)+_T(".exe"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (build.display_script)
|
build.notify(MAKENSIS_NOTIFY_SCRIPT,sfile);
|
||||||
{
|
build.INFO_MSG(_T("Processing script file: \"%s\"\n"),sfile);
|
||||||
build.notify(MAKENSIS_NOTIFY_SCRIPT,sfile);
|
|
||||||
_ftprintf(g_output,_T("Processing script file: \"%s\"\n"),sfile);
|
|
||||||
fflush(g_output);
|
|
||||||
}
|
|
||||||
int ret=build.process_script(fp,sfile,unicode);
|
int ret=build.process_script(fp,sfile,unicode);
|
||||||
if (fp != stdin) fclose(fp);
|
if (fp != stdin) fclose(fp);
|
||||||
|
|
||||||
if (ret != PS_EOF && ret != PS_OK)
|
if (ret != PS_EOF && ret != PS_OK)
|
||||||
{
|
{
|
||||||
if (build.display_errors)
|
build.ERROR_MSG(_T("Error in script \"%s\" on line %d -- aborting creation process\n"),sfile,build.linecnt);
|
||||||
{
|
|
||||||
PrintColorFmtMsg_ERR(_T("Error in script \"%s\" on line %d -- aborting creation process\n"),sfile,build.linecnt);
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -557,16 +525,13 @@ int _tmain(int argc, TCHAR **argv)
|
||||||
_ftprintf(g_output,_T("\nProcessed "));
|
_ftprintf(g_output,_T("\nProcessed "));
|
||||||
if (files_processed) _ftprintf(g_output,_T("%d file%s, "),files_processed,files_processed==1?_T(""):_T("s"));
|
if (files_processed) _ftprintf(g_output,_T("%d file%s, "),files_processed,files_processed==1?_T(""):_T("s"));
|
||||||
if (cmds_processed) _ftprintf(g_output,_T("%d command line command%s, "),cmds_processed,cmds_processed==1?_T(""):_T("s"));
|
if (cmds_processed) _ftprintf(g_output,_T("%d command line command%s, "),cmds_processed,cmds_processed==1?_T(""):_T("s"));
|
||||||
_ftprintf(g_output,_T("writing output:\n"));
|
_ftprintf(g_output,_T("writing output (%s):\n"),build.get_target_suffix());
|
||||||
fflush(g_output);
|
fflush(g_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (build.write_output())
|
if (build.write_output())
|
||||||
{
|
{
|
||||||
if (build.display_errors)
|
build.ERROR_MSG(_T("Error - aborting creation process\n"));
|
||||||
{
|
|
||||||
PrintColorFmtMsg_ERR(_T("Error - aborting creation process\n"));
|
|
||||||
}
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "manifest.h"
|
#include "manifest.h"
|
||||||
#include <nsis-version.h>
|
#include <nsis-version.h>
|
||||||
#include "tstring.h"
|
#include "tstring.h"
|
||||||
|
#include "utf.h"
|
||||||
|
|
||||||
// Jim Park: The manifest must stay UTF-8. Do not convert.
|
// Jim Park: The manifest must stay UTF-8. Do not convert.
|
||||||
|
|
||||||
|
@ -53,9 +54,9 @@ bool SupportedOSList::append(const TCHAR* osid)
|
||||||
guid = osid;
|
guid = osid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!_tcsicmp(osid,"WinVista")) guid = _T("{e2011457-1546-43c5-a5fe-008deee3d3f0}");
|
else if (!_tcsicmp(osid,_T("WinVista"))) guid = _T("{e2011457-1546-43c5-a5fe-008deee3d3f0}");
|
||||||
else if (!_tcsicmp(osid,"Win7")) guid = _T("{35138b9a-5d96-4fbd-8e2d-a2440225f93a}");
|
else if (!_tcsicmp(osid,_T("Win7"))) guid = _T("{35138b9a-5d96-4fbd-8e2d-a2440225f93a}");
|
||||||
else if (!_tcsicmp(osid,"Win8")) guid = _T("{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}");
|
else if (!_tcsicmp(osid,_T("Win8"))) guid = _T("{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}");
|
||||||
|
|
||||||
if (guid)
|
if (guid)
|
||||||
{
|
{
|
||||||
|
@ -113,8 +114,14 @@ string generate(comctl comctl_selection, exec_level exec_level_selection, dpiawa
|
||||||
int soslcount = sosl.getcount();
|
int soslcount = sosl.getcount();
|
||||||
if (soslcount)
|
if (soslcount)
|
||||||
{
|
{
|
||||||
|
char buf[38+1];
|
||||||
xml += "<compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\"><application>";
|
xml += "<compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\"><application>";
|
||||||
while(soslcount--) xml += "<supportedOS Id=\"", xml += sosl.get(soslcount), xml += "\"/>";
|
while(soslcount--)
|
||||||
|
{
|
||||||
|
xml += "<supportedOS Id=\"";
|
||||||
|
RawTStrToASCII(sosl.get(soslcount), buf, COUNTOF(buf));
|
||||||
|
xml += buf, xml += "\"/>";
|
||||||
|
}
|
||||||
xml += "</application></compatibility>";
|
xml += "</application></compatibility>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,15 +68,15 @@ namespace manifest
|
||||||
}
|
}
|
||||||
void addall()
|
void addall()
|
||||||
{
|
{
|
||||||
append("WinVista");
|
append(_T("WinVista"));
|
||||||
append("Win7");
|
append(_T("Win7"));
|
||||||
append("Win8");
|
append(_T("Win8"));
|
||||||
}
|
}
|
||||||
void setdefault()
|
void setdefault()
|
||||||
{
|
{
|
||||||
m_list.deleteall();
|
m_list.deleteall();
|
||||||
append("Win7");
|
append(_T("Win7"));
|
||||||
append("Win8");
|
append(_T("Win8"));
|
||||||
m_isdefaultlist = true;
|
m_isdefaultlist = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -389,7 +389,8 @@ parse_again:
|
||||||
// Added by Ximon Eighteen 5th August 2002
|
// Added by Ximon Eighteen 5th August 2002
|
||||||
// We didn't recognise this command, could it be the name of a
|
// We didn't recognise this command, could it be the name of a
|
||||||
// function exported from a dll?
|
// function exported from a dll?
|
||||||
if (m_plugins.IsPluginCommand(line.gettoken_str(0)))
|
// Plugins cannot be called in global scope so there is no need to initialize the list first
|
||||||
|
if (m_pPlugins && m_pPlugins->IsPluginCommand(line.gettoken_str(0)))
|
||||||
{
|
{
|
||||||
np = 0; // parameters are optional
|
np = 0; // parameters are optional
|
||||||
op = -1; // unlimited number of optional parameters
|
op = -1; // unlimited number of optional parameters
|
||||||
|
@ -914,7 +915,7 @@ int CEXEBuild::LoadLicenseFile(TCHAR *file, TCHAR** pdata, LineParser &line, BOO
|
||||||
MANAGE_WITH(fp, fclose);
|
MANAGE_WITH(fp, fclose);
|
||||||
unsigned int beginning=ftell(fp); // (we might be positionned after a BOM)
|
unsigned int beginning=ftell(fp); // (we might be positionned after a BOM)
|
||||||
fseek(fp,0,SEEK_END);
|
fseek(fp,0,SEEK_END);
|
||||||
unsigned int datalen=ftell(fp)-beginning; // size of file in bytes! not a number of character
|
unsigned int datalen=ftell(fp)-beginning; // size of file in bytes! not a number of characters
|
||||||
if (!datalen)
|
if (!datalen)
|
||||||
{
|
{
|
||||||
ERROR_MSG(_T("%s: empty license file \"%s\"\n"),line.gettoken_str(0),file);
|
ERROR_MSG(_T("%s: empty license file \"%s\"\n"),line.gettoken_str(0),file);
|
||||||
|
@ -929,16 +930,23 @@ int CEXEBuild::LoadLicenseFile(TCHAR *file, TCHAR** pdata, LineParser &line, BOO
|
||||||
}
|
}
|
||||||
*pdata = data; // memory will be released by caller
|
*pdata = data; // memory will be released by caller
|
||||||
TCHAR *ldata=data+1;
|
TCHAR *ldata=data+1;
|
||||||
while (_fgetts(ldata, data+datalen+2-ldata, fp)) // _fgetts translate ANSI/UTF8 characters to TCHAR
|
while (_fgetts(ldata, data+datalen+2-ldata, fp)) // _fgetts translates ANSI/UTF8 characters to TCHAR //BUGBUG: There is no reason to store ASCII files as TCHAR
|
||||||
ldata += _tcslen(ldata);
|
ldata += _tcslen(ldata);
|
||||||
if (ferror(fp))
|
if (ferror(fp))
|
||||||
{
|
{
|
||||||
ERROR_MSG(_T("%s: can't read file.\n"),line.gettoken_str(0));
|
ERROR_MSG(_T("%s: can't read file.\n"),line.gettoken_str(0));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
|
bool disallowrichedunicode = false;
|
||||||
|
#ifdef _UNICODE
|
||||||
|
if (!build_unicode)
|
||||||
|
disallowrichedunicode = true; //RichEdit 1.0 does not support unicode
|
||||||
|
else
|
||||||
|
*unicode = true; // _fgetts converted to TCHAR
|
||||||
|
#endif
|
||||||
if (!memcmp(data+1,_T("{\\rtf"),5*sizeof(TCHAR)))
|
if (!memcmp(data+1,_T("{\\rtf"),5*sizeof(TCHAR)))
|
||||||
*data = SF_RTF;
|
*data = SF_RTF;
|
||||||
else if (*unicode)
|
else if (*unicode && !disallowrichedunicode)
|
||||||
*data = SF_TEXT|SF_UNICODE;
|
*data = SF_TEXT|SF_UNICODE;
|
||||||
else
|
else
|
||||||
*data = SF_TEXT;
|
*data = SF_TEXT;
|
||||||
|
@ -1020,7 +1028,6 @@ int CEXEBuild::process_jump(LineParser &line, int wt, int *offs)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FLAG_OFFSET(flag) (FIELD_OFFSET(exec_flags_t, flag)/sizeof(int))
|
|
||||||
#define SECTION_FIELD_GET(field) (FIELD_OFFSET(section, field)/sizeof(int))
|
#define SECTION_FIELD_GET(field) (FIELD_OFFSET(section, field)/sizeof(int))
|
||||||
#define SECTION_FIELD_SET(field) (-1 - (int)(FIELD_OFFSET(section, field)/sizeof(int)))
|
#define SECTION_FIELD_SET(field) (-1 - (int)(FIELD_OFFSET(section, field)/sizeof(int)))
|
||||||
|
|
||||||
|
@ -1036,7 +1043,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||||
build_plugin_table();
|
if (PS_OK != initialize_default_plugins()) return PS_ERROR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
multiple_entries_instruction=0;
|
multiple_entries_instruction=0;
|
||||||
|
@ -1820,7 +1827,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
installer_icon = load_icon_file(line.gettoken_str(1));
|
installer_icon = load_icon_file(line.gettoken_str(1));
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("Error while loading icon from \"%s\": %s\n"), line.gettoken_str(1), CtoTString(err.what()));
|
ERROR_MSG(_T("Error while loading icon from \"%s\": %s\n"), line.gettoken_str(1), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
|
@ -1849,7 +1856,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("Error while replacing bitmap: %s\n"), CtoTString(err.what()));
|
ERROR_MSG(_T("Error while replacing bitmap: %s\n"), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
|
@ -2316,7 +2323,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
delete [] dlg;
|
delete [] dlg;
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("Error setting smooth progress bar: %s\n"), CtoTString(err.what()));
|
ERROR_MSG(_T("Error setting smooth progress bar: %s\n"), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
SCRIPT_MSG(_T("InstProgressFlags: smooth=%d, colored=%d\n"),smooth,
|
SCRIPT_MSG(_T("InstProgressFlags: smooth=%d, colored=%d\n"),smooth,
|
||||||
|
@ -2694,7 +2701,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
SCRIPT_MSG(_T("ChangeUI: %s %s%s\n"), line.gettoken_str(1), line.gettoken_str(2), branding_image_found?_T(" (branding image holder found)"):_T(""));
|
SCRIPT_MSG(_T("ChangeUI: %s %s%s\n"), line.gettoken_str(1), line.gettoken_str(2), branding_image_found?_T(" (branding image holder found)"):_T(""));
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("Error while changing UI: %s\n"), CtoTString(err.what()));
|
ERROR_MSG(_T("Error while changing UI: %s\n"), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
|
@ -2768,7 +2775,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
branding_image_id = IDC_BRANDIMAGE;
|
branding_image_id = IDC_BRANDIMAGE;
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("Error while adding image branding support: %s\n"), CtoTString(err.what()));
|
ERROR_MSG(_T("Error while adding image branding support: %s\n"), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
|
@ -2840,25 +2847,13 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
#endif// NSIS_CONFIG_VISIBLE_SUPPORT
|
#endif// NSIS_CONFIG_VISIBLE_SUPPORT
|
||||||
|
|
||||||
case TOK_REQEXECLEVEL:
|
case TOK_REQEXECLEVEL:
|
||||||
|
switch (line.gettoken_enum(1,_T("none\0user\0highest\0admin\0")))
|
||||||
{
|
{
|
||||||
int k=line.gettoken_enum(1,_T("none\0user\0highest\0admin\0"));
|
case 0: manifest_exec_level = manifest::exec_level_none; break;
|
||||||
switch (k)
|
case 1: manifest_exec_level = manifest::exec_level_user; break;
|
||||||
{
|
case 2: manifest_exec_level = manifest::exec_level_highest; break;
|
||||||
case 0:
|
case 3: manifest_exec_level = manifest::exec_level_admin; break;
|
||||||
manifest_exec_level = manifest::exec_level_none;
|
default: PRINTHELP();
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
manifest_exec_level = manifest::exec_level_user;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
manifest_exec_level = manifest::exec_level_highest;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
manifest_exec_level = manifest::exec_level_admin;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
PRINTHELP();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
|
|
||||||
|
@ -2887,7 +2882,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(int argi=1; argi<line.getnumtokens(); ++argi)
|
for(int argi = 1; argi < line.getnumtokens(); ++argi)
|
||||||
{
|
{
|
||||||
if (!manifest_sosl.append(line.gettoken_str(argi)))
|
if (!manifest_sosl.append(line.gettoken_str(argi)))
|
||||||
PRINTHELP();
|
PRINTHELP();
|
||||||
|
@ -2896,21 +2891,21 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
|
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
case TOK_TARGETMINIMALOS:
|
case TOK_TARGETUNICODE:
|
||||||
{
|
{
|
||||||
if (build_compressor_set) {
|
if (build_compressor_set)
|
||||||
ERROR_MSG(_T("Error: can't change target minimal OS version after data already got compressed or header already changed!\n"));
|
|
||||||
return PS_ERROR;
|
|
||||||
}
|
|
||||||
int major = 0, minor = 0;
|
|
||||||
if (_stscanf(line.gettoken_str(1), _T("%d.%d"), &major, &minor) == 0)
|
|
||||||
PRINTHELP()
|
|
||||||
if (set_target_minimal_OS(major,minor) != PS_OK) // Windows 5.0 or more recent requested? => Unicode support
|
|
||||||
{
|
{
|
||||||
ERROR_MSG(_T("Error: error while setting target minimal OS! (adequate stub not found?)\n"));
|
ERROR_MSG(_T("Error: Can't change target charset after data already got compressed or header already changed!\n"));
|
||||||
|
return PS_ERROR;
|
||||||
|
}
|
||||||
|
int k = line.gettoken_enum(1,_T("false\0true\0"));
|
||||||
|
if (-1==k) PRINTHELP();
|
||||||
|
SCRIPT_MSG(_T("Unicode: %s\n"),k?_T("true"):_T("false"));
|
||||||
|
if (set_target_charset(!!k) != PS_OK)
|
||||||
|
{
|
||||||
|
ERROR_MSG(_T("Error: Unable to set target charset (adequate stub not found?)\n"));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
SCRIPT_MSG(_T("TargetMinimalOS: %d.%d %s\n"),major,minor,build_unicode?_T("(Unicode installer)"):_T(""));
|
|
||||||
}
|
}
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
#endif
|
#endif
|
||||||
|
@ -3604,7 +3599,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
uninstaller_icon = load_icon_file(line.gettoken_str(1));
|
uninstaller_icon = load_icon_file(line.gettoken_str(1));
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("Error while loading icon from \"%s\": %s\n"), line.gettoken_str(1), CtoTString(err.what()));
|
ERROR_MSG(_T("Error while loading icon from \"%s\": %s\n"), line.gettoken_str(1), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
|
@ -3964,7 +3959,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
res_editor->FreeResource(dlg);
|
res_editor->FreeResource(dlg);
|
||||||
}
|
}
|
||||||
catch (exception& err) {
|
catch (exception& err) {
|
||||||
ERROR_MSG(_T("Error while triming branding text control: %s\n"), CtoTString(err.what()));
|
ERROR_MSG(_T("Error while triming branding text control: %s\n"), CtoTStrParam(err.what()));
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -6228,12 +6223,32 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||||
case TOK_PLUGINDIR:
|
case TOK_PLUGINDIR:
|
||||||
{
|
{
|
||||||
if (line.getnumtokens() == 2)
|
CEXEBuild::TARGETTYPE tt = m_target_type;
|
||||||
|
int numtok = line.getnumtokens() - 1;
|
||||||
|
TCHAR *path = line.gettoken_str(numtok);
|
||||||
|
if (2 == numtok)
|
||||||
{
|
{
|
||||||
SCRIPT_MSG(_T("PluginDir: \"%s\"\n"),line.gettoken_str(1));
|
const TCHAR* arcstr = line.gettoken_str(--numtok);
|
||||||
TCHAR *path = line.gettoken_str(1);
|
tt = get_target_type(arcstr+1);
|
||||||
|
if (_T('/') != arcstr[0] || CEXEBuild::TARGET_UNKNOWN == tt)
|
||||||
|
{
|
||||||
|
tstring es = get_commandtoken_name(which_token);
|
||||||
|
es += _T(": Target parameter must be one of: /");
|
||||||
|
for(int i = CEXEBuild::TARGETFIRST; i < CEXEBuild::TARGETCOUNT; ++i)
|
||||||
|
{
|
||||||
|
tt = (CEXEBuild::TARGETTYPE) i;
|
||||||
|
if (CEXEBuild::TARGETFIRST != tt) es += _T(", /");
|
||||||
|
es += get_target_suffix(tt);
|
||||||
|
}
|
||||||
|
ERROR_MSG(_T("Error: %s\n"),es.c_str());
|
||||||
|
return PS_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (1 == numtok)
|
||||||
|
{
|
||||||
|
SCRIPT_MSG(_T("PluginDir: \"%s\"\n"),path);
|
||||||
PATH_CONVERT(path);
|
PATH_CONVERT(path);
|
||||||
m_plugins.FindCommands(path, display_info?true:false);
|
m_plugins[tt].AddPluginsDir(path, !!display_script);
|
||||||
return PS_OK;
|
return PS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6241,18 +6256,18 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
case TOK__PLUGINCOMMAND:
|
case TOK__PLUGINCOMMAND:
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
tstring command, dllPath;
|
||||||
|
|
||||||
|
if (!m_pPlugins->GetCommandInfo(line.gettoken_str(0), command, dllPath))
|
||||||
|
{
|
||||||
|
ERROR_MSG(_T("Plugin command %s conflicts with a plugin in another directory!\n"),command.c_str());
|
||||||
|
return PS_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
tstring command = m_plugins.NormalizedCommand(line.gettoken_str(0));
|
|
||||||
#ifdef _UNICODE
|
|
||||||
if (build_unicode)
|
|
||||||
command = m_plugins.UseUnicodeVariant(command);
|
|
||||||
#endif
|
|
||||||
tstring dllPath = m_plugins.GetPluginPath(command);
|
|
||||||
tstring dllName = get_file_name(dllPath);
|
tstring dllName = get_file_name(dllPath);
|
||||||
int data_handle = m_plugins.GetPluginHandle(uninstall_mode?true:false, command);
|
int data_handle = m_pPlugins->GetDllDataHandle(!!uninstall_mode, command);
|
||||||
|
|
||||||
if (uninstall_mode) uninst_plugin_used = true;
|
if (uninstall_mode) uninst_plugin_used = true; else plugin_used = true;
|
||||||
else plugin_used = true;
|
|
||||||
|
|
||||||
// Initialize $PLUGINSDIR
|
// Initialize $PLUGINSDIR
|
||||||
ent.which=EW_CALL;
|
ent.which=EW_CALL;
|
||||||
|
@ -6285,7 +6300,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
if (ret != PS_OK) {
|
if (ret != PS_OK) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
m_plugins.SetDllDataHandle(uninstall_mode?true:false, line.gettoken_str(0), data_handle);
|
m_pPlugins->SetDllDataHandle(!!uninstall_mode, command, data_handle);
|
||||||
build_overwrite=old_build_overwrite;
|
build_overwrite=old_build_overwrite;
|
||||||
build_datesave=old_build_datesave;
|
build_datesave=old_build_datesave;
|
||||||
// Added by ramon 23 May 2003
|
// Added by ramon 23 May 2003
|
||||||
|
|
|
@ -101,7 +101,7 @@ int MLStringList::add(const TCHAR *str, WORD codepage /*= CP_ACP*/, bool process
|
||||||
delete[] ansiBuf;
|
delete[] ansiBuf;
|
||||||
if (len != cbMultiByte)
|
if (len != cbMultiByte)
|
||||||
{ // resize buffers to align future strings on same offsets
|
{ // resize buffers to align future strings on same offsets
|
||||||
len = a+max(len,cbMultiByte);
|
len = a + STD_MAX(len,cbMultiByte);
|
||||||
m_gr.resize(len*sizeof(TCHAR));
|
m_gr.resize(len*sizeof(TCHAR));
|
||||||
m_grAnsi.resize(len);
|
m_grAnsi.resize(len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,7 +276,6 @@ class SortedStringList
|
||||||
TinyGrowBuf m_gr;
|
TinyGrowBuf m_gr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define mymin(x, y) ((x < y) ? x : y)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class maintains a list of T types in a GrowBuf sorted by T.name which
|
* This class maintains a list of T types in a GrowBuf sorted by T.name which
|
||||||
|
@ -394,9 +393,9 @@ class SortedStringListND // no delete - can be placed in GrowBuf
|
||||||
{
|
{
|
||||||
unsigned int pCurr_len = _tcslen(pCurr);
|
unsigned int pCurr_len = _tcslen(pCurr);
|
||||||
if (case_sensitive)
|
if (case_sensitive)
|
||||||
res = _tcsncmp(str, pCurr, mymin((unsigned int) n_chars, pCurr_len));
|
res = _tcsncmp(str, pCurr, STD_MIN((unsigned int) n_chars, pCurr_len));
|
||||||
else
|
else
|
||||||
res = _tcsnicmp(str, pCurr, mymin((unsigned int) n_chars, pCurr_len));
|
res = _tcsnicmp(str, pCurr, STD_MIN((unsigned int) n_chars, pCurr_len));
|
||||||
|
|
||||||
// If there is a match and we are looking for a partial match and
|
// If there is a match and we are looking for a partial match and
|
||||||
// n_chars is NOT the length of the current string, then the
|
// n_chars is NOT the length of the current string, then the
|
||||||
|
|
|
@ -14,21 +14,32 @@
|
||||||
// Jim Park: Only those we use are listed here.
|
// Jim Park: Only those we use are listed here.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
|
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
#ifndef _T
|
#ifndef _T
|
||||||
#define __T(x) L ## x
|
#define __T(x) L ## x
|
||||||
#define _T(x) __T(x)
|
#define _T(x) __T(x)
|
||||||
#define _TEXT(x) __T(x)
|
#define _TEXT(x) __T(x)
|
||||||
#endif
|
#endif
|
||||||
#if defined(_MSC_VER) && (_MSC_VER<=1200)
|
|
||||||
typedef unsigned short TCHAR;
|
#if !defined(_WIN32) && defined(EXEHEAD)
|
||||||
typedef unsigned short _TUCHAR;
|
typedef unsigned short TCHAR, _TUCHAR;
|
||||||
#else
|
#else
|
||||||
typedef wchar_t TCHAR;
|
// MinGW typedefs TCHAR and _TCHAR inside #ifndef _TCHAR_DEFINED
|
||||||
typedef wchar_t _TUCHAR;
|
// MSVC typedefs TCHAR inside #ifndef _TCHAR_DEFINED
|
||||||
|
// and _TCHAR and _T*CHAR inside #ifndef __TCHAR_DEFINED.
|
||||||
|
// We don't want to break MSVCs _TSCHAR and _TXCHAR so we don't protect our typedef...
|
||||||
|
#if (_MSC_VER>1 && (_MSC_VER<1400 || !defined(_NATIVE_WCHAR_T_DEFINED))) || !defined(_WCHAR_T_DEFINED)
|
||||||
|
// VC6 knows about __wchar_t but does not support it. /Zc:wchar_t is on by default starting with VC8.
|
||||||
|
// VC7.1 supports __wchar_t but using it causes problems with conversions from WCHAR (unsigned short)?
|
||||||
|
typedef unsigned short TCHAR, _TUCHAR;
|
||||||
|
#else
|
||||||
|
typedef wchar_t TCHAR, _TUCHAR;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// program
|
// program
|
||||||
#define _tmain wmain
|
#define _tmain wmain
|
||||||
|
@ -39,7 +50,7 @@ typedef wchar_t _TUCHAR;
|
||||||
// printfs
|
// printfs
|
||||||
#define _ftprintf fwprintf
|
#define _ftprintf fwprintf
|
||||||
#define _sntprintf _snwprintf
|
#define _sntprintf _snwprintf
|
||||||
#if defined(_MSC_VER) && (_MSC_VER<=1200)
|
#if (defined(_MSC_VER) && (_MSC_VER<=1310)) || defined(__MINGW32__)
|
||||||
# define _stprintf swprintf
|
# define _stprintf swprintf
|
||||||
#else
|
#else
|
||||||
# define _stprintf _swprintf
|
# define _stprintf _swprintf
|
||||||
|
@ -47,7 +58,7 @@ typedef wchar_t _TUCHAR;
|
||||||
#define _tprintf wprintf
|
#define _tprintf wprintf
|
||||||
#define _vftprintf vfwprintf
|
#define _vftprintf vfwprintf
|
||||||
#define _vsntprintf _vsnwprintf
|
#define _vsntprintf _vsnwprintf
|
||||||
#if defined(_MSC_VER) && (_MSC_VER<=1200)
|
#if defined(_MSC_VER) && (_MSC_VER<=1310)
|
||||||
# define _vstprintf vswprintf
|
# define _vstprintf vswprintf
|
||||||
#else
|
#else
|
||||||
# define _vstprintf _vswprintf
|
# define _vstprintf _vswprintf
|
||||||
|
@ -132,9 +143,11 @@ typedef wchar_t _TUCHAR;
|
||||||
#define _T(x) x
|
#define _T(x) x
|
||||||
#define _TEXT(x) x
|
#define _TEXT(x) x
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef char TCHAR;
|
typedef char TCHAR;
|
||||||
typedef unsigned char _TUCHAR;
|
typedef unsigned char _TUCHAR;
|
||||||
|
|
||||||
|
|
||||||
// program
|
// program
|
||||||
#define _tmain main
|
#define _tmain main
|
||||||
#define _tWinMain WinMain
|
#define _tWinMain WinMain
|
||||||
|
|
|
@ -218,7 +218,7 @@ static tokenType tokenlist[TOK__LAST] =
|
||||||
{TOK_STRLEN,_T("StrLen"),2,0,_T("$(user_var: length output) str"),TP_CODE},
|
{TOK_STRLEN,_T("StrLen"),2,0,_T("$(user_var: length output) str"),TP_CODE},
|
||||||
{TOK_SUBCAPTION,_T("SubCaption"),2,0,_T("page_number(0-4) new_subcaption"),TP_GLOBAL},
|
{TOK_SUBCAPTION,_T("SubCaption"),2,0,_T("page_number(0-4) new_subcaption"),TP_GLOBAL},
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
{TOK_TARGETMINIMALOS,_T("TargetMinimalOS"),1,0,_T("windows_version"),TP_GLOBAL},
|
{TOK_TARGETUNICODE,_T("Unicode"),1,0,_T("true|false"),TP_GLOBAL},
|
||||||
#endif
|
#endif
|
||||||
{TOK_UNINSTALLEXENAME,_T("UninstallExeName"),0,0,_T("no longer supported, use WriteUninstaller from section."),TP_ALL},
|
{TOK_UNINSTALLEXENAME,_T("UninstallExeName"),0,0,_T("no longer supported, use WriteUninstaller from section."),TP_ALL},
|
||||||
{TOK_UNINSTCAPTION,_T("UninstallCaption"),1,0,_T("uninstaller_caption"),TP_GLOBAL},
|
{TOK_UNINSTCAPTION,_T("UninstallCaption"),1,0,_T("uninstaller_caption"),TP_GLOBAL},
|
||||||
|
@ -288,7 +288,7 @@ static tokenType tokenlist[TOK__LAST] =
|
||||||
{TOK_GETLABELADDR,_T("GetLabelAddress"),2,0,_T("output label"),TP_CODE},
|
{TOK_GETLABELADDR,_T("GetLabelAddress"),2,0,_T("output label"),TP_CODE},
|
||||||
{TOK_GETCURRENTADDR,_T("GetCurrentAddress"),1,0,_T("output"),TP_CODE},
|
{TOK_GETCURRENTADDR,_T("GetCurrentAddress"),1,0,_T("output"),TP_CODE},
|
||||||
|
|
||||||
{TOK_PLUGINDIR,_T("!AddPluginDir"),1,0,_T("new_plugin_directory"),TP_ALL},
|
{TOK_PLUGINDIR,_T("!AddPluginDir"),1,1,_T("[/target] new_plugin_directory"),TP_ALL},
|
||||||
{TOK_INITPLUGINSDIR,_T("InitPluginsDir"),0,0,_T(""),TP_CODE},
|
{TOK_INITPLUGINSDIR,_T("InitPluginsDir"),0,0,_T(""),TP_CODE},
|
||||||
// Added by ramon 23 May 2003
|
// Added by ramon 23 May 2003
|
||||||
{TOK_ALLOWSKIPFILES,_T("AllowSkipFiles"),1,0,_T("(off|on)"),TP_ALL},
|
{TOK_ALLOWSKIPFILES,_T("AllowSkipFiles"),1,0,_T("(off|on)"),TP_ALL},
|
||||||
|
@ -301,6 +301,13 @@ static tokenType tokenlist[TOK__LAST] =
|
||||||
{TOK_LOCKWINDOW,_T("LockWindow"),1,0,_T("(on|off)"),TP_CODE},
|
{TOK_LOCKWINDOW,_T("LockWindow"),1,0,_T("(on|off)"),TP_CODE},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const TCHAR* CEXEBuild::get_commandtoken_name(int tok)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < TOK__LAST; ++x)
|
||||||
|
if (tokenlist[x].id==tok) return tokenlist[x].name;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void CEXEBuild::print_help(TCHAR *commandname)
|
void CEXEBuild::print_help(TCHAR *commandname)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
|
|
@ -74,7 +74,7 @@ enum
|
||||||
TOK_VI_SETPRODUCTVERSION,
|
TOK_VI_SETPRODUCTVERSION,
|
||||||
TOK_VI_SETFILEVERSION,
|
TOK_VI_SETFILEVERSION,
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
TOK_TARGETMINIMALOS,
|
TOK_TARGETUNICODE,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TOK_MISCBUTTONTEXT,
|
TOK_MISCBUTTONTEXT,
|
||||||
|
|
|
@ -18,12 +18,13 @@
|
||||||
#include "validateunicode.h"
|
#include "validateunicode.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
FILE* FileOpenUnicodeText(const TCHAR* file, const TCHAR* mode, BOOL* unicode)
|
FILE* FileOpenUnicodeText(const TCHAR* file, const TCHAR* mode, BOOL* unicode)
|
||||||
{
|
{
|
||||||
extern FILE *g_output;
|
extern FILE *g_output;
|
||||||
CValidateUnicode::FILE_TYPE ftype = CValidateUnicode::UTF_8; // default file format is UTF-8
|
CValidateUnicode::FILE_TYPE ftype = CValidateUnicode::UTF_8; // default file format is UTF-8
|
||||||
if (unicode) *unicode = TRUE;
|
if (unicode) *unicode = TRUE;
|
||||||
|
|
||||||
// If we are reading an existing file, check to see what type of file it
|
// If we are reading an existing file, check to see what type of file it
|
||||||
// is first.
|
// is first.
|
||||||
|
@ -34,50 +35,50 @@ FILE* FileOpenUnicodeText(const TCHAR* file, const TCHAR* mode, BOOL* unicode)
|
||||||
|
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
MANAGE_WITH(fp, fclose);
|
MANAGE_WITH(fp, fclose);
|
||||||
fseek(fp, 0, SEEK_END);
|
fseek(fp, 0, SEEK_END);
|
||||||
size_t fileSize = ftell(fp);
|
size_t fileSize = ftell(fp);
|
||||||
if (fileSize == 0)
|
if (fileSize == 0)
|
||||||
{
|
{
|
||||||
// Empty files are treated as UTF-8.
|
// Empty files are treated as UTF-8.
|
||||||
ftype = CValidateUnicode::UTF_8;
|
ftype = CValidateUnicode::UTF_8;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::vector<unsigned char> buffer(fileSize);
|
std::vector<unsigned char> buffer(fileSize);
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
fread(&buffer[0], sizeof(unsigned char), fileSize, fp);
|
fread(&buffer[0], sizeof(unsigned char), fileSize, fp);
|
||||||
|
|
||||||
ftype = CValidateUnicode::CheckBOM(&buffer[0], buffer.size());
|
ftype = CValidateUnicode::CheckBOM(&buffer[0], buffer.size());
|
||||||
|
|
||||||
switch (ftype)
|
switch (ftype)
|
||||||
{
|
{
|
||||||
case CValidateUnicode::UTF_8:
|
case CValidateUnicode::UTF_8:
|
||||||
case CValidateUnicode::UTF_16LE:
|
case CValidateUnicode::UTF_16LE:
|
||||||
case CValidateUnicode::UTF_16BE:
|
case CValidateUnicode::UTF_16BE:
|
||||||
break;
|
break;
|
||||||
case CValidateUnicode::UTF_32LE:
|
case CValidateUnicode::UTF_32LE:
|
||||||
case CValidateUnicode::UTF_32BE:
|
case CValidateUnicode::UTF_32BE:
|
||||||
PrintColorFmtMsg_ERR(_T("File '%s' has a BOM marked as %s which is not supported at this time.\n"),
|
PrintColorFmtMsg_ERR(_T("File '%s' has a BOM marked as %s which is not supported at this time.\n"),
|
||||||
file, CValidateUnicode::TypeToName(ftype));
|
file, CValidateUnicode::TypeToName(ftype));
|
||||||
exit(-1);
|
exit(-1);
|
||||||
break;
|
break;
|
||||||
case CValidateUnicode::UNKNOWN:
|
case CValidateUnicode::UNKNOWN:
|
||||||
// If unknown, let's see if it's not just UTF_8 without a BOM.
|
// If unknown, let's see if it's not just UTF_8 without a BOM.
|
||||||
if (CValidateUnicode::ValidateUTF8(&buffer[0], buffer.size()) == 2)
|
if (CValidateUnicode::ValidateUTF8(&buffer[0], buffer.size()) == 2)
|
||||||
{
|
{
|
||||||
// contains UTF-8 characters sequences
|
// contains UTF-8 characters sequences
|
||||||
_ftprintf(g_output, _T("File '%s' has no BOM but seems to be UTF-8.\n"), file);
|
_ftprintf(g_output, _T("File '%s' has no BOM but seems to be UTF-8.\n"), file);
|
||||||
ftype = CValidateUnicode::UTF_8;
|
ftype = CValidateUnicode::UTF_8;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PrintColorFmtMsg_ERR(_T("CValidateUnicode::CheckBOM() for file '%s' returned an unknown return value: %d\n"),
|
PrintColorFmtMsg_ERR(_T("CValidateUnicode::CheckBOM() for file '%s' returned an unknown return value: %d\n"),
|
||||||
file, ftype);
|
file, ftype);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@ FILE* FileOpenUnicodeText(const TCHAR* file, const TCHAR* mode, BOOL* unicode)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Looks like fopen() doesn't support other encodings of Unicode.
|
// Looks like fopen() doesn't support other encodings of Unicode.
|
||||||
if (unicode) *unicode = FALSE;
|
if (unicode) *unicode = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,11 @@ typedef std::ifstream tifstream;
|
||||||
#define CtoTString(str) (str)
|
#define CtoTString(str) (str)
|
||||||
#define CtoTString2(str,cp) (str)
|
#define CtoTString2(str,cp) (str)
|
||||||
#define TtoCString(str) (str)
|
#define TtoCString(str) (str)
|
||||||
|
#define CtoTStrParam CtoTString
|
||||||
#else
|
#else
|
||||||
#define CtoTString2(str,cp) CtoTString(str,cp)
|
#define CtoTString2(str,cp) CtoTString((str),(cp))
|
||||||
|
#define CtoTStrParam(str) ( (const TCHAR*) CtoTString((str)) ) // Use this when passing as a vararg parameter
|
||||||
|
|
||||||
|
|
||||||
// This is a helpful little function for converting exceptions or
|
// This is a helpful little function for converting exceptions or
|
||||||
// other system type things that come back ANSI and must be
|
// other system type things that come back ANSI and must be
|
||||||
|
@ -75,7 +78,8 @@ public:
|
||||||
|
|
||||||
~CtoTString() { free(m_wStr); m_wStr = 0; }
|
~CtoTString() { free(m_wStr); m_wStr = 0; }
|
||||||
|
|
||||||
operator const wchar_t*() { return m_wStr; }
|
operator const wchar_t*() const { return GetTStr(); }
|
||||||
|
inline const wchar_t*GetTStr() const { return m_wStr; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wchar_t* m_wStr;
|
wchar_t* m_wStr;
|
||||||
|
|
|
@ -35,6 +35,14 @@ static EXEHEADWCHAR_T* ExeHeadWStrAlloc(UINT cch)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
|
|
||||||
|
void RawTStrToASCII(const TCHAR*in,char*out,UINT maxcch)
|
||||||
|
{
|
||||||
|
const bool empty = !maxcch;
|
||||||
|
for(; maxcch && *in; --maxcch) *out++ = (char) *in++;
|
||||||
|
if (!empty) *out = 0;
|
||||||
|
}
|
||||||
|
|
||||||
#else // !_UNICODE
|
#else // !_UNICODE
|
||||||
|
|
||||||
EXEHEADTCHAR_T* UTF8ToExeHeadTStrDup(LPCSTR StrU8,UINT Codepage)
|
EXEHEADTCHAR_T* UTF8ToExeHeadTStrDup(LPCSTR StrU8,UINT Codepage)
|
||||||
|
|
|
@ -28,6 +28,7 @@ typedef unsigned short EXEHEADWCHAR_T;
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
typedef EXEHEADWCHAR_T EXEHEADTCHAR_T;
|
typedef EXEHEADWCHAR_T EXEHEADTCHAR_T;
|
||||||
|
|
||||||
|
void RawTStrToASCII(const TCHAR*in,char*out,UINT maxcch);
|
||||||
#else // !_UNICODE
|
#else // !_UNICODE
|
||||||
typedef char EXEHEADTCHAR_T;
|
typedef char EXEHEADTCHAR_T;
|
||||||
|
|
||||||
|
@ -39,8 +40,16 @@ inline EXEHEADTCHAR_T* ExeHeadTStrAlloc(UINT cb)
|
||||||
}
|
}
|
||||||
extern EXEHEADTCHAR_T* UTF8ToExeHeadTStrDup(LPCSTR StrU8,UINT Codepage);
|
extern EXEHEADTCHAR_T* UTF8ToExeHeadTStrDup(LPCSTR StrU8,UINT Codepage);
|
||||||
|
|
||||||
|
inline void RawTStrToASCII(const TCHAR*in,char*out,UINT maxcch) { lstrcpyn(out,in,maxcch); }
|
||||||
#endif // ?_UNICODE
|
#endif // ?_UNICODE
|
||||||
|
|
||||||
|
template<typename T> T S7ChLwr(T c) { return c>='A' && c<='Z' ? (T)(c|32) : c; }
|
||||||
|
template<typename T> T S7ChUpr(T c) { return c>='a' && c<='z' ? (T)(c-'a'+'A') : c; }
|
||||||
|
template<typename T> bool S7IsChEqualI(char ch,T cmp)
|
||||||
|
{
|
||||||
|
return cmp==(T)S7ChLwr(ch) || cmp==(T)S7ChUpr(ch);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to peek at the first few bytes in the stream to determine if it is a UTF-8 BOM.
|
* Tries to peek at the first few bytes in the stream to determine if it is a UTF-8 BOM.
|
||||||
|
|
|
@ -170,8 +170,8 @@ WCHAR *CharNextW(const WCHAR *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char *CharNextExA(WORD codepage, const char *s, int flags) {
|
char *CharNextExA(WORD codepage, const char *s, int flags) {
|
||||||
char buf[1024];
|
char buf[30];
|
||||||
snprintf(buf, 1024, "CP%d", codepage);
|
snprintf(buf, 30, "CP%d", codepage);
|
||||||
const char* orglocct = setlocale(LC_CTYPE, buf);
|
const char* orglocct = setlocale(LC_CTYPE, buf);
|
||||||
|
|
||||||
const char* np;
|
const char* np;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#define _VALIDATEUNICODE_
|
#define _VALIDATEUNICODE_
|
||||||
|
|
||||||
#include "tchar.h"
|
#include "tchar.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
class CValidateUnicode
|
class CValidateUnicode
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue