Now only accepts plug-in calls in the form of dllname[.dll]::FunctionName
Prevents clashes with future commands git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@904 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
490104b9cc
commit
cc30332487
1 changed files with 20 additions and 16 deletions
|
@ -136,24 +136,28 @@ bool Plugins::IsPluginCommand(char* token)
|
|||
|
||||
char* Plugins::GetPluginDll(char* command)
|
||||
{
|
||||
if (strstr(command,"::"))
|
||||
return m_commands.find(command);
|
||||
bool malloced = false;
|
||||
char *colons = strstr(command,"::");
|
||||
if (!colons) return 0;
|
||||
|
||||
// slow & stupid but it doesn't matter
|
||||
int i = 0,pos = 0;
|
||||
char* signatures = m_commands.defines.get();
|
||||
while (pos != -1)
|
||||
{
|
||||
pos = m_commands.defines.idx2pos(i++);
|
||||
if (pos >= 0)
|
||||
{
|
||||
char* cmd = strstr(signatures+pos,"::");
|
||||
if (cmd && strcmp(cmd+2,command) == 0)
|
||||
return m_commands.find(signatures+pos);
|
||||
}
|
||||
*colons = 0;
|
||||
|
||||
char *p = command;
|
||||
|
||||
while (*p != '.' && *p) p++;
|
||||
|
||||
if (lstrcmpi(p, ".dll")) {
|
||||
char *new_command = (char *)malloc(lstrlen(command)+1+4);
|
||||
wsprintf(new_command, "%s.dll::%s", command, colons+2);
|
||||
command = new_command;
|
||||
malloced = 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
*colons = ':';
|
||||
|
||||
char *result = m_commands.find(command);
|
||||
if (malloced) free(command);
|
||||
return result;
|
||||
}
|
||||
|
||||
void Plugins::StoreInstDLL(char* dllName)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue