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

@ -6,6 +6,11 @@
#include <windowsx.h>
#include <nsis/pluginapi.h> // nsis plugin
#ifndef LWA_COLORKEY
# define LWA_COLORKEY 1
# define LWA_ALPHA 2
#endif
HINSTANCE g_hInstance;
#define RESOLUTION 32 // 30 fps ;) (32? I like SHR more than iDIV ;)
@ -120,7 +125,7 @@ void SetTransparentRegion(HWND myWnd)
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)
{
g_hInstance = hInst;

View file

@ -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;
if (hwBanner && ul_reason_for_call == DLL_PROCESS_DETACH)

View file

@ -111,8 +111,7 @@ NSISFunc(SetBg) {
return;
}
WNDCLASSEX wc = {
sizeof(WNDCLASSEX),
WNDCLASS wc = {
CS_VREDRAW|CS_HREDRAW,
WndProc,
0,
@ -123,9 +122,8 @@ NSISFunc(SetBg) {
0,
0,
_T("NSISBGImage"),
0
};
ATOM atomClass = RegisterClassEx(&wc);
ATOM atomClass = RegisterClass(&wc);
if (!atomClass) {
my_pushstring(_T("can't create window"));
return;

View file

@ -8,7 +8,7 @@
#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;
}

View file

@ -24,29 +24,31 @@ example = Split("""
extdll.inc
""")
Import('env plugin_env plugin_uenv')
Import('env plugin_env plugin_uenv GetArcSuffix PerformPluginExtrasDistOperationOnce')
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
if unicodetarget:
lib_targetT = lib_targetT + 'W'
api_uenv = plugin_uenv.Clone()
api_uenv.Append(CPPPATH = ['#Source/exehead'])
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
api_envT = plugin_envT.Clone()
api_envT.Append(CPPPATH = ['#Source/exehead']) # For api.h
lib = api_envT.Library(lib_targetT, lib_files)
# 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':
env.DistributeExamples(lib, path='Plugin/nsis')
else:
example += lib_files
@ -56,20 +58,14 @@ else:
if env.has_key('PREFIX_PLUGINAPI_LIB'):
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
if unicodetarget:
envT = plugin_uenv
env.Install('#$BUILD_PREFIX/api/nsis', libW)
else:
envT = plugin_env
env.Install('#$BUILD_PREFIX/api/nsis', api_files + libA)
if PerformPluginExtrasDistOperationOnce(plugin_envT, unicodetarget):
env.Install('#$BUILD_PREFIX/api/nsis', api_files)
envT.Append(CPPPATH = ['#$BUILD_PREFIX/api'])
envT.Append(LIBPATH = ['#$BUILD_PREFIX/api/nsis'])
envT.Append(LIBS = [lib_targetT])
env.Install('#$BUILD_PREFIX/api/nsis', lib)
plugin_envT.Append(CPPPATH = ['#$BUILD_PREFIX/api'])
plugin_envT.Append(LIBPATH = ['#$BUILD_PREFIX/api/nsis'])
plugin_envT.Append(LIBS = [lib_targetT])

View file

@ -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;
return TRUE;

View file

@ -22,19 +22,25 @@
#define _T(x) __T(x)
#define _TEXT(x) __T(x)
#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 _TUCHAR;
#endif
#endif
// program
#define _tmain wmain
#define _tWinMain wWinMain
#define _tenviron _wenviron
#define __targv __wargv
// printfs
#define _ftprintf fwprintf
#define _sntprintf _snwprintf
#if defined(_MSC_VER) && (_MSC_VER<=1200)
#if (defined(_MSC_VER) && (_MSC_VER<=1310)) || defined(__MINGW32__)
# define _stprintf swprintf
#else
# define _stprintf _swprintf
@ -42,7 +48,11 @@ typedef wchar_t _TUCHAR;
#define _tprintf wprintf
#define _vftprintf vfwprintf
#define _vsntprintf _vsnwprintf
#define _vstprintf _vswprintf
#if defined(_MSC_VER) && (_MSC_VER<=1310)
# define _vstprintf vswprintf
#else
# define _vstprintf _vswprintf
#endif
// scanfs
#define _tscanf wscanf
@ -119,12 +129,13 @@ typedef wchar_t _TUCHAR;
#define _T(x) x
#define _TEXT(x) x
#endif
typedef char TCHAR;
typedef unsigned char _TUCHAR;
#ifndef _TCHAR_DEFINED
#define _TCHAR_DEFINED
typedef char TCHAR;
#endif
// program
#define _tmain main
#define _tWinMain WinMain
#define _tenviron environ
#define __targv __argv

View file

@ -656,11 +656,11 @@ LRESULT WINAPI WMCommandProc(HWND hWnd, UINT id, HWND hwndCtl, UINT codeNotify)
LPSHELLFOLDER sf;
ULONG eaten;
LPITEMIDLIST root;
int ccRoot = (lstrlen(pField->pszRoot) * 2) + 2;
SHGetDesktopFolder(&sf);
#ifdef _UNICODE
sf->ParseDisplayName(hConfigWindow, NULL, pField->pszRoot, &eaten, &root, NULL);
#else
int ccRoot = (lstrlen(pField->pszRoot) * 2) + 2;
LPWSTR pwszRoot = (LPWSTR) MALLOC(ccRoot);
MultiByteToWideChar(CP_ACP, 0, pField->pszRoot, -1, pwszRoot, ccRoot);
sf->ParseDisplayName(hConfigWindow, NULL, pwszRoot, &eaten, &root, NULL);
@ -1592,9 +1592,9 @@ extern "C" void __declspec(dllexport) show(HWND hwndParent, int string_size,
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;
}

View file

@ -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;
return TRUE;

View file

@ -80,6 +80,7 @@ int GetTLBVersion(tstring& filepath, DWORD& high, DWORD & low)
#endif
}
NSIS_ENTRYPOINT_TMAIN
int _tmain(int argc, TCHAR* argv[])
{

View file

@ -1,5 +1,6 @@
// Unicode support by Jim Park & Olivier Marcoux
#include "../../../Source/Platform.h"
#include <windows.h>
#include <tchar.h>
@ -15,7 +16,8 @@ void RegDll(TCHAR *file);
void RegTypeLib(TCHAR *file);
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 seekchar = _T(' ');
@ -33,7 +35,6 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
if (*cmdline++ != _T('/'))
{
ExitProcess(1);
return 0;
}
if (*cmdline == _T('S'))
@ -113,7 +114,6 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
}
ExitProcess(0);
return 0;
}
void SafeWow64EnableWow64FsRedirection(BOOL Wow64FsEnableRedirection)

View file

@ -13,6 +13,5 @@ libs = Split("""
""")
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')

View file

@ -13,7 +13,7 @@
#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;
}

