
The official plugins are now stored in architecture specific subdirectories under NSIS\Plugins. !AddPluginDir also gained a new (optional) architecture flag because MakeNSIS now stores separate plugin information for each target architecture. Storing plugins in the root of the Plugins directory is no longer supported. MinGW does not implement the unicode CRT startup functions so the entry point functions and linker parameters had to be changed. The unicode tools use the ansi entry point and a small helper function that calls into the real code: _tmain has full argc+argv emulation while wWinMain does not pass the command line parameters. The stubs do not use any CRT functions and have no CRT or unicode helper code, they call our entry point directly. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6269 212acab6-be3b-0410-9dea-997c60f758d6
71 lines
2 KiB
C++
71 lines
2 KiB
C++
/*
|
|
* Plugins.h
|
|
*
|
|
* This file is a part of NSIS.
|
|
*
|
|
* Copyright (C) 1999-2009 Nullsoft and Contributors
|
|
*
|
|
* 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.
|
|
*
|
|
*/
|
|
|
|
#ifndef NSIS_EXEHEADPLUGINS_H
|
|
#define NSIS_EXEHEADPLUGINS_H
|
|
|
|
#include <map>
|
|
#include <set>
|
|
#include "tstring.h"
|
|
|
|
namespace STLHelpers
|
|
{
|
|
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());
|
|
}
|
|
};
|
|
}
|
|
|
|
class Plugins
|
|
{
|
|
public:
|
|
typedef STLHelpers::string_nocasecmpless<tstring, tstring::value_type> strnocasecmp;
|
|
|
|
Plugins() : m_initialized(false) {}
|
|
|
|
bool Initialize(const TCHAR*arcsubdir, bool displayInfo);
|
|
void AddPluginsDir(const tstring& path, bool displayInfo);
|
|
bool IsPluginCommand(const tstring& command) const;
|
|
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);
|
|
|
|
private: // methods
|
|
void GetExports(const tstring &pathToDll, bool displayInfo);
|
|
bool DllHasDataHandle(const tstring& dllnamelowercase) const;
|
|
|
|
private: // data members
|
|
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;
|
|
};
|
|
|
|
#endif
|