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:
anders_k 2012-10-13 01:47:50 +00:00
parent 8f330bbbdf
commit 7cc150c464
73 changed files with 936 additions and 713 deletions

View file

@ -108,7 +108,7 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
#define _snprintf snprintf
#define _vsnprintf vsnprintf
#endif
#endif // ?WIN32
#ifndef INT_MAX
#include <limits.h>
@ -121,6 +121,17 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
# define ULONG_PTR unsigned long
#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
#define COUNTOF _countof
#else
@ -724,6 +735,9 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
# define IMAGE_DIRECTORY_ENTRY_EXPORT 0
# define IMAGE_SIZEOF_SHORT_NAME 8
#endif
#ifndef IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE
#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
#endif
// structures
@ -860,7 +874,6 @@ typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
# define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x0b01
# define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x0b02
#endif
#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
typedef struct _IMAGE_NT_HEADERS {
DWORD Signature;
IMAGE_FILE_HEADER FileHeader;
@ -912,4 +925,41 @@ typedef struct tagVS_FIXEDFILEINFO {
# pragma pack()
#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