Added IfAbort
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2412 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
104df88ca3
commit
6e963b9e91
8 changed files with 52 additions and 43 deletions
|
@ -985,18 +985,11 @@ int CEXEBuild::resolve_instruction(const char *fn, const char *str, entry *w, in
|
||||||
if (resolve_jump_int(fn,&w->offsets[1],offs,start,end)) return 1;
|
if (resolve_jump_int(fn,&w->offsets[1],offs,start,end)) return 1;
|
||||||
if (resolve_jump_int(fn,&w->offsets[2],offs,start,end)) return 1;
|
if (resolve_jump_int(fn,&w->offsets[2],offs,start,end)) return 1;
|
||||||
}
|
}
|
||||||
else if (w->which == EW_IFERRORS)
|
else if (w->which == EW_IFFLAG)
|
||||||
{
|
{
|
||||||
if (resolve_jump_int(fn,&w->offsets[0],offs,start,end)) return 1;
|
if (resolve_jump_int(fn,&w->offsets[0],offs,start,end)) return 1;
|
||||||
if (resolve_jump_int(fn,&w->offsets[1],offs,start,end)) return 1;
|
if (resolve_jump_int(fn,&w->offsets[1],offs,start,end)) return 1;
|
||||||
}
|
}
|
||||||
#ifdef NSIS_SUPPORT_REBOOT
|
|
||||||
else if (w->which == EW_IFREBOOTFLAG)
|
|
||||||
{
|
|
||||||
if (resolve_jump_int(fn,&w->offsets[0],offs,start,end)) return 1;
|
|
||||||
if (resolve_jump_int(fn,&w->offsets[1],offs,start,end)) return 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef NSIS_SUPPORT_STROPTS
|
#ifdef NSIS_SUPPORT_STROPTS
|
||||||
else if (w->which == EW_STRCMP)
|
else if (w->which == EW_STRCMP)
|
||||||
{
|
{
|
||||||
|
@ -2309,7 +2302,7 @@ again:
|
||||||
ret=add_entry_direct(EW_CREATEDIR, zero_offset);
|
ret=add_entry_direct(EW_CREATEDIR, zero_offset);
|
||||||
if (ret != PS_OK) return ret;
|
if (ret != PS_OK) return ret;
|
||||||
// IfErrors Initialize_____Plugins_error - detect errors
|
// IfErrors Initialize_____Plugins_error - detect errors
|
||||||
ret=add_entry_direct(EW_IFERRORS, ns_label.add("Initialize_____Plugins_error",0));
|
ret=add_entry_direct(EW_IFFLAG, ns_label.add("Initialize_____Plugins_error",0), 0, FIELD_OFFSET(installer_flags, exec_error));
|
||||||
if (ret != PS_OK) return ret;
|
if (ret != PS_OK) return ret;
|
||||||
// Copy $0 to $PLUGINSDIR
|
// Copy $0 to $PLUGINSDIR
|
||||||
ret=add_entry_direct(EW_PLUGINCOMMANDPREP);
|
ret=add_entry_direct(EW_PLUGINCOMMANDPREP);
|
||||||
|
|
|
@ -79,7 +79,7 @@ int num_sections;
|
||||||
|
|
||||||
#define WM_TREEVIEW_KEYHACK (WM_USER+0x13)
|
#define WM_TREEVIEW_KEYHACK (WM_USER+0x13)
|
||||||
|
|
||||||
static int m_page=-1,m_abort,m_retcode,m_delta=1;
|
static int m_page=-1,m_retcode,m_delta=1;
|
||||||
|
|
||||||
#define NOTIFY_BYE_BYE 'x'
|
#define NOTIFY_BYE_BYE 'x'
|
||||||
|
|
||||||
|
@ -631,7 +631,7 @@ nextPage:
|
||||||
}
|
}
|
||||||
if (id == IDCANCEL)
|
if (id == IDCANCEL)
|
||||||
{
|
{
|
||||||
if (m_abort)
|
if (g_flags.abort)
|
||||||
{
|
{
|
||||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||||
ExecuteCodeSegment(g_inst_cmnheader->code_onInstFailed,NULL);
|
ExecuteCodeSegment(g_inst_cmnheader->code_onInstFailed,NULL);
|
||||||
|
@ -1332,20 +1332,20 @@ static DWORD WINAPI install_thread(LPVOID p)
|
||||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||||
if (g_is_uninstaller)
|
if (g_is_uninstaller)
|
||||||
{
|
{
|
||||||
if (ExecuteCodeSegment(g_inst_uninstheader->code,g_progresswnd)) m_abort++;
|
if (ExecuteCodeSegment(g_inst_uninstheader->code,g_progresswnd)) g_flags.abort++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
int m_inst_sec=0;
|
int m_inst_sec=0;
|
||||||
while (m_inst_sec<num_sections && !m_abort)
|
while (m_inst_sec<num_sections && !g_flags.abort)
|
||||||
{
|
{
|
||||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||||
if (g_inst_section[m_inst_sec].flags&SF_SELECTED)
|
if (g_inst_section[m_inst_sec].flags&SF_SELECTED)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
log_printf2("Section: \"%s\"",GetStringFromStringTab(g_inst_section[m_inst_sec].name_ptr));
|
log_printf2("Section: \"%s\"",GetStringFromStringTab(g_inst_section[m_inst_sec].name_ptr));
|
||||||
if (ExecuteCodeSegment(g_inst_section[m_inst_sec].code,g_progresswnd)) m_abort++;
|
if (ExecuteCodeSegment(g_inst_section[m_inst_sec].code,g_progresswnd)) g_flags.abort++;
|
||||||
}
|
}
|
||||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||||
else
|
else
|
||||||
|
@ -1358,8 +1358,8 @@ static DWORD WINAPI install_thread(LPVOID p)
|
||||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (m_curwnd) SendMessage(m_curwnd,WM_NOTIFY_INSTPROC_DONE,m_abort,0);
|
if (m_curwnd) SendMessage(m_curwnd,WM_NOTIFY_INSTPROC_DONE,g_flags.abort,0);
|
||||||
return m_abort;
|
return g_flags.abort;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||||
|
|
|
@ -24,7 +24,7 @@ typedef struct _stack_t {
|
||||||
static stack_t *g_st;
|
static stack_t *g_st;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
union flags g_flags;
|
union installer_flags g_flags;
|
||||||
|
|
||||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||||
char plugins_temp_dir[NSIS_MAX_STRLEN]="";
|
char plugins_temp_dir[NSIS_MAX_STRLEN]="";
|
||||||
|
@ -208,6 +208,12 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
case EW_SETFLAG:
|
case EW_SETFLAG:
|
||||||
g_flags.flags[parm0]=parm1;
|
g_flags.flags[parm0]=parm1;
|
||||||
break;
|
break;
|
||||||
|
case EW_IFFLAG:
|
||||||
|
{
|
||||||
|
int f=entry_->offsets[!g_flags.flags[parm2]];
|
||||||
|
g_flags.flags[parm2]&=parm3;
|
||||||
|
return f;
|
||||||
|
}
|
||||||
case EW_CHDETAILSVIEW:
|
case EW_CHDETAILSVIEW:
|
||||||
if (insthwndbutton) ShowWindow(insthwndbutton,parm1);
|
if (insthwndbutton) ShowWindow(insthwndbutton,parm1);
|
||||||
if (insthwnd) ShowWindow(insthwnd,parm0);
|
if (insthwnd) ShowWindow(insthwnd,parm0);
|
||||||
|
@ -274,12 +280,6 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
log_printf3("IfFileExists: file \"%s\" does not exist, jumping %d",buf0,parm2);
|
log_printf3("IfFileExists: file \"%s\" does not exist, jumping %d",buf0,parm2);
|
||||||
}
|
}
|
||||||
return parm2;
|
return parm2;
|
||||||
case EW_IFERRORS:
|
|
||||||
{
|
|
||||||
int f=entry_->offsets[!g_flags.exec_error];
|
|
||||||
g_flags.exec_error=0;
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
#ifdef NSIS_SUPPORT_RENAME
|
#ifdef NSIS_SUPPORT_RENAME
|
||||||
case EW_RENAME:
|
case EW_RENAME:
|
||||||
{
|
{
|
||||||
|
@ -1110,7 +1110,6 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
FreeLibrary(h);
|
FreeLibrary(h);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EW_IFREBOOTFLAG: return entry_->offsets[!g_flags.exec_reboot];
|
|
||||||
#endif//NSIS_SUPPORT_REBOOT
|
#endif//NSIS_SUPPORT_REBOOT
|
||||||
#ifdef NSIS_SUPPORT_INIFILES
|
#ifdef NSIS_SUPPORT_INIFILES
|
||||||
case EW_WRITEINI:
|
case EW_WRITEINI:
|
||||||
|
|
|
@ -1,17 +1,7 @@
|
||||||
#ifndef _EXEC_H_
|
#ifndef _EXEC_H_
|
||||||
#define _EXEC_H_
|
#define _EXEC_H_
|
||||||
|
|
||||||
extern union flags {
|
extern union installer_flags g_flags;
|
||||||
struct {
|
|
||||||
int autoclose;
|
|
||||||
int all_user_var;
|
|
||||||
int exec_error;
|
|
||||||
#ifdef NSIS_SUPPORT_REBOOT
|
|
||||||
int exec_reboot;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
int flags[1];
|
|
||||||
} g_flags;
|
|
||||||
|
|
||||||
int NSISCALL ExecuteCodeSegment(int pos, HWND hwndProgress); // returns 0 on success
|
int NSISCALL ExecuteCodeSegment(int pos, HWND hwndProgress); // returns 0 on success
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ enum
|
||||||
EW_SETFILEATTRIBUTES, // SetFileAttributes: 2 [filename, attributes]
|
EW_SETFILEATTRIBUTES, // SetFileAttributes: 2 [filename, attributes]
|
||||||
EW_CREATEDIR, // Create directory: 2, [path, ?update$INSTDIR]
|
EW_CREATEDIR, // Create directory: 2, [path, ?update$INSTDIR]
|
||||||
EW_IFFILEEXISTS, // IfFileExists: 3, [file name, jump amount if exists, jump amount if not exists]
|
EW_IFFILEEXISTS, // IfFileExists: 3, [file name, jump amount if exists, jump amount if not exists]
|
||||||
EW_IFERRORS, // IfErrors: 2 [jump if error, jump if not error]
|
|
||||||
EW_SETFLAG, // Sets a flag: 2 [id, data]
|
EW_SETFLAG, // Sets a flag: 2 [id, data]
|
||||||
|
EW_IFFLAG, // If a flag: 4 [on, off, id, new value mask]
|
||||||
#ifdef NSIS_SUPPORT_RENAME
|
#ifdef NSIS_SUPPORT_RENAME
|
||||||
EW_RENAME, // Rename: 3 [old, new, rebootok]
|
EW_RENAME, // Rename: 3 [old, new, rebootok]
|
||||||
#endif
|
#endif
|
||||||
|
@ -513,5 +513,17 @@ DWORD NSISCALL SetSelfFilePointer(LONG lDistanceToMove, DWORD dwMoveMethod);
|
||||||
#define VAR_CODES_START (256 - 36)
|
#define VAR_CODES_START (256 - 36)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
union installer_flags {
|
||||||
|
struct {
|
||||||
|
int autoclose;
|
||||||
|
int all_user_var;
|
||||||
|
int exec_error;
|
||||||
|
int abort;
|
||||||
|
#ifdef NSIS_SUPPORT_REBOOT
|
||||||
|
int exec_reboot;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
int flags[1];
|
||||||
|
};
|
||||||
|
|
||||||
#endif //_FILEFORM_H_
|
#endif //_FILEFORM_H_
|
||||||
|
|
|
@ -356,6 +356,8 @@ int CEXEBuild::process_jump(LineParser &line, int wt, int *offs)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FLAG_OFFSET(flag) (FIELD_OFFSET(installer_flags, flag)/sizeof(int))
|
||||||
|
|
||||||
int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char *curfilename, int *lineptr)
|
int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char *curfilename, int *lineptr)
|
||||||
{
|
{
|
||||||
int linecnt = *lineptr;
|
int linecnt = *lineptr;
|
||||||
|
@ -2470,7 +2472,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
||||||
return add_entry(&ent);
|
return add_entry(&ent);
|
||||||
case TOK_SETSHELLVARCONTEXT:
|
case TOK_SETSHELLVARCONTEXT:
|
||||||
ent.which=EW_SETFLAG;
|
ent.which=EW_SETFLAG;
|
||||||
ent.offsets[0]=1;
|
ent.offsets[0]=FLAG_OFFSET(all_user_var);
|
||||||
ent.offsets[1]=line.gettoken_enum(1,"current\0all\0");
|
ent.offsets[1]=line.gettoken_enum(1,"current\0all\0");
|
||||||
if (ent.offsets[1]<0) PRINTHELP()
|
if (ent.offsets[1]<0) PRINTHELP()
|
||||||
SCRIPT_MSG("SetShellVarContext: %s\n",line.gettoken_str(1));
|
SCRIPT_MSG("SetShellVarContext: %s\n",line.gettoken_str(1));
|
||||||
|
@ -3248,26 +3250,35 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
||||||
return add_entry(&ent);
|
return add_entry(&ent);
|
||||||
case TOK_SETAUTOCLOSE:
|
case TOK_SETAUTOCLOSE:
|
||||||
ent.which=EW_SETFLAG;
|
ent.which=EW_SETFLAG;
|
||||||
ent.offsets[0]=0;
|
ent.offsets[0]=FLAG_OFFSET(autoclose);
|
||||||
ent.offsets[1]=line.gettoken_enum(1,"false\0true\0");
|
ent.offsets[1]=line.gettoken_enum(1,"false\0true\0");
|
||||||
if (ent.offsets[1] < 0) PRINTHELP()
|
if (ent.offsets[1] < 0) PRINTHELP()
|
||||||
SCRIPT_MSG("SetAutoClose: %s\n",line.gettoken_str(1));
|
SCRIPT_MSG("SetAutoClose: %s\n",line.gettoken_str(1));
|
||||||
return add_entry(&ent);
|
return add_entry(&ent);
|
||||||
case TOK_IFERRORS:
|
case TOK_IFERRORS:
|
||||||
ent.which=EW_IFERRORS;
|
ent.which=EW_IFFLAG;
|
||||||
if (process_jump(line,1,&ent.offsets[0]) ||
|
if (process_jump(line,1,&ent.offsets[0]) ||
|
||||||
process_jump(line,2,&ent.offsets[1])) PRINTHELP()
|
process_jump(line,2,&ent.offsets[1])) PRINTHELP()
|
||||||
|
ent.offsets[2]=FLAG_OFFSET(exec_error);
|
||||||
|
ent.offsets[3]=0;//new value mask - clean error
|
||||||
SCRIPT_MSG("IfErrors ?%s:%s\n",line.gettoken_str(1),line.gettoken_str(2));
|
SCRIPT_MSG("IfErrors ?%s:%s\n",line.gettoken_str(1),line.gettoken_str(2));
|
||||||
|
case TOK_IFABORT:
|
||||||
|
ent.which=EW_IFFLAG;
|
||||||
|
if (process_jump(line,1,&ent.offsets[0]) ||
|
||||||
|
process_jump(line,2,&ent.offsets[1])) PRINTHELP()
|
||||||
|
ent.offsets[2]=FLAG_OFFSET(abort);
|
||||||
|
ent.offsets[3]=(int)~0;//new value mask - keep flag
|
||||||
|
SCRIPT_MSG("IfAbort ?%s:%s\n",line.gettoken_str(1),line.gettoken_str(2));
|
||||||
return add_entry(&ent);
|
return add_entry(&ent);
|
||||||
case TOK_CLEARERRORS:
|
case TOK_CLEARERRORS:
|
||||||
ent.which=EW_SETFLAG;
|
ent.which=EW_SETFLAG;
|
||||||
ent.offsets[0]=2;
|
ent.offsets[0]=FLAG_OFFSET(exec_error);
|
||||||
ent.offsets[1]=0;
|
ent.offsets[1]=0;
|
||||||
SCRIPT_MSG("ClearErrors\n");
|
SCRIPT_MSG("ClearErrors\n");
|
||||||
return add_entry(&ent);
|
return add_entry(&ent);
|
||||||
case TOK_SETERRORS:
|
case TOK_SETERRORS:
|
||||||
ent.which=EW_SETFLAG;
|
ent.which=EW_SETFLAG;
|
||||||
ent.offsets[0]=2;
|
ent.offsets[0]=FLAG_OFFSET(exec_error);
|
||||||
ent.offsets[1]=1;
|
ent.offsets[1]=1;
|
||||||
SCRIPT_MSG("SetErrors\n");
|
SCRIPT_MSG("SetErrors\n");
|
||||||
return add_entry(&ent);
|
return add_entry(&ent);
|
||||||
|
@ -3997,14 +4008,16 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
||||||
SCRIPT_MSG("Reboot! (WOW)\n");
|
SCRIPT_MSG("Reboot! (WOW)\n");
|
||||||
return add_entry(&ent);
|
return add_entry(&ent);
|
||||||
case TOK_IFREBOOTFLAG:
|
case TOK_IFREBOOTFLAG:
|
||||||
ent.which=EW_IFREBOOTFLAG;
|
ent.which=EW_IFFLAG;
|
||||||
if (process_jump(line,1,&ent.offsets[0]) ||
|
if (process_jump(line,1,&ent.offsets[0]) ||
|
||||||
process_jump(line,2,&ent.offsets[1])) PRINTHELP()
|
process_jump(line,2,&ent.offsets[1])) PRINTHELP()
|
||||||
|
ent.offsets[2]=FLAG_OFFSET(exec_reboot);
|
||||||
|
ent.offsets[3]=(int)~0;//new value mask - keep flag
|
||||||
SCRIPT_MSG("IfRebootFlag ?%s:%s\n",line.gettoken_str(1),line.gettoken_str(2));
|
SCRIPT_MSG("IfRebootFlag ?%s:%s\n",line.gettoken_str(1),line.gettoken_str(2));
|
||||||
return add_entry(&ent);
|
return add_entry(&ent);
|
||||||
case TOK_SETREBOOTFLAG:
|
case TOK_SETREBOOTFLAG:
|
||||||
ent.which=EW_SETFLAG;
|
ent.which=EW_SETFLAG;
|
||||||
ent.offsets[0]=3;
|
ent.offsets[0]=FLAG_OFFSET(exec_reboot);
|
||||||
ent.offsets[1]=line.gettoken_enum(1,"false\0true\0");
|
ent.offsets[1]=line.gettoken_enum(1,"false\0true\0");
|
||||||
if (ent.offsets[1] < 0) PRINTHELP()
|
if (ent.offsets[1] < 0) PRINTHELP()
|
||||||
return add_entry(&ent);
|
return add_entry(&ent);
|
||||||
|
|
|
@ -80,6 +80,7 @@ static tokenType tokenlist[TOK__LAST] =
|
||||||
{TOK_GETWINTEXT,"GetWindowText",2,0,"$(user_var: handle output) hwnd"},
|
{TOK_GETWINTEXT,"GetWindowText",2,0,"$(user_var: handle output) hwnd"},
|
||||||
{TOK_HIDEWINDOW,"HideWindow",0,0,""},
|
{TOK_HIDEWINDOW,"HideWindow",0,0,""},
|
||||||
{TOK_ICON,"Icon",1,0,"local_icon.ico"},
|
{TOK_ICON,"Icon",1,0,"local_icon.ico"},
|
||||||
|
{TOK_IFABORT,"IfAbort",1,1,"label_to_goto_if_abort [label_to_goto_if_no_abort]"},
|
||||||
{TOK_IFERRORS,"IfErrors",1,1,"label_to_goto_if_errors [label_to_goto_if_no_errors]"},
|
{TOK_IFERRORS,"IfErrors",1,1,"label_to_goto_if_errors [label_to_goto_if_no_errors]"},
|
||||||
{TOK_IFFILEEXISTS,"IfFileExists",2,1,"filename label_to_goto_if_file_exists [label_to_goto_otherwise]"},
|
{TOK_IFFILEEXISTS,"IfFileExists",2,1,"filename label_to_goto_if_file_exists [label_to_goto_otherwise]"},
|
||||||
{TOK_IFREBOOTFLAG,"IfRebootFlag",1,1,"jump_if_set [jump_if_not_set]"},
|
{TOK_IFREBOOTFLAG,"IfRebootFlag",1,1,"jump_if_set [jump_if_not_set]"},
|
||||||
|
|
|
@ -144,6 +144,7 @@ enum
|
||||||
TOK_IFERRORS,
|
TOK_IFERRORS,
|
||||||
TOK_CLEARERRORS,
|
TOK_CLEARERRORS,
|
||||||
TOK_SETERRORS,
|
TOK_SETERRORS,
|
||||||
|
TOK_IFABORT,
|
||||||
TOK_STRCPY,
|
TOK_STRCPY,
|
||||||
TOK_STRCMP,
|
TOK_STRCMP,
|
||||||
TOK_GETTEMPFILENAME,
|
TOK_GETTEMPFILENAME,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue