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
This commit is contained in:
kichik 2002-11-22 12:45:38 +00:00
parent 5abd9f0dde
commit 83b92fb6ea
3 changed files with 14 additions and 10 deletions

View file

@ -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

View file

@ -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);

View file

@ -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;
}