From 83b92fb6eac6aa5b4b453dbee8f494ce32de1b3f Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 22 Nov 2002 12:45:38 +0000 Subject: [PATCH] Plugins used both in uninstaller and installer problems should be fixed now git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1817 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/Plugins.cpp | 15 +++++++++------ Source/Plugins.h | 5 +++-- Source/script.cpp | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Source/Plugins.cpp b/Source/Plugins.cpp index 1fb80226..3b70a60e 100644 --- a/Source/Plugins.cpp +++ b/Source/Plugins.cpp @@ -134,23 +134,26 @@ void Plugins::GetExports(char* pathToDll,bool displayInfo) bool Plugins::IsPluginCommand(char* token) { - return GetPluginDll(token, 0) ? true : false; + return GetPluginDll(0, token, 0) ? true : false; } -char* Plugins::GetPluginDll(char* command, int* dataHandle) +char* Plugins::GetPluginDll(int uninst, char* command, int* dataHandle) { char* ret = m_commands.find(command, dataHandle); - if (dataHandle && ret) - *dataHandle = ((int*)m_dataHandles.get())[*dataHandle]; + if (dataHandle && ret) { + if (uninst) *dataHandle = ((int*)m_uninstDataHandles.get())[*dataHandle]; + else *dataHandle = ((int*)m_dataHandles.get())[*dataHandle]; + } return ret; } -void Plugins::SetDllDataHandle(char* command, int dataHandle) +void Plugins::SetDllDataHandle(int uninst, char* command, int dataHandle) { int idx = -1; m_commands.find(command, &idx); if (idx == -1) return; - ((int*)m_dataHandles.get())[idx] = dataHandle; + if (uninst) ((int*)m_uninstDataHandles.get())[idx] = dataHandle; + else ((int*)m_dataHandles.get())[idx] = dataHandle; } #endif \ No newline at end of file diff --git a/Source/Plugins.h b/Source/Plugins.h index 771510f9..b425612c 100644 --- a/Source/Plugins.h +++ b/Source/Plugins.h @@ -14,12 +14,13 @@ class Plugins public: void FindCommands(char*,bool); bool IsPluginCommand(char*); - char* GetPluginDll(char*, int*); - void SetDllDataHandle(char*, int); + char* GetPluginDll(int, char*, int*); + void SetDllDataHandle(int, char*, int); protected: DefineList m_commands; GrowBuf m_dataHandles; + GrowBuf m_uninstDataHandles; int m_funcsCount; void GetExports(char*,bool); diff --git a/Source/script.cpp b/Source/script.cpp index 25d865cf..ba7c8b2d 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -3741,7 +3741,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char { int ret, data_handle; - char* dllPath = m_plugins.GetPluginDll(line.gettoken_str(0), &data_handle); + char* dllPath = m_plugins.GetPluginDll(uninstall_mode, line.gettoken_str(0), &data_handle); if (dllPath) { if (uninstall_mode) uninst_plugin_used = true; @@ -3767,7 +3767,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char build_datesave=0; // off ret=do_add_file(dllPath,0,0,linecnt,&files_added,tempDLL,2,&data_handle); // 2 means no size add if (ret != PS_OK) return ret; - m_plugins.SetDllDataHandle(line.gettoken_str(0),data_handle); + m_plugins.SetDllDataHandle(uninstall_mode, line.gettoken_str(0),data_handle); build_overwrite=old_build_overwrite; build_datesave=old_build_datesave; }