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:
kichik 2003-04-02 19:54:53 +00:00
parent 104df88ca3
commit 6e963b9e91
8 changed files with 52 additions and 43 deletions

View file

@ -79,7 +79,7 @@ int num_sections;
#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'
@ -631,7 +631,7 @@ nextPage:
}
if (id == IDCANCEL)
{
if (m_abort)
if (g_flags.abort)
{
#ifdef NSIS_SUPPORT_CODECALLBACKS
ExecuteCodeSegment(g_inst_cmnheader->code_onInstFailed,NULL);
@ -1332,20 +1332,20 @@ static DWORD WINAPI install_thread(LPVOID p)
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
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
{
#endif
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
if (g_inst_section[m_inst_sec].flags&SF_SELECTED)
#endif
{
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
else
@ -1358,8 +1358,8 @@ static DWORD WINAPI install_thread(LPVOID p)
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
}
#endif
if (m_curwnd) SendMessage(m_curwnd,WM_NOTIFY_INSTPROC_DONE,m_abort,0);
return m_abort;
if (m_curwnd) SendMessage(m_curwnd,WM_NOTIFY_INSTPROC_DONE,g_flags.abort,0);
return g_flags.abort;
}
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT

View file

@ -24,7 +24,7 @@ typedef struct _stack_t {
static stack_t *g_st;
#endif
union flags g_flags;
union installer_flags g_flags;
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
char plugins_temp_dir[NSIS_MAX_STRLEN]="";
@ -208,6 +208,12 @@ static int NSISCALL ExecuteEntry(entry *entry_)
case EW_SETFLAG:
g_flags.flags[parm0]=parm1;
break;
case EW_IFFLAG:
{
int f=entry_->offsets[!g_flags.flags[parm2]];
g_flags.flags[parm2]&=parm3;
return f;
}
case EW_CHDETAILSVIEW:
if (insthwndbutton) ShowWindow(insthwndbutton,parm1);
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);
}
return parm2;
case EW_IFERRORS:
{
int f=entry_->offsets[!g_flags.exec_error];
g_flags.exec_error=0;
return f;
}
#ifdef NSIS_SUPPORT_RENAME
case EW_RENAME:
{
@ -1110,7 +1110,6 @@ static int NSISCALL ExecuteEntry(entry *entry_)
FreeLibrary(h);
}
break;
case EW_IFREBOOTFLAG: return entry_->offsets[!g_flags.exec_reboot];
#endif//NSIS_SUPPORT_REBOOT
#ifdef NSIS_SUPPORT_INIFILES
case EW_WRITEINI:

View file

@ -1,17 +1,7 @@
#ifndef _EXEC_H_
#define _EXEC_H_
extern union flags {
struct {
int autoclose;
int all_user_var;
int exec_error;
#ifdef NSIS_SUPPORT_REBOOT
int exec_reboot;
#endif
};
int flags[1];
} g_flags;
extern union installer_flags g_flags;
int NSISCALL ExecuteCodeSegment(int pos, HWND hwndProgress); // returns 0 on success

View file

@ -45,8 +45,8 @@ enum
EW_SETFILEATTRIBUTES, // SetFileAttributes: 2 [filename, attributes]
EW_CREATEDIR, // Create directory: 2, [path, ?update$INSTDIR]
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_IFFLAG, // If a flag: 4 [on, off, id, new value mask]
#ifdef NSIS_SUPPORT_RENAME
EW_RENAME, // Rename: 3 [old, new, rebootok]
#endif
@ -513,5 +513,17 @@ DWORD NSISCALL SetSelfFilePointer(LONG lDistanceToMove, DWORD dwMoveMethod);
#define VAR_CODES_START (256 - 36)
#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_