2006-10-28 19:45:02 +00:00
|
|
|
/*
|
|
|
|
* Plugins.h
|
|
|
|
*
|
|
|
|
* This file is a part of NSIS.
|
|
|
|
*
|
2021-01-01 20:27:52 +00:00
|
|
|
* Copyright (C) 1999-2021 Nullsoft and Contributors
|
2006-10-28 19:45:02 +00:00
|
|
|
*
|
|
|
|
* Licensed under the zlib/libpng license (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
*
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or implied
|
|
|
|
* warranty.
|
2010-03-24 17:22:56 +00:00
|
|
|
*
|
2006-10-28 19:45:02 +00:00
|
|
|
*/
|
|
|
|
|
2012-10-13 01:47:50 +00:00
|
|
|
#ifndef NSIS_EXEHEADPLUGINS_H
|
|
|
|
#define NSIS_EXEHEADPLUGINS_H
|
2002-08-05 02:05:00 +00:00
|
|
|
|
2005-08-27 19:56:00 +00:00
|
|
|
#include <map>
|
2012-10-13 01:47:50 +00:00
|
|
|
#include <set>
|
2010-03-24 17:22:56 +00:00
|
|
|
#include "tstring.h"
|
2003-04-17 15:27:12 +00:00
|
|
|
|
2018-11-07 16:58:43 +00:00
|
|
|
namespace STL
|
2012-10-13 01:47:50 +00:00
|
|
|
{
|
|
|
|
template<class S, class C>
|
|
|
|
struct string_nocasecmpless : std::binary_function<S, S, bool>
|
|
|
|
{
|
|
|
|
struct cmp : public std::binary_function<C, C, bool>
|
|
|
|
{
|
|
|
|
bool operator() (const C&a, const C&b) const
|
|
|
|
{
|
|
|
|
return tolower(a) < tolower(b);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
bool operator() (const S&a,const S&b) const
|
|
|
|
{
|
|
|
|
return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end(), cmp());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2003-04-17 15:27:12 +00:00
|
|
|
class Plugins
|
|
|
|
{
|
|
|
|
public:
|
2018-11-07 16:58:43 +00:00
|
|
|
typedef STL::string_nocasecmpless<tstring, tstring::value_type> strnocasecmp;
|
2012-10-13 01:47:50 +00:00
|
|
|
|
|
|
|
Plugins() : m_initialized(false) {}
|
|
|
|
|
2015-10-01 17:32:56 +00:00
|
|
|
bool Initialize(const TCHAR*arcsubdir, bool pe64, bool displayInfo);
|
|
|
|
void AddPluginsDir(const tstring& path, bool pe64, bool displayInfo);
|
2015-07-27 19:32:32 +00:00
|
|
|
bool FindDllPath(const tstring filename, tstring&dllPath);
|
2010-03-24 17:22:56 +00:00
|
|
|
bool IsPluginCommand(const tstring& command) const;
|
2014-08-21 13:15:07 +00:00
|
|
|
bool IsKnownPlugin(const tstring& token) const;
|
2012-10-13 01:47:50 +00:00
|
|
|
bool GetCommandInfo(const tstring&command, tstring&canoniccmd, tstring&dllPath);
|
|
|
|
int GetDllDataHandle(bool uninst, const tstring& command) const;
|
|
|
|
void SetDllDataHandle(bool uninst, tstring&canoniccmd, int dataHandle);
|
2014-08-21 13:15:07 +00:00
|
|
|
static bool IsPluginCallSyntax(const tstring& token);
|
2018-06-25 21:33:30 +00:00
|
|
|
void PrintPluginDirs();
|
2002-08-05 02:05:00 +00:00
|
|
|
|
2005-08-27 19:56:00 +00:00
|
|
|
private: // methods
|
2015-10-01 17:32:56 +00:00
|
|
|
void GetExports(const tstring &pathToDll, bool pe64, bool displayInfo);
|
2012-10-13 01:47:50 +00:00
|
|
|
bool DllHasDataHandle(const tstring& dllnamelowercase) const;
|
2002-08-05 02:05:00 +00:00
|
|
|
|
2005-08-27 19:56:00 +00:00
|
|
|
private: // data members
|
2012-10-13 01:47:50 +00:00
|
|
|
std::set<tstring, strnocasecmp> m_commands;
|
|
|
|
std::map<tstring, tstring, strnocasecmp> m_dllname_to_path;
|
|
|
|
std::map<tstring, int, strnocasecmp> m_dllname_to_inst_datahandle;
|
|
|
|
std::map<tstring, int, strnocasecmp> m_dllname_to_unst_datahandle;
|
|
|
|
std::set<tstring, strnocasecmp> m_dllname_conflicts;
|
|
|
|
bool m_initialized;
|
2002-08-05 02:05:00 +00:00
|
|
|
};
|
|
|
|
|
2004-03-12 20:43:54 +00:00
|
|
|
#endif
|