- Improved installation types behaviour

- .onSelChange no longer called when the components page is created
- First section is selected at compile time - changes in .onInit stick
- Added SectionSetSize / SectionGetSize
- Added SetCurInstType / GetCurInstType
- Added InstTypeSetText / InstTypeGetText - ability to change (and add and remove) installation types on runtime
- NSIS_MAX_INST_TYPES is now 32 by default
- InstType texts are now processed ($0, $1, etc. can be used)
- Added /o switch for Section - unselected by default


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2563 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-05-24 13:50:24 +00:00
parent fe3a6393e5
commit 564ca077d8
21 changed files with 381 additions and 207 deletions

View file

@ -56,7 +56,7 @@ STYLE DS_CONTROL | DS_SHELLFONT | WS_CHILD
FONT 8, "MS Shell Dlg"
BEGIN
COMBOBOX IDC_COMBO1,114,25,152,102,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
WS_TABSTOP | NOT WS_VISIBLE
ICON IDI_ICON2,IDC_ULICON,0,0,21,20
LTEXT "",IDC_TEXT2,0,40,108,65
CONTROL "",IDC_TEXT1,"Static",SS_LEFTNOWORDWRAP,0,27,108,8

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -265,7 +265,7 @@ CEXEBuild::CEXEBuild()
build_header.install_directory_ptr=0;
build_header.install_reg_key_ptr=0;
#ifdef NSIS_CONFIG_COMPONENTPAGE
memset(build_header.install_types_ptr,0,sizeof(build_header.install_types_ptr));
memset(build_header.install_types,0,sizeof(build_header.install_types));
#endif
// Changed by Amir Szekely 11th July 2002
@ -315,6 +315,8 @@ CEXEBuild::CEXEBuild()
notify_hwnd=0;
uDefCodePage=CP_ACP;
use_first_insttype=true;
}
int CEXEBuild::getcurdbsize() { return cur_datablock->getlen(); }
@ -325,6 +327,13 @@ int CEXEBuild::add_string(const char *string) // returns offset in stringblock
return add_string_main(string,1);
}
int CEXEBuild::add_intstring(const int i) // returns offset in stringblock
{
char i_str[64];
wsprintf(i_str, "%d", i);
return add_string(i_str);
}
// based on Dave Laundon's code
int CEXEBuild::preprocess_string(char *out, const char *in)
{
@ -356,6 +365,7 @@ int CEXEBuild::preprocess_string(char *out, const char *in)
"OUTDIR\0" // 23
"EXEDIR\0" // 24
"LANGUAGE\0" // 25
"PLUGINSDIR\0" // 26
"PROGRAMFILES\0" // 26
"SMPROGRAMS\0" // 27
"SMSTARTUP\0" // 28
@ -365,9 +375,6 @@ int CEXEBuild::preprocess_string(char *out, const char *in)
"TEMP\0" // 32
"WINDIR\0" // 33
"SYSDIR\0" // 34
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
"PLUGINSDIR\0" // 35
#endif
;
const char *p=in;
@ -410,7 +417,14 @@ int CEXEBuild::preprocess_string(char *out, const char *in)
pVarName += strlen(pVarName) + 1, i++
);
// Found?
if (*pVarName) p += strlen(pVarName);
if (*pVarName
#ifndef NSIS_CONFIG_PLUGIN_SUPPORT
&& i != VAR_CODES_START + 26
#endif
)
{
p += strlen(pVarName);
}
else // warning should go here
{
char tbuf[64];
@ -782,7 +796,7 @@ int CEXEBuild::section_end()
return PS_OK;
}
int CEXEBuild::add_section(const char *secname, const char *file, int line, const char *defname, int expand=0)
int CEXEBuild::add_section(const char *secname, const char *file, int line, const char *defname, int expand/*=0*/)
{
if (build_cursection_isfunc)
{
@ -1227,7 +1241,6 @@ int CEXEBuild::write_output(void)
}
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
// Added by Amir Szekely 9th August 2002
int err=add_plugins_dir_initializer();
if (err != PS_OK)
return err;
@ -1286,6 +1299,18 @@ int CEXEBuild::write_output(void)
if (resolve_coderefs("install")) return PS_ERROR;
// set sections to the first insttype
if (use_first_insttype && build_header.install_types[0])
{
int n = build_sections.getlen()/sizeof(section);
section *sections = (section *) build_sections.get();
for (int i = 0; i < n; i++)
{
if ((sections[i].install_types & 1) == 0)
sections[i].flags &= ~SF_SELECTED;
}
}
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
{
SCRIPT_MSG("Processing pages... ");
@ -2263,6 +2288,8 @@ void CEXEBuild::build_plugin_table(void)
}
}
#define FLAG_OFFSET(flag) (FIELD_OFFSET(installer_flags, flag)/sizeof(int))
int CEXEBuild::add_plugins_dir_initializer(void)
{
if (!plugin_used && !uninst_plugin_used) return PS_OK;
@ -2293,7 +2320,7 @@ again:
ret=add_entry_direct(EW_PUSHPOP, zero_offset);
if (ret != PS_OK) return ret;
// ClearErrors
ret=add_entry_direct(EW_SETFLAG, 2);
ret=add_entry_direct(EW_SETFLAG, add_intstring(FLAG_OFFSET(exec_error)));
if (ret != PS_OK) return ret;
// GetTempFileName $0
ret=add_entry_direct(EW_GETTEMPFILENAME);
@ -2308,7 +2335,7 @@ again:
ret=add_entry_direct(EW_IFFLAG, ns_label.add("Initialize_____Plugins_error",0), 0, FIELD_OFFSET(installer_flags, exec_error)/sizeof(int));
if (ret != PS_OK) return ret;
// Copy $0 to $PLUGINSDIR
ret=add_entry_direct(EW_PLUGINCOMMANDPREP);
ret=add_entry_direct(EW_ASSIGNVAR,25,zero_offset);
if (ret != PS_OK) return ret;
// Pop $0
ret=add_entry_direct(EW_PUSHPOP, 0, 1);

View file

@ -107,7 +107,7 @@ class CEXEBuild {
// build.cpp functions used mostly by script.cpp
int getcurdbsize();
int add_section(const char *secname, const char *file, int line, const char *defname, int expand);
int add_section(const char *secname, const char *file, int line, const char *defname, int expand=0);
int section_end();
int add_function(const char *funname);
int function_end();
@ -119,6 +119,7 @@ class CEXEBuild {
int add_entry_direct(int which, int o0=0, int o1=0, int o2=0, int o3=0, int o4=0, int o5=0);
int add_data(const char *data, int length, IGrowBuf *dblock=NULL); // returns offset
int add_string(const char *string); // returns offset (in string table)
int add_intstring(const int i); // returns offset in stringblock
int add_string_main(const char *string, int process=1); // returns offset (in string table)
int add_string_uninst(const char *string, int process=1); // returns offset (in string table)
int preprocess_string(char *out, const char *in);
@ -166,7 +167,6 @@ class CEXEBuild {
// a whole bunch O data.
// Added by Amir Szekely 31st July 2002
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
ICompressor *compressor;
CZlib zlib_compressor;
@ -175,7 +175,8 @@ class CEXEBuild {
bool build_compressor_set;
bool build_compress_whole;
// Added by Amir Szekely 2nd August 2002
bool use_first_insttype;
vector<NLF*> build_nlfs;
vector<StringTable*> string_tables;
LANGID last_used_lang;

View file

@ -362,7 +362,7 @@ end:
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
// Clean up after plug-ins
if (plugins_temp_dir[0]) doRMDir(plugins_temp_dir,1);
if (state_plugins_dir[0]) doRMDir(state_plugins_dir,1);
#endif // NSIS_CONFIG_PLUGIN_SUPPORT
if (g_hIcon) DeleteObject(g_hIcon);

View file

@ -47,7 +47,7 @@ int dlg_offset;
int g_quit_flag; // set when Quit has been called (meaning bail out ASAP)
#if NSIS_MAX_INST_TYPES >= 31 || NSIS_MAX_INST_TYPES < 1
#if NSIS_MAX_INST_TYPES > 32 || NSIS_MAX_INST_TYPES < 1
#error invalid value for NSIS_MAX_INST_TYPES
#endif
@ -60,25 +60,6 @@ static char g_tmp[4096];
int num_sections;
// sent to the last child window to tell it that the install thread is done
#define WM_NOTIFY_INSTPROC_DONE (WM_USER+0x4)
// sent to every child window to tell it it can start executing NSIS code
#define WM_NOTIFY_START (WM_USER+0x5)
// sent to the outer window to tell it to go to the next inner window
#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
// sent to every child window to tell it it is closing soon
#define WM_NOTIFY_INIGO_MONTOYA (WM_USER+0xb)
// update message used by DirProc and SelProc for space display
#define WM_IN_UPDATEMSG (WM_USER+0xf)
#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
#define WM_TREEVIEW_KEYHACK (WM_USER+0x13)
static int m_page=-1,m_retcode,m_delta=1;
#define NOTIFY_BYE_BYE 'x'
@ -112,7 +93,6 @@ section *g_inst_section;
entry *g_inst_entry;
static HWND m_curwnd, m_bgwnd, m_hwndOK, m_hwndCancel;
static int m_whichcfg;
static BOOL NSISCALL SetDlgItemTextFromLang_(HWND dlg, int id, int lid) {
return my_SetDialogItemText(dlg,id+1000,LANG_STR(lid));
@ -967,10 +947,10 @@ static DWORD WINAPI newTreeWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
lParam = tvItem.lParam;
}
uMsg = WM_USER+0x19;
uMsg = WM_NOTIFY_SELCHANGE;
}
}
if (uMsg == WM_USER+0x19) {
if (uMsg == WM_NOTIFY_SELCHANGE) {
if (last_item != lParam)
{
last_item = lParam;
@ -988,8 +968,6 @@ static DWORD WINAPI newTreeWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
return CallWindowProc((WNDPROC)oldTreeWndProc,hwnd,uMsg,wParam,lParam);
}
int m_num_insttypes;
static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static HTREEITEM *hTreeItems;
@ -1002,7 +980,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
int doLines=0;
HTREEITEM Par;
HBITMAP hBMcheck1;
int x, lastGoodX;
int x, lastGoodX, i, doCombo=0;
g_SectionHack=hwndDlg;
@ -1011,8 +989,6 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
hBMcheck1=LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BITMAP1));
SetUITextFromLang(IDC_INTROTEXT,LANG_COMP_TEXT);
SetUITextFromLang(IDC_TEXT1,LANG_COMP_SUBTEXT(0));
SetUITextFromLang(IDC_TEXT2,LANG_COMP_SUBTEXT(1));
oldTreeWndProc=SetWindowLong(hwndTree1,GWL_WNDPROC,(DWORD)newTreeWndProc);
@ -1025,20 +1001,33 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
DeleteObject(hBMcheck1);
if (!g_inst_header->install_types_ptr[0])
for (i = 0; i < NSIS_MAX_INST_TYPES; i++)
{
ShowWindow(hwndCombo1,SW_HIDE);
if (g_inst_header->install_types[i])
{
int j;
doCombo++;
process_string_fromtab(g_tmp,g_inst_header->install_types[i]);
j=SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)ps_tmpbuf);
SendMessage(hwndCombo1,CB_SETITEMDATA,j,i);
}
}
if (!(inst_flags&CH_FLAGS_NO_CUSTOM))
{
int j=SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)LANG_STR(LANG_COMP_CUSTOM));
SendMessage(hwndCombo1,CB_SETITEMDATA,j,NSIS_MAX_INST_TYPES);
}
if (doCombo)
{
ShowWindow(hwndCombo1,SW_SHOW);
SetUITextFromLang(IDC_TEXT1,LANG_COMP_SUBTEXT(0));
SetUITextFromLang(IDC_TEXT2,LANG_COMP_SUBTEXT(1));
}
else
{
for (m_num_insttypes = 0; m_num_insttypes < NSIS_MAX_INST_TYPES &&
g_inst_header->install_types_ptr[m_num_insttypes]; m_num_insttypes ++)
{
SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)GetStringFromStringTab(g_inst_header->install_types_ptr[m_num_insttypes]));
}
if (!(inst_flags&CH_FLAGS_NO_CUSTOM))
SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)LANG_STR(LANG_COMP_CUSTOM));
SendMessage(hwndCombo1,CB_SETCURSEL,m_whichcfg,0);
SetUITextFromLang(IDC_TEXT1,LANG_COMP_SUBTEXT(2));
SetUITextFromLang(IDC_TEXT2,LANG_COMP_SUBTEXT(3));
}
Par=NULL;
@ -1047,14 +1036,6 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
{
section *sec=g_inst_section+x;
if (m_num_insttypes && m_whichcfg != m_num_insttypes)
{
if ((sec->install_types>>m_whichcfg) & 1)
sec->flags|=SF_SELECTED;
else
sec->flags&=~SF_SELECTED;
}
if (sec->name_ptr)
{
TVINSERTSTRUCT tv;
@ -1107,9 +1088,9 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
SendMessage(hwndTree1,WM_VSCROLL,SB_TOP,0);
uMsg=WM_IN_UPDATEMSG;
uMsg = g_flags.insttype_changed ? WM_NOTIFY_INSTTYPE_CHANGE : WM_IN_UPDATEMSG;
}
if (uMsg == WM_USER+0x17) // update text
if (uMsg == WM_NOTIFY_SECTEXT) // update text
{
int x=wParam;
int ns=lParam;
@ -1123,7 +1104,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
TreeView_SetItem(hwndTree1,&tv);
}
}
if (uMsg == WM_USER+0x18) // change flags
if (uMsg == WM_NOTIFY_SECFLAGS) // change flags
{
int flags = g_inst_section[wParam].flags;
TVITEM tvItem;
@ -1179,6 +1160,10 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
lParam = 0;
uMsg = WM_IN_UPDATEMSG;
#if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_COMPONENTPAGE)
ExecuteCodeSegment(g_inst_header->code_onSelChange,NULL);
#endif//NSIS_SUPPORT_CODECALLBACKS && NSIS_CONFIG_COMPONENTPAGE
} // not ro
} // was valid click
} // was click or hack
@ -1186,7 +1171,7 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
if (lpnmh)
{
if (lpnmh->code == TVN_SELCHANGED)
SendMessage(hwndTree1, WM_USER+0x19, 0, ((LPNMTREEVIEW)lpnmh)->itemNew.lParam);
SendMessage(hwndTree1, WM_NOTIFY_SELCHANGE, 0, ((LPNMTREEVIEW)lpnmh)->itemNew.lParam);
if (lpnmh->code == TVN_ITEMEXPANDED)
{
LPNMTREEVIEW pnmtv = (LPNMTREEVIEW) lpnmh;
@ -1203,50 +1188,59 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
{
SendMessage(hwndTree1, WM_MOUSEMOVE, 0, 0);
}
if (uMsg == WM_COMMAND)
if (uMsg == WM_NOTIFY_INSTTYPE_CHANGE ||
(uMsg == WM_COMMAND && LOWORD(wParam)==IDC_COMBO1 && HIWORD(wParam)==CBN_SELCHANGE))
{
int id=LOWORD(wParam),code=HIWORD(wParam);
if (id == IDC_COMBO1 && code==CBN_SELCHANGE)
int t=SendMessage(hwndCombo1,CB_GETCURSEL,0,0);
if (uMsg == WM_NOTIFY_INSTTYPE_CHANGE || t != CB_ERR)
{
int t=SendMessage(hwndCombo1,CB_GETCURSEL,0,0);
if (t != CB_ERR)
int whichcfg=SendMessage(hwndCombo1,CB_GETITEMDATA,t,0);
if (uMsg == WM_NOTIFY_INSTTYPE_CHANGE)
{
m_whichcfg=t;
if (m_whichcfg != m_num_insttypes) // not custom
{
int x=num_sections;
section *t=g_inst_section;
HTREEITEM *ht=hTreeItems;
while (x--)
{
TVITEM tv;
int l=1;
if (t->install_types & (1<<m_whichcfg))
{
l++;
t->flags|=SF_SELECTED;
}
else t->flags&=~SF_SELECTED;
if (t->flags&SF_RO) l+=3;
if (tv.hItem=*ht) {
tv.mask=TVIF_STATE;
tv.state=INDEXTOSTATEIMAGEMASK(l);
tv.stateMask=TVIS_STATEIMAGEMASK;
TreeView_SetItem(hwndTree1,&tv);
SetParentState(hwndTree1,tv.hItem);
}
t++;
ht++;
}
SendMessage(hwndTree1,WM_VSCROLL,SB_TOP,0);
}
lParam = 1;
uMsg = WM_IN_UPDATEMSG;
whichcfg = g_flags.cur_insttype;
g_flags.insttype_changed = 0;
}
else lParam = 1;
if (whichcfg == CB_ERR || !(g_inst_header->install_types[whichcfg]))
whichcfg = NSIS_MAX_INST_TYPES;
if (whichcfg != NSIS_MAX_INST_TYPES) // not custom
{
int x=num_sections;
section *t=g_inst_section;
HTREEITEM *ht=hTreeItems;
while (x--)
{
TVITEM tv;
int l=1;
if (t->install_types & (1<<whichcfg))
{
l++;
t->flags|=SF_SELECTED;
}
else t->flags&=~SF_SELECTED;
if (t->flags&SF_RO) l+=3;
if (tv.hItem=*ht) {
tv.mask=TVIF_STATE;
tv.state=INDEXTOSTATEIMAGEMASK(l);
tv.stateMask=TVIS_STATEIMAGEMASK;
TreeView_SetItem(hwndTree1,&tv);
SetParentState(hwndTree1,tv.hItem);
}
t++;
ht++;
}
SendMessage(hwndTree1,WM_VSCROLL,SB_TOP,0);
}
g_flags.cur_insttype=whichcfg;
uMsg = WM_IN_UPDATEMSG;
}
}
if (uMsg == WM_NOTIFY_INIGO_MONTOYA)
@ -1258,24 +1252,24 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
if (uMsg == WM_IN_UPDATEMSG)
{
#if defined(NSIS_SUPPORT_CODECALLBACKS) && defined(NSIS_CONFIG_COMPONENTPAGE)
ExecuteCodeSegment(g_inst_header->code_onSelChange,NULL);
#endif//NSIS_SUPPORT_CODECALLBACKS && NSIS_CONFIG_COMPONENTPAGE
if (inst_flags&CH_FLAGS_COMP_ONLY_ON_CUSTOM)
{
int c=(m_whichcfg == m_num_insttypes && m_num_insttypes)<<3;// SW_SHOWNA=8, SW_HIDE=0
int c=(g_flags.cur_insttype == NSIS_MAX_INST_TYPES)<<3;// SW_SHOWNA=8, SW_HIDE=0
ShowWindow(hwndTree1,c);
ShowWindow(GetUIItem(IDC_TEXT2),c);
}
else if (!lParam)
{
int r,x;
int r,x,cbi;
// check to see which install type we are
for (r = 0; r < m_num_insttypes; r ++)
for (r = 0, cbi = 0; r < NSIS_MAX_INST_TYPES; r ++)
{
HTREEITEM *ht=hTreeItems;
section *t=g_inst_section;
x=num_sections;
if (!g_inst_header->install_types[r]) continue;
while (x--)
{
if (*ht && !(t->flags&(SF_SUBSEC|SF_SUBSECEND)))
@ -1290,10 +1284,12 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
ht++;
}
if (x < 0) break;
cbi++;
}
m_whichcfg=r;
SendMessage(hwndCombo1,CB_SETCURSEL,m_whichcfg,0);
g_flags.cur_insttype=r;
SendMessage(hwndCombo1,CB_SETCURSEL,cbi,0);
} // end of typecheckshit
if (LANG_STR_TAB(LANG_SPACE_REQ)) {
@ -1476,7 +1472,7 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
DWORD pos = GetMessagePos();
HMENU menu = CreatePopupMenu();
AppendMenu(menu,MF_STRING,1,LANG_STR(LANG_COPYDETAILS));
if (1==TrackPopupMenu(
if (1==TrackPopupMenu(
menu,
TPM_NONOTIFY|TPM_RETURNCMD,
GET_X_LPARAM(pos),

View file

@ -28,8 +28,8 @@
// NSIS_MAX_INST_TYPES specified the maximum install types.
// note that this should not exceed 30, ever.
#define NSIS_MAX_INST_TYPES 8
// note that this should not exceed 32, ever.
#define NSIS_MAX_INST_TYPES 32
// NSIS_CONFIG_UNINSTALL_SUPPORT enables the uninstaller
// support. Comment it out if your installers don't need
@ -329,8 +329,8 @@
#endif
#endif
#if NSIS_MAX_INST_TYPES > 30
#error NSIS_MAX_INST_TYPES > 30
#if NSIS_MAX_INST_TYPES > 32
#error NSIS_MAX_INST_TYPES > 32
#endif
#endif//!APSTUDIO_INVOKED

View file

@ -26,10 +26,6 @@ static stack_t *g_st;
union installer_flags g_flags;
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
char plugins_temp_dir[NSIS_MAX_STRLEN]="";
#endif
static WIN32_FIND_DATA * NSISCALL file_exists(char *buf)
{
HANDLE h;
@ -73,11 +69,7 @@ static LONG NSISCALL myRegDeleteKeyEx(HKEY thiskey, LPCTSTR lpSubKey, int onlyif
static int NSISCALL ExecuteEntry(entry *entry_);
static int NSISCALL resolveaddr(int v)
{
if (v<0) return myatoi(g_usrvars[-(v+1)]); // if <0, that means we
return v;
}
#define resolveaddr(v) ((v<0) ? myatoi(g_usrvars[-(v+1)]) : v)
int NSISCALL ExecuteCodeSegment(int pos, HWND hwndProgress)
{
@ -156,6 +148,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
// Saves 8 bytes
// HWND mainHwnd = g_hwnd;
// #define g_hwnd mainHwnd
HWND hwSectionHack = g_SectionHack;
parms = entry_->offsets;
@ -209,7 +203,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
SetForegroundWindow(g_hwnd);
break;
case EW_SETFLAG:
g_flags.flags[parm0]=parm1;
g_flags.flags[parm0]=process_string_fromparm_toint(1);
break;
case EW_IFFLAG:
{
@ -217,6 +211,9 @@ static int NSISCALL ExecuteEntry(entry *entry_)
g_flags.flags[parm2]&=parm3;
return f;
}
case EW_GETFLAG:
myitoa(var0,g_flags.flags[parm1]);
break;
case EW_CHDETAILSVIEW:
if (insthwndbutton) ShowWindow(insthwndbutton,parm1);
if (insthwnd) ShowWindow(insthwnd,parm0);
@ -980,7 +977,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
break;
#endif
#ifdef NSIS_SUPPORT_CREATESHORTCUT
case EW_CREATESHORTCUT: {
case EW_CREATESHORTCUT:
{
char *buf2=process_string_fromparm_tobuf(-0x20);
char *buf1=process_string_fromparm_tobuf(0x11);
char *buf0=process_string_fromparm_tobuf(0x02);
@ -1494,13 +1492,6 @@ static int NSISCALL ExecuteEntry(entry *entry_)
}
break;
#endif//NSIS_CONFIG_LOG
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
// Added by Ximon Eighteen 5th August 2002
case EW_PLUGINCOMMANDPREP:
// $0 temp plug-ins dir
if (!*plugins_temp_dir) mystrcpy(plugins_temp_dir,g_usrvars[0]);
break;
#endif // NSIS_CONFIG_PLUGIN_SUPPORT
#ifdef NSIS_CONFIG_COMPONENTPAGE
case EW_SECTIONSET:
{
@ -1533,19 +1524,42 @@ static int NSISCALL ExecuteEntry(entry *entry_)
else
{
// setting text, send the message to do it
SendMessage(g_SectionHack,WM_USER+0x17,x,parm2);
SendMessage(hwSectionHack,WM_NOTIFY_SECTEXT,x,parm2);
}
((int*)sec)[parm1]=parm2;
if (parm1)
{
// update tree view
SendMessage(g_SectionHack,WM_USER+0x18,x,0);
SendMessage(hwSectionHack,WM_NOTIFY_SECFLAGS,x,0);
}
}
}
else g_flags.exec_error++;
}
break;
case EW_INSTTYPESET:
{
int x=process_string_fromparm_toint(0);
if (parm3)
{
g_flags.insttype_changed++;
SendMessage(hwSectionHack,WM_NOTIFY_INSTTYPE_CHANGE,0,0);
}
else if ((unsigned int)x < (unsigned int)NSIS_MAX_INST_TYPES)
{
if (parm2) // set text
{
g_inst_header->install_types[x] = parm1;
}
else // get text
{
process_string_fromtab(var1,g_inst_header->install_types[x]);
}
}
else g_flags.exec_error++;
}
break;
#endif//NSIS_CONFIG_COMPONENTPAGE
}
return 0;

View file

@ -30,8 +30,8 @@
enum
{
EW_INVALID_OPCODE, // zero is invalid. useful for catching errors. (otherwise an all zeroes instruction does nothing, which is
// easily ignored but means something is wrong.
EW_INVALID_OPCODE, // zero is invalid. useful for catching errors. (otherwise an all zeroes instruction
// does nothing, which is easily ignored but means something is wrong.
EW_RET, // return from function call
EW_NOP, // Nop/Jump, do nothing: 1, [?new address+1:advance one]
EW_ABORT, // Abort: 1 [status]
@ -39,7 +39,6 @@ enum
EW_CALL, // Call: 1 [new address+1]
EW_UPDATETEXT, // Update status text: 2 [update str, ui_st_updateflag=?ui_st_updateflag:this]
EW_SLEEP, // Sleep: 1 [sleep time in milliseconds]
EW_HIDEWINDOW, // HideWindow: 0
EW_BRINGTOFRONT, // BringToFront: 0
EW_CHDETAILSVIEW, // SetDetailsView: 2 [listaction,buttonaction]
EW_SETFILEATTRIBUTES, // SetFileAttributes: 2 [filename, attributes]
@ -47,6 +46,7 @@ enum
EW_IFFILEEXISTS, // IfFileExists: 3, [file name, jump amount if exists, jump amount if not exists]
EW_SETFLAG, // Sets a flag: 2 [id, data]
EW_IFFLAG, // If a flag: 4 [on, off, id, new value mask]
EW_GETFLAG, // Gets a flag: 2 [output, id]
#ifdef NSIS_SUPPORT_RENAME
EW_RENAME, // Rename: 3 [old, new, rebootok]
#endif
@ -129,7 +129,6 @@ enum
#ifdef NSIS_SUPPORT_REBOOT
EW_REBOOT, // Reboot: 0
EW_IFREBOOTFLAG, // IfRebootFlag: 2 [if reboot flag set, if not reboot flag]
#endif
#ifdef NSIS_SUPPORT_INIFILES
@ -172,21 +171,13 @@ enum
// SectionGetText: 3: [idx, 1, output]
// SectionSetFlags: 3: [idx, 2, flags]
// SectionGetFlags: 3: [idx, 3, output]
EW_INSTTYPESET, // InstTypeSetFlags: 3: [idx, 0, flags]
// InstTypeGetFlags: 3: [idx, 1, output]
#endif
// instructions not actually implemented in exehead, but used in compiler.
EW_GETLABELADDR, // both of these get converted to EW_ASSIGNVAR
EW_GETFUNCTIONADDR,
// Saves 56 bytes, don't ask me how
// Hmm... now it doesn't =/
/*EW_DUMMY,
EW_DUMMY2,
EW_DUMMY3,
EW_DUMMY4,
EW_DUMMY5,*/
EW_PLUGINCOMMANDPREP,
};
#define FH_FLAGS_MASK 15
@ -371,7 +362,7 @@ typedef struct
int dirsubtext; // directory text2
#ifdef NSIS_CONFIG_COMPONENTPAGE
int componenttext; // component page text
int componentsubtext[2];
int componentsubtext[4];
#endif
#ifdef NSIS_CONFIG_LICENSEPAGE
int licensetext; // license page text
@ -394,7 +385,7 @@ typedef struct
int install_reg_rootkey, install_reg_key_ptr, install_reg_value_ptr;
#ifdef NSIS_CONFIG_COMPONENTPAGE
int install_types_ptr[NSIS_MAX_INST_TYPES]; // -1 if not used. can describe as lite, normal, full, etc.
int install_types[NSIS_MAX_INST_TYPES];
#endif
#ifdef NSIS_CONFIG_LICENSEPAGE
@ -535,6 +526,8 @@ union installer_flags {
#ifdef NSIS_SUPPORT_REBOOT
int exec_reboot;
#endif
int cur_insttype;
int insttype_changed;
};
int flags[1];
};

View file

@ -74,7 +74,7 @@ STYLE DS_CONTROL | DS_SHELLFONT | WS_CHILD
FONT 8, "MS Shell Dlg"
BEGIN
COMBOBOX IDC_COMBO1,114,25,152,102,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
WS_TABSTOP | NOT WS_VISIBLE
ICON IDI_ICON2,IDC_ULICON,0,0,21,20
LTEXT "",IDC_TEXT2,0,40,108,65
CONTROL "",IDC_TEXT1,"Static",SS_LEFTNOWORDWRAP,0,27,108,8

View file

@ -1,14 +1,14 @@
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
extern char plugins_temp_dir[NSIS_MAX_STRLEN];
#endif
extern char temp_directory[NSIS_MAX_STRLEN];
extern char g_usrvars[25][NSIS_MAX_STRLEN];
extern char g_usrvars[26][NSIS_MAX_STRLEN];
extern char *state_command_line;
extern char *state_install_directory;
extern char *state_output_directory;
extern char *state_exe_directory;
extern char *state_language;
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
extern char *state_plugins_dir;
#endif
extern char g_caption[NSIS_MAX_STRLEN*2];
extern HWND g_hwnd;

View file

@ -29,4 +29,37 @@ extern int g_is_uninstaller;
void NSISCALL build_g_logfile(void);
#endif
// sent to the last child window to tell it that the install thread is done
#define WM_NOTIFY_INSTPROC_DONE (WM_USER+0x4)
// sent to every child window to tell it it can start executing NSIS code
#define WM_NOTIFY_START (WM_USER+0x5)
// sent to the outer window to tell it to go to the next inner window
#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
// sent to every child window to tell it it is closing soon
#define WM_NOTIFY_INIGO_MONTOYA (WM_USER+0xb)
// update message used by DirProc and SelProc for space display
#define WM_IN_UPDATEMSG (WM_USER+0xf)
// the selected insttype has changed
#define WM_NOTIFY_INSTTYPE_CHANGE (WM_USER+0x32)
// custom pages should send this message to let NSIS know they're ready
#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd)
// simulates clicking on the tree
#define WM_TREEVIEW_KEYHACK (WM_USER+0x13)
// section text changed
#define WM_NOTIFY_SECTEXT WM_USER+0x17
// section flags changed
#define WM_NOTIFY_SECFLAGS WM_USER+0x18
// notifies a component selection change (.onMouseOverSection)
#define WM_NOTIFY_SELCHANGE WM_USER+0x19
#endif//_UI_H_

View file

@ -16,12 +16,15 @@ char g_log_file[1024];
char temp_directory[NSIS_MAX_STRLEN];
char g_usrvars[25][NSIS_MAX_STRLEN];
char g_usrvars[26][NSIS_MAX_STRLEN];
char *state_command_line=g_usrvars[20];
char *state_install_directory=g_usrvars[21];
char *state_output_directory=g_usrvars[22];
char *state_exe_directory=g_usrvars[23];
char *state_language=g_usrvars[24];
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
char *state_plugins_dir=g_usrvars[25];
#endif
HANDLE g_hInstance;
@ -433,21 +436,22 @@ char * NSISCALL process_string(const char *in)
case VAR_CODES_START + 23: // OUTDIR
case VAR_CODES_START + 24: // EXEDIR
case VAR_CODES_START + 25: // LANGUAGE
case VAR_CODES_START + 26: // PLUGINSDIR
mystrcpy(out, g_usrvars[nVarIdx - (VAR_CODES_START + 1)]);
break;
case VAR_CODES_START + 26: // PROGRAMFILES
case VAR_CODES_START + 27: // PROGRAMFILES
smwcvesf[41]=0;
myRegGetStr(HKEY_LOCAL_MACHINE, smwcvesf, "ProgramFilesDir", out);
if (!*out)
mystrcpy(out, "C:\\Program Files");
break;
case VAR_CODES_START + 27: // SMPROGRAMS
case VAR_CODES_START + 28: // SMSTARTUP
case VAR_CODES_START + 29: // DESKTOP
case VAR_CODES_START + 30: // STARTMENU
case VAR_CODES_START + 31: // QUICKLAUNCH
case VAR_CODES_START + 28: // SMPROGRAMS
case VAR_CODES_START + 29: // SMSTARTUP
case VAR_CODES_START + 30: // DESKTOP
case VAR_CODES_START + 31: // STARTMENU
case VAR_CODES_START + 32: // QUICKLAUNCH
{
static const char *tab[]={
"Programs",
@ -485,31 +489,21 @@ char * NSISCALL process_string(const char *in)
else break;
}
case VAR_CODES_START + 32: // TEMP
case VAR_CODES_START + 33: // TEMP
mystrcpy(out,temp_directory);
break;
case VAR_CODES_START + 33: // WINDIR
case VAR_CODES_START + 34: // WINDIR
GetWindowsDirectory(out, NSIS_MAX_STRLEN);
break;
case VAR_CODES_START + 34: // SYSDIR
case VAR_CODES_START + 35: // SYSDIR
GetSystemDirectory(out, NSIS_MAX_STRLEN);
break;
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
case VAR_CODES_START + 35: // PLUGINSDIR
mystrcpy(out, plugins_temp_dir);
break;
#if VAR_CODES_START + 35 >= 255
#error "Too many variables! Extend VAR_CODES_START!"
#endif
#else
#if VAR_CODES_START + 34 >= 255
#error "Too many variables! Extend VAR_CODES_START!"
#endif
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
} // switch
// validate the directory name
if (nVarIdx > 21+VAR_CODES_START) { // only if not $0 to $R9, $CMDLINE, or $HWNDPARENT
@ -521,7 +515,6 @@ char * NSISCALL process_string(const char *in)
} // while
*out = 0;
return ps_tmpbuf;
;
}
char * NSISCALL validate_filename(char *in) {

View file

@ -416,18 +416,22 @@ void CEXEBuild::FillStringTable(StringTable *table, NLF *nlf/*=0*/) {
if (!table->common.subcaptions[1])
table->common.subcaptions[1]=add_string_main(str(NLF_SUBCAPTION_OPTIONS));
if (!build_header.install_types_ptr[0])
if (!table->installer.componentsubtext[2])
{
if (!table->installer.componentsubtext[1])
table->installer.componentsubtext[1]=add_string_main(str(NLF_COMP_SUBTEXT1_NO_INST_TYPES),0);
if (table->installer.componentsubtext[0])
table->installer.componentsubtext[2]=table->installer.componentsubtext[0];
}
else
if (!table->installer.componentsubtext[3])
{
if (!table->installer.componentsubtext[0])
table->installer.componentsubtext[0]=add_string_main(str(NLF_COMP_SUBTEXT1),0);
if (!(build_header.common.flags&CH_FLAGS_NO_CUSTOM) && !table->installer.componentsubtext[1])
table->installer.componentsubtext[1]=add_string_main(str(NLF_COMP_SUBTEXT2),0);
if (table->installer.componentsubtext[1])
table->installer.componentsubtext[3]=table->installer.componentsubtext[1];
else
table->installer.componentsubtext[3]=add_string_main(str(NLF_COMP_SUBTEXT1_NO_INST_TYPES),0);
}
if (!table->installer.componentsubtext[0])
table->installer.componentsubtext[0]=add_string_main(str(NLF_COMP_SUBTEXT1),0);
if (!(build_header.common.flags&CH_FLAGS_NO_CUSTOM) && !table->installer.componentsubtext[1])
table->installer.componentsubtext[1]=add_string_main(str(NLF_COMP_SUBTEXT2),0);
}
else table->installer.componenttext=0;
}

View file

@ -1012,7 +1012,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
else if (line.gettoken_str(1)[0]=='/') PRINTHELP()
else
{
for (x = 0; x < NSIS_MAX_INST_TYPES && build_header.install_types_ptr[x]; x ++);
for (x = 0; x < NSIS_MAX_INST_TYPES && build_header.install_types[x]; x ++);
if (x==NSIS_MAX_INST_TYPES)
{
ERROR_MSG("InstType: no more than %d install types allowed. %d specified\n",NSIS_MAX_INST_TYPES,NSIS_MAX_INST_TYPES+1);
@ -1020,7 +1020,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
}
else
{
build_header.install_types_ptr[x] = add_string_main(line.gettoken_str(1),0);
build_header.install_types[x] = add_string_main(line.gettoken_str(1));
SCRIPT_MSG("InstType: %d=\"%s\"\n",x+1,line.gettoken_str(1));
}
}
@ -2182,10 +2182,10 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
case TOK_SECTION:
{
int a=1,ex = 0;
if (!strcmpi(line.gettoken_str(1),"/e"))
int a=1,unselected = 0;
if (!strcmpi(line.gettoken_str(1),"/o"))
{
ex = 1;
unselected = 1;
a++;
}
SCRIPT_MSG("Section: \"%s\"",line.gettoken_str(a));
@ -2199,8 +2199,19 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
}
#endif
if (line.gettoken_str(a)[0]=='-') return add_section("",curfilename,linecnt,line.gettoken_str(a+1),ex);
return add_section(line.gettoken_str(a),curfilename,linecnt,line.gettoken_str(a+1),ex);
int ret;
if (line.gettoken_str(a)[0]=='-') ret=add_section("",curfilename,linecnt,line.gettoken_str(a+1));
ret=add_section(line.gettoken_str(a),curfilename,linecnt,line.gettoken_str(a+1));
if (ret != PS_OK) return ret;
if (unselected)
{
use_first_insttype = false;
build_cursection->flags &= ~SF_SELECTED;
}
return PS_OK;
}
case TOK_SECTIONEND:
SCRIPT_MSG("SectionEnd\n");
@ -2502,11 +2513,14 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
SCRIPT_MSG("Goto: %s\n",line.gettoken_str(1));
return add_entry(&ent);
case TOK_SETSHELLVARCONTEXT:
{
ent.which=EW_SETFLAG;
ent.offsets[0]=FLAG_OFFSET(all_user_var);
ent.offsets[1]=line.gettoken_enum(1,"current\0all\0");
if (ent.offsets[1]<0) PRINTHELP()
int k=line.gettoken_enum(1,"current\0all\0");
if (k<0) PRINTHELP()
ent.offsets[1]=add_intstring(k);
SCRIPT_MSG("SetShellVarContext: %s\n",line.gettoken_str(1));
}
return add_entry(&ent);
case TOK_RET:
SCRIPT_MSG("Return\n");
@ -3282,11 +3296,14 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
SCRIPT_MSG("SetDetailsPrint: %s\n",line.gettoken_str(1));
return add_entry(&ent);
case TOK_SETAUTOCLOSE:
{
ent.which=EW_SETFLAG;
ent.offsets[0]=FLAG_OFFSET(autoclose);
ent.offsets[1]=line.gettoken_enum(1,"false\0true\0");
if (ent.offsets[1] < 0) PRINTHELP()
int k=line.gettoken_enum(1,"false\0true\0");
if (k < 0) PRINTHELP()
ent.offsets[1]=add_intstring(k);
SCRIPT_MSG("SetAutoClose: %s\n",line.gettoken_str(1));
}
return add_entry(&ent);
case TOK_IFERRORS:
ent.which=EW_IFFLAG;
@ -3307,13 +3324,13 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
case TOK_CLEARERRORS:
ent.which=EW_SETFLAG;
ent.offsets[0]=FLAG_OFFSET(exec_error);
ent.offsets[1]=0;
ent.offsets[1]=add_intstring(0);
SCRIPT_MSG("ClearErrors\n");
return add_entry(&ent);
case TOK_SETERRORS:
ent.which=EW_SETFLAG;
ent.offsets[0]=FLAG_OFFSET(exec_error);
ent.offsets[1]=1;
ent.offsets[1]=add_intstring(1);
SCRIPT_MSG("SetErrors\n");
return add_entry(&ent);
#ifdef NSIS_SUPPORT_STROPTS
@ -4050,10 +4067,13 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
SCRIPT_MSG("IfRebootFlag ?%s:%s\n",line.gettoken_str(1),line.gettoken_str(2));
return add_entry(&ent);
case TOK_SETREBOOTFLAG:
{
ent.which=EW_SETFLAG;
ent.offsets[0]=FLAG_OFFSET(exec_reboot);
ent.offsets[1]=line.gettoken_enum(1,"false\0true\0");
if (ent.offsets[1] < 0) PRINTHELP()
int k=line.gettoken_enum(1,"false\0true\0");
if (k < 0) PRINTHELP()
ent.offsets[1]=add_intstring(k);
}
return add_entry(&ent);
#else//!NSIS_SUPPORT_REBOOT
case TOK_REBOOT:
@ -4095,7 +4115,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
ent.offsets[0]=add_string(line.gettoken_str(1));
ent.offsets[1]=SECTION_FIELD_SET(name_ptr);
ent.offsets[2]=add_string(line.gettoken_str(2));
SCRIPT_MSG("SectionSetText: %s=%s\n",line.gettoken_str(1),line.gettoken_str(2));
SCRIPT_MSG("SectionSetText: %s->%s\n",line.gettoken_str(1),line.gettoken_str(2));
return add_entry(&ent);
case TOK_SECTIONGETTEXT:
if (uninstall_mode)
@ -4135,6 +4155,31 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
if (line.gettoken_str(2)[0] && ent.offsets[2]<0) PRINTHELP()
SCRIPT_MSG("SectionGetFlags: %s->%s\n",line.gettoken_str(1),line.gettoken_str(2));
return add_entry(&ent);
case TOK_INSTTYPESETTEXT:
if (uninstall_mode)
{
ERROR_MSG("Error: %s called in uninstall section.\n", line.gettoken_str(0));
return PS_ERROR;
}
ent.which=EW_INSTTYPESET;
ent.offsets[0]=add_string(line.gettoken_str(1));
ent.offsets[1]=add_string(line.gettoken_str(2));
ent.offsets[2]=1;
SCRIPT_MSG("InstTypeSetText: %s->%s\n",line.gettoken_str(1),line.gettoken_str(2));
return add_entry(&ent);
case TOK_INSTTYPEGETTEXT:
if (uninstall_mode)
{
ERROR_MSG("Error: %s called in uninstall section.\n", line.gettoken_str(0));
return PS_ERROR;
}
ent.which=EW_INSTTYPESET;
ent.offsets[0]=add_string(line.gettoken_str(1));
ent.offsets[1]=line.gettoken_enum(2,usrvars);
ent.offsets[2]=0;
if (line.gettoken_str(1)[0] && ent.offsets[1]<0) PRINTHELP()
SCRIPT_MSG("InstTypeGetText: %s->%s\n",line.gettoken_str(1),line.gettoken_str(2));
return add_entry(&ent);
case TOK_SECTIONSETINSTTYPES:
if (uninstall_mode)
{
@ -4160,13 +4205,69 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
if (line.gettoken_str(2)[0] && ent.offsets[2]<0) PRINTHELP()
SCRIPT_MSG("SectionGetInstTypes: %s->%s\n",line.gettoken_str(1),line.gettoken_str(2));
return add_entry(&ent);
case TOK_SECTIONSETSIZE:
if (uninstall_mode)
{
ERROR_MSG("Error: %s called in uninstall section.\n", line.gettoken_str(0));
return PS_ERROR;
}
ent.which=EW_SECTIONSET;
ent.offsets[0]=add_string(line.gettoken_str(1));
ent.offsets[1]=SECTION_FIELD_SET(size_kb);
ent.offsets[2]=add_string(line.gettoken_str(2));
SCRIPT_MSG("SectionSetSize: %s->%s\n",line.gettoken_str(1),line.gettoken_str(2));
return add_entry(&ent);
case TOK_SECTIONGETSIZE:
if (uninstall_mode)
{
ERROR_MSG("Error: %s called in uninstall section.\n", line.gettoken_str(0));
return PS_ERROR;
}
ent.which=EW_SECTIONSET;
ent.offsets[0]=add_string(line.gettoken_str(1));
ent.offsets[1]=SECTION_FIELD_GET(size_kb);
ent.offsets[2]=line.gettoken_enum(2,usrvars);
if (line.gettoken_str(2)[0] && ent.offsets[2]<0) PRINTHELP()
SCRIPT_MSG("SectionGetSize: %s->%s\n",line.gettoken_str(1),line.gettoken_str(2));
return add_entry(&ent);
case TOK_SETCURINSTTYPE:
{
int ret;
if (uninstall_mode)
{
ERROR_MSG("Error: %s called in uninstall section.\n", line.gettoken_str(0));
return PS_ERROR;
}
SCRIPT_MSG("SetCurInstType: %s\n",line.gettoken_str(1));
ret = add_entry_direct(EW_SETFLAG, FLAG_OFFSET(cur_insttype), add_string(line.gettoken_str(1)));
if (ret != PS_OK) return ret;
ret = add_entry_direct(EW_INSTTYPESET, 0, 0, 0, 1);
if (ret != PS_OK) return ret;
}
return PS_OK;
case TOK_GETCURINSTTYPE:
if (uninstall_mode)
{
ERROR_MSG("Error: %s called in uninstall section.\n", line.gettoken_str(0));
return PS_ERROR;
}
ent.which=EW_GETFLAG;
ent.offsets[0]=line.gettoken_enum(1,usrvars);
ent.offsets[1]=FLAG_OFFSET(cur_insttype);
if (line.gettoken_str(1)[0] && ent.offsets[0]<0) PRINTHELP()
SCRIPT_MSG("GetCurInstType: %s\n",line.gettoken_str(1));
return add_entry(&ent);
#else//!NSIS_CONFIG_COMPONENTPAGE
case TOK_SECTIONGETTEXT:
case TOK_SECTIONSETTEXT:
case TOK_SECTIONGETTEXT:
case TOK_SECTIONSETFLAGS:
case TOK_SECTIONGETFLAGS:
case TOK_SECTIONSETSIZE:
case TOK_SECTIONGETSIZE:
case TOK_SECTIONSETINSTTYPES:
case TOK_SECTIONGETINSTTYPES:
case TOK_SETCURINSTTYPE:
case TOK_GETCURINSTTYPE:
ERROR_MSG("Error: %s specified, NSIS_CONFIG_COMPONENTPAGE not defined.\n", line.gettoken_str(0));
return PS_ERROR;
#endif//!NSIS_CONFIG_COMPONENTPAGE

View file

@ -126,7 +126,9 @@ static tokenType tokenlist[TOK__LAST] =
{TOK_RENAME,"Rename",2,1,"[/REBOOTOK] source_file destination_file"},
{TOK_RET,"Return",0,0,""},
{TOK_RMDIR,"RMDir",1,1,"[/r|/REBOOTOK] directory_name"},
{TOK_SECTION,"Section",0,3,"[/e] [section_name|-section_name] [section index output]"},
{TOK_SECTION,"Section",0,3,"[/0] [section_name|-section_name] [section index output]"},
{TOK_SECTIONEND,"SectionEnd",0,0,""},
{TOK_SECTIONIN,"SectionIn",1,-1,"InstTypeIdx [InstTypeIdx [...]]"},
{TOK_SUBSECTION,"SubSection",1,2,"[/e] subsection_name [section index output]"},
{TOK_SUBSECTIONEND,"SubSectionEnd",0,0,""},
{TOK_SEARCHPATH,"SearchPath",2,0,"$(user_var: result) filename"},
@ -136,8 +138,12 @@ static tokenType tokenlist[TOK__LAST] =
{TOK_SECTIONGETINSTTYPES,"SectionGetInstTypes",2,0,"section_index $(user_var: output inst_types)"},
{TOK_SECTIONGETTEXT,"SectionGetText",2,0,"section_index $(user_var: output text)"},
{TOK_SECTIONSETTEXT,"SectionSetText",2,0,"section_index text_string"},
{TOK_SECTIONEND,"SectionEnd",0,0,""},
{TOK_SECTIONIN,"SectionIn",1,-1,"InstTypeIdx [InstTypeIdx [...]]"},
{TOK_SECTIONGETSIZE,"SectionGetSize",2,0,"section_index $(user_var: output size)"},
{TOK_SECTIONSETSIZE,"SectionSetSize",2,0,"section_index new_size"},
{TOK_GETCURINSTTYPE,"GetCurInstType",1,0,"$(user_var: output inst_type_idx)"},
{TOK_SETCURINSTTYPE,"SetCurInstType",1,0,"inst_type_idx"},
{TOK_INSTTYPESETTEXT,"InstTypeSetText",2,0,"insttype_index flags"},
{TOK_INSTTYPEGETTEXT,"InstTypeGetText",2,0,"insttype_index $(user_var: output flags)"},
{TOK_SENDMESSAGE,"SendMessage",4,2,"hwnd message [wparam|STR:wParam] [lparam|STR:lParam] [$(user_var: return value)] [/TIMEOUT=X]"},
{TOK_SETAUTOCLOSE,"SetAutoClose",1,0,"(false|true)"},
{TOK_SETBKCOLOR,"SetBkColor",2,0,"hwnd color"},

View file

@ -201,6 +201,12 @@ enum
TOK_SECTIONGETFLAGS,
TOK_SECTIONSETINSTTYPES,
TOK_SECTIONGETINSTTYPES,
TOK_SECTIONSETSIZE,
TOK_SECTIONGETSIZE,
TOK_INSTTYPESETTEXT,
TOK_INSTTYPEGETTEXT,
TOK_GETCURINSTTYPE,
TOK_SETCURINSTTYPE,
TOK_SETSHELLVARCONTEXT,
TOK_PLUGINDIR,
TOK_INITPLUGINSDIR,