View file

@ -1,8 +1,7 @@
// Unicode support by Jim Park -- 08/23/2007
#include <windows.h>
#include "../../Source/Platform.h"
#include <commctrl.h>
#include "../ExDLL/nsis_tchar.h"
#include "resource.h"
#define CBL(x) {x,_T(#x)}
@ -231,10 +230,8 @@ BOOL CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
return 0;
}
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
NSIS_ENTRYPOINT_GUINOCRT
EXTERN_C void NSISWinMainNOCRT()
{
InitCommonControls();
@ -246,6 +243,5 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
);
ExitProcess(0);
return 0;
}

View file

@ -19,7 +19,6 @@ libs = Split("""
""")
Import('BuildUtil')
Import('_tWinMain')
BuildUtil(target, files, libs, res = res, resources = resources, entry = _tWinMain)
BuildUtil(target, files, libs, res = res, resources = resources, entry = 'NSISWinMainNOCRT')

View file

@ -45,7 +45,6 @@ docs = Split("""
""")
Import('BuildUtil')
Import('_tWinMain')
BuildUtil(
target,
@ -53,7 +52,7 @@ BuildUtil(
libs,
res = res,
resources = resources,
entry = _tWinMain,
entry = None,
defines = ['RELEASE=2.3'],
docs = docs,
root_util = True

View file

@ -42,7 +42,8 @@ NFINDREPLACE g_find;
extern NTOOLBAR g_toolbar;
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;
int status;
HACCEL haccel;
@ -50,7 +51,7 @@ int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, TCHAR *cmdParam, int
memset(&g_sdata,0,sizeof(NSCRIPTDATA));
memset(&g_resize,0,sizeof(NRESIZEDATA));
memset(&g_find,0,sizeof(NFINDREPLACE));
g_sdata.hInstance=GetModuleHandle(0);
g_sdata.hInstance=hInst;
g_sdata.symbols = NULL;
g_sdata.sigint_event = CreateEvent(NULL, FALSE, FALSE, _T("makensis win32 signint event"));
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);
FreeLibrary(hRichEditDLL);
FinalizeUpdate();
ExitProcess(msg.wParam);
return msg.wParam;
}

View file

@ -24,9 +24,9 @@
#define MAKENSIS_H
#define _WIN32_IE 0x0400
#include "../../Source/Platform.h"
#include <windows.h>
#include <commctrl.h>
#include "../ExDLL/nsis_tchar.h"
#include "utils.h"
#define _RICHEDIT_VER 0x0200
#include <richedit.h>
@ -38,7 +38,7 @@
#define NSIS_UPDATE "http://nsis.sourceforge.net/update.php?version="
#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 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 DOCPATH "http://nsis.sourceforge.net/Docs/"
#define LOCALDOCS _T("\\NSIS.chm")
@ -144,7 +144,6 @@ int compressor_strings[] = {IDS_SCRIPT,
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);
DWORD WINAPI MakeNSISProc(LPVOID p);
BOOL CALLBACK DialogResize(HWND hWnd, LPARAM /* unused*/);

View file

