Fixed a bug that caused the second plug-in DLL not to get extracted
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@677 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
3e33df5e0c
commit
bc6494155b
5 changed files with 36 additions and 33 deletions
|
@ -328,6 +328,7 @@ int CEXEBuild::preprocess_string(char *out, const char *in)
|
|||
"WINDIR\0" // 32
|
||||
"SYSDIR\0" // 33
|
||||
"LANGUAGE\0" // 34
|
||||
"PLUGINSDIR\0" // 35
|
||||
;
|
||||
|
||||
const char *p=in;
|
||||
|
|
|
@ -789,10 +789,6 @@ static int ExecuteEntry(entry *entries, int pos)
|
|||
if (hres == S_FALSE || hres == S_OK)
|
||||
{
|
||||
HANDLE h;
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
if (!parms[0]) lstrcpy(buf,plugin);
|
||||
else
|
||||
#endif
|
||||
process_string_fromtab(buf,parms[0]);
|
||||
process_string_fromtab(buf2,parms[1]);
|
||||
|
||||
|
@ -1390,8 +1386,6 @@ static int ExecuteEntry(entry *entries, int pos)
|
|||
// parms[0] = dll name
|
||||
|
||||
if (!*plugins_temp_dir) lstrcpy(plugins_temp_dir,g_usrvars[0]);
|
||||
lstrcpy(plugin,plugins_temp_dir);
|
||||
process_string_fromtab(plugin+lstrlen(plugins_temp_dir),parms[0]);
|
||||
return 0;
|
||||
#endif // NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
}
|
||||
|
|
|
@ -416,7 +416,7 @@ int GetCompressedDataFromDataBlock(int offset, HANDLE hFileOut);
|
|||
int GetCompressedDataFromDataBlockToMemory(int offset, char *out, int out_len);
|
||||
|
||||
// $0..$9, $INSTDIR, etc are encoded as ASCII bytes starting from this value.
|
||||
#define VAR_CODES_START (256 - 36)
|
||||
#define VAR_CODES_START (256 - 37)
|
||||
|
||||
|
||||
#endif //_FILEFORM_H_
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
char g_log_file[1024];
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
extern char plugins_temp_dir[NSIS_MAX_STRLEN];
|
||||
#endif
|
||||
|
||||
char g_usrvars[24][NSIS_MAX_STRLEN];
|
||||
|
||||
HANDLE g_hInstance;
|
||||
|
@ -497,6 +501,10 @@ void process_string(char *out, const char *in)
|
|||
wsprintf(out, "%u", cur_install_strings_table->lang_id);
|
||||
break;
|
||||
|
||||
case VAR_CODES_START + 35: // PLUGINSDIR
|
||||
lstrcpy(out, plugins_temp_dir);
|
||||
break;
|
||||
|
||||
#if VAR_CODES_START + 34 >= 255
|
||||
#error "Too many variables! Extend VAR_CODES_START!"
|
||||
#endif
|
||||
|
|
|
@ -3328,30 +3328,10 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
|||
ent.offsets[1]=0;
|
||||
ret=add_entry(&ent);
|
||||
if (ret != PS_OK) return ret;
|
||||
}
|
||||
// Make DLL name (on user machine)
|
||||
ent.which=EW_PLUGINCOMMANDPREP;
|
||||
ent.offsets[0]=add_string(strrchr(dllPath,'\\'));
|
||||
ret=add_entry(&ent);
|
||||
if (ret != PS_OK) return ret;
|
||||
|
||||
// Add the DLL if not already added
|
||||
if (!m_plugins.IsDLLStored(strrchr(dllPath,'\\')+1))
|
||||
{
|
||||
int error;
|
||||
int files_added;
|
||||
char file[NSIS_MAX_STRLEN];
|
||||
wsprintf(file,"$0\\%s",strrchr(dllPath,'\\')+1);
|
||||
if (PS_OK != (error = do_add_file(dllPath,0,0,0,&files_added,file)))
|
||||
{
|
||||
ERROR_MSG("Error: Failed to auto include plugin file \"%s\"\n",dllPath);
|
||||
return error;
|
||||
}
|
||||
|
||||
m_plugins.DLLStored(strrchr(dllPath,'\\')+1);
|
||||
}
|
||||
|
||||
if (!plugin_used) {
|
||||
// Copy $0 to $PLUGINSDIR
|
||||
ent.which=EW_PLUGINCOMMANDPREP;
|
||||
ret=add_entry(&ent);
|
||||
if (ret != PS_OK) return ret;
|
||||
// Pop $0
|
||||
ent.which=EW_PUSHPOP;
|
||||
ent.offsets[0]=0; // $0
|
||||
|
@ -3359,8 +3339,28 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
|||
ent.offsets[2]=0;
|
||||
ret=add_entry(&ent);
|
||||
if (ret != PS_OK) return ret;
|
||||
// We need to do all of this only once
|
||||
plugin_used = true;
|
||||
}
|
||||
|
||||
// DLL name on the user machine
|
||||
char tempDLL[NSIS_MAX_STRLEN];
|
||||
wsprintf(tempDLL, "$PLUGINSDIR%s", strrchr(dllPath,'\\'));
|
||||
int tempDLLtab = add_string(tempDLL);
|
||||
|
||||
// Add the DLL if not already added
|
||||
if (!m_plugins.IsDLLStored(strrchr(dllPath,'\\')+1))
|
||||
{
|
||||
int error;
|
||||
int files_added;
|
||||
if (PS_OK != (error = do_add_file(dllPath,0,0,0,&files_added,tempDLL)))
|
||||
{
|
||||
ERROR_MSG("Error: Failed to auto include plugin file \"%s\"\n",dllPath);
|
||||
return error;
|
||||
}
|
||||
|
||||
m_plugins.DLLStored(strrchr(dllPath,'\\')+1);
|
||||
}
|
||||
plugin_used = true;
|
||||
|
||||
// Finally call the DLL
|
||||
char* command = strstr(line.gettoken_str(0),"::");
|
||||
|
@ -3381,7 +3381,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
|||
|
||||
// next, call it
|
||||
ent.which=EW_REGISTERDLL;
|
||||
ent.offsets[0]=0;
|
||||
ent.offsets[0]=tempDLLtab;
|
||||
ent.offsets[1]=add_string(command);
|
||||
ent.offsets[2]=-1;
|
||||
ret=add_entry(&ent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue