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:
kichik 2002-09-04 14:28:10 +00:00
parent 490104b9cc
commit cc30332487

View file

@ -136,24 +136,28 @@ bool Plugins::IsPluginCommand(char* token)
char* Plugins::GetPluginDll(char* command) char* Plugins::GetPluginDll(char* command)
{ {
if (strstr(command,"::")) bool malloced = false;
return m_commands.find(command); char *colons = strstr(command,"::");
if (!colons) return 0;
// slow & stupid but it doesn't matter *colons = 0;
int i = 0,pos = 0;
char* signatures = m_commands.defines.get(); char *p = command;
while (pos != -1)
{ while (*p != '.' && *p) p++;
pos = m_commands.defines.idx2pos(i++);
if (pos >= 0) if (lstrcmpi(p, ".dll")) {
{ char *new_command = (char *)malloc(lstrlen(command)+1+4);
char* cmd = strstr(signatures+pos,"::"); wsprintf(new_command, "%s.dll::%s", command, colons+2);
if (cmd && strcmp(cmd+2,command) == 0) command = new_command;
return m_commands.find(signatures+pos); malloced = 1;
}
} }
return 0; *colons = ':';
char *result = m_commands.find(command);
if (malloced) free(command);
return result;
} }
void Plugins::StoreInstDLL(char* dllName) void Plugins::StoreInstDLL(char* dllName)