diff --git a/Source/build.cpp b/Source/build.cpp
index 83206888..d8846e49 100644
--- a/Source/build.cpp
+++ b/Source/build.cpp
@@ -1165,7 +1165,12 @@ int CEXEBuild::add_section(const char *secname, const char *defname, int expand/
set_uninstall_mode(1);
}
- if (subsection_open_cnt && !(new_section.flags & SF_SUBSECEND))
+ if ((new_section.flags & SF_SUBSECEND) && subsection_open_cnt && old_uninstall_mode)
+ {
+ set_uninstall_mode(1);
+ }
+
+ if (subsection_open_cnt)
{
if (uninstall_mode != old_uninstall_mode)
{
@@ -1182,28 +1187,6 @@ int CEXEBuild::add_section(const char *secname, const char *defname, int expand/
cur_sections->add(&new_section, sizeof(section));
build_cursection = (section *) cur_sections->get() + cur_header->blocks[NB_SECTIONS].num;
- if (new_section.flags & (SF_SUBSEC | SF_SUBSECEND))
- {
- if (new_section.flags & SF_SUBSECEND)
- {
- subsection_open_cnt--;
- if (subsection_open_cnt < 0)
- {
- ERROR_MSG("SubSectionEnd: no SubSections are open\n");
- return PS_ERROR;
- }
- if (!subsection_open_cnt)
- set_uninstall_mode(0);
- }
- else
- subsection_open_cnt++;
-
- add_entry_direct(EW_RET);
- build_cursection->code_size = 0;
-
- build_cursection = 0;
- }
-
if (defname[0])
{
char buf[32];
@@ -1217,6 +1200,30 @@ int CEXEBuild::add_section(const char *secname, const char *defname, int expand/
cur_header->blocks[NB_SECTIONS].num++;
+ if (new_section.flags & (SF_SUBSEC | SF_SUBSECEND))
+ {
+ add_entry_direct(EW_RET);
+ build_cursection->code_size = 0;
+
+ build_cursection = 0;
+
+ if (new_section.flags & SF_SUBSECEND)
+ {
+ subsection_open_cnt--;
+ if (subsection_open_cnt < 0)
+ {
+ ERROR_MSG("SubSectionEnd: no SubSections are open\n");
+ return PS_ERROR;
+ }
+ if (!subsection_open_cnt)
+ {
+ set_uninstall_mode(0);
+ }
+ }
+ else
+ subsection_open_cnt++;
+ }
+
return PS_OK;
}
diff --git a/Source/makenssi.cpp b/Source/makenssi.cpp
index ca09388d..6f329b43 100644
--- a/Source/makenssi.cpp
+++ b/Source/makenssi.cpp
@@ -1,4 +1,4 @@
-const char *NSIS_VERSION="v2.0b4 (CVS)";
+const char *NSIS_VERSION="v2.0b4";
/*
Nullsoft Scriptable Install System (NSIS)
diff --git a/Source/script.cpp b/Source/script.cpp
index fc7c3f03..faddf53c 100644
--- a/Source/script.cpp
+++ b/Source/script.cpp
@@ -1934,7 +1934,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
if (k == -1) PRINTHELP()
SCRIPT_MSG("XPStyle: %s\n", line.gettoken_str(1));
init_res_editor();
- char* szXPManifest = k ? 0 : "Nullsoft Install System v2.0b4 (CVS)";
+ char* szXPManifest = k ? 0 : "Nullsoft Install System v2.0b4";
res_editor->UpdateResource(MAKEINTRESOURCE(24), MAKEINTRESOURCE(1), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (unsigned char*)szXPManifest, k ? 0 : lstrlen(szXPManifest));
}
catch (exception& err) {
@@ -2667,7 +2667,12 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
a++;
}
wsprintf(buf,"-%s",line.gettoken_str(a));
- if (which_token == TOK_SUBSECTION && !line.gettoken_str(a)[0]) PRINTHELP()
+ if (which_token == TOK_SUBSECTION)
+ {
+ char *s = line.gettoken_str(a);
+ if (!s[0] || (!strcmpi(s, "un.") && !s[3]))
+ PRINTHELP();
+ }
SCRIPT_MSG("%s %s",line.gettoken_str(0),line.gettoken_str(a));
if (line.gettoken_str(a+1)[0]) SCRIPT_MSG(" ->(%s)",line.gettoken_str(a+1));
diff --git a/Source/tokens.cpp b/Source/tokens.cpp
index 9af1c96f..026aa5d2 100644
--- a/Source/tokens.cpp
+++ b/Source/tokens.cpp
@@ -91,7 +91,7 @@ static tokenType tokenlist[TOK__LAST] =
{TOK_INSTCOLORS,"InstallColors",1,1,"(/windows | (foreground_color background_color))"},
{TOK_INSTDIR,"InstallDir",1,0,"default_install_directory"},
{TOK_INSTPROGRESSFLAGS,"InstProgressFlags",0,-1,"[flag [...]]\n flag={smooth|colored}"},
-{TOK_INSTTYPE,"InstType",1,0,"install_type_name | /NOCUSTOM | /CUSTOMSTRING=str | /COMPONENTSONLYONCUSTOM"},
+{TOK_INSTTYPE,"InstType",1,0,"[un.]install_type_name | /NOCUSTOM | /CUSTOMSTRING=str | /COMPONENTSONLYONCUSTOM"},
{TOK_INTOP,"IntOp",3,1,"$(user_var: result) val1 OP [val2]\n OP=(+ - * / % | & ^ ~ ! || &&)"},
{TOK_INTCMP,"IntCmp",3,2,"val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]"},
{TOK_INTCMPU,"IntCmpU",3,2,"val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]"},
@@ -133,10 +133,10 @@ 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,"[/0] [section_name|-section_name] [section index output]"},
+{TOK_SECTION,"Section",0,3,"[/0] [-][un.][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_SUBSECTION,"SubSection",1,2,"[/e] [un.]subsection_name [section index output]"},
{TOK_SUBSECTIONEND,"SubSectionEnd",0,0,""},
{TOK_SEARCHPATH,"SearchPath",2,0,"$(user_var: result) filename"},
{TOK_SECTIONSETFLAGS,"SectionSetFlags",2,0,"section_index flags"},