diff --git a/Source/build.cpp b/Source/build.cpp index 46ac12f7..768b03d0 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -1835,6 +1835,7 @@ void CEXEBuild::print_warnings() void CEXEBuild::build_plugin_table(void) { plugin_used = false; + uninst_plugin_used = false; char* nsisdir = definedlist.find("NSISDIR"); if (nsisdir) { @@ -1933,7 +1934,7 @@ again: ret=function_end(); if (ret != PS_OK) return ret; - if (uninstaller_writes_used && !uninstall) { + if (uninst_plugin_used && !uninstall) { add_function("un.Initialize_____Plugins"); uninstall = true; goto again; diff --git a/Source/build.h b/Source/build.h index f48fc296..0d7c6e6b 100644 --- a/Source/build.h +++ b/Source/build.h @@ -116,6 +116,7 @@ class CEXEBuild { // Added by Ximon Eighteen 5th August 2002 Plugins m_plugins; bool plugin_used; + bool uninst_plugin_used; #endif //NSIS_CONFIG_PLUGIN_SUPPORT // build.cpp functions used mostly within build.cpp diff --git a/Source/exehead/exec.c b/Source/exehead/exec.c index ca978bff..16f351e9 100644 --- a/Source/exehead/exec.c +++ b/Source/exehead/exec.c @@ -841,7 +841,7 @@ static int NSISCALL ExecuteEntry(entry *entries, int pos) update_status_text_from_lang(LANGID_CANNOTFINDSYMBOL,buf2); log_printf3("Error registering DLL: %s not found in %s",buf2,buf); } - FreeLibrary(h); + if (!parm3) FreeLibrary(h); } else { diff --git a/Source/exehead/fileform.h b/Source/exehead/fileform.h index 90fb3ab5..6bc58233 100644 --- a/Source/exehead/fileform.h +++ b/Source/exehead/fileform.h @@ -79,7 +79,7 @@ enum EW_GETDLLVERSION, // GetDLLVersion: 3 [file highout lowout] - EW_REGISTERDLL, // Register DLL: 3,[DLL file name, string ptr of function to call, text to put in display (<0 if none/pass parms)] + EW_REGISTERDLL, // Register DLL: 3,[DLL file name, string ptr of function to call, text to put in display (<0 if none/pass parms), 1 - no unload, 0 - unload] EW_CREATESHORTCUT, // Make Shortcut: 5, [link file, target file, parameters, icon file, iconindex|show mode<<8|hotkey<<16] diff --git a/Source/script.cpp b/Source/script.cpp index f0bd6984..17eefb68 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -2028,7 +2028,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char } else if (which_token == TOK_CALLINSTDLL) { - ent.offsets[1] = add_string(line.gettoken_str(2)); + int a = 2; + if (!stricmp(line.gettoken_str(a++), "/NOUNLOAD")) + ent.offsets[3]=1; + if (a+1 != line.getnumtokens()) PRINTHELP(); + ent.offsets[1]=add_string(line.gettoken_str(a)); if (ent.offsets[1]<0) PRINTHELP() ent.offsets[2]=-1; } @@ -2039,7 +2043,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char ent.offsets[2]=add_string("Registering: "); } - SCRIPT_MSG("%s: \"%s\" %s\n",line.gettoken_str(0),line.gettoken_str(1), line.gettoken_str(2)); + SCRIPT_MSG("%s: \"%s\" %s\n",line.gettoken_str(0),line.gettoken_str(1), line.gettoken_str(ent.offsets[3]?3:2)); return add_entry(&ent); #endif//NSIS_SUPPORT_ACTIVEXREG case TOK_RENAME: @@ -3433,7 +3437,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char char* dllPath = m_plugins.GetPluginDll(line.gettoken_str(0)); if (dllPath) { - plugin_used = true; + if (uninstall_mode) uninst_plugin_used = true; + else plugin_used = true; ent.which=EW_CALL; ent.offsets[0]=ns_func.add(uninstall_mode?"un.Initialize_____Plugins":"Initialize_____Plugins",0); diff --git a/Source/tokens.cpp b/Source/tokens.cpp index 15087696..2cd63fd8 100644 --- a/Source/tokens.cpp +++ b/Source/tokens.cpp @@ -25,7 +25,7 @@ static tokenType tokenlist[TOK__LAST] = {TOK_BRANDINGTEXT,"BrandingText",1,2,"[/LANG=lang_id] [/TRIM(LEFT|RIGHT|CENTER)] installer_text"}, {TOK_BRINGTOFRONT,"BringToFront",0,0,""}, {TOK_CALL,"Call",1,0,"function_name | [:label_name]"}, -{TOK_CALLINSTDLL,"CallInstDLL",2,0,"dll_path_on_target.dll function"}, +{TOK_CALLINSTDLL,"CallInstDLL",2,1,"dll_path_on_target.dll [/NOUNLOAD] function"}, {TOK_CAPTION,"Caption",1,1,"[/LANG=lang_id] installer_caption"}, {TOK_CHANGEUI,"ChangeUI",2,0,"(all|dlg_id) ui_file.exe"}, {TOK_CLEARERRORS,"ClearErrors",0,0,""},