Added another parameter to plug-in functions. This parameter is a structure with pointers to exec_flags and ExecuteCodeSegment. This is backward compatible with older plug-ins because plug-in functions use the __cdecl calling convention which means NSIS clears the stack.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3751 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
54eca79ebf
commit
89d3581649
5 changed files with 39 additions and 6 deletions
|
@ -6,7 +6,8 @@ HINSTANCE g_hInstance;
|
||||||
HWND g_hwndParent;
|
HWND g_hwndParent;
|
||||||
|
|
||||||
void __declspec(dllexport) myFunction(HWND hwndParent, int string_size,
|
void __declspec(dllexport) myFunction(HWND hwndParent, int string_size,
|
||||||
char *variables, stack_t **stacktop)
|
char *variables, stack_t **stacktop,
|
||||||
|
extra_parameters *extra)
|
||||||
{
|
{
|
||||||
g_hwndParent=hwndParent;
|
g_hwndParent=hwndParent;
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,25 @@ INST_LANG, // $LANGUAGE
|
||||||
__INST_LAST
|
__INST_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int autoclose;
|
||||||
|
int all_user_var;
|
||||||
|
int exec_error;
|
||||||
|
int abort;
|
||||||
|
int exec_reboot;
|
||||||
|
int reboot_called;
|
||||||
|
int cur_insttype;
|
||||||
|
int insttype_changed;
|
||||||
|
int silent;
|
||||||
|
int instdir_error;
|
||||||
|
int rtl;
|
||||||
|
int errlvl;
|
||||||
|
} exec_flags;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
exec_flags *exec_flags;
|
||||||
|
int (__stdcall *ExecuteCodeSegment)(int, HWND);
|
||||||
|
} extra_parameters;
|
||||||
|
|
||||||
// utility functions (not required but often useful)
|
// utility functions (not required but often useful)
|
||||||
static int __stdcall popstring(char *str)
|
static int __stdcall popstring(char *str)
|
||||||
|
|
|
@ -26,6 +26,14 @@ static stack_t *g_st;
|
||||||
|
|
||||||
exec_flags g_exec_flags;
|
exec_flags g_exec_flags;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
exec_flags *flags;
|
||||||
|
void *ExecuteCodeSegment;
|
||||||
|
} plugin_extra_parameters = {
|
||||||
|
&g_exec_flags,
|
||||||
|
&ExecuteCodeSegment
|
||||||
|
};
|
||||||
|
|
||||||
#if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT)
|
#if defined(NSIS_SUPPORT_ACTIVEXREG) || defined(NSIS_SUPPORT_CREATESHORTCUT)
|
||||||
HRESULT g_hres;
|
HRESULT g_hres;
|
||||||
#endif
|
#endif
|
||||||
|
@ -924,17 +932,18 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
void (*func)(HWND,int,char*,void*);
|
void (*func)(HWND,int,char*,void*,void*);
|
||||||
func=(void*)funke;
|
func=(void*)funke;
|
||||||
func(
|
func(
|
||||||
g_hwnd,
|
g_hwnd,
|
||||||
NSIS_MAX_STRLEN,
|
NSIS_MAX_STRLEN,
|
||||||
(char*)g_usrvars,
|
(char*)g_usrvars,
|
||||||
#ifdef NSIS_SUPPORT_STACK
|
#ifdef NSIS_SUPPORT_STACK
|
||||||
(void*)&g_st
|
(void*)&g_st,
|
||||||
#else
|
#else
|
||||||
NULL
|
NULL,
|
||||||
#endif//NSIS_SUPPORT_STACK
|
#endif//NSIS_SUPPORT_STACK
|
||||||
|
&plugin_extra_parameters
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "../Platform.h"
|
||||||
|
|
||||||
#ifndef _FILEFORM_H_
|
#ifndef _FILEFORM_H_
|
||||||
#define _FILEFORM_H_
|
#define _FILEFORM_H_
|
||||||
|
@ -462,11 +463,16 @@ typedef struct
|
||||||
#ifdef NSIS_SUPPORT_REBOOT
|
#ifdef NSIS_SUPPORT_REBOOT
|
||||||
int exec_reboot;
|
int exec_reboot;
|
||||||
int reboot_called;
|
int reboot_called;
|
||||||
|
#else
|
||||||
|
int _;
|
||||||
|
int __;
|
||||||
#endif
|
#endif
|
||||||
int cur_insttype;
|
int cur_insttype;
|
||||||
int insttype_changed;
|
int insttype_changed;
|
||||||
#ifdef NSIS_CONFIG_SILENT_SUPPORT
|
#ifdef NSIS_CONFIG_SILENT_SUPPORT
|
||||||
int silent;
|
int silent;
|
||||||
|
#else
|
||||||
|
int ___;
|
||||||
#endif
|
#endif
|
||||||
int instdir_error;
|
int instdir_error;
|
||||||
int rtl;
|
int rtl;
|
||||||
|
|
2
TODO.txt
2
TODO.txt
|
@ -9,8 +9,6 @@ NSIS
|
||||||
|
|
||||||
* Empty subsections should not show
|
* Empty subsections should not show
|
||||||
|
|
||||||
* More powerful plug-ins (access to ExecFunc and flags and even more)
|
|
||||||
|
|
||||||
* Option to cancel the installation process
|
* Option to cancel the installation process
|
||||||
|
|
||||||
* DirShow back
|
* DirShow back
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue