Shaved off another 104 bytes of code.
exehead_bzip2 is now 37.5K. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1057 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
24977f45d0
commit
0910f0dd75
3 changed files with 24 additions and 24 deletions
|
@ -399,7 +399,7 @@ int NSISCALL ui_doinstall(void)
|
||||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||||
g_hwnd=m_bgwnd;
|
g_hwnd=m_bgwnd;
|
||||||
// Select language
|
// Select language
|
||||||
if (ExecuteCodeSegment(g_inst_entry,g_inst_cmnheader->code_onInit,NULL)) return 1;
|
if (ExecuteCodeSegment(g_inst_cmnheader->code_onInit,NULL)) return 1;
|
||||||
set_language();
|
set_language();
|
||||||
g_hwnd=NULL;
|
g_hwnd=NULL;
|
||||||
ShowWindow(m_bgwnd, SW_SHOW);
|
ShowWindow(m_bgwnd, SW_SHOW);
|
||||||
|
@ -438,18 +438,18 @@ int NSISCALL ui_doinstall(void)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||||
if (ExecuteCodeSegment(g_inst_entry,g_inst_cmnheader->code_onInit,NULL)) return 1;
|
if (ExecuteCodeSegment(g_inst_cmnheader->code_onInit,NULL)) return 1;
|
||||||
set_language();
|
set_language();
|
||||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||||
if (install_thread(NULL))
|
if (install_thread(NULL))
|
||||||
{
|
{
|
||||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||||
if (!g_quit_flag) ExecuteCodeSegment(g_inst_entry,g_inst_cmnheader->code_onInstFailed,NULL);
|
if (!g_quit_flag) ExecuteCodeSegment(g_inst_cmnheader->code_onInstFailed,NULL);
|
||||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||||
ExecuteCodeSegment(g_inst_entry,g_inst_cmnheader->code_onInstSuccess,NULL);
|
ExecuteCodeSegment(g_inst_cmnheader->code_onInstSuccess,NULL);
|
||||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -538,7 +538,7 @@ static BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
!((g_inst_cmnheader->misc_flags&2) &&
|
!((g_inst_cmnheader->misc_flags&2) &&
|
||||||
is_valid_instpath(state_install_directory)
|
is_valid_instpath(state_install_directory)
|
||||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||||
&& !ExecuteCodeSegment(g_inst_entry,g_inst_header->code_onVerifyInstDir,NULL)
|
&& !ExecuteCodeSegment(g_inst_header->code_onVerifyInstDir,NULL)
|
||||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||||
)) isdp++;
|
)) isdp++;
|
||||||
}
|
}
|
||||||
|
@ -549,7 +549,7 @@ static BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
int count=1; // Number of pages to move by
|
int count=1; // Number of pages to move by
|
||||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||||
// Call onNext|PrevPage for every not-definitely-disabled page
|
// Call onNext|PrevPage for every not-definitely-disabled page
|
||||||
if (ExecuteCodeSegment(g_inst_entry,delta>0?g_inst_cmnheader->code_onNextPage:g_inst_header->code_onPrevPage,NULL))
|
if (ExecuteCodeSegment(delta>0?g_inst_cmnheader->code_onNextPage:g_inst_header->code_onPrevPage,NULL))
|
||||||
{
|
{
|
||||||
if (g_quit_flag) // Quit instruction used?
|
if (g_quit_flag) // Quit instruction used?
|
||||||
m_page=count=-1;
|
m_page=count=-1;
|
||||||
|
@ -565,7 +565,7 @@ static BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
} while ((m_page >= 0) && (m_page <= g_max_page) && (m_page==2 && !isdp));
|
} while ((m_page >= 0) && (m_page <= g_max_page) && (m_page==2 && !isdp));
|
||||||
|
|
||||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||||
if (m_page>g_max_page) ExecuteCodeSegment(g_inst_entry,g_inst_cmnheader->code_onInstSuccess,NULL);
|
if (m_page>g_max_page) ExecuteCodeSegment(g_inst_cmnheader->code_onInstSuccess,NULL);
|
||||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||||
|
|
||||||
if (m_curwnd && (m_page!=prev_page))
|
if (m_curwnd && (m_page!=prev_page))
|
||||||
|
@ -604,7 +604,7 @@ static BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
ScreenToClient(hwndDlg,(LPPOINT)&r);
|
ScreenToClient(hwndDlg,(LPPOINT)&r);
|
||||||
SetWindowPos(m_curwnd,0,r.left,r.top,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER);
|
SetWindowPos(m_curwnd,0,r.left,r.top,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER);
|
||||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||||
ExecuteCodeSegment(g_inst_entry,g_inst_cmnheader->code_onInitDialog,NULL);
|
ExecuteCodeSegment(g_inst_cmnheader->code_onInitDialog,NULL);
|
||||||
#endif //NSIS_SUPPORT_CODECALLBACKS
|
#endif //NSIS_SUPPORT_CODECALLBACKS
|
||||||
SendMessage(m_curwnd, WM_NOTIFY_START, 0, 0);
|
SendMessage(m_curwnd, WM_NOTIFY_START, 0, 0);
|
||||||
ShowWindow(m_curwnd,SW_SHOWNA);
|
ShowWindow(m_curwnd,SW_SHOWNA);
|
||||||
|
@ -648,14 +648,14 @@ static BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
if (m_abort)
|
if (m_abort)
|
||||||
{
|
{
|
||||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||||
ExecuteCodeSegment(g_inst_entry,g_inst_cmnheader->code_onInstFailed,NULL);
|
ExecuteCodeSegment(g_inst_cmnheader->code_onInstFailed,NULL);
|
||||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||||
EndDialog(hwndDlg,2);
|
EndDialog(hwndDlg,2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||||
if (!ExecuteCodeSegment(g_inst_entry,g_inst_cmnheader->code_onUserAbort,NULL))
|
if (!ExecuteCodeSegment(g_inst_cmnheader->code_onUserAbort,NULL))
|
||||||
#endif//NSIS_SUPPORT_CODECALLBACKS
|
#endif//NSIS_SUPPORT_CODECALLBACKS
|
||||||
{
|
{
|
||||||
EndDialog(hwndDlg,1);
|
EndDialog(hwndDlg,1);
|
||||||
|
@ -907,7 +907,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||||
EnableWindow(GetDlgItem(g_hwnd,IDOK),
|
EnableWindow(GetDlgItem(g_hwnd,IDOK),
|
||||||
is_valid_path && (available >= total || available == -1)
|
is_valid_path && (available >= total || available == -1)
|
||||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||||
&& !ExecuteCodeSegment(g_inst_entry,g_inst_header->code_onVerifyInstDir,NULL)
|
&& !ExecuteCodeSegment(g_inst_header->code_onVerifyInstDir,NULL)
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -966,7 +966,7 @@ static DWORD WINAPI newTreeWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
|
||||||
mystrcpy(g_tmp, g_usrvars[0]);
|
mystrcpy(g_tmp, g_usrvars[0]);
|
||||||
|
|
||||||
myitoa(g_usrvars[0], last_item);
|
myitoa(g_usrvars[0], last_item);
|
||||||
ExecuteCodeSegment(g_inst_entry,g_inst_header->code_onMouseOverSection,NULL);
|
ExecuteCodeSegment(g_inst_header->code_onMouseOverSection,NULL);
|
||||||
|
|
||||||
mystrcpy(g_usrvars[0], g_tmp);
|
mystrcpy(g_usrvars[0], g_tmp);
|
||||||
}
|
}
|
||||||
|
@ -1175,7 +1175,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
||||||
{
|
{
|
||||||
extern HWND g_SectionHack;
|
extern HWND g_SectionHack;
|
||||||
g_SectionHack=hwndDlg;
|
g_SectionHack=hwndDlg;
|
||||||
ExecuteCodeSegment(g_inst_entry,g_inst_header->code_onSelChange,NULL);
|
ExecuteCodeSegment(g_inst_header->code_onSelChange,NULL);
|
||||||
g_SectionHack=0;
|
g_SectionHack=0;
|
||||||
}
|
}
|
||||||
#endif//NSIS_SUPPORT_CODECALLBACKS && NSIS_CONFIG_COMPONENTPAGE
|
#endif//NSIS_SUPPORT_CODECALLBACKS && NSIS_CONFIG_COMPONENTPAGE
|
||||||
|
@ -1332,7 +1332,7 @@ 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_entry,g_inst_uninstheader->code,g_progresswnd)) m_abort++;
|
if (ExecuteCodeSegment(g_inst_uninstheader->code,g_progresswnd)) m_abort++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1349,7 +1349,7 @@ static DWORD WINAPI install_thread(LPVOID p)
|
||||||
#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_entry,g_inst_section[m_inst_sec].code,g_progresswnd)) m_abort++;
|
if (ExecuteCodeSegment(g_inst_section[m_inst_sec].code,g_progresswnd)) m_abort++;
|
||||||
}
|
}
|
||||||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||||
else
|
else
|
||||||
|
|
|
@ -82,7 +82,7 @@ static LONG NSISCALL myRegDeleteKeyEx(HKEY thiskey, LPCTSTR lpSubKey, int onlyif
|
||||||
|
|
||||||
extern char g_all_user_var_flag;
|
extern char g_all_user_var_flag;
|
||||||
|
|
||||||
static int NSISCALL ExecuteEntry(entry *entries, int pos);
|
static int NSISCALL ExecuteEntry(entry *entry_);
|
||||||
|
|
||||||
static int NSISCALL resolveaddr(int v)
|
static int NSISCALL resolveaddr(int v)
|
||||||
{
|
{
|
||||||
|
@ -90,13 +90,13 @@ static int NSISCALL resolveaddr(int v)
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
int NSISCALL ExecuteCodeSegment(entry *entries, int pos, HWND hwndProgress)
|
int NSISCALL ExecuteCodeSegment(int pos, HWND hwndProgress)
|
||||||
{
|
{
|
||||||
while (pos >= 0)
|
while (pos >= 0)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
if (entries[pos].which == EW_RET) return 0;
|
if (g_inst_entry[pos].which == EW_RET) return 0;
|
||||||
rv=ExecuteEntry(entries,pos);
|
rv=ExecuteEntry(g_inst_entry + pos);
|
||||||
if (rv == EXEC_ERROR) return EXEC_ERROR;
|
if (rv == EXEC_ERROR) return EXEC_ERROR;
|
||||||
|
|
||||||
rv=resolveaddr(rv);
|
rv=resolveaddr(rv);
|
||||||
|
@ -138,11 +138,11 @@ static void NSISCALL process_string_fromparm_tobuf(int id_)
|
||||||
// returns EXEC_ERROR on error
|
// returns EXEC_ERROR on error
|
||||||
// returns 0, advance position by 1
|
// returns 0, advance position by 1
|
||||||
// otherwise, returns new_position+1
|
// otherwise, returns new_position+1
|
||||||
static int NSISCALL ExecuteEntry(entry *entries, int pos)
|
static int NSISCALL ExecuteEntry(entry *entry_)
|
||||||
{
|
{
|
||||||
// changed by Amir Szekely 28 August 2002
|
// changed by Amir Szekely 28 August 2002
|
||||||
// shaves off 0.5KB
|
// shaves off 0.5KB
|
||||||
int parm0 = (parms = entries[pos].offsets)[0];
|
int parm0 = (parms = entry_->offsets)[0];
|
||||||
int parm1 = parms[1];
|
int parm1 = parms[1];
|
||||||
int parm2 = parms[2];
|
int parm2 = parms[2];
|
||||||
int parm3 = parms[3];
|
int parm3 = parms[3];
|
||||||
|
@ -158,7 +158,7 @@ static int NSISCALL ExecuteEntry(entry *entries, int pos)
|
||||||
char *buf1 = bufs[1];
|
char *buf1 = bufs[1];
|
||||||
char *buf2 = bufs[2];
|
char *buf2 = bufs[2];
|
||||||
char *buf3 = bufs[3];
|
char *buf3 = bufs[3];
|
||||||
int which = entries[pos].which;
|
int which = entry_->which;
|
||||||
switch (which)
|
switch (which)
|
||||||
{
|
{
|
||||||
case EW_NOP:
|
case EW_NOP:
|
||||||
|
@ -179,7 +179,7 @@ static int NSISCALL ExecuteEntry(entry *entries, int pos)
|
||||||
{
|
{
|
||||||
int v=resolveaddr(parm0)-1; // address is -1, since we encode it as +1
|
int v=resolveaddr(parm0)-1; // address is -1, since we encode it as +1
|
||||||
log_printf2("Call: %d",v);
|
log_printf2("Call: %d",v);
|
||||||
return ExecuteCodeSegment(entries,v,NULL);
|
return ExecuteCodeSegment(v,NULL);
|
||||||
}
|
}
|
||||||
case EW_UPDATETEXT:
|
case EW_UPDATETEXT:
|
||||||
if (parm1) ui_st_updateflag=parm1;
|
if (parm1) ui_st_updateflag=parm1;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef _EXEC_H_
|
#ifndef _EXEC_H_
|
||||||
#define _EXEC_H_
|
#define _EXEC_H_
|
||||||
|
|
||||||
int NSISCALL ExecuteCodeSegment(entry *entries, int pos, HWND hwndProgress); // returns 0 on success
|
int NSISCALL ExecuteCodeSegment(int pos, HWND hwndProgress); // returns 0 on success
|
||||||
|
|
||||||
|
|
||||||
#endif//_EXEC_H_
|
#endif//_EXEC_H_
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue