Unicode port: Unicode version of NSIS can now generate both ANSI & Unicode installers (using new instruction UnicodeInstaller on/off).

Stubs & Plugins differentiation is done automatically using a 'W' suffix.
SConscripts need to be reviewed to generate both variants of Plugins & pluginapi.lib under Unicode compilation.

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6100 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
wizou 2010-06-14 10:07:22 +00:00
parent fbc7cb8fd0
commit 57f7ff8a1c
24 changed files with 376 additions and 112 deletions

View file

@ -47,7 +47,7 @@ void Plugins::FindCommands(const tstring &path, bool displayInfo)
for (dir_reader::iterator files_itr = dr->files().begin();
files_itr != dr->files().end();
files_itr++)
files_itr++) // note: files are listed alphabetically, so plugin.dll will be listed before pluginW.dll
{
if (!dir_reader::matches(*files_itr, _T("*.dll")))
continue;
@ -109,7 +109,10 @@ void Plugins::GetExports(const tstring &pathToDll, bool displayInfo)
return;
}
const tstring dllName = remove_file_extension(get_file_name(pathToDll));
tstring dllName = remove_file_extension(get_file_name(pathToDll));
#ifdef _UNICODE
bool unicodeDll = dllName[dllName.size()-1] == 'W';
#endif
FIX_ENDIAN_INT16_INPLACE(NTHeaders->FileHeader.Characteristics);
if (NTHeaders->FileHeader.Characteristics & IMAGE_FILE_DLL)
@ -143,6 +146,12 @@ void Plugins::GetExports(const tstring &pathToDll, bool displayInfo)
const tstring lcsig = lowercase(signature);
m_command_to_path[lcsig] = pathToDll;
m_command_lowercase_to_command[lcsig] = signature;
#ifdef _UNICODE
const tstring lcsigA = lowercase(dllName.substr(0,dllName.size()-1) + _T("::") + tstring(CtoTString(name)));
if (unicodeDll && m_command_to_path.find(lcsigA) != m_command_to_path.end())
m_unicode_variant[lcsigA] = signature;
else
#endif
if (displayInfo)
_ftprintf(g_output, _T(" - %s\n"), signature.c_str());
}
@ -180,6 +189,10 @@ tstring Plugins::NormalizedCommand(const tstring& command) const {
return get_value(m_command_lowercase_to_command, lowercase(command));
}
tstring Plugins::UseUnicodeVariant(const tstring& command) const {
return get_value(m_unicode_variant, lowercase(command), command);
}
int Plugins::GetPluginHandle(bool uninst, const tstring& command) const {
if (uninst) {
return get_value(m_command_to_uninstall_data_handle, command, -1);