@ -22,11 +22,11 @@
Unicode support by Jim Park -- 08/17/2007
*/
#include "makensisw.h"
#define REALSTR(x) #x
#define STR(x) REALSTR(x)
#define TSTRINGIFY_(x) _T(#x)
#define TSTRINGIFY(x) TSTRINGIFY_(x)
#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
const TCHAR *NSISW_VERSION = _T("MakeNSISW ") __TDATE__;
#endif

View file

@ -49,10 +49,10 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar
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;
return TRUE;
return TRUE;
}
void __declspec(dllexport) show(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)

View file

@ -427,10 +427,10 @@ BOOL CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
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;
return TRUE;
return TRUE;
}
void AddFolderFromReg(int nFolder)

View file

@ -1,6 +1,6 @@
#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;
}

View file

@ -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.
*/
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
VirtualProtect(&retexpr, sizeof(retexpr), PAGE_EXECUTE_READWRITE, (PDWORD)&LastStackPlace);

View file

@ -18,10 +18,9 @@ libs = Split("""
""")
Import('BuildUtil env')
Import('_tWinMain')
code = env.Object(code)
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)

View file

@ -2,15 +2,15 @@
//
// Unicode support by Jim Park -- 08/10/2007
#include "../../Source/Platform.h"
#include <windows.h>
#include <commctrl.h>
#include "../ExDLL/nsis_tchar.h"
#include "resource.h"
HINSTANCE g_hInstance;
HWND m_curwnd;
TCHAR* windows[] = {
const TCHAR* windows[] = {
MAKEINTRESOURCE(IDD_LICENSE),
MAKEINTRESOURCE(IDD_SELCOM),
MAKEINTRESOURCE(IDD_DIR),
@ -76,29 +76,16 @@ BOOL CALLBACK DialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) {
break;
}
break;
}
return 0;
}
return 0;
}
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
NSIS_ENTRYPOINT_SIMPLEGUI
int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hOldInst,LPTSTR CmdLineParams,int ShowCmd)
{
InitCommonControls();
g_hInstance = hInst;
LoadLibrary(_T("RichEd32.dll"));
g_hInstance = GetModuleHandle(0);
DialogBox(
GetModuleHandle(0),
MAKEINTRESOURCE(IDD_INST),
0,
DialogProc
);
ExitProcess(0);
return 0;
return DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_INST),0,DialogProc);
}

View file

@ -148,7 +148,7 @@ void __declspec(dllexport) GetOriginalAccountType(HWND hwndParent, int string_si
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;
}

View file

@ -56,6 +56,10 @@ inline bool ISSINGLESWITCHCHAR(const TCHAR c) { return ( OPT_CHAR==(c) || (OPT_C
#include <fstream>
#include <sstream>
#ifdef _WIN32
#include "../../../../Source/Platform.h"
NSIS_ENTRYPOINT_TMAIN
#endif
int _tmain( int argc, TCHAR * argv[] ) {
tout << _T("GenPat v3.1\n");
tout << _T("===========\n\n(c) 2001-2005 Van de Sande Productions\n");

View file

@ -174,7 +174,7 @@ void __declspec(dllexport) GetFileMD5(HWND hwndParent, int string_size,
}
#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;
return TRUE;
}

View file

@ -593,8 +593,8 @@ void __declspec(dllexport) Show(HWND hwndParent, int string_size, TCHAR *variabl
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;
}

View file

@ -40,7 +40,7 @@ void ExecScript(BOOL log);
void LogMessage(const TCHAR *pStr, BOOL bOEM);
TCHAR *my_strstr(TCHAR *a, TCHAR *b);
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) {
g_hwndParent=hwndParent;
@ -67,7 +67,7 @@ void __declspec(dllexport) ExecToStack(HWND hwndParent, int string_size, TCHAR *
}
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;
return TRUE;
}
@ -176,7 +176,7 @@ void ExecScript(int log) {
// WinMain will have the address of the WinMain function in memory.
// Getting the difference gets you the relative location of the
// WinMain function.
pNTHeaders->OptionalHeader.AddressOfEntryPoint = (DWORD)_tWinMain - (DWORD)g_hInst;
pNTHeaders->OptionalHeader.AddressOfEntryPoint = (DWORD_PTR)AsExeWinMain - (DWORD_PTR)g_hInst;
UnmapViewOfFile(pMapView);
}
CloseHandle(hMapping);
@ -476,12 +476,12 @@ unsigned int my_atoi(TCHAR *s) {
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;
STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
TCHAR command_line[1024];
TCHAR command_line[1024]; //BUGBUG
TCHAR seekchar=_T(' ');
TCHAR *cmdline;

View file

@ -1,3 +1,5 @@
#include "../../Source/Platform.h"
#include <windows.h>
#include <tchar.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);
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,
LPTSTR lpszCmdParam, int nCmdShow)
NSIS_ENTRYPOINT_SIMPLEGUI
int WINAPI _tWinMain(HINSTANCE hInst,HINSTANCE hOldInst,LPTSTR CmdLineParams,int ShowCmd)
{
g_hInstance=hInstance;
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];