Sunjammer's code is now fully optimized
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@668 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
9a6e21556f
commit
93a5fa4c1c
3 changed files with 26 additions and 20 deletions
|
@ -111,8 +111,11 @@ void Plugins::GetExports(char* pathToDll,bool displayInfo)
|
|||
for (unsigned long j = 0; j < exports->NumberOfNames; j++)
|
||||
{
|
||||
char *name = (char*)exports + names[j] - ExportDirVA;
|
||||
wsprintf(signature,"%s::%s", dllName, name);
|
||||
wsprintf(signature, "%s::%s", dllName, name);
|
||||
m_commands.add(signature, pathToDll);
|
||||
DLL newDll = {new char[lstrlen(dllName)], false};
|
||||
lstrcpy(newDll.name, dllName);
|
||||
m_storedDLLs.push_back(newDll);
|
||||
if (displayInfo)
|
||||
fprintf(g_output, " - %s\n", signature);
|
||||
}
|
||||
|
@ -153,23 +156,22 @@ char* Plugins::GetPluginDll(char* command)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void Plugins::StoreDllDataHandle(char* signature,int handle)
|
||||
void Plugins::DLLStored(char* dllName)
|
||||
{
|
||||
int idx = -1;
|
||||
m_commands.defines.find(signature,0,&idx);
|
||||
if (idx > -1)
|
||||
{
|
||||
m_dataHandles.reserve(idx+1);
|
||||
m_dataHandles[idx] = handle;
|
||||
for (int i = 0; i < m_storedDLLs.size(); i++) {
|
||||
if (!strcmp(m_storedDLLs[i].name, dllName)) {
|
||||
m_storedDLLs[i].stored = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Plugins::GetDllDataHandle(char* signature)
|
||||
bool Plugins::IsDLLStored(char* dllName)
|
||||
{
|
||||
int idx = -1;
|
||||
if (-1 != m_commands.defines.find(signature,0,&idx))
|
||||
return m_dataHandles[idx];
|
||||
return -1;
|
||||
for (int i = 0; i < m_storedDLLs.size(); i++)
|
||||
if (!strcmp(m_storedDLLs[i].name, dllName))
|
||||
return m_storedDLLs[i].stored;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -9,6 +9,10 @@
|
|||
#include "strlist.h"
|
||||
#include <vector>
|
||||
|
||||
struct DLL {
|
||||
char *name;
|
||||
bool stored;
|
||||
};
|
||||
|
||||
class Plugins
|
||||
{
|
||||
|
@ -16,12 +20,12 @@ class Plugins
|
|||
void FindCommands(char*,bool);
|
||||
bool IsPluginCommand(char*);
|
||||
char* GetPluginDll(char*);
|
||||
int GetDllDataHandle(char*);
|
||||
void StoreDllDataHandle(char*,int);
|
||||
void DLLStored(char*);
|
||||
bool IsDLLStored(char*);
|
||||
|
||||
protected:
|
||||
DefineList m_commands;
|
||||
std::vector<int> m_dataHandles;
|
||||
std::vector<DLL> m_storedDLLs;
|
||||
|
||||
void GetExports(char*,bool);
|
||||
};
|
||||
|
|
|
@ -3336,19 +3336,19 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
|
|||
if (ret != PS_OK) return ret;
|
||||
|
||||
// Add the DLL if not already added
|
||||
int dataHandle = m_plugins.GetDllDataHandle(dllPath);
|
||||
if (dataHandle == -1)
|
||||
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,&dataHandle,file)))
|
||||
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.StoreDllDataHandle(line.gettoken_str(0),dataHandle);
|
||||
m_plugins.DLLStored(strrchr(dllPath,'\\')+1);
|
||||
}
|
||||
|
||||
if (!plugin_used) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue