From 0c7981ef603547731d66a39fc37c3dde47c7f409 Mon Sep 17 00:00:00 2001 From: kichik Date: Wed, 24 Dec 2003 15:54:06 +0000 Subject: [PATCH] - Disabled DirShow as it hasn't been working since b0 which was released more than a year ago. - Rewrote token placement checks to prevent a crash with: "Section uninstall InstallDir something" and to make it a bit more comfortable. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3305 212acab6-be3b-0410-9dea-997c60f758d6 --- Examples/waplugin.nsi | 2 +- Source/build.cpp | 14 -- Source/build.h | 5 +- Source/script.cpp | 137 ++++++----- Source/tokens.cpp | 513 ++++++++++++++++++++++++------------------ 5 files changed, 366 insertions(+), 305 deletions(-) diff --git a/Examples/waplugin.nsi b/Examples/waplugin.nsi index 4d6a40a7..fef61034 100644 --- a/Examples/waplugin.nsi +++ b/Examples/waplugin.nsi @@ -27,7 +27,7 @@ InstallDirRegKey HKLM \ ; The text to prompt the user to enter a directory DirText "Please select your Winamp path below (you will be able to proceed when Winamp is detected):" -DirShow hide +# currently doesn't work - DirShow hide ; automatically close the installer when done. AutoCloseWindow true diff --git a/Source/build.cpp b/Source/build.cpp index dbeefa22..efc5b49b 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -1199,20 +1199,6 @@ int CEXEBuild::add_section(const char *secname, const char *defname, int expand/ return PS_OK; } -int CEXEBuild::make_sure_not_in_secorfunc(const char *str, int page_ok/*=0*/) -{ - if (build_cursection) - { - ERROR_MSG("Error: command %s not valid in %s\n",str,build_cursection_isfunc?"function":"section"); - return PS_ERROR; - } - if (cur_page && !page_ok) { - ERROR_MSG("Error: command %s not valid in PageEx\n",str); - return PS_ERROR; - } - return PS_OK; -} - int CEXEBuild::add_entry(const entry *ent) { if (!build_cursection && !uninstall_mode) diff --git a/Source/build.h b/Source/build.h index 665a0b25..fdcca62c 100644 --- a/Source/build.h +++ b/Source/build.h @@ -109,7 +109,8 @@ class CEXEBuild { private: // tokens.cpp - int get_commandtoken(char *s, int *np, int *op); + int get_commandtoken(char *s, int *np, int *op, int *pos); + int IsTokenPlacedRight(int pos, char *tok); // script.cpp #ifdef NSIS_SUPPORT_STANDARD_PREDEFINES @@ -184,8 +185,6 @@ class CEXEBuild { int preprocess_string(char *out, const char *in, WORD codepage=CP_ACP); - int make_sure_not_in_secorfunc(const char *str, int page_ok=0); - #ifdef NSIS_CONFIG_PLUGIN_SUPPORT // Added by Ximon Eighteen 5th August 2002 Plugins m_plugins; diff --git a/Source/script.cpp b/Source/script.cpp index 0a93ec56..199b55fe 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -267,8 +267,8 @@ int CEXEBuild::doParse(const char *str) parse_again: if (line.getnumtokens() < 1) return PS_OK; - int np,op; - int tkid=get_commandtoken(line.gettoken_str(0),&np,&op); + int np,op,pos; + int tkid=get_commandtoken(line.gettoken_str(0),&np,&op,&pos); if (tkid == -1) { char *p=line.gettoken_str(0); @@ -292,6 +292,7 @@ parse_again: { np = 0; // parameters are optional op = -1; // unlimited number of optional parameters + pos = -1; // placement will tested later tkid = TOK__PLUGINCOMMAND; } else @@ -302,6 +303,9 @@ parse_again: } } + if (IsTokenPlacedRight(pos, line.gettoken_str(0)) != PS_OK) + return PS_ERROR; + int v=line.getnumtokens()-(np+1); if (v < 0 || (op >= 0 && v > op)) // opt_parms is -1 for unlimited { @@ -1063,7 +1067,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) set_uninstall_mode(0); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; // extended page setting case TOK_PAGEEX: @@ -1082,17 +1086,12 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) cur_page->flags |= PF_PAGE_EX; } - return make_sure_not_in_secorfunc(line.gettoken_str(0), 1); + return PS_OK; case TOK_PAGEEXEND: { SCRIPT_MSG("PageExEnd\n"); - if (!cur_page) { - ERROR_MSG("Error: no PageEx open!\n"); - return PS_ERROR; - } - #ifdef NSIS_SUPPORT_CODECALLBACKS if (cur_page_type == PAGE_CUSTOM && !cur_page->prefunc) { ERROR_MSG("Error: custom pages must have a creator function.\n"); @@ -1109,15 +1108,12 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) set_uninstall_mode(0); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_PAGECALLBACKS: #ifdef NSIS_SUPPORT_CODECALLBACKS { SCRIPT_MSG("PageCallbacks:"); - if (!cur_page) { - ERROR_MSG("\nPageCallbacks must be used inside PageEx!\n"); - return PS_ERROR; - } + if (cur_page_type == PAGE_CUSTOM) { switch (line.getnumtokens()) @@ -1261,7 +1257,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SCRIPT_MSG("\n"); } - return make_sure_not_in_secorfunc(line.gettoken_str(0), 1); + return PS_OK; #else ERROR_MSG("Error: %s specified, NSIS_SUPPORT_CODECALLBACKS not defined.\n", line.gettoken_str(0)); return PS_ERROR; @@ -1291,7 +1287,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } SCRIPT_MSG("LangString: \"%s\" %d \"%s\"\n", name, lang, str); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_LANGSTRINGUP: SCRIPT_MSG("Error: LangStringUP is obsolete, there are no more unprocessed strings. Use LangString.\n"); return PS_ERROR; @@ -1356,7 +1352,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SCRIPT_MSG("LicenseLangString: \"%s\" %d \"%s\"\n", name, lang, file); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_NAME: { if (SetInnerString(NLF_NAME,line.gettoken_str(1)) == PS_WARNING) @@ -1367,7 +1363,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SCRIPT_MSG(" \"%s\"",line.gettoken_str(2)); SCRIPT_MSG("\n"); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_CAPTION: { if (!cur_page) @@ -1381,7 +1377,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } SCRIPT_MSG("Caption: \"%s\"\n",line.gettoken_str(1)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0), 1); + return PS_OK; case TOK_ICON: SCRIPT_MSG("Icon: \"%s\"\n",line.gettoken_str(1)); try { @@ -1395,7 +1391,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) ERROR_MSG("Error while replacing icon: %s\n", err.what()); return PS_ERROR; } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; #ifdef NSIS_CONFIG_COMPONENTPAGE case TOK_CHECKBITMAP: SCRIPT_MSG("CheckBitmap: \"%s\"\n",line.gettoken_str(1)); @@ -1424,7 +1420,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) ERROR_MSG("Error while replacing bitmap: %s\n", err.what()); return PS_ERROR; } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; #else//NSIS_CONFIG_COMPONENTPAGE case TOK_CHECKBITMAP: ERROR_MSG("Error: %s specified, NSIS_CONFIG_COMPONENTPAGE not defined.\n", line.gettoken_str(0)); @@ -1458,14 +1454,14 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } SCRIPT_MSG("DirText: \"%s\" \"%s\" \"%s\" \"%s\"\n",line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(4)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0), 1); + return PS_OK; #else//NSIS_CONFIG_VISIBLE_SUPPORT ERROR_MSG("Error: %s specified, NSIS_CONFIG_VISIBLE_SUPPORT not defined.\n", line.gettoken_str(0)); return PS_ERROR; #endif//!NSIS_CONFIG_VISIBLE_SUPPORT case TOK_DIRVAR: { - if (!cur_page || (cur_page_type != PAGE_DIRECTORY && cur_page_type != PAGE_UNINSTCONFIRM)) { + if (cur_page_type != PAGE_DIRECTORY && cur_page_type != PAGE_UNINSTCONFIRM) { ERROR_MSG("Error: can't use DirVar outside of PageEx directory|uninstConfirm.\n"); return PS_ERROR; } @@ -1473,10 +1469,10 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) if (cur_page->parms[4] <= 0) PRINTHELP(); SCRIPT_MSG("DirVar: %s\n", line.gettoken_str(1)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0), 1); + return PS_OK; case TOK_DIRVERIFY: { - if (!cur_page || cur_page_type != PAGE_DIRECTORY) { + if (cur_page_type != PAGE_DIRECTORY) { ERROR_MSG("Error: can't use DirVerify outside of PageEx directory.\n"); return PS_ERROR; } @@ -1488,7 +1484,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) cur_page->flags |= PF_DIR_NO_BTN_DISABLE; SCRIPT_MSG("DirVerify: %s\n", line.gettoken_str(1)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0), 1); + return PS_OK; case TOK_GETINSTDIRERROR: ent.which = EW_GETFLAG; ent.offsets[0] = GetUserVarIndex(line, 1); @@ -1518,7 +1514,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } SCRIPT_MSG("ComponentText: \"%s\" \"%s\" \"%s\"\n",line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0), 1); + return PS_OK; case TOK_INSTTYPE: { int x; @@ -1567,7 +1563,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) set_uninstall_mode(0); } } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; #else//NSIS_CONFIG_COMPONENTPAGE case TOK_COMPTEXT: case TOK_INSTTYPE: @@ -1595,7 +1591,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } SCRIPT_MSG("LicenseText: \"%s\" \"%s\"\n",line.gettoken_str(1),line.gettoken_str(2)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0), 1); + return PS_OK; case TOK_LICENSEDATA: { int idx = 0; @@ -1671,7 +1667,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SCRIPT_MSG("LicenseData: \"%s\"\n",file); } - return make_sure_not_in_secorfunc(line.gettoken_str(0), 1); + return PS_OK; case TOK_LICENSEFORCESELECTION: { int k=line.gettoken_enum(1,"off\0checkbox\0radiobuttons\0"); @@ -1732,7 +1728,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SCRIPT_MSG("LicenseForceSelection: %s \"%s\" \"%s\"\n", line.gettoken_str(1), line.gettoken_str(2), line.gettoken_str(3)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0), 1); + return PS_OK; case TOK_LICENSEBKCOLOR: { char *p = line.gettoken_str(1); @@ -1754,7 +1750,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SCRIPT_MSG("LicenseBkColor: %06X\n",v); } } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; #else//!NSIS_CONFIG_LICENSEPAGE case TOK_LICENSETEXT: case TOK_LICENSEDATA: @@ -1791,7 +1787,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } #endif//NSIS_CONFIG_LICENSEPAGE } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_SILENTUNINST: #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT { @@ -1803,7 +1799,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) build_uninst.flags&=~CH_FLAGS_SILENT; SCRIPT_MSG("SilentUnInstall: %s\n",line.gettoken_str(1)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; #else ERROR_MSG("Error: %s specified, NSIS_CONFIG_UNINSTALL_SUPPORT not defined.\n", line.gettoken_str(0)); return PS_ERROR; @@ -1837,7 +1833,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) case TOK_OUTFILE: strncpy(build_output_filename,line.gettoken_str(1),1024-1); SCRIPT_MSG("OutFile: \"%s\"\n",build_output_filename); - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_INSTDIR: { char *p = line.gettoken_str(1); @@ -1859,7 +1855,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } SCRIPT_MSG("InstallDir: \"%s\"\n",line.gettoken_str(1)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_INSTALLDIRREGKEY: // InstallDirRegKey { if (build_header.install_reg_key_ptr) @@ -1876,12 +1872,12 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) build_header.install_reg_value_ptr = add_string(line.gettoken_str(3),0); SCRIPT_MSG("InstallRegKey: \"%s\\%s\\%s\"\n",line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_CRCCHECK: build_crcchk=line.gettoken_enum(1,"off\0on\0force\0"); if (build_crcchk==-1) PRINTHELP() SCRIPT_MSG("CRCCheck: %s\n",line.gettoken_str(1)); - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_INSTPROGRESSFLAGS: { int x; @@ -1922,7 +1918,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SCRIPT_MSG("InstProgressFlags: smooth=%d, colored=%d\n",smooth, !!(build_header.flags&CH_FLAGS_PROGRESS_COLORED)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_AUTOCLOSE: { int k=line.gettoken_enum(1,"false\0true\0"); @@ -1933,13 +1929,13 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) build_header.flags&=~CH_FLAGS_AUTO_CLOSE; SCRIPT_MSG("AutoCloseWindow: %s\n",k?"true":"false"); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_WINDOWICON: #ifdef NSIS_CONFIG_VISIBLE_SUPPORT disable_window_icon=line.gettoken_enum(1,"on\0off\0"); if (disable_window_icon == -1) PRINTHELP(); SCRIPT_MSG("WindowIcon: %s\n",line.gettoken_str(1)); - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; #else ERROR_MSG("Error: %s specified, NSIS_CONFIG_VISIBLE_SUPPORT not defined.\n",line.gettoken_str(0)); return PS_ERROR; @@ -1973,9 +1969,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } SCRIPT_MSG("%s: %s\n",line.gettoken_str(0),line.gettoken_str(1)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_DIRSHOW: - { + /*{ int k=line.gettoken_enum(1,"show\0hide\0"); if (k == -1) PRINTHELP(); if (k) @@ -1983,8 +1979,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) else build_header.flags&=~CH_FLAGS_DIR_NO_SHOW; SCRIPT_MSG("DirShow: %s\n",k?"hide":"show"); - } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + }*/ + ERROR_MSG("Error: DirShow doesn't currently work\n"); + return PS_ERROR; case TOK_ROOTDIRINST: { int k=line.gettoken_enum(1,"true\0false\0"); @@ -1995,7 +1992,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) build_header.flags&=~CH_FLAGS_NO_ROOT_DIR; SCRIPT_MSG("AllowRootDirInstall: %s\n",k?"false":"true"); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_BGGRADIENT: #ifndef NSIS_SUPPORT_BGBG ERROR_MSG("Error: BGGradient specified but NSIS_SUPPORT_BGBG not defined\n"); @@ -2043,7 +2040,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) build_uninst.bg_textcolor=build_header.bg_textcolor; #endif//NSIS_CONFIG_UNINSTALL_SUPPORT #endif//NSIS_SUPPORT_BGBG - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; #ifdef NSIS_CONFIG_VISIBLE_SUPPORT case TOK_INSTCOLORS: { @@ -2071,7 +2068,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) build_uninst.lb_bg=build_header.lb_bg; #endif } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_XPSTYLE: try { int k=line.gettoken_enum(1,"on\0off\0"); @@ -2085,7 +2082,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) ERROR_MSG("Error while adding XP style: %s\n", err.what()); return PS_ERROR; } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_CHANGEUI: try { DWORD dwSize; @@ -2220,7 +2217,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) ERROR_MSG("Error while changing UI: %s\n", err.what()); return PS_ERROR; } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_ADDBRANDINGIMAGE: try { int k=line.gettoken_enum(1,"top\0left\0bottom\0right\0"); @@ -2293,7 +2290,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) ERROR_MSG("Error while adding image branding support: %s\n", err.what()); return PS_ERROR; } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_SETFONT: { if (!strnicmp(line.gettoken_str(1), "/LANG=", 6)) @@ -2314,7 +2311,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SCRIPT_MSG("SetFont: \"%s\" %s\n", line.gettoken_str(1), line.gettoken_str(2)); } } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; #else case TOK_INSTCOLORS: case TOK_XPSTYLE: @@ -2417,7 +2414,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) warning_fl("SetCompressor ignored due to previous call with the /FINAL switch"); } } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; #else//NSIS_CONFIG_COMPRESSION_SUPPORT ERROR_MSG("Error: %s specified, NSIS_CONFIG_COMPRESSION_SUPPORT not defined.\n", line.gettoken_str(0)); return PS_ERROR; @@ -2446,7 +2443,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) wsprintf(lang_id, "%u", table->lang_id); definedlist.add(lang_name, lang_id); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; // preprocessor-ish (ifdef/ifndef/else/endif are handled one step out from here) /////////////////////////////////////////////////////////////////////////////// @@ -2662,7 +2659,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) warning_fl("%s: specified multiple times, wasting space",line.gettoken_str(0)); SCRIPT_MSG("UninstCaption: \"%s\"\n",line.gettoken_str(1)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_UNINSTICON: SCRIPT_MSG("UninstallIcon: \"%s\"\n",line.gettoken_str(1)); try { @@ -2677,7 +2674,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) ERROR_MSG("Error while replacing icon: %s\n", err.what()); return PS_ERROR; } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_UNINSTTEXT: { if (!cur_page) { @@ -2695,7 +2692,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } SCRIPT_MSG("UninstallText: \"%s\" \"%s\"\n",line.gettoken_str(1),line.gettoken_str(2)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0), 1); + return PS_OK; case TOK_UNINSTSUBCAPTION: { int s; @@ -2704,7 +2701,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SetInnerString(NLF_USUBCAPTION_CONFIRM+w,line.gettoken_str(2)); SCRIPT_MSG("UninstSubCaption: page:%d, text=%s\n",w,line.gettoken_str(2)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_WRITEUNINSTALLER: if (uninstall_mode) { @@ -2963,7 +2960,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SetInnerString(NLF_SUBCAPTION_LICENSE+w,line.gettoken_str(2)); SCRIPT_MSG("SubCaption: page:%d, text=%s\n",w,line.gettoken_str(2)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_FILEERRORTEXT: #ifdef NSIS_SUPPORT_FILE { @@ -2971,7 +2968,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SetInnerString(NLF_FILE_ERROR_NOIGNORE,line.gettoken_str(2)); SCRIPT_MSG("FileErrorText: \"%s\" \"%s\"\n",line.gettoken_str(1),line.gettoken_str(2)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; #else ERROR_MSG("Error: %s specified, NSIS_SUPPORT_FILE not defined.\n", line.gettoken_str(0)); return PS_ERROR; @@ -3026,7 +3023,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } SCRIPT_MSG("BrandingText: \"%s\"\n",line.gettoken_str(a)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_MISCBUTTONTEXT: { SetInnerString(NLF_BTN_BACK,line.gettoken_str(1)); @@ -3035,7 +3032,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SetInnerString(NLF_BTN_CLOSE,line.gettoken_str(4)); SCRIPT_MSG("MiscButtonText: back=\"%s\" next=\"%s\" cancel=\"%s\" close=\"%s\"\n",line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(4)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_SPACETEXTS: { if (!lstrcmpi(line.gettoken_str(1), "none")) { @@ -3049,13 +3046,13 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SCRIPT_MSG("SpaceTexts: required=\"%s\" available=\"%s\"\n",line.gettoken_str(1),line.gettoken_str(2)); } } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_INSTBUTTONTEXT: { SetInnerString(NLF_BTN_INSTALL,line.gettoken_str(1)); SCRIPT_MSG("InstallButtonText: \"%s\"\n",line.gettoken_str(1)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_DETAILSBUTTONTEXT: { if (!cur_page) { @@ -3071,7 +3068,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } SCRIPT_MSG("DetailsButtonText: \"%s\"\n",line.gettoken_str(1)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0),1); + return PS_OK; case TOK_COMPLETEDTEXT: { if (!cur_page) { @@ -3087,14 +3084,14 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) } SCRIPT_MSG("CompletedText: \"%s\"\n",line.gettoken_str(1)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; case TOK_UNINSTBUTTONTEXT: #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT { SetInnerString(NLF_BTN_UNINSTALL,line.gettoken_str(1)); SCRIPT_MSG("UninstButtonText: \"%s\"\n",line.gettoken_str(1)); } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; #else ERROR_MSG("Error: %s specified, NSIS_CONFIG_UNINSTALL_SUPPORT not defined.\n", line.gettoken_str(0)); return PS_ERROR; @@ -4991,7 +4988,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) if ( res != PS_OK ) return res; } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; // Added by ramon 6 jun 2003 #ifdef NSIS_SUPPORT_VERSION_INFO @@ -5022,7 +5019,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) return PS_ERROR; } - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; } } case TOK_VI_SETPRODUCTVERSION: @@ -5032,7 +5029,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) return PS_ERROR; } strcpy(version_product_v, line.gettoken_str(1)); - return make_sure_not_in_secorfunc(line.gettoken_str(0)); + return PS_OK; #else case TOK_VI_ADDKEY: diff --git a/Source/tokens.cpp b/Source/tokens.cpp index 267a2993..ee55f7e6 100644 --- a/Source/tokens.cpp +++ b/Source/tokens.cpp @@ -5,6 +5,15 @@ #include "build.h" #include "tokens.h" +// token placement +#define TP_SEC 1 +#define TP_FUNC 2 +#define TP_CODE (TP_SEC | TP_FUNC) +#define TP_GLOBAL 4 +#define TP_PAGEEX 8 +#define TP_PG (TP_GLOBAL | TP_PAGEEX) +#define TP_ALL (TP_CODE | TP_PG) + typedef struct { int id; @@ -12,241 +21,242 @@ typedef struct int num_parms; // minimum number of parameters int opt_parms; // optional parmaters, usually 0, can be -1 for unlimited. char *usage_str; + int placement; // where the token can be placed } tokenType; static tokenType tokenlist[TOK__LAST] = { -{TOK_ABORT,"Abort",0,1,"[message]"}, -{TOK_ADDBRANDINGIMAGE,"AddBrandingImage",2,1,"(top|left|bottom|right) (height|width) [padding]"}, -{TOK_ADDSIZE,"AddSize",1,0,"size_to_add_to_section_in_kb"}, -{TOK_AUTOCLOSE,"AutoCloseWindow",1,0,"(false|true)"}, -{TOK_BGGRADIENT,"BGGradient",0,3,"(off | [top_color [bottom_color [text_color]]])"}, -{TOK_BRANDINGTEXT,"BrandingText",1,1,"[/TRIM(LEFT|RIGHT|CENTER)] installer_text"}, -{TOK_BRINGTOFRONT,"BringToFront",0,0,""}, -{TOK_CALL,"Call",1,0,"function_name | [:label_name]"}, -{TOK_CALLINSTDLL,"CallInstDLL",2,1,"dll_path_on_target.dll [/NOUNLOAD] function"}, -{TOK_CAPTION,"Caption",1,0,"installer_caption"}, -{TOK_CHANGEUI,"ChangeUI",1,1,"[/RTL] (all|dlg_id) ui_file.exe"}, -{TOK_CLEARERRORS,"ClearErrors",0,0,""}, -{TOK_COMPTEXT,"ComponentText",0,3,"[component_page_description] [component_subtext1] [component_subtext2]"}, -{TOK_GETDLLVERSION,"GetDLLVersion",3,0,"filename $(user_var: high output) $(user_var: low output)"}, -{TOK_GETDLLVERSIONLOCAL,"GetDLLVersionLocal",3,0,"localfilename $(user_var: high output) $(user_var: low output)"}, -{TOK_GETFILETIME,"GetFileTime",3,0,"file $(user_var: high output) $(user_var: low output)"}, -{TOK_GETFILETIMELOCAL,"GetFileTimeLocal",3,0,"localfile $(user_var: high output) $(user_var: low output)"}, -{TOK_COPYFILES,"CopyFiles",2,3,"[/SILENT] [/FILESONLY] source_path destination_path [total_size_in_kb]"}, -{TOK_CRCCHECK,"CRCCheck",1,0,"(on|force|off)"}, -{TOK_CREATEDIR,"CreateDirectory",1,0,"directory_name"}, -{TOK_CREATEFONT,"CreateFont",2,5,"$(user_var: handle output) face_name [height wieght /ITALIC /UNDERLINE /STRIKE]"}, -{TOK_CREATESHORTCUT,"CreateShortCut",2,6,"shortcut_name.lnk shortcut_target [parameters [icon_file [icon index [showmode [hotkey [comment]]]]]]\n showmode=(SW_SHOWNORMAL|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED)\n hotkey=(ALT|CONTROL|EXT|SHIFT)|(F1-F24|A-Z)"}, -{TOK_DBOPTIMIZE,"SetDatablockOptimize",1,0,"(off|on)"}, -{TOK_DELETEINISEC,"DeleteINISec",2,0,"ini_file section_name"}, -{TOK_DELETEINISTR,"DeleteINIStr",3,0,"ini_file section_name entry_name"}, -{TOK_DELETEREGKEY,"DeleteRegKey",2,1,"[/ifempty] root_key subkey\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)"}, -{TOK_DELETEREGVALUE,"DeleteRegValue",3,0,"root_key subkey entry_name\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)"}, -{TOK_DELETE,"Delete",1,1,"[/REBOOTOK] filespec"}, -{TOK_DETAILPRINT,"DetailPrint",1,0,"message"}, -{TOK_DIRTEXT,"DirText",0,4,"[directory_page_description] [directory_page_subtext] [browse_button_text] [browse_dlg_text]"}, -{TOK_DIRSHOW,"DirShow",1,0,"(show|hide)"}, -{TOK_DIRVAR,"DirVar",1,0,"$(user_var: dir in/out))"}, -{TOK_DIRVERIFY,"DirVerify",1,0,"auto|leave"}, -{TOK_GETINSTDIRERROR,"GetInstDirError",1,0,"$(user_var: error output)"}, -{TOK_ROOTDIRINST,"AllowRootDirInstall",1,0,"(true|false)"}, -{TOK_CHECKBITMAP,"CheckBitmap",1,0,"local_bitmap.bmp"}, -{TOK_ENABLEWINDOW,"EnableWindow",2,0,"hwnd (1|0)"}, -{TOK_ENUMREGKEY,"EnumRegKey",4,0,"$(user_var: output) rootkey subkey index\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)"}, -{TOK_ENUMREGVAL,"EnumRegValue",4,0,"$(user_var: output) rootkey subkey index\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)"}, -{TOK_EXCH,"Exch",0,1,"[$(user_var)] | [stack_item_index]"}, -{TOK_EXEC,"Exec",1,0,"command_line"}, -{TOK_EXECWAIT,"ExecWait",1,1,"command_line [$(user_var: return value)]"}, -{TOK_EXECSHELL,"ExecShell",2,2,"(open|print|etc) command_line [parameters [showmode]]\n showmode=(SW_SHOWNORMAL|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED)"}, -{TOK_EXPANDENVSTRS,"ExpandEnvStrings",2,0,"$(user_var: output) string"}, -{TOK_FINDWINDOW,"FindWindow",2,3,"$(user_var: handle output) WindowClass [WindowTitle] [Window_Parent] [Child_After]"}, -{TOK_FINDCLOSE,"FindClose",1,0,"$(user_var: handle input)"}, -{TOK_FINDFIRST,"FindFirst",3,0,"$(user_var: handle output) $(user_var: filename output) filespec"}, -{TOK_FINDNEXT,"FindNext",2,0,"$(user_var: handle input) $(user_var: filename output)"}, -{TOK_FILE,"File",1,-1,"[/nonfatal] [/a] ([/r] filespec [...]|/oname=outfile one_file_only)"}, -{TOK_FILEBUFSIZE,"FileBufSize",1,0,"buf_size_mb"}, -{TOK_FLUSHINI,"FlushINI",1,0,"ini_file"}, -{TOK_RESERVEFILE,"ReserveFile",1,-1,"[/nonfatal] [/r] file [file...]"}, -{TOK_FILECLOSE,"FileClose",1,0,"$(user_var: handle input)"}, -{TOK_FILEERRORTEXT,"FileErrorText",0,2,"[text (can contain $0)] [text without ignore (can contain $0)]"}, -{TOK_FILEOPEN,"FileOpen",3,0,"$(user_var: handle output) filename openmode\n openmode=r|w|a"}, -{TOK_FILEREAD,"FileRead",2,1,"$(user_var: handle input) $(user_var: text output) [maxlen]"}, -{TOK_FILEWRITE,"FileWrite",2,0,"$(user_var: handle input) text"}, -{TOK_FILEREADBYTE,"FileReadByte",2,0,"$(user_var: handle input) $(user_var: bytevalue output)"}, -{TOK_FILEWRITEBYTE,"FileWriteByte",2,0,"$(user_var: handle input) bytevalue"}, -{TOK_FILESEEK,"FileSeek",2,2,"$(user_var: handle input) offset [mode] [$(user_var: new position output)]\n mode=SET|CUR|END"}, -{TOK_FUNCTION,"Function",1,0,"function_name"}, -{TOK_FUNCTIONEND,"FunctionEnd",0,0,""}, -{TOK_GETDLGITEM,"GetDlgItem",3,0,"$(user_var: handle output) dialog item_id"}, -{TOK_GETFULLPATHNAME,"GetFullPathName",2,1,"[/SHORT] $(user_var: result) path_or_file"}, -{TOK_GETTEMPFILENAME,"GetTempFileName",1,1,"$(user_var: name output) [base_dir]"}, -{TOK_HIDEWINDOW,"HideWindow",0,0,""}, -{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_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_IFSILENT,"IfSilent",1,1,"jump_if_silent [jump_if_not_silent]"}, -{TOK_INSTALLDIRREGKEY,"InstallDirRegKey",3,0,"root_key subkey entry_name\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)"}, -{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,"[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]"}, -{TOK_INTFMT,"IntFmt",3,0,"$(user_var: output) format_string input"}, -{TOK_ISWINDOW,"IsWindow",2,1,"hwnd jump_if_window [jump_if_not_window]"}, -{TOK_GOTO,"Goto",1,0,"label"}, -{TOK_LANGSTRING,"LangString",3,0,"[un.]name lang_id string"}, -{TOK_LANGSTRINGUP,"LangStringUP",0,0,"obsolete, use LangString."}, -{TOK_LICENSEDATA,"LicenseData",1,0,"local_file_that_has_license_text | license_lang_string"}, -{TOK_LICENSEFORCESELECTION,"LicenseForceSelection",1,2,"(checkbox [accept_text] | radiobuttons [accept_text] [decline_text] | off)"}, -{TOK_LICENSELANGSTRING,"LicenseLangString",3,0,"name lang_id license_path"}, -{TOK_LICENSETEXT,"LicenseText",1,1,"license_page_description [license_button_text]"}, -{TOK_LICENSEBKCOLOR,"LicenseBkColor",1,0,"background_color"}, -{TOK_LOADNLF,"LoadLanguageFile",1,0,"language.nlf"}, -{TOK_LOGSET,"LogSet",1,0,"on|off"}, -{TOK_LOGTEXT,"LogText",1,0,"text"}, +{TOK_ABORT,"Abort",0,1,"[message]",TP_CODE}, +{TOK_ADDBRANDINGIMAGE,"AddBrandingImage",2,1,"(top|left|bottom|right) (height|width) [padding]",TP_GLOBAL}, +{TOK_ADDSIZE,"AddSize",1,0,"size_to_add_to_section_in_kb",TP_SEC}, +{TOK_AUTOCLOSE,"AutoCloseWindow",1,0,"(false|true)",TP_GLOBAL}, +{TOK_BGGRADIENT,"BGGradient",0,3,"(off | [top_color [bottom_color [text_color]]])",TP_GLOBAL}, +{TOK_BRANDINGTEXT,"BrandingText",1,1,"[/TRIM(LEFT|RIGHT|CENTER)] installer_text",TP_GLOBAL}, +{TOK_BRINGTOFRONT,"BringToFront",0,0,"",TP_CODE}, +{TOK_CALL,"Call",1,0,"function_name | [:label_name]",TP_CODE}, +{TOK_CALLINSTDLL,"CallInstDLL",2,1,"dll_path_on_target.dll [/NOUNLOAD] function",TP_CODE}, +{TOK_CAPTION,"Caption",1,0,"installer_caption",TP_GLOBAL|TP_PAGEEX}, +{TOK_CHANGEUI,"ChangeUI",1,1,"[/RTL] (all|dlg_id) ui_file.exe",TP_GLOBAL}, +{TOK_CLEARERRORS,"ClearErrors",0,0,"",TP_CODE}, +{TOK_COMPTEXT,"ComponentText",0,3,"[component_page_description] [component_subtext1] [component_subtext2]",TP_PG}, +{TOK_GETDLLVERSION,"GetDLLVersion",3,0,"filename $(user_var: high output) $(user_var: low output)",TP_CODE}, +{TOK_GETDLLVERSIONLOCAL,"GetDLLVersionLocal",3,0,"localfilename $(user_var: high output) $(user_var: low output)",TP_CODE}, +{TOK_GETFILETIME,"GetFileTime",3,0,"file $(user_var: high output) $(user_var: low output)",TP_CODE}, +{TOK_GETFILETIMELOCAL,"GetFileTimeLocal",3,0,"localfile $(user_var: high output) $(user_var: low output)",TP_CODE}, +{TOK_COPYFILES,"CopyFiles",2,3,"[/SILENT] [/FILESONLY] source_path destination_path [total_size_in_kb]",TP_CODE}, +{TOK_CRCCHECK,"CRCCheck",1,0,"(on|force|off)",TP_GLOBAL}, +{TOK_CREATEDIR,"CreateDirectory",1,0,"directory_name",TP_CODE}, +{TOK_CREATEFONT,"CreateFont",2,5,"$(user_var: handle output) face_name [height wieght /ITALIC /UNDERLINE /STRIKE]",TP_CODE}, +{TOK_CREATESHORTCUT,"CreateShortCut",2,6,"shortcut_name.lnk shortcut_target [parameters [icon_file [icon index [showmode [hotkey [comment]]]]]]\n showmode=(SW_SHOWNORMAL|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED)\n hotkey=(ALT|CONTROL|EXT|SHIFT)|(F1-F24|A-Z)",TP_CODE}, +{TOK_DBOPTIMIZE,"SetDatablockOptimize",1,0,"(off|on)",TP_ALL}, +{TOK_DELETEINISEC,"DeleteINISec",2,0,"ini_file section_name",TP_CODE}, +{TOK_DELETEINISTR,"DeleteINIStr",3,0,"ini_file section_name entry_name",TP_CODE}, +{TOK_DELETEREGKEY,"DeleteRegKey",2,1,"[/ifempty] root_key subkey\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)",TP_CODE}, +{TOK_DELETEREGVALUE,"DeleteRegValue",3,0,"root_key subkey entry_name\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)",TP_CODE}, +{TOK_DELETE,"Delete",1,1,"[/REBOOTOK] filespec",TP_CODE}, +{TOK_DETAILPRINT,"DetailPrint",1,0,"message",TP_CODE}, +{TOK_DIRTEXT,"DirText",0,4,"[directory_page_description] [directory_page_subtext] [browse_button_text] [browse_dlg_text]",TP_PG}, +//{TOK_DIRSHOW,"DirShow",1,0,"(show|hide)",TP_PG}, +{TOK_DIRSHOW,"DirShow",0,0,"doesn't currently work",TP_ALL}, +{TOK_DIRVAR,"DirVar",1,0,"$(user_var: dir in/out))",TP_PAGEEX}, +{TOK_DIRVERIFY,"DirVerify",1,0,"auto|leave",TP_PAGEEX}, +{TOK_GETINSTDIRERROR,"GetInstDirError",1,0,"$(user_var: error output)",TP_CODE}, +{TOK_ROOTDIRINST,"AllowRootDirInstall",1,0,"(true|false)",TP_GLOBAL}, +{TOK_CHECKBITMAP,"CheckBitmap",1,0,"local_bitmap.bmp",TP_GLOBAL}, +{TOK_ENABLEWINDOW,"EnableWindow",2,0,"hwnd (1|0)",TP_CODE}, +{TOK_ENUMREGKEY,"EnumRegKey",4,0,"$(user_var: output) rootkey subkey index\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)",TP_CODE}, +{TOK_ENUMREGVAL,"EnumRegValue",4,0,"$(user_var: output) rootkey subkey index\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)",TP_CODE}, +{TOK_EXCH,"Exch",0,1,"[$(user_var)] | [stack_item_index]",TP_CODE}, +{TOK_EXEC,"Exec",1,0,"command_line",TP_CODE}, +{TOK_EXECWAIT,"ExecWait",1,1,"command_line [$(user_var: return value)]",TP_CODE}, +{TOK_EXECSHELL,"ExecShell",2,2,"(open|print|etc) command_line [parameters [showmode]]\n showmode=(SW_SHOWNORMAL|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED)",TP_CODE}, +{TOK_EXPANDENVSTRS,"ExpandEnvStrings",2,0,"$(user_var: output) string",TP_CODE}, +{TOK_FINDWINDOW,"FindWindow",2,3,"$(user_var: handle output) WindowClass [WindowTitle] [Window_Parent] [Child_After]",TP_CODE}, +{TOK_FINDCLOSE,"FindClose",1,0,"$(user_var: handle input)",TP_CODE}, +{TOK_FINDFIRST,"FindFirst",3,0,"$(user_var: handle output) $(user_var: filename output) filespec",TP_CODE}, +{TOK_FINDNEXT,"FindNext",2,0,"$(user_var: handle input) $(user_var: filename output)",TP_CODE}, +{TOK_FILE,"File",1,-1,"[/nonfatal] [/a] ([/r] filespec [...]|/oname=outfile one_file_only)",TP_CODE}, +{TOK_FILEBUFSIZE,"FileBufSize",1,0,"buf_size_mb",TP_ALL}, +{TOK_FLUSHINI,"FlushINI",1,0,"ini_file",TP_CODE}, +{TOK_RESERVEFILE,"ReserveFile",1,-1,"[/nonfatal] [/r] file [file...]",TP_ALL}, +{TOK_FILECLOSE,"FileClose",1,0,"$(user_var: handle input)",TP_CODE}, +{TOK_FILEERRORTEXT,"FileErrorText",0,2,"[text (can contain $0)] [text without ignore (can contain $0)]",TP_GLOBAL}, +{TOK_FILEOPEN,"FileOpen",3,0,"$(user_var: handle output) filename openmode\n openmode=r|w|a",TP_CODE}, +{TOK_FILEREAD,"FileRead",2,1,"$(user_var: handle input) $(user_var: text output) [maxlen]",TP_CODE}, +{TOK_FILEWRITE,"FileWrite",2,0,"$(user_var: handle input) text",TP_CODE}, +{TOK_FILEREADBYTE,"FileReadByte",2,0,"$(user_var: handle input) $(user_var: bytevalue output)",TP_CODE}, +{TOK_FILEWRITEBYTE,"FileWriteByte",2,0,"$(user_var: handle input) bytevalue",TP_CODE}, +{TOK_FILESEEK,"FileSeek",2,2,"$(user_var: handle input) offset [mode] [$(user_var: new position output)]\n mode=SET|CUR|END",TP_CODE}, +{TOK_FUNCTION,"Function",1,0,"function_name",TP_GLOBAL}, +{TOK_FUNCTIONEND,"FunctionEnd",0,0,"",TP_FUNC}, +{TOK_GETDLGITEM,"GetDlgItem",3,0,"$(user_var: handle output) dialog item_id",TP_CODE}, +{TOK_GETFULLPATHNAME,"GetFullPathName",2,1,"[/SHORT] $(user_var: result) path_or_file",TP_CODE}, +{TOK_GETTEMPFILENAME,"GetTempFileName",1,1,"$(user_var: name output) [base_dir]",TP_CODE}, +{TOK_HIDEWINDOW,"HideWindow",0,0,"",TP_CODE}, +{TOK_ICON,"Icon",1,0,"local_icon.ico",TP_GLOBAL}, +{TOK_IFABORT,"IfAbort",1,1,"label_to_goto_if_abort [label_to_goto_if_no_abort]",TP_CODE}, +{TOK_IFERRORS,"IfErrors",1,1,"label_to_goto_if_errors [label_to_goto_if_no_errors]",TP_CODE}, +{TOK_IFFILEEXISTS,"IfFileExists",2,1,"filename label_to_goto_if_file_exists [label_to_goto_otherwise]",TP_CODE}, +{TOK_IFREBOOTFLAG,"IfRebootFlag",1,1,"jump_if_set [jump_if_not_set]",TP_CODE}, +{TOK_IFSILENT,"IfSilent",1,1,"jump_if_silent [jump_if_not_silent]",TP_CODE}, +{TOK_INSTALLDIRREGKEY,"InstallDirRegKey",3,0,"root_key subkey entry_name\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)",TP_GLOBAL}, +{TOK_INSTCOLORS,"InstallColors",1,1,"(/windows | (foreground_color background_color))",TP_GLOBAL}, +{TOK_INSTDIR,"InstallDir",1,0,"default_install_directory",TP_GLOBAL}, +{TOK_INSTPROGRESSFLAGS,"InstProgressFlags",0,-1,"[flag [...]]\n flag={smooth|colored}",TP_GLOBAL}, +{TOK_INSTTYPE,"InstType",1,0,"[un.]install_type_name | /NOCUSTOM | /CUSTOMSTRING=str | /COMPONENTSONLYONCUSTOM",TP_GLOBAL}, +{TOK_INTOP,"IntOp",3,1,"$(user_var: result) val1 OP [val2]\n OP=(+ - * / % | & ^ ~ ! || &&)",TP_CODE}, +{TOK_INTCMP,"IntCmp",3,2,"val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]",TP_CODE}, +{TOK_INTCMPU,"IntCmpU",3,2,"val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]",TP_CODE}, +{TOK_INTFMT,"IntFmt",3,0,"$(user_var: output) format_string input",TP_CODE}, +{TOK_ISWINDOW,"IsWindow",2,1,"hwnd jump_if_window [jump_if_not_window]",TP_CODE}, +{TOK_GOTO,"Goto",1,0,"label",TP_CODE}, +{TOK_LANGSTRING,"LangString",3,0,"[un.]name lang_id string",TP_GLOBAL}, +{TOK_LANGSTRINGUP,"LangStringUP",0,0,"obsolete, use LangString.",TP_ALL}, +{TOK_LICENSEDATA,"LicenseData",1,0,"local_file_that_has_license_text | license_lang_string",TP_PG}, +{TOK_LICENSEFORCESELECTION,"LicenseForceSelection",1,2,"(checkbox [accept_text] | radiobuttons [accept_text] [decline_text] | off)",TP_PG}, +{TOK_LICENSELANGSTRING,"LicenseLangString",3,0,"name lang_id license_path",TP_GLOBAL}, +{TOK_LICENSETEXT,"LicenseText",1,1,"license_page_description [license_button_text]",TP_PG}, +{TOK_LICENSEBKCOLOR,"LicenseBkColor",1,0,"background_color",TP_GLOBAL}, +{TOK_LOADNLF,"LoadLanguageFile",1,0,"language.nlf",TP_GLOBAL}, +{TOK_LOGSET,"LogSet",1,0,"on|off",TP_CODE}, +{TOK_LOGTEXT,"LogText",1,0,"text",TP_CODE}, {TOK_MESSAGEBOX,"MessageBox",2,6,"mode messagebox_text [/SD return] [return_check label_to_goto_if_equal [return_check2 label2]]\n mode=modeflag[|modeflag[|modeflag[...]]]\n " - "modeflag=(MB_ABORTRETRYIGNORE|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_YESNO|MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND|MB_RIGHT"}, -{TOK_NOP,"Nop",0,0,""}, -{TOK_NAME,"Name",1,1,"installer_name installer_name_doubled_ampersands"}, -{TOK_OUTFILE,"OutFile",1,0,"install_output.exe"}, + "modeflag=(MB_ABORTRETRYIGNORE|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_YESNO|MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_TOPMOST|MB_SETFOREGROUND|MB_RIGHT",TP_CODE}, +{TOK_NOP,"Nop",0,0,"",TP_CODE}, +{TOK_NAME,"Name",1,1,"installer_name installer_name_doubled_ampersands",TP_GLOBAL}, +{TOK_OUTFILE,"OutFile",1,0,"install_output.exe",TP_GLOBAL}, #ifdef NSIS_SUPPORT_CODECALLBACKS -{TOK_PAGE,"Page",1,4,"((custom [creator_function] [leave_function] [caption]) | ((license|components|directory|instfiles|uninstConfirm) [pre_function] [show_function] [leave_function]))"}, +{TOK_PAGE,"Page",1,4,"((custom [creator_function] [leave_function] [caption]) | ((license|components|directory|instfiles|uninstConfirm) [pre_function] [show_function] [leave_function]))",TP_GLOBAL}, #else -{TOK_PAGE,"Page",1,1,"license|components|directory|instfiles|uninstConfirm"}, +{TOK_PAGE,"Page",1,1,"license|components|directory|instfiles|uninstConfirm",TP_GLOBAL}, #endif -{TOK_PAGECALLBACKS,"PageCallbacks",0,3,"([creator_function] [leave_function]) | ([pre_function] [show_function] [leave_function])"}, -{TOK_PAGEEX,"PageEx",1,0,"[un.](custom|uninstConfirm|license|components|directory|instfiles)"}, -{TOK_PAGEEXEND,"PageExEnd",0,0,""}, -{TOK_POP,"Pop",1,0,"$(user_var: output)"}, -{TOK_PUSH,"Push",1,0,"string"}, -{TOK_QUIT,"Quit",0,0,""}, -{TOK_READINISTR,"ReadINIStr",4,0,"$(user_var: output) ini_file section entry_name"}, -{TOK_READREGDWORD,"ReadRegDWORD",4,0,"$(user_var: output) rootkey subkey entry\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)"}, -{TOK_READREGSTR,"ReadRegStr",4,0,"$(user_var: output) rootkey subkey entry\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)"}, -{TOK_READENVSTR,"ReadEnvStr",2,0,"$(user_var: output) name"}, -{TOK_REBOOT,"Reboot",0,0,""}, -{TOK_REGDLL,"RegDLL",1,1,"dll_path_on_target.dll [entrypoint_symbol]"}, -{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] [-][un.][section_name] [section index output]"}, -{TOK_SECTIONEND,"SectionEnd",0,0,""}, -{TOK_SECTIONIN,"SectionIn",1,-1,"InstTypeIdx [InstTypeIdx [...]]"}, -{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"}, -{TOK_SECTIONGETFLAGS,"SectionGetFlags",2,0,"section_index $(user_var: output flags)"}, -{TOK_SECTIONSETINSTTYPES,"SectionSetInstTypes",2,0,"section_index inst_types"}, -{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_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_SETCTLCOLORS,"SetCtlColors",2,2,"hwnd [/BRANDING] [text_color] [transparent|bg_color]"}, -{TOK_SETBRANDINGIMAGE,"SetBrandingImage",1,2,"[/IMGID=image_item_id_in_dialog] [/RESIZETOFIT] bitmap.bmp"}, -{TOK_SETCOMPRESS,"SetCompress",1,0,"(off|auto|force)"}, -{TOK_SETCOMPRESSOR,"SetCompressor",1,1,"[/FINAL] (zlib|bzip2|lzma)"}, -{TOK_SETCOMPRESSORDICTSIZE,"SetCompressorDictSize",1,0,"dict_size_mb"}, -{TOK_SETCOMPRESSIONLEVEL,"SetCompressionLevel",1,0,"level_0-9"}, -{TOK_SETDATESAVE,"SetDateSave",1,0,"(off|on)"}, -{TOK_SETDETAILSVIEW,"SetDetailsView",1,0,"(hide|show)"}, -{TOK_SETDETAILSPRINT,"SetDetailsPrint",1,0,"(none|listonly|textonly|both)"}, -{TOK_SETERRORS,"SetErrors",0,0,""}, -{TOK_SETFILEATTRIBUTES,"SetFileAttributes",2,0,"file attribute[|attribute[...]]\n attribute=(NORMAL|ARCHIVE|HIDDEN|OFFLINE|READONLY|SYSTEM|TEMPORARY|0)"}, -{TOK_SETFONT,"SetFont",2,1,"[/LANG=lang_id] font_face_name font_size"}, -{TOK_SETOUTPATH,"SetOutPath",1,0,"output_path"}, -{TOK_SETOVERWRITE,"SetOverwrite",1,0,"on|off|try|ifnewer|ifdiff"}, -{TOK_SETPLUGINUNLOAD,"SetPluginUnload",1,0,"(manual|alwaysoff)"}, -{TOK_SETREBOOTFLAG,"SetRebootFlag",1,0,"true|false"}, -{TOK_SETSHELLVARCONTEXT,"SetShellVarContext",1,0,"all|current"}, -{TOK_SETSILENT,"SetSilent",1,0,"silent|normal"}, -{TOK_SHOWDETAILS,"ShowInstDetails",1,0,"(hide|show|nevershow)"}, -{TOK_SHOWDETAILSUNINST,"ShowUninstDetails",1,0,"(hide|show|nevershow)"}, -{TOK_SHOWWINDOW,"ShowWindow",2,0,"hwnd show_state"}, -{TOK_SILENTINST,"SilentInstall",1,0,"(normal|silent|silentlog)"}, -{TOK_SILENTUNINST,"SilentUnInstall",1,0,"(normal|silent)"}, -{TOK_SLEEP,"Sleep",1,0,"sleep_time_in_ms"}, -{TOK_STRCMP,"StrCmp",3,1,"str1 str2 label_to_goto_if_equal [label_to_goto_if_not]"}, -{TOK_STRCPY,"StrCpy",2,2,"$(user_var: output) str [maxlen] [startoffset]"}, -{TOK_STRLEN,"StrLen",2,0,"$(user_var: length output) str"}, -{TOK_SUBCAPTION,"SubCaption",2,0,"page_number(0-4) new_subcaption"}, -{TOK_UNINSTALLEXENAME,"UninstallExeName",0,0,"no longer supported, use WriteUninstaller from section."}, -{TOK_UNINSTCAPTION,"UninstallCaption",1,0,"uninstaller_caption"}, -{TOK_UNINSTICON,"UninstallIcon",1,0,"icon_on_local_system.ico"}, +{TOK_PAGECALLBACKS,"PageCallbacks",0,3,"([creator_function] [leave_function]) | ([pre_function] [show_function] [leave_function])",TP_PAGEEX}, +{TOK_PAGEEX,"PageEx",1,0,"[un.](custom|uninstConfirm|license|components|directory|instfiles)",TP_GLOBAL}, +{TOK_PAGEEXEND,"PageExEnd",0,0,"",TP_PAGEEX}, +{TOK_POP,"Pop",1,0,"$(user_var: output)",TP_CODE}, +{TOK_PUSH,"Push",1,0,"string",TP_CODE}, +{TOK_QUIT,"Quit",0,0,"",TP_CODE}, +{TOK_READINISTR,"ReadINIStr",4,0,"$(user_var: output) ini_file section entry_name",TP_CODE}, +{TOK_READREGDWORD,"ReadRegDWORD",4,0,"$(user_var: output) rootkey subkey entry\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)",TP_CODE}, +{TOK_READREGSTR,"ReadRegStr",4,0,"$(user_var: output) rootkey subkey entry\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)",TP_CODE}, +{TOK_READENVSTR,"ReadEnvStr",2,0,"$(user_var: output) name",TP_CODE}, +{TOK_REBOOT,"Reboot",0,0,"",TP_CODE}, +{TOK_REGDLL,"RegDLL",1,1,"dll_path_on_target.dll [entrypoint_symbol]",TP_CODE}, +{TOK_RENAME,"Rename",2,1,"[/REBOOTOK] source_file destination_file",TP_CODE}, +{TOK_RET,"Return",0,0,"",TP_CODE}, +{TOK_RMDIR,"RMDir",1,1,"[/r|/REBOOTOK] directory_name",TP_CODE}, +{TOK_SECTION,"Section",0,3,"[/0] [-][un.][section_name] [section index output]",TP_GLOBAL}, +{TOK_SECTIONEND,"SectionEnd",0,0,"",TP_SEC}, +{TOK_SECTIONIN,"SectionIn",1,-1,"InstTypeIdx [InstTypeIdx [...]]",TP_SEC}, +{TOK_SUBSECTION,"SubSection",1,2,"[/e] [un.]subsection_name [section index output]",TP_GLOBAL}, +{TOK_SUBSECTIONEND,"SubSectionEnd",0,0,"",TP_GLOBAL}, +{TOK_SEARCHPATH,"SearchPath",2,0,"$(user_var: result) filename",TP_CODE}, +{TOK_SECTIONSETFLAGS,"SectionSetFlags",2,0,"section_index flags",TP_CODE}, +{TOK_SECTIONGETFLAGS,"SectionGetFlags",2,0,"section_index $(user_var: output flags)",TP_CODE}, +{TOK_SECTIONSETINSTTYPES,"SectionSetInstTypes",2,0,"section_index inst_types",TP_CODE}, +{TOK_SECTIONGETINSTTYPES,"SectionGetInstTypes",2,0,"section_index $(user_var: output inst_types)",TP_CODE}, +{TOK_SECTIONGETTEXT,"SectionGetText",2,0,"section_index $(user_var: output text)",TP_CODE}, +{TOK_SECTIONSETTEXT,"SectionSetText",2,0,"section_index text_string",TP_CODE}, +{TOK_SECTIONGETSIZE,"SectionGetSize",2,0,"section_index $(user_var: output size)",TP_CODE}, +{TOK_SECTIONSETSIZE,"SectionSetSize",2,0,"section_index new_size",TP_CODE}, +{TOK_GETCURINSTTYPE,"GetCurInstType",1,0,"$(user_var: output inst_type_idx)",TP_CODE}, +{TOK_SETCURINSTTYPE,"SetCurInstType",1,0,"inst_type_idx",TP_CODE}, +{TOK_INSTTYPESETTEXT,"InstTypeSetText",2,0,"insttype_index flags",TP_CODE}, +{TOK_INSTTYPEGETTEXT,"InstTypeGetText",2,0,"insttype_index $(user_var: output flags)",TP_CODE}, +{TOK_SENDMESSAGE,"SendMessage",4,2,"hwnd message [wparam|STR:wParam] [lparam|STR:lParam] [$(user_var: return value)] [/TIMEOUT=X]",TP_CODE}, +{TOK_SETAUTOCLOSE,"SetAutoClose",1,0,"(false|true)",TP_CODE}, +{TOK_SETCTLCOLORS,"SetCtlColors",2,2,"hwnd [/BRANDING] [text_color] [transparent|bg_color]",TP_CODE}, +{TOK_SETBRANDINGIMAGE,"SetBrandingImage",1,2,"[/IMGID=image_item_id_in_dialog] [/RESIZETOFIT] bitmap.bmp",TP_CODE}, +{TOK_SETCOMPRESS,"SetCompress",1,0,"(off|auto|force)",TP_ALL}, +{TOK_SETCOMPRESSOR,"SetCompressor",1,1,"[/FINAL] (zlib|bzip2|lzma)",TP_GLOBAL}, +{TOK_SETCOMPRESSORDICTSIZE,"SetCompressorDictSize",1,0,"dict_size_mb",TP_ALL}, +{TOK_SETCOMPRESSIONLEVEL,"SetCompressionLevel",1,0,"level_0-9",TP_ALL}, +{TOK_SETDATESAVE,"SetDateSave",1,0,"(off|on)",TP_ALL}, +{TOK_SETDETAILSVIEW,"SetDetailsView",1,0,"(hide|show)",TP_CODE}, +{TOK_SETDETAILSPRINT,"SetDetailsPrint",1,0,"(none|listonly|textonly|both)",TP_CODE}, +{TOK_SETERRORS,"SetErrors",0,0,"",TP_CODE}, +{TOK_SETFILEATTRIBUTES,"SetFileAttributes",2,0,"file attribute[|attribute[...]]\n attribute=(NORMAL|ARCHIVE|HIDDEN|OFFLINE|READONLY|SYSTEM|TEMPORARY|0)",TP_CODE}, +{TOK_SETFONT,"SetFont",2,1,"[/LANG=lang_id] font_face_name font_size",TP_GLOBAL}, +{TOK_SETOUTPATH,"SetOutPath",1,0,"output_path",TP_CODE}, +{TOK_SETOVERWRITE,"SetOverwrite",1,0,"on|off|try|ifnewer|ifdiff",TP_ALL}, +{TOK_SETPLUGINUNLOAD,"SetPluginUnload",1,0,"(manual|alwaysoff)",TP_ALL}, +{TOK_SETREBOOTFLAG,"SetRebootFlag",1,0,"true|false",TP_CODE}, +{TOK_SETSHELLVARCONTEXT,"SetShellVarContext",1,0,"all|current",TP_CODE}, +{TOK_SETSILENT,"SetSilent",1,0,"silent|normal",TP_CODE}, +{TOK_SHOWDETAILS,"ShowInstDetails",1,0,"(hide|show|nevershow)",TP_GLOBAL}, +{TOK_SHOWDETAILSUNINST,"ShowUninstDetails",1,0,"(hide|show|nevershow)",TP_GLOBAL}, +{TOK_SHOWWINDOW,"ShowWindow",2,0,"hwnd show_state",TP_CODE}, +{TOK_SILENTINST,"SilentInstall",1,0,"(normal|silent|silentlog)",TP_GLOBAL}, +{TOK_SILENTUNINST,"SilentUnInstall",1,0,"(normal|silent)",TP_GLOBAL}, +{TOK_SLEEP,"Sleep",1,0,"sleep_time_in_ms",TP_CODE}, +{TOK_STRCMP,"StrCmp",3,1,"str1 str2 label_to_goto_if_equal [label_to_goto_if_not]",TP_CODE}, +{TOK_STRCPY,"StrCpy",2,2,"$(user_var: output) str [maxlen] [startoffset]",TP_CODE}, +{TOK_STRLEN,"StrLen",2,0,"$(user_var: length output) str",TP_CODE}, +{TOK_SUBCAPTION,"SubCaption",2,0,"page_number(0-4) new_subcaption",TP_GLOBAL}, +{TOK_UNINSTALLEXENAME,"UninstallExeName",0,0,"no longer supported, use WriteUninstaller from section.",TP_ALL}, +{TOK_UNINSTCAPTION,"UninstallCaption",1,0,"uninstaller_caption",TP_GLOBAL}, +{TOK_UNINSTICON,"UninstallIcon",1,0,"icon_on_local_system.ico",TP_GLOBAL}, #ifdef NSIS_SUPPORT_CODECALLBACKS -{TOK_UNINSTPAGE,"UninstPage",1,4,"((custom [creator_function] [leave_function] [caption]) | ((license|components|directory|instfiles|uninstConfirm) [pre_function] [show_function] [leave_function]))"}, +{TOK_UNINSTPAGE,"UninstPage",1,4,"((custom [creator_function] [leave_function] [caption]) | ((license|components|directory|instfiles|uninstConfirm) [pre_function] [show_function] [leave_function]))",TP_GLOBAL}, #else -{TOK_UNINSTPAGE,"UninstPage",1,1,"license|components|directory|instfiles|uninstConfirm"}, +{TOK_UNINSTPAGE,"UninstPage",1,1,"license|components|directory|instfiles|uninstConfirm",TP_GLOBAL}, #endif -{TOK_UNINSTTEXT,"UninstallText",1,1,"Text_to_go_on_uninstall_page [subtext]"}, -{TOK_UNINSTSUBCAPTION,"UninstallSubCaption",2,0,"page_number(0-2) new_subcaption"}, -{TOK_UNREGDLL,"UnRegDLL",1,0,"dll_path_on_target.dll"}, -// useless - {TOK_USEOUTERUIITEM,"UseOuterUIItem",2,0,"item id"}, -{TOK_WINDOWICON,"WindowIcon",1,0,"on|off"}, -{TOK_WRITEINISTR,"WriteINIStr",4,0,"ini_file section_name entry_name new_value"}, -{TOK_WRITEREGBIN,"WriteRegBin",4,0,"rootkey subkey entry_name hex_string_like_12848412AB\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)"}, -{TOK_WRITEREGDWORD,"WriteRegDWORD",4,0,"rootkey subkey entry_name new_value_dword\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)"}, -{TOK_WRITEREGSTR,"WriteRegStr",4,0,"rootkey subkey entry_name new_value_string\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)"}, -{TOK_WRITEREGEXPANDSTR,"WriteRegExpandStr",4,0,"rootkey subkey entry_name new_value_string\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)"}, -{TOK_WRITEUNINSTALLER,"WriteUninstaller",1,0,"uninstall_exe_name"}, -{TOK_XPSTYLE, "XPStyle",1,0,"(on|off)"}, -{TOK_P_PACKEXEHEADER,"!packhdr",2,0,"temp_file_name command_line_to_compress_that_temp_file"}, -{TOK_P_SYSTEMEXEC,"!system",1,2,"command [<|>|<>|=) retval]"}, -{TOK_P_ADDINCLUDEDIR,"!AddIncludeDir",1,0,"dir"}, -{TOK_P_INCLUDE,"!include",1,0,"filename.nsi"}, -{TOK_P_CD,"!cd",1,0,"absolute_or_relative_new_directory"}, -{TOK_P_IFDEF,"!ifdef",1,-1,"symbol [| symbol2 [& symbol3 [...]]]"}, -{TOK_P_IFNDEF,"!ifndef",1,-1,"symbol [| symbol2 [& symbol3 [...]]]"}, -{TOK_P_ENDIF,"!endif",0,0,""}, -{TOK_P_DEFINE,"!define",1,1,"symbol [value]"}, -{TOK_P_UNDEF,"!undef",1,1,"symbol [value]"}, -{TOK_P_ELSE,"!else",0,-1,"[ifdef|ifndef symbol [|symbol2 [& symbol3 [...]]]]"}, -{TOK_P_ECHO,"!echo",1,0,"message"}, -{TOK_P_WARNING,"!warning",0,1,"[warning_message]"}, -{TOK_P_ERROR,"!error",0,1,"[error_message]"}, +{TOK_UNINSTTEXT,"UninstallText",1,1,"Text_to_go_on_uninstall_page [subtext]",TP_PG}, +{TOK_UNINSTSUBCAPTION,"UninstallSubCaption",2,0,"page_number(0-2) new_subcaption",TP_GLOBAL}, +{TOK_UNREGDLL,"UnRegDLL",1,0,"dll_path_on_target.dll",TP_CODE}, +{TOK_WINDOWICON,"WindowIcon",1,0,"on|off",TP_GLOBAL}, +{TOK_WRITEINISTR,"WriteINIStr",4,0,"ini_file section_name entry_name new_value",TP_CODE}, +{TOK_WRITEREGBIN,"WriteRegBin",4,0,"rootkey subkey entry_name hex_string_like_12848412AB\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)",TP_CODE}, +{TOK_WRITEREGDWORD,"WriteRegDWORD",4,0,"rootkey subkey entry_name new_value_dword\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)",TP_CODE}, +{TOK_WRITEREGSTR,"WriteRegStr",4,0,"rootkey subkey entry_name new_value_string\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)",TP_CODE}, +{TOK_WRITEREGEXPANDSTR,"WriteRegExpandStr",4,0,"rootkey subkey entry_name new_value_string\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)",TP_CODE}, +{TOK_WRITEUNINSTALLER,"WriteUninstaller",1,0,"uninstall_exe_name",TP_CODE}, +{TOK_XPSTYLE, "XPStyle",1,0,"(on|off)",TP_GLOBAL}, +{TOK_P_PACKEXEHEADER,"!packhdr",2,0,"temp_file_name command_line_to_compress_that_temp_file",TP_ALL}, +{TOK_P_SYSTEMEXEC,"!system",1,2,"command [<|>|<>|=) retval]",TP_ALL}, +{TOK_P_ADDINCLUDEDIR,"!AddIncludeDir",1,0,"dir",TP_ALL}, +{TOK_P_INCLUDE,"!include",1,0,"filename.nsi",TP_ALL}, +{TOK_P_CD,"!cd",1,0,"absolute_or_relative_new_directory",TP_ALL}, +{TOK_P_IFDEF,"!ifdef",1,-1,"symbol [| symbol2 [& symbol3 [...]]]",TP_ALL}, +{TOK_P_IFNDEF,"!ifndef",1,-1,"symbol [| symbol2 [& symbol3 [...]]]",TP_ALL}, +{TOK_P_ENDIF,"!endif",0,0,"",TP_ALL}, +{TOK_P_DEFINE,"!define",1,1,"symbol [value]",TP_ALL}, +{TOK_P_UNDEF,"!undef",1,1,"symbol [value]",TP_ALL}, +{TOK_P_ELSE,"!else",0,-1,"[ifdef|ifndef symbol [|symbol2 [& symbol3 [...]]]]",TP_ALL}, +{TOK_P_ECHO,"!echo",1,0,"message",TP_ALL}, +{TOK_P_WARNING,"!warning",0,1,"[warning_message]",TP_ALL}, +{TOK_P_ERROR,"!error",0,1,"[error_message]",TP_ALL}, -{TOK_P_VERBOSE,"!verbose",1,0,"verbose_level | push | pop"}, +{TOK_P_VERBOSE,"!verbose",1,0,"verbose_level | push | pop",TP_ALL}, -{TOK_P_MACRO,"!macro",1,-1,"macroname [parms ...]"}, -{TOK_P_MACROEND,"!macroend",0,0,""}, -{TOK_P_INSERTMACRO,"!insertmacro",1,-1,"macroname [parms ...]"}, -{TOK_P_IFMACRODEF,"!ifmacrodef",1,-1,"macro [| macro2 [& macro3 [...]]]"}, -{TOK_P_IFMACRONDEF,"!ifmacrondef",1,-1,"macro [| macro2 [& macro3 [...]]]"}, +{TOK_P_MACRO,"!macro",1,-1,"macroname [parms ...]",TP_ALL}, +{TOK_P_MACROEND,"!macroend",0,0,"",TP_ALL}, +{TOK_P_INSERTMACRO,"!insertmacro",1,-1,"macroname [parms ...]",TP_ALL}, +{TOK_P_IFMACRODEF,"!ifmacrodef",1,-1,"macro [| macro2 [& macro3 [...]]]",TP_ALL}, +{TOK_P_IFMACRONDEF,"!ifmacrondef",1,-1,"macro [| macro2 [& macro3 [...]]]",TP_ALL}, -{TOK_MISCBUTTONTEXT,"MiscButtonText",0,4,"[back button text] [next button text] [cancel button text] [close button text]"}, -{TOK_DETAILSBUTTONTEXT,"DetailsButtonText",0,1,"[details button text]"}, -{TOK_UNINSTBUTTONTEXT,"UninstallButtonText",0,1,"[uninstall button text]"}, -{TOK_INSTBUTTONTEXT,"InstallButtonText",0,1,"[install button text]"}, -{TOK_SPACETEXTS,"SpaceTexts",0,2,"none | ([space required text] [space available text])"}, -{TOK_COMPLETEDTEXT,"CompletedText",0,2,"[completed text]"}, +{TOK_MISCBUTTONTEXT,"MiscButtonText",0,4,"[back button text] [next button text] [cancel button text] [close button text]",TP_GLOBAL}, +{TOK_DETAILSBUTTONTEXT,"DetailsButtonText",0,1,"[details button text]",TP_PG}, +{TOK_UNINSTBUTTONTEXT,"UninstallButtonText",0,1,"[uninstall button text]",TP_GLOBAL}, +{TOK_INSTBUTTONTEXT,"InstallButtonText",0,1,"[install button text]",TP_GLOBAL}, +{TOK_SPACETEXTS,"SpaceTexts",0,2,"none | ([space required text] [space available text])",TP_GLOBAL}, +{TOK_COMPLETEDTEXT,"CompletedText",0,2,"[completed text]",TP_PG}, -{TOK_GETFUNCTIONADDR,"GetFunctionAddress",2,0,"output function"}, -{TOK_GETLABELADDR,"GetLabelAddress",2,0,"output label"}, -{TOK_GETCURRENTADDR,"GetCurrentAddress",1,0,"output"}, +{TOK_GETFUNCTIONADDR,"GetFunctionAddress",2,0,"output function",TP_CODE}, +{TOK_GETLABELADDR,"GetLabelAddress",2,0,"output label",TP_CODE}, +{TOK_GETCURRENTADDR,"GetCurrentAddress",1,0,"output",TP_CODE}, -{TOK_PLUGINDIR,"!AddPluginDir",1,0,"new_plugin_directory"}, -{TOK_INITPLUGINSDIR,"InitPluginsDir",0,0,""}, +{TOK_PLUGINDIR,"!AddPluginDir",1,0,"new_plugin_directory",TP_ALL}, +{TOK_INITPLUGINSDIR,"InitPluginsDir",0,0,"",TP_CODE}, // Added by ramon 23 May 2003 -{TOK_ALLOWSKIPFILES,"AllowSkipFiles",1,0,"(off|on)"}, +{TOK_ALLOWSKIPFILES,"AllowSkipFiles",1,0,"(off|on)",TP_ALL}, // Added by ramon 3 jun 2003 -{TOK_DEFVAR,"Var",1,0,"VarName"}, +{TOK_DEFVAR,"Var",1,0,"VarName",TP_GLOBAL}, // Added by ramon 6 jun 2003 -{TOK_VI_ADDKEY,"VIAddVersionKey",2,1,"/LANG=lang_id keyname value"}, -{TOK_VI_SETPRODUCTVERSION,"VIProductVersion",1,0,"[version_string_X.X.X.X]"}, -{TOK_LOCKWINDOW,"LockWindow",1,0,"(on|off)"}, +{TOK_VI_ADDKEY,"VIAddVersionKey",2,1,"/LANG=lang_id keyname value",TP_GLOBAL}, +{TOK_VI_SETPRODUCTVERSION,"VIProductVersion",1,0,"[version_string_X.X.X.X]",TP_GLOBAL}, +{TOK_LOCKWINDOW,"LockWindow",1,0,"(on|off)",TP_CODE}, }; void CEXEBuild::print_help(char *commandname) @@ -260,14 +270,14 @@ void CEXEBuild::print_help(char *commandname) if (commandname) break; } } - if (x == TOK__LAST && commandname)\ + if (x == TOK__LAST && commandname) { ERROR_MSG("Invalid command \"%s\"\n",commandname); } } -int CEXEBuild::get_commandtoken(char *s, int *np, int *op) +int CEXEBuild::get_commandtoken(char *s, int *np, int *op, int *pos) { int x; for (x = 0; x < TOK__LAST; x ++) @@ -275,7 +285,76 @@ int CEXEBuild::get_commandtoken(char *s, int *np, int *op) { *np=tokenlist[x].num_parms; *op=tokenlist[x].opt_parms; + *pos=x; return tokenlist[x].id; } return -1; } + +int CEXEBuild::IsTokenPlacedRight(int pos, char *tok) +{ + if ((unsigned int) pos > (sizeof(tokenlist) / sizeof(tokenType))) + return PS_OK; + + int tp = tokenlist[pos].placement; + if (build_cursection && !build_cursection_isfunc) + { + // section + if (tp & TP_SEC) + return PS_OK; + ERROR_MSG("Error: command %s not valid in section\n", tok); + return PS_ERROR; + } + else if (build_cursection && build_cursection_isfunc) + { + // function + if (tp & TP_FUNC) + return PS_OK; + ERROR_MSG("Error: command %s not valid in function\n", tok); + return PS_ERROR; + } + else if (cur_page) + { + // pageex + if (tp & TP_PAGEEX) + return PS_OK; + ERROR_MSG("Error: command %s not valid in PageEx\n", tok); + return PS_ERROR; + } + else + { + // global + if (tp & TP_GLOBAL) + return PS_OK; + char err[1024]; + strcpy(err, "Error: command %s not valid outside "); + if (tp & TP_SEC) + strcat(err, "section"); + if (tp & TP_FUNC) + { + if (tp & TP_SEC) + { + if (tp & TP_PAGEEX) + { + strcat(err, ", "); + } + else + { + strcat(err, " or "); + } + } + strcat(err, "function"); + } + if (tp & TP_PAGEEX) + { + if (tp & TP_CODE) + { + strcat(err, " or "); + } + strcat(err, "PageEx"); + } + strcat(err, "\n"); + ERROR_MSG(err, tok); + return PS_ERROR; + } +} \ No newline at end of file