diff --git a/Source/Plugins.cpp b/Source/Plugins.cpp index d2a4cb6b..c77789ac 100644 --- a/Source/Plugins.cpp +++ b/Source/Plugins.cpp @@ -141,32 +141,4 @@ char* Plugins::GetPluginDll(char* command) return m_commands.find(command); } -void Plugins::StoreInstDLL(char* dllName) -{ - for (int i = 0; i < m_installDLLs.size(); i++) - if (!strcmp(m_installDLLs[i], dllName)) - return; - m_installDLLs.push_back(strdup(dllName)); -} - -void Plugins::StoreUninstDLL(char* dllName) -{ - for (int i = 0; i < m_uninstallDLLs.size(); i++) - if (!strcmp(m_uninstallDLLs[i], dllName)) - return; - m_uninstallDLLs.push_back(strdup(dllName)); -} - -char* Plugins::GetInstDLL(int i) -{ - if (i >= 0 && i < m_installDLLs.size()) return m_installDLLs[i]; - else return 0; -} - -char* Plugins::GetUninstDLL(int i) -{ - if (i >= 0 && i < m_uninstallDLLs.size()) return m_uninstallDLLs[i]; - else return 0; -} - #endif \ No newline at end of file diff --git a/Source/build.cpp b/Source/build.cpp index d4b2f40b..50382e3c 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -1076,7 +1076,7 @@ int CEXEBuild::write_output(void) #ifdef NSIS_CONFIG_PLUGIN_SUPPORT // Added by Amir Szekely 9th August 2002 - int err=add_plugin_initializer(); + int err=add_plugins_dir_initializer(); if (err != PS_OK) return err; #endif //NSIS_CONFIG_PLUGIN_SUPPORT @@ -1890,15 +1890,15 @@ void CEXEBuild::build_plugin_table(void) } } -int CEXEBuild::add_plugin_initializer(void) +int CEXEBuild::add_plugins_dir_initializer(void) { if (!plugin_used) return PS_OK; - SCRIPT_MSG("Adding plug-ins initializing function...\n"); + SCRIPT_MSG("Adding plug-ins initializing function... "); bool uninstall = false; - int ret, i; + int ret; entry ent; int zero_offset; @@ -1949,26 +1949,6 @@ again: ret=add_entry(&ent); if (ret != PS_OK) return ret; - int files_added; - if (uninstall) { - char* dll; - for (i = 0; dll = m_plugins.GetUninstDLL(i); i++) { - char tempPath[NSIS_MAX_STRLEN]; - wsprintf(tempPath,"$PLUGINSDIR%s",strrchr(dll,'\\')); - ret=do_add_file(dll,0,0,0,&files_added,tempPath); - if (ret != PS_OK) return ret; - } - } - else { - char* dll; - for (i = 0; dll = m_plugins.GetInstDLL(i); i++) { - char tempPath[NSIS_MAX_STRLEN]; - wsprintf(tempPath,"$PLUGINSDIR%s",strrchr(dll,'\\')); - ret=do_add_file(dll,0,0,0,&files_added,tempPath); - if (ret != PS_OK) return ret; - } - } - if (add_label("Initialize_____Plugins_done")) return PS_ERROR; ret=function_end(); diff --git a/Source/build.h b/Source/build.h index 26139cb8..68cbc5a6 100644 --- a/Source/build.h +++ b/Source/build.h @@ -87,7 +87,7 @@ class CEXEBuild { #ifdef NSIS_CONFIG_PLUGIN_SUPPORT // Added by Amir Szekely 9th August 2002 - int add_plugin_initializer(void); + int add_plugins_dir_initializer(void); #endif //NSIS_CONFIG_PLUGIN_SUPPORT void ERROR_MSG(const char *s, ...); diff --git a/Source/script.cpp b/Source/script.cpp index 53b05d2e..57d3d538 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -3540,6 +3540,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char if (uninstall_mode) uninst_plugin_used = true; else plugin_used = true; + // Initialize $PLUGINSDIR ent.which=EW_CALL; ent.offsets[0]=ns_func.add(uninstall_mode?"un.Initialize_____Plugins":"Initialize_____Plugins",0); ret=add_entry(&ent); @@ -3548,13 +3549,16 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char // DLL name on the user machine char tempDLL[NSIS_MAX_STRLEN]; wsprintf(tempDLL, "$PLUGINSDIR%s", strrchr(dllPath,'\\')); - int tempDLLtab = add_string(tempDLL); - // Store the DLL - if (uninstall_mode) m_plugins.StoreUninstDLL(dllPath); - else m_plugins.StoreInstDLL(dllPath); + // Add the DLL to the installer + int files_added; + int old_build_overwrite=build_overwrite; + build_overwrite=1; + ret=do_add_file(dllPath,0,0,0,&files_added,tempDLL); + if (ret != PS_OK) return ret; + build_overwrite=old_build_overwrite; - // Finally call the DLL + // Call the DLL char* command = strstr(line.gettoken_str(0),"::"); if (command) command += 2; else command = line.gettoken_str(0); @@ -3580,7 +3584,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char // next, call it ent.which=EW_REGISTERDLL; - ent.offsets[0]=tempDLLtab; + ent.offsets[0]=add_string(tempDLL);; ent.offsets[1]=add_string(command); ent.offsets[2]=-1; ent.offsets[3]=nounload;