Jim Park's Unicode NSIS merging - Step 2 : merge TCHARs changes into trunk
Compiler output is identical before & after this step git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6037 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
commit
cdf7735a77
206 changed files with 8437 additions and 6403 deletions
|
@ -13,6 +13,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/24/2007
|
||||
*/
|
||||
|
||||
// DLLExports.cpp
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/28/2007
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
@ -21,6 +23,7 @@
|
|||
#include "MyWindows.h"
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#include "../../tchar.h"
|
||||
#endif
|
||||
|
||||
#include "Alloc.h"
|
||||
|
@ -39,7 +42,7 @@ void *MyAlloc(size_t size) throw()
|
|||
if (size == 0)
|
||||
return 0;
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount++);
|
||||
_ftprintf(stderr, _T("\nAlloc %10d bytes; count = %10d"), size, g_allocCount++);
|
||||
#endif
|
||||
return ::malloc(size);
|
||||
}
|
||||
|
@ -48,7 +51,7 @@ void MyFree(void *address) throw()
|
|||
{
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
if (address != 0)
|
||||
fprintf(stderr, "\nFree; count = %10d", --g_allocCount);
|
||||
_ftprintf(stderr, _T("\nFree; count = %10d"), --g_allocCount);
|
||||
#endif
|
||||
|
||||
::free(address);
|
||||
|
@ -61,7 +64,7 @@ void *MidAlloc(size_t size) throw()
|
|||
if (size == 0)
|
||||
return 0;
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
fprintf(stderr, "\nAlloc_Mid %10d bytes; count = %10d", size, g_allocCountMid++);
|
||||
_ftprintf(stderr, _T("\nAlloc_Mid %10d bytes; count = %10d"), size, g_allocCountMid++);
|
||||
#endif
|
||||
return ::VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
|
||||
}
|
||||
|
@ -70,7 +73,7 @@ void MidFree(void *address) throw()
|
|||
{
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
if (address != 0)
|
||||
fprintf(stderr, "\nFree_Mid; count = %10d", --g_allocCountMid);
|
||||
_ftprintf(stderr, _T("\nFree_Mid; count = %10d"), --g_allocCountMid);
|
||||
#endif
|
||||
if (address == 0)
|
||||
return;
|
||||
|
@ -89,7 +92,7 @@ typedef SIZE_T (WINAPI *GetLargePageMinimumP)();
|
|||
bool SetLargePageSize()
|
||||
{
|
||||
GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP)
|
||||
::GetProcAddress(::GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum");
|
||||
::GetProcAddress(::GetModuleHandle(_T("kernel32.dll")), "GetLargePageMinimum");
|
||||
if (largePageMinimum == 0)
|
||||
return false;
|
||||
SIZE_T size = largePageMinimum();
|
||||
|
@ -105,7 +108,7 @@ void *BigAlloc(size_t size) throw()
|
|||
if (size == 0)
|
||||
return 0;
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++);
|
||||
_ftprintf(stderr, _T("\nAlloc_Big %10d bytes; count = %10d"), size, g_allocCountBig++);
|
||||
#endif
|
||||
|
||||
if (size >= (1 << 18))
|
||||
|
@ -122,7 +125,7 @@ void BigFree(void *address) throw()
|
|||
{
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
if (address != 0)
|
||||
fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig);
|
||||
_ftprintf(stderr, _T("\nFree_Big; count = %10d"), --g_allocCountBig);
|
||||
#endif
|
||||
|
||||
if (address == 0)
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/28/2007
|
||||
*/
|
||||
|
||||
#ifndef __COMMON_ALLOC_H
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/28/2007
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/28/2007
|
||||
*/
|
||||
|
||||
#ifndef __COMMON_CRC_H
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/24/2007
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/24/2007
|
||||
*/
|
||||
|
||||
#ifndef __LZMADECODE_H
|
||||
|
|
|
@ -280,8 +280,8 @@ int CDialogTemplate::RemoveItem(WORD wId) {
|
|||
}
|
||||
|
||||
// Sets the font of the dialog
|
||||
void CDialogTemplate::SetFont(char* szFaceName, WORD wFontSize) {
|
||||
if (strcmp(szFaceName, "MS Shell Dlg")) {
|
||||
void CDialogTemplate::SetFont(TCHAR* szFaceName, WORD wFontSize) {
|
||||
if (_tcscmp(szFaceName, _T("MS Shell Dlg"))) {
|
||||
// not MS Shell Dlg
|
||||
m_dwStyle &= ~DS_SHELLFONT;
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ void CDialogTemplate::DlgUnitsToPixels(short& x, short& y) {
|
|||
}
|
||||
|
||||
// Returns the size of a string in the dialog (in dialog units)
|
||||
SIZE CDialogTemplate::GetStringSize(WORD id, char *str) {
|
||||
SIZE CDialogTemplate::GetStringSize(WORD id, TCHAR *str) {
|
||||
HWND hDlg = CreateDummyDialog();
|
||||
|
||||
LOGFONT f;
|
||||
|
@ -375,7 +375,7 @@ SIZE CDialogTemplate::GetStringSize(WORD id, char *str) {
|
|||
SelectObject(memDC, font);
|
||||
|
||||
SIZE size;
|
||||
GetTextExtentPoint32(memDC, str, strlen(str), &size);
|
||||
GetTextExtentPoint32(memDC, str, _tcsclen(str), &size);
|
||||
|
||||
DestroyWindow(hDlg);
|
||||
DeleteObject(font);
|
||||
|
@ -387,7 +387,7 @@ SIZE CDialogTemplate::GetStringSize(WORD id, char *str) {
|
|||
}
|
||||
|
||||
// Trims the right margins of a control to fit a given text string size.
|
||||
void CDialogTemplate::RTrimToString(WORD id, char *str, int margins) {
|
||||
void CDialogTemplate::RTrimToString(WORD id, TCHAR *str, int margins) {
|
||||
DialogItemTemplate* item = GetItem(id);
|
||||
if (!item) return;
|
||||
|
||||
|
@ -401,7 +401,7 @@ void CDialogTemplate::RTrimToString(WORD id, char *str, int margins) {
|
|||
}
|
||||
|
||||
// Trims the left margins of a control to fit a given text string size.
|
||||
void CDialogTemplate::LTrimToString(WORD id, char *str, int margins) {
|
||||
void CDialogTemplate::LTrimToString(WORD id, TCHAR *str, int margins) {
|
||||
DialogItemTemplate* item = GetItem(id);
|
||||
if (!item) return;
|
||||
|
||||
|
@ -416,7 +416,7 @@ void CDialogTemplate::LTrimToString(WORD id, char *str, int margins) {
|
|||
}
|
||||
|
||||
// Trims the left and right margins of a control to fit a given text string size.
|
||||
void CDialogTemplate::CTrimToString(WORD id, char *str, int margins) {
|
||||
void CDialogTemplate::CTrimToString(WORD id, TCHAR *str, int margins) {
|
||||
DialogItemTemplate* item = GetItem(id);
|
||||
if (!item) return;
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/21/2007
|
||||
*/
|
||||
|
||||
#if !defined(AFX_DIALOGTEMPLATE_H__C5A973AF_0F56_4BEC_814A_79318E2EB4AC__INCLUDED_)
|
||||
|
@ -113,7 +115,7 @@ public:
|
|||
DialogItemTemplate* GetItem(WORD wId);
|
||||
DialogItemTemplate* GetItemByIdx(DWORD i);
|
||||
int RemoveItem(WORD wId);
|
||||
void SetFont(char* szFaceName, WORD wFontSize);
|
||||
void SetFont(TCHAR* szFaceName, WORD wFontSize);
|
||||
void AddItem(DialogItemTemplate item);
|
||||
#ifdef _WIN32
|
||||
HWND CreateDummyDialog();
|
||||
|
@ -123,10 +125,10 @@ public:
|
|||
#ifdef _WIN32
|
||||
void PixelsToDlgUnits(short& x, short& y);
|
||||
void DlgUnitsToPixels(short& x, short& y);
|
||||
SIZE GetStringSize(WORD id, char *str);
|
||||
void RTrimToString(WORD id, char *str, int margins);
|
||||
void LTrimToString(WORD id, char *str, int margins);
|
||||
void CTrimToString(WORD id, char *str, int margins);
|
||||
SIZE GetStringSize(WORD id, TCHAR *str);
|
||||
void RTrimToString(WORD id, TCHAR *str, int margins);
|
||||
void LTrimToString(WORD id, TCHAR *str, int margins);
|
||||
void CTrimToString(WORD id, TCHAR *str, int margins);
|
||||
#endif
|
||||
void ConvertToRTL();
|
||||
BYTE* Save(DWORD& dwSize);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/13/2007
|
||||
*/
|
||||
|
||||
#ifndef ___PLATFORM__H___
|
||||
|
@ -22,9 +24,10 @@
|
|||
// includes
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
# include <commctrl.h>
|
||||
# include <shellapi.h>
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <shellapi.h>
|
||||
#include "tchar.h"
|
||||
#else
|
||||
# ifndef EXEHEAD
|
||||
# include <string.h>
|
||||
|
@ -109,22 +112,22 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
|
|||
|
||||
// script path separator
|
||||
|
||||
# define PATH_SEPARATOR_STR "\\"
|
||||
# define PATH_SEPARATOR_C '\\'
|
||||
# define PATH_SEPARATOR_STR _T("\\")
|
||||
# define PATH_SEPARATOR_C _T('\\')
|
||||
|
||||
// system specific characters
|
||||
|
||||
#ifdef _WIN32
|
||||
# define PLATFORM_PATH_SEPARATOR_STR "\\"
|
||||
# define PLATFORM_PATH_SEPARATOR_C '\\'
|
||||
# define OPT_STR "/"
|
||||
# define OPT_C '/'
|
||||
# define IS_OPT(a) (a[0]==OPT_C||a[0]=='-')
|
||||
# define PLATFORM_PATH_SEPARATOR_STR _T("\\")
|
||||
# define PLATFORM_PATH_SEPARATOR_C _T('\\')
|
||||
# define OPT_STR _T("/")
|
||||
# define OPT_C _T('/')
|
||||
# define IS_OPT(a) (a[0]==OPT_C||a[0]==_T('-'))
|
||||
#else
|
||||
# define PLATFORM_PATH_SEPARATOR_STR "/"
|
||||
# define PLATFORM_PATH_SEPARATOR_C '/'
|
||||
# define OPT_STR "-"
|
||||
# define OPT_C '-'
|
||||
# define PLATFORM_PATH_SEPARATOR_STR _T("/")
|
||||
# define PLATFORM_PATH_SEPARATOR_C _T('/')
|
||||
# define OPT_STR _T("-")
|
||||
# define OPT_C _T('-')
|
||||
# define IS_OPT(a) (a[0]==OPT_C)
|
||||
#endif
|
||||
|
||||
|
@ -183,6 +186,8 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
|
|||
|
||||
// functions
|
||||
|
||||
// Jim Park: These str functions will probably never be encountered with all my
|
||||
// Unicode changes. And if they were used, these would probably be wrong.
|
||||
#ifndef _WIN32
|
||||
# define stricmp strcasecmp
|
||||
# define strcmpi strcasecmp
|
||||
|
@ -227,10 +232,10 @@ typedef DWORDLONG ULONGLONG,*PULONGLONG;
|
|||
|
||||
#ifndef EXEHEAD
|
||||
# ifndef SF_TEXT
|
||||
# define SF_TEXT 1
|
||||
# define SF_TEXT 0x0001
|
||||
# endif
|
||||
# ifndef SF_RTF
|
||||
# define SF_RTF 2
|
||||
# define SF_RTF 0x0002
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -683,7 +688,7 @@ typedef struct _LOGFONT {
|
|||
BYTE lfClipPrecision;
|
||||
BYTE lfQuality;
|
||||
BYTE lfPitchAndFamily;
|
||||
CHAR lfFaceName[LF_FACESIZE];
|
||||
TCHAR lfFaceName[LF_FACESIZE];
|
||||
} LOGFONT;
|
||||
# pragma pack(2)
|
||||
typedef struct _IMAGE_DOS_HEADER {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "tstring.h"
|
||||
#include <fstream>
|
||||
|
||||
#include "Plugins.h"
|
||||
|
@ -40,7 +40,7 @@ using namespace std;
|
|||
|
||||
extern FILE *g_output;
|
||||
|
||||
void Plugins::FindCommands(const string &path, bool displayInfo)
|
||||
void Plugins::FindCommands(const tstring &path, bool displayInfo)
|
||||
{
|
||||
boost::scoped_ptr<dir_reader> dr( new_dir_reader() );
|
||||
dr->read(path);
|
||||
|
@ -49,10 +49,10 @@ void Plugins::FindCommands(const string &path, bool displayInfo)
|
|||
files_itr != dr->files().end();
|
||||
files_itr++)
|
||||
{
|
||||
if (!dir_reader::matches(*files_itr, "*.dll"))
|
||||
if (!dir_reader::matches(*files_itr, _T("*.dll")))
|
||||
continue;
|
||||
|
||||
const string plugin = path + PLATFORM_PATH_SEPARATOR_C + *files_itr;
|
||||
const tstring plugin = path + PLATFORM_PATH_SEPARATOR_C + *files_itr;
|
||||
GetExports(plugin, displayInfo);
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ vector<unsigned char> read_file(const string& filename) {
|
|||
vector<unsigned char> result;
|
||||
result.resize(filesize);
|
||||
|
||||
file.read(reinterpret_cast<char*>(&result[0]), filesize);
|
||||
file.read(reinterpret_cast<TCHAR*>(&result[0]), filesize);
|
||||
|
||||
if (size_t(file.tellg()) != filesize) { // ifstream::eof doesn't return true here
|
||||
throw NSISException("Couldn't read entire file '" + filename + "'");
|
||||
|
@ -99,7 +99,7 @@ vector<unsigned char> read_file(const string& filename) {
|
|||
}
|
||||
}
|
||||
|
||||
void Plugins::GetExports(const string &pathToDll, bool displayInfo)
|
||||
void Plugins::GetExports(const tstring &pathToDll, bool displayInfo)
|
||||
{
|
||||
vector<unsigned char> dlldata;
|
||||
PIMAGE_NT_HEADERS NTHeaders;
|
||||
|
@ -110,7 +110,7 @@ void Plugins::GetExports(const string &pathToDll, bool displayInfo)
|
|||
return;
|
||||
}
|
||||
|
||||
const string dllName = remove_file_extension(get_file_name(pathToDll));
|
||||
const tstring dllName = remove_file_extension(get_file_name(pathToDll));
|
||||
|
||||
FIX_ENDIAN_INT16_INPLACE(NTHeaders->FileHeader.Characteristics);
|
||||
if (NTHeaders->FileHeader.Characteristics & IMAGE_FILE_DLL)
|
||||
|
@ -140,12 +140,12 @@ void Plugins::GetExports(const string &pathToDll, bool displayInfo)
|
|||
for (unsigned long j = 0; j < FIX_ENDIAN_INT32(exports->NumberOfNames); j++)
|
||||
{
|
||||
const string name = string((char*)exports + FIX_ENDIAN_INT32(names[j]) - ExportDirVA);
|
||||
const string signature = dllName + "::" + name;
|
||||
const string lcsig = lowercase(signature);
|
||||
const tstring signature = dllName + _T("::") + name;
|
||||
const tstring lcsig = lowercase(signature);
|
||||
m_command_to_path[lcsig] = pathToDll;
|
||||
m_command_lowercase_to_command[lcsig] = signature;
|
||||
if (displayInfo)
|
||||
fprintf(g_output, " - %s\n", signature.c_str());
|
||||
_ftprintf(g_output, _T(" - %s\n"), signature.c_str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ void Plugins::GetExports(const string &pathToDll, bool displayInfo)
|
|||
}
|
||||
}
|
||||
|
||||
bool Plugins::IsPluginCommand(const string& token) const {
|
||||
bool Plugins::IsPluginCommand(const tstring& token) const {
|
||||
return m_command_to_path.find(lowercase(token)) != m_command_to_path.end();
|
||||
}
|
||||
|
||||
|
@ -177,11 +177,11 @@ Value get_value(const map<Key, Value>& the_map,
|
|||
}
|
||||
}
|
||||
|
||||
string Plugins::NormalizedCommand(const string& command) const {
|
||||
tstring Plugins::NormalizedCommand(const tstring& command) const {
|
||||
return get_value(m_command_lowercase_to_command, lowercase(command));
|
||||
}
|
||||
|
||||
int Plugins::GetPluginHandle(bool uninst, const string& command) const {
|
||||
int Plugins::GetPluginHandle(bool uninst, const tstring& command) const {
|
||||
if (uninst) {
|
||||
return get_value(m_command_to_uninstall_data_handle, command, -1);
|
||||
}
|
||||
|
@ -190,11 +190,11 @@ int Plugins::GetPluginHandle(bool uninst, const string& command) const {
|
|||
}
|
||||
}
|
||||
|
||||
string Plugins::GetPluginPath(const string& command) const {
|
||||
tstring Plugins::GetPluginPath(const tstring& command) const {
|
||||
return get_value(m_command_to_path, lowercase(command));
|
||||
}
|
||||
|
||||
void Plugins::SetDllDataHandle(bool uninst, const string& command, int dataHandle)
|
||||
void Plugins::SetDllDataHandle(bool uninst, const tstring& command, int dataHandle)
|
||||
{
|
||||
if (uninst) {
|
||||
m_command_to_uninstall_data_handle[command] = dataHandle;
|
||||
|
|
|
@ -12,32 +12,34 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/21/2007
|
||||
*/
|
||||
|
||||
#ifndef __X18_PLUGINS_H
|
||||
#define __X18_PLUGINS_H
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "tstring.h"
|
||||
|
||||
class Plugins
|
||||
{
|
||||
public:
|
||||
void FindCommands(const std::string& path, bool displayInfo);
|
||||
bool IsPluginCommand(const std::string& command) const;
|
||||
std::string NormalizedCommand(const std::string& command) const;
|
||||
int GetPluginHandle(bool uninst, const std::string& command) const;
|
||||
std::string GetPluginPath(const std::string& command) const;
|
||||
void SetDllDataHandle(bool uninst, const std::string& command, int dataHandle);
|
||||
void FindCommands(const tstring& path, bool displayInfo);
|
||||
bool IsPluginCommand(const tstring& command) const;
|
||||
tstring NormalizedCommand(const tstring& command) const;
|
||||
int GetPluginHandle(bool uninst, const tstring& command) const;
|
||||
tstring GetPluginPath(const tstring& command) const;
|
||||
void SetDllDataHandle(bool uninst, const tstring& command, int dataHandle);
|
||||
|
||||
private: // methods
|
||||
void GetExports(const std::string &pathToDll, bool displayInfo);
|
||||
void GetExports(const tstring &pathToDll, bool displayInfo);
|
||||
|
||||
private: // data members
|
||||
std::map<std::string, std::string> m_command_lowercase_to_command;
|
||||
std::map<std::string, std::string> m_command_to_path;
|
||||
std::map<std::string, int> m_command_to_data_handle;
|
||||
std::map<std::string, int> m_command_to_uninstall_data_handle;
|
||||
std::map<tstring, tstring> m_command_lowercase_to_command;
|
||||
std::map<tstring, tstring> m_command_to_path;
|
||||
std::map<tstring, int> m_command_to_data_handle;
|
||||
std::map<tstring, int> m_command_to_uninstall_data_handle;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,12 +12,15 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/21/2007
|
||||
*/
|
||||
|
||||
#include "ResourceEditor.h"
|
||||
#include "util.h"
|
||||
#include "winchar.h"
|
||||
#include <queue>
|
||||
#include "tchar.h"
|
||||
using namespace std;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -541,6 +544,7 @@ DWORD CResourceEditor::Save(BYTE* pbBuf, DWORD &dwSize) {
|
|||
|
||||
// This function scans exe sections and after find a match with given name
|
||||
// increments it's virtual size (auto fixes image size based on section alignment, etc)
|
||||
// Jim Park: The section name must be ASCII code. Do not TCHAR this stuff.
|
||||
bool CResourceEditor::AddExtraVirtualSize2PESection(const char* pszSectionName, int addsize)
|
||||
{
|
||||
PIMAGE_SECTION_HEADER sectionHeadersArray = IMAGE_FIRST_SECTION(m_ntHeaders);
|
||||
|
@ -889,7 +893,7 @@ int CResourceDirectory::Find(WCHAR* szName) {
|
|||
if (IS_INTRESOURCE(szName))
|
||||
return Find((WORD) (DWORD) szName);
|
||||
else
|
||||
if (szName[0] == '#')
|
||||
if (szName[0] == L'#')
|
||||
return Find(WORD(winchar_stoi(szName + 1)));
|
||||
|
||||
for (unsigned int i = 0; i < m_vEntries.size(); i++) {
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/21/2007
|
||||
*/
|
||||
|
||||
#if !defined(AFX_RESOURCEEDITOR_H__683BF710_E805_4093_975B_D5729186A89A__INCLUDED_)
|
||||
|
@ -27,7 +29,7 @@
|
|||
|
||||
#include "Platform.h"
|
||||
#ifdef _WIN32
|
||||
# include <WinNT.h>
|
||||
#include <WinNT.h>
|
||||
#else
|
||||
// all definitions for non Win32 platforms were taken from MinGW's free Win32 library
|
||||
# define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
|
||||
|
@ -127,6 +129,7 @@ public:
|
|||
DWORD GetResourceOffsetA(char* szType, char* szName, LANGID wLanguage);
|
||||
void FreeResource(BYTE* pbResource);
|
||||
|
||||
// The section name must be in ASCII.
|
||||
bool AddExtraVirtualSize2PESection(const char* pszSectionName, int addsize);
|
||||
DWORD Save(BYTE* pbBuf, DWORD &dwSize);
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Modified for Unicode support by Jim Park -- 08/21/2007
|
||||
*/
|
||||
|
||||
#include "ResourceVersionInfo.h"
|
||||
|
@ -54,8 +56,8 @@ CVersionStrigList::~CVersionStrigList()
|
|||
|
||||
int CVersionStrigList::add(LANGID langid, int codepage)
|
||||
{
|
||||
char Buff[10];
|
||||
sprintf(Buff, "%04x", langid);
|
||||
TCHAR Buff[10];
|
||||
sprintf(Buff, _T("%04x"), langid);
|
||||
int pos = SortedStringListND<struct version_string_list>::add(Buff);
|
||||
if (pos == -1) return false;
|
||||
((struct version_string_list*)gr.get())[pos].pChildStrings = new DefineList;
|
||||
|
@ -84,8 +86,8 @@ DefineList* CVersionStrigList::get_strings(int idx)
|
|||
|
||||
int CVersionStrigList::find(LANGID lang_id, int codepage)
|
||||
{
|
||||
char Buff[10];
|
||||
sprintf(Buff, "%04x", lang_id);
|
||||
TCHAR Buff[10];
|
||||
sprintf(Buff, _T("%04x"), lang_id);
|
||||
return SortedStringListND<struct version_string_list>::find(Buff);
|
||||
}
|
||||
|
||||
|
@ -132,6 +134,7 @@ void CResourceVersionInfo::SetProductVersion(int HighPart, int LowPart)
|
|||
m_FixedInfo.dwProductVersionMS = HighPart;
|
||||
}
|
||||
|
||||
// Jim Park: Not sure where this is used.
|
||||
int GetVersionHeader (LPSTR &p, WORD &wLength, WORD &wValueLength, WORD &wType)
|
||||
{
|
||||
WCHAR *szKey;
|
||||
|
@ -159,6 +162,14 @@ void PadStream (GrowBuf &strm)
|
|||
strm.add (&ZEROS, 4 - (strm.getlen() % 4));
|
||||
}
|
||||
|
||||
// Helper function only used by CResourceVersionInfo::ExportToStream
|
||||
// Cannot handle anything longer than 65K objects.
|
||||
//
|
||||
// @param wLength Size in bytes of the entire object we are storing.
|
||||
// @param wValueLength The value length in bytes.
|
||||
// @param wType If type is 1, it's a wchar_t string, so save value length appropriately.
|
||||
// @param key The string key
|
||||
// @param value The value mapped to string key.
|
||||
void SaveVersionHeader (GrowBuf &strm, WORD wLength, WORD wValueLength, WORD wType, const WCHAR *key, void *value)
|
||||
{
|
||||
WORD valueLen;
|
||||
|
@ -190,7 +201,7 @@ void CResourceVersionInfo::ExportToStream(GrowBuf &strm, int Index)
|
|||
WCHAR *KeyName, *KeyValue;
|
||||
|
||||
strm.resize(0);
|
||||
KeyName = winchar_fromansi("VS_VERSION_INFO");
|
||||
KeyName = winchar_fromansi(_T("VS_VERSION_INFO"));
|
||||
SaveVersionHeader (strm, 0, sizeof (VS_FIXEDFILEINFO), 0, KeyName, &m_FixedInfo);
|
||||
delete [] KeyName;
|
||||
|
||||
|
@ -200,8 +211,8 @@ void CResourceVersionInfo::ExportToStream(GrowBuf &strm, int Index)
|
|||
GrowBuf stringInfoStream;
|
||||
int codepage = m_ChildStringLists.get_codepage(Index);
|
||||
LANGID langid = m_ChildStringLists.get_lang(Index);
|
||||
char Buff[16];
|
||||
sprintf(Buff, "%04x%04x", langid, codepage);
|
||||
TCHAR Buff[16];
|
||||
sprintf(Buff, _T("%04x%04x"), langid, codepage);
|
||||
KeyName = winchar_fromansi(Buff, CP_ACP);
|
||||
SaveVersionHeader (stringInfoStream, 0, 0, 0, KeyName, &ZEROS);
|
||||
delete [] KeyName;
|
||||
|
@ -226,7 +237,7 @@ void CResourceVersionInfo::ExportToStream(GrowBuf &strm, int Index)
|
|||
|
||||
PadStream (strm);
|
||||
p = strm.getlen();
|
||||
KeyName = winchar_fromansi("StringFileInfo", CP_ACP);
|
||||
KeyName = winchar_fromansi(_T("StringFileInfo"), CP_ACP);
|
||||
SaveVersionHeader (strm, 0, 0, 0, KeyName, &ZEROS);
|
||||
delete [] KeyName;
|
||||
strm.add (stringInfoStream.get(), stringInfoStream.getlen());
|
||||
|
@ -240,13 +251,13 @@ void CResourceVersionInfo::ExportToStream(GrowBuf &strm, int Index)
|
|||
{
|
||||
PadStream (strm);
|
||||
p = strm.getlen();
|
||||
KeyName = winchar_fromansi("VarFileInfo", CP_ACP);
|
||||
KeyName = winchar_fromansi(_T("VarFileInfo"), CP_ACP);
|
||||
SaveVersionHeader (strm, 0, 0, 0, KeyName, &ZEROS);
|
||||
delete [] KeyName;
|
||||
PadStream (strm);
|
||||
|
||||
p1 = strm.getlen();
|
||||
KeyName = winchar_fromansi("Translation", CP_ACP);
|
||||
KeyName = winchar_fromansi(_T("Translation"), CP_ACP);
|
||||
SaveVersionHeader (strm, 0, 0, 0, KeyName, &ZEROS);
|
||||
delete [] KeyName;
|
||||
|
||||
|
@ -278,7 +289,7 @@ void CResourceVersionInfo::ExportToStream(GrowBuf &strm, int Index)
|
|||
}
|
||||
|
||||
// Returns 0 if success, 1 if already defined
|
||||
int CResourceVersionInfo::SetKeyValue(LANGID lang_id, int codepage, char* AKeyName, char* AValue)
|
||||
int CResourceVersionInfo::SetKeyValue(LANGID lang_id, int codepage, TCHAR* AKeyName, TCHAR* AValue)
|
||||
{
|
||||
int pos = m_ChildStringLists.find(lang_id, codepage);
|
||||
if ( pos == -1 )
|
||||
|
@ -304,7 +315,7 @@ int CResourceVersionInfo::GetCodePage(int Index)
|
|||
return m_ChildStringLists.get_codepage(Index);
|
||||
}
|
||||
|
||||
char *CResourceVersionInfo::FindKey(LANGID LangID, int codepage, const char *pKeyName)
|
||||
TCHAR *CResourceVersionInfo::FindKey(LANGID LangID, int codepage, const TCHAR *pKeyName)
|
||||
{
|
||||
int pos = m_ChildStringLists.find(LangID, codepage);
|
||||
if ( pos == -1 )
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support and Doxygen comments by Jim Park -- 07/26/2007
|
||||
*/
|
||||
|
||||
#if !defined(AFX_RESOURCEVERSIONINFO_H__80439ADA_49DA_4623_8DA9_1663FF356E76__INCLUDED_)
|
||||
|
@ -33,12 +35,46 @@ class CVersionStrigList : public SortedStringListND<struct version_string_list>
|
|||
{
|
||||
public:
|
||||
~CVersionStrigList();
|
||||
|
||||
/**
|
||||
* Add a version_string_list struct referred to by langid. Then add the
|
||||
* codepage value to the structure.
|
||||
*
|
||||
* @param langid The language ID (LANGID)
|
||||
* @param codepage The code page value to set.
|
||||
* @return The position to the inserted structure, false (0) if failed.
|
||||
*/
|
||||
int add(LANGID langid, int codepage);
|
||||
|
||||
/**
|
||||
* Get the language ID given the positional index idx.
|
||||
*/
|
||||
LANGID get_lang(int idx);
|
||||
|
||||
/**
|
||||
* Get the codepage value given the positional index idx.
|
||||
*/
|
||||
int get_codepage(int idx);
|
||||
|
||||
/**
|
||||
* Get the string pair mappings given the positional index idx.
|
||||
*/
|
||||
DefineList* get_strings(int idx);
|
||||
|
||||
/**
|
||||
* Given a language ID return the positional index that holds the
|
||||
* version_string_list struct. Actually, the codepage value is ignored.
|
||||
*/
|
||||
int find(LANGID lang_id, int codepage);
|
||||
|
||||
/**
|
||||
* Get the length of the buffer of strings in count of TCHARs.
|
||||
*/
|
||||
int getlen();
|
||||
|
||||
/**
|
||||
* Get the number of version_string_list objects stored in this list.
|
||||
*/
|
||||
int getnum();
|
||||
};
|
||||
|
||||
|
@ -51,15 +87,58 @@ class CResourceVersionInfo
|
|||
public:
|
||||
CResourceVersionInfo();
|
||||
virtual ~CResourceVersionInfo();
|
||||
int SetKeyValue(LANGID lang_id, int codepage, char* AKeyName, char* AValue);
|
||||
int SetKeyValue(LANGID lang_id, int codepage, TCHAR* AKeyName, TCHAR* AValue);
|
||||
|
||||
/**
|
||||
* Sets the file flags into the VS_FIXEDFILEINFO structure for this object.
|
||||
* Only what's set as valid in the dwFileFlagsMask is allowed to be set.
|
||||
* Currently, this API is never used and unless dwFileFlagsMask is set,
|
||||
* should never be used.
|
||||
*/
|
||||
void SetFileFlags(int Value);
|
||||
|
||||
/**
|
||||
* Set the file version.
|
||||
*/
|
||||
void SetFileVersion(int HighPart, int LowPart);
|
||||
|
||||
/**
|
||||
* Set the product version.
|
||||
*/
|
||||
void SetProductVersion(int HighPart, int LowPart);
|
||||
|
||||
/**
|
||||
* Write the data out to the flat buffer 'strm'. Not sure where and how
|
||||
* it gets read back in though.
|
||||
*/
|
||||
void ExportToStream(GrowBuf &strm, int Index);
|
||||
|
||||
/**
|
||||
* How many string tables are we storing in the m_ChildStringLists?
|
||||
*/
|
||||
int GetStringTablesCount();
|
||||
|
||||
/**
|
||||
* Given a positional index, get the Language ID associated with it.
|
||||
*/
|
||||
LANGID GetLangID(int Index);
|
||||
|
||||
/**
|
||||
* Given a positional index, get the CodePage associated with it.
|
||||
*/
|
||||
int GetCodePage(int Index);
|
||||
char *FindKey(LANGID LangID, int codepage, const char *pKeyName);
|
||||
|
||||
/**
|
||||
* Given the language ID, codepage, and the 'keyname', return the
|
||||
* TCHAR* pointer to the value portion of the key-value pair.
|
||||
*
|
||||
* @param LangID The language ID.
|
||||
* @param codepage The codepage. (Not used.)
|
||||
* @param pKeyName The key name in the key-value pair of strings.
|
||||
* @return The value string associated with the key string. NULL
|
||||
* if not found.
|
||||
*/
|
||||
TCHAR *FindKey(LANGID LangID, int codepage, const TCHAR *pKeyName);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/24/2007
|
||||
*/
|
||||
|
||||
#include "ShConstants.h"
|
||||
|
@ -21,7 +23,7 @@ ConstantsStringList::ConstantsStringList()
|
|||
index = 0;
|
||||
}
|
||||
|
||||
int ConstantsStringList::add(const char *name, int value1, int value2)
|
||||
int ConstantsStringList::add(const TCHAR *name, int value1, int value2)
|
||||
{
|
||||
int pos=SortedStringListND<struct constantstring>::add(name);
|
||||
if (pos == -1) return -1;
|
||||
|
@ -37,7 +39,7 @@ int ConstantsStringList::add(const char *name, int value1, int value2)
|
|||
return temp;
|
||||
}
|
||||
|
||||
int ConstantsStringList::get(char *name, int n_chars /*= -1*/)
|
||||
int ConstantsStringList::get(TCHAR *name, int n_chars /*= -1*/)
|
||||
{
|
||||
int v=SortedStringListND<struct constantstring>::find(name, n_chars);
|
||||
if (v==-1) return -1;
|
||||
|
@ -63,12 +65,12 @@ int ConstantsStringList::get_value2(int idx)
|
|||
return (((struct constantstring*)gr.get())[pos].value2);
|
||||
}
|
||||
|
||||
char* ConstantsStringList::idx2name(int idx)
|
||||
TCHAR* ConstantsStringList::idx2name(int idx)
|
||||
{
|
||||
int pos=get_internal_idx(idx);
|
||||
if (pos==-1) return NULL;
|
||||
struct constantstring *data=(struct constantstring *)gr.get();
|
||||
return ((char*)strings.get() + data[pos].name);
|
||||
return ((TCHAR*)strings.get() + data[pos].name);
|
||||
}
|
||||
|
||||
int ConstantsStringList::get_internal_idx(int idx)
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/24/2007
|
||||
*/
|
||||
|
||||
#ifndef ___CONSTANTS___H_____
|
||||
|
@ -32,12 +34,12 @@ class ConstantsStringList : public SortedStringListND<struct constantstring>
|
|||
public:
|
||||
ConstantsStringList();
|
||||
|
||||
int add(const char *name, int value1, int value2);
|
||||
int get(char *name, int n_chars = -1);
|
||||
int add(const TCHAR *name, int value1, int value2);
|
||||
int get(TCHAR *name, int n_chars = -1);
|
||||
int getnum();
|
||||
int get_value1(int idx);
|
||||
int get_value2(int idx);
|
||||
char *idx2name(int idx);
|
||||
TCHAR *idx2name(int idx);
|
||||
|
||||
private:
|
||||
int index;
|
||||
|
|
|
@ -78,11 +78,15 @@ scripts = Split("""
|
|||
icon1.nsi
|
||||
icon2.nsi
|
||||
preprocessor.nsi
|
||||
winver.nsi
|
||||
""")
|
||||
|
||||
Import('env AddAvailableLibs AddZLib')
|
||||
|
||||
if env['UNICODE']:
|
||||
scripts.append('Unicode/winver.nsi')
|
||||
else:
|
||||
scripts.append('ANSI/winver.nsi')
|
||||
|
||||
# Test scripts
|
||||
env.TestScript(scripts)
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// Reviewed for Unicode support by Jim Park -- 08/24/2007
|
||||
|
||||
#include "../Platform.h"
|
||||
|
||||
void NSISCALL mini_memcpy(void *out, const void *in, int len)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// Unicode support by Jim Park -- 08/13/2007
|
||||
//
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include "../mmap.h"
|
||||
|
||||
|
@ -11,7 +13,7 @@ int g_display_errors = 1;
|
|||
FILE *g_output = stderr;
|
||||
|
||||
void quit() {
|
||||
fprintf(g_output, "MMap quit\n");
|
||||
_ftprintf(g_output, _T("MMap quit\n"));
|
||||
}
|
||||
|
||||
class MMapTest : public CppUnit::TestFixture {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include "../dirreader.h"
|
||||
|
||||
#include <string>
|
||||
#include "tstring.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -13,30 +13,30 @@ class SpecTest : public CppUnit::TestFixture {
|
|||
|
||||
public:
|
||||
void testMatches() {
|
||||
testMatch("test.exe", "test.exe", true);
|
||||
testMatch("test", "test", true);
|
||||
testMatch("test.exe", "test.*", true);
|
||||
testMatch("test", "test.*", true);
|
||||
testMatch("test", "????", true);
|
||||
testMatch("test", "???", false);
|
||||
testMatch("test", "*.exe", false);
|
||||
testMatch("test.exe.bat", "*.exe", false);
|
||||
testMatch("test.exe.bat", "*.bat", true);
|
||||
testMatch("test.exe.bat", "*t", true);
|
||||
testMatch("test.exe.bat", "*", true);
|
||||
testMatch("test.exe.bat", "*x*", true);
|
||||
testMatch("test.exe.exe", "*.*", true);
|
||||
testMatch("test.exe.bat", "*.b*", true);
|
||||
testMatch("test.exe.bat", "tes?.*.bat", true);
|
||||
testMatch("test.exe.bat", "tes?.*bat", true);
|
||||
testMatch("test.exe.bat", "tes?.*bat***.", true);
|
||||
testMatch("test.exe", "????.*", true);
|
||||
testMatch("testing.exe", "????.*", false);
|
||||
testMatch(TEXT("test.exe"), TEXT("test.exe"), true);
|
||||
testMatch(TEXT("test"), TEXT("test"), true);
|
||||
testMatch(TEXT("test.exe"), TEXT("test.*"), true);
|
||||
testMatch(TEXT("test"), TEXT("test.*"), true);
|
||||
testMatch(TEXT("test"), TEXT("????"), true);
|
||||
testMatch(TEXT("test"), TEXT("???"), false);
|
||||
testMatch(TEXT("test"), TEXT("*.exe"), false);
|
||||
testMatch(TEXT("test.exe.bat"), TEXT("*.exe"), false);
|
||||
testMatch(TEXT("test.exe.bat"), TEXT("*.bat"), true);
|
||||
testMatch(TEXT("test.exe.bat"), TEXT("*t"), true);
|
||||
testMatch(TEXT("test.exe.bat"), TEXT("*"), true);
|
||||
testMatch(TEXT("test.exe.bat"), TEXT("*x*"), true);
|
||||
testMatch(TEXT("test.exe.exe"), TEXT("*.*"), true);
|
||||
testMatch(TEXT("test.exe.bat"), TEXT("*.b*"), true);
|
||||
testMatch(TEXT("test.exe.bat"), TEXT("tes?.*.bat"), true);
|
||||
testMatch(TEXT("test.exe.bat"), TEXT("tes?.*bat"), true);
|
||||
testMatch(TEXT("test.exe.bat"), TEXT("tes?.*bat***."), true);
|
||||
testMatch(TEXT("test.exe"), TEXT("????.*"), true);
|
||||
testMatch(TEXT("testing.exe"), TEXT("????.*"), false);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void testMatch(string name, string spec, bool result) {
|
||||
void testMatch(tstring name, tstring spec, bool result) {
|
||||
CPPUNIT_ASSERT_EQUAL( dir_reader::matches(name, spec), result );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Reviewed for Unicode support by Jim Park -- 08/13/2007
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include "../winchar.h"
|
||||
|
||||
|
|
912
Source/build.cpp
912
Source/build.cpp
File diff suppressed because it is too large
Load diff
910
Source/build.h
910
Source/build.h
|
@ -1,421 +1,491 @@
|
|||
/*
|
||||
* build.h
|
||||
*
|
||||
* This file is a part of NSIS.
|
||||
*
|
||||
* Copyright (C) 1999-2008 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 _BUILD_H_
|
||||
#define _BUILD_H_
|
||||
|
||||
#include "strlist.h"
|
||||
#include "lineparse.h"
|
||||
#include "lang.h"
|
||||
#include "ResourceEditor.h"
|
||||
#include "ResourceVersionInfo.h"
|
||||
#include "uservars.h"
|
||||
#include "ShConstants.h"
|
||||
#include "mmap.h"
|
||||
#include "manifest.h"
|
||||
#include "icon.h"
|
||||
|
||||
#include "exehead/fileform.h"
|
||||
#include "exehead/config.h"
|
||||
|
||||
#include <string>
|
||||
#include <set>
|
||||
|
||||
#ifdef NSIS_SUPPORT_STANDARD_PREDEFINES
|
||||
// Added by Sunil Kamath 11 June 2003
|
||||
# include <time.h>
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
// Changed by Amir Szekely 31st July 2002
|
||||
#include "compressor.h"
|
||||
#include "czlib.h"
|
||||
#include "cbzip2.h"
|
||||
#include "clzma.h"
|
||||
|
||||
#endif//NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
# include "Plugins.h"
|
||||
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
|
||||
#define PS_OK 0
|
||||
#define PS_EOF 1
|
||||
#define PS_ERROR 50
|
||||
#define PS_WARNING 100
|
||||
|
||||
// token placement
|
||||
#define TP_SEC 1
|
||||
#define TP_FUNC 2
|
||||
#define TP_CODE (TP_SEC | TP_FUNC)
|
||||
#define TP_GLOBAL 4
|
||||
#define TP_PAGEEX 8
|
||||
#define TP_PG (TP_GLOBAL | TP_PAGEEX)
|
||||
#define TP_ALL (TP_CODE | TP_PG)
|
||||
|
||||
enum notify_e {
|
||||
MAKENSIS_NOTIFY_SCRIPT,
|
||||
MAKENSIS_NOTIFY_WARNING,
|
||||
MAKENSIS_NOTIFY_ERROR,
|
||||
MAKENSIS_NOTIFY_OUTPUT
|
||||
};
|
||||
|
||||
#define PAGE_CUSTOM 0
|
||||
#define PAGE_LICENSE 1
|
||||
#define PAGE_COMPONENTS 2
|
||||
#define PAGE_DIRECTORY 3
|
||||
#define PAGE_INSTFILES 4
|
||||
#define PAGE_UNINSTCONFIRM 5
|
||||
#define PAGE_COMPLETED 6
|
||||
|
||||
class CEXEBuild {
|
||||
public:
|
||||
CEXEBuild();
|
||||
void initialize(const char *makensis_path);
|
||||
~CEXEBuild();
|
||||
|
||||
// to add a warning to the compiler's warning list.
|
||||
void warning(const char *s, ...);
|
||||
// warning with file name and line count
|
||||
void warning_fl(const char *s, ...);
|
||||
|
||||
// to add a defined thing.
|
||||
void define(const char *p, const char *v="");
|
||||
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
// Added by Ximon Eighteen 5th August 2002
|
||||
void build_plugin_table(void);
|
||||
int plugins_processed;
|
||||
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
|
||||
|
||||
// process a script (you can process as many scripts as you want,
|
||||
// it is as if they are concatenated)
|
||||
int process_script(FILE *fp, const char *curfilename);
|
||||
int process_oneline(char *line, const char *curfilename, int lineptr);
|
||||
|
||||
// you only get to call write_output once, so use it wisely.
|
||||
int write_output(void);
|
||||
|
||||
void print_help(char *commandname=NULL);
|
||||
|
||||
DefineList definedlist;
|
||||
|
||||
int display_errors;
|
||||
int display_script;
|
||||
int display_warnings;
|
||||
int display_info;
|
||||
|
||||
int linecnt;
|
||||
const char *curfilename;
|
||||
FILE *fp;
|
||||
|
||||
HWND notify_hwnd;
|
||||
void notify(notify_e code, const char *data) const;
|
||||
|
||||
private:
|
||||
int check_write_output_errors() const;
|
||||
int prepare_uninstaller();
|
||||
int pack_exe_header();
|
||||
|
||||
int set_compressor(const std::string& compressor, const bool solid);
|
||||
int update_exehead(const std::string& file, size_t *size=NULL);
|
||||
void update_exehead(const unsigned char *new_exehead, size_t new_size);
|
||||
|
||||
// tokens.cpp
|
||||
bool is_valid_token(char *s);
|
||||
int get_commandtoken(char *s, int *np, int *op, int *pos);
|
||||
int GetCurrentTokenPlace();
|
||||
int IsTokenPlacedRight(int pos, char *tok);
|
||||
|
||||
// script.cpp
|
||||
#ifdef NSIS_SUPPORT_STANDARD_PREDEFINES
|
||||
// Added by Sunil Kamath 11 June 2003
|
||||
char* set_file_predefine(const char *);
|
||||
void restore_file_predefine(char *);
|
||||
char* set_timestamp_predefine(const char *);
|
||||
void restore_timestamp_predefine(char *);
|
||||
char* set_line_predefine(int, BOOL);
|
||||
void restore_line_predefine(char *);
|
||||
void set_date_time_predefines();
|
||||
void del_date_time_predefines();
|
||||
#endif
|
||||
int parseScript();
|
||||
int includeScript(char *f);
|
||||
int MacroExists(const char *macroname);
|
||||
#ifdef NSIS_FIX_DEFINES_IN_STRINGS
|
||||
void ps_addtoline(const char *str, GrowBuf &linedata, StringList &hist, bool bIgnoreDefines = false);
|
||||
#else
|
||||
void ps_addtoline(const char *str, GrowBuf &linedata, StringList &hist);
|
||||
#endif
|
||||
int doParse(const char *str);
|
||||
int doCommand(int which_token, LineParser &line);
|
||||
|
||||
int do_add_file(const char *lgss, int attrib, int recurse, int *total_files, const char
|
||||
*name_override=0, int generatecode=1, int *data_handle=0,
|
||||
const std::set<std::string>& excluded=std::set<std::string>(),
|
||||
const std::string& basedir=std::string(""), bool dir_created=false);
|
||||
int add_file(const std::string& dir, const std::string& file, int attrib, const char
|
||||
*name_override, int generatecode, int *data_handle);
|
||||
int do_add_file_create_dir(const std::string& local_dir, const std::string& dir, int attrib=0);
|
||||
|
||||
GrowBuf m_linebuild; // used for concatenating lines
|
||||
|
||||
// used by doParse to do preprocessing
|
||||
struct ifblock
|
||||
{
|
||||
int hasexeced;
|
||||
int elseused;
|
||||
int ignore;
|
||||
int inherited_ignore;
|
||||
} *cur_ifblock;
|
||||
|
||||
TinyGrowBuf build_preprocessor_data;
|
||||
|
||||
void start_ifblock();
|
||||
void end_ifblock();
|
||||
int num_ifblock();
|
||||
|
||||
int last_line_had_slash;
|
||||
bool inside_comment;
|
||||
int multiple_entries_instruction;
|
||||
|
||||
void ERROR_MSG(const char *s, ...) const;
|
||||
void SCRIPT_MSG(const char *s, ...) const;
|
||||
void INFO_MSG(const char *s, ...) const;
|
||||
/*
|
||||
* build.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.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/10/2007
|
||||
*/
|
||||
|
||||
DefineList *searchParseString(const char *source_string, LineParser *line, int parmOffs, bool ignCase, bool noErrors);
|
||||
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
int add_plugins_dir_initializer(void);
|
||||
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
|
||||
// build.cpp functions used mostly by script.cpp
|
||||
void set_code_type_predefines(const char *value = NULL);
|
||||
int getcurdbsize();
|
||||
int add_section(const char *secname, const char *defname, int expand=0);
|
||||
int section_end();
|
||||
int add_function(const char *funname);
|
||||
int function_end();
|
||||
void section_add_size_kb(int kb);
|
||||
int section_add_flags(int flags);
|
||||
int section_add_install_type(int inst_type);
|
||||
int add_page(int type);
|
||||
int page_end();
|
||||
int add_label(const char *name);
|
||||
int add_entry(const entry *ent);
|
||||
int add_entry_direct(int which, int o0=0, int o1=0, int o2=0, int o3=0, int o4=0, int o5=0);
|
||||
int add_db_data(IMMap *map); // returns offset
|
||||
int add_db_data(const char *data, int length); // returns offset
|
||||
int add_data(const char *data, int length, IGrowBuf *dblock); // returns offset
|
||||
int add_string(const char *string, int process=1, WORD codepage=CP_ACP); // returns offset (in string table)
|
||||
int add_intstring(const int i); // returns offset in stringblock
|
||||
|
||||
int preprocess_string(char *out, const char *in, WORD codepage=CP_ACP);
|
||||
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
// Added by Ximon Eighteen 5th August 2002
|
||||
Plugins m_plugins;
|
||||
bool plugin_used;
|
||||
bool uninst_plugin_used;
|
||||
int build_plugin_unload;
|
||||
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
|
||||
// build.cpp functions used mostly within build.cpp
|
||||
int datablock_optimize(int start_offset, int first_int);
|
||||
void printline(int l);
|
||||
int process_jump(LineParser &line, int wt, int *offs);
|
||||
|
||||
int AddVersionInfo();
|
||||
int ProcessPages();
|
||||
void PrepareInstTypes();
|
||||
void AddStandardStrings();
|
||||
void PrepareHeaders(IGrowBuf *hdrbuf);
|
||||
int SetVarsSection();
|
||||
int SetManifest();
|
||||
int UpdatePEHeader();
|
||||
|
||||
int resolve_jump_int(const char *fn, int *a, int offs, int start, int end);
|
||||
int resolve_call_int(const char *fn, const char *str, int fptr, int *ofs);
|
||||
int resolve_instruction(const char *fn, const char *str, entry *w, int offs, int start, int end);
|
||||
|
||||
int resolve_coderefs(const char *str);
|
||||
void print_warnings();
|
||||
int uninstall_generate();
|
||||
void set_uninstall_mode(int un);
|
||||
|
||||
// lang.cpp functions and variables
|
||||
void InitLangTables();
|
||||
LanguageTable *GetLangTable(LANGID &lang, bool create = true);
|
||||
const char *GetLangNameAndCP(LANGID lang, unsigned int *codepage = NULL);
|
||||
int DefineLangString(const char *name, int process=-1);
|
||||
int DefineInnerLangString(int id, int process=-1);
|
||||
int SetLangString(char *name, LANGID lang, char *string);
|
||||
int SetInnerString(int id, char *string);
|
||||
int GenerateLangTable(LanguageTable *lt, int num_lang_tables);
|
||||
int GenerateLangTables();
|
||||
void FillLanguageTable(LanguageTable *table);
|
||||
int HasUserDefined(int id) {
|
||||
const char *us = UserInnerStrings.get(id);
|
||||
return us && *us;
|
||||
};
|
||||
|
||||
LanguageTable *LoadLangFile(char *filename);
|
||||
void DeleteLangTable(LanguageTable *table);
|
||||
|
||||
NLFRef NLFRefs[NLF_STRINGS];
|
||||
bool keep_ref;
|
||||
StringsArray UserInnerStrings;
|
||||
bool defcodepage_set;
|
||||
GrowBuf lang_tables;
|
||||
LANGID last_used_lang;
|
||||
LangStringList build_langstrings;
|
||||
int build_langstring_num, ubuild_langstring_num;
|
||||
char build_font[1024];
|
||||
int build_font_size;
|
||||
|
||||
unsigned int uDefCodePage;
|
||||
|
||||
// pages stuff
|
||||
int license_res_id;
|
||||
page *cur_page;
|
||||
int cur_page_type;
|
||||
int enable_last_page_cancel, uenable_last_page_cancel;
|
||||
|
||||
int disable_window_icon;
|
||||
|
||||
// User variables stuff
|
||||
int GetUserVarIndex(LineParser &line, int token);
|
||||
// Added by ramon 3 jun 2003
|
||||
UserVarsStringList m_UserVarNames;
|
||||
int m_iBaseVarsNum;
|
||||
int DeclaredUserVar(const char *VarName);
|
||||
void VerifyDeclaredUserVarRefs(UserVarsStringList *pVarsStringList);
|
||||
|
||||
ConstantsStringList m_ShellConstants;
|
||||
|
||||
// a whole bunch O data.
|
||||
|
||||
std::string stubs_dir;
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
ICompressor *compressor;
|
||||
CZlib zlib_compressor;
|
||||
CBzip2 bzip2_compressor;
|
||||
CLZMA lzma_compressor;
|
||||
#endif
|
||||
bool build_compressor_set;
|
||||
bool build_compressor_final;
|
||||
bool build_compress_whole;
|
||||
int build_compress;
|
||||
int build_compress_level;
|
||||
int build_compress_dict_size;
|
||||
|
||||
bool no_space_texts;
|
||||
|
||||
bool has_called_write_output;
|
||||
|
||||
char build_packname[1024], build_packcmd[1024];
|
||||
int build_overwrite, build_last_overwrite, build_crcchk,
|
||||
build_datesave, build_optimize_datablock,
|
||||
build_allowskipfiles; // Added by ramon 23 May 2003
|
||||
|
||||
header build_header, build_uninst, *cur_header;
|
||||
int uninstall_mode;
|
||||
int uninstall_size,uninstall_size_full;
|
||||
int uninstaller_writes_used;
|
||||
|
||||
char build_output_filename[1024];
|
||||
|
||||
int build_include_depth;
|
||||
|
||||
// Added by ramon 6 jun 2003
|
||||
#ifdef NSIS_SUPPORT_VERSION_INFO
|
||||
CResourceVersionInfo rVersionInfo;
|
||||
char version_product_v[1024];
|
||||
#endif
|
||||
|
||||
int sectiongroup_open_cnt;
|
||||
FastStringList m_warnings;
|
||||
GrowBuf m_macros;
|
||||
|
||||
StringList m_macro_entry;
|
||||
|
||||
int db_opt_save, db_comp_save, db_full_size, db_opt_save_u,
|
||||
db_comp_save_u, db_full_size_u;
|
||||
|
||||
FastStringList include_dirs;
|
||||
|
||||
StringList ns_func; // function namespace
|
||||
StringList ns_label; // label namespace
|
||||
|
||||
int build_cursection_isfunc;
|
||||
section *build_cursection;
|
||||
TinyGrowBuf build_sections, ubuild_sections, *cur_sections;
|
||||
GrowBuf build_entries,ubuild_entries, *cur_entries;
|
||||
GrowBuf build_instruction_entry_map,ubuild_instruction_entry_map, *cur_instruction_entry_map;
|
||||
TinyGrowBuf build_functions, ubuild_functions, *cur_functions;
|
||||
TinyGrowBuf build_labels, ubuild_labels, *cur_labels;
|
||||
StringList build_strlist, ubuild_strlist, *cur_strlist;
|
||||
GrowBuf build_langtables, ubuild_langtables, *cur_langtables;
|
||||
TinyGrowBuf build_pages, ubuild_pages, *cur_pages;
|
||||
TinyGrowBuf build_ctlcolors, ubuild_ctlcolors, *cur_ctlcolors;
|
||||
|
||||
// don't forget to update the cache after updating the datablock
|
||||
// see datablock_optimize for an example
|
||||
MMapBuf build_datablock, ubuild_datablock;
|
||||
TinyGrowBuf build_datablock_cache, ubuild_datablock_cache;
|
||||
IGrowBuf *cur_datablock, *cur_datablock_cache;
|
||||
struct cached_db_size
|
||||
{
|
||||
int first_int; // size | (compressed ? 0x80000000 : 0)
|
||||
int start_offset;
|
||||
};
|
||||
|
||||
int build_filebuflen;
|
||||
|
||||
TinyGrowBuf verbose_stack;
|
||||
|
||||
unsigned char *m_exehead;
|
||||
size_t m_exehead_size;
|
||||
size_t m_exehead_original_size;
|
||||
|
||||
bool branding_image_found;
|
||||
WORD branding_image_id;
|
||||
|
||||
IconGroup installer_icon;
|
||||
IconGroup uninstaller_icon;
|
||||
size_t m_unicon_size;
|
||||
|
||||
#ifdef NSIS_SUPPORT_BGBG
|
||||
LOGFONT bg_font;
|
||||
LOGFONT bg_default_font;
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
int deflateToFile(FILE *fp, char *buf, int len); // len==0 to flush
|
||||
#endif
|
||||
|
||||
manifest::comctl manifest_comctl;
|
||||
manifest::exec_level manifest_exec_level;
|
||||
|
||||
CResourceEditor *res_editor;
|
||||
void init_res_editor();
|
||||
void close_res_editor();
|
||||
};
|
||||
|
||||
#endif //_BUILD_H_
|
||||
#ifndef _BUILD_H_
|
||||
#define _BUILD_H_
|
||||
|
||||
#include "strlist.h"
|
||||
#include "lineparse.h"
|
||||
#include "lang.h"
|
||||
#include "ResourceEditor.h"
|
||||
#include "ResourceVersionInfo.h"
|
||||
#include "uservars.h"
|
||||
#include "ShConstants.h"
|
||||
#include "mmap.h"
|
||||
#include "manifest.h"
|
||||
#include "icon.h"
|
||||
|
||||
#include "exehead/fileform.h"
|
||||
#include "exehead/config.h"
|
||||
|
||||
#include "tstring.h"
|
||||
#include <set>
|
||||
|
||||
#ifdef NSIS_SUPPORT_STANDARD_PREDEFINES
|
||||
// Added by Sunil Kamath 11 June 2003
|
||||
# include <time.h>
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
// Changed by Amir Szekely 31st July 2002
|
||||
#include "compressor.h"
|
||||
#include "czlib.h"
|
||||
#include "cbzip2.h"
|
||||
#include "clzma.h"
|
||||
|
||||
#endif//NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
# include "Plugins.h"
|
||||
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
|
||||
#define PS_OK 0
|
||||
#define PS_EOF 1
|
||||
#define PS_ERROR 50
|
||||
#define PS_WARNING 100
|
||||
|
||||
// token placement
|
||||
#define TP_SEC 1
|
||||
#define TP_FUNC 2
|
||||
#define TP_CODE (TP_SEC | TP_FUNC)
|
||||
#define TP_GLOBAL 4
|
||||
#define TP_PAGEEX 8
|
||||
#define TP_PG (TP_GLOBAL | TP_PAGEEX)
|
||||
#define TP_ALL (TP_CODE | TP_PG)
|
||||
|
||||
enum notify_e {
|
||||
MAKENSIS_NOTIFY_SCRIPT,
|
||||
MAKENSIS_NOTIFY_WARNING,
|
||||
MAKENSIS_NOTIFY_ERROR,
|
||||
MAKENSIS_NOTIFY_OUTPUT
|
||||
};
|
||||
|
||||
#define PAGE_CUSTOM 0
|
||||
#define PAGE_LICENSE 1
|
||||
#define PAGE_COMPONENTS 2
|
||||
#define PAGE_DIRECTORY 3
|
||||
#define PAGE_INSTFILES 4
|
||||
#define PAGE_UNINSTCONFIRM 5
|
||||
#define PAGE_COMPLETED 6
|
||||
|
||||
class CEXEBuild {
|
||||
public:
|
||||
CEXEBuild();
|
||||
void initialize(const TCHAR *makensis_path);
|
||||
~CEXEBuild();
|
||||
|
||||
// to add a warning to the compiler's warning list.
|
||||
void warning(const TCHAR *s, ...);
|
||||
// warning with file name and line count
|
||||
void warning_fl(const TCHAR *s, ...);
|
||||
|
||||
// to add a defined thing.
|
||||
void define(const TCHAR *p, const TCHAR *v=TEXT(""));
|
||||
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
// Added by Ximon Eighteen 5th August 2002
|
||||
void build_plugin_table(void);
|
||||
int plugins_processed;
|
||||
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
|
||||
|
||||
// process a script (you can process as many scripts as you want,
|
||||
// it is as if they are concatenated)
|
||||
int process_script(FILE *fp, const TCHAR *curfilename);
|
||||
int process_oneline(TCHAR *line, const TCHAR *curfilename, int lineptr);
|
||||
|
||||
// you only get to call write_output once, so use it wisely.
|
||||
int write_output(void);
|
||||
|
||||
void print_help(TCHAR *commandname=NULL);
|
||||
|
||||
DefineList definedlist; // List of identifiers marked as "defined" like
|
||||
// C++ macro definitions such as _UNICODE.
|
||||
|
||||
int display_errors;
|
||||
int display_script;
|
||||
int display_warnings;
|
||||
int display_info;
|
||||
|
||||
int linecnt;
|
||||
const TCHAR *curfilename;
|
||||
FILE *fp;
|
||||
|
||||
HWND notify_hwnd;
|
||||
void notify(notify_e code, const TCHAR *data) const;
|
||||
|
||||
private:
|
||||
int check_write_output_errors() const;
|
||||
int prepare_uninstaller();
|
||||
int pack_exe_header();
|
||||
|
||||
int set_compressor(const tstring& compressor, const bool solid);
|
||||
int update_exehead(const tstring& file, size_t *size=NULL);
|
||||
void update_exehead(const unsigned char *new_exehead, size_t new_size);
|
||||
|
||||
// tokens.cpp
|
||||
bool is_valid_token(TCHAR *s);
|
||||
int get_commandtoken(TCHAR *s, int *np, int *op, int *pos);
|
||||
|
||||
/**
|
||||
* Returns the current "state" by looking at whether it is in a
|
||||
* section/function/pagex or global.
|
||||
* @return TP_FUNC, TP_SEC, TP_PAGEEX, TP_GLOBAL.
|
||||
*/
|
||||
int GetCurrentTokenPlace();
|
||||
int IsTokenPlacedRight(int pos, TCHAR *tok);
|
||||
|
||||
// script.cpp
|
||||
#ifdef NSIS_SUPPORT_STANDARD_PREDEFINES
|
||||
// Added by Sunil Kamath 11 June 2003
|
||||
TCHAR* set_file_predefine(const TCHAR *);
|
||||
void restore_file_predefine(TCHAR *);
|
||||
TCHAR* set_timestamp_predefine(const TCHAR *);
|
||||
void restore_timestamp_predefine(TCHAR *);
|
||||
TCHAR* set_line_predefine(int, BOOL);
|
||||
void restore_line_predefine(TCHAR *);
|
||||
void set_date_time_predefines();
|
||||
void del_date_time_predefines();
|
||||
#endif
|
||||
int parseScript();
|
||||
int includeScript(TCHAR *f);
|
||||
int MacroExists(const TCHAR *macroname);
|
||||
#ifdef NSIS_FIX_DEFINES_IN_STRINGS
|
||||
void ps_addtoline(const TCHAR *str, GrowBuf &linedata, StringList &hist, bool bIgnoreDefines = false);
|
||||
#else
|
||||
void ps_addtoline(const TCHAR *str, GrowBuf &linedata, StringList &hist);
|
||||
#endif
|
||||
int doParse(const TCHAR *str);
|
||||
int doCommand(int which_token, LineParser &line);
|
||||
|
||||
int do_add_file(const TCHAR *lgss, int attrib, int recurse, int *total_files, const TCHAR
|
||||
*name_override=0, int generatecode=1, int *data_handle=0,
|
||||
const std::set<tstring>& excluded=std::set<tstring>(),
|
||||
const tstring& basedir=tstring(_T("")), bool dir_created=false);
|
||||
int add_file(const tstring& dir, const tstring& file, int attrib, const TCHAR
|
||||
*name_override, int generatecode, int *data_handle);
|
||||
int do_add_file_create_dir(const tstring& local_dir, const tstring& dir, int attrib=0);
|
||||
|
||||
GrowBuf m_linebuild; // used for concatenating lines
|
||||
|
||||
// used by doParse to do preprocessing
|
||||
struct ifblock
|
||||
{
|
||||
int hasexeced;
|
||||
int elseused;
|
||||
int ignore;
|
||||
int inherited_ignore;
|
||||
} *cur_ifblock;
|
||||
|
||||
TinyGrowBuf build_preprocessor_data;
|
||||
|
||||
void start_ifblock();
|
||||
void end_ifblock();
|
||||
int num_ifblock();
|
||||
|
||||
int last_line_had_slash;
|
||||
bool inside_comment;
|
||||
int multiple_entries_instruction; // 1 (true) or 0 (false)
|
||||
|
||||
void ERROR_MSG(const TCHAR *s, ...) const;
|
||||
void SCRIPT_MSG(const TCHAR *s, ...) const;
|
||||
void INFO_MSG(const TCHAR *s, ...) const;
|
||||
|
||||
DefineList *searchParseString(const TCHAR *source_string, LineParser *line, int parmOffs, bool ignCase, bool noErrors);
|
||||
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
int add_plugins_dir_initializer(void);
|
||||
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
|
||||
// build.cpp functions used mostly by script.cpp
|
||||
void set_code_type_predefines(const TCHAR *value = NULL);
|
||||
int getcurdbsize();
|
||||
int add_section(const TCHAR *secname, const TCHAR *defname, int expand=0);
|
||||
int section_end();
|
||||
int add_function(const TCHAR *funname);
|
||||
int function_end();
|
||||
void section_add_size_kb(int kb);
|
||||
int section_add_flags(int flags);
|
||||
int section_add_install_type(int inst_type);
|
||||
int add_page(int type);
|
||||
int page_end();
|
||||
int add_label(const TCHAR *name);
|
||||
int add_entry(const entry *ent);
|
||||
int add_entry_direct(int which, int o0=0, int o1=0, int o2=0, int o3=0, int o4=0, int o5=0);
|
||||
int add_db_data(IMMap *map); // returns offset
|
||||
int add_db_data(const char *data, int length); // returns offset
|
||||
int add_data(const char *data, int length, IGrowBuf *dblock); // returns offset
|
||||
int add_string(const TCHAR *string, int process=1, WORD codepage=CP_ACP); // returns offset (in string table)
|
||||
int add_intstring(const int i); // returns offset in stringblock
|
||||
|
||||
int preprocess_string(TCHAR *out, const TCHAR *in, WORD codepage=CP_ACP);
|
||||
|
||||
#ifdef NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
// Added by Ximon Eighteen 5th August 2002
|
||||
Plugins m_plugins;
|
||||
bool plugin_used;
|
||||
bool uninst_plugin_used;
|
||||
int build_plugin_unload;
|
||||
#endif //NSIS_CONFIG_PLUGIN_SUPPORT
|
||||
|
||||
// build.cpp functions used mostly within build.cpp
|
||||
int datablock_optimize(int start_offset, int first_int);
|
||||
void printline(int l);
|
||||
int process_jump(LineParser &line, int wt, int *offs);
|
||||
|
||||
int AddVersionInfo();
|
||||
int ProcessPages();
|
||||
void PrepareInstTypes();
|
||||
void AddStandardStrings();
|
||||
void PrepareHeaders(IGrowBuf *hdrbuf);
|
||||
int SetVarsSection();
|
||||
int SetManifest();
|
||||
int UpdatePEHeader();
|
||||
|
||||
int resolve_jump_int(const TCHAR *fn, int *a, int offs, int start, int end);
|
||||
int resolve_call_int(const TCHAR *fn, const TCHAR *str, int fptr, int *ofs);
|
||||
int resolve_instruction(const TCHAR *fn, const TCHAR *str, entry *w, int offs, int start, int end);
|
||||
|
||||
int resolve_coderefs(const TCHAR *str);
|
||||
void print_warnings();
|
||||
int uninstall_generate();
|
||||
|
||||
/** Are we defining an uninstall version of the code?
|
||||
* @param un Use like a boolean to define whether in uninstall mode.
|
||||
*/
|
||||
void set_uninstall_mode(int un);
|
||||
|
||||
// lang.cpp functions and variables
|
||||
void InitLangTables();
|
||||
|
||||
/**
|
||||
* This function gets a LanguageTable structure for the specified language
|
||||
* via LANGID. If create == true, it will create a new LanguageTable if
|
||||
* the appropriate one cannot be found. If lang is LANG_NEUTRAL (0), then
|
||||
* it will get the LanguageTable of the last used language or more
|
||||
* correctly, the last Language ID that generated a valid return value
|
||||
* (not NULL).
|
||||
*
|
||||
* @param lang [in/out] Language ID reference. If LANG_NEUTRAL, it gets
|
||||
* set to thelast used language ID.
|
||||
* @param create Create a new LanguageTable? Default = true.
|
||||
* @return Appropriate LanguagTable* if exists, otherwise NULL.
|
||||
*/
|
||||
LanguageTable *GetLangTable(LANGID &lang, bool create = true);
|
||||
|
||||
/**
|
||||
* Get the language name as a TCHAR* and the code page value via an
|
||||
* out parameter. It will look for a LanguageTable to get the values.
|
||||
* If not found, then it will set the codepage to English for ANSI
|
||||
* or Unicode for Unicode version of NSIS. The language name is looked
|
||||
* up via the LanguageTable if it exists, otherwise, it calls
|
||||
* GetLocaleInfo() with the LANGID to get the string.
|
||||
*
|
||||
* This function is not thread-safe! For a thread-safe version, the
|
||||
* parameter must include the buffer to write to.
|
||||
*
|
||||
* @param lang The language ID
|
||||
* @param codepage [out] The code page referred to by the language ID.
|
||||
* @return The language string in English.
|
||||
*/
|
||||
const TCHAR *GetLangNameAndCP(LANGID lang, unsigned int *codepage = NULL);
|
||||
|
||||
int DefineLangString(const TCHAR *name, int process=-1);
|
||||
int DefineInnerLangString(int id, int process=-1);
|
||||
|
||||
/**
|
||||
* A LangString is a string variable that varies in value depending on what
|
||||
* language is being used. This function sets the string value for the
|
||||
* variable 'name' for a given language ID.
|
||||
*
|
||||
* @return If the language id, the variable name or string is invalid, it will
|
||||
* return aPS_ERROR. If this function call is overwriting a set user string,
|
||||
* this will return a PS_WARNING.
|
||||
*/
|
||||
int SetLangString(TCHAR *name, LANGID lang, TCHAR *str);
|
||||
|
||||
/**
|
||||
* Sets the user string to the specific NLF_STRINGS id.
|
||||
*
|
||||
* @return If the id is invalid or the string is not valid, it will return
|
||||
* aPS_ERROR. If this function call is overwriting a set user string,
|
||||
* this will return a PS_WARNING.
|
||||
*/
|
||||
int SetInnerString(int id, TCHAR *str);
|
||||
|
||||
int GenerateLangTable(LanguageTable *lt, int num_lang_tables);
|
||||
int GenerateLangTables();
|
||||
void FillLanguageTable(LanguageTable *table);
|
||||
int HasUserDefined(int id) {
|
||||
const TCHAR *us = UserInnerStrings.get(id);
|
||||
return us && *us;
|
||||
};
|
||||
|
||||
LanguageTable *LoadLangFile(TCHAR *filename);
|
||||
void DeleteLangTable(LanguageTable *table);
|
||||
|
||||
NLFRef NLFRefs[NLF_STRINGS];
|
||||
bool keep_ref;
|
||||
StringsArray UserInnerStrings;
|
||||
bool defcodepage_set;
|
||||
GrowBuf lang_tables;
|
||||
LANGID last_used_lang;
|
||||
LangStringList build_langstrings;
|
||||
|
||||
int build_langstring_num, ubuild_langstring_num;
|
||||
TCHAR build_font[1024];
|
||||
int build_font_size;
|
||||
|
||||
unsigned int uDefCodePage;
|
||||
|
||||
// pages stuff
|
||||
int license_res_id;
|
||||
page *cur_page; // Current page we are defining, NULL if not.
|
||||
int cur_page_type;
|
||||
int enable_last_page_cancel, uenable_last_page_cancel;
|
||||
|
||||
int disable_window_icon;
|
||||
|
||||
// User variables stuff
|
||||
int GetUserVarIndex(LineParser &line, int token);
|
||||
// Added by ramon 3 jun 2003
|
||||
UserVarsStringList m_UserVarNames;
|
||||
int m_iBaseVarsNum;
|
||||
int DeclaredUserVar(const TCHAR *VarName);
|
||||
void VerifyDeclaredUserVarRefs(UserVarsStringList *pVarsStringList);
|
||||
|
||||
ConstantsStringList m_ShellConstants;
|
||||
|
||||
// a whole bunch O data.
|
||||
|
||||
tstring stubs_dir;
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
ICompressor *compressor;
|
||||
CZlib zlib_compressor;
|
||||
CBzip2 bzip2_compressor;
|
||||
CLZMA lzma_compressor;
|
||||
#endif
|
||||
bool build_compressor_set;
|
||||
bool build_compressor_final;
|
||||
bool build_compress_whole;
|
||||
int build_compress;
|
||||
int build_compress_level;
|
||||
int build_compress_dict_size;
|
||||
|
||||
bool no_space_texts;
|
||||
|
||||
bool has_called_write_output;
|
||||
|
||||
TCHAR build_packname[1024], build_packcmd[1024];
|
||||
int build_overwrite, build_last_overwrite, build_crcchk,
|
||||
build_datesave, build_optimize_datablock,
|
||||
build_allowskipfiles; // Added by ramon 23 May 2003
|
||||
|
||||
header build_header, build_uninst, *cur_header;
|
||||
int uninstall_mode; // Are we in uinstall mode? Acts like a bool.
|
||||
int uninstall_size,uninstall_size_full;
|
||||
int uninstaller_writes_used;
|
||||
|
||||
TCHAR build_output_filename[1024];
|
||||
|
||||
int build_include_depth;
|
||||
|
||||
// Added by ramon 6 jun 2003
|
||||
#ifdef NSIS_SUPPORT_VERSION_INFO
|
||||
CResourceVersionInfo rVersionInfo;
|
||||
TCHAR version_product_v[1024];
|
||||
#endif
|
||||
|
||||
int sectiongroup_open_cnt;
|
||||
FastStringList m_warnings;
|
||||
GrowBuf m_macros;
|
||||
|
||||
StringList m_macro_entry;
|
||||
|
||||
int db_opt_save, db_comp_save, db_full_size, db_opt_save_u,
|
||||
db_comp_save_u, db_full_size_u;
|
||||
|
||||
FastStringList include_dirs;
|
||||
|
||||
StringList ns_func; // function namespace
|
||||
StringList ns_label; // label namespace
|
||||
|
||||
int build_cursection_isfunc; // Are we in the middle of func definition?
|
||||
section *build_cursection; // The section we are defining, NULL if not in section.
|
||||
// This could be a function or a section.
|
||||
|
||||
// The ubuild prefixed objects / variables are for the uinstall versions
|
||||
// of the code. The cur prefix objects are what the current objects that
|
||||
// need to be referenced should be. What is pointed to by the cur* objects
|
||||
// are determined by whether or not we are in uninstall mode or not.
|
||||
TinyGrowBuf build_sections, ubuild_sections, *cur_sections;
|
||||
GrowBuf build_entries,ubuild_entries, *cur_entries;
|
||||
GrowBuf build_instruction_entry_map,ubuild_instruction_entry_map, *cur_instruction_entry_map;
|
||||
TinyGrowBuf build_functions, ubuild_functions, *cur_functions;
|
||||
TinyGrowBuf build_labels, ubuild_labels, *cur_labels;
|
||||
StringList build_strlist, ubuild_strlist, *cur_strlist;
|
||||
GrowBuf build_langtables, ubuild_langtables, *cur_langtables;
|
||||
TinyGrowBuf build_pages, ubuild_pages, *cur_pages;
|
||||
TinyGrowBuf build_ctlcolors, ubuild_ctlcolors, *cur_ctlcolors;
|
||||
|
||||
// don't forget to update the cache after updating the datablock
|
||||
// see datablock_optimize for an example
|
||||
MMapBuf build_datablock, ubuild_datablock;
|
||||
TinyGrowBuf build_datablock_cache, ubuild_datablock_cache;
|
||||
IGrowBuf *cur_datablock, *cur_datablock_cache;
|
||||
struct cached_db_size
|
||||
{
|
||||
int first_int; // size | (compressed ? 0x80000000 : 0)
|
||||
int start_offset;
|
||||
};
|
||||
|
||||
int build_filebuflen;
|
||||
|
||||
TinyGrowBuf verbose_stack;
|
||||
|
||||
unsigned char *m_exehead;
|
||||
size_t m_exehead_size;
|
||||
size_t m_exehead_original_size;
|
||||
|
||||
bool branding_image_found;
|
||||
WORD branding_image_id;
|
||||
|
||||
IconGroup installer_icon;
|
||||
IconGroup uninstaller_icon;
|
||||
size_t m_unicon_size;
|
||||
|
||||
#ifdef NSIS_SUPPORT_BGBG
|
||||
LOGFONT bg_font;
|
||||
LOGFONT bg_default_font;
|
||||
#endif
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
int deflateToFile(FILE *fp, char *buf, int len); // len==0 to flush
|
||||
#endif
|
||||
|
||||
manifest::comctl manifest_comctl;
|
||||
manifest::exec_level manifest_exec_level;
|
||||
|
||||
CResourceEditor *res_editor;
|
||||
void init_res_editor();
|
||||
void close_res_editor();
|
||||
};
|
||||
|
||||
#endif //_BUILD_H_
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/27/2007
|
||||
*/
|
||||
|
||||
#include "bzlib.h"
|
||||
|
@ -217,7 +219,7 @@ void fallbackQSort3 ( UInt32* fmap,
|
|||
fswap(fmap[unLo], fmap[unHi]); unLo++; unHi--;
|
||||
}
|
||||
|
||||
AssertD ( unHi == unLo-1, "fallbackQSort3(2)" );
|
||||
AssertD ( unHi == unLo-1, _T("fallbackQSort3(2)") );
|
||||
|
||||
if (gtHi < ltLo) continue;
|
||||
|
||||
|
@ -400,7 +402,7 @@ static Bool mainGtU ( UInt32 i1,
|
|||
UChar c1, c2;
|
||||
UInt16 s1, s2;
|
||||
|
||||
AssertD ( i1 != i2, "mainGtU" );
|
||||
AssertD ( i1 != i2, _T("mainGtU") );
|
||||
/* 1 */
|
||||
c1 = block[i1]; c2 = block[i2];
|
||||
if (c1 != c2) return (c1 > c2);
|
||||
|
@ -730,7 +732,7 @@ void mainQSort3 ( UInt32* ptr,
|
|||
mswap(ptr[unLo], ptr[unHi]); unLo++; unHi--;
|
||||
}
|
||||
|
||||
AssertD ( unHi == unLo-1, "mainQSort3(2)" );
|
||||
AssertD ( unHi == unLo-1, _T("mainQSort3(2)") );
|
||||
|
||||
if (gtHi < ltLo) {
|
||||
mpush(lo, hi, d+1 );
|
||||
|
@ -751,8 +753,8 @@ void mainQSort3 ( UInt32* ptr,
|
|||
if (mnextsize(1) < mnextsize(2)) mnextswap(1,2);
|
||||
if (mnextsize(0) < mnextsize(1)) mnextswap(0,1);
|
||||
|
||||
AssertD (mnextsize(0) >= mnextsize(1), "mainQSort3(8)" );
|
||||
AssertD (mnextsize(1) >= mnextsize(2), "mainQSort3(9)" );
|
||||
AssertD (mnextsize(0) >= mnextsize(1), _T("mainQSort3(8)") );
|
||||
AssertD (mnextsize(1) >= mnextsize(2), _T("mainQSort3(9)") );
|
||||
|
||||
mpush (nextLo[0], nextHi[0], nextD[0]);
|
||||
mpush (nextLo[1], nextHi[1], nextD[1]);
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/23/2007
|
||||
*/
|
||||
|
||||
#include "bzlib.h"
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/27/2007
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/27/2007
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
|
@ -218,10 +220,10 @@ void generateMTFValues ( EState* s )
|
|||
|
||||
for (i = 0; i < s->nblock; i++) {
|
||||
UChar ll_i;
|
||||
AssertD ( wr <= i, "generateMTFValues(1)" );
|
||||
AssertD ( wr <= i, _T("generateMTFValues(1)") );
|
||||
j = ptr[i]-1; if (j < 0) j += s->nblock;
|
||||
ll_i = s->unseqToSeq[block[j]];
|
||||
AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" );
|
||||
AssertD ( ll_i < s->nInUse, _T("generateMTFValues(2a)") );
|
||||
|
||||
if (yy[0] == ll_i) {
|
||||
zPend++;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/27/2007
|
||||
*/
|
||||
|
||||
#include "bzlib.h"
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/27/2007
|
||||
*/
|
||||
|
||||
#include "bzlib.h"
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/24/2007
|
||||
*/
|
||||
|
||||
#ifndef __CBZIP2_H__
|
||||
|
@ -71,23 +73,23 @@ class CBzip2 : public ICompressor {
|
|||
return stream->avail_out;
|
||||
}
|
||||
|
||||
const char* GetName() {
|
||||
return "bzip2";
|
||||
const TCHAR* GetName() {
|
||||
return _T("bzip2");
|
||||
}
|
||||
|
||||
const char* GetErrStr(int err) {
|
||||
const TCHAR* GetErrStr(int err) {
|
||||
switch (err)
|
||||
{
|
||||
case BZ_SEQUENCE_ERROR:
|
||||
return "sequence error - bad call";
|
||||
return _T("sequence error - bad call");
|
||||
case BZ_PARAM_ERROR:
|
||||
return "parameter error - bad call";
|
||||
return _T("parameter error - bad call");
|
||||
case BZ_MEM_ERROR:
|
||||
return "not enough memory";
|
||||
return _T("not enough memory");
|
||||
case BZ_CONFIG_ERROR:
|
||||
return "config error";
|
||||
return _T("config error");
|
||||
default:
|
||||
return "unknown error";
|
||||
return _T("unknown error");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/24/2007
|
||||
*/
|
||||
|
||||
#include <algorithm> // for std::min
|
||||
|
@ -27,7 +29,7 @@ struct evnet_t
|
|||
bool signaled;
|
||||
};
|
||||
|
||||
HANDLE CreateEvent(void *, BOOL, BOOL, char *)
|
||||
HANDLE CreateEvent(void *, BOOL, BOOL, TCHAR *)
|
||||
{
|
||||
evnet_t *event = (evnet_t *) malloc(sizeof(evnet_t));
|
||||
if (!event)
|
||||
|
@ -439,26 +441,26 @@ unsigned int CLZMA::GetAvailOut()
|
|||
return avail_out;
|
||||
}
|
||||
|
||||
const char* CLZMA::GetName()
|
||||
const TCHAR* CLZMA::GetName()
|
||||
{
|
||||
return "lzma";
|
||||
return _T("lzma");
|
||||
}
|
||||
|
||||
const char* CLZMA::GetErrStr(int err)
|
||||
const TCHAR* CLZMA::GetErrStr(int err)
|
||||
{
|
||||
switch (err)
|
||||
{
|
||||
case LZMA_BAD_CALL:
|
||||
return "bad call";
|
||||
return _T("bad call");
|
||||
case LZMA_INIT_ERROR:
|
||||
return "initialization failed";
|
||||
return _T("initialization failed");
|
||||
case LZMA_THREAD_ERROR:
|
||||
return "thread synchronization error";
|
||||
return _T("thread synchronization error");
|
||||
case LZMA_IO_ERROR:
|
||||
return "input/output error";
|
||||
return _T("input/output error");
|
||||
case LZMA_MEM_ERROR:
|
||||
return "not enough memory";
|
||||
return _T("not enough memory");
|
||||
default:
|
||||
return "unknown error";
|
||||
return _T("unknown error");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/24/2007
|
||||
*/
|
||||
|
||||
#ifndef __CLZMA_H__
|
||||
|
@ -95,9 +97,9 @@ public:
|
|||
virtual char *GetNextOut();
|
||||
virtual unsigned int GetAvailIn();
|
||||
virtual unsigned int GetAvailOut();
|
||||
virtual const char *GetName();
|
||||
virtual const TCHAR *GetName();
|
||||
|
||||
virtual const char* GetErrStr(int err);
|
||||
virtual const TCHAR* GetErrStr(int err);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,11 +12,15 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/24/2007
|
||||
*/
|
||||
|
||||
#ifndef __COMPRESSOR_H__
|
||||
#define __COMPRESSOR_H__
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
#define C_OK 0
|
||||
#define C_FINISHED 1
|
||||
|
||||
|
@ -38,9 +42,9 @@ class ICompressor {
|
|||
virtual unsigned int GetAvailIn() = 0;
|
||||
virtual unsigned int GetAvailOut() = 0;
|
||||
|
||||
virtual const char* GetName() = 0;
|
||||
virtual const TCHAR* GetName() = 0;
|
||||
|
||||
virtual const char* GetErrStr(int err) = 0;
|
||||
virtual const TCHAR* GetErrStr(int err) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/24/2007
|
||||
*/
|
||||
|
||||
#include "Platform.h"
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/24/2007
|
||||
*/
|
||||
|
||||
#include "Platform.h"
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/24/2007
|
||||
*/
|
||||
|
||||
#ifndef __CZLIB_H__
|
||||
|
@ -68,25 +70,25 @@ class CZlib : public ICompressor {
|
|||
return stream->avail_out;
|
||||
}
|
||||
|
||||
const char* GetName() {
|
||||
return "zlib";
|
||||
const TCHAR* GetName() {
|
||||
return _T("zlib");
|
||||
}
|
||||
|
||||
const char* GetErrStr(int err) {
|
||||
const TCHAR* GetErrStr(int err) {
|
||||
switch (err)
|
||||
{
|
||||
case Z_STREAM_ERROR:
|
||||
return "invalid stream - bad call";
|
||||
return _T("invalid stream - bad call");
|
||||
case Z_DATA_ERROR:
|
||||
return "data error";
|
||||
return _T("data error");
|
||||
case Z_MEM_ERROR:
|
||||
return "not enough memory";
|
||||
return _T("not enough memory");
|
||||
case Z_BUF_ERROR:
|
||||
return "buffer error - bad call";
|
||||
return _T("buffer error - bad call");
|
||||
case Z_VERSION_ERROR:
|
||||
return "version error";
|
||||
return _T("version error");
|
||||
default:
|
||||
return "unknown error";
|
||||
return _T("unknown error");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,11 +12,13 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/23/2007
|
||||
*/
|
||||
|
||||
#include "Platform.h"
|
||||
#include "dirreader.h"
|
||||
#include <string>
|
||||
#include "tstring.h"
|
||||
#include <set>
|
||||
|
||||
#include <string.h> // for stricmp()
|
||||
|
@ -25,27 +27,27 @@
|
|||
using namespace std;
|
||||
|
||||
dir_reader::dir_reader() {
|
||||
exclude(".");
|
||||
exclude("..");
|
||||
exclude(_T("."));
|
||||
exclude(_T(".."));
|
||||
}
|
||||
|
||||
const set<string>& dir_reader::files() {
|
||||
const set<tstring>& dir_reader::files() {
|
||||
return m_files;
|
||||
}
|
||||
|
||||
const set<string>& dir_reader::dirs() {
|
||||
const set<tstring>& dir_reader::dirs() {
|
||||
return m_dirs;
|
||||
}
|
||||
|
||||
void dir_reader::exclude(const string& spec) {
|
||||
if (spec.find_first_of("?*") != string::npos) {
|
||||
void dir_reader::exclude(const tstring& spec) {
|
||||
if (spec.find_first_of(_T("?*")) != tstring::npos) {
|
||||
m_wildcard_excluded.insert(spec);
|
||||
} else {
|
||||
m_excluded.insert(spec);
|
||||
}
|
||||
}
|
||||
|
||||
void dir_reader::exclude(const set<string>& specs) {
|
||||
void dir_reader::exclude(const set<tstring>& specs) {
|
||||
iterator i = specs.begin();
|
||||
iterator e = specs.end();
|
||||
|
||||
|
@ -54,27 +56,27 @@ void dir_reader::exclude(const set<string>& specs) {
|
|||
}
|
||||
}
|
||||
|
||||
bool dir_reader::matches(const string& name, const string& spec) {
|
||||
string::const_iterator name_itr = name.begin();
|
||||
string::const_iterator name_end = name.end();
|
||||
bool dir_reader::matches(const tstring& name, const tstring& spec) {
|
||||
tstring::const_iterator name_itr = name.begin();
|
||||
tstring::const_iterator name_end = name.end();
|
||||
|
||||
string::const_iterator spec_itr = spec.begin();
|
||||
string::const_iterator spec_end = spec.end();
|
||||
tstring::const_iterator spec_itr = spec.begin();
|
||||
tstring::const_iterator spec_end = spec.end();
|
||||
|
||||
string::const_iterator last_good_spec = spec_end;
|
||||
string::const_iterator last_good_name = name_end;
|
||||
tstring::const_iterator last_good_spec = spec_end;
|
||||
tstring::const_iterator last_good_name = name_end;
|
||||
|
||||
while (name_itr != name_end && spec_itr != spec_end) {
|
||||
switch (*spec_itr) {
|
||||
case '?':
|
||||
case _T('?'):
|
||||
// question mark mathes one char
|
||||
name_itr++;
|
||||
spec_itr++;
|
||||
break;
|
||||
|
||||
case '*':
|
||||
case _T('*'):
|
||||
// double asterisk is the same as a single asterisk
|
||||
while (*spec_itr == '*') {
|
||||
while (*spec_itr == _T('*')) {
|
||||
spec_itr++;
|
||||
// asterisk at the end of the spec matches the end of the name
|
||||
if (spec_itr == spec_end)
|
||||
|
@ -88,6 +90,7 @@ bool dir_reader::matches(const string& name, const string& spec) {
|
|||
break;
|
||||
|
||||
default:
|
||||
// Jim Park: This should work since tolower is templated with Chartype.
|
||||
if (::tolower(*name_itr) != ::tolower(*spec_itr)) {
|
||||
if (last_good_spec != spec_end) {
|
||||
// matched wrong part of the name, try again
|
||||
|
@ -115,7 +118,7 @@ bool dir_reader::matches(const string& name, const string& spec) {
|
|||
|
||||
// skip any redundant asterisks and periods at the end of the name
|
||||
while (spec_itr != spec_end) {
|
||||
if (*spec_itr != '.' && *spec_itr != '*') {
|
||||
if (*spec_itr != _T('.') && *spec_itr != _T('*')) {
|
||||
break;
|
||||
}
|
||||
spec_itr++;
|
||||
|
@ -125,19 +128,19 @@ bool dir_reader::matches(const string& name, const string& spec) {
|
|||
return name_itr == name_end && spec_itr == spec_end;
|
||||
}
|
||||
|
||||
void dir_reader::add_file(const string& file) {
|
||||
void dir_reader::add_file(const tstring& file) {
|
||||
if (!is_excluded(file)) {
|
||||
m_files.insert(file);
|
||||
}
|
||||
}
|
||||
|
||||
void dir_reader::add_dir(const string& dir) {
|
||||
void dir_reader::add_dir(const tstring& dir) {
|
||||
if (!is_excluded(dir)) {
|
||||
m_dirs.insert(dir);
|
||||
}
|
||||
}
|
||||
|
||||
bool dir_reader::is_excluded(const string& name) const {
|
||||
bool dir_reader::is_excluded(const tstring& name) const {
|
||||
iterator i = m_excluded.begin();
|
||||
iterator e = m_excluded.end();
|
||||
|
||||
|
@ -164,10 +167,10 @@ bool dir_reader::is_excluded(const string& name) const {
|
|||
class win32_dir_reader : public dir_reader {
|
||||
public:
|
||||
|
||||
virtual void read(const string& dir) {
|
||||
virtual void read(const tstring& dir) {
|
||||
WIN32_FIND_DATA fd;
|
||||
|
||||
string spec = dir + PLATFORM_PATH_SEPARATOR_STR + "*.*";
|
||||
tstring spec = dir + PLATFORM_PATH_SEPARATOR_STR + _T("*.*");
|
||||
|
||||
HANDLE h = ::FindFirstFile(spec.c_str(), &fd);
|
||||
if (h != INVALID_HANDLE_VALUE) {
|
||||
|
@ -193,7 +196,7 @@ public:
|
|||
class posix_dir_reader : public dir_reader {
|
||||
public:
|
||||
|
||||
virtual void read(const string& dir) {
|
||||
virtual void read(const tstring& dir) {
|
||||
//convert(dir);
|
||||
|
||||
DIR *dip = ::opendir(dir.c_str());
|
||||
|
@ -218,16 +221,16 @@ public:
|
|||
private:
|
||||
|
||||
void convert(string& path) {
|
||||
string::size_type pos = path.find('\\');
|
||||
string::size_type pos = path.find(_T('\\'));
|
||||
while (pos != string::npos) {
|
||||
path[pos] = '/';
|
||||
pos = path.find('\\');
|
||||
path[pos] = _T('/');
|
||||
pos = path.find(_T('\\'));
|
||||
}
|
||||
|
||||
/* Replace drive letter X: by /x */
|
||||
if (path[1] == ':') {
|
||||
path[1] = ::tolower(path[0]);
|
||||
path[0] = '/';
|
||||
if (path[1] == _T(':')) {
|
||||
path[1] = ::_totlower(path[0]);
|
||||
path[0] = _T('/');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,44 +12,46 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/23/2007
|
||||
*/
|
||||
|
||||
#include "Platform.h"
|
||||
#include <string>
|
||||
#include "tstring.h"
|
||||
#include <set>
|
||||
|
||||
class dir_reader {
|
||||
public:
|
||||
|
||||
typedef std::set<std::string>::const_iterator iterator;
|
||||
typedef std::set<tstring>::const_iterator iterator;
|
||||
|
||||
dir_reader();
|
||||
virtual ~dir_reader() {}
|
||||
|
||||
virtual void read(const std::string& dir) = 0;
|
||||
virtual void read(const tstring& dir) = 0;
|
||||
|
||||
virtual const std::set<std::string>& files();
|
||||
virtual const std::set<std::string>& dirs();
|
||||
virtual const std::set<tstring>& files();
|
||||
virtual const std::set<tstring>& dirs();
|
||||
|
||||
virtual void exclude(const std::string& spec);
|
||||
virtual void exclude(const std::set<std::string>& specs);
|
||||
virtual void exclude(const tstring& spec);
|
||||
virtual void exclude(const std::set<tstring>& specs);
|
||||
|
||||
static bool matches(const std::string& name, const std::string& spec);
|
||||
static bool matches(const tstring& name, const tstring& spec);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void add_file(const std::string& file);
|
||||
virtual void add_dir(const std::string& dir);
|
||||
virtual void add_file(const tstring& file);
|
||||
virtual void add_dir(const tstring& dir);
|
||||
|
||||
virtual bool is_excluded(const std::string& name) const;
|
||||
virtual bool is_excluded(const tstring& name) const;
|
||||
|
||||
private:
|
||||
|
||||
std::set<std::string> m_excluded;
|
||||
std::set<std::string> m_wildcard_excluded;
|
||||
std::set<tstring> m_excluded;
|
||||
std::set<tstring> m_wildcard_excluded;
|
||||
|
||||
std::set<std::string> m_files;
|
||||
std::set<std::string> m_dirs;
|
||||
std::set<tstring> m_files;
|
||||
std::set<tstring> m_dirs;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/22/2007
|
||||
*/
|
||||
|
||||
#include "../Platform.h"
|
||||
|
@ -34,7 +36,7 @@
|
|||
extern HANDLE dbd_hFile;
|
||||
#endif
|
||||
|
||||
char g_caption[NSIS_MAX_STRLEN*2];
|
||||
TCHAR g_caption[NSIS_MAX_STRLEN*2];
|
||||
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
HWND g_hwnd;
|
||||
HANDLE g_hInstance;
|
||||
|
@ -42,7 +44,7 @@ HANDLE g_hInstance;
|
|||
|
||||
void NSISCALL CleanUp();
|
||||
|
||||
char *ValidateTempDir()
|
||||
TCHAR *ValidateTempDir()
|
||||
{
|
||||
validate_filename(state_temp_dir);
|
||||
if (!validpathspec(state_temp_dir))
|
||||
|
@ -55,16 +57,16 @@ char *ValidateTempDir()
|
|||
|
||||
void *g_SHGetFolderPath;
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam, int nCmdShow)
|
||||
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPTSTR lpszCmdParam, int nCmdShow)
|
||||
{
|
||||
int ret = 0;
|
||||
const char *m_Err = _LANG_ERRORWRITINGTEMP;
|
||||
const TCHAR *m_Err = _LANG_ERRORWRITINGTEMP;
|
||||
|
||||
int cl_flags = 0;
|
||||
|
||||
char *realcmds;
|
||||
char seekchar=' ';
|
||||
char *cmdline;
|
||||
TCHAR *realcmds;
|
||||
TCHAR seekchar=_T(' ');
|
||||
TCHAR *cmdline;
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
|
@ -88,7 +90,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
|
|||
// Delete $PROGRAMFILES\shfolder.dll # can't be deleted, as the
|
||||
// # new shfolder.dll is used
|
||||
// # to find its own path.
|
||||
g_SHGetFolderPath = myGetProcAddress(MGA_SHGetFolderPathA);
|
||||
g_SHGetFolderPath = myGetProcAddress(MGA_SHGetFolderPath);
|
||||
|
||||
{
|
||||
// workaround for bug #1008632
|
||||
|
@ -108,7 +110,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
|
|||
// of special folders (CSIDL_*).
|
||||
|
||||
SHFILEINFO shfi;
|
||||
SHGetFileInfo("", 0, &shfi, sizeof(SHFILEINFO), 0);
|
||||
SHGetFileInfo(_T(""), 0, &shfi, sizeof(SHFILEINFO), 0);
|
||||
}
|
||||
|
||||
mystrcpy(g_caption,_LANG_GENERIC_ERROR);
|
||||
|
@ -120,7 +122,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
|
|||
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
|
||||
cmdline = state_command_line;
|
||||
if (*cmdline == '\"') seekchar = *cmdline++;
|
||||
if (*cmdline == _T('\"')) seekchar = *cmdline++;
|
||||
|
||||
cmdline=findchar(cmdline, seekchar);
|
||||
cmdline=CharNext(cmdline);
|
||||
|
@ -129,34 +131,34 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
|
|||
while (*cmdline)
|
||||
{
|
||||
// skip over any spaces
|
||||
while (*cmdline == ' ') cmdline++;
|
||||
while (*cmdline == _T(' ')) cmdline++;
|
||||
|
||||
// get char we should look for to get the next parm
|
||||
seekchar = ' ';
|
||||
if (cmdline[0] == '\"')
|
||||
seekchar = _T(' ');
|
||||
if (cmdline[0] == _T('\"'))
|
||||
{
|
||||
cmdline++;
|
||||
seekchar = '\"';
|
||||
seekchar = _T('\"');
|
||||
}
|
||||
|
||||
// is it a switch?
|
||||
if (cmdline[0] == '/')
|
||||
if (cmdline[0] == _T('/'))
|
||||
{
|
||||
cmdline++;
|
||||
|
||||
// this only works with spaces because they have just one bit on
|
||||
#define END_OF_ARG(c) (((c)|' ')==' ')
|
||||
#define END_OF_ARG(c) (((c)|_T(' '))==_T(' '))
|
||||
|
||||
#if defined(NSIS_CONFIG_VISIBLE_SUPPORT) && defined(NSIS_CONFIG_SILENT_SUPPORT)
|
||||
if (cmdline[0] == 'S' && END_OF_ARG(cmdline[1]))
|
||||
if (cmdline[0] == _T('S') && END_OF_ARG(cmdline[1]))
|
||||
cl_flags |= FH_FLAGS_SILENT;
|
||||
#endif//NSIS_CONFIG_SILENT_SUPPORT && NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
#ifdef NSIS_CONFIG_CRC_SUPPORT
|
||||
if (*(LPDWORD)cmdline == CHAR4_TO_DWORD('N','C','R','C') && END_OF_ARG(cmdline[4]))
|
||||
if (*(LPDWORD)cmdline == CHAR4_TO_DWORD(_T('N'),_T('C'),_T('R'),_T('C')) && END_OF_ARG(cmdline[4]))
|
||||
cl_flags |= FH_FLAGS_NO_CRC;
|
||||
#endif//NSIS_CONFIG_CRC_SUPPORT
|
||||
|
||||
if (*(LPDWORD)(cmdline-2) == CHAR4_TO_DWORD(' ', '/', 'D','='))
|
||||
if (*(LPDWORD)(cmdline-2) == CHAR4_TO_DWORD(_T(' '), _T('/'), _T('D'),_T('=')))
|
||||
{
|
||||
*(LPDWORD)(cmdline-2)=0; // keep this from being passed to uninstaller if necessary
|
||||
mystrcpy(state_install_directory,cmdline+2);
|
||||
|
@ -167,7 +169,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
|
|||
// skip over our parm
|
||||
cmdline = findchar(cmdline, seekchar);
|
||||
// skip the quote
|
||||
if (*cmdline == '\"')
|
||||
if (*cmdline == _T('\"'))
|
||||
cmdline++;
|
||||
}
|
||||
|
||||
|
@ -175,7 +177,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
|
|||
if (!ValidateTempDir())
|
||||
{
|
||||
GetWindowsDirectory(state_temp_dir, NSIS_MAX_STRLEN - 5); // leave space for \Temp
|
||||
mystrcat(state_temp_dir, "\\Temp");
|
||||
mystrcat(state_temp_dir, _T("\\Temp"));
|
||||
if (!ValidateTempDir())
|
||||
{
|
||||
goto end;
|
||||
|
@ -189,11 +191,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
|
|||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
if (g_is_uninstaller)
|
||||
{
|
||||
char *p = findchar(state_command_line, 0);
|
||||
TCHAR *p = findchar(state_command_line, 0);
|
||||
|
||||
// state_command_line has state_install_directory right after it in memory, so reading
|
||||
// a bit over state_command_line won't do any harm
|
||||
while (p >= state_command_line && *(LPDWORD)p != CHAR4_TO_DWORD(' ', '_', '?', '=')) p--;
|
||||
while (p >= state_command_line && *(LPDWORD)p != CHAR4_TO_DWORD(_T(' '), _T('_'), _T('?'), _T('='))) p--;
|
||||
|
||||
m_Err = _LANG_UNINSTINITERROR;
|
||||
|
||||
|
@ -216,7 +218,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
|
|||
{
|
||||
int x;
|
||||
|
||||
mystrcat(state_temp_dir,"~nsu.tmp");
|
||||
mystrcat(state_temp_dir,_T("~nsu.tmp"));
|
||||
|
||||
// check if already running from uninstaller temp dir
|
||||
// this prevents recursive uninstaller calls
|
||||
|
@ -230,11 +232,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst,LPSTR lpszCmdParam,
|
|||
mystrcpy(state_install_directory,state_exe_directory);
|
||||
|
||||
mystrcpy(g_usrvars[0], realcmds);
|
||||
*(LPWORD)g_usrvars[1] = CHAR2_TO_WORD('A',0);
|
||||
*(LPWORD)g_usrvars[1] = CHAR2_TO_WORD(_T('A'),0);
|
||||
|
||||
for (x = 0; x < 26; x ++)
|
||||
{
|
||||
static char buf2[NSIS_MAX_STRLEN];
|
||||
static TCHAR buf2[NSIS_MAX_STRLEN];
|
||||
|
||||
GetNSISString(buf2,g_header->str_uninstchild); // $TEMP\$1u_.exe
|
||||
|
||||
|
@ -301,7 +303,7 @@ end:
|
|||
BOOL (WINAPI *LPV)(LPCTSTR,LPCTSTR,PLUID);
|
||||
BOOL (WINAPI *ATP)(HANDLE,BOOL,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD);
|
||||
OPT=myGetProcAddress(MGA_OpenProcessToken);
|
||||
LPV=myGetProcAddress(MGA_LookupPrivilegeValueA);
|
||||
LPV=myGetProcAddress(MGA_LookupPrivilegeValue);
|
||||
ATP=myGetProcAddress(MGA_AdjustTokenPrivileges);
|
||||
if (OPT && LPV && ATP)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/10/2007
|
||||
*/
|
||||
|
||||
#include <windowsx.h>
|
||||
|
@ -48,9 +50,9 @@ int g_quit_flag; // set when Quit has been called (meaning bail out ASAP)
|
|||
int progress_bar_pos, progress_bar_len;
|
||||
|
||||
#if NSIS_MAX_STRLEN < 1024
|
||||
static char g_tmp[4096];
|
||||
static TCHAR g_tmp[4096];
|
||||
#else
|
||||
static char g_tmp[NSIS_MAX_STRLEN * 4];
|
||||
static TCHAR g_tmp[NSIS_MAX_STRLEN * 4];
|
||||
#endif
|
||||
|
||||
static int m_page=-1,m_retcode,m_delta;
|
||||
|
@ -162,7 +164,7 @@ static BOOL NSISCALL _HandleStaticBkColor(UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
#if !defined(NSIS_CONFIG_LOG_ODS) && !defined(NSIS_CONFIG_LOG_STDOUT)
|
||||
void NSISCALL build_g_logfile()
|
||||
{
|
||||
mystrcat(addtrailingslash(mystrcpy(g_log_file,state_install_directory)),"install.log");
|
||||
mystrcat(addtrailingslash(mystrcpy(g_log_file,state_install_directory)),_T("install.log"));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -177,6 +179,8 @@ static void NSISCALL set_language()
|
|||
int lang_num;
|
||||
int *selected_langtable=0;
|
||||
|
||||
// Jim Park: We are doing byte offsets to get to various data structures so
|
||||
// no TCHARs here.
|
||||
lang_again:
|
||||
lang_num=g_blocks[NB_LANGTABLES].num;
|
||||
while (lang_num--) {
|
||||
|
@ -200,7 +204,7 @@ lang_again:
|
|||
|
||||
myitoa(state_language, *(LANGID*)language_table);
|
||||
{
|
||||
char *caption = GetNSISString(g_caption,LANG_CAPTION);
|
||||
TCHAR *caption = GetNSISString(g_caption,LANG_CAPTION);
|
||||
#ifdef NSIS_SUPPORT_BGBG
|
||||
my_SetWindowText(m_bgwnd, caption);
|
||||
#endif
|
||||
|
@ -241,11 +245,11 @@ FORCE_INLINE int NSISCALL ui_doinstall(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
static const char reg_9x_locale[] = "Control Panel\\Desktop\\ResourceLocale";
|
||||
static const char reg_nt_locale_key[] = ".DEFAULT\\Control Panel\\International";
|
||||
const char *reg_nt_locale_val = ®_9x_locale[30]; // = "Locale" with opt
|
||||
static const TCHAR reg_9x_locale[] = _T("Control Panel\\Desktop\\ResourceLocale");
|
||||
static const TCHAR reg_nt_locale_key[] = _T(".DEFAULT\\Control Panel\\International");
|
||||
const TCHAR *reg_nt_locale_val = ®_9x_locale[30]; // = _T("Locale") with opt
|
||||
|
||||
*(DWORD*)state_language = CHAR4_TO_DWORD('0', 'x', 0, 0);
|
||||
*(DWORD*)state_language = CHAR4_TO_DWORD(_T('0'), _T('x'), 0, 0);
|
||||
|
||||
{
|
||||
// Windows 9x
|
||||
|
@ -287,13 +291,13 @@ FORCE_INLINE int NSISCALL ui_doinstall(void)
|
|||
);
|
||||
if (ps_tmpbuf[0])
|
||||
{
|
||||
char *p=ps_tmpbuf;
|
||||
char *e;
|
||||
if (p[0]=='\"')
|
||||
TCHAR *p=ps_tmpbuf;
|
||||
TCHAR *e;
|
||||
if (p[0]==_T('\"'))
|
||||
{
|
||||
char *p2;
|
||||
TCHAR *p2;
|
||||
p++;
|
||||
p2 = findchar(p, '"');
|
||||
p2 = findchar(p, _T('"'));
|
||||
*p2 = 0;
|
||||
}
|
||||
// p is the path now, check for .exe extension
|
||||
|
@ -302,7 +306,7 @@ FORCE_INLINE int NSISCALL ui_doinstall(void)
|
|||
if (e > p)
|
||||
{
|
||||
// if filename ends in .exe, and is not a directory, remove the filename
|
||||
if (!lstrcmpi(e, ".exe")) // check extension
|
||||
if (!lstrcmpi(e, _T(".exe"))) // check extension
|
||||
{
|
||||
DWORD d;
|
||||
d=GetFileAttributes(p);
|
||||
|
@ -339,20 +343,20 @@ FORCE_INLINE int NSISCALL ui_doinstall(void)
|
|||
#ifdef NSIS_SUPPORT_BGBG
|
||||
if (header->bg_color1 != -1)
|
||||
{
|
||||
DWORD cn = CHAR4_TO_DWORD('_', 'N', 'b', 0);
|
||||
DWORD cn = CHAR4_TO_DWORD(_T('_'), _T('N'), _T('b'), 0);
|
||||
RECT vp;
|
||||
extern LRESULT CALLBACK BG_WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
wc.lpfnWndProc = BG_WndProc;
|
||||
wc.hInstance = g_hInstance;
|
||||
wc.hIcon = g_hIcon;
|
||||
//wc.hCursor = LoadCursor(NULL,IDC_ARROW);
|
||||
wc.lpszClassName = (LPCSTR)&cn;
|
||||
wc.lpszClassName = (LPCTSTR)&cn;
|
||||
|
||||
if (!RegisterClass(&wc)) return 0;
|
||||
|
||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &vp, 0);
|
||||
|
||||
m_bgwnd = CreateWindowEx(WS_EX_TOOLWINDOW,(LPCSTR)&cn,0,WS_POPUP,
|
||||
m_bgwnd = CreateWindowEx(WS_EX_TOOLWINDOW,(LPCTSTR)&cn,0,WS_POPUP,
|
||||
vp.left,vp.top,vp.right-vp.left,vp.bottom-vp.top,0,NULL,g_hInstance,NULL);
|
||||
}
|
||||
|
||||
|
@ -378,10 +382,10 @@ FORCE_INLINE int NSISCALL ui_doinstall(void)
|
|||
|
||||
#ifdef NSIS_CONFIG_LICENSEPAGE
|
||||
{ // load richedit DLL
|
||||
static const char riched20[]="RichEd20";
|
||||
static const char riched32[]="RichEd32";
|
||||
static const char richedit20a[]="RichEdit20A";
|
||||
static const char richedit[]="RichEdit";
|
||||
static const TCHAR riched20[]=_T("RichEd20");
|
||||
static const TCHAR riched32[]=_T("RichEd32");
|
||||
static const TCHAR richedit20a[]=_T("RichEdit20A");
|
||||
static const TCHAR richedit[]=_T("RichEdit");
|
||||
if (!LoadLibrary(riched20))
|
||||
{
|
||||
LoadLibrary(riched32);
|
||||
|
@ -434,9 +438,10 @@ FORCE_INLINE int NSISCALL ui_doinstall(void)
|
|||
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
static int CALLBACK WINAPI BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
|
||||
{
|
||||
// lpData has the TCHAR* to 'dir'.
|
||||
if (uMsg==BFFM_INITIALIZED)
|
||||
{
|
||||
my_GetDialogItemText(IDC_DIR,(char*)lpData);
|
||||
my_GetDialogItemText(IDC_DIR,(TCHAR*)lpData);
|
||||
SendMessage(hwnd,BFFM_SETSELECTION,(WPARAM)1,lpData);
|
||||
}
|
||||
if (uMsg==BFFM_SELCHANGED)
|
||||
|
@ -445,7 +450,7 @@ static int CALLBACK WINAPI BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lPara
|
|||
hwnd,
|
||||
BFFM_ENABLEOK,
|
||||
0,
|
||||
SHGetPathFromIDList((LPITEMIDLIST)lParam,(char*)lpData)
|
||||
SHGetPathFromIDList((LPITEMIDLIST)lParam,(TCHAR*)lpData)
|
||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||
&& !ExecuteCallbackFunction(CB_ONVERIFYINSTDIR)
|
||||
#endif
|
||||
|
@ -710,7 +715,7 @@ skipPage:
|
|||
static DWORD dwRead;
|
||||
DWORD CALLBACK StreamLicense(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
|
||||
{
|
||||
lstrcpyn(pbBuff,(char*)dwCookie+dwRead,cb);
|
||||
lstrcpyn(pbBuff,(TCHAR*)dwCookie+dwRead,cb);
|
||||
*pcb=mystrlen(pbBuff);
|
||||
dwRead+=*pcb;
|
||||
return 0;
|
||||
|
@ -724,7 +729,7 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
|
||||
if (uMsg == WM_INITDIALOG)
|
||||
{
|
||||
char *l = (char *)GetNSISStringNP(GetNSISTab(this_page->parms[1]));
|
||||
TCHAR *l = (TCHAR *)GetNSISStringNP(GetNSISTab(this_page->parms[1]));
|
||||
int lt = *l;
|
||||
EDITSTREAM es = {
|
||||
(DWORD)(++l),
|
||||
|
@ -778,7 +783,7 @@ static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
|
|||
if (tr.chrg.cpMax-tr.chrg.cpMin < sizeof(ps_tmpbuf)) {
|
||||
SendMessage(hwLicense,EM_GETTEXTRANGE,0,(LPARAM)&tr);
|
||||
SetCursor(LoadCursor(0, IDC_WAIT));
|
||||
ShellExecute(hwndDlg,"open",tr.lpstrText,NULL,NULL,SW_SHOWNORMAL);
|
||||
ShellExecute(hwndDlg,_T("open"),tr.lpstrText,NULL,NULL,SW_SHOWNORMAL);
|
||||
SetCursor(LoadCursor(0, IDC_ARROW));
|
||||
}
|
||||
}
|
||||
|
@ -835,7 +840,7 @@ static BOOL CALLBACK UninstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
|
||||
static void NSISCALL SetSizeText(int dlgItem, int prefix, unsigned kb)
|
||||
{
|
||||
char scalestr[32], byte[32];
|
||||
TCHAR scalestr[32], byte[32];
|
||||
unsigned sh = 20;
|
||||
int scale = LANG_GIGA;
|
||||
|
||||
|
@ -853,7 +858,7 @@ static void NSISCALL SetSizeText(int dlgItem, int prefix, unsigned kb)
|
|||
wsprintf(
|
||||
g_tmp + mystrlen(g_tmp),
|
||||
#endif
|
||||
"%u.%u%s%s",
|
||||
_T("%u.%u%s%s"),
|
||||
kb >> sh,
|
||||
(((kb & 0x00FFFFFF) * 10) >> sh) % 10, // 0x00FFFFFF mask is used to
|
||||
// prevent overflow that causes
|
||||
|
@ -887,7 +892,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
{
|
||||
static int dontsetdefstyle;
|
||||
page *thispage = g_this_page;
|
||||
char *dir = g_usrvars[thispage->parms[4]];
|
||||
TCHAR *dir = g_usrvars[thispage->parms[4]];
|
||||
int browse_text = thispage->parms[3];
|
||||
if (uMsg == WM_NOTIFY_INIGO_MONTOYA)
|
||||
{
|
||||
|
@ -955,7 +960,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
}
|
||||
if (id == IDC_BROWSE)
|
||||
{
|
||||
static char bt[NSIS_MAX_STRLEN];
|
||||
static TCHAR bt[NSIS_MAX_STRLEN];
|
||||
BROWSEINFO bi = {0,};
|
||||
ITEMIDLIST *idlist;
|
||||
bi.hwndOwner = hwndDlg;
|
||||
|
@ -975,7 +980,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
if (g_header->install_directory_auto_append &&
|
||||
dir == state_install_directory) // only append to $INSTDIR (bug #1174184)
|
||||
{
|
||||
const char *post_str = ps_tmpbuf;
|
||||
const TCHAR *post_str = ps_tmpbuf;
|
||||
GetNSISStringTT(g_header->install_directory_auto_append);
|
||||
// display name gives just the folder name
|
||||
if (lstrcmpi(post_str, g_tmp))
|
||||
|
@ -995,7 +1000,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
}
|
||||
if (uMsg == WM_IN_UPDATEMSG || uMsg == WM_NOTIFY_START)
|
||||
{
|
||||
static char s[NSIS_MAX_STRLEN];
|
||||
static TCHAR s[NSIS_MAX_STRLEN];
|
||||
int error = 0;
|
||||
int available_set = 0;
|
||||
unsigned total, available;
|
||||
|
@ -1026,15 +1031,15 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
|
||||
// Test for and use the GetDiskFreeSpaceEx API
|
||||
{
|
||||
BOOL (WINAPI *GDFSE)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER) =
|
||||
myGetProcAddress(MGA_GetDiskFreeSpaceExA);
|
||||
BOOL (WINAPI *GDFSE)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER) =
|
||||
myGetProcAddress(MGA_GetDiskFreeSpaceEx);
|
||||
if (GDFSE)
|
||||
{
|
||||
ULARGE_INTEGER available64;
|
||||
ULARGE_INTEGER a, b;
|
||||
char *p;
|
||||
TCHAR *p;
|
||||
WORD *pw = NULL;
|
||||
while ((char *) pw != s) // trimslashtoend() cut the entire string
|
||||
while ((TCHAR *) pw != s) // trimslashtoend() cut the entire string
|
||||
{
|
||||
if (GDFSE(s, &available64, &a, &b))
|
||||
{
|
||||
|
@ -1053,7 +1058,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
|
||||
p = trimslashtoend(s); // trim last backslash
|
||||
pw = (LPWORD) (p - 1);
|
||||
*pw = CHAR2_TO_WORD('\\', 0); // bring it back, but make the next char null
|
||||
*pw = CHAR2_TO_WORD(_T('\\'), 0); // bring it back, but make the next TCHAR null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1061,7 +1066,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
if (!available_set)
|
||||
{
|
||||
DWORD spc, bps, fc, tc;
|
||||
char *root;
|
||||
TCHAR *root;
|
||||
|
||||
// GetDiskFreeSpaceEx accepts any path, but GetDiskFreeSpace accepts only the root
|
||||
mystrcpy(s,dir);
|
||||
|
@ -1087,7 +1092,7 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
if (available_set)
|
||||
SetSizeText(IDC_SPACEAVAILABLE,LANG_SPACE_AVAIL,available);
|
||||
else
|
||||
SetUITextNT(IDC_SPACEAVAILABLE,"");
|
||||
SetUITextNT(IDC_SPACEAVAILABLE,_T(""));
|
||||
}
|
||||
|
||||
g_exec_flags.instdir_error = error;
|
||||
|
@ -1500,8 +1505,8 @@ static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
|
||||
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
|
||||
void NSISCALL update_status_text(int strtab, const char *text) {
|
||||
static char tmp[NSIS_MAX_STRLEN*2];
|
||||
void NSISCALL update_status_text(int strtab, const TCHAR *text) {
|
||||
static TCHAR tmp[NSIS_MAX_STRLEN*2];
|
||||
LVITEM new_item;
|
||||
HWND linsthwnd = insthwnd;
|
||||
if (linsthwnd)
|
||||
|
@ -1567,7 +1572,7 @@ static DWORD WINAPI install_thread(LPVOID p)
|
|||
if (s->flags&SF_SELECTED)
|
||||
#endif
|
||||
{
|
||||
log_printf2("Section: \"%s\"",s->name);
|
||||
log_printf2(_T("Section: \"%s\""),s->name);
|
||||
if (ExecuteCodeSegment(s->code,progresswnd))
|
||||
{
|
||||
g_exec_flags.abort++;
|
||||
|
@ -1577,7 +1582,7 @@ static DWORD WINAPI install_thread(LPVOID p)
|
|||
#ifdef NSIS_CONFIG_COMPONENTPAGE
|
||||
else
|
||||
{
|
||||
log_printf2("Skipping section: \"%s\"",s->name);
|
||||
log_printf2(_T("Skipping section: \"%s\""),s->name);
|
||||
}
|
||||
#endif
|
||||
s++;
|
||||
|
@ -1611,7 +1616,7 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
progress_bar_len=sumsecsfield(code_size);
|
||||
progress_bar_pos=0;
|
||||
|
||||
log_printf3("New install of \"%s\" to \"%s\"",GetNSISStringTT(LANG_NAME),state_install_directory);
|
||||
log_printf3(_T("New install of \"%s\" to \"%s\""),GetNSISStringTT(LANG_NAME),state_install_directory);
|
||||
|
||||
GetClientRect(linsthwnd, &r);
|
||||
lvc.cx = r.right - GetSystemMetrics(SM_CXHSCROLL);
|
||||
|
@ -1718,14 +1723,14 @@ static BOOL CALLBACK InstProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
// Clipboard MSDN docs say mem must be GMEM_MOVEABLE
|
||||
OpenClipboard(0);
|
||||
EmptyClipboard();
|
||||
memory = GlobalAlloc(GHND,total);
|
||||
memory = GlobalAlloc(GHND,total*sizeof(TCHAR));
|
||||
ptr = GlobalLock(memory);
|
||||
//endPtr = ptr+total-2; // -2 to allow for CR/LF
|
||||
i = 0;
|
||||
do {
|
||||
item.pszText = ptr;
|
||||
ptr += SendMessage(linsthwnd,LVM_GETITEMTEXT,i,(LPARAM)&item);
|
||||
*(WORD*)ptr = CHAR2_TO_WORD('\r','\n');
|
||||
*(WORD*)ptr = CHAR2_TO_WORD(_T('\r'),_T('\n'));
|
||||
ptr+=2;
|
||||
} while (++i < count);
|
||||
// memory is auto zeroed when allocated with GHND - *ptr = 0;
|
||||
|
|
|
@ -64,7 +64,7 @@ typedef struct
|
|||
typedef struct {
|
||||
exec_flags_t *exec_flags;
|
||||
int (NSISCALL *ExecuteCodeSegment)(int, HWND);
|
||||
void (NSISCALL *validate_filename)(char *);
|
||||
void (NSISCALL *validate_filename)(TCHAR *);
|
||||
int (NSISCALL *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK); // returns 0 on success, 1 if already registered and < 0 on errors
|
||||
} extra_parameters;
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/22/2007
|
||||
*/
|
||||
|
||||
#include "../Platform.h"
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/22/2007
|
||||
*/
|
||||
|
||||
#include "../Platform.h"
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/22/2007
|
||||
*/
|
||||
|
||||
#ifndef ___COMPONENTS_H___
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/22/2007
|
||||
*/
|
||||
|
||||
#ifndef NSIS_CONFIG_H
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/13/2007
|
||||
*/
|
||||
|
||||
#include "../Platform.h"
|
||||
|
@ -27,6 +29,7 @@
|
|||
#include "lang.h"
|
||||
#include "resource.h"
|
||||
#include "api.h"
|
||||
#include "../tchar.h"
|
||||
|
||||
#define EXEC_ERROR 0x7FFFFFFF
|
||||
|
||||
|
@ -37,7 +40,7 @@ HWND g_SectionHack;
|
|||
#ifdef NSIS_SUPPORT_STACK
|
||||
typedef struct _stack_t {
|
||||
struct _stack_t *next;
|
||||
char text[NSIS_MAX_STRLEN];
|
||||
TCHAR text[NSIS_MAX_STRLEN];
|
||||
} stack_t;
|
||||
|
||||
static stack_t *g_st;
|
||||
|
@ -59,6 +62,11 @@ HRESULT g_hres;
|
|||
|
||||
static int NSISCALL ExecuteEntry(entry *entry_);
|
||||
|
||||
/**
|
||||
* If v is negative, then the address to resolve is actually
|
||||
* stored in the global user variables. Convert the value
|
||||
* to integer and return.
|
||||
*/
|
||||
int NSISCALL resolveaddr(int v)
|
||||
{
|
||||
if (v < 0)
|
||||
|
@ -107,7 +115,7 @@ int NSISCALL ExecuteCallbackFunction(int num)
|
|||
|
||||
#endif
|
||||
|
||||
static char bufs[5][NSIS_MAX_STRLEN];
|
||||
static TCHAR bufs[5][NSIS_MAX_STRLEN];
|
||||
static int *parms;
|
||||
|
||||
void NSISCALL update_status_text_buf1(int strtab)
|
||||
|
@ -123,10 +131,14 @@ static int NSISCALL GetIntFromParm(int id_)
|
|||
// NB - USE CAUTION when rearranging code to make use of the new return value of
|
||||
// this function - be sure the parm being accessed is not modified before the call.
|
||||
// Use a negative number to get the string validated as a file name
|
||||
static char * NSISCALL GetStringFromParm(int id_)
|
||||
// Note: Calling GetNSISString has the side effect that the buffer holding
|
||||
// the string to expand gets modified.
|
||||
// When calling this function with numbers like 0x13, it means create the string
|
||||
// from the string ID found in entry.offset[3] and put it into bufs[0].
|
||||
static TCHAR * NSISCALL GetStringFromParm(int id_)
|
||||
{
|
||||
int id = id_ < 0 ? -id_ : id_;
|
||||
char *result = GetNSISString(bufs[id >> 4], parms[id & 0xF]);
|
||||
TCHAR *result = GetNSISString(bufs[id >> 4], parms[id & 0xF]);
|
||||
if (id_ < 0) validate_filename(result);
|
||||
return result;
|
||||
}
|
||||
|
@ -145,7 +157,7 @@ static LONG NSISCALL myRegDeleteKeyEx(HKEY thiskey, LPCTSTR lpSubKey, int onlyif
|
|||
if (retval==ERROR_SUCCESS)
|
||||
{
|
||||
// NB - don't change this to static (recursive function)
|
||||
char buffer[MAX_PATH+1];
|
||||
TCHAR buffer[MAX_PATH+1];
|
||||
while (RegEnumKey(key,0,buffer,MAX_PATH+1)==ERROR_SUCCESS)
|
||||
{
|
||||
if (onlyifempty)
|
||||
|
@ -157,9 +169,9 @@ static LONG NSISCALL myRegDeleteKeyEx(HKEY thiskey, LPCTSTR lpSubKey, int onlyif
|
|||
}
|
||||
RegCloseKey(key);
|
||||
{
|
||||
typedef LONG (WINAPI * RegDeleteKeyExAPtr)(HKEY, LPCTSTR, REGSAM, DWORD);
|
||||
RegDeleteKeyExAPtr RDKE = (RegDeleteKeyExAPtr)
|
||||
myGetProcAddress(MGA_RegDeleteKeyExA);
|
||||
typedef LONG (WINAPI * RegDeleteKeyExPtr)(HKEY, LPCTSTR, REGSAM, DWORD);
|
||||
RegDeleteKeyExPtr RDKE = (RegDeleteKeyExPtr)
|
||||
myGetProcAddress(MGA_RegDeleteKeyEx);
|
||||
|
||||
if (RDKE)
|
||||
retval=RDKE(thiskey,lpSubKey,AlterRegistrySAM(0),0);
|
||||
|
@ -195,14 +207,14 @@ static HKEY NSISCALL myRegOpenKey(REGSAM samDesired)
|
|||
// otherwise, returns new_position+1
|
||||
static int NSISCALL ExecuteEntry(entry *entry_)
|
||||
{
|
||||
char *buf0 = bufs[0];
|
||||
char *buf1 = bufs[1];
|
||||
char *buf2 = bufs[2];
|
||||
char *buf3 = bufs[3];
|
||||
TCHAR *buf0 = bufs[0];
|
||||
TCHAR *buf1 = bufs[1];
|
||||
TCHAR *buf2 = bufs[2];
|
||||
TCHAR *buf3 = bufs[3];
|
||||
//char *buf4 = bufs[4];
|
||||
|
||||
char *var0;
|
||||
char *var1;
|
||||
TCHAR *var0;
|
||||
TCHAR *var1;
|
||||
//char *var2;
|
||||
//char *var3;
|
||||
//char *var4;
|
||||
|
@ -239,11 +251,11 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
switch (which)
|
||||
{
|
||||
case EW_NOP:
|
||||
log_printf2("Jump: %d",parm0);
|
||||
log_printf2(_T("Jump: %d"),parm0);
|
||||
return parm0;
|
||||
case EW_ABORT:
|
||||
{
|
||||
log_printf2("Aborting: \"%s\"",GetStringFromParm(0x00));
|
||||
log_printf2(_T("Aborting: \"%s\""),GetStringFromParm(0x00));
|
||||
update_status_text(parm0,0);
|
||||
}
|
||||
return EXEC_ERROR;
|
||||
|
@ -254,23 +266,23 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
case EW_CALL:
|
||||
{
|
||||
int v=resolveaddr(parm0)-1; // address is -1, since we encode it as +1
|
||||
log_printf2("Call: %d",v);
|
||||
log_printf2(_T("Call: %d"),v);
|
||||
return ExecuteCodeSegment(v,NULL);
|
||||
}
|
||||
case EW_UPDATETEXT:
|
||||
log_printf2("detailprint: %s",GetStringFromParm(0x00));
|
||||
log_printf2(_T("detailprint: %s"),GetStringFromParm(0x00));
|
||||
update_status_text(parm0,0);
|
||||
break;
|
||||
case EW_SLEEP:
|
||||
{
|
||||
int x=GetIntFromParm(0);
|
||||
log_printf2("Sleep(%d)",x);
|
||||
log_printf2(_T("Sleep(%d)"),x);
|
||||
Sleep(max(x,1));
|
||||
}
|
||||
break;
|
||||
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
case EW_BRINGTOFRONT:
|
||||
log_printf("BringToFront");
|
||||
log_printf(_T("BringToFront"));
|
||||
SetForegroundWindow(g_hwnd);
|
||||
break;
|
||||
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
|
@ -302,44 +314,44 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
case EW_SETFILEATTRIBUTES:
|
||||
{
|
||||
char *buf1=GetStringFromParm(-0x10);
|
||||
log_printf3("SetFileAttributes: \"%s\":%08X",buf1,parm1);
|
||||
TCHAR *buf1=GetStringFromParm(-0x10);
|
||||
log_printf3(_T("SetFileAttributes: \"%s\":%08X"),buf1,parm1);
|
||||
if (!SetFileAttributes(buf1,parm1))
|
||||
{
|
||||
exec_error++;
|
||||
log_printf("SetFileAttributes failed.");
|
||||
log_printf(_T("SetFileAttributes failed."));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EW_CREATEDIR: {
|
||||
char *buf1=GetStringFromParm(-0x10);
|
||||
log_printf3("CreateDirectory: \"%s\" (%d)",buf1,parm1);
|
||||
TCHAR *buf1=GetStringFromParm(-0x10);
|
||||
log_printf3(_T("CreateDirectory: \"%s\" (%d)"),buf1,parm1);
|
||||
{
|
||||
char *p = skip_root(buf1);
|
||||
char c = 'c';
|
||||
TCHAR *p = skip_root(buf1);
|
||||
TCHAR c = _T('c');
|
||||
if (p)
|
||||
{
|
||||
while (c)
|
||||
{
|
||||
p = findchar(p, '\\');
|
||||
p = findchar(p, _T('\\'));
|
||||
c = *p;
|
||||
*p = 0;
|
||||
if (!CreateDirectory(buf1, NULL))
|
||||
{
|
||||
if (GetLastError() != ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
log_printf3("CreateDirectory: can't create \"%s\" (err=%d)",buf1,GetLastError());
|
||||
{
|
||||
log_printf3(_T("CreateDirectory: can't create \"%s\" (err=%d)"),buf1,GetLastError());
|
||||
exec_error++;
|
||||
}
|
||||
else if ((GetFileAttributes(buf1) & FILE_ATTRIBUTE_DIRECTORY) == 0)
|
||||
{
|
||||
log_printf2("CreateDirectory: can't create \"%s\" - a file already exists",buf1);
|
||||
log_printf2(_T("CreateDirectory: can't create \"%s\" - a file already exists"),buf1);
|
||||
exec_error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log_printf2("CreateDirectory: \"%s\" created",buf1);
|
||||
log_printf2(_T("CreateDirectory: \"%s\" created"),buf1);
|
||||
}
|
||||
*p++ = c;
|
||||
}
|
||||
|
@ -360,22 +372,22 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
break;
|
||||
case EW_IFFILEEXISTS:
|
||||
{
|
||||
char *buf0=GetStringFromParm(0x00);
|
||||
TCHAR *buf0=GetStringFromParm(0x00);
|
||||
if (file_exists(buf0))
|
||||
{
|
||||
log_printf3("IfFileExists: file \"%s\" exists, jumping %d",buf0,parm1);
|
||||
log_printf3(_T("IfFileExists: file \"%s\" exists, jumping %d"),buf0,parm1);
|
||||
return parm1;
|
||||
}
|
||||
log_printf3("IfFileExists: file \"%s\" does not exist, jumping %d",buf0,parm2);
|
||||
log_printf3(_T("IfFileExists: file \"%s\" does not exist, jumping %d"),buf0,parm2);
|
||||
}
|
||||
return parm2;
|
||||
#ifdef NSIS_SUPPORT_RENAME
|
||||
case EW_RENAME:
|
||||
{
|
||||
char *buf3=GetStringFromParm(-0x30);
|
||||
char *buf2=GetStringFromParm(-0x21);
|
||||
char *buf1=GetStringFromParm(0x13);
|
||||
log_printf2("Rename: %s",buf1);
|
||||
TCHAR *buf3=GetStringFromParm(-0x30);
|
||||
TCHAR *buf2=GetStringFromParm(-0x21);
|
||||
TCHAR *buf1=GetStringFromParm(0x13);
|
||||
log_printf2(_T("Rename: %s"),buf1);
|
||||
if (MoveFile(buf3,buf2))
|
||||
{
|
||||
update_status_text_buf1(LANG_RENAME);
|
||||
|
@ -387,13 +399,13 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
{
|
||||
MoveFileOnReboot(buf3,buf2);
|
||||
update_status_text_buf1(LANG_RENAMEONREBOOT);
|
||||
log_printf2("Rename on reboot: %s",buf1);
|
||||
log_printf2(_T("Rename on reboot: %s"),buf1);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
exec_error++;
|
||||
log_printf2("Rename failed: %s",buf1);
|
||||
log_printf2(_T("Rename failed: %s"),buf1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -402,9 +414,9 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#ifdef NSIS_SUPPORT_FNUTIL
|
||||
case EW_GETFULLPATHNAME:
|
||||
{
|
||||
char *fp;
|
||||
char *p=var1;
|
||||
char *buf0=GetStringFromParm(0x00);
|
||||
TCHAR *fp;
|
||||
TCHAR *p=var1;
|
||||
TCHAR *buf0=GetStringFromParm(0x00);
|
||||
if (!GetFullPathName(buf0,NSIS_MAX_STRLEN,p,&fp))
|
||||
{
|
||||
exec_error++;
|
||||
|
@ -428,9 +440,9 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
break;
|
||||
case EW_SEARCHPATH:
|
||||
{
|
||||
char *fp;
|
||||
char *p=var0;
|
||||
char *buf0=GetStringFromParm(-0x01);
|
||||
TCHAR *fp;
|
||||
TCHAR *p=var0;
|
||||
TCHAR *buf0=GetStringFromParm(-0x01);
|
||||
if (!SearchPath(NULL,buf0,NULL,NSIS_MAX_STRLEN,p,&fp))
|
||||
{
|
||||
exec_error++;
|
||||
|
@ -440,7 +452,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
break;
|
||||
case EW_GETTEMPFILENAME:
|
||||
{
|
||||
char *textout=var0;
|
||||
TCHAR *textout=var0;
|
||||
if (!my_GetTempFileName(textout, GetStringFromParm(-0x11)))
|
||||
exec_error++;
|
||||
}
|
||||
|
@ -451,10 +463,10 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
{
|
||||
HANDLE hOut;
|
||||
int ret;
|
||||
char *buf3 = GetStringFromParm(0x31);
|
||||
TCHAR *buf3 = GetStringFromParm(0x31);
|
||||
int overwriteflag = parm0 & 7;
|
||||
|
||||
log_printf4("File: overwriteflag=%d, allowskipfilesflag=%d, name=\"%s\"",overwriteflag,(parm0>>3)&MB_ABORTRETRYIGNORE,buf3);
|
||||
log_printf4(_T("File: overwriteflag=%d, allowskipfilesflag=%d, name=\"%s\""),overwriteflag,(parm0>>3)&MB_ABORTRETRYIGNORE,buf3);
|
||||
if (validpathspec(buf3))
|
||||
{
|
||||
mystrcpy(buf0,buf3);
|
||||
|
@ -485,10 +497,10 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
{
|
||||
update_status_text(LANG_SKIPPED,buf3);
|
||||
if (overwriteflag==2) exec_error++;
|
||||
log_printf3("File: skipped: \"%s\" (overwriteflag=%d)",buf0,overwriteflag);
|
||||
log_printf3(_T("File: skipped: \"%s\" (overwriteflag=%d)"),buf0,overwriteflag);
|
||||
break;
|
||||
}
|
||||
log_printf2("File: error creating \"%s\"",buf0);
|
||||
log_printf2(_T("File: error creating \"%s\""),buf0);
|
||||
|
||||
mystrcpy(buf2,g_usrvars[0]); // save $0
|
||||
mystrcpy(g_usrvars[0],buf0); // copy file name to $0
|
||||
|
@ -499,14 +511,14 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
switch (my_MessageBox(buf1, parm0>>3))
|
||||
{
|
||||
case IDRETRY:
|
||||
log_printf("File: error, user retry");
|
||||
log_printf(_T("File: error, user retry"));
|
||||
goto _tryagain;
|
||||
case IDIGNORE:
|
||||
log_printf("File: error, user cancel");
|
||||
log_printf(_T("File: error, user cancel"));
|
||||
g_exec_flags.exec_error++;
|
||||
return 0;
|
||||
default:
|
||||
log_printf("File: error, user abort");
|
||||
log_printf(_T("File: error, user abort"));
|
||||
update_status_text(LANG_CANTWRITE,buf0);
|
||||
return EXEC_ERROR;
|
||||
}
|
||||
|
@ -519,7 +531,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
g_exec_flags.status_update--;
|
||||
}
|
||||
|
||||
log_printf3("File: wrote %d to \"%s\"",ret,buf0);
|
||||
log_printf3(_T("File: wrote %d to \"%s\""),ret,buf0);
|
||||
|
||||
if (parm3 != 0xffffffff || parm4 != 0xffffffff)
|
||||
SetFileTime(hOut,(FILETIME*)(lent.offsets+3),NULL,(FILETIME*)(lent.offsets+3));
|
||||
|
@ -537,7 +549,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
{
|
||||
GetNSISString(buf0,LANG_ERRORDECOMPRESSING);
|
||||
}
|
||||
log_printf2("%s",buf0);
|
||||
log_printf2(_T("%s"),buf0);
|
||||
my_MessageBox(buf0,MB_OK|MB_ICONSTOP|(IDOK<<21));
|
||||
return EXEC_ERROR;
|
||||
}
|
||||
|
@ -547,8 +559,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#ifdef NSIS_SUPPORT_DELETE
|
||||
case EW_DELETEFILE:
|
||||
{
|
||||
char *buf0=GetStringFromParm(0x00);
|
||||
log_printf2("Delete: \"%s\"",buf0);
|
||||
TCHAR *buf0=GetStringFromParm(0x00);
|
||||
log_printf2(_T("Delete: \"%s\""),buf0);
|
||||
myDelete(buf0,parm1);
|
||||
}
|
||||
break;
|
||||
|
@ -557,8 +569,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
case EW_MESSAGEBOX: // MessageBox
|
||||
{
|
||||
int v;
|
||||
char *buf3=GetStringFromParm(0x31);
|
||||
log_printf3("MessageBox: %d,\"%s\"",parm0,buf3);
|
||||
TCHAR *buf3=GetStringFromParm(0x31);
|
||||
log_printf3(_T("MessageBox: %d,\"%s\""),parm0,buf3);
|
||||
v=my_MessageBox(buf3,parm0);
|
||||
if (v)
|
||||
{
|
||||
|
@ -578,8 +590,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#ifdef NSIS_SUPPORT_RMDIR
|
||||
case EW_RMDIR:
|
||||
{
|
||||
char *buf1=GetStringFromParm(-0x10);
|
||||
log_printf2("RMDir: \"%s\"",buf1);
|
||||
TCHAR *buf1=GetStringFromParm(-0x10);
|
||||
log_printf2(_T("RMDir: \"%s\""),buf1);
|
||||
|
||||
myDelete(buf1,parm1);
|
||||
}
|
||||
|
@ -588,7 +600,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#ifdef NSIS_SUPPORT_STROPTS
|
||||
case EW_STRLEN:
|
||||
{
|
||||
char *buf0=GetStringFromParm(0x01);
|
||||
TCHAR *buf0=GetStringFromParm(0x01);
|
||||
myitoa(var0,mystrlen(buf0));
|
||||
}
|
||||
break;
|
||||
|
@ -597,8 +609,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
int newlen=GetIntFromParm(2);
|
||||
int start=GetIntFromParm(3);
|
||||
int l;
|
||||
char *p=var0;
|
||||
char *buf0=GetStringFromParm(0x01);
|
||||
TCHAR *p=var0;
|
||||
TCHAR *buf0=GetStringFromParm(0x01);
|
||||
*p=0;
|
||||
if (!parm2 || newlen)
|
||||
{
|
||||
|
@ -621,8 +633,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
break;
|
||||
case EW_STRCMP:
|
||||
{
|
||||
char *buf2=GetStringFromParm(0x20);
|
||||
char *buf3=GetStringFromParm(0x31);
|
||||
TCHAR *buf2=GetStringFromParm(0x20);
|
||||
TCHAR *buf3=GetStringFromParm(0x31);
|
||||
if (!parm4) {
|
||||
// case insensitive
|
||||
if (!lstrcmpi(buf2,buf3)) return parm2;
|
||||
|
@ -637,8 +649,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#ifdef NSIS_SUPPORT_ENVIRONMENT
|
||||
case EW_READENVSTR:
|
||||
{
|
||||
char *p=var0;
|
||||
char *buf0=GetStringFromParm(0x01);
|
||||
TCHAR *p=var0;
|
||||
TCHAR *buf0=GetStringFromParm(0x01);
|
||||
if (!ExpandEnvironmentStrings(buf0,p,NSIS_MAX_STRLEN)
|
||||
|| (parm2 && !lstrcmp(buf0, p)))
|
||||
{
|
||||
|
@ -670,7 +682,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
case EW_INTOP:
|
||||
{
|
||||
int v,v2;
|
||||
char *p=var0;
|
||||
TCHAR *p=var0;
|
||||
v=GetIntFromParm(1);
|
||||
v2=GetIntFromParm(2);
|
||||
switch (parm3)
|
||||
|
@ -693,7 +705,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
}
|
||||
break;
|
||||
case EW_INTFMT: {
|
||||
char *buf0=GetStringFromParm(0x01);
|
||||
TCHAR *buf0=GetStringFromParm(0x01);
|
||||
wsprintf(var0,
|
||||
buf0,
|
||||
GetIntFromParm(2));
|
||||
|
@ -710,7 +722,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
while (cnt--&&s) s=s->next;
|
||||
if (!s)
|
||||
{
|
||||
log_printf2("Exch: stack < %d elements",parm2);
|
||||
log_printf2(_T("Exch: stack < %d elements"),parm2);
|
||||
my_MessageBox(GetNSISStringTT(LANG_INSTCORRUPTED),MB_OK|MB_ICONSTOP|(IDOK<<21));
|
||||
return EXEC_ERROR;
|
||||
}
|
||||
|
@ -722,7 +734,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
{
|
||||
if (!s)
|
||||
{
|
||||
log_printf("Pop: stack empty");
|
||||
log_printf(_T("Pop: stack empty"));
|
||||
exec_error++;
|
||||
break;
|
||||
}
|
||||
|
@ -756,12 +768,15 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
int msg=GetIntFromParm(2);
|
||||
|
||||
if (parm5>>2) exec_error += !SendMessageTimeout(hwnd,msg,b3,b4,SMTO_NORMAL,parm5>>2,(LPDWORD)&v);
|
||||
// Jim Park: This sends script messages. Some messages require
|
||||
// settings for Unicode. This means the user's script may need
|
||||
// to change for Unicode NSIS.
|
||||
else v=SendMessage(hwnd,msg,b3,b4);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *buf0=GetStringFromParm(0x01);
|
||||
char *buf1=GetStringFromParm(0x12);
|
||||
TCHAR *buf0=GetStringFromParm(0x01);
|
||||
TCHAR *buf1=GetStringFromParm(0x12);
|
||||
v=(int)FindWindowEx((HWND)b3,(HWND)b4,buf0[0]?buf0:NULL,buf1[0]?buf1:NULL);
|
||||
}
|
||||
|
||||
|
@ -829,7 +844,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
{
|
||||
HWND hw=(HWND)GetIntFromParm(0);
|
||||
int a=GetIntFromParm(1);
|
||||
if (parm2) log_printf("HideWindow");
|
||||
if (parm2) log_printf(_T("HideWindow"));
|
||||
if (!parm3)
|
||||
ShowWindow(hw,a);
|
||||
else
|
||||
|
@ -842,20 +857,20 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
case EW_SHELLEXEC: // this uses improvements of Andras Varga
|
||||
{
|
||||
int x;
|
||||
char *buf0=GetStringFromParm(0x00);
|
||||
char *buf3=GetStringFromParm(0x31);
|
||||
char *buf2=GetStringFromParm(0x22);
|
||||
char *buf1=GetStringFromParm(0x15);
|
||||
TCHAR *buf0=GetStringFromParm(0x00);
|
||||
TCHAR *buf3=GetStringFromParm(0x31);
|
||||
TCHAR *buf2=GetStringFromParm(0x22);
|
||||
TCHAR *buf1=GetStringFromParm(0x15);
|
||||
update_status_text_buf1(LANG_EXECSHELL);
|
||||
x=(int)ShellExecute(g_hwnd,buf0[0]?buf0:NULL,buf3,buf2[0]?buf2:NULL,state_output_directory,parm3);
|
||||
if (x < 33)
|
||||
{
|
||||
log_printf5("ExecShell: warning: error (\"%s\": file:\"%s\" params:\"%s\")=%d",buf0,buf3,buf2,x);
|
||||
log_printf5(_T("ExecShell: warning: error (\"%s\": file:\"%s\" params:\"%s\")=%d"),buf0,buf3,buf2,x);
|
||||
exec_error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
log_printf4("ExecShell: success (\"%s\": file:\"%s\" params:\"%s\")",buf0,buf3,buf2);
|
||||
log_printf4(_T("ExecShell: success (\"%s\": file:\"%s\" params:\"%s\")"),buf0,buf3,buf2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -864,15 +879,15 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
case EW_EXECUTE:
|
||||
{
|
||||
HANDLE hProc;
|
||||
char *buf0=GetStringFromParm(0x00);
|
||||
log_printf2("Exec: command=\"%s\"",buf0);
|
||||
TCHAR *buf0=GetStringFromParm(0x00);
|
||||
log_printf2(_T("Exec: command=\"%s\""),buf0);
|
||||
update_status_text(LANG_EXECUTE,buf0);
|
||||
|
||||
hProc=myCreateProcess(buf0);
|
||||
|
||||
if (hProc)
|
||||
{
|
||||
log_printf2("Exec: success (\"%s\")",buf0);
|
||||
log_printf2(_T("Exec: success (\"%s\")"),buf0);
|
||||
if (parm2)
|
||||
{
|
||||
DWORD lExitCode;
|
||||
|
@ -890,7 +905,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
else
|
||||
{
|
||||
exec_error++;
|
||||
log_printf2("Exec: failed createprocess (\"%s\")",buf0);
|
||||
log_printf2(_T("Exec: failed createprocess (\"%s\")"),buf0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -902,9 +917,9 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
// also allows GetFileTime to be passed a wildcard.
|
||||
{
|
||||
WIN32_FIND_DATA *ffd;
|
||||
char *highout=var0;
|
||||
char *lowout=var1;
|
||||
char *buf0=GetStringFromParm(0x02);
|
||||
TCHAR *highout=var0;
|
||||
TCHAR *lowout=var1;
|
||||
TCHAR *buf0=GetStringFromParm(0x02);
|
||||
|
||||
ffd=file_exists(buf0);
|
||||
if (ffd)
|
||||
|
@ -923,12 +938,12 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#ifdef NSIS_SUPPORT_GETDLLVERSION
|
||||
case EW_GETDLLVERSION:
|
||||
{
|
||||
char *highout=var0;
|
||||
char *lowout=var1;
|
||||
TCHAR *highout=var0;
|
||||
TCHAR *lowout=var1;
|
||||
DWORD s1;
|
||||
VS_FIXEDFILEINFO *pvsf1;
|
||||
DWORD d;
|
||||
char *buf1=GetStringFromParm(-0x12);
|
||||
TCHAR *buf1=GetStringFromParm(-0x12);
|
||||
s1=GetFileVersionInfoSize(buf1,&d);
|
||||
*lowout=*highout=0;
|
||||
exec_error++;
|
||||
|
@ -939,7 +954,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
if (b1)
|
||||
{
|
||||
UINT uLen;
|
||||
if (GetFileVersionInfo(buf1,0,s1,b1) && VerQueryValue(b1,"\\",(void*)&pvsf1,&uLen))
|
||||
if (GetFileVersionInfo(buf1,0,s1,b1) && VerQueryValue(b1,_T("\\"),(void*)&pvsf1,&uLen))
|
||||
{
|
||||
myitoa(highout,pvsf1->dwFileVersionMS);
|
||||
myitoa(lowout,pvsf1->dwFileVersionLS);
|
||||
|
@ -959,8 +974,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
if (SUCCEEDED(g_hres))
|
||||
{
|
||||
HANDLE h=NULL;
|
||||
char *buf1=GetStringFromParm(-0x10);
|
||||
char *buf0=GetStringFromParm(0x01);
|
||||
TCHAR *buf1=GetStringFromParm(-0x10);
|
||||
TCHAR *buf0=GetStringFromParm(0x01);
|
||||
|
||||
if (parm4)
|
||||
h=GetModuleHandle(buf1);
|
||||
|
@ -979,12 +994,12 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
}
|
||||
else
|
||||
{
|
||||
void (*func)(HWND,int,char*,void*,void*);
|
||||
void (*func)(HWND,int,TCHAR*,void*,void*);
|
||||
func=(void*)funke;
|
||||
func(
|
||||
g_hwnd,
|
||||
NSIS_MAX_STRLEN,
|
||||
(char*)g_usrvars,
|
||||
(TCHAR*)g_usrvars,
|
||||
#ifdef NSIS_SUPPORT_STACK
|
||||
(void*)&g_st,
|
||||
#else
|
||||
|
@ -997,20 +1012,20 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
else
|
||||
{
|
||||
update_status_text(LANG_CANNOTFINDSYMBOL,buf0);
|
||||
log_printf3("Error registering DLL: %s not found in %s",buf0,buf1);
|
||||
log_printf3(_T("Error registering DLL: %s not found in %s"),buf0,buf1);
|
||||
}
|
||||
if (!parm3 && Plugins_CanUnload(h)) FreeLibrary(h);
|
||||
}
|
||||
else
|
||||
{
|
||||
update_status_text_buf1(LANG_COULDNOTLOAD);
|
||||
log_printf2("Error registering DLL: Could not load %s",buf1);
|
||||
log_printf2(_T("Error registering DLL: Could not load %s"),buf1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
update_status_text_buf1(LANG_NOOLE);
|
||||
log_printf("Error registering DLL: Could not initialize OLE");
|
||||
log_printf(_T("Error registering DLL: Could not initialize OLE"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1018,11 +1033,11 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#ifdef NSIS_SUPPORT_CREATESHORTCUT
|
||||
case EW_CREATESHORTCUT:
|
||||
{
|
||||
char *buf1=GetStringFromParm(-0x10);
|
||||
char *buf2=GetStringFromParm(-0x21);
|
||||
char *buf0=GetStringFromParm(0x02);
|
||||
char *buf3=GetStringFromParm(-0x33);
|
||||
char *buf4=GetStringFromParm(0x45);
|
||||
TCHAR *buf1=GetStringFromParm(-0x10);
|
||||
TCHAR *buf2=GetStringFromParm(-0x21);
|
||||
TCHAR *buf0=GetStringFromParm(0x02);
|
||||
TCHAR *buf3=GetStringFromParm(-0x33);
|
||||
TCHAR *buf4=GetStringFromParm(0x45);
|
||||
|
||||
HRESULT hres;
|
||||
IShellLink* psl;
|
||||
|
@ -1030,7 +1045,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
if (!validpathspec(buf2))
|
||||
GetStringFromParm(0x21);
|
||||
|
||||
log_printf8("CreateShortCut: out: \"%s\", in: \"%s %s\", icon: %s,%d, sw=%d, hk=%d",
|
||||
log_printf8(_T("CreateShortCut: out: \"%s\", in: \"%s %s\", icon: %s,%d, sw=%d, hk=%d"),
|
||||
buf1,buf2,buf0,buf3,parm4&0xff,(parm4&0xff00)>>8,parm4>>16);
|
||||
|
||||
hres = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
||||
|
@ -1079,10 +1094,10 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
{
|
||||
int res;
|
||||
SHFILEOPSTRUCT op;
|
||||
char *buf0=GetStringFromParm(0x00);
|
||||
char *buf1=GetStringFromParm(0x11);
|
||||
char *buf2=GetStringFromParm(0x23); // LANG_COPYTO + buf1
|
||||
log_printf3("CopyFiles \"%s\"->\"%s\"",buf0,buf1);
|
||||
TCHAR *buf0=GetStringFromParm(0x00);
|
||||
TCHAR *buf1=GetStringFromParm(0x11);
|
||||
TCHAR *buf2=GetStringFromParm(0x23); // LANG_COPYTO + buf1
|
||||
log_printf3(_T("CopyFiles \"%s\"->\"%s\""),buf0,buf1);
|
||||
|
||||
if (!file_exists(buf0))
|
||||
{
|
||||
|
@ -1131,9 +1146,9 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#ifdef NSIS_SUPPORT_INIFILES
|
||||
case EW_WRITEINI:
|
||||
{
|
||||
char *sec=0, *key=0, *str=0;
|
||||
TCHAR *sec=0, *key=0, *str=0;
|
||||
#ifdef NSIS_CONFIG_LOG
|
||||
mystrcpy(buf1,"<RM>");
|
||||
mystrcpy(buf1,_T("<RM>"));
|
||||
mystrcpy(buf2,buf1);
|
||||
#endif
|
||||
if (parm0)
|
||||
|
@ -1149,18 +1164,18 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
str=GetStringFromParm(0x22);
|
||||
}
|
||||
buf3=GetStringFromParm(-0x33);
|
||||
log_printf5("WriteINIStr: wrote [%s] %s=%s in %s",buf0,buf1,buf2,buf3);
|
||||
log_printf5(_T("WriteINIStr: wrote [%s] %s=%s in %s"),buf0,buf1,buf2,buf3);
|
||||
if (!WritePrivateProfileString(sec,key,str,buf3)) exec_error++;
|
||||
}
|
||||
break;
|
||||
case EW_READINISTR:
|
||||
{
|
||||
DWORD errstr = CHAR4_TO_DWORD('!', 'N', '~', 0);
|
||||
char *p=var0;
|
||||
char *buf0=GetStringFromParm(0x01);
|
||||
char *buf1=GetStringFromParm(0x12);
|
||||
char *buf2=GetStringFromParm(-0x23);
|
||||
GetPrivateProfileString(buf0,buf1,(LPCSTR)&errstr,p,NSIS_MAX_STRLEN-1,buf2);
|
||||
DWORD errstr = CHAR4_TO_DWORD(_T('!'), _T('N'), _T('~'), 0);
|
||||
TCHAR *p=var0;
|
||||
TCHAR *buf0=GetStringFromParm(0x01);
|
||||
TCHAR *buf1=GetStringFromParm(0x12);
|
||||
TCHAR *buf2=GetStringFromParm(-0x23);
|
||||
GetPrivateProfileString(buf0,buf1,(LPCTSTR)&errstr,p,NSIS_MAX_STRLEN-1,buf2);
|
||||
if (*(DWORD*)p == errstr)
|
||||
{
|
||||
exec_error++;
|
||||
|
@ -1173,22 +1188,22 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
case EW_DELREG:
|
||||
{
|
||||
long res=!ERROR_SUCCESS;
|
||||
const char *rkn UNUSED=RegKeyHandleToName((HKEY)parm1);
|
||||
const TCHAR *rkn UNUSED=RegKeyHandleToName((HKEY)parm1);
|
||||
if (!parm4)
|
||||
{
|
||||
HKEY hKey=myRegOpenKey(KEY_SET_VALUE);
|
||||
if (hKey)
|
||||
{
|
||||
char *buf3=GetStringFromParm(0x33);
|
||||
TCHAR *buf3=GetStringFromParm(0x33);
|
||||
res = RegDeleteValue(hKey,buf3);
|
||||
log_printf4("DeleteRegValue: \"%s\\%s\" \"%s\"",rkn,buf2,buf3);
|
||||
log_printf4(_T("DeleteRegValue: \"%s\\%s\" \"%s\""),rkn,buf2,buf3);
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char *buf2=GetStringFromParm(0x22);
|
||||
log_printf3("DeleteRegKey: \"%s\\%s\"",rkn,buf2);
|
||||
TCHAR *buf2=GetStringFromParm(0x22);
|
||||
log_printf3(_T("DeleteRegKey: \"%s\\%s\""),rkn,buf2);
|
||||
res = myRegDeleteKeyEx(GetRegRootKey(parm1),buf2,parm4&2);
|
||||
}
|
||||
if (res != ERROR_SUCCESS)
|
||||
|
@ -1201,9 +1216,9 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
HKEY rootkey=GetRegRootKey(parm0);
|
||||
int type=parm4;
|
||||
int rtype=parm5;
|
||||
char *buf0=GetStringFromParm(0x02);
|
||||
char *buf1=GetStringFromParm(0x11);
|
||||
const char *rkn UNUSED=RegKeyHandleToName(rootkey);
|
||||
TCHAR *buf0=GetStringFromParm(0x02);
|
||||
TCHAR *buf1=GetStringFromParm(0x11);
|
||||
const TCHAR *rkn UNUSED=RegKeyHandleToName(rootkey);
|
||||
|
||||
exec_error++;
|
||||
if (RegCreateKeyEx(rootkey,buf1,0,0,0,AlterRegistrySAM(KEY_SET_VALUE),0,&hKey,0) == ERROR_SUCCESS)
|
||||
|
@ -1213,31 +1228,31 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
if (type == REG_SZ)
|
||||
{
|
||||
GetStringFromParm(0x23);
|
||||
size = mystrlen((char *) data) + 1;
|
||||
size = (mystrlen((TCHAR *) data) + 1)*sizeof(TCHAR);
|
||||
if (rtype == REG_SZ)
|
||||
{
|
||||
log_printf5("WriteRegStr: \"%s\\%s\" \"%s\"=\"%s\"",rkn,buf1,buf0,data);
|
||||
log_printf5(_T("WriteRegStr: \"%s\\%s\" \"%s\"=\"%s\""),rkn,buf1,buf0,data);
|
||||
}
|
||||
else
|
||||
{
|
||||
log_printf5("WriteRegExpandStr: \"%s\\%s\" \"%s\"=\"%s\"",rkn,buf1,buf0,data);
|
||||
log_printf5(_T("WriteRegExpandStr: \"%s\\%s\" \"%s\"=\"%s\""),rkn,buf1,buf0,data);
|
||||
}
|
||||
}
|
||||
if (type == REG_DWORD)
|
||||
{
|
||||
*(LPDWORD) data = GetIntFromParm(3);
|
||||
size = sizeof(DWORD);
|
||||
log_printf5("WriteRegDWORD: \"%s\\%s\" \"%s\"=\"0x%08x\"",rkn,buf1,buf0,*(LPDWORD) data);
|
||||
log_printf5(_T("WriteRegDWORD: \"%s\\%s\" \"%s\"=\"0x%08x\""),rkn,buf1,buf0,*(LPDWORD) data);
|
||||
}
|
||||
if (type == REG_BINARY)
|
||||
{
|
||||
#ifdef NSIS_CONFIG_LOG
|
||||
char binbuf[128];
|
||||
TCHAR binbuf[128];
|
||||
#endif
|
||||
// use buf2, buf3 and buf4
|
||||
size = GetCompressedDataFromDataBlockToMemory(parm3, data, 3 * NSIS_MAX_STRLEN);
|
||||
size = GetCompressedDataFromDataBlockToMemory(parm3, data, (3 * NSIS_MAX_STRLEN)*sizeof(TCHAR));
|
||||
LogData2Hex(binbuf, sizeof(binbuf), data, size);
|
||||
log_printf5("WriteRegBin: \"%s\\%s\" \"%s\"=\"%s\"",rkn,buf1,buf0,binbuf);
|
||||
log_printf5(_T("WriteRegBin: \"%s\\%s\" \"%s\"=\"%s\""),rkn,buf1,buf0,binbuf);
|
||||
}
|
||||
|
||||
if (size >= 0 && RegSetValueEx(hKey,buf0,0,rtype,data,size) == ERROR_SUCCESS)
|
||||
|
@ -1246,19 +1261,19 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
}
|
||||
else
|
||||
{
|
||||
log_printf4("WriteReg: error writing into \"%s\\%s\" \"%s\"",rkn,buf1,buf0);
|
||||
log_printf4(_T("WriteReg: error writing into \"%s\\%s\" \"%s\""),rkn,buf1,buf0);
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
else { log_printf3("WriteReg: error creating key \"%s\\%s\"",rkn,buf1); }
|
||||
else { log_printf3(_T("WriteReg: error creating key \"%s\\%s\""),rkn,buf1); }
|
||||
}
|
||||
break;
|
||||
case EW_READREGSTR: // read registry string
|
||||
{
|
||||
HKEY hKey=myRegOpenKey(KEY_READ);
|
||||
char *p=var0;
|
||||
char *buf3=GetStringFromParm(0x33); // buf3 == key name
|
||||
TCHAR *p=var0;
|
||||
TCHAR *buf3=GetStringFromParm(0x33); // buf3 == key name
|
||||
p[0]=0;
|
||||
if (hKey)
|
||||
{
|
||||
|
@ -1292,7 +1307,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
case EW_REGENUM:
|
||||
{
|
||||
HKEY key=myRegOpenKey(KEY_READ);
|
||||
char *p=var0;
|
||||
TCHAR *p=var0;
|
||||
int b=GetIntFromParm(3);
|
||||
p[0]=0;
|
||||
if (key)
|
||||
|
@ -1315,15 +1330,15 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#ifdef NSIS_SUPPORT_FILEFUNCTIONS
|
||||
case EW_FCLOSE:
|
||||
{
|
||||
char *t=var0;
|
||||
TCHAR *t=var0;
|
||||
if (*t) CloseHandle((HANDLE)myatoi(t));
|
||||
}
|
||||
break;
|
||||
case EW_FOPEN:
|
||||
{
|
||||
HANDLE h;
|
||||
char *handleout=var0;
|
||||
char *buf1=GetStringFromParm(-0x13);
|
||||
TCHAR *handleout=var0;
|
||||
TCHAR *buf1=GetStringFromParm(-0x13);
|
||||
h=myOpenFile(buf1,parm1,parm2);
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -1340,8 +1355,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
{
|
||||
DWORD dw;
|
||||
int l;
|
||||
char *t=var0;
|
||||
if (parm2)
|
||||
TCHAR *t=var0;
|
||||
if (parm2) // WriteByte
|
||||
{
|
||||
((unsigned char *)buf1)[0]=GetIntFromParm(1)&0xff;
|
||||
l=1;
|
||||
|
@ -1372,7 +1387,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
while (rpos<maxlen)
|
||||
{
|
||||
char c;
|
||||
if (!ReadFile(h,&c,1,&dw,NULL) || dw != 1) break;
|
||||
if (!ReadFile(h,&c,sizeof(c),&dw,NULL) || dw != sizeof(c)) break;
|
||||
if (parm3)
|
||||
{
|
||||
myitoa(textout,(unsigned int)(unsigned char)c);
|
||||
|
@ -1380,7 +1395,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
}
|
||||
if (lc == '\r' || lc == '\n')
|
||||
{
|
||||
if (lc == c || (c != '\r' && c != '\n')) SetFilePointer(h,-1,NULL,FILE_CURRENT);
|
||||
if (lc == c || (c != '\r' && c != '\n')) SetFilePointer(h,-((int)(sizeof(c))),NULL,FILE_CURRENT);
|
||||
else textout[rpos++]=c;
|
||||
break;
|
||||
}
|
||||
|
@ -1395,7 +1410,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
break;
|
||||
case EW_FSEEK:
|
||||
{
|
||||
char *t=var0;
|
||||
TCHAR *t=var0;
|
||||
if (*t)
|
||||
{
|
||||
DWORD v=SetFilePointer((HANDLE)myatoi(t),GetIntFromParm(2),NULL,parm3);
|
||||
|
@ -1411,14 +1426,14 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
#ifdef NSIS_SUPPORT_FINDFIRST
|
||||
case EW_FINDCLOSE:
|
||||
{
|
||||
char *t=var0;
|
||||
TCHAR *t=var0;
|
||||
if (*t) FindClose((HANDLE)myatoi(t));
|
||||
}
|
||||
break;
|
||||
case EW_FINDNEXT:
|
||||
{
|
||||
char *textout=var0;
|
||||
char *t=var1;
|
||||
TCHAR *textout=var0;
|
||||
TCHAR *t=var1;
|
||||
WIN32_FIND_DATA fd;
|
||||
if (*t && FindNextFile((HANDLE)myatoi(t),&fd))
|
||||
{
|
||||
|
@ -1434,11 +1449,11 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
break;
|
||||
case EW_FINDFIRST:
|
||||
{
|
||||
char *textout=var0;
|
||||
char *handleout=var1;
|
||||
TCHAR *textout=var0;
|
||||
TCHAR *handleout=var1;
|
||||
HANDLE h;
|
||||
WIN32_FIND_DATA fd;
|
||||
char *buf0=GetStringFromParm(0x02);
|
||||
TCHAR *buf0=GetStringFromParm(0x02);
|
||||
h=FindFirstFile(buf0,&fd);
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -1459,7 +1474,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
{
|
||||
int ret=-666;
|
||||
HANDLE hFile;
|
||||
char *buf1=GetStringFromParm(-0x10);
|
||||
TCHAR *buf1=GetStringFromParm(-0x10);
|
||||
|
||||
if (!validpathspec(buf1))
|
||||
GetStringFromParm(-0x13);
|
||||
|
@ -1477,6 +1492,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
SetSelfFilePointer(0);
|
||||
ReadSelfFile((char*)filebuf,filehdrsize);
|
||||
{
|
||||
// parm1 = uninstdata_offset
|
||||
// parm2 = m_unicon_size
|
||||
unsigned char* seeker;
|
||||
unsigned char* unicon_data = seeker = (unsigned char*)GlobalAlloc(GPTR,parm2);
|
||||
if (unicon_data) {
|
||||
|
@ -1499,7 +1516,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
}
|
||||
CloseHandle(hFile);
|
||||
}
|
||||
log_printf3("created uninstaller: %d, \"%s\"",ret,buf1);
|
||||
log_printf3(_T("created uninstaller: %d, \"%s\""),ret,buf1);
|
||||
{
|
||||
int str = LANG_CREATEDUNINST;
|
||||
if (ret < 0)
|
||||
|
@ -1517,9 +1534,9 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
case EW_LOG:
|
||||
if (parm0)
|
||||
{
|
||||
log_printf2("settings logging to %d",parm1);
|
||||
log_printf2(_T("settings logging to %d"),parm1);
|
||||
log_dolog=parm1;
|
||||
log_printf2("logging set to %d",parm1);
|
||||
log_printf2(_T("logging set to %d"),parm1);
|
||||
#if !defined(NSIS_CONFIG_LOG_ODS) && !defined(NSIS_CONFIG_LOG_STDOUT)
|
||||
if (parm1)
|
||||
build_g_logfile();
|
||||
|
@ -1529,8 +1546,8 @@ static int NSISCALL ExecuteEntry(entry *entry_)
|
|||
}
|
||||
else
|
||||
{
|
||||
char *buf0=GetStringFromParm(0x01);
|
||||
log_printf2("%s",buf0);
|
||||
TCHAR *buf0=GetStringFromParm(0x01);
|
||||
log_printf2(_T("%s"),buf0);
|
||||
}
|
||||
break;
|
||||
#endif//NSIS_CONFIG_LOG
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/22/2007
|
||||
*/
|
||||
|
||||
#ifndef _EXEC_H_
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/13/2007
|
||||
*/
|
||||
|
||||
#include "../Platform.h"
|
||||
|
@ -23,6 +25,7 @@
|
|||
#include "ui.h"
|
||||
#include "exec.h"
|
||||
#include "../crc32.h"
|
||||
#include "../tchar.h"
|
||||
|
||||
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
#ifdef NSIS_COMPRESS_USE_ZLIB
|
||||
|
@ -89,12 +92,12 @@ BOOL CALLBACK verProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
if (uMsg == WM_TIMER)
|
||||
{
|
||||
char bt[64];
|
||||
TCHAR bt[64];
|
||||
int percent=calc_percent();
|
||||
#ifdef NSIS_COMPRESS_WHOLE
|
||||
char *msg=g_header?_LANG_UNPACKING:_LANG_VERIFYINGINST;
|
||||
TCHAR *msg=g_header?_LANG_UNPACKING:_LANG_VERIFYINGINST;
|
||||
#else
|
||||
char *msg=_LANG_VERIFYINGINST;
|
||||
TCHAR *msg=_LANG_VERIFYINGINST;
|
||||
#endif
|
||||
|
||||
wsprintf(bt,msg,percent);
|
||||
|
@ -130,8 +133,8 @@ void handle_ver_dlg(BOOL kill)
|
|||
{
|
||||
if (g_exec_flags.status_update & 1)
|
||||
{
|
||||
char bt[64];
|
||||
wsprintf(bt, "... %d%%", calc_percent());
|
||||
TCHAR bt[64];
|
||||
wsprintf(bt, _T("... %d%%"), calc_percent());
|
||||
update_status_text(0, bt);
|
||||
}
|
||||
}
|
||||
|
@ -148,6 +151,7 @@ void handle_ver_dlg(BOOL kill)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif//NSIS_CONFIG_CRC_SUPPORT || NSIS_COMPRESS_WHOLE
|
||||
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
|
||||
|
@ -155,7 +159,7 @@ void handle_ver_dlg(BOOL kill)
|
|||
static z_stream g_inflate_stream;
|
||||
#endif
|
||||
|
||||
const char * NSISCALL loadHeaders(int cl_flags)
|
||||
const TCHAR * NSISCALL loadHeaders(int cl_flags)
|
||||
{
|
||||
int left;
|
||||
#ifdef NSIS_CONFIG_CRC_SUPPORT
|
||||
|
@ -234,7 +238,7 @@ const char * NSISCALL loadHeaders(int cl_flags)
|
|||
|
||||
#ifndef NSIS_CONFIG_CRC_ANAL
|
||||
left = h.length_of_all_following_data - 4;
|
||||
// end crc checking at crc :) this means you can tack shit on the end and it'll still work.
|
||||
// end crc checking at crc :) this means you can tack stuff on the end and it'll still work.
|
||||
#else //!NSIS_CONFIG_CRC_ANAL
|
||||
left -= 4;
|
||||
#endif//NSIS_CONFIG_CRC_ANAL
|
||||
|
@ -292,7 +296,7 @@ const char * NSISCALL loadHeaders(int cl_flags)
|
|||
inflateReset(&g_inflate_stream);
|
||||
|
||||
{
|
||||
char fno[MAX_PATH];
|
||||
TCHAR fno[MAX_PATH];
|
||||
my_GetTempFileName(fno, state_temp_dir);
|
||||
dbd_hFile=CreateFile(fno,GENERIC_WRITE|GENERIC_READ,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE,NULL);
|
||||
if (dbd_hFile == INVALID_HANDLE_VALUE)
|
||||
|
@ -345,6 +349,7 @@ const char * NSISCALL loadHeaders(int cl_flags)
|
|||
|
||||
#if !defined(NSIS_COMPRESS_WHOLE) || !defined(NSIS_CONFIG_COMPRESSION_SUPPORT)
|
||||
|
||||
// Decompress data.
|
||||
int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen)
|
||||
{
|
||||
static char inbuffer[IBUFSIZE+OBUFSIZE];
|
||||
|
@ -365,7 +370,7 @@ int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen)
|
|||
#ifdef NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
if (input_len & 0x80000000) // compressed
|
||||
{
|
||||
char progress[64];
|
||||
TCHAR progress[64];
|
||||
int input_len_total;
|
||||
DWORD ltc = GetTickCount(), tc;
|
||||
|
||||
|
@ -400,7 +405,7 @@ int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen)
|
|||
tc = GetTickCount();
|
||||
if (g_exec_flags.status_update & 1 && (tc - ltc > 200 || !input_len))
|
||||
{
|
||||
wsprintf(progress, "... %d%%", MulDiv(input_len_total - input_len, 100, input_len_total));
|
||||
wsprintf(progress, _T("... %d%%"), MulDiv(input_len_total - input_len, 100, input_len_total));
|
||||
update_status_text(0, progress);
|
||||
ltc = tc;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/13/2007
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -271,7 +273,7 @@ enum {
|
|||
|
||||
// nsis strings
|
||||
|
||||
typedef char NSIS_STRING[NSIS_MAX_STRLEN];
|
||||
typedef TCHAR NSIS_STRING[NSIS_MAX_STRLEN];
|
||||
|
||||
// Settings common to both installers and uninstallers
|
||||
typedef struct
|
||||
|
@ -333,7 +335,7 @@ typedef struct
|
|||
int str_uninstcmd;
|
||||
#endif//NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
#ifdef NSIS_SUPPORT_MOVEONREBOOT
|
||||
int str_wininit;
|
||||
int str_wininit; // Points to the path of wininit.ini
|
||||
#endif//NSIS_SUPPORT_MOVEONREBOOT
|
||||
} header;
|
||||
|
||||
|
@ -376,18 +378,22 @@ typedef struct
|
|||
int name_ptr; // initial name pointer
|
||||
int install_types; // bits set for each of the different install_types, if any.
|
||||
int flags; // SF_* - defined above
|
||||
int code;
|
||||
int code_size;
|
||||
// for labels, it looks like it's only used to track how often it is used.
|
||||
int code; // The "address" of the start of the code in count of struct entries.
|
||||
int code_size; // The size of the code in num of entries?
|
||||
int size_kb;
|
||||
char name[NSIS_MAX_STRLEN]; // '' for invisible sections
|
||||
TCHAR name[NSIS_MAX_STRLEN]; // '' for invisible sections
|
||||
} section;
|
||||
|
||||
#define SECTION_OFFSET(field) (FIELD_OFFSET(section, field)/sizeof(int))
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int which;
|
||||
int which; // EW_* enum. Look at the enum values to see what offsets mean.
|
||||
int offsets[MAX_ENTRY_OFFSETS]; // count and meaning of offsets depend on 'which'
|
||||
// sometimes they are just straight int values or bool
|
||||
// values and sometimes they are indices into string
|
||||
// tables.
|
||||
} entry;
|
||||
|
||||
// page window proc
|
||||
|
@ -478,8 +484,10 @@ typedef struct {
|
|||
#define NS_LANG_CODE 255
|
||||
#define NS_CODES_START NS_SKIP_CODE
|
||||
|
||||
// We are doing this to store an integer value into a char string and we
|
||||
// don't want false end of string values so we shift then OR with 0x8080
|
||||
#define CODE_SHORT(x) (WORD)((((WORD)(x) & 0x7F) | (((WORD)(x) & 0x3F80) << 1) | 0x8080))
|
||||
#define MAX_CODED 16383
|
||||
#define MAX_CODED 16383 // 0x3FFF
|
||||
|
||||
#define NSIS_INSTDIR_INVALID 1
|
||||
#define NSIS_INSTDIR_NOT_ENOUGH_SPACE 2
|
||||
|
@ -496,7 +504,7 @@ int NSISCALL isheader(firstheader *h); // returns 0 on not header, length_of_dat
|
|||
// returns 0 on success
|
||||
// on success, m_header will be set to a pointer that should eventually be GlobalFree()'d.
|
||||
// (or m_uninstheader)
|
||||
const char * NSISCALL loadHeaders(int cl_flags);
|
||||
const TCHAR * NSISCALL loadHeaders(int cl_flags);
|
||||
|
||||
int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen);
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/13/2007
|
||||
*/
|
||||
|
||||
#ifndef _NSIS_LANG_H_
|
||||
|
@ -19,24 +21,27 @@
|
|||
|
||||
|
||||
// generic startup strings (these will never be overridable)
|
||||
#define _LANG_INVALIDCRC "Installer integrity check has failed. Common causes include\n" \
|
||||
"incomplete download and damaged media. Contact the\n" \
|
||||
"installer's author to obtain a new copy.\n\n" \
|
||||
"More information at:\n" \
|
||||
"http://nsis.sf.net/NSIS_Error"
|
||||
#define _LANG_INVALIDCRC _T("Installer integrity check has failed. Common causes include\n") \
|
||||
_T("incomplete download and damaged media. Contact the\n") \
|
||||
_T("installer's author to obtain a new copy.\n\n") \
|
||||
_T("More information at:\n") \
|
||||
_T("http://nsis.sf.net/NSIS_Error")
|
||||
|
||||
#define _LANG_ERRORWRITINGTEMP "Error writing temporary file. Make sure your temp folder is valid."
|
||||
#define _LANG_ERRORWRITINGTEMP _T("Error writing temporary file. Make sure your temp folder is valid.")
|
||||
|
||||
#define _LANG_UNINSTINITERROR "Error launching installer"
|
||||
#define _LANG_UNINSTINITERROR _T("Error launching installer")
|
||||
|
||||
#define _LANG_VERIFYINGINST "verifying installer: %d%%"
|
||||
#define _LANG_VERIFYINGINST _T("verifying installer: %d%%")
|
||||
|
||||
#define _LANG_UNPACKING "unpacking data: %d%%"
|
||||
#define _LANG_UNPACKING _T("unpacking data: %d%%")
|
||||
|
||||
#define _LANG_CANTOPENSELF "Error launching installer" // same as uninstiniterror for size
|
||||
#define _LANG_CANTOPENSELF _T("Error launching installer") // same as uninstiniterror for size
|
||||
|
||||
#define _LANG_GENERIC_ERROR "NSIS Error"
|
||||
#define _LANG_GENERIC_ERROR _T("NSIS Error")
|
||||
|
||||
// We store index to the current language table as a negative
|
||||
// index value - 1. So this macro, undoes that into a valid
|
||||
// index.
|
||||
#define LANG_STR_TAB(x) cur_langtable[-((int)x+1)]
|
||||
|
||||
#define LANG_BRANDING -1
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/22/2007
|
||||
*/
|
||||
|
||||
#include "fileform.h"
|
||||
|
@ -31,7 +33,7 @@ extern NSIS_STRING g_usrvars[1];
|
|||
#define state_exe_file g_usrvars[28]
|
||||
#define state_click_next g_usrvars[30]
|
||||
|
||||
extern char g_caption[NSIS_MAX_STRLEN*2];
|
||||
extern TCHAR g_caption[NSIS_MAX_STRLEN*2];
|
||||
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
extern HWND g_hwnd;
|
||||
extern HANDLE g_hInstance;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/13/2007
|
||||
*/
|
||||
|
||||
|
||||
|
@ -21,7 +23,7 @@
|
|||
extern int *cur_langtable;
|
||||
|
||||
extern int NSISCALL ui_doinstall(void);
|
||||
void NSISCALL update_status_text(int strtab, const char *text2);
|
||||
void NSISCALL update_status_text(int strtab, const TCHAR *text2);
|
||||
|
||||
extern int ui_dlg_visible;
|
||||
extern HWND m_curwnd;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/11/2007
|
||||
*/
|
||||
|
||||
#include "../Platform.h"
|
||||
|
@ -24,10 +26,11 @@
|
|||
#include "exec.h"
|
||||
#include "ui.h"
|
||||
#include "resource.h"
|
||||
#include "../tchar.h"
|
||||
|
||||
#ifdef NSIS_CONFIG_LOG
|
||||
#if !defined(NSIS_CONFIG_LOG_ODS) && !defined(NSIS_CONFIG_LOG_STDOUT)
|
||||
char g_log_file[1024];
|
||||
TCHAR g_log_file[1024];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -50,7 +53,7 @@ NSIS_STRING g_usrvars[1] __attribute__((section (NSIS_VARS_SECTION)));
|
|||
# endif
|
||||
#endif
|
||||
|
||||
HANDLE NSISCALL myCreateProcess(char *cmd)
|
||||
HANDLE NSISCALL myCreateProcess(TCHAR *cmd)
|
||||
{
|
||||
PROCESS_INFORMATION ProcInfo;
|
||||
static STARTUPINFO StartUp;
|
||||
|
@ -61,25 +64,25 @@ HANDLE NSISCALL myCreateProcess(char *cmd)
|
|||
return ProcInfo.hProcess;
|
||||
}
|
||||
|
||||
/*BOOL NSISCALL my_SetWindowText(HWND hWnd, const char *val)
|
||||
/*BOOL NSISCALL my_SetWindowText(HWND hWnd, const TCHAR *val)
|
||||
{
|
||||
return SendMessage(hWnd,WM_SETTEXT,0,(LPARAM)val);
|
||||
}*/
|
||||
|
||||
BOOL NSISCALL my_SetDialogItemText(HWND dlg, UINT idx, const char *val)
|
||||
BOOL NSISCALL my_SetDialogItemText(HWND dlg, UINT idx, const TCHAR *val)
|
||||
{
|
||||
return SetDlgItemText(dlg,idx,val);
|
||||
// return my_SetWindowText(GetDlgItem(dlg, idx), val);
|
||||
}
|
||||
|
||||
int NSISCALL my_GetDialogItemText(UINT idx, char *val)
|
||||
int NSISCALL my_GetDialogItemText(UINT idx, TCHAR *val)
|
||||
{
|
||||
extern HWND m_curwnd;
|
||||
return GetDlgItemText(m_curwnd, idx, val, NSIS_MAX_STRLEN);
|
||||
// return my_GetWindowText(GetDlgItem(m_curwnd, idx), val, NSIS_MAX_STRLEN);
|
||||
}
|
||||
|
||||
int NSISCALL my_MessageBox(const char *text, UINT type) {
|
||||
int NSISCALL my_MessageBox(const TCHAR *text, UINT type) {
|
||||
int _type = type & 0x001FFFFF;
|
||||
static MSGBOXPARAMS mbp = {
|
||||
sizeof(MSGBOXPARAMS),
|
||||
|
@ -112,13 +115,13 @@ int NSISCALL my_MessageBox(const char *text, UINT type) {
|
|||
return MessageBoxIndirect(&mbp);
|
||||
}
|
||||
|
||||
void NSISCALL myDelete(char *buf, int flags)
|
||||
void NSISCALL myDelete(TCHAR *buf, int flags)
|
||||
{
|
||||
static char lbuf[NSIS_MAX_STRLEN];
|
||||
static TCHAR lbuf[NSIS_MAX_STRLEN];
|
||||
|
||||
HANDLE h;
|
||||
WIN32_FIND_DATA fd;
|
||||
char *fn;
|
||||
TCHAR *fn;
|
||||
int valid_dir=is_valid_instpath(buf);
|
||||
|
||||
if ((flags & DEL_SIMPLE))
|
||||
|
@ -134,14 +137,14 @@ void NSISCALL myDelete(char *buf, int flags)
|
|||
mystrcpy(lbuf,buf);
|
||||
#ifdef NSIS_SUPPORT_RMDIR
|
||||
if (flags & DEL_DIR)
|
||||
mystrcat(lbuf,"\\*.*");
|
||||
mystrcat(lbuf,_T("\\*.*"));
|
||||
else
|
||||
#endif//NSIS_SUPPORT_RMDIR
|
||||
trimslashtoend(buf);
|
||||
|
||||
// only append backslash if the path isn't relative to the working directory [bug #1851273]
|
||||
if (*buf || *lbuf == '\\')
|
||||
mystrcat(buf,"\\");
|
||||
if (*buf || *lbuf == _T('\\'))
|
||||
mystrcat(buf,_T("\\"));
|
||||
|
||||
fn=buf+mystrlen(buf);
|
||||
|
||||
|
@ -150,14 +153,14 @@ void NSISCALL myDelete(char *buf, int flags)
|
|||
{
|
||||
do
|
||||
{
|
||||
char *fdfn = fd.cFileName;
|
||||
if (*findchar(fdfn, '?') && *fd.cAlternateFileName)
|
||||
TCHAR *fdfn = fd.cFileName;
|
||||
if (*findchar(fdfn, _T('?')) && *fd.cAlternateFileName)
|
||||
// name contains unicode, use short name
|
||||
fdfn = fd.cAlternateFileName;
|
||||
|
||||
#ifdef NSIS_SUPPORT_RMDIR
|
||||
if (fdfn[0] == '.' && !fdfn[1]) continue;
|
||||
if (fdfn[0] == '.' && fdfn[1] == '.' && !fdfn[2]) continue;
|
||||
if (fdfn[0] == _T('.') && !fdfn[1]) continue;
|
||||
if (fdfn[0] == _T('.') && fdfn[1] == _T('.') && !fdfn[2]) continue;
|
||||
#endif//NSIS_SUPPORT_RMDIR
|
||||
{
|
||||
mystrcpy(fn,fdfn);
|
||||
|
@ -172,21 +175,21 @@ void NSISCALL myDelete(char *buf, int flags)
|
|||
}
|
||||
else
|
||||
{
|
||||
log_printf2("Delete: DeleteFile(\"%s\")",buf);
|
||||
log_printf2(_T("Delete: DeleteFile(\"%s\")"),buf);
|
||||
remove_ro_attr(buf);
|
||||
if (!DeleteFile(buf))
|
||||
{
|
||||
#ifdef NSIS_SUPPORT_MOVEONREBOOT
|
||||
if (flags & DEL_REBOOT)
|
||||
{
|
||||
log_printf2("Delete: DeleteFile on Reboot(\"%s\")",buf);
|
||||
log_printf2(_T("Delete: DeleteFile on Reboot(\"%s\")"),buf);
|
||||
update_status_text(LANG_DELETEONREBOOT,buf);
|
||||
MoveFileOnReboot(buf,NULL);
|
||||
}
|
||||
else
|
||||
#endif//NSIS_SUPPORT_MOVEONREBOOT
|
||||
{
|
||||
log_printf2("Delete: DeleteFile failed(\"%s\")",buf);
|
||||
log_printf2(_T("Delete: DeleteFile failed(\"%s\")"),buf);
|
||||
g_exec_flags.exec_error++;
|
||||
}
|
||||
}
|
||||
|
@ -209,27 +212,27 @@ void NSISCALL myDelete(char *buf, int flags)
|
|||
{
|
||||
if (!valid_dir)
|
||||
{
|
||||
log_printf2("RMDir: RemoveDirectory invalid input(\"%s\")",buf);
|
||||
log_printf2(_T("RMDir: RemoveDirectory invalid input(\"%s\")"),buf);
|
||||
g_exec_flags.exec_error++;
|
||||
}
|
||||
else if (file_exists(buf))
|
||||
{
|
||||
addtrailingslash(buf);
|
||||
log_printf2("RMDir: RemoveDirectory(\"%s\")",buf);
|
||||
log_printf2(_T("RMDir: RemoveDirectory(\"%s\")"),buf);
|
||||
remove_ro_attr(buf);
|
||||
if (!RemoveDirectory(buf))
|
||||
{
|
||||
#ifdef NSIS_SUPPORT_MOVEONREBOOT
|
||||
if (flags & DEL_REBOOT)
|
||||
{
|
||||
log_printf2("RMDir: RemoveDirectory on Reboot(\"%s\")",buf);
|
||||
log_printf2(_T("RMDir: RemoveDirectory on Reboot(\"%s\")"),buf);
|
||||
update_status_text(LANG_DELETEONREBOOT,buf);
|
||||
MoveFileOnReboot(buf,NULL);
|
||||
}
|
||||
else
|
||||
#endif//NSIS_SUPPORT_MOVEONREBOOT
|
||||
{
|
||||
log_printf2("RMDir: RemoveDirectory failed(\"%s\")",buf);
|
||||
log_printf2(_T("RMDir: RemoveDirectory failed(\"%s\")"),buf);
|
||||
g_exec_flags.exec_error++;
|
||||
}
|
||||
}
|
||||
|
@ -242,9 +245,9 @@ void NSISCALL myDelete(char *buf, int flags)
|
|||
#endif//NSIS_SUPPORT_RMDIR
|
||||
}
|
||||
|
||||
char *NSISCALL addtrailingslash(char *str)
|
||||
TCHAR *NSISCALL addtrailingslash(TCHAR *str)
|
||||
{
|
||||
if (lastchar(str)!='\\') mystrcat(str,"\\");
|
||||
if (lastchar(str)!=_T('\\')) mystrcat(str,_T("\\"));
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -253,7 +256,7 @@ char *NSISCALL addtrailingslash(char *str)
|
|||
return *CharPrev(str,str+mystrlen(str));
|
||||
}*/
|
||||
|
||||
char * NSISCALL findchar(char *str, char c)
|
||||
TCHAR * NSISCALL findchar(TCHAR *str, TCHAR c)
|
||||
{
|
||||
while (*str && *str != c)
|
||||
{
|
||||
|
@ -262,12 +265,14 @@ char * NSISCALL findchar(char *str, char c)
|
|||
return str;
|
||||
}
|
||||
|
||||
char * NSISCALL trimslashtoend(char *buf)
|
||||
// Separates a full path to the directory portion and file name portion
|
||||
// and returns the pointer to the filename portion.
|
||||
TCHAR * NSISCALL trimslashtoend(TCHAR *buf)
|
||||
{
|
||||
char *p = buf + mystrlen(buf);
|
||||
TCHAR *p = buf + mystrlen(buf);
|
||||
do
|
||||
{
|
||||
if (*p == '\\')
|
||||
if (*p == _T('\\'))
|
||||
break;
|
||||
p = CharPrev(buf, p);
|
||||
} while (p > buf);
|
||||
|
@ -277,28 +282,28 @@ char * NSISCALL trimslashtoend(char *buf)
|
|||
return p + 1;
|
||||
}
|
||||
|
||||
int NSISCALL validpathspec(char *ubuf)
|
||||
int NSISCALL validpathspec(TCHAR *ubuf)
|
||||
{
|
||||
char dl = ubuf[0] | 0x20; // convert alleged drive letter to lower case
|
||||
return ((*(WORD*)ubuf==CHAR2_TO_WORD('\\','\\')) || (dl >= 'a' && dl <= 'z' && ubuf[1]==':'));
|
||||
TCHAR dl = ubuf[0] | 0x20; // convert alleged drive letter to lower case
|
||||
return ((*(WORD*)ubuf==CHAR2_TO_WORD(_T('\\'),_T('\\'))) || (dl >= _T('a') && dl <= _T('z') && ubuf[1]==_T(':')));
|
||||
}
|
||||
|
||||
char * NSISCALL skip_root(char *path)
|
||||
TCHAR * NSISCALL skip_root(TCHAR *path)
|
||||
{
|
||||
char *p = CharNext(path);
|
||||
char *p2 = CharNext(p);
|
||||
TCHAR *p = CharNext(path);
|
||||
TCHAR *p2 = CharNext(p);
|
||||
|
||||
if (*path && *(WORD*)p == CHAR2_TO_WORD(':', '\\'))
|
||||
if (*path && *(WORD*)p == CHAR2_TO_WORD(_T(':'), _T('\\')))
|
||||
{
|
||||
return CharNext(p2);
|
||||
}
|
||||
else if (*(WORD*)path == CHAR2_TO_WORD('\\','\\'))
|
||||
else if (*(WORD*)path == CHAR2_TO_WORD(_T('\\'),_T('\\')))
|
||||
{
|
||||
// skip host and share name
|
||||
int x = 2;
|
||||
while (x--)
|
||||
{
|
||||
p2 = findchar(p2, '\\');
|
||||
p2 = findchar(p2, _T('\\'));
|
||||
if (!*p2)
|
||||
return NULL;
|
||||
p2++; // skip backslash
|
||||
|
@ -310,10 +315,10 @@ char * NSISCALL skip_root(char *path)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int NSISCALL is_valid_instpath(char *s)
|
||||
int NSISCALL is_valid_instpath(TCHAR *s)
|
||||
{
|
||||
static char tmp[NSIS_MAX_STRLEN];
|
||||
char *root;
|
||||
static TCHAR tmp[NSIS_MAX_STRLEN];
|
||||
TCHAR *root;
|
||||
|
||||
mystrcpy(tmp, s);
|
||||
|
||||
|
@ -330,7 +335,7 @@ int NSISCALL is_valid_instpath(char *s)
|
|||
// not pass as a valid non-root directory.
|
||||
validate_filename(root);
|
||||
|
||||
if ((g_flags & CH_FLAGS_NO_ROOT_DIR) && (!*root || *root == '\\'))
|
||||
if ((g_flags & CH_FLAGS_NO_ROOT_DIR) && (!*root || *root == _T('\\')))
|
||||
return 0;
|
||||
|
||||
while (mystrlen(tmp) > root - tmp)
|
||||
|
@ -352,12 +357,12 @@ int NSISCALL is_valid_instpath(char *s)
|
|||
return 1;
|
||||
}
|
||||
|
||||
char * NSISCALL mystrstri(char *a, const char *b)
|
||||
TCHAR * NSISCALL mystrstri(TCHAR *a, const TCHAR *b)
|
||||
{
|
||||
int l = mystrlen(b);
|
||||
while (mystrlen(a) >= l)
|
||||
{
|
||||
char c = a[l];
|
||||
TCHAR c = a[l];
|
||||
a[l] = 0;
|
||||
if (!lstrcmpi(a, b))
|
||||
{
|
||||
|
@ -370,6 +375,8 @@ char * NSISCALL mystrstri(char *a, const char *b)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// mini_memcpy takes the number of bytes to copy.
|
||||
void NSISCALL mini_memcpy(void *out, const void *in, int len)
|
||||
{
|
||||
char *c_out=(char*)out;
|
||||
|
@ -380,14 +387,14 @@ void NSISCALL mini_memcpy(void *out, const void *in, int len)
|
|||
}
|
||||
}
|
||||
|
||||
void NSISCALL remove_ro_attr(char *file)
|
||||
void NSISCALL remove_ro_attr(TCHAR *file)
|
||||
{
|
||||
int attr = GetFileAttributes(file);
|
||||
if (attr != INVALID_FILE_ATTRIBUTES)
|
||||
SetFileAttributes(file,attr&(~FILE_ATTRIBUTE_READONLY));
|
||||
}
|
||||
|
||||
HANDLE NSISCALL myOpenFile(const char *fn, DWORD da, DWORD cd)
|
||||
HANDLE NSISCALL myOpenFile(const TCHAR *fn, DWORD da, DWORD cd)
|
||||
{
|
||||
int attr = GetFileAttributes(fn);
|
||||
return CreateFile(
|
||||
|
@ -401,14 +408,14 @@ HANDLE NSISCALL myOpenFile(const char *fn, DWORD da, DWORD cd)
|
|||
);
|
||||
}
|
||||
|
||||
char * NSISCALL my_GetTempFileName(char *buf, const char *dir)
|
||||
TCHAR * NSISCALL my_GetTempFileName(TCHAR *buf, const TCHAR *dir)
|
||||
{
|
||||
int n = 100;
|
||||
while (n--)
|
||||
{
|
||||
char prefix[4];
|
||||
*(LPDWORD)prefix = CHAR4_TO_DWORD('n', 's', 'a', 0);
|
||||
prefix[2] += (char)(GetTickCount() % 26);
|
||||
TCHAR prefix[4];
|
||||
*(LPDWORD)prefix = CHAR4_TO_DWORD(_T('n'), _T('s'), _T('a'), 0);
|
||||
prefix[2] += (TCHAR)(GetTickCount() % 26);
|
||||
if (GetTempFileName(dir, prefix, 0, buf))
|
||||
return buf;
|
||||
}
|
||||
|
@ -420,9 +427,9 @@ char * NSISCALL my_GetTempFileName(char *buf, const char *dir)
|
|||
void NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
|
||||
{
|
||||
BOOL fOk = 0;
|
||||
typedef BOOL (WINAPI *mfea_t)(LPCSTR lpExistingFileName,LPCSTR lpNewFileName,DWORD dwFlags);
|
||||
typedef BOOL (WINAPI *mfea_t)(LPCTSTR lpExistingFileName,LPCTSTR lpNewFileName,DWORD dwFlags);
|
||||
mfea_t mfea;
|
||||
mfea=(mfea_t) myGetProcAddress(MGA_MoveFileExA);
|
||||
mfea=(mfea_t) myGetProcAddress(MGA_MoveFileEx);
|
||||
if (mfea)
|
||||
{
|
||||
fOk=mfea(pszExisting, pszNew, MOVEFILE_DELAY_UNTIL_REBOOT|MOVEFILE_REPLACE_EXISTING);
|
||||
|
@ -430,20 +437,20 @@ void NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
|
|||
|
||||
if (!fOk)
|
||||
{
|
||||
static char szRenameLine[1024];
|
||||
static char wininit[1024];
|
||||
static char tmpbuf[1024];
|
||||
static TCHAR szRenameLine[1024];
|
||||
static TCHAR wininit[1024];
|
||||
static TCHAR tmpbuf[1024];
|
||||
int cchRenameLine;
|
||||
static const char szRenameSec[] = "[Rename]\r\n";
|
||||
static const TCHAR szRenameSec[] = _T("[Rename]\r\n");
|
||||
HANDLE hfile;
|
||||
DWORD dwFileSize;
|
||||
DWORD dwBytes;
|
||||
DWORD dwRenameLinePos;
|
||||
char *pszWinInit;
|
||||
TCHAR *pszWinInit;
|
||||
|
||||
int spn;
|
||||
|
||||
*(DWORD*)tmpbuf = CHAR4_TO_DWORD('N', 'U', 'L', 0);
|
||||
*(DWORD*)tmpbuf = CHAR4_TO_DWORD(_T('N'), _T('U'), _T('L'), 0);
|
||||
|
||||
if (pszNew) {
|
||||
// create the file if it's not already there to prevent GetShortPathName from failing
|
||||
|
@ -456,7 +463,7 @@ void NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
|
|||
spn = GetShortPathName(pszExisting,wininit,1024);
|
||||
if (!spn || spn > 1024)
|
||||
return;
|
||||
cchRenameLine = wsprintf(szRenameLine,"%s=%s\r\n",tmpbuf,wininit);
|
||||
cchRenameLine = wsprintf(szRenameLine,_T("%s=%s\r\n"),tmpbuf,wininit);
|
||||
|
||||
GetNSISString(wininit, g_header->str_wininit);
|
||||
hfile = myOpenFile(wininit, GENERIC_READ | GENERIC_WRITE, OPEN_ALWAYS);
|
||||
|
@ -470,7 +477,7 @@ void NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
|
|||
{
|
||||
if (ReadFile(hfile, pszWinInit, dwFileSize, &dwBytes, NULL) && dwFileSize == dwBytes)
|
||||
{
|
||||
LPSTR pszRenameSecInFile = mystrstri(pszWinInit, szRenameSec);
|
||||
LPTSTR pszRenameSecInFile = mystrstri(pszWinInit, szRenameSec);
|
||||
if (pszRenameSecInFile == NULL)
|
||||
{
|
||||
mystrcpy(pszWinInit+dwFileSize, szRenameSec);
|
||||
|
@ -479,11 +486,11 @@ void NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
|
|||
}
|
||||
else
|
||||
{
|
||||
char *pszFirstRenameLine = pszRenameSecInFile+10;
|
||||
char *pszNextSec = mystrstri(pszFirstRenameLine,"\n[");
|
||||
TCHAR *pszFirstRenameLine = pszRenameSecInFile+10;
|
||||
TCHAR *pszNextSec = mystrstri(pszFirstRenameLine,_T("\n["));
|
||||
if (pszNextSec)
|
||||
{
|
||||
char *p = ++pszNextSec;
|
||||
TCHAR *p = ++pszNextSec;
|
||||
while (p < pszWinInit + dwFileSize) {
|
||||
p[cchRenameLine] = *p;
|
||||
p++;
|
||||
|
@ -515,48 +522,52 @@ void NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew)
|
|||
}
|
||||
#endif
|
||||
|
||||
void NSISCALL myRegGetStr(HKEY root, const char *sub, const char *name, char *out, int x64)
|
||||
// The value of registry->sub->name is stored in out. If failure, then out becomes
|
||||
// an empty string "".
|
||||
void NSISCALL myRegGetStr(HKEY root, const TCHAR *sub, const TCHAR *name, TCHAR *out, int x64)
|
||||
{
|
||||
HKEY hKey;
|
||||
*out=0;
|
||||
if (RegOpenKeyEx(root,sub,0,KEY_READ|(x64?KEY_WOW64_64KEY:0),&hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD l = NSIS_MAX_STRLEN;
|
||||
DWORD l = NSIS_MAX_STRLEN*sizeof(TCHAR);
|
||||
DWORD t;
|
||||
if (RegQueryValueEx(hKey,name,NULL,&t,out,&l ) != ERROR_SUCCESS || (t != REG_SZ && t != REG_EXPAND_SZ)) *out=0;
|
||||
// Note that RegQueryValueEx returns Unicode strings if _UNICODE is defined for the
|
||||
// REG_SZ type.
|
||||
if (RegQueryValueEx(hKey,name,NULL,&t,(LPBYTE)out,&l ) != ERROR_SUCCESS || (t != REG_SZ && t != REG_EXPAND_SZ)) *out=0;
|
||||
out[NSIS_MAX_STRLEN-1]=0;
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
}
|
||||
|
||||
void NSISCALL myitoa(char *s, int d)
|
||||
void NSISCALL myitoa(TCHAR *s, int d)
|
||||
{
|
||||
static const char c[] = "%d";
|
||||
static const TCHAR c[] = _T("%d");
|
||||
wsprintf(s,c,d);
|
||||
}
|
||||
|
||||
int NSISCALL myatoi(char *s)
|
||||
int NSISCALL myatoi(TCHAR *s)
|
||||
{
|
||||
unsigned int v=0;
|
||||
int sign=1; // sign of positive
|
||||
char m=10; // base of 10
|
||||
char t='9'; // cap top of numbers at 9
|
||||
TCHAR m=10; // base of 10
|
||||
TCHAR t=_T('9'); // cap top of numbers at 9
|
||||
|
||||
if (*s == '-')
|
||||
if (*s == _T('-'))
|
||||
{
|
||||
s++; //skip over -
|
||||
sign=-1; // sign flip
|
||||
}
|
||||
|
||||
if (*s == '0')
|
||||
if (*s == _T('0'))
|
||||
{
|
||||
s++; // skip over 0
|
||||
if (s[0] >= '0' && s[0] <= '7')
|
||||
if (s[0] >= _T('0') && s[0] <= _T('7'))
|
||||
{
|
||||
m=8; // base of 8
|
||||
t='7'; // cap top at 7
|
||||
t=_T('7'); // cap top at 7
|
||||
}
|
||||
if ((s[0] & ~0x20) == 'X')
|
||||
if ((s[0] & ~0x20) == _T('X'))
|
||||
{
|
||||
m=16; // base of 16
|
||||
s++; // advance over 'x'
|
||||
|
@ -566,8 +577,9 @@ int NSISCALL myatoi(char *s)
|
|||
for (;;)
|
||||
{
|
||||
int c=*s++;
|
||||
if (c >= '0' && c <= t) c-='0';
|
||||
else if (m==16 && (c & ~0x20) >= 'A' && (c & ~0x20) <= 'F') c = (c & 7) + 9;
|
||||
if (c >= _T('0') && c <= t) c-=_T('0');
|
||||
// clever little trick to do both upper and lowercase A-F.
|
||||
else if (m==16 && (c & ~0x20) >= _T('A') && (c & ~0x20) <= _T('F')) c = (c & 7) + 9;
|
||||
else break;
|
||||
v*=m;
|
||||
v+=c;
|
||||
|
@ -578,34 +590,38 @@ int NSISCALL myatoi(char *s)
|
|||
// Straight copies of selected shell functions. Calling local functions
|
||||
// requires less code than DLL functions. For the savings to outweigh the cost
|
||||
// of a new function there should be about a couple of dozen or so calls.
|
||||
char * NSISCALL mystrcpy(char *out, const char *in)
|
||||
TCHAR * NSISCALL mystrcpy(TCHAR *out, const TCHAR *in)
|
||||
{
|
||||
return lstrcpyn(out, in, NSIS_MAX_STRLEN);
|
||||
}
|
||||
|
||||
int NSISCALL mystrlen(const char *in)
|
||||
int NSISCALL mystrlen(const TCHAR *in)
|
||||
{
|
||||
return lstrlen(in);
|
||||
}
|
||||
|
||||
char * NSISCALL mystrcat(char *out, const char *concat)
|
||||
TCHAR * NSISCALL mystrcat(TCHAR *out, const TCHAR *concat)
|
||||
{
|
||||
return lstrcat(out, concat);
|
||||
}
|
||||
|
||||
char ps_tmpbuf[NSIS_MAX_STRLEN*2];
|
||||
TCHAR ps_tmpbuf[NSIS_MAX_STRLEN*2];
|
||||
|
||||
const char SYSREGKEY[] = "Software\\Microsoft\\Windows\\CurrentVersion";
|
||||
const char QUICKLAUNCH[] = "\\Microsoft\\Internet Explorer\\Quick Launch";
|
||||
const TCHAR SYSREGKEY[] = _T("Software\\Microsoft\\Windows\\CurrentVersion");
|
||||
const TCHAR QUICKLAUNCH[] = _T("\\Microsoft\\Internet Explorer\\Quick Launch");
|
||||
|
||||
typedef HRESULT (__stdcall * PFNSHGETFOLDERPATHA)(HWND, int, HANDLE, DWORD, LPSTR);
|
||||
typedef HRESULT (__stdcall * PFNSHGETFOLDERPATH)(HWND, int, HANDLE, DWORD, LPTSTR);
|
||||
extern void *g_SHGetFolderPath;
|
||||
|
||||
// Based on Dave Laundon's simplified process_string
|
||||
char * NSISCALL GetNSISString(char *outbuf, int strtab)
|
||||
// The string actually has a lot of different data encoded into it. This
|
||||
// function extracts the special data out and puts it into outbuf.
|
||||
TCHAR * NSISCALL GetNSISString(TCHAR *outbuf, int strtab)
|
||||
{
|
||||
char *in = (char*)GetNSISStringNP(GetNSISTab(strtab));
|
||||
char *out = ps_tmpbuf;
|
||||
// This looks at the g_block (copied from header->blocks) and
|
||||
// indexes into the language
|
||||
TCHAR *in = (TCHAR*)GetNSISStringNP(GetNSISTab(strtab));
|
||||
TCHAR *out = ps_tmpbuf;
|
||||
if ((unsigned int) (outbuf - ps_tmpbuf) < sizeof(ps_tmpbuf))
|
||||
{
|
||||
out = outbuf;
|
||||
|
@ -613,7 +629,7 @@ char * NSISCALL GetNSISString(char *outbuf, int strtab)
|
|||
}
|
||||
while (*in && out - ps_tmpbuf < NSIS_MAX_STRLEN)
|
||||
{
|
||||
unsigned char nVarIdx = (unsigned char)*in++;
|
||||
_TUCHAR nVarIdx = (_TUCHAR)*in++;
|
||||
int nData;
|
||||
int fldrs[4];
|
||||
if (nVarIdx > NS_CODES_START)
|
||||
|
@ -623,7 +639,7 @@ char * NSISCALL GetNSISString(char *outbuf, int strtab)
|
|||
fldrs[1] = in[0];
|
||||
fldrs[2] = in[1] | CSIDL_FLAG_CREATE; // all users
|
||||
fldrs[3] = in[1];
|
||||
in += 2;
|
||||
in += sizeof(SHORT)/sizeof(TCHAR);
|
||||
|
||||
if (nVarIdx == NS_SHELL_CODE)
|
||||
{
|
||||
|
@ -689,7 +705,7 @@ char * NSISCALL GetNSISString(char *outbuf, int strtab)
|
|||
{
|
||||
if (g_SHGetFolderPath && use_shfolder)
|
||||
{
|
||||
PFNSHGETFOLDERPATHA SHGetFolderPathFunc = (PFNSHGETFOLDERPATHA) g_SHGetFolderPath;
|
||||
PFNSHGETFOLDERPATH SHGetFolderPathFunc = (PFNSHGETFOLDERPATH) g_SHGetFolderPath;
|
||||
if (!SHGetFolderPathFunc(g_hwnd, fldrs[x], NULL, SHGFP_TYPE_CURRENT, out))
|
||||
{
|
||||
break;
|
||||
|
@ -751,15 +767,15 @@ char * NSISCALL GetNSISString(char *outbuf, int strtab)
|
|||
return ps_tmpbuf;
|
||||
}
|
||||
|
||||
void NSISCALL validate_filename(char *in) {
|
||||
char *nono = "*?|<>/\":";
|
||||
char *out;
|
||||
char *out_save;
|
||||
void NSISCALL validate_filename(TCHAR *in) {
|
||||
TCHAR *nono = _T("*?|<>/\":");
|
||||
TCHAR *out;
|
||||
TCHAR *out_save;
|
||||
|
||||
// ignoring spaces is wrong, " C:\blah" is invalid
|
||||
//while (*in == ' ') in = CharNext(in);
|
||||
// ignoring spaces is wrong, _T(" C:\blah") is invalid
|
||||
//while (*in == _T(' ')) in = CharNext(in);
|
||||
|
||||
if (in[0] == '\\' && in[1] == '\\' && in[2] == '?' && in[3] == '\\')
|
||||
if (in[0] == _T('\\') && in[1] == _T('\\') && in[2] == _T('?') && in[3] == _T('\\'))
|
||||
{
|
||||
// at least four bytes
|
||||
in += 4;
|
||||
|
@ -772,7 +788,7 @@ void NSISCALL validate_filename(char *in) {
|
|||
out = out_save = in;
|
||||
while (*in)
|
||||
{
|
||||
if ((unsigned char)*in > 31 && !*findchar(nono, *in))
|
||||
if ((_TUCHAR)*in > 31 && !*findchar(nono, *in))
|
||||
{
|
||||
mini_memcpy(out, in, CharNext(in) - in);
|
||||
out = CharNext(out);
|
||||
|
@ -783,7 +799,7 @@ void NSISCALL validate_filename(char *in) {
|
|||
do
|
||||
{
|
||||
out = CharPrev(out_save, out);
|
||||
if (*out == ' ' || *out == '\\')
|
||||
if (*out == _T(' ') || *out == _T('\\'))
|
||||
*out = 0;
|
||||
else
|
||||
break;
|
||||
|
@ -792,7 +808,7 @@ void NSISCALL validate_filename(char *in) {
|
|||
|
||||
#ifdef NSIS_CONFIG_LOG
|
||||
int log_dolog;
|
||||
char log_text[2048]; // 1024 for each wsprintf
|
||||
TCHAR log_text[2048]; // 1024 for each wsprintf
|
||||
|
||||
#if !defined(NSIS_CONFIG_LOG_ODS) && !defined(NSIS_CONFIG_LOG_STDOUT)
|
||||
void NSISCALL log_write(int close)
|
||||
|
@ -818,36 +834,36 @@ void NSISCALL log_write(int close)
|
|||
if (fp!=INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DWORD d;
|
||||
mystrcat(log_text,"\r\n");
|
||||
WriteFile(fp,log_text,mystrlen(log_text),&d,NULL);
|
||||
mystrcat(log_text,_T("\r\n"));
|
||||
WriteFile(fp,log_text,mystrlen(log_text)*sizeof(TCHAR),&d,NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif//!NSIS_CONFIG_LOG_ODS && !NSIS_CONFIG_LOG_STDOUT
|
||||
|
||||
const char * _RegKeyHandleToName(HKEY hKey)
|
||||
const TCHAR * _RegKeyHandleToName(HKEY hKey)
|
||||
{
|
||||
if (hKey == HKEY_CLASSES_ROOT)
|
||||
return "HKEY_CLASSES_ROOT";
|
||||
return _T("HKEY_CLASSES_ROOT");
|
||||
else if (hKey == HKEY_CURRENT_USER)
|
||||
return "HKEY_CURRENT_USER";
|
||||
return _T("HKEY_CURRENT_USER");
|
||||
else if (hKey == HKEY_LOCAL_MACHINE)
|
||||
return "HKEY_LOCAL_MACHINE";
|
||||
return _T("HKEY_LOCAL_MACHINE");
|
||||
else if (hKey == HKEY_USERS)
|
||||
return "HKEY_USERS";
|
||||
return _T("HKEY_USERS");
|
||||
else if (hKey == HKEY_PERFORMANCE_DATA)
|
||||
return "HKEY_PERFORMANCE_DATA";
|
||||
return _T("HKEY_PERFORMANCE_DATA");
|
||||
else if (hKey == HKEY_CURRENT_CONFIG)
|
||||
return "HKEY_CURRENT_CONFIG";
|
||||
return _T("HKEY_CURRENT_CONFIG");
|
||||
else if (hKey == HKEY_DYN_DATA)
|
||||
return "HKEY_DYN_DATA";
|
||||
return _T("HKEY_DYN_DATA");
|
||||
else
|
||||
return "invalid registry key";
|
||||
return _T("invalid registry key");
|
||||
}
|
||||
|
||||
void _LogData2Hex(char *buf, size_t buflen, unsigned char *data, size_t datalen)
|
||||
void _LogData2Hex(TCHAR *buf, size_t buflen, BYTE *data, size_t datalen)
|
||||
{
|
||||
char *p = buf;
|
||||
TCHAR *p = buf;
|
||||
|
||||
size_t i;
|
||||
|
||||
|
@ -864,31 +880,31 @@ void _LogData2Hex(char *buf, size_t buflen, unsigned char *data, size_t datalen)
|
|||
|
||||
for (i = 0; i < bufbytes; i++)
|
||||
{
|
||||
wsprintf(p, "%02x%c", data[i], (i == bufbytes - 1) ? '\0' : ' ');
|
||||
wsprintf(p, _T("%02x%c"), data[i], (i == bufbytes - 1) ? _T('\0') : _T(' '));
|
||||
p += 3;
|
||||
}
|
||||
|
||||
if (dots)
|
||||
mystrcat(buf, "...");
|
||||
mystrcat(buf, _T("..."));
|
||||
}
|
||||
|
||||
#ifdef NSIS_CONFIG_LOG_TIMESTAMP
|
||||
void log_timestamp(char *buf)
|
||||
void log_timestamp(TCHAR *buf)
|
||||
{
|
||||
SYSTEMTIME st;
|
||||
GetLocalTime(&st);
|
||||
wsprintf(buf,"[%04hu/%02hu/%02hu %02hu:%02hu:%02hu] ", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
|
||||
wsprintf(buf,_T("[%04hu/%02hu/%02hu %02hu:%02hu:%02hu] "), st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
|
||||
}
|
||||
#else
|
||||
# define log_timestamp(x)
|
||||
#endif//NSIS_CONFIG_LOG_TIMESTAMP
|
||||
|
||||
void log_printf(char *format, ...)
|
||||
void log_printf(TCHAR *format, ...)
|
||||
{
|
||||
va_list val;
|
||||
va_start(val,format);
|
||||
|
||||
log_text[0] = '\0';
|
||||
log_text[0] = _T('\0');
|
||||
log_timestamp(log_text);
|
||||
wvsprintf(log_text+mystrlen(log_text),format,val);
|
||||
|
||||
|
@ -902,7 +918,7 @@ void log_printf(char *format, ...)
|
|||
{
|
||||
DWORD dwBytes;
|
||||
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), log_text, lstrlen(log_text), &dwBytes, NULL);
|
||||
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), "\n", 1, &dwBytes, NULL);
|
||||
WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), _T("\n"), 1, &dwBytes, NULL);
|
||||
}
|
||||
#endif
|
||||
#if !defined(NSIS_CONFIG_LOG_ODS) && !defined(NSIS_CONFIG_LOG_STDOUT)
|
||||
|
@ -911,7 +927,8 @@ void log_printf(char *format, ...)
|
|||
}
|
||||
#endif//NSIS_CONFIG_LOG
|
||||
|
||||
WIN32_FIND_DATA * NSISCALL file_exists(char *buf)
|
||||
// Jim Park: This function is non-reentrant because of the static.
|
||||
WIN32_FIND_DATA * NSISCALL file_exists(TCHAR *buf)
|
||||
{
|
||||
HANDLE h;
|
||||
static WIN32_FIND_DATA fd;
|
||||
|
@ -924,6 +941,8 @@ WIN32_FIND_DATA * NSISCALL file_exists(char *buf)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// Jim Park: Keep these as chars since there's only ANSI version of
|
||||
// GetProcAddress.
|
||||
struct MGA_FUNC
|
||||
{
|
||||
const char *dll;
|
||||
|
@ -942,12 +961,20 @@ struct MGA_FUNC MGA_FUNCS[] = {
|
|||
{"SHFOLDER", "SHGetFolderPathA"}
|
||||
};
|
||||
|
||||
/**
|
||||
* Given a function enum, it will load the appropriate DLL and get the
|
||||
* process address of the function and return the pointer. It's up to
|
||||
* the caller to know how to call that function, however.
|
||||
*
|
||||
* @param func Enum value that indexes the MGA_FUNCS array.
|
||||
* @return Pointer to the function identified by the enum value.
|
||||
*/
|
||||
void * NSISCALL myGetProcAddress(const enum myGetProcAddressFunctions func)
|
||||
{
|
||||
const char *dll = MGA_FUNCS[func].dll;
|
||||
HMODULE hModule = GetModuleHandle(dll);
|
||||
HMODULE hModule = GetModuleHandleA(dll);
|
||||
if (!hModule)
|
||||
hModule = LoadLibrary(dll);
|
||||
hModule = LoadLibraryA(dll);
|
||||
if (!hModule)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 07/23/2007
|
||||
*/
|
||||
|
||||
#ifndef ___NSIS_UTIL_H___
|
||||
|
@ -21,36 +23,40 @@
|
|||
#include "config.h"
|
||||
#include <shlobj.h>
|
||||
|
||||
extern char ps_tmpbuf[NSIS_MAX_STRLEN*2];
|
||||
char * NSISCALL GetNSISString(char *outbuf, int strtab);
|
||||
extern TCHAR ps_tmpbuf[NSIS_MAX_STRLEN*2];
|
||||
TCHAR * NSISCALL GetNSISString(TCHAR *outbuf, int strtab);
|
||||
#define GetNSISStringTT(strtab) GetNSISString(0, (strtab))
|
||||
#define GetNSISStringNP(strtab) ((const char *)g_blocks[NB_STRINGS].offset+(strtab))
|
||||
#define GetNSISTab(strtab) (strtab < 0 ? LANG_STR_TAB(strtab) : strtab)
|
||||
void NSISCALL myRegGetStr(HKEY root, const char *sub, const char *name, char *out, int x64);
|
||||
int NSISCALL myatoi(char *s);
|
||||
void NSISCALL myitoa(char *s, int d);
|
||||
char * NSISCALL mystrcpy(char *out, const char *in);
|
||||
int NSISCALL mystrlen(const char *in);
|
||||
char * NSISCALL mystrcat(char *out, const char *concat);
|
||||
char * NSISCALL mystrstr(char *a, char *b);
|
||||
WIN32_FIND_DATA * NSISCALL file_exists(char *buf);
|
||||
char * NSISCALL my_GetTempFileName(char *buf, const char *dir);
|
||||
#define GetNSISStringNP(strtab) ((const TCHAR *)g_blocks[NB_STRINGS].offset+(strtab))
|
||||
|
||||
//BOOL NSISCALL my_SetWindowText(HWND hWnd, const char *val);
|
||||
// A negative string table index means it's a language string table, so we
|
||||
// use the LANG_STR_TAB() macro to decode it.
|
||||
#define GetNSISTab(strtab) (strtab < 0 ? LANG_STR_TAB(strtab) : strtab)
|
||||
|
||||
void NSISCALL myRegGetStr(HKEY root, const TCHAR *sub, const TCHAR *name, TCHAR *out, int x64);
|
||||
int NSISCALL myatoi(TCHAR *s);
|
||||
void NSISCALL myitoa(TCHAR *s, int d);
|
||||
TCHAR * NSISCALL mystrcpy(TCHAR *out, const TCHAR *in);
|
||||
int NSISCALL mystrlen(const TCHAR *in);
|
||||
TCHAR * NSISCALL mystrcat(TCHAR *out, const TCHAR *concat);
|
||||
TCHAR * NSISCALL mystrstr(TCHAR *a, TCHAR *b);
|
||||
WIN32_FIND_DATA * NSISCALL file_exists(TCHAR *buf);
|
||||
TCHAR * NSISCALL my_GetTempFileName(TCHAR *buf, const TCHAR *dir);
|
||||
|
||||
//BOOL NSISCALL my_SetWindowText(HWND hWnd, const TCHAR *val);
|
||||
#define my_SetWindowText SetWindowText
|
||||
BOOL NSISCALL my_SetDialogItemText(HWND dlg, UINT idx, const char *val);
|
||||
BOOL NSISCALL my_SetDialogItemText(HWND dlg, UINT idx, const TCHAR *val);
|
||||
//#define my_SetDialogItemText SetDlgItemText
|
||||
//int NSISCALL my_GetWindowText(HWND hWnd, char *val, int size);
|
||||
//int NSISCALL my_GetWindowText(HWND hWnd, TCHAR *val, int size);
|
||||
#define my_GetWindowText GetWindowText
|
||||
int NSISCALL my_GetDialogItemText(UINT idx, char *val);
|
||||
int NSISCALL my_GetDialogItemText(UINT idx, TCHAR *val);
|
||||
//#define my_GetDialogItemText GetDlgItemText
|
||||
|
||||
#ifdef NSIS_CONFIG_LOG
|
||||
extern char log_text[2048];
|
||||
extern TCHAR log_text[2048];
|
||||
void NSISCALL log_write(int close);
|
||||
const char * _RegKeyHandleToName(HKEY hKey);
|
||||
void _LogData2Hex(char *buf, size_t buflen, unsigned char *data, size_t datalen);
|
||||
void log_printf(char *format, ...);
|
||||
const TCHAR * _RegKeyHandleToName(HKEY hKey);
|
||||
void _LogData2Hex(TCHAR *buf, size_t buflen, BYTE *data, size_t datalen);
|
||||
void log_printf(TCHAR *format, ...);
|
||||
#define log_printf2(x1,x2) log_printf(x1,x2);
|
||||
#define log_printf3(x1,x2,x3) log_printf(x1,x2,x3);
|
||||
#define log_printf4(x1,x2,x3,x4) log_printf(x1,x2,x3,x4);
|
||||
|
@ -61,7 +67,7 @@ void log_printf(char *format, ...);
|
|||
#define RegKeyHandleToName(x1) _RegKeyHandleToName(x1);
|
||||
#define LogData2Hex(x1,x2,x3,x4) _LogData2Hex(x1,x2,x3,x4);
|
||||
extern int log_dolog;
|
||||
extern char g_log_file[1024];
|
||||
extern TCHAR g_log_file[1024];
|
||||
#else
|
||||
#define log_printf(x1)
|
||||
#define log_printf2(x1,x2)
|
||||
|
@ -75,35 +81,44 @@ extern char g_log_file[1024];
|
|||
#define LogData2Hex(x1,x2,x3,x4)
|
||||
#endif
|
||||
|
||||
HANDLE NSISCALL myCreateProcess(char *cmd);
|
||||
int NSISCALL my_MessageBox(const char *text, UINT type);
|
||||
HANDLE NSISCALL myCreateProcess(TCHAR *cmd);
|
||||
int NSISCALL my_MessageBox(const TCHAR *text, UINT type);
|
||||
|
||||
void NSISCALL myDelete(char *buf, int flags);
|
||||
void NSISCALL myDelete(TCHAR *buf, int flags);
|
||||
|
||||
HANDLE NSISCALL myOpenFile(const char *fn, DWORD da, DWORD cd);
|
||||
int NSISCALL validpathspec(char *ubuf);
|
||||
char * NSISCALL addtrailingslash(char *str);
|
||||
//char NSISCALL lastchar(const char *str);
|
||||
HANDLE NSISCALL myOpenFile(const TCHAR *fn, DWORD da, DWORD cd);
|
||||
int NSISCALL validpathspec(TCHAR *ubuf);
|
||||
TCHAR * NSISCALL addtrailingslash(TCHAR *str);
|
||||
//TCHAR NSISCALL lastchar(const TCHAR *str);
|
||||
#define lastchar(str) *CharPrev(str,str+mystrlen(str))
|
||||
char * NSISCALL findchar(char *str, char c);
|
||||
char * NSISCALL trimslashtoend(char *buf);
|
||||
char * NSISCALL skip_root(char *path);
|
||||
int NSISCALL is_valid_instpath(char *s);
|
||||
void NSISCALL validate_filename(char *fn);
|
||||
TCHAR * NSISCALL findchar(TCHAR *str, TCHAR c);
|
||||
TCHAR * NSISCALL trimslashtoend(TCHAR *buf);
|
||||
TCHAR * NSISCALL skip_root(TCHAR *path);
|
||||
int NSISCALL is_valid_instpath(TCHAR *s);
|
||||
void NSISCALL validate_filename(TCHAR *fn);
|
||||
|
||||
/**
|
||||
* MoveFileOnReboot tries to move a file by the name of pszExisting to the
|
||||
* name pszNew.
|
||||
*
|
||||
* @param pszExisting The old name of the file.
|
||||
* @param pszNew The new name of the file.
|
||||
*/
|
||||
void NSISCALL MoveFileOnReboot(LPCTSTR pszExisting, LPCTSTR pszNew);
|
||||
|
||||
void NSISCALL mini_memcpy(void *out, const void *in, int len);
|
||||
void NSISCALL remove_ro_attr(char *file);
|
||||
void NSISCALL remove_ro_attr(TCHAR *file);
|
||||
|
||||
enum myGetProcAddressFunctions {
|
||||
MGA_GetDiskFreeSpaceExA,
|
||||
MGA_MoveFileExA,
|
||||
MGA_RegDeleteKeyExA,
|
||||
MGA_GetDiskFreeSpaceEx,
|
||||
MGA_MoveFileEx,
|
||||
MGA_RegDeleteKeyEx,
|
||||
MGA_OpenProcessToken,
|
||||
MGA_LookupPrivilegeValueA,
|
||||
MGA_LookupPrivilegeValue,
|
||||
MGA_AdjustTokenPrivileges,
|
||||
MGA_GetUserDefaultUILanguage,
|
||||
MGA_SHAutoComplete,
|
||||
MGA_SHGetFolderPathA
|
||||
MGA_SHGetFolderPath
|
||||
};
|
||||
|
||||
void * NSISCALL myGetProcAddress(const enum myGetProcAddressFunctions func);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/13/2007
|
||||
*/
|
||||
|
||||
#include "fileform.h"
|
||||
|
@ -184,6 +186,7 @@ void lang_table_writer::write(const unsigned char *data)
|
|||
void lang_table_writer::write_block(IGrowBuf *buf, writer_sink *sink, const size_t table_size)
|
||||
{
|
||||
unsigned char *tables = (unsigned char *) buf->get();
|
||||
// langtable has LANGID(WORD) + dlgoffset(int) + right-to-left(int) + string pointers.
|
||||
size_t lang_strings = ( table_size - 2 * sizeof(int) - sizeof(LANGID) ) / sizeof(int);
|
||||
size_t l = buf->getlen() / table_size;
|
||||
lang_table_writer writer(sink, lang_strings);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/13/2007
|
||||
*/
|
||||
|
||||
#ifndef ___MAKENSIS_FILEFORM_H___
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support and Doxygen comments by Jim Park -- 07/31/2007
|
||||
*/
|
||||
|
||||
#include "growbuf.h"
|
||||
|
@ -20,12 +22,16 @@
|
|||
#include <cstring> // for memcpy
|
||||
#include <cstdio> // for f*
|
||||
#include <algorithm> // for std::min
|
||||
#include "tchar.h"
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Default constructor
|
||||
GrowBuf::GrowBuf() { m_alloc=m_used=m_zero=0; m_s=NULL; m_bs=32768; }
|
||||
|
||||
// Destructor
|
||||
GrowBuf::~GrowBuf() { free(m_s); }
|
||||
|
||||
void GrowBuf::set_zeroing(int zero) { m_zero=zero; }
|
||||
|
@ -34,18 +40,22 @@ int GrowBuf::add(const void *data, int len)
|
|||
{
|
||||
if (len<=0) return 0;
|
||||
resize(m_used+len);
|
||||
memcpy((char*)m_s+m_used-len,data,len);
|
||||
memcpy((BYTE*)m_s+m_used-len,data,len);
|
||||
return m_used-len;
|
||||
}
|
||||
|
||||
void GrowBuf::resize(int newlen)
|
||||
{
|
||||
int os=m_alloc;
|
||||
int ou=m_used;
|
||||
int os=m_alloc; // old size
|
||||
int ou=m_used; // old used
|
||||
m_used=newlen;
|
||||
if (newlen > m_alloc)
|
||||
{
|
||||
void *n;
|
||||
|
||||
// Jim Park: Not sure why we don't just add m_bs. Multiplying by 2
|
||||
// makes m_bs meaningless after a few resizes. So TinyGrowBuf
|
||||
// isn't very tiny.
|
||||
m_alloc = newlen*2 + m_bs;
|
||||
n = realloc(m_s, m_alloc);
|
||||
if (!n)
|
||||
|
@ -54,7 +64,7 @@ void GrowBuf::resize(int newlen)
|
|||
extern int g_display_errors;
|
||||
if (g_display_errors)
|
||||
{
|
||||
fprintf(g_output,"\nack! realloc(%d) failed, trying malloc(%d)!\n",m_alloc,newlen);
|
||||
_ftprintf(g_output,_T("\nack! realloc(%d) failed, trying malloc(%d)!\n"),m_alloc,newlen);
|
||||
fflush(g_output);
|
||||
}
|
||||
m_alloc=newlen; // try to malloc the minimum needed
|
||||
|
@ -64,7 +74,7 @@ void GrowBuf::resize(int newlen)
|
|||
extern void quit();
|
||||
if (g_display_errors)
|
||||
{
|
||||
fprintf(g_output,"\nInternal compiler error #12345: GrowBuf realloc/malloc(%d) failed.\n",m_alloc);
|
||||
_ftprintf(g_output,_T("\nInternal compiler error #12345: GrowBuf realloc/malloc(%d) failed.\n"),m_alloc);
|
||||
fflush(g_output);
|
||||
}
|
||||
quit();
|
||||
|
@ -74,9 +84,13 @@ void GrowBuf::resize(int newlen)
|
|||
}
|
||||
m_s=n;
|
||||
}
|
||||
|
||||
// Zero out the new buffer area
|
||||
if (m_zero && m_used > ou)
|
||||
memset((char*)m_s + ou, 0, m_used - ou);
|
||||
if (!m_used && m_alloc > 2*m_bs) // only free if you resize to 0 and we're > 64k
|
||||
memset((BYTE*)m_s + ou, 0, m_used - ou);
|
||||
|
||||
if (!m_used && m_alloc > 2*m_bs) // only free if you resize to 0 and we're > 64k or
|
||||
// 2K in the case of TinyGrowBuf
|
||||
{
|
||||
m_alloc=0;
|
||||
free(m_s);
|
||||
|
|
|
@ -12,21 +12,52 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/22/2007
|
||||
*/
|
||||
|
||||
#ifndef __GROWBUF_H_
|
||||
#define __GROWBUF_H_
|
||||
|
||||
/**
|
||||
* IGrowBuf is the interface to a buffer that grows as you
|
||||
* add to the buffer.
|
||||
*/
|
||||
class IGrowBuf
|
||||
{
|
||||
public:
|
||||
virtual ~IGrowBuf() {}
|
||||
|
||||
/**
|
||||
* Add data to the buffer.
|
||||
* @param data Pointer to the data to be stored.
|
||||
* @param len Size of the data in bytes.
|
||||
* @return the previous logical size in bytes before the addition.
|
||||
*/
|
||||
virtual int add(const void *data, int len)=0;
|
||||
|
||||
/**
|
||||
* Resizes the buffer to hold the number of bytes specified.
|
||||
* @param newlen the desired logical size of the buffer.
|
||||
*/
|
||||
virtual void resize(int newlen)=0;
|
||||
|
||||
/**
|
||||
* Get the length of the logical buffer in bytes.
|
||||
* @return the length in bytes
|
||||
*/
|
||||
virtual int getlen() const=0;
|
||||
|
||||
/**
|
||||
* Get the buffer itself.
|
||||
* @return Void pointer to the buffer.
|
||||
*/
|
||||
virtual void *get() const=0;
|
||||
};
|
||||
|
||||
/**
|
||||
* GrowBuf implements IGrowBuf and grows in 32K chunks.
|
||||
*/
|
||||
class GrowBuf : public IGrowBuf
|
||||
{
|
||||
private: // don't copy instances
|
||||
|
@ -37,22 +68,55 @@ class GrowBuf : public IGrowBuf
|
|||
GrowBuf();
|
||||
virtual ~GrowBuf();
|
||||
|
||||
/**
|
||||
* Set whether to zero out buffer
|
||||
* @param zero A boolean value.
|
||||
*/
|
||||
void set_zeroing(int zero);
|
||||
|
||||
/**
|
||||
* Add data to the buffer.
|
||||
* @param data Pointer to the data to be stored.
|
||||
* @param len Size of the data in bytes.
|
||||
* @return the previous logical size in bytes before the addition.
|
||||
*/
|
||||
int add(const void *data, int len);
|
||||
|
||||
/**
|
||||
* Resizes the buffer to hold the number of bytes specified.
|
||||
* @param newlen the desired logical size of the buffer.
|
||||
*/
|
||||
void resize(int newlen);
|
||||
|
||||
/**
|
||||
* Get the length of the logical buffer in bytes.
|
||||
* Setting the newlen to 0 will cause the buffer to be at most
|
||||
* 2*m_bs bytes long. (It will free the buffer if > 2*m_bs.)
|
||||
*
|
||||
* @return the length in bytes
|
||||
*/
|
||||
int getlen() const;
|
||||
|
||||
/**
|
||||
* Get the buffer itself.
|
||||
* @return Void pointer to the buffer.
|
||||
*/
|
||||
void *get() const;
|
||||
|
||||
private:
|
||||
void *m_s;
|
||||
int m_alloc;
|
||||
int m_used;
|
||||
int m_zero;
|
||||
void *m_s; /* the storage buffer */
|
||||
int m_alloc; /* allocated bytes */
|
||||
int m_used; /* how many bytes of the buffer is used? */
|
||||
int m_zero; /* should storage be zeroed out? */
|
||||
|
||||
protected:
|
||||
int m_bs;
|
||||
int m_bs; // byte-size to grow by
|
||||
};
|
||||
|
||||
/**
|
||||
* TinyGrowBuf is a derived class that grows the buffer
|
||||
* in tiny increments.
|
||||
*/
|
||||
class TinyGrowBuf : public GrowBuf {
|
||||
public:
|
||||
TinyGrowBuf() : GrowBuf() { m_bs=1024; }
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// Unicode support by Jim Park -- 11/16/2007
|
||||
|
||||
#include "Platform.h"
|
||||
#include "icon.h"
|
||||
#include "util.h"
|
||||
|
@ -15,9 +17,9 @@ extern FILE *g_output;
|
|||
|
||||
#define SIZEOF_RSRC_ICON_GROUP_ENTRY 14
|
||||
|
||||
static FILE * open_icon(const char* filename, IconGroupHeader& igh)
|
||||
static FILE * open_icon(const TCHAR* filename, IconGroupHeader& igh)
|
||||
{
|
||||
FILE* f = FOPEN(filename, "rb");
|
||||
FILE* f = FOPEN(filename, _T("rb"));
|
||||
if (!f)
|
||||
throw runtime_error("can't open file");
|
||||
|
||||
|
@ -81,7 +83,7 @@ IconGroup load_icon_res(CResourceEditor* re, WORD id)
|
|||
return result;
|
||||
}
|
||||
|
||||
IconGroup load_icon_file(const char* filename)
|
||||
IconGroup load_icon_file(const TCHAR* filename)
|
||||
{
|
||||
IconGroupHeader iconHeader;
|
||||
IconGroup result;
|
||||
|
@ -150,6 +152,7 @@ typedef struct
|
|||
unsigned size_index;
|
||||
} IconPair;
|
||||
|
||||
|
||||
typedef vector<IconPair> IconPairs;
|
||||
|
||||
static bool compare_icon(Icon a, Icon b)
|
||||
|
@ -389,7 +392,7 @@ int generate_unicons_offsets(LPBYTE exeHeader, size_t exeHeaderSize, LPBYTE unin
|
|||
|
||||
if (offset > exeHeaderSize)
|
||||
{
|
||||
throw runtime_error("invalid icon offset (possibly compressed icon)");
|
||||
throw runtime_error(_T("invalid icon offset (possibly compressed icon)"));
|
||||
}
|
||||
|
||||
DWORD real_size = re.GetResourceSizeA(RT_ICON, MAKEINTRESOURCE(icon_index), NSIS_DEFAULT_LANG);
|
||||
|
@ -413,7 +416,7 @@ int generate_unicons_offsets(LPBYTE exeHeader, size_t exeHeaderSize, LPBYTE unin
|
|||
catch (const exception& e)
|
||||
{
|
||||
if (g_display_errors)
|
||||
fprintf(g_output, "\nError generating uninstaller icon: %s -- failing!\n", e.what());
|
||||
fprintf(g_output, _T("\nError generating uninstaller icon: %s -- failing!\n"), e.what());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
* warranty.
|
||||
*/
|
||||
|
||||
/* Unicode support by Jim Park -- 11/16/2007 */
|
||||
|
||||
#ifndef _ICON_H_
|
||||
#define _ICON_H_
|
||||
|
||||
|
@ -60,7 +62,7 @@ typedef struct
|
|||
|
||||
typedef std::vector<Icon> IconGroup;
|
||||
|
||||
IconGroup load_icon_file(const char* filename);
|
||||
IconGroup load_icon_file(const TCHAR* filename);
|
||||
IconGroup load_icon_res(CResourceEditor* re, WORD id);
|
||||
void free_loaded_icon(IconGroup icon);
|
||||
|
||||
|
|
459
Source/lang.cpp
459
Source/lang.cpp
|
@ -12,16 +12,20 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support and Doxygen comments by Jim Park -- 07/25/2007
|
||||
*/
|
||||
|
||||
#include "Platform.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "tchar.h"
|
||||
#include "build.h"
|
||||
#include "util.h"
|
||||
#include "DialogTemplate.h"
|
||||
#include "exehead/resource.h"
|
||||
#include <nsis-version.h>
|
||||
#include "tstring.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -37,107 +41,107 @@ typedef enum {
|
|||
} STATICID;
|
||||
|
||||
struct NLFString {
|
||||
const char *szLangStringName;
|
||||
const char *szDefault;
|
||||
const TCHAR *szLangStringName;
|
||||
const TCHAR *szDefault;
|
||||
STATICID eStaticID;
|
||||
};
|
||||
|
||||
NLFString NLFStrings[NLF_STRINGS] = {
|
||||
{"^Branding", "Nullsoft Install System %s", BOTH_STATIC},
|
||||
{"^SetupCaption", "$(^Name) Setup", INSTALL_STATIC},
|
||||
{"^UninstallCaption", "$(^Name) Uninstall", UNINSTALL_STATIC},
|
||||
{"^LicenseSubCaption", ": License Agreement", NONE_STATIC},
|
||||
{"^ComponentsSubCaption", ": Installation Options", NONE_STATIC},
|
||||
{"^DirSubCaption", ": Installation Folder", NONE_STATIC},
|
||||
{"^InstallingSubCaption", ": Installing", NONE_STATIC},
|
||||
{"^CompletedSubCaption", ": Completed", NONE_STATIC},
|
||||
{"^UnComponentsSubCaption", ": Uninstallation Options", NONE_STATIC},
|
||||
{"^UnDirSubCaption", ": Uninstallation Folder", NONE_STATIC},
|
||||
{"^ConfirmSubCaption", ": Confirmation", NONE_STATIC},
|
||||
{"^UninstallingSubCaption", ": Uninstalling", NONE_STATIC},
|
||||
{"^UnCompletedSubCaption", ": Completed", NONE_STATIC},
|
||||
{"^BackBtn", "< &Back", NONE_STATIC},
|
||||
{"^NextBtn", "&Next >", NONE_STATIC},
|
||||
{"^AgreeBtn", "I &Agree", NONE_STATIC},
|
||||
{"^AcceptBtn", "I &accept the terms of the License Agreement", NONE_STATIC},
|
||||
{"^DontAcceptBtn", "I &do not accept the terms of the License Agreement", NONE_STATIC},
|
||||
{"^InstallBtn", "&Install", NONE_STATIC},
|
||||
{"^UninstallBtn", "&Uninstall", NONE_STATIC},
|
||||
{"^CancelBtn", "Cancel", NONE_STATIC},
|
||||
{"^CloseBtn", "&Close", NONE_STATIC},
|
||||
{"^BrowseBtn", "B&rowse...", NONE_STATIC},
|
||||
{"^ShowDetailsBtn", "Show &details", NONE_STATIC},
|
||||
{"^ClickNext", "Click Next to continue.", NONE_STATIC},
|
||||
{"^ClickInstall", "Click Install to start the installation.", NONE_STATIC},
|
||||
{"^ClickUninstall", "Click Uninstall to start the uninstallation.", NONE_STATIC},
|
||||
{"^Name", "Name", BOTH_STATIC},
|
||||
{"^NameDA", 0, NONE_STATIC}, // virtual
|
||||
{"^Completed", "Completed", NONE_STATIC},
|
||||
{"^LicenseText", "Please review the license agreement before installing $(^NameDA). If you accept all terms of the agreement, click I Agree.", NONE_STATIC},
|
||||
{"^LicenseTextCB", "Please review the license agreement before installing $(^NameDA). If you accept all terms of the agreement, click the check box below. $_CLICK", NONE_STATIC},
|
||||
{"^LicenseTextRB", "Please review the license agreement before installing $(^NameDA). If you accept all terms of the agreement, select the first option below. $_CLICK", NONE_STATIC},
|
||||
{"^UnLicenseText", "Please review the license agreement before uninstalling $(^NameDA). If you accept all terms of the agreement, click I Agree.", NONE_STATIC},
|
||||
{"^UnLicenseTextCB", "Please review the license agreement before uninstalling $(^NameDA). If you accept all terms of the agreement, click the check box below. $_CLICK", NONE_STATIC},
|
||||
{"^UnLicenseTextRB", "Please review the license agreement before uninstalling $(^NameDA). If you accept all terms of the agreement, select the first option below. $_CLICK", NONE_STATIC},
|
||||
{"^LicenseData", 0, NONE_STATIC}, // virtual - not processed
|
||||
{"^Custom", "Custom", NONE_STATIC},
|
||||
{"^ComponentsText", "Check the components you want to install and uncheck the components you don't want to install. $_CLICK", NONE_STATIC},
|
||||
{"^ComponentsSubText1", "Select the type of install:", NONE_STATIC},
|
||||
{"^ComponentsSubText2_NoInstTypes", "Select components to install:", NONE_STATIC},
|
||||
{"^ComponentsSubText2", "Or, select the optional components you wish to install:", NONE_STATIC},
|
||||
{"^UnComponentsText", "Check the components you want to uninstall and uncheck the components you don't want to uninstall. $_CLICK", NONE_STATIC},
|
||||
{"^UnComponentsSubText1", "Select the type of uninstall:", NONE_STATIC},
|
||||
{"^UnComponentsSubText2_NoInstTypes", "Select components to uninstall:", NONE_STATIC},
|
||||
{"^UnComponentsSubText2", "Or, select the optional components you wish to uninstall:", NONE_STATIC},
|
||||
{"^DirText", "Setup will install $(^NameDA) in the following folder. To install in a different folder, click Browse and select another folder. $_CLICK", NONE_STATIC},
|
||||
{"^DirSubText", "Destination Folder", NONE_STATIC},
|
||||
{"^DirBrowseText", "Select the folder to install $(^NameDA) in:", NONE_STATIC},
|
||||
{"^UnDirText", "Setup will uninstall $(^NameDA) from the following folder. To uninstall from a different folder, click Browse and select another folder. $_CLICK", NONE_STATIC},
|
||||
{"^UnDirSubText", "", NONE_STATIC},
|
||||
{"^UnDirBrowseText", "Select the folder to uninstall $(^NameDA) from:", NONE_STATIC},
|
||||
{"^SpaceAvailable", "Space available: ", BOTH_STATIC},
|
||||
{"^SpaceRequired", "Space required: ", BOTH_STATIC},
|
||||
{"^UninstallingText", "This wizard will uninstall $(^NameDA) from your computer. $_CLICK", NONE_STATIC},
|
||||
{"^UninstallingSubText", "Uninstalling from:", NONE_STATIC},
|
||||
{"^FileError", "Error opening file for writing: \r\n\r\n$0\r\n\r\nClick Abort to stop the installation,\r\nRetry to try again, or\r\nIgnore to skip this file.", NONE_STATIC},
|
||||
{"^FileError_NoIgnore", "Error opening file for writing: \r\n\r\n$0\r\n\r\nClick Retry to try again, or\r\nCancel to stop the installation.", NONE_STATIC},
|
||||
{"^CantWrite", "Can't write: ", BOTH_STATIC},
|
||||
{"^CopyFailed", "Copy failed", BOTH_STATIC},
|
||||
{"^CopyTo", "Copy to ", BOTH_STATIC},
|
||||
{"^Registering", "Registering: ", NONE_STATIC},
|
||||
{"^Unregistering", "Unregistering: ", NONE_STATIC},
|
||||
{"^SymbolNotFound", "Could not find symbol: ", BOTH_STATIC},
|
||||
{"^CouldNotLoad", "Could not load: ", BOTH_STATIC},
|
||||
{"^CreateFolder", "Create folder: ", BOTH_STATIC},
|
||||
{"^CreateShortcut", "Create shortcut: ", BOTH_STATIC},
|
||||
{"^CreatedUninstaller", "Created uninstaller: ", BOTH_STATIC},
|
||||
{"^Delete", "Delete file: ", BOTH_STATIC},
|
||||
{"^DeleteOnReboot", "Delete on reboot: ", BOTH_STATIC},
|
||||
{"^ErrorCreatingShortcut", "Error creating shortcut: ", BOTH_STATIC},
|
||||
{"^ErrorCreating", "Error creating: ", BOTH_STATIC},
|
||||
{"^ErrorDecompressing", "Error decompressing data! Corrupted installer?", BOTH_STATIC},
|
||||
{"^ErrorRegistering", "Error registering DLL", BOTH_STATIC},
|
||||
{"^ExecShell", "ExecShell: ", BOTH_STATIC},
|
||||
{"^Exec", "Execute: ", BOTH_STATIC},
|
||||
{"^Extract", "Extract: ", BOTH_STATIC},
|
||||
{"^ErrorWriting", "Extract: error writing to file ", BOTH_STATIC},
|
||||
{"^InvalidOpcode", "Installer corrupted: invalid opcode", BOTH_STATIC},
|
||||
{"^NoOLE", "No OLE for: ", BOTH_STATIC},
|
||||
{"^OutputFolder", "Output folder: ", BOTH_STATIC},
|
||||
{"^RemoveFolder", "Remove folder: ", BOTH_STATIC},
|
||||
{"^RenameOnReboot", "Rename on reboot: ", BOTH_STATIC},
|
||||
{"^Rename", "Rename: ", BOTH_STATIC},
|
||||
{"^Skipped", "Skipped: ", BOTH_STATIC},
|
||||
{"^CopyDetails", "Copy Details To Clipboard", BOTH_STATIC},
|
||||
{"^LogInstall", "Log install process", BOTH_STATIC},
|
||||
{"^Byte", "B", BOTH_STATIC},
|
||||
{"^Kilo", "K", BOTH_STATIC},
|
||||
{"^Mega", "M", BOTH_STATIC},
|
||||
{"^Giga", "G", BOTH_STATIC},
|
||||
{"^Font", "MS Shell Dlg", NONE_STATIC},
|
||||
{"^FontSize", "8", NONE_STATIC},
|
||||
{"^RTL", "0", NONE_STATIC},
|
||||
{"^Language", "English", NONE_STATIC}
|
||||
{_T("^Branding"), _T("Nullsoft Install System %s"), BOTH_STATIC},
|
||||
{_T("^SetupCaption"), _T("$(^Name) Setup"), INSTALL_STATIC},
|
||||
{_T("^UninstallCaption"), _T("$(^Name) Uninstall"), UNINSTALL_STATIC},
|
||||
{_T("^LicenseSubCaption"), _T(": License Agreement"), NONE_STATIC},
|
||||
{_T("^ComponentsSubCaption"), _T(": Installation Options"), NONE_STATIC},
|
||||
{_T("^DirSubCaption"), _T(": Installation Folder"), NONE_STATIC},
|
||||
{_T("^InstallingSubCaption"), _T(": Installing"), NONE_STATIC},
|
||||
{_T("^CompletedSubCaption"), _T(": Completed"), NONE_STATIC},
|
||||
{_T("^UnComponentsSubCaption"), _T(": Uninstallation Options"), NONE_STATIC},
|
||||
{_T("^UnDirSubCaption"), _T(": Uninstallation Folder"), NONE_STATIC},
|
||||
{_T("^ConfirmSubCaption"), _T(": Confirmation"), NONE_STATIC},
|
||||
{_T("^UninstallingSubCaption"), _T(": Uninstalling"), NONE_STATIC},
|
||||
{_T("^UnCompletedSubCaption"), _T(": Completed"), NONE_STATIC},
|
||||
{_T("^BackBtn"), _T("< &Back"), NONE_STATIC},
|
||||
{_T("^NextBtn"), _T("&Next >"), NONE_STATIC},
|
||||
{_T("^AgreeBtn"), _T("I &Agree"), NONE_STATIC},
|
||||
{_T("^AcceptBtn"), _T("I &accept the terms of the License Agreement"), NONE_STATIC},
|
||||
{_T("^DontAcceptBtn"), _T("I &do not accept the terms of the License Agreement"), NONE_STATIC},
|
||||
{_T("^InstallBtn"), _T("&Install"), NONE_STATIC},
|
||||
{_T("^UninstallBtn"), _T("&Uninstall"), NONE_STATIC},
|
||||
{_T("^CancelBtn"), _T("Cancel"), NONE_STATIC},
|
||||
{_T("^CloseBtn"), _T("&Close"), NONE_STATIC},
|
||||
{_T("^BrowseBtn"), _T("B&rowse..."), NONE_STATIC},
|
||||
{_T("^ShowDetailsBtn"), _T("Show &details"), NONE_STATIC},
|
||||
{_T("^ClickNext"), _T("Click Next to continue."), NONE_STATIC},
|
||||
{_T("^ClickInstall"), _T("Click Install to start the installation."), NONE_STATIC},
|
||||
{_T("^ClickUninstall"), _T("Click Uninstall to start the uninstallation."), NONE_STATIC},
|
||||
{_T("^Name"), _T("Name"), BOTH_STATIC},
|
||||
{_T("^NameDA"), 0, NONE_STATIC}, // virtual
|
||||
{_T("^Completed"), _T("Completed"), NONE_STATIC},
|
||||
{_T("^LicenseText"), _T("Please review the license agreement before installing $(^NameDA). If you accept all terms of the agreement, click I Agree."), NONE_STATIC},
|
||||
{_T("^LicenseTextCB"), _T("Please review the license agreement before installing $(^NameDA). If you accept all terms of the agreement, click the check box below. $_CLICK"), NONE_STATIC},
|
||||
{_T("^LicenseTextRB"), _T("Please review the license agreement before installing $(^NameDA). If you accept all terms of the agreement, select the first option below. $_CLICK"), NONE_STATIC},
|
||||
{_T("^UnLicenseText"), _T("Please review the license agreement before uninstalling $(^NameDA). If you accept all terms of the agreement, click I Agree."), NONE_STATIC},
|
||||
{_T("^UnLicenseTextCB"), _T("Please review the license agreement before uninstalling $(^NameDA). If you accept all terms of the agreement, click the check box below. $_CLICK"), NONE_STATIC},
|
||||
{_T("^UnLicenseTextRB"), _T("Please review the license agreement before uninstalling $(^NameDA). If you accept all terms of the agreement, select the first option below. $_CLICK"), NONE_STATIC},
|
||||
{_T("^LicenseData"), 0, NONE_STATIC}, // virtual - not processed
|
||||
{_T("^Custom"), _T("Custom"), NONE_STATIC},
|
||||
{_T("^ComponentsText"), _T("Check the components you want to install and uncheck the components you don't want to install. $_CLICK"), NONE_STATIC},
|
||||
{_T("^ComponentsSubText1"), _T("Select the type of install:"), NONE_STATIC},
|
||||
{_T("^ComponentsSubText2_NoInstTypes"), _T("Select components to install:"), NONE_STATIC},
|
||||
{_T("^ComponentsSubText2"), _T("Or, select the optional components you wish to install:"), NONE_STATIC},
|
||||
{_T("^UnComponentsText"), _T("Check the components you want to uninstall and uncheck the components you don't want to uninstall. $_CLICK"), NONE_STATIC},
|
||||
{_T("^UnComponentsSubText1"), _T("Select the type of uninstall:"), NONE_STATIC},
|
||||
{_T("^UnComponentsSubText2_NoInstTypes"), _T("Select components to uninstall:"), NONE_STATIC},
|
||||
{_T("^UnComponentsSubText2"), _T("Or, select the optional components you wish to uninstall:"), NONE_STATIC},
|
||||
{_T("^DirText"), _T("Setup will install $(^NameDA) in the following folder. To install in a different folder, click Browse and select another folder. $_CLICK"), NONE_STATIC},
|
||||
{_T("^DirSubText"), _T("Destination Folder"), NONE_STATIC},
|
||||
{_T("^DirBrowseText"), _T("Select the folder to install $(^NameDA) in:"), NONE_STATIC},
|
||||
{_T("^UnDirText"), _T("Setup will uninstall $(^NameDA) from the following folder. To uninstall from a different folder, click Browse and select another folder. $_CLICK"), NONE_STATIC},
|
||||
{_T("^UnDirSubText"), _T(""), NONE_STATIC},
|
||||
{_T("^UnDirBrowseText"), _T("Select the folder to uninstall $(^NameDA) from:"), NONE_STATIC},
|
||||
{_T("^SpaceAvailable"), _T("Space available: "), BOTH_STATIC},
|
||||
{_T("^SpaceRequired"), _T("Space required: "), BOTH_STATIC},
|
||||
{_T("^UninstallingText"), _T("This wizard will uninstall $(^NameDA) from your computer. $_CLICK"), NONE_STATIC},
|
||||
{_T("^UninstallingSubText"), _T("Uninstalling from:"), NONE_STATIC},
|
||||
{_T("^FileError"), _T("Error opening file for writing: \r\n\r\n$0\r\n\r\nClick Abort to stop the installation,\r\nRetry to try again, or\r\nIgnore to skip this file."), NONE_STATIC},
|
||||
{_T("^FileError_NoIgnore"), _T("Error opening file for writing: \r\n\r\n$0\r\n\r\nClick Retry to try again, or\r\nCancel to stop the installation."), NONE_STATIC},
|
||||
{_T("^CantWrite"), _T("Can't write: "), BOTH_STATIC},
|
||||
{_T("^CopyFailed"), _T("Copy failed"), BOTH_STATIC},
|
||||
{_T("^CopyTo"), _T("Copy to "), BOTH_STATIC},
|
||||
{_T("^Registering"), _T("Registering: "), NONE_STATIC},
|
||||
{_T("^Unregistering"), _T("Unregistering: "), NONE_STATIC},
|
||||
{_T("^SymbolNotFound"), _T("Could not find symbol: "), BOTH_STATIC},
|
||||
{_T("^CouldNotLoad"), _T("Could not load: "), BOTH_STATIC},
|
||||
{_T("^CreateFolder"), _T("Create folder: "), BOTH_STATIC},
|
||||
{_T("^CreateShortcut"), _T("Create shortcut: "), BOTH_STATIC},
|
||||
{_T("^CreatedUninstaller"), _T("Created uninstaller: "), BOTH_STATIC},
|
||||
{_T("^Delete"), _T("Delete file: "), BOTH_STATIC},
|
||||
{_T("^DeleteOnReboot"), _T("Delete on reboot: "), BOTH_STATIC},
|
||||
{_T("^ErrorCreatingShortcut"), _T("Error creating shortcut: "), BOTH_STATIC},
|
||||
{_T("^ErrorCreating"), _T("Error creating: "), BOTH_STATIC},
|
||||
{_T("^ErrorDecompressing"), _T("Error decompressing data! Corrupted installer?"), BOTH_STATIC},
|
||||
{_T("^ErrorRegistering"), _T("Error registering DLL"), BOTH_STATIC},
|
||||
{_T("^ExecShell"), _T("ExecShell: "), BOTH_STATIC},
|
||||
{_T("^Exec"), _T("Execute: "), BOTH_STATIC},
|
||||
{_T("^Extract"), _T("Extract: "), BOTH_STATIC},
|
||||
{_T("^ErrorWriting"), _T("Extract: error writing to file "), BOTH_STATIC},
|
||||
{_T("^InvalidOpcode"), _T("Installer corrupted: invalid opcode"), BOTH_STATIC},
|
||||
{_T("^NoOLE"), _T("No OLE for: "), BOTH_STATIC},
|
||||
{_T("^OutputFolder"), _T("Output folder: "), BOTH_STATIC},
|
||||
{_T("^RemoveFolder"), _T("Remove folder: "), BOTH_STATIC},
|
||||
{_T("^RenameOnReboot"), _T("Rename on reboot: "), BOTH_STATIC},
|
||||
{_T("^Rename"), _T("Rename: "), BOTH_STATIC},
|
||||
{_T("^Skipped"), _T("Skipped: "), BOTH_STATIC},
|
||||
{_T("^CopyDetails"), _T("Copy Details To Clipboard"), BOTH_STATIC},
|
||||
{_T("^LogInstall"), _T("Log install process"), BOTH_STATIC},
|
||||
{_T("^Byte"), _T("B"), BOTH_STATIC},
|
||||
{_T("^Kilo"), _T("K"), BOTH_STATIC},
|
||||
{_T("^Mega"), _T("M"), BOTH_STATIC},
|
||||
{_T("^Giga"), _T("G"), BOTH_STATIC},
|
||||
{_T("^Font"), _T("MS Shell Dlg"), NONE_STATIC},
|
||||
{_T("^FontSize"), _T("8"), NONE_STATIC},
|
||||
{_T("^RTL"), _T("0"), NONE_STATIC},
|
||||
{_T("^Language"), _T("English"), NONE_STATIC}
|
||||
};
|
||||
|
||||
// ==============
|
||||
|
@ -148,7 +152,7 @@ LangStringList::LangStringList() {
|
|||
count = 0;
|
||||
}
|
||||
|
||||
int LangStringList::add(const char *name, int *sn/*=0*/)
|
||||
int LangStringList::add(const TCHAR *name, int *sn/*=0*/)
|
||||
{
|
||||
int pos = SortedStringListND<struct langstring>::add(name);
|
||||
if (pos == -1) return -1;
|
||||
|
@ -163,9 +167,9 @@ int LangStringList::add(const char *name, int *sn/*=0*/)
|
|||
return pos;
|
||||
}
|
||||
|
||||
int LangStringList::get(const char *name, int *sn/*=0*/, int *index/*=0*/, int *uindex/*=0*/, int *process/*=0*/)
|
||||
int LangStringList::get(const TCHAR *name, int *sn/*=0*/, int *index/*=0*/, int *uindex/*=0*/, int *process/*=0*/)
|
||||
{
|
||||
if (index) *index = -1;
|
||||
if (index) *index = -1;
|
||||
if (uindex) *uindex = -1;
|
||||
if (sn) *sn = -1;
|
||||
int v=find(name);
|
||||
|
@ -192,27 +196,27 @@ void LangStringList::set(int pos, int index/*=-1*/, int uindex/*=-1*/, int proce
|
|||
data[pos].process = process;
|
||||
}
|
||||
|
||||
void LangStringList::set(const char *name, int index, int uindex/*=-1*/, int process/*=-1*/)
|
||||
void LangStringList::set(const TCHAR *name, int index, int uindex/*=-1*/, int process/*=-1*/)
|
||||
{
|
||||
set(get(name), index, uindex, process);
|
||||
}
|
||||
|
||||
const char* LangStringList::pos2name(int pos)
|
||||
const TCHAR* LangStringList::pos2name(int pos)
|
||||
{
|
||||
struct langstring *data=(struct langstring *)gr.get();
|
||||
|
||||
if ((unsigned int)pos > (gr.getlen() / sizeof(struct langstring)))
|
||||
return 0;
|
||||
|
||||
return ((const char*)strings.get() + data[pos].name);
|
||||
return ((const TCHAR*)strings.get() + data[pos].name);
|
||||
}
|
||||
|
||||
const char* LangStringList::offset2name(int name)
|
||||
const TCHAR* LangStringList::offset2name(int name)
|
||||
{
|
||||
if ((unsigned int)name > (unsigned int)strings.getlen())
|
||||
return 0;
|
||||
|
||||
return (const char*)strings.get() + name;
|
||||
return (const TCHAR*)strings.get() + name;
|
||||
}
|
||||
|
||||
int LangStringList::getnum()
|
||||
|
@ -264,7 +268,7 @@ StringsArray::StringsArray()
|
|||
{
|
||||
offsets.set_zeroing(1);
|
||||
|
||||
strings.add("", sizeof(""));
|
||||
strings.add(_T(""), sizeof(_T("")));
|
||||
}
|
||||
|
||||
void StringsArray::resize(int num)
|
||||
|
@ -272,7 +276,7 @@ void StringsArray::resize(int num)
|
|||
offsets.resize(num * sizeof(int));
|
||||
}
|
||||
|
||||
int StringsArray::set(int idx, const char *str)
|
||||
int StringsArray::set(int idx, const TCHAR *str)
|
||||
{
|
||||
if (idx < 0)
|
||||
return 0;
|
||||
|
@ -287,12 +291,12 @@ int StringsArray::set(int idx, const char *str)
|
|||
return old;
|
||||
}
|
||||
|
||||
const char* StringsArray::get(int idx)
|
||||
const TCHAR* StringsArray::get(int idx)
|
||||
{
|
||||
if ((unsigned int)idx >= (offsets.getlen() / sizeof(int)))
|
||||
return 0;
|
||||
|
||||
return (const char *)strings.get() + ((int*)offsets.get())[idx];
|
||||
return (const TCHAR *)strings.get() + ((int*)offsets.get())[idx];
|
||||
}
|
||||
|
||||
// =========
|
||||
|
@ -331,6 +335,12 @@ void CEXEBuild::InitLangTables() {
|
|||
keep_ref = true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// class CEXEBuild
|
||||
//
|
||||
// Note: The functions below refer to the methods related to Languages.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LanguageTable* CEXEBuild::GetLangTable(LANGID &lang, bool create/*=true*/) {
|
||||
int nlt = lang_tables.getlen() / sizeof(LanguageTable);
|
||||
LanguageTable *nla = (LanguageTable*)lang_tables.get();
|
||||
|
@ -363,7 +373,7 @@ LanguageTable* CEXEBuild::GetLangTable(LANGID &lang, bool create/*=true*/) {
|
|||
return table;
|
||||
}
|
||||
|
||||
const char *CEXEBuild::GetLangNameAndCP(LANGID lang, unsigned int *codepage/*=NULL*/) {
|
||||
const TCHAR *CEXEBuild::GetLangNameAndCP(LANGID lang, unsigned int *codepage/*=NULL*/) {
|
||||
LanguageTable *table = GetLangTable(lang, false);
|
||||
|
||||
if (table && table->nlf.m_bLoaded) {
|
||||
|
@ -377,48 +387,54 @@ const char *CEXEBuild::GetLangNameAndCP(LANGID lang, unsigned int *codepage/*=NU
|
|||
*codepage = 1252; // English US
|
||||
|
||||
if (lang == 1033)
|
||||
return "English";
|
||||
return _T("English");
|
||||
else
|
||||
return "???";
|
||||
return _T("???");
|
||||
}
|
||||
}
|
||||
|
||||
int CEXEBuild::DefineLangString(const char *name, int process/*=-1*/) {
|
||||
int CEXEBuild::DefineLangString(const TCHAR *name, int process/*=-1*/) {
|
||||
int index, uindex, pos, ret, sn;
|
||||
|
||||
/* If not exist, index and uindex will get -1. */
|
||||
pos = build_langstrings.get(name, &sn, &index, &uindex);
|
||||
if (pos < 0) {
|
||||
pos = build_langstrings.add(name);
|
||||
}
|
||||
|
||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
if (!uninstall_mode) {
|
||||
if (!this->uninstall_mode) {
|
||||
#endif
|
||||
if (index < 0) {
|
||||
index = build_langstring_num++;
|
||||
// Did not exist. Increment.
|
||||
index = this->build_langstring_num++;
|
||||
}
|
||||
ret = -index - 1;
|
||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
}
|
||||
else {
|
||||
if (uindex < 0) {
|
||||
uindex = ubuild_langstring_num++;
|
||||
// Did not exist. Increment.
|
||||
uindex = this->ubuild_langstring_num++;
|
||||
}
|
||||
ret = -uindex - 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Now set the new index and uindex values with the
|
||||
// passed in proces value.
|
||||
build_langstrings.set(pos, index, uindex, process);
|
||||
|
||||
// set reference count for NLF strings
|
||||
if (keep_ref && name[0] == '^') {
|
||||
if (this->keep_ref && name[0] == _T('^')) {
|
||||
for (int i = 0; i < NLF_STRINGS; i++) {
|
||||
if (!strcmp(name, NLFStrings[i].szLangStringName)) {
|
||||
if (!_tcscmp(name, NLFStrings[i].szLangStringName)) {
|
||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
if (uninstall_mode)
|
||||
NLFRefs[i].iUnRef++;
|
||||
if (this->uninstall_mode)
|
||||
this->NLFRefs[i].iUnRef++;
|
||||
else
|
||||
#endif
|
||||
NLFRefs[i].iRef++;
|
||||
this->NLFRefs[i].iRef++;
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -450,8 +466,15 @@ int CEXEBuild::DefineInnerLangString(int id, int process/*=-1*/) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
int CEXEBuild::SetLangString(char *name, LANGID lang, char *string) {
|
||||
if (!string || !name) return PS_ERROR;
|
||||
// A LangString is a string variable that varies in value depending on what
|
||||
// language is being used. This function sets the string value for the
|
||||
// variable 'name' for a given language ID.
|
||||
//
|
||||
// @return If the language id, the variable name or string is invalid, it will
|
||||
// return a PS_ERROR. If this function call is overwriting a set user string,
|
||||
// this will return a PS_WARNING.
|
||||
int CEXEBuild::SetLangString(TCHAR *name, LANGID lang, TCHAR *str) {
|
||||
if (!str || !name) return PS_ERROR;
|
||||
|
||||
LanguageTable *table = GetLangTable(lang);
|
||||
if (!table) return PS_ERROR;
|
||||
|
@ -462,22 +485,27 @@ int CEXEBuild::SetLangString(char *name, LANGID lang, char *string) {
|
|||
if (pos < 0)
|
||||
pos = build_langstrings.add(name, &sn);
|
||||
|
||||
if (table->lang_strings->set(sn, string))
|
||||
if (table->lang_strings->set(sn, str))
|
||||
return PS_WARNING;
|
||||
|
||||
return PS_OK;
|
||||
}
|
||||
|
||||
int CEXEBuild::SetInnerString(int id, char *string) {
|
||||
if ((unsigned int)id >= NLF_STRINGS || !string) return PS_ERROR;
|
||||
// Sets the user string to the specific NLF_STRINGS id.
|
||||
//
|
||||
// @return If the id is invalid or the string is not valid, it will return a
|
||||
// PS_ERROR. If this function call is overwriting a set user string, this
|
||||
// will return a PS_WARNING.
|
||||
int CEXEBuild::SetInnerString(int id, TCHAR *str) {
|
||||
if ((unsigned int)id >= NLF_STRINGS || !str) return PS_ERROR;
|
||||
|
||||
int ret = PS_OK;
|
||||
|
||||
const char *ps = UserInnerStrings.get(id);
|
||||
const TCHAR *ps = UserInnerStrings.get(id);
|
||||
if (ps && *ps)
|
||||
ret = PS_WARNING;
|
||||
|
||||
UserInnerStrings.set(id, string);
|
||||
UserInnerStrings.set(id, str);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -531,24 +559,25 @@ int CEXEBuild::GenerateLangTable(LanguageTable *lt, int num_lang_tables) {
|
|||
if (!*ptr)
|
||||
{
|
||||
// Get the language string and its name
|
||||
const char *str = lt[i].lang_strings->get(lang_strings[j].sn);
|
||||
const char *lsn = build_langstrings.offset2name(lang_strings[j].name);
|
||||
const TCHAR *str = lt[i].lang_strings->get(lang_strings[j].sn);
|
||||
const TCHAR *lsn = build_langstrings.offset2name(lang_strings[j].name);
|
||||
// lsn = variable name, str = value
|
||||
if (!str || !*str)
|
||||
{
|
||||
// No string is defined; give a warning (for user strings only)
|
||||
if (lsn[0] != '^')
|
||||
if (lsn[0] != _T('^'))
|
||||
{
|
||||
if (lt[i].nlf.m_bLoaded)
|
||||
warning("LangString \"%s\" is not set in language table of language %s", lsn, lt[i].nlf.m_szName);
|
||||
warning(_T("LangString \"%s\" is not set in language table of language %s"), lsn, lt[i].nlf.m_szName);
|
||||
else
|
||||
warning("LangString \"%s\" is not set in language table of language %d", lsn, lt[i].lang_id);
|
||||
warning(_T("LangString \"%s\" is not set in language table of language %d"), lsn, lt[i].lang_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add the language string to the string data block
|
||||
char fn[1024];
|
||||
sprintf(fn, "LangString %s", lsn);
|
||||
TCHAR fn[1024];
|
||||
_stprintf(fn, _T("LangString %s"), lsn);
|
||||
curfilename = fn;
|
||||
linecnt = lt[i].lang_id;
|
||||
*ptr = add_string(str, lang_strings[j].process, (WORD) lt[i].nlf.m_uCodePage);
|
||||
|
@ -586,7 +615,7 @@ int CEXEBuild::GenerateLangTable(LanguageTable *lt, int num_lang_tables) {
|
|||
if (((int*)rec.get())[l] == lst[j])
|
||||
{
|
||||
// We have the index of a recursive language string; now find the name
|
||||
const char *name = "(unnamed)";
|
||||
const TCHAR *name = _T("(unnamed)");
|
||||
for (l = 0; l < langstring_num; l++)
|
||||
{
|
||||
int index;
|
||||
|
@ -601,7 +630,7 @@ int CEXEBuild::GenerateLangTable(LanguageTable *lt, int num_lang_tables) {
|
|||
name = build_langstrings.offset2name(lang_strings[l].name);
|
||||
}
|
||||
}
|
||||
ERROR_MSG("Error: LangString %s is recursive!\n", name);
|
||||
ERROR_MSG(_T("Error: LangString %s is recursive!\n"), name);
|
||||
delete [] string_ptrs;
|
||||
return PS_ERROR;
|
||||
}
|
||||
|
@ -638,7 +667,7 @@ int CEXEBuild::GenerateLangTables() {
|
|||
int i;
|
||||
LanguageTable *lt = (LanguageTable*)lang_tables.get();
|
||||
|
||||
SCRIPT_MSG("Generating language tables... ");
|
||||
SCRIPT_MSG(_T("Generating language tables... "));
|
||||
|
||||
if (
|
||||
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
|
||||
|
@ -647,7 +676,7 @@ int CEXEBuild::GenerateLangTables() {
|
|||
build_langstring_num > MAX_CODED
|
||||
)
|
||||
{
|
||||
ERROR_MSG("\nError: too many LangStrings. Maximum allowed is %u.\n", MAX_CODED);
|
||||
ERROR_MSG(_T("\nError: too many LangStrings. Maximum allowed is %u.\n"), MAX_CODED);
|
||||
return PS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -699,7 +728,7 @@ int CEXEBuild::GenerateLangTables() {
|
|||
#undef ADD_FONT
|
||||
}
|
||||
catch (exception& err) {
|
||||
ERROR_MSG("\nError while applying font: %s\n", err.what());
|
||||
ERROR_MSG(_T("\nError while applying font: %s\n"), err.what());
|
||||
return PS_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -715,7 +744,7 @@ int CEXEBuild::GenerateLangTables() {
|
|||
{
|
||||
lt[i].dlg_offset = cur_offset;
|
||||
|
||||
char *font = lt[i].nlf.m_szFont;
|
||||
TCHAR *font = lt[i].nlf.m_szFont;
|
||||
if (*build_font) font = 0;
|
||||
|
||||
try {
|
||||
|
@ -762,7 +791,7 @@ int CEXEBuild::GenerateLangTables() {
|
|||
#undef ADD_FONT
|
||||
}
|
||||
catch (exception& err) {
|
||||
ERROR_MSG("\nError while applying NLF font/RTL: %s\n", err.what());
|
||||
ERROR_MSG(_T("\nError while applying NLF font/RTL: %s\n"), err.what());
|
||||
return PS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -784,7 +813,7 @@ int CEXEBuild::GenerateLangTables() {
|
|||
|
||||
set_uninstall_mode(orig_uninstall_mode);
|
||||
|
||||
SCRIPT_MSG("Done!\n");
|
||||
SCRIPT_MSG(_T("Done!\n"));
|
||||
|
||||
return PS_OK;
|
||||
}
|
||||
|
@ -810,30 +839,30 @@ void CEXEBuild::FillLanguageTable(LanguageTable *table) {
|
|||
int sn, index;
|
||||
int pos = build_langstrings.get(NLFStrings[i].szLangStringName, &sn, &index);
|
||||
if (pos >= 0) {
|
||||
const char *str = table->lang_strings->get(sn);
|
||||
const TCHAR *str = table->lang_strings->get(sn);
|
||||
if (!str || !*str) {
|
||||
const char *us = UserInnerStrings.get(i);
|
||||
const TCHAR *us = UserInnerStrings.get(i);
|
||||
if (i == NLF_NAME_DA && (!us || !*us))
|
||||
{
|
||||
// if the user didn't set NLF_NAME_DA we set it to $(^Name)
|
||||
table->lang_strings->set(sn, "$(^Name)");
|
||||
table->lang_strings->set(sn, _T("$(^Name)"));
|
||||
}
|
||||
if (us && *us) {
|
||||
table->lang_strings->set(sn, (char *) us);
|
||||
table->lang_strings->set(sn, (TCHAR *) us);
|
||||
}
|
||||
else {
|
||||
const char *dstr = table->nlf.m_szStrings[i] ? table->nlf.m_szStrings[i] : NLFStrings[i].szDefault;
|
||||
const TCHAR *dstr = table->nlf.m_szStrings[i] ? table->nlf.m_szStrings[i] : NLFStrings[i].szDefault;
|
||||
if (!dstr)
|
||||
continue;
|
||||
if (i == NLF_BRANDING) {
|
||||
char temp[NSIS_MAX_STRLEN + sizeof(NSIS_VERSION)];
|
||||
sprintf(temp, dstr, NSIS_VERSION);
|
||||
TCHAR temp[NSIS_MAX_STRLEN + sizeof(NSIS_VERSION)];
|
||||
_stprintf(temp, dstr, NSIS_VERSION);
|
||||
table->lang_strings->set(sn, temp);
|
||||
continue;
|
||||
}
|
||||
else if (i == NLF_FONT)
|
||||
{
|
||||
char *font = *build_font ? build_font : table->nlf.m_szFont;
|
||||
TCHAR *font = *build_font ? build_font : table->nlf.m_szFont;
|
||||
if (font)
|
||||
table->lang_strings->set(sn, font);
|
||||
else
|
||||
|
@ -845,8 +874,8 @@ void CEXEBuild::FillLanguageTable(LanguageTable *table) {
|
|||
WORD font_size = *build_font ? (WORD) build_font_size : (WORD) table->nlf.m_iFontSize;
|
||||
if (font_size)
|
||||
{
|
||||
char temp[64];
|
||||
sprintf(temp, "%d", font_size);
|
||||
TCHAR temp[64];
|
||||
_stprintf(temp, _T("%d"), font_size);
|
||||
table->lang_strings->set(sn, temp);
|
||||
}
|
||||
else
|
||||
|
@ -860,51 +889,51 @@ void CEXEBuild::FillLanguageTable(LanguageTable *table) {
|
|||
}
|
||||
}
|
||||
|
||||
char SkipComments(FILE *f) {
|
||||
TCHAR SkipComments(FILE *f) {
|
||||
int c;
|
||||
while ((c = fgetc(f))) {
|
||||
while (c == '\n' || c == '\r') {
|
||||
c = fgetc(f); // Skip empty lines
|
||||
while ((c = _fgettc(f))) {
|
||||
while (c == _T('\n') || c == _T('\r')) {
|
||||
c = _fgettc(f); // Skip empty lines
|
||||
}
|
||||
if (c == '#' || c == ';') {
|
||||
while ((c = fgetc(f))) {
|
||||
if (c == '\n') break;
|
||||
if (c == _T('#') || c == _T(';')) {
|
||||
while ((c = _fgettc(f))) {
|
||||
if (c == _T('\n')) break;
|
||||
}
|
||||
}
|
||||
else break;
|
||||
}
|
||||
return (char) c;
|
||||
return (TCHAR) c;
|
||||
}
|
||||
|
||||
// NSIS Language File parser
|
||||
LanguageTable * CEXEBuild::LoadLangFile(char *filename) {
|
||||
FILE *f = FOPEN(filename, "r");
|
||||
LanguageTable * CEXEBuild::LoadLangFile(TCHAR *filename) {
|
||||
FILE *f = FOPEN(filename, _T("r"));
|
||||
if (!f) {
|
||||
ERROR_MSG("Error: Can't open language file - \"%s\"!\n",filename);
|
||||
ERROR_MSG(_T("Error: Can't open language file - \"%s\"!\n"),filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check header
|
||||
char buf[NSIS_MAX_STRLEN];
|
||||
TCHAR buf[NSIS_MAX_STRLEN];
|
||||
buf[0] = SkipComments(f);
|
||||
fgets(buf+1, NSIS_MAX_STRLEN, f);
|
||||
_fgetts(buf+1, NSIS_MAX_STRLEN, f);
|
||||
|
||||
if (strncmp(buf, "NLF v", 5)) {
|
||||
ERROR_MSG("Error: Invalid language file.\n");
|
||||
if (_tcsncmp(buf, _T("NLF v"), 5)) {
|
||||
ERROR_MSG(_T("Error: Invalid language file.\n"));
|
||||
return 0;
|
||||
}
|
||||
int nlf_version = atoi(buf+5);
|
||||
int nlf_version = _ttoi(buf+5);
|
||||
if (nlf_version != NLF_VERSION) {
|
||||
if (nlf_version != 2 && nlf_version != 3 && nlf_version != 4 && nlf_version != 5) {
|
||||
ERROR_MSG("Error: Language file version doesn't match NSIS version.\n");
|
||||
ERROR_MSG(_T("Error: Language file version doesn't match NSIS version.\n"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Get language ID
|
||||
buf[0] = SkipComments(f);
|
||||
fgets(buf+1, NSIS_MAX_STRLEN, f);
|
||||
LANGID lang_id = atoi(buf);
|
||||
_fgetts(buf+1, NSIS_MAX_STRLEN, f);
|
||||
LANGID lang_id = _ttoi(buf);
|
||||
|
||||
// Get appropriate table
|
||||
LanguageTable *table = GetLangTable(lang_id);
|
||||
|
@ -914,32 +943,32 @@ LanguageTable * CEXEBuild::LoadLangFile(char *filename) {
|
|||
NLF *nlf = &table->nlf;
|
||||
|
||||
if (nlf->m_bLoaded) {
|
||||
ERROR_MSG("Error: can't load same language file twice.\n");
|
||||
ERROR_MSG(_T("Error: can't load same language file twice.\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Generate language name
|
||||
char *p, *p2, t = 0;
|
||||
TCHAR *p, *p2, t = 0;
|
||||
|
||||
p = strrchr(filename, '.');
|
||||
p = _tcsrchr(filename, _T('.'));
|
||||
if (p) {
|
||||
t = *p;
|
||||
*p = 0;
|
||||
}
|
||||
p2 = strrchr(filename, '\\');
|
||||
p2 = _tcsrchr(filename, _T('\\'));
|
||||
if (p2) {
|
||||
p2++;
|
||||
nlf->m_szName = (char*)malloc(strlen(p2)+1);
|
||||
strcpy(nlf->m_szName, p2);
|
||||
nlf->m_szName = (TCHAR*)malloc((_tcsclen(p2)+1)*sizeof(TCHAR));
|
||||
_tcscpy(nlf->m_szName, p2);
|
||||
}
|
||||
else {
|
||||
nlf->m_szName = (char*)malloc(strlen(filename)+1);
|
||||
strcpy(nlf->m_szName, filename);
|
||||
nlf->m_szName = (TCHAR*)malloc((_tcsclen(filename)+1)*sizeof(TCHAR));
|
||||
_tcscpy(nlf->m_szName, filename);
|
||||
}
|
||||
if (p) *p = t;
|
||||
|
||||
if (nlf_version != NLF_VERSION) {
|
||||
warning_fl("%s language file version doesn't match. Using default English texts for missing strings.", nlf->m_szName);
|
||||
warning_fl(_T("%s language file version doesn't match. Using default English texts for missing strings."), nlf->m_szName);
|
||||
}
|
||||
|
||||
// set ^Language
|
||||
|
@ -949,48 +978,48 @@ LanguageTable * CEXEBuild::LoadLangFile(char *filename) {
|
|||
|
||||
// Get font
|
||||
buf[0] = SkipComments(f);
|
||||
fgets(buf+1, NSIS_MAX_STRLEN, f);
|
||||
_fgetts(buf+1, NSIS_MAX_STRLEN, f);
|
||||
if (!nlf->m_szFont) {
|
||||
temp=strlen(buf);
|
||||
while (buf[temp-1] == '\n' || buf[temp-1] == '\r') {
|
||||
temp=_tcsclen(buf);
|
||||
while (buf[temp-1] == _T('\n') || buf[temp-1] == _T('\r')) {
|
||||
buf[temp-1] = 0;
|
||||
temp--;
|
||||
}
|
||||
if (buf[0] != '-' || buf[1] != 0) {
|
||||
nlf->m_szFont = (char*)malloc(strlen(buf)+1);
|
||||
strcpy(nlf->m_szFont, buf);
|
||||
if (buf[0] != _T('-') || buf[1] != 0) {
|
||||
nlf->m_szFont = (TCHAR*)malloc((_tcsclen(buf)+1)*sizeof(TCHAR));
|
||||
_tcscpy(nlf->m_szFont, buf);
|
||||
}
|
||||
}
|
||||
|
||||
buf[0] = SkipComments(f);
|
||||
fgets(buf+1, NSIS_MAX_STRLEN, f);
|
||||
_fgetts(buf+1, NSIS_MAX_STRLEN, f);
|
||||
if (!nlf->m_iFontSize) {
|
||||
if (buf[0] != '-' || buf[1] != 0) {
|
||||
nlf->m_iFontSize = atoi(buf);
|
||||
if (buf[0] != _T('-') || buf[1] != 0) {
|
||||
nlf->m_iFontSize = _ttoi(buf);
|
||||
}
|
||||
}
|
||||
|
||||
// Get code page
|
||||
nlf->m_uCodePage = CP_ACP;
|
||||
buf[0] = SkipComments(f);
|
||||
fgets(buf+1, NSIS_MAX_STRLEN, f);
|
||||
if (buf[0] != '-' || buf[1] != 0) {
|
||||
nlf->m_uCodePage = atoi(buf);
|
||||
_fgetts(buf+1, NSIS_MAX_STRLEN, f);
|
||||
if (buf[0] != _T('-') || buf[1] != 0) {
|
||||
nlf->m_uCodePage = _ttoi(buf);
|
||||
if (!IsValidCodePage(nlf->m_uCodePage))
|
||||
nlf->m_uCodePage = CP_ACP;
|
||||
}
|
||||
|
||||
// Get RTL setting
|
||||
nlf->m_szStrings[NLF_RTL] = (char *)malloc(2);
|
||||
nlf->m_szStrings[NLF_RTL] = (TCHAR *)malloc(2*sizeof(TCHAR));
|
||||
nlf->m_bRTL = false;
|
||||
buf[0] = SkipComments(f);
|
||||
fgets(buf+1, NSIS_MAX_STRLEN, f);
|
||||
if (buf[0] == 'R' && buf[1] == 'T' && buf[2] == 'L' && (!buf[3] || buf[3] == '\r' || buf[3] == '\n')) {
|
||||
_fgetts(buf+1, NSIS_MAX_STRLEN, f);
|
||||
if (buf[0] == _T('R') && buf[1] == _T('T') && buf[2] == _T('L') && (!buf[3] || buf[3] == _T('\r') || buf[3] == _T('\n'))) {
|
||||
nlf->m_bRTL = true;
|
||||
strcpy(nlf->m_szStrings[NLF_RTL], "1");
|
||||
_tcscpy(nlf->m_szStrings[NLF_RTL], _T("1"));
|
||||
}
|
||||
else {
|
||||
strcpy(nlf->m_szStrings[NLF_RTL], "0");
|
||||
_tcscpy(nlf->m_szStrings[NLF_RTL], _T("0"));
|
||||
}
|
||||
|
||||
// Read strings
|
||||
|
@ -1045,42 +1074,42 @@ LanguageTable * CEXEBuild::LoadLangFile(char *filename) {
|
|||
|
||||
buf[0] = SkipComments(f);
|
||||
|
||||
fgets(buf+1, NSIS_MAX_STRLEN, f);
|
||||
if (strlen(buf) == NSIS_MAX_STRLEN-1) {
|
||||
ERROR_MSG("Error: String too long (string #%d - \"%s\")", i, NLFStrings[i].szLangStringName);
|
||||
_fgetts(buf+1, NSIS_MAX_STRLEN, f);
|
||||
if (_tcsclen(buf) == NSIS_MAX_STRLEN-1) {
|
||||
ERROR_MSG(_T("Error: String too long (string #%d - \"%s\")"), i, NLFStrings[i].szLangStringName);
|
||||
return 0;
|
||||
}
|
||||
temp=strlen(buf);
|
||||
temp=_tcsclen(buf);
|
||||
|
||||
while (buf[temp-1] == '\n' || buf[temp-1] == '\r') {
|
||||
while (buf[temp-1] == _T('\n') || buf[temp-1] == _T('\r')) {
|
||||
buf[--temp] = 0;
|
||||
}
|
||||
|
||||
char *in = buf;
|
||||
TCHAR *in = buf;
|
||||
|
||||
// trim quotes
|
||||
if (buf[0] == '"' && buf[temp-1] == '"') {
|
||||
if (buf[0] == _T('"') && buf[temp-1] == _T('"')) {
|
||||
in++;
|
||||
buf[--temp] = 0;
|
||||
}
|
||||
|
||||
nlf->m_szStrings[i] = (char*)malloc(temp+1);
|
||||
char *out;
|
||||
nlf->m_szStrings[i] = (TCHAR*)malloc((temp+1)*sizeof(TCHAR));
|
||||
TCHAR *out;
|
||||
for (out = nlf->m_szStrings[i]; *in; in++, out++) {
|
||||
if (*in == '\\') {
|
||||
if (*in == _T('\\')) {
|
||||
in++;
|
||||
switch (*in) {
|
||||
case 'n':
|
||||
*out = '\n';
|
||||
case _T('n'):
|
||||
*out = _T('\n');
|
||||
break;
|
||||
case 'r':
|
||||
*out = '\r';
|
||||
case _T('r'):
|
||||
*out = _T('\r');
|
||||
break;
|
||||
case 't':
|
||||
*out = '\t';
|
||||
case _T('t'):
|
||||
*out = _T('\t');
|
||||
break;
|
||||
default:
|
||||
*out++ = '\\';
|
||||
*out++ = _T('\\');
|
||||
*out = *in;
|
||||
}
|
||||
}
|
||||
|
|
165
Source/lang.h
165
Source/lang.h
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support and Doxygen comments by Jim Park -- 07/30/2007
|
||||
*/
|
||||
|
||||
#ifndef ___NLF___H_____
|
||||
|
@ -37,18 +39,116 @@ struct langstring {
|
|||
class LangStringList : public SortedStringListND<struct langstring>
|
||||
{
|
||||
public:
|
||||
/* Default constructor */
|
||||
LangStringList();
|
||||
|
||||
int add(const char *name, int *sn=0);
|
||||
int get(const char *name, int *sn=0, int *index=0, int *uindex=0, int *process=0);
|
||||
/**
|
||||
* Adds a langstring struct with the string name of 'name' into this
|
||||
* structure.
|
||||
*
|
||||
* @param name The string to use as key.
|
||||
* @param sn [out] The string number.
|
||||
* @return Returns the position where T was stored.
|
||||
*/
|
||||
int add(const TCHAR *name, int *sn=0);
|
||||
|
||||
/**
|
||||
* Gets the values in the langstring struct that is mapped to the string
|
||||
* 'name'. Sets sn, index, and uindex to -1 before looking for the
|
||||
* 'name'. If not found, -1 is returned. If found, then the values
|
||||
* associated with 'name' are set to the sn, index, uindex, process
|
||||
* variables.
|
||||
*
|
||||
* TODO: Need better documentation here.
|
||||
* @param sn [out] Set to string ID number.
|
||||
* @param index [out] Set to index value in langstring.
|
||||
* @param uindex [out] Set to uindex value in langstring.
|
||||
* @param process [out] Set to process value in langstring.
|
||||
* @return The index into langstring array. -1 if not found.
|
||||
*/
|
||||
int get(const TCHAR *name, int *sn=0, int *index=0, int *uindex=0, int *process=0);
|
||||
|
||||
/**
|
||||
* Sets the values in the langstring struct that is in the position 'pos'.
|
||||
*
|
||||
* @param pos The langstring index into m_gr.
|
||||
* @param index Value to set langstring[pos].index.
|
||||
* @param uindex Value to set langstring[pos].uindex.
|
||||
* @param process Value to set langstring[pos].process.
|
||||
*/
|
||||
void set(int pos, int index=-1, int uindex=-1, int process=-1);
|
||||
void set(const char *name, int index, int uindex=-1, int process=-1);
|
||||
const char *pos2name(int pos);
|
||||
const char *offset2name(int name);
|
||||
|
||||
/**
|
||||
* Sets the values in the langstring struct that is mapped to the string
|
||||
* 'name'.
|
||||
*
|
||||
* @param name The string key to lookup langstring.
|
||||
* @param index Value to set langstring[pos].index.
|
||||
* @param uindex Value to set langstring[pos].uindex.
|
||||
* @param process Value to set langstring[pos].process.
|
||||
*/
|
||||
void set(const TCHAR *name, int index, int uindex=-1, int process=-1);
|
||||
|
||||
/**
|
||||
* From the position index, get the pointer to the key string.
|
||||
* Basically, get the string referenced by langstring[pos].name.
|
||||
*
|
||||
* @param pos The position index.
|
||||
* @return The TCHAR* to the string referenced by pos.
|
||||
*/
|
||||
const TCHAR *pos2name(int pos);
|
||||
|
||||
/**
|
||||
* From the index into the strings, get the pointer to the
|
||||
* key string. Note: the positional index into the storage of
|
||||
* key strings probably should not be exposed to the outside.
|
||||
*
|
||||
* @param name Index into the m_strings array.
|
||||
* @return The TCHAR* to the string referenced by name.
|
||||
*/
|
||||
const TCHAR *offset2name(int name);
|
||||
|
||||
/**
|
||||
* Get the number of entries.
|
||||
*
|
||||
* @return The number of langstring entries.
|
||||
*/
|
||||
int getnum();
|
||||
|
||||
/**
|
||||
* Compare two langstring structs pointed by item1 and item2 by looking at
|
||||
* their .index values via their difference (item1->index - item2->index).
|
||||
*
|
||||
* @return 0 if equal, negative value if item1 is smaller, positive value
|
||||
* if item1 is bigger.
|
||||
*/
|
||||
static int compare_index(const void *item1, const void *item2);
|
||||
|
||||
/**
|
||||
* Sorts the langstrings by their index. Then return the sorted array
|
||||
* via m_sortbuf. Warning: This function is not thread-safe!
|
||||
*
|
||||
* @param num [out] Set to the size of langstring items in the array.
|
||||
* @return The sorted langstring array via m_sortbuf.
|
||||
*/
|
||||
langstring *sort_index(int *num);
|
||||
|
||||
/**
|
||||
* Compare two langstring structs pointed by item1 and item2 by looking at
|
||||
* their .uindex values via their difference (item1->uindex - item2->uindex).
|
||||
*
|
||||
* @return 0 if equal, negative value if item1 is smaller, positive value
|
||||
* if item1 is bigger.
|
||||
*/
|
||||
static int compare_uindex(const void *item1, const void *item2);
|
||||
|
||||
/**
|
||||
* Sorts the langstrings by their index. Then return the sorted array
|
||||
* via m_sortbuf. Warning: This function is not thread-safe!
|
||||
*
|
||||
* @param num [out] Set to the size of langstring items in the array.
|
||||
* @return The sorted langstring array via m_sortbuf.
|
||||
*/
|
||||
langstring *sort_uindex(int *num);
|
||||
|
||||
private:
|
||||
|
@ -56,14 +156,43 @@ class LangStringList : public SortedStringListND<struct langstring>
|
|||
TinyGrowBuf sortbuf;
|
||||
};
|
||||
|
||||
/**
|
||||
* This class implements an array of C-style strings in a flat buffer.
|
||||
*
|
||||
* Implementation: Resetting the string at a particular index does not delete
|
||||
* the old string. Instead a new string is added to the end of m_strings and
|
||||
* the old string can no longer be looked up.
|
||||
*/
|
||||
class StringsArray
|
||||
{
|
||||
public:
|
||||
StringsArray();
|
||||
|
||||
/**
|
||||
* Resizes the m_offsets so that the index num is valid.
|
||||
*
|
||||
* @param num New size.
|
||||
*/
|
||||
void resize(int num);
|
||||
int set(int idx, const char *str);
|
||||
const char *get(int idx);
|
||||
|
||||
/**
|
||||
* Set the string 'str' at index idx. This class cannot really delete
|
||||
* strings. It can "overwrite" them in the sense that the string is no
|
||||
* longer referenceable via the index but they are never gone.
|
||||
*
|
||||
* @param idx The index position to set the string to.
|
||||
* @param str The string value to set.
|
||||
* @return If overwriting, the position in m_strings of the old string.
|
||||
*/
|
||||
int set(int idx, const TCHAR *str);
|
||||
|
||||
/**
|
||||
* Get the string at index 'idx'.
|
||||
*
|
||||
* @param idx The logical index to the string.
|
||||
* @return Returns the TCHAR* to the string.
|
||||
*/
|
||||
const TCHAR *get(int idx);
|
||||
|
||||
private:
|
||||
TinyGrowBuf offsets;
|
||||
|
@ -176,18 +305,26 @@ enum {
|
|||
};
|
||||
|
||||
struct NLF {
|
||||
bool m_bLoaded;
|
||||
char *m_szName;
|
||||
char *m_szFont;
|
||||
bool m_bLoaded; /* Is the table loaded? */
|
||||
TCHAR *m_szName; /* The language name */
|
||||
TCHAR *m_szFont;
|
||||
int m_iFontSize;
|
||||
unsigned int m_uCodePage;
|
||||
bool m_bRTL;
|
||||
unsigned int m_uCodePage; /* Code page associated with language. When
|
||||
* using Unicode, this value will be 1200.
|
||||
*/
|
||||
|
||||
bool m_bRTL; /* Is this a right-to-left language like
|
||||
Hebrew? */
|
||||
|
||||
char *m_szStrings[NLF_STRINGS];
|
||||
TCHAR *m_szStrings[NLF_STRINGS];
|
||||
};
|
||||
|
||||
/**
|
||||
* LanguageTable stores within the lang_strings, all the user strings and
|
||||
* variables for that specific language.
|
||||
*/
|
||||
struct LanguageTable {
|
||||
LANGID lang_id;
|
||||
LANGID lang_id; /* Windows Language ID identifier */
|
||||
|
||||
int dlg_offset;
|
||||
|
||||
|
|
|
@ -12,13 +12,16 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/09/2007
|
||||
*/
|
||||
|
||||
#include "lineparse.h"
|
||||
#include "Platform.h"
|
||||
|
||||
#include "tchar.h"
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
//#include "tstring.h"
|
||||
|
||||
LineParser::LineParser(bool bCommentBlock)
|
||||
{
|
||||
|
@ -43,7 +46,7 @@ bool LineParser::inCommentBlock()
|
|||
return m_incommentblock;
|
||||
}
|
||||
|
||||
int LineParser::parse(char *line, int ignore_escaping/*=0*/) // returns -1 on error
|
||||
int LineParser::parse(TCHAR *line, int ignore_escaping/*=0*/) // returns -1 on error
|
||||
{
|
||||
freetokens();
|
||||
bool bPrevCB=m_incommentblock;
|
||||
|
@ -52,7 +55,7 @@ int LineParser::parse(char *line, int ignore_escaping/*=0*/) // returns -1 on er
|
|||
if (m_nt)
|
||||
{
|
||||
m_incommentblock=bPrevCB;
|
||||
m_tokens=(char**)malloc(sizeof(char*)*m_nt);
|
||||
m_tokens=(TCHAR**)malloc(sizeof(TCHAR*)*m_nt);
|
||||
n=doline(line, ignore_escaping);
|
||||
if (n)
|
||||
{
|
||||
|
@ -83,15 +86,15 @@ double LineParser::gettoken_float(int token, int *success/*=0*/)
|
|||
}
|
||||
if (success)
|
||||
{
|
||||
char *t=m_tokens[token];
|
||||
TCHAR *t=m_tokens[token];
|
||||
*success=*t?1:0;
|
||||
while (*t)
|
||||
{
|
||||
if ((*t < '0' || *t > '9')&&*t != '.') *success=0;
|
||||
if ((*t < _T('0') || *t > _T('9'))&&*t != _T('.')) *success=0;
|
||||
t++;
|
||||
}
|
||||
}
|
||||
return atof(m_tokens[token]);
|
||||
return _tstof(m_tokens[token]);
|
||||
}
|
||||
|
||||
int LineParser::gettoken_int(int token, int *success/*=0*/)
|
||||
|
@ -102,29 +105,29 @@ int LineParser::gettoken_int(int token, int *success/*=0*/)
|
|||
if (success) *success=0;
|
||||
return 0;
|
||||
}
|
||||
char *tmp;
|
||||
TCHAR *tmp;
|
||||
int l;
|
||||
if (m_tokens[token][0] == '-') l=strtol(m_tokens[token],&tmp,0);
|
||||
else l=(int)strtoul(m_tokens[token],&tmp,0);
|
||||
if (m_tokens[token][0] == _T('-')) l=_tcstol(m_tokens[token],&tmp,0);
|
||||
else l=(int)_tcstoul(m_tokens[token],&tmp,0);
|
||||
if (success) *success=! (int)(*tmp);
|
||||
return l;
|
||||
}
|
||||
|
||||
char* LineParser::gettoken_str(int token)
|
||||
TCHAR* LineParser::gettoken_str(int token)
|
||||
{
|
||||
token+=m_eat;
|
||||
if (token < 0 || token >= m_nt) return (char*)"";
|
||||
if (token < 0 || token >= m_nt) return (TCHAR*)_T("");
|
||||
return m_tokens[token];
|
||||
}
|
||||
|
||||
int LineParser::gettoken_enum(int token, const char *strlist) // null seperated list
|
||||
int LineParser::gettoken_enum(int token, const TCHAR *strlist) // null seperated list
|
||||
{
|
||||
int x=0;
|
||||
char *tt=gettoken_str(token);
|
||||
TCHAR *tt=gettoken_str(token);
|
||||
if (tt && *tt) while (*strlist)
|
||||
{
|
||||
if (!stricmp(tt,strlist)) return x;
|
||||
strlist+=strlen(strlist)+1;
|
||||
strlist+=_tcsclen(strlist)+1;
|
||||
x++;
|
||||
}
|
||||
return -1;
|
||||
|
@ -143,22 +146,22 @@ void LineParser::freetokens()
|
|||
m_nt=0;
|
||||
}
|
||||
|
||||
int LineParser::doline(char *line, int ignore_escaping/*=0*/)
|
||||
int LineParser::doline(TCHAR *line, int ignore_escaping/*=0*/)
|
||||
{
|
||||
m_nt=0;
|
||||
m_incomment = false;
|
||||
while (*line == ' ' || *line == '\t') line++;
|
||||
while (*line == _T(' ') || *line == _T('\t')) line++;
|
||||
while (*line)
|
||||
{
|
||||
if ( m_incommentblock )
|
||||
{
|
||||
while ( *line )
|
||||
{
|
||||
if ( *line == '*' && *(line+1) == '/' )
|
||||
if ( *line == _T('*') && *(line+1) == _T('/') )
|
||||
{
|
||||
m_incommentblock=false; // Found end of comment block
|
||||
line+=2;
|
||||
while (*line == ' ' || *line == '\t') line++;
|
||||
while (*line == _T(' ') || *line == _T('\t')) line++;
|
||||
break;
|
||||
}
|
||||
else line++;
|
||||
|
@ -166,41 +169,41 @@ int LineParser::doline(char *line, int ignore_escaping/*=0*/)
|
|||
}
|
||||
else {
|
||||
int lstate=0; // 1=", 2=`, 4='
|
||||
if (*line == ';' || *line == '#')
|
||||
if (*line == _T(';') || *line == _T('#'))
|
||||
{
|
||||
m_incomment = true;
|
||||
break;
|
||||
}
|
||||
if (*line == '/' && *(line+1) == '*')
|
||||
if (*line == _T('/') && *(line+1) == _T('*'))
|
||||
{
|
||||
m_incommentblock = true;
|
||||
line+=2;
|
||||
}
|
||||
else {
|
||||
if (*line == '\"') lstate=1;
|
||||
else if (*line == '\'') lstate=2;
|
||||
else if (*line == '`') lstate=4;
|
||||
if (*line == _T('\"')) lstate=1;
|
||||
else if (*line == _T('\'')) lstate=2;
|
||||
else if (*line == _T('`')) lstate=4;
|
||||
if (lstate) line++;
|
||||
int nc=0;
|
||||
char *p = line;
|
||||
TCHAR *p = line;
|
||||
while (*line)
|
||||
{
|
||||
if (line[0] == '$' && line[1] == '\\') {
|
||||
if (line[0] == _T('$') && line[1] == _T('\\')) {
|
||||
switch (line[2]) {
|
||||
case '"':
|
||||
case '\'':
|
||||
case '`':
|
||||
case _T('"'):
|
||||
case _T('\''):
|
||||
case _T('`'):
|
||||
nc += ignore_escaping ? 3 : 1;
|
||||
line += 3;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (lstate==1 && *line =='\"') break;
|
||||
if (lstate==2 && *line =='\'') break;
|
||||
if (lstate==4 && *line =='`') break;
|
||||
if (!lstate && (*line == ' ' || *line == '\t')) break;
|
||||
if (lstate==1 && *line ==_T('\"')) break;
|
||||
if (lstate==2 && *line ==_T('\'')) break;
|
||||
if (lstate==4 && *line ==_T('`')) break;
|
||||
if (!lstate && (*line == _T(' ') || *line == _T('\t'))) break;
|
||||
#ifdef NSIS_FIX_COMMENT_HANDLING
|
||||
if (!lstate && (*line == ';' || *line == '#' || (*line == '/' && *(line+1) == '*'))) break;
|
||||
if (!lstate && (*line == _T(';') || *line == _T('#') || (*line == _T('/') && *(line+1) == _T('*')))) break;
|
||||
#endif
|
||||
line++;
|
||||
nc++;
|
||||
|
@ -208,13 +211,13 @@ int LineParser::doline(char *line, int ignore_escaping/*=0*/)
|
|||
if (m_tokens)
|
||||
{
|
||||
int i;
|
||||
m_tokens[m_nt]=(char*)malloc(nc+1);
|
||||
m_tokens[m_nt]=(TCHAR*)malloc((nc+1)*sizeof(TCHAR));
|
||||
for (i = 0; p < line; i++, p++) {
|
||||
if (!ignore_escaping && p[0] == '$' && p[1] == '\\') {
|
||||
if (!ignore_escaping && p[0] == _T('$') && p[1] == _T('\\')) {
|
||||
switch (p[2]) {
|
||||
case '"':
|
||||
case '\'':
|
||||
case '`':
|
||||
case _T('"'):
|
||||
case _T('\''):
|
||||
case _T('`'):
|
||||
p += 2;
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +231,7 @@ int LineParser::doline(char *line, int ignore_escaping/*=0*/)
|
|||
if (*line) line++;
|
||||
else return -2;
|
||||
}
|
||||
while (*line == ' ' || *line == '\t') line++;
|
||||
while (*line == _T(' ') || *line == _T('\t')) line++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,11 +12,15 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/09/2007
|
||||
*/
|
||||
|
||||
#ifndef _LINEPARSE_H_
|
||||
#define _LINEPARSE_H_
|
||||
|
||||
#include "tchar.h"
|
||||
|
||||
class LineParser {
|
||||
public:
|
||||
|
||||
|
@ -25,23 +29,23 @@ class LineParser {
|
|||
|
||||
bool inComment();
|
||||
bool inCommentBlock();
|
||||
int parse(char *line, int ignore_escaping=0); // returns -1 on error
|
||||
int parse(TCHAR *line, int ignore_escaping=0); // returns -1 on error
|
||||
int getnumtokens();
|
||||
void eattoken();
|
||||
double gettoken_float(int token, int *success=0);
|
||||
int gettoken_int(int token, int *success=0);
|
||||
char *gettoken_str(int token);
|
||||
int gettoken_enum(int token, const char *strlist); // null seperated list
|
||||
TCHAR *gettoken_str(int token);
|
||||
int gettoken_enum(int token, const TCHAR *strlist); // null seperated list
|
||||
|
||||
private:
|
||||
|
||||
void freetokens();
|
||||
int doline(char *line, int ignore_escaping=0);
|
||||
int doline(TCHAR *line, int ignore_escaping=0);
|
||||
|
||||
int m_eat;
|
||||
int m_nt;
|
||||
bool m_incommentblock;
|
||||
bool m_incomment;
|
||||
char **m_tokens;
|
||||
TCHAR **m_tokens;
|
||||
};
|
||||
#endif//_LINEPARSE_H_
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/09/2007
|
||||
*/
|
||||
|
||||
#include "Platform.h"
|
||||
|
@ -22,7 +24,7 @@
|
|||
#else
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <string>
|
||||
#include "tstring.h"
|
||||
|
||||
#include "build.h"
|
||||
#include "util.h"
|
||||
|
@ -39,8 +41,8 @@ void quit()
|
|||
{
|
||||
if (g_display_errors)
|
||||
{
|
||||
fprintf(g_output,"\nNote: you may have one or two (large) stale temporary file(s)\n"
|
||||
"left in your temporary directory (Generally this only happens on Windows 9x).\n");
|
||||
_ftprintf(g_output,_T("\nNote: you may have one or two (large) stale temporary file(s)\n")
|
||||
_T("left in your temporary directory (Generally this only happens on Windows 9x).\n"));
|
||||
fflush(g_output);
|
||||
}
|
||||
exit(1);
|
||||
|
@ -56,7 +58,7 @@ static void sigint(int sig)
|
|||
{
|
||||
if (g_display_errors)
|
||||
{
|
||||
fprintf(g_output,"\n\nAborting on Ctrl+C...\n");
|
||||
_ftprintf(g_output,_T("\n\nAborting on Ctrl+C...\n"));
|
||||
fflush(g_output);
|
||||
}
|
||||
quit();
|
||||
|
@ -65,7 +67,7 @@ static void sigint(int sig)
|
|||
#ifdef _WIN32
|
||||
static DWORD WINAPI sigint_event_msg_handler(LPVOID)
|
||||
{
|
||||
HANDLE hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, "makensis win32 signint event");
|
||||
HANDLE hEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, _T("makensis win32 signint event"));
|
||||
|
||||
if (hEvent)
|
||||
{
|
||||
|
@ -92,59 +94,59 @@ static void init_signals()
|
|||
|
||||
static void print_logo()
|
||||
{
|
||||
fprintf(g_output,"MakeNSIS %s - Copyright 1995-2009 Contributors\n"
|
||||
"See the file COPYING for license details.\n"
|
||||
"Credits can be found in the Users Manual.\n\n", NSIS_VERSION);
|
||||
_ftprintf(g_output,_T("MakeNSIS %s - Copyright 1995-2009 Contributors\n")
|
||||
_T("See the file COPYING for license details.\n")
|
||||
_T("Credits can be found in the Users Manual.\n\n"), NSIS_VERSION);
|
||||
fflush(g_output);
|
||||
}
|
||||
|
||||
static void print_license()
|
||||
{
|
||||
fprintf(g_output,"Copyright (C) 1999-2009 Nullsoft and Contributors\n\n"
|
||||
"This license applies to everything in the NSIS package, except where otherwise\n"
|
||||
"noted.\n\n"
|
||||
"This software is provided 'as-is', without any express or implied warranty.\n"
|
||||
"In no event will the authors be held liable for any damages arising from the\n"
|
||||
"use of this software.\n\n"
|
||||
"Permission is granted to anyone to use this software for any purpose, including\n"
|
||||
"commercial applications, and to alter it and redistribute it freely, subject to\n"
|
||||
"the following restrictions:\n"
|
||||
" 1. The origin of this software must not be misrepresented; you must not claim\n"
|
||||
" that you wrote the original software. If you use this software in a\n"
|
||||
" product, an acknowledgment in the product documentation would be\n"
|
||||
" appreciated but is not required.\n"
|
||||
" 2. Altered source versions must be plainly marked as such, and must not be\n"
|
||||
" misrepresented as being the original software.\n"
|
||||
" 3. This notice may not be removed or altered from any source distribution.\n\n"
|
||||
"In addition to this license, different licenses apply to the included\n"
|
||||
"compression modules. See the file COPYING for details.\n");
|
||||
_ftprintf(g_output,_T("Copyright (C) 1999-2009 Nullsoft and Contributors\n\n")
|
||||
_T("This license applies to everything in the NSIS package, except where otherwise\n")
|
||||
_T("noted.\n\n")
|
||||
_T("This software is provided 'as-is', without any express or implied warranty.\n")
|
||||
_T("In no event will the authors be held liable for any damages arising from the\n")
|
||||
_T("use of this software.\n\n")
|
||||
_T("Permission is granted to anyone to use this software for any purpose, including\n")
|
||||
_T("commercial applications, and to alter it and redistribute it freely, subject to\n")
|
||||
_T("the following restrictions:\n")
|
||||
_T(" 1. The origin of this software must not be misrepresented; you must not claim\n")
|
||||
_T(" that you wrote the original software. If you use this software in a\n")
|
||||
_T(" product, an acknowledgment in the product documentation would be\n")
|
||||
_T(" appreciated but is not required.\n")
|
||||
_T(" 2. Altered source versions must be plainly marked as such, and must not be\n")
|
||||
_T(" misrepresented as being the original software.\n")
|
||||
_T(" 3. This notice may not be removed or altered from any source distribution.\n\n")
|
||||
_T("In addition to this license, different licenses apply to the included\n")
|
||||
_T("compression modules. See the file COPYING for details.\n"));
|
||||
fflush(g_output);
|
||||
}
|
||||
|
||||
static void print_usage()
|
||||
{
|
||||
fprintf(g_output,"Usage:\n"
|
||||
" makensis [option | script.nsi | - [...]]\n"
|
||||
" options are:\n"
|
||||
" " OPT_STR "CMDHELP item prints out help for 'item', or lists all commands\n"
|
||||
" " OPT_STR "HDRINFO prints information about what options makensis was compiled with\n"
|
||||
" " OPT_STR "LICENSE prints the makensis software license\n"
|
||||
" " OPT_STR "VERSION prints the makensis version and exits\n"
|
||||
" " OPT_STR "Px sets the compiler process priority, where x is 5=realtime,4=high,\n"
|
||||
" " " 3=above normal,2=normal,1=below normal,0=idle\n"
|
||||
" " OPT_STR "Vx verbosity where x is 4=all,3=no script,2=no info,1=no warnings,0=none\n"
|
||||
" " OPT_STR "Ofile specifies a text file to log compiler output (default is stdout)\n"
|
||||
" " OPT_STR "PAUSE pauses after execution\n"
|
||||
" " OPT_STR "NOCONFIG disables inclusion of <path to makensis.exe>" PLATFORM_PATH_SEPARATOR_STR "nsisconf.nsh\n"
|
||||
" " OPT_STR "NOCD disabled the current directory change to that of the .nsi file\n"
|
||||
" " OPT_STR "Ddefine[=value] defines the symbol \"define\" for the script [to value]\n"
|
||||
" " OPT_STR "Xscriptcmd executes scriptcmd in script (i.e. \"" OPT_STR "XOutFile poop.exe\")\n"
|
||||
" parameters are processed by order (" OPT_STR "Ddef ins.nsi != ins.nsi " OPT_STR "Ddef)\n"
|
||||
" for script file name, you can use - to read from the standard input\n"
|
||||
_ftprintf(g_output,_T("Usage:\n")
|
||||
_T(" makensis [option | script.nsi | - [...]]\n")
|
||||
_T(" options are:\n")
|
||||
_T(" ") OPT_STR _T("CMDHELP item prints out help for 'item', or lists all commands\n")
|
||||
_T(" ") OPT_STR _T("HDRINFO prints information about what options makensis was compiled with\n")
|
||||
_T(" ") OPT_STR _T("LICENSE prints the makensis software license\n")
|
||||
_T(" ") OPT_STR _T("VERSION prints the makensis version and exits\n")
|
||||
_T(" ") OPT_STR _T("Px sets the compiler process priority, where x is 5=realtime,4=high,\n")
|
||||
_T(" ") _T(" 3=above normal,2=normal,1=below normal,0=idle\n")
|
||||
_T(" ") OPT_STR _T("Vx verbosity where x is 4=all,3=no script,2=no info,1=no warnings,0=none\n")
|
||||
_T(" ") OPT_STR _T("Ofile specifies a text file to log compiler output (default is stdout)\n")
|
||||
_T(" ") OPT_STR _T("PAUSE pauses after execution\n")
|
||||
_T(" ") OPT_STR _T("NOCONFIG disables inclusion of <path to makensis.exe>") PLATFORM_PATH_SEPARATOR_STR _T("nsisconf.nsh\n")
|
||||
_T(" ") OPT_STR _T("NOCD disabled the current directory change to that of the .nsi file\n")
|
||||
_T(" ") OPT_STR _T("Ddefine[=value] defines the symbol \"define\" for the script [to value]\n")
|
||||
_T(" ") OPT_STR _T("Xscriptcmd executes scriptcmd in script (i.e. \"") OPT_STR _T("XOutFile poop.exe\")\n")
|
||||
_T(" parameters are processed by order (") OPT_STR _T("Ddef ins.nsi != ins.nsi ") OPT_STR _T("Ddef)\n")
|
||||
_T(" for script file name, you can use - to read from the standard input\n")
|
||||
#ifdef _WIN32
|
||||
" you can also use - as an option character: -PAUSE as well as /PAUSE\n"
|
||||
_T(" you can also use - as an option character: -PAUSE as well as /PAUSE\n")
|
||||
#endif
|
||||
" you can use a double-dash to end options processing: makensis -- -ins.nsi\n");
|
||||
_T(" you can use a double-dash to end options processing: makensis -- -ins.nsi\n"));
|
||||
fflush(g_output);
|
||||
}
|
||||
|
||||
|
@ -152,91 +154,91 @@ static void print_stub_info(CEXEBuild& build)
|
|||
{
|
||||
if (build.display_info)
|
||||
{
|
||||
fprintf(g_output,"Size of first header is %lu bytes.\n",(unsigned long)sizeof(firstheader));
|
||||
fprintf(g_output,"Size of main header is %lu bytes.\n",(unsigned long)sizeof(header));
|
||||
fprintf(g_output,"Size of each section is %lu bytes.\n",(unsigned long)sizeof(section));
|
||||
fprintf(g_output,"Size of each page is %lu bytes.\n",(unsigned long)sizeof(page));
|
||||
fprintf(g_output,"Size of each instruction is %lu bytes.\n",(unsigned long)sizeof(entry));
|
||||
_ftprintf(g_output,_T("Size of first header is %lu bytes.\n"),(unsigned long)sizeof(firstheader));
|
||||
_ftprintf(g_output,_T("Size of main header is %lu bytes.\n"),(unsigned long)sizeof(header));
|
||||
_ftprintf(g_output,_T("Size of each section is %lu bytes.\n"),(unsigned long)sizeof(section));
|
||||
_ftprintf(g_output,_T("Size of each page is %lu bytes.\n"),(unsigned long)sizeof(page));
|
||||
_ftprintf(g_output,_T("Size of each instruction is %lu bytes.\n"),(unsigned long)sizeof(entry));
|
||||
int x=build.definedlist.getnum();
|
||||
fprintf(g_output,"\nDefined symbols: ");
|
||||
_ftprintf(g_output,_T("\nDefined symbols: "));
|
||||
for (int i=0; i<x; i++)
|
||||
{
|
||||
fprintf(g_output,"%s",build.definedlist.getname(i));
|
||||
char *p=build.definedlist.getvalue(i);
|
||||
if (*p) fprintf(g_output,"=%s",p);
|
||||
if (i<x-1) fprintf(g_output,",");
|
||||
_ftprintf(g_output,_T("%s"),build.definedlist.getname(i));
|
||||
TCHAR *p=build.definedlist.getvalue(i);
|
||||
if (*p) _ftprintf(g_output,_T("=%s"),p);
|
||||
if (i<x-1) _ftprintf(g_output,_T(","));
|
||||
}
|
||||
if (!x) fprintf(g_output,"none");
|
||||
fprintf(g_output,"\n");
|
||||
if (!x) _ftprintf(g_output,_T("none"));
|
||||
_ftprintf(g_output,_T("\n"));
|
||||
fflush(g_output);
|
||||
}
|
||||
}
|
||||
|
||||
static string get_home()
|
||||
static tstring get_home()
|
||||
{
|
||||
char *home = getenv(
|
||||
TCHAR *home = _tgetenv(
|
||||
#ifdef _WIN32
|
||||
"APPDATA"
|
||||
_T("APPDATA")
|
||||
#else
|
||||
"HOME"
|
||||
_T("HOME")
|
||||
#endif
|
||||
);
|
||||
|
||||
return home ? home : "";
|
||||
return home ? home : _T("");
|
||||
}
|
||||
|
||||
static int process_config(CEXEBuild& build, string& conf)
|
||||
static int process_config(CEXEBuild& build, tstring& conf)
|
||||
{
|
||||
FILE *cfg=fopen(conf.c_str(),"rt");
|
||||
FILE *cfg=fopen(conf.c_str(),_T("rt"));
|
||||
if (cfg)
|
||||
{
|
||||
if (build.display_script)
|
||||
{
|
||||
fprintf(g_output,"Processing config: \n");
|
||||
_ftprintf(g_output,_T("Processing config: \n"));
|
||||
fflush(g_output);
|
||||
}
|
||||
int ret=build.process_script(cfg,(char*)conf.c_str());
|
||||
int ret=build.process_script(cfg,(TCHAR*)conf.c_str());
|
||||
fclose(cfg);
|
||||
if (ret != PS_OK && ret != PS_EOF)
|
||||
{
|
||||
if (build.display_errors)
|
||||
{
|
||||
fprintf(g_output,"Error in config on line %d -- aborting creation process\n",build.linecnt);
|
||||
_ftprintf(g_output,_T("Error in config on line %d -- aborting creation process\n"),build.linecnt);
|
||||
fflush(g_output);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (build.display_script)
|
||||
{
|
||||
fprintf(g_output,"\n");
|
||||
_ftprintf(g_output,_T("\n"));
|
||||
fflush(g_output);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int change_to_script_dir(CEXEBuild& build, string& script)
|
||||
static int change_to_script_dir(CEXEBuild& build, tstring& script)
|
||||
{
|
||||
string dir = get_dir_name(get_full_path(script));
|
||||
tstring dir = get_dir_name(get_full_path(script));
|
||||
if (!dir.empty())
|
||||
{
|
||||
if (build.display_script)
|
||||
{
|
||||
fprintf(g_output,"Changing directory to: \"%s\"\n",dir.c_str());
|
||||
_ftprintf(g_output,_T("Changing directory to: \"%s\"\n"),dir.c_str());
|
||||
fflush(g_output);
|
||||
}
|
||||
if (chdir(dir.c_str()))
|
||||
{
|
||||
if (build.display_errors)
|
||||
{
|
||||
fprintf(g_output,"Error changing directory to \"%s\"\n",dir.c_str());
|
||||
_ftprintf(g_output,_T("Error changing directory to \"%s\"\n"),dir.c_str());
|
||||
fflush(g_output);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (build.display_script)
|
||||
{
|
||||
fprintf(g_output,"\n");
|
||||
_ftprintf(g_output,_T("\n"));
|
||||
fflush(g_output);
|
||||
}
|
||||
}
|
||||
|
@ -247,8 +249,9 @@ static int change_to_script_dir(CEXEBuild& build, string& script)
|
|||
extern "C" void allow_unaligned_data_access();
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int _tmain(int argc, TCHAR **argv)
|
||||
{
|
||||
|
||||
#ifdef NSIS_HPUX_ALLOW_UNALIGNED_DATA_ACCESS
|
||||
allow_unaligned_data_access();
|
||||
#endif
|
||||
|
@ -271,21 +274,21 @@ int main(int argc, char **argv)
|
|||
}
|
||||
catch (exception& err)
|
||||
{
|
||||
fprintf(g_output, "Error initalizing CEXEBuild: %s\n", err.what());
|
||||
fprintf(g_output, _T("Error initalizing CEXEBuild: %s\n"), err.what());
|
||||
fflush(g_output);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argc > 1 && IS_OPT(argv[1]) && !stricmp(&argv[1][1],"VERSION"))
|
||||
if (argc > 1 && IS_OPT(argv[1]) && !stricmp(&argv[1][1],_T("VERSION")))
|
||||
{
|
||||
fprintf(g_output,NSIS_VERSION);
|
||||
fflush(g_output);
|
||||
return 0;
|
||||
}
|
||||
if (argc > 1 && IS_OPT(argv[1]) && (argv[1][1]=='v' || argv[1][1]=='V'))
|
||||
if (argc > 1 && IS_OPT(argv[1]) && (argv[1][1]==_T('v') || argv[1][1]==_T('V')))
|
||||
{
|
||||
tmpargpos++;
|
||||
if (argv[1][2] <= '2' && argv[1][2] >= '0')
|
||||
if (argv[1][2] <= _T('2') && argv[1][2] >= _T('0'))
|
||||
{
|
||||
no_logo=1;
|
||||
}
|
||||
|
@ -293,12 +296,12 @@ int main(int argc, char **argv)
|
|||
|
||||
if (!no_logo)
|
||||
{
|
||||
if (argc > tmpargpos && IS_OPT(argv[tmpargpos]) && (argv[tmpargpos][1]=='o' || argv[tmpargpos][1]=='O') && argv[tmpargpos][2])
|
||||
if (argc > tmpargpos && IS_OPT(argv[tmpargpos]) && (argv[tmpargpos][1]==_T('o') || argv[tmpargpos][1]==_T('O')) && argv[tmpargpos][2])
|
||||
{
|
||||
g_output=fopen(argv[tmpargpos]+2,"w");
|
||||
g_output=fopen(argv[tmpargpos]+2,_T("w"));
|
||||
if (!g_output)
|
||||
{
|
||||
printf("Error opening output log for writing. Using stdout.\n");
|
||||
printf(_T("Error opening output log for writing. Using stdout.\n"));
|
||||
g_output=stdout;
|
||||
}
|
||||
outputtried=1;
|
||||
|
@ -311,59 +314,59 @@ int main(int argc, char **argv)
|
|||
if (!g_output) g_output=stdout;
|
||||
while (argpos < argc)
|
||||
{
|
||||
if (!strcmp(argv[argpos], "--"))
|
||||
if (!_tcscmp(argv[argpos], _T("--")))
|
||||
in_files=1;
|
||||
else if (IS_OPT(argv[argpos]) && strcmp(argv[argpos], "-") && !in_files)
|
||||
else if (IS_OPT(argv[argpos]) && _tcscmp(argv[argpos], _T("-")) && !in_files)
|
||||
{
|
||||
if ((argv[argpos][1]=='D' || argv[argpos][1]=='d') && argv[argpos][2])
|
||||
if ((argv[argpos][1]==_T('D') || argv[argpos][1]==_T('d')) && argv[argpos][2])
|
||||
{
|
||||
char *p=argv[argpos]+2;
|
||||
char *s=strdup(p),*v;
|
||||
TCHAR *p=argv[argpos]+2;
|
||||
TCHAR *s=strdup(p),*v;
|
||||
if (build.display_script)
|
||||
{
|
||||
fprintf(g_output,"Command line defined: \"%s\"\n",p);
|
||||
_ftprintf(g_output,_T("Command line defined: \"%s\"\n"),p);
|
||||
fflush(g_output);
|
||||
}
|
||||
v=strstr(s,"=");
|
||||
v=_tcsstr(s,_T("="));
|
||||
if (v) *v++=0;
|
||||
build.define(s,v?v:"");
|
||||
build.define(s,v?v:_T(""));
|
||||
free(s);
|
||||
}
|
||||
else if ((argv[argpos][1]=='X' || argv[argpos][1]=='x') && argv[argpos][2])
|
||||
else if ((argv[argpos][1]==_T('X') || argv[argpos][1]==_T('x')) && argv[argpos][2])
|
||||
{
|
||||
if (build.process_oneline(argv[argpos]+2,"command line",argpos+1) != PS_OK)
|
||||
if (build.process_oneline(argv[argpos]+2,_T("command line"),argpos+1) != PS_OK)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
cmds_processed++;
|
||||
}
|
||||
else if ((argv[argpos][1]=='O' || argv[argpos][1]=='o') && argv[argpos][2])
|
||||
else if ((argv[argpos][1]==_T('O') || argv[argpos][1]==_T('o')) && argv[argpos][2])
|
||||
{
|
||||
if (!outputtried)
|
||||
{
|
||||
g_output=fopen(argv[argpos]+2,"w");
|
||||
g_output=fopen(argv[argpos]+2,_T("w"));
|
||||
if (!g_output)
|
||||
{
|
||||
if (build.display_errors) printf("Error opening output log for writing. Using stdout.\n");
|
||||
if (build.display_errors) _tprintf(_T("Error opening output log for writing. Using stdout.\n"));
|
||||
g_output=stdout;
|
||||
}
|
||||
outputtried=1;
|
||||
}
|
||||
}
|
||||
else if (!stricmp(&argv[argpos][1],"NOCD")) do_cd=0;
|
||||
else if ((argv[argpos][1] == 'V' || argv[argpos][1] == 'v') &&
|
||||
argv[argpos][2] >= '0' && argv[argpos][2] <= '4' && !argv[argpos][3])
|
||||
else if (!stricmp(&argv[argpos][1],_T("NOCD"))) do_cd=0;
|
||||
else if ((argv[argpos][1] == _T('V') || argv[argpos][1] == _T('v')) &&
|
||||
argv[argpos][2] >= _T('0') && argv[argpos][2] <= _T('4') && !argv[argpos][3])
|
||||
{
|
||||
int v=argv[argpos][2]-'0';
|
||||
int v=argv[argpos][2]-_T('0');
|
||||
build.display_script=v>3;
|
||||
build.display_info=v>2;
|
||||
build.display_warnings=v>1;
|
||||
build.display_errors=v>0;
|
||||
g_display_errors=build.display_errors;
|
||||
}
|
||||
else if (!stricmp(&argv[argpos][1],"NOCONFIG")) g_noconfig=1;
|
||||
else if (!stricmp(&argv[argpos][1],"PAUSE")) g_dopause=1;
|
||||
else if (!stricmp(&argv[argpos][1],"LICENSE"))
|
||||
else if (!stricmp(&argv[argpos][1],_T("NOCONFIG"))) g_noconfig=1;
|
||||
else if (!stricmp(&argv[argpos][1],_T("PAUSE"))) g_dopause=1;
|
||||
else if (!stricmp(&argv[argpos][1],_T("LICENSE")))
|
||||
{
|
||||
if (build.display_info)
|
||||
{
|
||||
|
@ -371,7 +374,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
nousage++;
|
||||
}
|
||||
else if (!stricmp(&argv[argpos][1],"CMDHELP"))
|
||||
else if (!stricmp(&argv[argpos][1],_T("CMDHELP")))
|
||||
{
|
||||
if (argpos < argc-1)
|
||||
build.print_help(argv[++argpos]);
|
||||
|
@ -379,28 +382,28 @@ int main(int argc, char **argv)
|
|||
build.print_help(NULL);
|
||||
nousage++;
|
||||
}
|
||||
else if (!stricmp(&argv[argpos][1],"NOTIFYHWND"))
|
||||
else if (!stricmp(&argv[argpos][1],_T("NOTIFYHWND")))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
build.notify_hwnd=(HWND)atol(argv[++argpos]);
|
||||
build.notify_hwnd=(HWND)_ttol(argv[++argpos]);
|
||||
if (!IsWindow(build.notify_hwnd))
|
||||
build.notify_hwnd=0;
|
||||
#else
|
||||
argpos++;
|
||||
build.warning(OPT_STR "NOTIFYHWND is disabled for non Win32 platforms.");
|
||||
build.warning(OPT_STR _T("NOTIFYHWND is disabled for non Win32 platforms."));
|
||||
#endif
|
||||
}
|
||||
else if (!stricmp(&argv[argpos][1],"HDRINFO"))
|
||||
else if (!stricmp(&argv[argpos][1],_T("HDRINFO")))
|
||||
{
|
||||
print_stub_info(build);
|
||||
nousage++;
|
||||
}
|
||||
else if ((argv[argpos][1]=='P' || argv[argpos][1]=='p') &&
|
||||
argv[argpos][2] >= '0' && argv[argpos][2] <= '5' && !argv[argpos][3])
|
||||
else if ((argv[argpos][1]==_T('P') || argv[argpos][1]==_T('p')) &&
|
||||
argv[argpos][2] >= _T('0') && argv[argpos][2] <= _T('5') && !argv[argpos][3])
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// priority setting added 01-2007 by Comm@nder21
|
||||
int p=argv[argpos][2]-'0';
|
||||
int p=argv[argpos][2]-_T('0');
|
||||
HANDLE hProc = GetCurrentProcess();
|
||||
|
||||
struct
|
||||
|
@ -422,10 +425,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if (p == 5)
|
||||
build.warning("makensis is running in REALTIME priority mode!");
|
||||
build.warning(_T("makensis is running in REALTIME priority mode!"));
|
||||
|
||||
#else
|
||||
build.warning(OPT_STR "Px is disabled for non Win32 platforms.");
|
||||
build.warning(OPT_STR _T("Px is disabled for non Win32 platforms."));
|
||||
#endif
|
||||
}
|
||||
else break;
|
||||
|
@ -433,13 +436,13 @@ int main(int argc, char **argv)
|
|||
else
|
||||
{
|
||||
files_processed++;
|
||||
if (!strcmp(argv[argpos],"-") && !in_files)
|
||||
if (!_tcscmp(argv[argpos],_T("-")) && !in_files)
|
||||
g_dopause=0;
|
||||
if (!g_noconfig)
|
||||
{
|
||||
g_noconfig=1;
|
||||
string main_conf;
|
||||
char* env_var = getenv("NSISCONFDIR");
|
||||
tstring main_conf;
|
||||
TCHAR* env_var = _tgetenv(_T("NSISCONFDIR"));
|
||||
if(env_var == NULL)
|
||||
#ifndef NSIS_CONFIG_CONST_DATA_PATH
|
||||
main_conf = get_dir_name(get_executable_dir(argv[0]));
|
||||
|
@ -448,18 +451,18 @@ int main(int argc, char **argv)
|
|||
#endif
|
||||
else main_conf = env_var;
|
||||
main_conf += PLATFORM_PATH_SEPARATOR_STR;
|
||||
main_conf += "nsisconf.nsh";
|
||||
main_conf += _T("nsisconf.nsh");
|
||||
if (process_config(build, main_conf))
|
||||
return 1;
|
||||
|
||||
string home_conf = get_home();
|
||||
if (home_conf != "")
|
||||
tstring home_conf = get_home();
|
||||
if (home_conf != _T(""))
|
||||
{
|
||||
home_conf += PLATFORM_PATH_SEPARATOR_STR;
|
||||
#ifdef _WIN32
|
||||
home_conf += "nsisconf.nsh";
|
||||
home_conf += _T("nsisconf.nsh");
|
||||
#else
|
||||
home_conf += ".nsisconf.nsh";
|
||||
home_conf += _T(".nsisconf.nsh");
|
||||
#endif
|
||||
if (process_config(build, home_conf))
|
||||
return 1;
|
||||
|
@ -467,26 +470,26 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
{
|
||||
char sfile[1024];
|
||||
if (!strcmp(argv[argpos],"-") && !in_files)
|
||||
TCHAR sfile[1024];
|
||||
if (!_tcscmp(argv[argpos],_T("-")) && !in_files)
|
||||
{
|
||||
fp=stdin;
|
||||
strcpy(sfile,"stdin");
|
||||
_tcscpy(sfile,_T("stdin"));
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(sfile,argv[argpos]);
|
||||
fp=fopen(sfile,"rt");
|
||||
_tcscpy(sfile,argv[argpos]);
|
||||
fp=fopen(sfile,_T("rt"));
|
||||
if (!fp)
|
||||
{
|
||||
sprintf(sfile,"%s.nsi",argv[argpos]);
|
||||
fp=fopen(sfile,"rt");
|
||||
_stprintf(sfile,_T("%s.nsi"),argv[argpos]);
|
||||
fp=fopen(sfile,_T("rt"));
|
||||
if (!fp)
|
||||
{
|
||||
if (build.display_errors)
|
||||
{
|
||||
sfile[strlen(sfile)-4]=0;
|
||||
fprintf(g_output,"Can't open script \"%s\"\n",sfile);
|
||||
sfile[_tcsclen(sfile)-4]=0;
|
||||
_ftprintf(g_output,_T("Can't open script \"%s\"\n"),sfile);
|
||||
fflush(g_output);
|
||||
}
|
||||
return 1;
|
||||
|
@ -494,7 +497,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
if (do_cd)
|
||||
{
|
||||
string script_file = string(sfile);
|
||||
tstring script_file = tstring(sfile);
|
||||
if (change_to_script_dir(build, script_file))
|
||||
return 1;
|
||||
}
|
||||
|
@ -503,7 +506,7 @@ int main(int argc, char **argv)
|
|||
if (build.display_script)
|
||||
{
|
||||
build.notify(MAKENSIS_NOTIFY_SCRIPT,sfile);
|
||||
fprintf(g_output,"Processing script file: \"%s\"\n",sfile);
|
||||
_ftprintf(g_output,_T("Processing script file: \"%s\"\n"),sfile);
|
||||
fflush(g_output);
|
||||
}
|
||||
int ret=build.process_script(fp,sfile);
|
||||
|
@ -513,7 +516,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
if (build.display_errors)
|
||||
{
|
||||
fprintf(g_output,"Error in script \"%s\" on line %d -- aborting creation process\n",sfile,build.linecnt);
|
||||
_ftprintf(g_output,_T("Error in script \"%s\" on line %d -- aborting creation process\n"),sfile,build.linecnt);
|
||||
fflush(g_output);
|
||||
}
|
||||
return 1;
|
||||
|
@ -534,10 +537,10 @@ int main(int argc, char **argv)
|
|||
|
||||
if (build.display_info)
|
||||
{
|
||||
fprintf(g_output,"\nProcessed ");
|
||||
if (files_processed) fprintf(g_output,"%d file%s, ",files_processed,files_processed==1?"":"s");
|
||||
if (cmds_processed) fprintf(g_output,"%d command line command%s, ",cmds_processed,cmds_processed==1?"":"s");
|
||||
fprintf(g_output,"writing output:\n");
|
||||
_ftprintf(g_output,_T("\nProcessed "));
|
||||
if (files_processed) _ftprintf(g_output,_T("%d file%s, "),files_processed,files_processed==1?_T(""):_T("s"));
|
||||
if (cmds_processed) _ftprintf(g_output,_T("%d command line command%s, "),cmds_processed,cmds_processed==1?_T(""):_T("s"));
|
||||
_ftprintf(g_output,_T("writing output:\n"));
|
||||
fflush(g_output);
|
||||
}
|
||||
|
||||
|
@ -545,7 +548,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
if (build.display_errors)
|
||||
{
|
||||
fprintf(g_output,"Error - aborting creation process\n");
|
||||
_ftprintf(g_output,_T("Error - aborting creation process\n"));
|
||||
fflush(g_output);
|
||||
}
|
||||
return 1;
|
||||
|
|
|
@ -12,11 +12,16 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/22/2007
|
||||
*/
|
||||
|
||||
#include "Platform.h"
|
||||
#include "manifest.h"
|
||||
#include <nsis-version.h>
|
||||
#include "tstring.h"
|
||||
|
||||
// Jim Park: The manifest must stay UTF-8. Do not convert.
|
||||
|
||||
namespace manifest
|
||||
{
|
||||
|
|
|
@ -12,12 +12,14 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/22/2007
|
||||
*/
|
||||
|
||||
#ifndef ___MANIFEST_H___
|
||||
#define ___MANIFEST_H___
|
||||
|
||||
#include <string>
|
||||
#include "tstring.h"
|
||||
|
||||
namespace manifest
|
||||
{
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
*/
|
||||
|
||||
#include "mmap.h"
|
||||
|
||||
#include <cstdio> // for f*
|
||||
#include <cassert> // for assert
|
||||
#include "tchar.h"
|
||||
#ifndef _WIN32
|
||||
# include <sys/types.h> // for freebsd
|
||||
# include <sys/mman.h>
|
||||
|
@ -146,10 +146,10 @@ void MMapFile::resize(int newsize)
|
|||
#ifdef _WIN32
|
||||
if (m_hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
char buf[MAX_PATH], buf2[MAX_PATH];
|
||||
TCHAR buf[MAX_PATH], buf2[MAX_PATH];
|
||||
|
||||
GetTempPath(MAX_PATH, buf);
|
||||
GetTempFileName(buf, "nsd", 0, buf2);
|
||||
GetTempFileName(buf, _T("nsd"), 0, buf2);
|
||||
|
||||
m_hFile = CreateFile(
|
||||
buf2,
|
||||
|
@ -219,7 +219,7 @@ void MMapFile::resize(int newsize)
|
|||
extern void quit(); extern int g_display_errors;
|
||||
if (g_display_errors)
|
||||
{
|
||||
fprintf(g_output,"\nInternal compiler error #12345: error creating mmap the size of %d.\n", m_iSize);
|
||||
_ftprintf(g_output,_T("\nInternal compiler error #12345: error creating mmap the size of %d.\n"), m_iSize);
|
||||
fflush(g_output);
|
||||
}
|
||||
quit();
|
||||
|
@ -252,7 +252,7 @@ void *MMapFile::get(int offset, int *sizep) const
|
|||
extern void quit(); extern int g_display_errors;
|
||||
if (g_display_errors)
|
||||
{
|
||||
fprintf(g_output,"\nInternal compiler error #12345: error mmapping file (%d, %d) is out of range.\n", offset, size);
|
||||
_ftprintf(g_output,_T("\nInternal compiler error #12345: error mmapping file (%d, %d) is out of range.\n"), offset, size);
|
||||
fflush(g_output);
|
||||
}
|
||||
quit();
|
||||
|
@ -279,7 +279,7 @@ void *MMapFile::get(int offset, int *sizep) const
|
|||
extern void quit(); extern int g_display_errors;
|
||||
if (g_display_errors)
|
||||
{
|
||||
fprintf(g_output,"\nInternal compiler error #12345: error mmapping datablock to %d.\n", size);
|
||||
_ftprintf(g_output,_T("\nInternal compiler error #12345: error mmapping datablock to %d.\n"), size);
|
||||
fflush(g_output);
|
||||
}
|
||||
quit();
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/13/2007
|
||||
*/
|
||||
|
||||
#ifndef __MMAP_H_
|
||||
|
@ -51,20 +53,108 @@ class MMapFile : public IMMap
|
|||
MMapFile();
|
||||
virtual ~MMapFile();
|
||||
|
||||
/**
|
||||
* Closes the memory map and the file handle.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Set read-only.
|
||||
* @param bRO Boolean value to set read-only.
|
||||
*/
|
||||
void setro(BOOL bRO);
|
||||
|
||||
/**
|
||||
* Creates the memory mapping object of the file with a mapping size.
|
||||
*
|
||||
* @param hFile The handle to the opened file.
|
||||
* @param dwSize The size of the memory mapped object. You cannot set
|
||||
* this value to zero like with CreateFileMapping() because it will
|
||||
* immediately return. Most likely, you want to set it to the size
|
||||
* of the file unless you want to only map a part of the file on
|
||||
* purpose.
|
||||
* @return Returns 1 on success, 0 on failure.
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
int setfile(HANDLE hFile, DWORD dwSize);
|
||||
#else
|
||||
int setfile(int hFile, DWORD dwSize);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Resize the memory mapping of the file. Used when the filesize has
|
||||
* changed. When setfile has not been called previously, then it will
|
||||
* create a temporary file and use it to create a memory map. This is
|
||||
* what's used by MMapBuf to create a Memory Mapped Buffer.
|
||||
*
|
||||
* @param newsize The new size of the file. Limited to 32-bits.
|
||||
*/
|
||||
void resize(int newsize);
|
||||
|
||||
/**
|
||||
* Size of the memory map object.
|
||||
*/
|
||||
int getsize() const;
|
||||
|
||||
/**
|
||||
* Set the memory map to a particular offset in the file and return the
|
||||
* memory mapped pointer to it. Internally it may have to align to a
|
||||
* certain page size.
|
||||
*
|
||||
* @param offset The offset from the beginning of the file.
|
||||
* @param size The size of the memory map window.
|
||||
*/
|
||||
void *get(int offset, int size) const;
|
||||
|
||||
/**
|
||||
* Set the memory map to a particular offset in the file and return the
|
||||
* memory mapped pointer to it. Internally it may have to align to a
|
||||
* certain page size.
|
||||
*
|
||||
* @param offset The offset from the beginning of the file.
|
||||
* @param sizep [in/out] The size of the memory map window. (In non-Win32
|
||||
* systems, the new size is written back out.)
|
||||
*/
|
||||
void *get(int offset, int *sizep) const;
|
||||
|
||||
/**
|
||||
* This function sets memory map and just hands you the pointer and
|
||||
* it expects you to manage it. So you need to call release(pView, size)
|
||||
* yourself or you will leak memory.
|
||||
*
|
||||
* Warning: This breaks encapsulation. The user should probably just
|
||||
* create a new map.
|
||||
*
|
||||
* @param offset The offset from the beginning of the file.
|
||||
* @param size The size of the memory map window.
|
||||
*/
|
||||
void *getmore(int offset, int size) const;
|
||||
|
||||
/**
|
||||
* Releases the memory map currently being used. Calls UnMapViewOfFile().
|
||||
*/
|
||||
void release();
|
||||
|
||||
/**
|
||||
* Releases the memory map pointed to by pView. In Win32 systems
|
||||
* eventually calls UnmapViewOfFile(). Interestingly, the function
|
||||
* tries to align the pointer value back to the beginning of the
|
||||
* paged memory which is necessary because of the way get() works.
|
||||
*
|
||||
* This looks like it should only be used in conjunction with
|
||||
* getmore(). Otherwise, just call release().
|
||||
*
|
||||
* @param pView The pointer to somewhere in a MemMapped object.
|
||||
* @param size The size of the object. Used only in non-Win32 systems.
|
||||
*/
|
||||
void release(void *pView, int size);
|
||||
|
||||
/**
|
||||
* Flushes the contents of the current memory map to disk. Set size to 0
|
||||
* if you want to flush everything.
|
||||
*
|
||||
* @param num The number of bytes to flush. 0 for everything.
|
||||
*/
|
||||
void flush(int num);
|
||||
|
||||
private:
|
||||
|
@ -109,6 +199,15 @@ class MMapFake : public IMMap
|
|||
int m_iSize;
|
||||
};
|
||||
|
||||
/**
|
||||
* A data structure that can be used to create a scratch file to do
|
||||
* work in. When it's smaller than 16mb, it's all in memory using the
|
||||
* GrowBuf class. But when it gets biggered than 16mb, then it uses
|
||||
* the MMapFile class to create a memory map to a temporary file and
|
||||
* then uses it. This reduces memory overhead of the installer.
|
||||
*
|
||||
* This is sort of our virtual memory manager.
|
||||
*/
|
||||
class MMapBuf : public IGrowBuf, public IMMap
|
||||
{
|
||||
private: // don't copy instances
|
||||
|
|
2232
Source/script.cpp
2232
Source/script.cpp
File diff suppressed because it is too large
Load diff
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "strlist.h"
|
||||
|
||||
int StringList::add(const char *str, int case_sensitive)
|
||||
int StringList::add(const TCHAR *str, int case_sensitive)
|
||||
{
|
||||
int a=find(str,case_sensitive);
|
||||
if (a >= 0 && case_sensitive!=-1) return a;
|
||||
|
@ -24,9 +24,9 @@ int StringList::add(const char *str, int case_sensitive)
|
|||
}
|
||||
|
||||
// use 2 for case sensitive end-of-string matches too
|
||||
int StringList::find(const char *str, int case_sensitive, int *idx/*=NULL*/) const // returns -1 if not found
|
||||
int StringList::find(const TCHAR *str, int case_sensitive, int *idx/*=NULL*/) const // returns -1 if not found
|
||||
{
|
||||
const char *s=get();
|
||||
const TCHAR *s=get();
|
||||
int ml=getlen();
|
||||
int offs=0;
|
||||
if (idx) *idx=0;
|
||||
|
@ -51,7 +51,7 @@ int StringList::find(const char *str, int case_sensitive, int *idx/*=NULL*/) con
|
|||
|
||||
void StringList::delbypos(int pos)
|
||||
{
|
||||
char *s=(char*)gr.get();
|
||||
TCHAR *s=(TCHAR*)gr.get();
|
||||
int len=strlen(s+pos)+1;
|
||||
if (pos+len < gr.getlen()) memcpy(s+pos,s+pos+len,gr.getlen()-(pos+len));
|
||||
gr.resize(gr.getlen()-len);
|
||||
|
@ -59,7 +59,7 @@ void StringList::delbypos(int pos)
|
|||
|
||||
int StringList::idx2pos(int idx) const
|
||||
{
|
||||
char *s=(char*)gr.get();
|
||||
TCHAR *s=(TCHAR*)gr.get();
|
||||
int offs=0;
|
||||
int cnt=0;
|
||||
if (idx>=0) while (offs < gr.getlen())
|
||||
|
@ -72,7 +72,7 @@ int StringList::idx2pos(int idx) const
|
|||
|
||||
int StringList::getnum() const
|
||||
{
|
||||
char *s=(char*)gr.get();
|
||||
TCHAR *s=(TCHAR*)gr.get();
|
||||
int ml=gr.getlen();
|
||||
int offs=0;
|
||||
int idx=0;
|
||||
|
@ -84,9 +84,9 @@ int StringList::getnum() const
|
|||
return idx;
|
||||
}
|
||||
|
||||
const char *StringList::get() const
|
||||
const TCHAR *StringList::get() const
|
||||
{
|
||||
return (const char*)gr.get();
|
||||
return (const TCHAR*)gr.get();
|
||||
}
|
||||
|
||||
int StringList::getlen() const
|
||||
|
@ -108,7 +108,7 @@ DefineList::~DefineList()
|
|||
}
|
||||
}
|
||||
|
||||
int DefineList::add(const char *name, const char *value/*=""*/)
|
||||
int DefineList::add(const TCHAR *name, const TCHAR *value/*=_T("")*/)
|
||||
{
|
||||
int pos=SortedStringList<struct define>::add(name);
|
||||
if (pos == -1)
|
||||
|
@ -116,8 +116,8 @@ int DefineList::add(const char *name, const char *value/*=""*/)
|
|||
return 1;
|
||||
}
|
||||
|
||||
char **newvalue=&(((struct define*)gr.get())[pos].value);
|
||||
*newvalue=(char*)malloc(strlen(value)+1);
|
||||
TCHAR **newvalue=&(((struct define*)gr.get())[pos].value);
|
||||
*newvalue=(TCHAR*)malloc(strlen(value)+1);
|
||||
if (!(*newvalue))
|
||||
{
|
||||
extern FILE *g_output;
|
||||
|
@ -125,7 +125,7 @@ int DefineList::add(const char *name, const char *value/*=""*/)
|
|||
extern void quit();
|
||||
if (g_display_errors)
|
||||
{
|
||||
fprintf(g_output,"\nInternal compiler error #12345: GrowBuf realloc/malloc(%lu) failed.\n",(unsigned long)strlen(value)+1);
|
||||
fprintf(g_output,_T("\nInternal compiler error #12345: GrowBuf realloc/malloc(%lu) failed.\n"),(unsigned long)strlen(value)+1);
|
||||
fflush(g_output);
|
||||
}
|
||||
quit();
|
||||
|
@ -134,7 +134,7 @@ int DefineList::add(const char *name, const char *value/*=""*/)
|
|||
return 0;
|
||||
}
|
||||
|
||||
char *DefineList::find(const char *name)
|
||||
TCHAR *DefineList::find(const TCHAR *name)
|
||||
{
|
||||
int v=SortedStringList<struct define>::find(name);
|
||||
if (v==-1)
|
||||
|
@ -145,7 +145,7 @@ char *DefineList::find(const char *name)
|
|||
}
|
||||
|
||||
// returns 0 on success, 1 otherwise
|
||||
int DefineList::del(const char *str)
|
||||
int DefineList::del(const TCHAR *str)
|
||||
{
|
||||
int pos=SortedStringList<struct define>::find(str);
|
||||
if (pos==-1) return 1;
|
||||
|
@ -162,14 +162,14 @@ int DefineList::getnum()
|
|||
return gr.getlen()/sizeof(define);
|
||||
}
|
||||
|
||||
char *DefineList::getname(int num)
|
||||
TCHAR *DefineList::getname(int num)
|
||||
{
|
||||
if ((unsigned int)getnum() <= (unsigned int)num)
|
||||
return 0;
|
||||
return ((struct define*)gr.get())[num].name;
|
||||
}
|
||||
|
||||
char *DefineList::getvalue(int num)
|
||||
TCHAR *DefineList::getvalue(int num)
|
||||
{
|
||||
if ((unsigned int)getnum() <= (unsigned int)num)
|
||||
return 0;
|
||||
|
@ -180,16 +180,16 @@ char *DefineList::getvalue(int num)
|
|||
// FastStringList
|
||||
// ==============
|
||||
|
||||
int FastStringList::add(const char *name, int case_sensitive/*=0*/)
|
||||
int FastStringList::add(const TCHAR *name, int case_sensitive/*=0*/)
|
||||
{
|
||||
int pos = SortedStringListND<struct string_t>::add(name, case_sensitive);
|
||||
if (pos == -1) return -1;
|
||||
return ((struct string_t*)gr.get())[pos].name;
|
||||
}
|
||||
|
||||
char *FastStringList::get() const
|
||||
TCHAR *FastStringList::get() const
|
||||
{
|
||||
return (char*)strings.get();
|
||||
return (TCHAR*)strings.get();
|
||||
}
|
||||
|
||||
int FastStringList::getlen() const
|
||||
|
|
347
Source/strlist.h
347
Source/strlist.h
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support and Doxygen comments by Jim Park -- 07/27/2007
|
||||
*/
|
||||
|
||||
#ifndef _STRLIST_H_
|
||||
|
@ -20,8 +22,14 @@
|
|||
#include "Platform.h"
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
#include "tchar.h"
|
||||
#include "growbuf.h"
|
||||
|
||||
/**
|
||||
* Implements a list of strings mapped into a straight buffer. It is
|
||||
* virtually always O(n) to do any basic operations on this thing. Very
|
||||
* memory efficient but very slow performance.
|
||||
*/
|
||||
class StringList
|
||||
{
|
||||
private: // don't copy instances
|
||||
|
@ -32,23 +40,99 @@ public:
|
|||
StringList() {}
|
||||
~StringList() {}
|
||||
|
||||
int add(const char *str, int case_sensitive);
|
||||
// use 2 for case sensitive end-of-string matches too
|
||||
int find(const char *str, int case_sensitive, int *idx=NULL) const; // returns -1 if not found
|
||||
/**
|
||||
* Adds a string to the StringList. If the string already exists in the
|
||||
* list, then it just returns the index of the found string.
|
||||
*
|
||||
* @param str String to add.
|
||||
*
|
||||
* @param case_sensitive If 0, search for whole string case insensitively.
|
||||
* If 1, then search for whole string case sensitively. If 2, then search
|
||||
* for just the end of the string match case sensitively. Basically it's
|
||||
* like searching for regexp('str$') in the list of string. If -1, then it
|
||||
* adds the string regardless of whether there is a match or not!
|
||||
*
|
||||
* @return the index to the string in TCHARs.
|
||||
*/
|
||||
int add(const TCHAR *str, int case_sensitive);
|
||||
|
||||
/**
|
||||
* Search the StrinList for a string. If the string already exists in the
|
||||
* list then it returns the index of the found string. Returns -1 on
|
||||
* failure.
|
||||
*
|
||||
* @param str String to search for.
|
||||
*
|
||||
* @param case_sensitive If 0, search for whole string case insensitively.If
|
||||
* 1, then search for whole string case <b>sensitively</b>. If 2, then
|
||||
* search for just the <b>end of the string match</b>, case sensitively.
|
||||
* Basically it's like searching for regexp('str$') in the list of string.
|
||||
*
|
||||
* @param idx If not NULL, the *idx is set to the cardinal number of the
|
||||
* string. In other words, it tells you which nth string it is in the
|
||||
* list.
|
||||
*
|
||||
* @return the TCHAR index to the string (not necessarily the byte positional
|
||||
* offset). -1 if not found.
|
||||
*/
|
||||
int find(const TCHAR *str, int case_sensitive, int *idx=NULL) const; // returns -1 if not found
|
||||
|
||||
/**
|
||||
* Delete the string at the positional index.
|
||||
*
|
||||
* @param pos The number of TCHARS to count from the beginning of the buffer
|
||||
* before the start of the string.
|
||||
*/
|
||||
void delbypos(int pos);
|
||||
|
||||
/**
|
||||
* Converts the string index to the positional TCHAR index. For example,
|
||||
* it gives the answer to which TCHAR position is the beginning of the
|
||||
* nth string in the list?
|
||||
*
|
||||
* @param idx The string index.
|
||||
*/
|
||||
int idx2pos(int idx) const;
|
||||
|
||||
/**
|
||||
* Get the count of the number of strings in the list.
|
||||
* @return the number of string in the list.
|
||||
*/
|
||||
int getnum() const;
|
||||
const char *get() const;
|
||||
|
||||
/**
|
||||
* Get the buffer straight as a const TCHAR pointer. Very unwise to use.
|
||||
* @return gr.m_s cast as a TCHAR*.
|
||||
*/
|
||||
const TCHAR *get() const;
|
||||
|
||||
/**
|
||||
* Get the buffer size in bytes.
|
||||
* @return The buffer size in bytes.
|
||||
*/
|
||||
int getlen() const;
|
||||
|
||||
private:
|
||||
GrowBuf gr;
|
||||
};
|
||||
|
||||
/**
|
||||
* This class maintains a list of T types in a GrowBuf sorted by T.name which
|
||||
* is assumed to be a string (TCHAR*). So it's really sort of a
|
||||
* map<TCHAR*, X> where X is whatever else is defined in T. But T must define
|
||||
* a TCHAR* name.
|
||||
*
|
||||
* The T struct should have the 'name' as the first element in its list of
|
||||
* members. Otherwise, all kinds of bad things will happen.
|
||||
*/
|
||||
template <class T>
|
||||
class SortedStringList
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Jim Park: Note that SortedStringList actually <b>owns</b> T.name.
|
||||
* Yes, this violates all kinds of encapsulation ideas.
|
||||
*/
|
||||
virtual ~SortedStringList()
|
||||
{
|
||||
T *s=(T*)gr.get();
|
||||
|
@ -59,13 +143,22 @@ class SortedStringList
|
|||
}
|
||||
}
|
||||
|
||||
// returns -1 when name already exists and pos if added
|
||||
int add(const char *name, int case_sensitive=0)
|
||||
/**
|
||||
* This function adds a new T struct with a copy of TCHAR *name into
|
||||
* T.name. But adds it into a sorted position. All calls to
|
||||
* add must be done with the same value for case_sensitive or you
|
||||
* can get random behavior.
|
||||
*
|
||||
* @param name The name which is the "key" to finding the instance of T.
|
||||
* @param case_sensitive 1 means case sensitive, 0 insensitive.
|
||||
* @return Returns -1 when name already exists and pos if added.
|
||||
*/
|
||||
int add(const TCHAR *name, int case_sensitive=0)
|
||||
{
|
||||
T newstruct={0,};
|
||||
int pos=find(name,case_sensitive,1);
|
||||
if (pos==-1) return -1;
|
||||
newstruct.name=(char*)malloc(strlen(name)+1);
|
||||
newstruct.name=(TCHAR*)malloc((_tcsclen(name)+1)*sizeof(TCHAR));
|
||||
if (!newstruct.name)
|
||||
{
|
||||
extern FILE *g_output;
|
||||
|
@ -73,12 +166,12 @@ class SortedStringList
|
|||
extern void quit();
|
||||
if (g_display_errors)
|
||||
{
|
||||
fprintf(g_output,"\nInternal compiler error #12345: GrowBuf realloc/malloc(%lu) failed.\n",(unsigned long)strlen(name)+1);
|
||||
_ftprintf(g_output,_T("\nInternal compiler error #12345: GrowBuf realloc/malloc(%lu) failed.\n"),(unsigned long)((_tcsclen(name)+1)*sizeof(TCHAR)));
|
||||
fflush(g_output);
|
||||
}
|
||||
quit();
|
||||
}
|
||||
strcpy(newstruct.name,name);
|
||||
_tcscpy(newstruct.name,name);
|
||||
gr.add(&newstruct,sizeof(T));
|
||||
|
||||
T *s=(T*)gr.get();
|
||||
|
@ -88,9 +181,23 @@ class SortedStringList
|
|||
return pos;
|
||||
}
|
||||
|
||||
// returns -1 if not found, position if found
|
||||
// if returnbestpos=1 returns -1 if found, best pos to insert if not found
|
||||
int find(const char *str, int case_sensitive=0, int returnbestpos=0)
|
||||
/**
|
||||
* This function does a binary search for the T in the buffer that
|
||||
* contains str as its T.name. It then returns the position of the found
|
||||
* T, not in its byte position, but its T position (valid offset to T*).
|
||||
*
|
||||
* @param str The string to search for in T.name.
|
||||
*
|
||||
* @param case_sensitive If 1, do a case sensitive search, otherwise, case insensitive.
|
||||
*
|
||||
* @param returnbestpos If 1, then the function changes behavior. Instead
|
||||
* of looking for the string str in the Ts, it tries to find the best
|
||||
* sorted position to insert str into the buffer.
|
||||
*
|
||||
* @return Returns -1 if not found, position if found. If returnbestpos=1
|
||||
* returns -1 if found, best pos to insert if not found
|
||||
*/
|
||||
int find(const TCHAR *str, int case_sensitive=0, int returnbestpos=0)
|
||||
{
|
||||
T *data=(T *)gr.get();
|
||||
int ul=gr.getlen()/sizeof(T);
|
||||
|
@ -101,7 +208,7 @@ class SortedStringList
|
|||
{
|
||||
int res;
|
||||
if (case_sensitive)
|
||||
res=strcmp(str, data[nextpos].name);
|
||||
res=_tcscmp(str, data[nextpos].name);
|
||||
else
|
||||
res=stricmp(str, data[nextpos].name);
|
||||
if (res==0) return returnbestpos ? -1 : nextpos;
|
||||
|
@ -113,8 +220,13 @@ class SortedStringList
|
|||
return returnbestpos ? nextpos : -1;
|
||||
}
|
||||
|
||||
// returns 0 on success, 1 otherwise
|
||||
int del(const char *str, int case_sensitive=0)
|
||||
/**
|
||||
* This function looks for str in T.name and deletes the T in the
|
||||
* buffer.
|
||||
*
|
||||
* @return Returns 0 on success, 1 on failure.
|
||||
*/
|
||||
int del(const TCHAR *str, int case_sensitive=0)
|
||||
{
|
||||
int pos=find(str, case_sensitive);
|
||||
if (pos==-1) return 1;
|
||||
|
@ -124,6 +236,12 @@ class SortedStringList
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a T position, it deletes it from the buffer. It will
|
||||
* move the rest of the Ts to fill its position.
|
||||
*
|
||||
* @param pos The position of the target for deletion in T* offsets.
|
||||
*/
|
||||
void delbypos(int pos)
|
||||
{
|
||||
T *db=(T *)gr.get();
|
||||
|
@ -138,6 +256,21 @@ class SortedStringList
|
|||
|
||||
#define mymin(x, y) ((x < y) ? x : y)
|
||||
|
||||
/**
|
||||
* This class maintains a list of T types in a GrowBuf sorted by T.name which
|
||||
* is assumed to be an index into m_strings. So it's really sort of a
|
||||
* map<TCHAR*, X> where X is whatever else is defined in T. But T must define
|
||||
* a int name.
|
||||
*
|
||||
* The T struct should have the 'name' as the first element in its list of
|
||||
* members. Otherwise, all kinds of bad things will happen.
|
||||
*
|
||||
* This version does not have a delete function, hence the ND designation.
|
||||
* Also, because nothing is malloc'ed and free'd, this structure can be
|
||||
* placed in a single flat buffer. (Of course, T itself can be holding
|
||||
* pointers to things on the heap, which this structure does not
|
||||
* disallow explicitly.)
|
||||
*/
|
||||
template <class T>
|
||||
class SortedStringListND // no delete - can be placed in GrowBuf
|
||||
{
|
||||
|
@ -145,12 +278,27 @@ class SortedStringListND // no delete - can be placed in GrowBuf
|
|||
SortedStringListND() { }
|
||||
virtual ~SortedStringListND() { }
|
||||
|
||||
// returns -1 when name already exists and pos if added
|
||||
int add(const char *name, int case_sensitive=0, int alwaysreturnpos=0)
|
||||
/**
|
||||
* Adds name into the list of sorted strings.
|
||||
*
|
||||
* @param name String to store.
|
||||
* @param case_sensitive Look for string case sensitively. Default is 0.
|
||||
* @param alwaysreturnpos Always return the position regardless of whether
|
||||
* name was inserted into the list or not. The default is 0.
|
||||
*
|
||||
* @return Returns -1 when name already exists, otherwise the T offset
|
||||
* into which the struct was stored in m_gr. If alwaysreturnpos
|
||||
* is true, then it will return the byte offset regardless of whether
|
||||
* the string was found.
|
||||
*/
|
||||
int add(const TCHAR *name, int case_sensitive=0, int alwaysreturnpos=0)
|
||||
{
|
||||
int where=0;
|
||||
T newstruct={0,};
|
||||
|
||||
// Find the best position to insert.
|
||||
int pos=find(name,-1,case_sensitive,1,&where);
|
||||
|
||||
if (pos==-1) return alwaysreturnpos ? where : -1;
|
||||
newstruct.name=strings.add(name,strlen(name)+1);
|
||||
|
||||
|
@ -162,10 +310,47 @@ class SortedStringListND // no delete - can be placed in GrowBuf
|
|||
return pos;
|
||||
}
|
||||
|
||||
// returns -1 if not found, position if found
|
||||
// if returnbestpos=1 returns -1 if found, best pos to insert if not found
|
||||
// if n_chars equal to -1 all string is tested
|
||||
int find(const char *str, int n_chars=-1, int case_sensitive=0, int returnbestpos=0, int *where=0)
|
||||
/**
|
||||
* This function looks for the string str, in T.name in the buffer m_gr.
|
||||
* If it finds it, it returns the position found. Otherwise, it returns
|
||||
* -1.
|
||||
*
|
||||
* This behavior changes when returnbestpos == 1. In this case,
|
||||
* it will do the reverse. It will return -1 when it is found, noting
|
||||
* that there is no good place to put this duplicate string. If it
|
||||
* is <b>not</b> found, it returns the position where it ought to be
|
||||
* placed.
|
||||
*
|
||||
* When case_sensitive == -1 and returnbestpos == 1, then when the string
|
||||
* is found, it returns
|
||||
* the position of the string so that one can overwrite it. Very strange
|
||||
* special case behavior that I'm not sure if anyone actually uses.
|
||||
*
|
||||
* @param str The key string to search for.
|
||||
*
|
||||
* @param n_chars The number of characters to compare. Use -1 to match
|
||||
* the entire string.
|
||||
*
|
||||
* @param case_sensitive 1 = case sensitive, 0 = case insensitive,
|
||||
* -1 is a special case where it is case sensitive and overrides the
|
||||
* returnbestpos behavior when the string is found.
|
||||
*
|
||||
* @param returnbestpos If 1, then look for the best position to add the
|
||||
* string. If found in the list, return -1.
|
||||
*
|
||||
* @param where When str is found, returns the position of the string.
|
||||
*
|
||||
* @return The position of T where T.name == str. If returnbestpos != 0
|
||||
* then return the best position to add T if not found, otherwise, -1.
|
||||
*/
|
||||
int find
|
||||
(
|
||||
const TCHAR* str, /* key to search for */
|
||||
int n_chars=-1, /* if -1, test the entire string, otherwise just n characters */
|
||||
int case_sensitive=0,
|
||||
int returnbestpos=0, /* if not found, return best pos */
|
||||
int* where=0 /* */
|
||||
)
|
||||
{
|
||||
T *data=(T *)gr.get();
|
||||
int ul=gr.getlen()/sizeof(T);
|
||||
|
@ -175,11 +360,11 @@ class SortedStringListND // no delete - can be placed in GrowBuf
|
|||
while (ul > ll)
|
||||
{
|
||||
int res;
|
||||
const char *pCurr = (char*)strings.get() + data[nextpos].name;
|
||||
const TCHAR *pCurr = (TCHAR*)strings.get() + data[nextpos].name;
|
||||
if (n_chars < 0)
|
||||
{
|
||||
if (case_sensitive)
|
||||
res = strcmp(str, pCurr);
|
||||
res = _tcscmp(str, pCurr);
|
||||
else
|
||||
res = stricmp(str, pCurr);
|
||||
}
|
||||
|
@ -211,11 +396,18 @@ class SortedStringListND // no delete - can be placed in GrowBuf
|
|||
GrowBuf strings;
|
||||
};
|
||||
|
||||
/**
|
||||
* Structure stored by DefineList.
|
||||
*/
|
||||
struct define {
|
||||
char *name;
|
||||
char *value;
|
||||
TCHAR *name; // key
|
||||
TCHAR *value; // value stored
|
||||
};
|
||||
|
||||
/**
|
||||
* DefineList is a specialized version of a SortedStringList
|
||||
* which is like a string to string mapping class.
|
||||
*/
|
||||
class DefineList : public SortedStringList<struct define>
|
||||
{
|
||||
private: // don't copy instances
|
||||
|
@ -223,23 +415,78 @@ class DefineList : public SortedStringList<struct define>
|
|||
void operator=(const DefineList&);
|
||||
|
||||
public:
|
||||
/* Empty default constructor */
|
||||
DefineList() {} // VC6 complains otherwise
|
||||
virtual ~DefineList();
|
||||
|
||||
int add(const char *name, const char *value="");
|
||||
char *find(const char *name);
|
||||
/**
|
||||
* Add a name-value pair, case insensitively.
|
||||
*
|
||||
* @param name The name of the variable or key to search by. In a
|
||||
* std::map, it would be the .first of the pair.
|
||||
*
|
||||
* @param value The value to store. In a std::map, it would be the.second
|
||||
* of the pair.
|
||||
*
|
||||
* @return Returns 0 if successful, 1 if already exists. Errors cause
|
||||
* general program exit with error logging.
|
||||
*/
|
||||
int add(const TCHAR *name, const TCHAR *value=_T(""));
|
||||
|
||||
// returns 0 on success, 1 otherwise
|
||||
int del(const char *str);
|
||||
/**
|
||||
* This function returns the pointer to the .value TCHAR* that corresponds
|
||||
* to the name key.
|
||||
*
|
||||
* @param name The key to search with.
|
||||
*
|
||||
* @return The TCHAR* to the value portion of the define struct. If not
|
||||
* found, returns NULL.
|
||||
*/
|
||||
TCHAR *find(const TCHAR *name);
|
||||
|
||||
/**
|
||||
* This function deletes the define struct corresponding to the key 'str'.
|
||||
*
|
||||
* @return Returns 0 on success, 1 otherwise
|
||||
*/
|
||||
int del(const TCHAR *str);
|
||||
|
||||
/**
|
||||
* This function returns the number of define structs in the sorted array.
|
||||
*/
|
||||
int getnum();
|
||||
char *getname(int num);
|
||||
char *getvalue(int num);
|
||||
|
||||
/**
|
||||
* Get the .name string of the (num)th define struct in the sorted array.
|
||||
*
|
||||
* @return Returns 0 if not found, otherwise the pointer to the .name.
|
||||
*/
|
||||
TCHAR *getname(int num);
|
||||
|
||||
/**
|
||||
* Get the .value string of the (num)th define struct in the sorted array.
|
||||
*
|
||||
* @return Returns 0 if not found, otherwise the pointer to the .value.
|
||||
*/
|
||||
TCHAR *getvalue(int num);
|
||||
};
|
||||
|
||||
/**
|
||||
* Storage unit for FastStringList. Contains the byte offset into m_strings.
|
||||
*/
|
||||
struct string_t {
|
||||
int name;
|
||||
};
|
||||
|
||||
/**
|
||||
* This class uses SortedStringListND to implement a "faster" storage of
|
||||
* strings. It sort of implements a std::set<string> that allows you
|
||||
* to add to the set and check for existence of the set.
|
||||
*
|
||||
* It's only faster in the sense that memory moves now only need to occur
|
||||
* on the array of string_t structs (or pointers) rather than entire
|
||||
* strings. A truly faster implementation would be using a hash table.
|
||||
*/
|
||||
class FastStringList : public SortedStringListND<struct string_t>
|
||||
{
|
||||
private: // don't copy instances
|
||||
|
@ -247,12 +494,46 @@ class FastStringList : public SortedStringListND<struct string_t>
|
|||
void operator=(const FastStringList&);
|
||||
|
||||
public:
|
||||
/* Empty constructor */
|
||||
FastStringList() {} // VC6 complains otherwise
|
||||
|
||||
/* Empty virtual destructor */
|
||||
virtual ~FastStringList() {}
|
||||
|
||||
int add(const char *name, int case_sensitive=0);
|
||||
char *get() const;
|
||||
/**
|
||||
* Adds name to sorted array and returns the TCHAR* offset of m_strings
|
||||
* where it is stored.
|
||||
*
|
||||
* @param name The string to store.
|
||||
*
|
||||
* @param case_sensitive Should we store this case sensitively or not?
|
||||
* Setting case_sensitive to -1 will cause it to be case sensitive and
|
||||
* always overwrite. (Weird bad behavior).
|
||||
*
|
||||
* @return The TCHAR* offset of name in m_string as an int.
|
||||
*/
|
||||
int add(const TCHAR *name, int case_sensitive=0);
|
||||
|
||||
/**
|
||||
* Get the buffer that contains the list of the strings in the order
|
||||
* in which they were added.
|
||||
*
|
||||
* @return The pointer to m_strings as a TCHAR*.
|
||||
*/
|
||||
TCHAR *get() const;
|
||||
|
||||
/**
|
||||
* The size of the collection of m_strings as bytes.
|
||||
*
|
||||
* @return The size of m_strings in bytes.
|
||||
*/
|
||||
int getlen() const;
|
||||
|
||||
/**
|
||||
* The number of strings stored in the sorted array.
|
||||
*
|
||||
* @return The number of strings stored.
|
||||
*/
|
||||
int getnum() const;
|
||||
};
|
||||
|
||||
|
|
210
Source/tchar.h
Normal file
210
Source/tchar.h
Normal file
|
@ -0,0 +1,210 @@
|
|||
/*
|
||||
* tchar.h
|
||||
*
|
||||
* This file is a part of NSIS.
|
||||
*
|
||||
* Copyright (C) 1999-2009 Nullsoft and Contributors
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* For Unicode support by Jim Park -- 08/30/2007
|
||||
*/
|
||||
|
||||
// Jim Park: Only those we use are listed here.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef _UNICODE
|
||||
|
||||
#ifndef _T
|
||||
#define __T(x) L ## x
|
||||
#define _T(x) __T(x)
|
||||
#define _TEXT(x) __T(x)
|
||||
#endif
|
||||
typedef wchar_t TCHAR;
|
||||
typedef wchar_t _TUCHAR;
|
||||
|
||||
// program
|
||||
#define _tmain wmain
|
||||
#define _tWinMain wWinMain
|
||||
#define _tenviron _wenviron
|
||||
#define __targv __wargv
|
||||
|
||||
// printfs
|
||||
#define _ftprintf fwprintf
|
||||
#define _sntprintf _snwprintf
|
||||
#define _stprintf _swprintf
|
||||
#define _tprintf wprintf
|
||||
#define _vftprintf vfwprintf
|
||||
#define _vsntprintf _vsnwprintf
|
||||
#define _vstprintf _vswprintf
|
||||
|
||||
// scanfs
|
||||
#define _tscanf wscanf
|
||||
#define _stscanf swscanf
|
||||
|
||||
// string manipulations
|
||||
#define _tcscat wcscat
|
||||
#define _tcschr wcschr
|
||||
#define _tcsclen wcslen
|
||||
#define _tcscpy wcscpy
|
||||
#define _tcsdup _wcsdup
|
||||
#define _tcslen wcslen
|
||||
#define _tcsnccpy wcsncpy
|
||||
#define _tcsncpy wcsncpy
|
||||
#define _tcsrchr wcsrchr
|
||||
#define _tcsstr wcsstr
|
||||
#define _tcstok wcstok
|
||||
|
||||
// string comparisons
|
||||
#define _tcscmp wcscmp
|
||||
#define _tcsicmp _wcsicmp
|
||||
#define _tcsncicmp _wcsnicmp
|
||||
#define _tcsncmp wcsncmp
|
||||
#define _tcsnicmp _wcsnicmp
|
||||
|
||||
// upper / lower
|
||||
#define _tcslwr _wcslwr
|
||||
#define _tcsupr _wcsupr
|
||||
#define _totlower towlower
|
||||
#define _totupper towupper
|
||||
|
||||
// conversions to numbers
|
||||
#define _tcstoi64 _wcstoi64
|
||||
#define _tcstol wcstol
|
||||
#define _tcstoul wcstoul
|
||||
#define _tstof _wtof
|
||||
#define _tstoi _wtoi
|
||||
#define _tstoi64 _wtoi64
|
||||
#define _ttoi _wtoi
|
||||
#define _ttoi64 _wtoi64
|
||||
#define _ttol _wtol
|
||||
|
||||
// conversion from numbers to strings
|
||||
#define _itot _itow
|
||||
#define _ltot _ltow
|
||||
#define _i64tot _i64tow
|
||||
#define _ui64tot _ui64tow
|
||||
|
||||
// file manipulations
|
||||
#define _tfopen _wfopen
|
||||
#define _topen _wopen
|
||||
#define _tremove _wremove
|
||||
#define _tunlink _wunlink
|
||||
|
||||
// reading and writing to i/o
|
||||
#define _fgettc fgetwc
|
||||
#define _fgetts fgetws
|
||||
#define _fputts fputws
|
||||
#define _gettchar getwchar
|
||||
|
||||
// directory
|
||||
#define _tchdir _wchdir
|
||||
|
||||
// environment
|
||||
#define _tgetenv _wgetenv
|
||||
#define _tsystem _wsystem
|
||||
|
||||
// time
|
||||
#define _tcsftime wcsftime
|
||||
|
||||
#else // ANSI
|
||||
|
||||
#ifndef _T
|
||||
#define _T(x) x
|
||||
#define _TEXT(x) x
|
||||
#endif
|
||||
typedef char TCHAR;
|
||||
typedef unsigned char _TUCHAR;
|
||||
|
||||
// program
|
||||
#define _tmain main
|
||||
#define _tWinMain WinMain
|
||||
#define _tenviron environ
|
||||
#define __targv __argv
|
||||
|
||||
// printfs
|
||||
#define _ftprintf fprintf
|
||||
#define _sntprintf _snprintf
|
||||
#define _stprintf sprintf
|
||||
#define _tprintf printf
|
||||
#define _vftprintf vfprintf
|
||||
#define _vsntprintf _vsnprintf
|
||||
#define _vstprintf vsprintf
|
||||
|
||||
// scanfs
|
||||
#define _tscanf scanf
|
||||
#define _stscanf sscanf
|
||||
|
||||
// string manipulations
|
||||
#define _tcscat strcat
|
||||
#define _tcschr strchr
|
||||
#define _tcsclen strlen
|
||||
#define _tcscnlen strnlen
|
||||
#define _tcscpy strcpy
|
||||
#define _tcsdup _strdup
|
||||
#define _tcslen strlen
|
||||
#define _tcsnccpy strncpy
|
||||
#define _tcsrchr strrchr
|
||||
#define _tcsstr strstr
|
||||
#define _tcstok strtok
|
||||
|
||||
// string comparisons
|
||||
#define _tcscmp strcmp
|
||||
#define _tcsicmp _stricmp
|
||||
#define _tcsncmp strncmp
|
||||
#define _tcsncicmp _strnicmp
|
||||
#define _tcsnicmp _strnicmp
|
||||
|
||||
// upper / lower
|
||||
#define _tcslwr _strlwr
|
||||
#define _tcsupr _strupr
|
||||
|
||||
#define _totupper toupper
|
||||
#define _totlower tolower
|
||||
|
||||
// conversions to numbers
|
||||
#define _tcstol strtol
|
||||
#define _tcstoul strtoul
|
||||
#define _tstof atof
|
||||
#define _tstoi atoi
|
||||
#define _tstoi64 _atoi64
|
||||
#define _tstoi64 _atoi64
|
||||
#define _ttoi atoi
|
||||
#define _ttoi64 _atoi64
|
||||
#define _ttol atol
|
||||
|
||||
// conversion from numbers to strings
|
||||
#define _i64tot _i64toa
|
||||
#define _itot _itoa
|
||||
#define _ltot _ltoa
|
||||
#define _ui64tot _ui64toa
|
||||
|
||||
// file manipulations
|
||||
#define _tfopen fopen
|
||||
#define _topen _open
|
||||
#define _tremove remove
|
||||
#define _tunlink _unlink
|
||||
|
||||
// reading and writing to i/o
|
||||
#define _fgettc fgetc
|
||||
#define _fgetts fgets
|
||||
#define _fputts fputs
|
||||
#define _gettchar getchar
|
||||
|
||||
// directory
|
||||
#define _tchdir _chdir
|
||||
|
||||
// environment
|
||||
#define _tgetenv getenv
|
||||
#define _tsystem system
|
||||
|
||||
// time
|
||||
#define _tcsftime strftime
|
||||
|
||||
#endif
|
||||
|
||||
// is functions (the same in Unicode / ANSI)
|
||||
#define _istgraph isgraph
|
||||
#define _istascii __isascii
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/10/2007
|
||||
*/
|
||||
|
||||
#include "Platform.h"
|
||||
|
@ -24,284 +26,284 @@
|
|||
typedef struct
|
||||
{
|
||||
int id;
|
||||
const char *name;
|
||||
const TCHAR *name;
|
||||
int num_parms; // minimum number of parameters
|
||||
int opt_parms; // optional parmaters, usually 0, can be -1 for unlimited.
|
||||
const char *usage_str;
|
||||
const TCHAR *usage_str;
|
||||
int placement; // where the token can be placed
|
||||
} tokenType;
|
||||
|
||||
|
||||
static tokenType tokenlist[TOK__LAST] =
|
||||
{
|
||||
{TOK_ABORT,"Abort",0,1,"[message]",TP_CODE},
|
||||
{TOK_ADDBRANDINGIMAGE,"AddBrandingImage",2,1,"(top|left|bottom|right) (height|width) [padding]",TP_GLOBAL},
|
||||
{TOK_ADDSIZE,"AddSize",1,0,"size_to_add_to_section_in_kb",TP_SEC},
|
||||
{TOK_AUTOCLOSE,"AutoCloseWindow",1,0,"(false|true)",TP_GLOBAL},
|
||||
{TOK_BGFONT,"BGFont",0,6,"[font_face [height [wieght] [/ITALIC] [/UNDERLINE] [/STRIKE]]]",TP_GLOBAL},
|
||||
{TOK_BGGRADIENT,"BGGradient",0,3,"(off | [top_color [bottom_color [text_color]]])",TP_GLOBAL},
|
||||
{TOK_BRANDINGTEXT,"BrandingText",1,1,"[/TRIM(LEFT|RIGHT|CENTER)] installer_text",TP_GLOBAL},
|
||||
{TOK_BRINGTOFRONT,"BringToFront",0,0,"",TP_CODE},
|
||||
{TOK_CALL,"Call",1,0,"function_name | [:label_name]",TP_CODE},
|
||||
{TOK_CALLINSTDLL,"CallInstDLL",2,1,"dll_path_on_target.dll function",TP_CODE},
|
||||
{TOK_CAPTION,"Caption",1,0,"installer_caption",TP_GLOBAL|TP_PAGEEX},
|
||||
{TOK_CHANGEUI,"ChangeUI",2,0,"(all|dlg_id) ui_file.exe",TP_GLOBAL},
|
||||
{TOK_CLEARERRORS,"ClearErrors",0,0,"",TP_CODE},
|
||||
{TOK_COMPTEXT,"ComponentText",0,3,"[component_page_description] [component_subtext1] [component_subtext2]",TP_PG},
|
||||
{TOK_GETDLLVERSION,"GetDLLVersion",3,0,"filename $(user_var: high output) $(user_var: low output)",TP_CODE},
|
||||
{TOK_GETDLLVERSIONLOCAL,"GetDLLVersionLocal",3,0,"localfilename $(user_var: high output) $(user_var: low output)",TP_CODE},
|
||||
{TOK_GETFILETIME,"GetFileTime",3,0,"file $(user_var: high output) $(user_var: low output)",TP_CODE},
|
||||
{TOK_GETFILETIMELOCAL,"GetFileTimeLocal",3,0,"localfile $(user_var: high output) $(user_var: low output)",TP_CODE},
|
||||
{TOK_COPYFILES,"CopyFiles",2,3,"[/SILENT] [/FILESONLY] source_path destination_path [total_size_in_kb]",TP_CODE},
|
||||
{TOK_CRCCHECK,"CRCCheck",1,0,"(on|force|off)",TP_GLOBAL},
|
||||
{TOK_CREATEDIR,"CreateDirectory",1,0,"directory_name",TP_CODE},
|
||||
{TOK_CREATEFONT,"CreateFont",2,5,"$(user_var: handle output) face_name [height wieght /ITALIC /UNDERLINE /STRIKE]",TP_CODE},
|
||||
{TOK_CREATESHORTCUT,"CreateShortCut",2,6,"shortcut_name.lnk shortcut_target [parameters [icon_file [icon index [showmode [hotkey [comment]]]]]]\n showmode=(SW_SHOWNORMAL|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED)\n hotkey=(ALT|CONTROL|EXT|SHIFT)|(F1-F24|A-Z)",TP_CODE},
|
||||
{TOK_DBOPTIMIZE,"SetDatablockOptimize",1,0,"(off|on)",TP_ALL},
|
||||
{TOK_DELETEINISEC,"DeleteINISec",2,0,"ini_file section_name",TP_CODE},
|
||||
{TOK_DELETEINISTR,"DeleteINIStr",3,0,"ini_file section_name entry_name",TP_CODE},
|
||||
{TOK_DELETEREGKEY,"DeleteRegKey",2,1,"[/ifempty] root_key subkey\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)",TP_CODE},
|
||||
{TOK_DELETEREGVALUE,"DeleteRegValue",3,0,"root_key subkey entry_name\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)",TP_CODE},
|
||||
{TOK_DELETE,"Delete",1,1,"[/REBOOTOK] filespec",TP_CODE},
|
||||
{TOK_DETAILPRINT,"DetailPrint",1,0,"message",TP_CODE},
|
||||
{TOK_DIRTEXT,"DirText",0,4,"[directory_page_description] [directory_page_subtext] [browse_button_text] [browse_dlg_text]",TP_PG},
|
||||
//{TOK_DIRSHOW,"DirShow",1,0,"(show|hide)",TP_PG},
|
||||
{TOK_DIRSHOW,"DirShow",0,0,"doesn't currently work",TP_ALL},
|
||||
{TOK_DIRVAR,"DirVar",1,0,"$(user_var: dir in/out))",TP_PAGEEX},
|
||||
{TOK_DIRVERIFY,"DirVerify",1,0,"auto|leave",TP_PAGEEX},
|
||||
{TOK_GETINSTDIRERROR,"GetInstDirError",1,0,"$(user_var: error output)",TP_CODE},
|
||||
{TOK_ROOTDIRINST,"AllowRootDirInstall",1,0,"(true|false)",TP_GLOBAL},
|
||||
{TOK_CHECKBITMAP,"CheckBitmap",1,0,"local_bitmap.bmp",TP_GLOBAL},
|
||||
{TOK_ENABLEWINDOW,"EnableWindow",2,0,"hwnd (1|0)",TP_CODE},
|
||||
{TOK_ENUMREGKEY,"EnumRegKey",4,0,"$(user_var: output) rootkey subkey index\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)",TP_CODE},
|
||||
{TOK_ENUMREGVAL,"EnumRegValue",4,0,"$(user_var: output) rootkey subkey index\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)",TP_CODE},
|
||||
{TOK_EXCH,"Exch",0,1,"[$(user_var)] | [stack_item_index]",TP_CODE},
|
||||
{TOK_EXEC,"Exec",1,0,"command_line",TP_CODE},
|
||||
{TOK_EXECWAIT,"ExecWait",1,1,"command_line [$(user_var: return value)]",TP_CODE},
|
||||
{TOK_EXECSHELL,"ExecShell",2,2,"(open|print|etc) command_line [parameters [showmode]]\n showmode=(SW_SHOWNORMAL|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_HIDE)",TP_CODE},
|
||||
{TOK_EXPANDENVSTRS,"ExpandEnvStrings",2,0,"$(user_var: output) string",TP_CODE},
|
||||
{TOK_FINDWINDOW,"FindWindow",2,3,"$(user_var: handle output) WindowClass [WindowTitle] [Window_Parent] [Child_After]",TP_CODE},
|
||||
{TOK_FINDCLOSE,"FindClose",1,0,"$(user_var: handle input)",TP_CODE},
|
||||
{TOK_FINDFIRST,"FindFirst",3,0,"$(user_var: handle output) $(user_var: filename output) filespec",TP_CODE},
|
||||
{TOK_FINDNEXT,"FindNext",2,0,"$(user_var: handle input) $(user_var: filename output)",TP_CODE},
|
||||
{TOK_FILE,"File",1,-1,"[/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |\n /oname=outfile one_file_only)",TP_CODE},
|
||||
{TOK_FILEBUFSIZE,"FileBufSize",1,0,"buf_size_mb",TP_ALL},
|
||||
{TOK_FLUSHINI,"FlushINI",1,0,"ini_file",TP_CODE},
|
||||
{TOK_RESERVEFILE,"ReserveFile",1,-1,"[/nonfatal] [/r] [/x filespec [...]] file [file...]",TP_ALL},
|
||||
{TOK_FILECLOSE,"FileClose",1,0,"$(user_var: handle input)",TP_CODE},
|
||||
{TOK_FILEERRORTEXT,"FileErrorText",0,2,"[text (can contain $0)] [text without ignore (can contain $0)]",TP_GLOBAL},
|
||||
{TOK_FILEOPEN,"FileOpen",3,0,"$(user_var: handle output) filename openmode\n openmode=r|w|a",TP_CODE},
|
||||
{TOK_FILEREAD,"FileRead",2,1,"$(user_var: handle input) $(user_var: text output) [maxlen]",TP_CODE},
|
||||
{TOK_FILEWRITE,"FileWrite",2,0,"$(user_var: handle input) text",TP_CODE},
|
||||
{TOK_FILEREADBYTE,"FileReadByte",2,0,"$(user_var: handle input) $(user_var: bytevalue output)",TP_CODE},
|
||||
{TOK_FILEWRITEBYTE,"FileWriteByte",2,0,"$(user_var: handle input) bytevalue",TP_CODE},
|
||||
{TOK_FILESEEK,"FileSeek",2,2,"$(user_var: handle input) offset [mode] [$(user_var: new position output)]\n mode=SET|CUR|END",TP_CODE},
|
||||
{TOK_FUNCTION,"Function",1,0,"function_name",TP_GLOBAL},
|
||||
{TOK_FUNCTIONEND,"FunctionEnd",0,0,"",TP_FUNC},
|
||||
{TOK_GETDLGITEM,"GetDlgItem",3,0,"$(user_var: handle output) dialog item_id",TP_CODE},
|
||||
{TOK_GETFULLPATHNAME,"GetFullPathName",2,1,"[/SHORT] $(user_var: result) path_or_file",TP_CODE},
|
||||
{TOK_GETTEMPFILENAME,"GetTempFileName",1,1,"$(user_var: name output) [base_dir]",TP_CODE},
|
||||
{TOK_HIDEWINDOW,"HideWindow",0,0,"",TP_CODE},
|
||||
{TOK_ICON,"Icon",1,0,"local_icon.ico",TP_GLOBAL},
|
||||
{TOK_IFABORT,"IfAbort",1,1,"label_to_goto_if_abort [label_to_goto_if_no_abort]",TP_CODE},
|
||||
{TOK_IFERRORS,"IfErrors",1,1,"label_to_goto_if_errors [label_to_goto_if_no_errors]",TP_CODE},
|
||||
{TOK_IFFILEEXISTS,"IfFileExists",2,1,"filename label_to_goto_if_file_exists [label_to_goto_otherwise]",TP_CODE},
|
||||
{TOK_IFREBOOTFLAG,"IfRebootFlag",1,1,"jump_if_set [jump_if_not_set]",TP_CODE},
|
||||
{TOK_IFSILENT,"IfSilent",1,1,"jump_if_silent [jump_if_not_silent]",TP_CODE},
|
||||
{TOK_INSTALLDIRREGKEY,"InstallDirRegKey",3,0,"root_key subkey entry_name\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)",TP_GLOBAL},
|
||||
{TOK_INSTCOLORS,"InstallColors",1,1,"(/windows | (foreground_color background_color))",TP_GLOBAL},
|
||||
{TOK_INSTDIR,"InstallDir",1,0,"default_install_directory",TP_GLOBAL},
|
||||
{TOK_INSTPROGRESSFLAGS,"InstProgressFlags",0,-1,"[flag [...]]\n flag={smooth|colored}",TP_GLOBAL},
|
||||
{TOK_INSTTYPE,"InstType",1,0,"[un.]install_type_name | /NOCUSTOM | /CUSTOMSTRING=str | /COMPONENTSONLYONCUSTOM",TP_GLOBAL},
|
||||
{TOK_INTOP,"IntOp",3,1,"$(user_var: result) val1 OP [val2]\n OP=(+ - * / % | & ^ ~ ! || && << >>)",TP_CODE},
|
||||
{TOK_INTCMP,"IntCmp",3,2,"val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]",TP_CODE},
|
||||
{TOK_INTCMPU,"IntCmpU",3,2,"val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]",TP_CODE},
|
||||
{TOK_INTFMT,"IntFmt",3,0,"$(user_var: output) format_string input",TP_CODE},
|
||||
{TOK_ISWINDOW,"IsWindow",2,1,"hwnd jump_if_window [jump_if_not_window]",TP_CODE},
|
||||
{TOK_GOTO,"Goto",1,0,"label",TP_CODE},
|
||||
{TOK_LANGSTRING,"LangString",3,0,"[un.]name lang_id string",TP_GLOBAL},
|
||||
{TOK_LANGSTRINGUP,"LangStringUP",0,0,"obsolete, use LangString.",TP_ALL},
|
||||
{TOK_LICENSEDATA,"LicenseData",1,0,"local_file_that_has_license_text | license_lang_string",TP_PG},
|
||||
{TOK_LICENSEFORCESELECTION,"LicenseForceSelection",1,2,"(checkbox [accept_text] | radiobuttons [accept_text] [decline_text] | off)",TP_PG},
|
||||
{TOK_LICENSELANGSTRING,"LicenseLangString",3,0,"name lang_id license_path",TP_GLOBAL},
|
||||
{TOK_LICENSETEXT,"LicenseText",1,1,"license_page_description [license_button_text]",TP_PG},
|
||||
{TOK_LICENSEBKCOLOR,"LicenseBkColor",1,0,"background_color",TP_GLOBAL},
|
||||
{TOK_LOADNLF,"LoadLanguageFile",1,0,"language.nlf",TP_GLOBAL},
|
||||
{TOK_LOGSET,"LogSet",1,0,"on|off",TP_CODE},
|
||||
{TOK_LOGTEXT,"LogText",1,0,"text",TP_CODE},
|
||||
{TOK_MESSAGEBOX,"MessageBox",2,6,"mode messagebox_text [/SD return] [return_check label_to_goto_if_equal [return_check2 label2]]\n mode=modeflag[|modeflag[|modeflag[...]]]\n "
|
||||
"modeflag=(MB_ABORTRETRYIGNORE|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_YESNO|MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_USERICON|MB_TOPMOST|MB_SETFOREGROUND|MB_RIGHT",TP_CODE},
|
||||
{TOK_NOP,"Nop",0,0,"",TP_CODE},
|
||||
{TOK_NAME,"Name",1,1,"installer_name installer_name_doubled_ampersands",TP_GLOBAL},
|
||||
{TOK_OUTFILE,"OutFile",1,0,"install_output.exe",TP_GLOBAL},
|
||||
{TOK_ABORT,_T("Abort"),0,1,_T("[message]"),TP_CODE},
|
||||
{TOK_ADDBRANDINGIMAGE,_T("AddBrandingImage"),2,1,_T("(top|left|bottom|right) (height|width) [padding]"),TP_GLOBAL},
|
||||
{TOK_ADDSIZE,_T("AddSize"),1,0,_T("size_to_add_to_section_in_kb"),TP_SEC},
|
||||
{TOK_AUTOCLOSE,_T("AutoCloseWindow"),1,0,_T("(false|true)"),TP_GLOBAL},
|
||||
{TOK_BGFONT,_T("BGFont"),0,6,_T("[font_face [height [wieght] [/ITALIC] [/UNDERLINE] [/STRIKE]]]"),TP_GLOBAL},
|
||||
{TOK_BGGRADIENT,_T("BGGradient"),0,3,_T("(off | [top_color [bottom_color [text_color]]])"),TP_GLOBAL},
|
||||
{TOK_BRANDINGTEXT,_T("BrandingText"),1,1,_T("[/TRIM(LEFT|RIGHT|CENTER)] installer_text"),TP_GLOBAL},
|
||||
{TOK_BRINGTOFRONT,_T("BringToFront"),0,0,_T(""),TP_CODE},
|
||||
{TOK_CALL,_T("Call"),1,0,_T("function_name | [:label_name]"),TP_CODE},
|
||||
{TOK_CALLINSTDLL,_T("CallInstDLL"),2,1,_T("dll_path_on_target.dll function"),TP_CODE},
|
||||
{TOK_CAPTION,_T("Caption"),1,0,_T("installer_caption"),TP_GLOBAL|TP_PAGEEX},
|
||||
{TOK_CHANGEUI,_T("ChangeUI"),2,0,_T("(all|dlg_id) ui_file.exe"),TP_GLOBAL},
|
||||
{TOK_CLEARERRORS,_T("ClearErrors"),0,0,_T(""),TP_CODE},
|
||||
{TOK_COMPTEXT,_T("ComponentText"),0,3,_T("[component_page_description] [component_subtext1] [component_subtext2]"),TP_PG},
|
||||
{TOK_GETDLLVERSION,_T("GetDLLVersion"),3,0,_T("filename $(user_var: high output) $(user_var: low output)"),TP_CODE},
|
||||
{TOK_GETDLLVERSIONLOCAL,_T("GetDLLVersionLocal"),3,0,_T("localfilename $(user_var: high output) $(user_var: low output)"),TP_CODE},
|
||||
{TOK_GETFILETIME,_T("GetFileTime"),3,0,_T("file $(user_var: high output) $(user_var: low output)"),TP_CODE},
|
||||
{TOK_GETFILETIMELOCAL,_T("GetFileTimeLocal"),3,0,_T("localfile $(user_var: high output) $(user_var: low output)"),TP_CODE},
|
||||
{TOK_COPYFILES,_T("CopyFiles"),2,3,_T("[/SILENT] [/FILESONLY] source_path destination_path [total_size_in_kb]"),TP_CODE},
|
||||
{TOK_CRCCHECK,_T("CRCCheck"),1,0,_T("(on|force|off)"),TP_GLOBAL},
|
||||
{TOK_CREATEDIR,_T("CreateDirectory"),1,0,_T("directory_name"),TP_CODE},
|
||||
{TOK_CREATEFONT,_T("CreateFont"),2,5,_T("$(user_var: handle output) face_name [height wieght /ITALIC /UNDERLINE /STRIKE]"),TP_CODE},
|
||||
{TOK_CREATESHORTCUT,_T("CreateShortCut"),2,6,_T("shortcut_name.lnk shortcut_target [parameters [icon_file [icon index [showmode [hotkey [comment]]]]]]\n showmode=(SW_SHOWNORMAL|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED)\n hotkey=(ALT|CONTROL|EXT|SHIFT)|(F1-F24|A-Z)"),TP_CODE},
|
||||
{TOK_DBOPTIMIZE,_T("SetDatablockOptimize"),1,0,_T("(off|on)"),TP_ALL},
|
||||
{TOK_DELETEINISEC,_T("DeleteINISec"),2,0,_T("ini_file section_name"),TP_CODE},
|
||||
{TOK_DELETEINISTR,_T("DeleteINIStr"),3,0,_T("ini_file section_name entry_name"),TP_CODE},
|
||||
{TOK_DELETEREGKEY,_T("DeleteRegKey"),2,1,_T("[/ifempty] root_key subkey\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)"),TP_CODE},
|
||||
{TOK_DELETEREGVALUE,_T("DeleteRegValue"),3,0,_T("root_key subkey entry_name\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)"),TP_CODE},
|
||||
{TOK_DELETE,_T("Delete"),1,1,_T("[/REBOOTOK] filespec"),TP_CODE},
|
||||
{TOK_DETAILPRINT,_T("DetailPrint"),1,0,_T("message"),TP_CODE},
|
||||
{TOK_DIRTEXT,_T("DirText"),0,4,_T("[directory_page_description] [directory_page_subtext] [browse_button_text] [browse_dlg_text]"),TP_PG},
|
||||
//{TOK_DIRSHOW,_T("DirShow"),1,0,_T("(show|hide)"),TP_PG},
|
||||
{TOK_DIRSHOW,_T("DirShow"),0,0,_T("doesn't currently work"),TP_ALL},
|
||||
{TOK_DIRVAR,_T("DirVar"),1,0,_T("$(user_var: dir in/out))"),TP_PAGEEX},
|
||||
{TOK_DIRVERIFY,_T("DirVerify"),1,0,_T("auto|leave"),TP_PAGEEX},
|
||||
{TOK_GETINSTDIRERROR,_T("GetInstDirError"),1,0,_T("$(user_var: error output)"),TP_CODE},
|
||||
{TOK_ROOTDIRINST,_T("AllowRootDirInstall"),1,0,_T("(true|false)"),TP_GLOBAL},
|
||||
{TOK_CHECKBITMAP,_T("CheckBitmap"),1,0,_T("local_bitmap.bmp"),TP_GLOBAL},
|
||||
{TOK_ENABLEWINDOW,_T("EnableWindow"),2,0,_T("hwnd (1|0)"),TP_CODE},
|
||||
{TOK_ENUMREGKEY,_T("EnumRegKey"),4,0,_T("$(user_var: output) rootkey subkey index\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)"),TP_CODE},
|
||||
{TOK_ENUMREGVAL,_T("EnumRegValue"),4,0,_T("$(user_var: output) rootkey subkey index\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)"),TP_CODE},
|
||||
{TOK_EXCH,_T("Exch"),0,1,_T("[$(user_var)] | [stack_item_index]"),TP_CODE},
|
||||
{TOK_EXEC,_T("Exec"),1,0,_T("command_line"),TP_CODE},
|
||||
{TOK_EXECWAIT,_T("ExecWait"),1,1,_T("command_line [$(user_var: return value)]"),TP_CODE},
|
||||
{TOK_EXECSHELL,_T("ExecShell"),2,2,_T("(open|print|etc) command_line [parameters [showmode]]\n showmode=(SW_SHOWNORMAL|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_HIDE)"),TP_CODE},
|
||||
{TOK_EXPANDENVSTRS,_T("ExpandEnvStrings"),2,0,_T("$(user_var: output) string"),TP_CODE},
|
||||
{TOK_FINDWINDOW,_T("FindWindow"),2,3,_T("$(user_var: handle output) WindowClass [WindowTitle] [Window_Parent] [Child_After]"),TP_CODE},
|
||||
{TOK_FINDCLOSE,_T("FindClose"),1,0,_T("$(user_var: handle input)"),TP_CODE},
|
||||
{TOK_FINDFIRST,_T("FindFirst"),3,0,_T("$(user_var: handle output) $(user_var: filename output) filespec"),TP_CODE},
|
||||
{TOK_FINDNEXT,_T("FindNext"),2,0,_T("$(user_var: handle input) $(user_var: filename output)"),TP_CODE},
|
||||
{TOK_FILE,_T("File"),1,-1,_T("[/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |\n /oname=outfile one_file_only)"),TP_CODE},
|
||||
{TOK_FILEBUFSIZE,_T("FileBufSize"),1,0,_T("buf_size_mb"),TP_ALL},
|
||||
{TOK_FLUSHINI,_T("FlushINI"),1,0,_T("ini_file"),TP_CODE},
|
||||
{TOK_RESERVEFILE,_T("ReserveFile"),1,-1,_T("[/nonfatal] [/r] [/x filespec [...]] file [file...]"),TP_ALL},
|
||||
{TOK_FILECLOSE,_T("FileClose"),1,0,_T("$(user_var: handle input)"),TP_CODE},
|
||||
{TOK_FILEERRORTEXT,_T("FileErrorText"),0,2,_T("[text (can contain $0)] [text without ignore (can contain $0)]"),TP_GLOBAL},
|
||||
{TOK_FILEOPEN,_T("FileOpen"),3,0,_T("$(user_var: handle output) filename openmode\n openmode=r|w|a"),TP_CODE},
|
||||
{TOK_FILEREAD,_T("FileRead"),2,1,_T("$(user_var: handle input) $(user_var: text output) [maxlen]"),TP_CODE},
|
||||
{TOK_FILEWRITE,_T("FileWrite"),2,0,_T("$(user_var: handle input) text"),TP_CODE},
|
||||
{TOK_FILEREADBYTE,_T("FileReadByte"),2,0,_T("$(user_var: handle input) $(user_var: bytevalue output)"),TP_CODE},
|
||||
{TOK_FILEWRITEBYTE,_T("FileWriteByte"),2,0,_T("$(user_var: handle input) bytevalue"),TP_CODE},
|
||||
{TOK_FILESEEK,_T("FileSeek"),2,2,_T("$(user_var: handle input) offset [mode] [$(user_var: new position output)]\n mode=SET|CUR|END"),TP_CODE},
|
||||
{TOK_FUNCTION,_T("Function"),1,0,_T("function_name"),TP_GLOBAL},
|
||||
{TOK_FUNCTIONEND,_T("FunctionEnd"),0,0,_T(""),TP_FUNC},
|
||||
{TOK_GETDLGITEM,_T("GetDlgItem"),3,0,_T("$(user_var: handle output) dialog item_id"),TP_CODE},
|
||||
{TOK_GETFULLPATHNAME,_T("GetFullPathName"),2,1,_T("[/SHORT] $(user_var: result) path_or_file"),TP_CODE},
|
||||
{TOK_GETTEMPFILENAME,_T("GetTempFileName"),1,1,_T("$(user_var: name output) [base_dir]"),TP_CODE},
|
||||
{TOK_HIDEWINDOW,_T("HideWindow"),0,0,_T(""),TP_CODE},
|
||||
{TOK_ICON,_T("Icon"),1,0,_T("local_icon.ico"),TP_GLOBAL},
|
||||
{TOK_IFABORT,_T("IfAbort"),1,1,_T("label_to_goto_if_abort [label_to_goto_if_no_abort]"),TP_CODE},
|
||||
{TOK_IFERRORS,_T("IfErrors"),1,1,_T("label_to_goto_if_errors [label_to_goto_if_no_errors]"),TP_CODE},
|
||||
{TOK_IFFILEEXISTS,_T("IfFileExists"),2,1,_T("filename label_to_goto_if_file_exists [label_to_goto_otherwise]"),TP_CODE},
|
||||
{TOK_IFREBOOTFLAG,_T("IfRebootFlag"),1,1,_T("jump_if_set [jump_if_not_set]"),TP_CODE},
|
||||
{TOK_IFSILENT,_T("IfSilent"),1,1,_T("jump_if_silent [jump_if_not_silent]"),TP_CODE},
|
||||
{TOK_INSTALLDIRREGKEY,_T("InstallDirRegKey"),3,0,_T("root_key subkey entry_name\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD)"),TP_GLOBAL},
|
||||
{TOK_INSTCOLORS,_T("InstallColors"),1,1,_T("(/windows | (foreground_color background_color))"),TP_GLOBAL},
|
||||
{TOK_INSTDIR,_T("InstallDir"),1,0,_T("default_install_directory"),TP_GLOBAL},
|
||||
{TOK_INSTPROGRESSFLAGS,_T("InstProgressFlags"),0,-1,_T("[flag [...]]\n flag={smooth|colored}"),TP_GLOBAL},
|
||||
{TOK_INSTTYPE,_T("InstType"),1,0,_T("[un.]install_type_name | /NOCUSTOM | /CUSTOMSTRING=str | /COMPONENTSONLYONCUSTOM"),TP_GLOBAL},
|
||||
{TOK_INTOP,_T("IntOp"),3,1,_T("$(user_var: result) val1 OP [val2]\n OP=(+ - * / % | & ^ ~ ! || && << >>)"),TP_CODE},
|
||||
{TOK_INTCMP,_T("IntCmp"),3,2,_T("val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]"),TP_CODE},
|
||||
{TOK_INTCMPU,_T("IntCmpU"),3,2,_T("val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]"),TP_CODE},
|
||||
{TOK_INTFMT,_T("IntFmt"),3,0,_T("$(user_var: output) format_string input"),TP_CODE},
|
||||
{TOK_ISWINDOW,_T("IsWindow"),2,1,_T("hwnd jump_if_window [jump_if_not_window]"),TP_CODE},
|
||||
{TOK_GOTO,_T("Goto"),1,0,_T("label"),TP_CODE},
|
||||
{TOK_LANGSTRING,_T("LangString"),3,0,_T("[un.]name lang_id string"),TP_GLOBAL},
|
||||
{TOK_LANGSTRINGUP,_T("LangStringUP"),0,0,_T("obsolete, use LangString."),TP_ALL},
|
||||
{TOK_LICENSEDATA,_T("LicenseData"),1,0,_T("local_file_that_has_license_text | license_lang_string"),TP_PG},
|
||||
{TOK_LICENSEFORCESELECTION,_T("LicenseForceSelection"),1,2,_T("(checkbox [accept_text] | radiobuttons [accept_text] [decline_text] | off)"),TP_PG},
|
||||
{TOK_LICENSELANGSTRING,_T("LicenseLangString"),3,0,_T("name lang_id license_path"),TP_GLOBAL},
|
||||
{TOK_LICENSETEXT,_T("LicenseText"),1,1,_T("license_page_description [license_button_text]"),TP_PG},
|
||||
{TOK_LICENSEBKCOLOR,_T("LicenseBkColor"),1,0,_T("background_color"),TP_GLOBAL},
|
||||
{TOK_LOADNLF,_T("LoadLanguageFile"),1,0,_T("language.nlf"),TP_GLOBAL},
|
||||
{TOK_LOGSET,_T("LogSet"),1,0,_T("on|off"),TP_CODE},
|
||||
{TOK_LOGTEXT,_T("LogText"),1,0,_T("text"),TP_CODE},
|
||||
{TOK_MESSAGEBOX,_T("MessageBox"),2,6,_T("mode messagebox_text [/SD return] [return_check label_to_goto_if_equal [return_check2 label2]]\n mode=modeflag[|modeflag[|modeflag[...]]]\n ")
|
||||
_T("modeflag=(MB_ABORTRETRYIGNORE|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_YESNO|MB_YESNOCANCEL|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_USERICON|MB_TOPMOST|MB_SETFOREGROUND|MB_RIGHT"),TP_CODE},
|
||||
{TOK_NOP,_T("Nop"),0,0,_T(""),TP_CODE},
|
||||
{TOK_NAME,_T("Name"),1,1,_T("installer_name installer_name_doubled_ampersands"),TP_GLOBAL},
|
||||
{TOK_OUTFILE,_T("OutFile"),1,0,_T("install_output.exe"),TP_GLOBAL},
|
||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||
{TOK_PAGE,"Page",1,4,"((custom [creator_function] [leave_function] [caption]) | ((license|components|directory|instfiles|uninstConfirm) [pre_function] [show_function] [leave_function])) [/ENABLECANCEL]",TP_GLOBAL},
|
||||
{TOK_PAGE,_T("Page"),1,4,_T("((custom [creator_function] [leave_function] [caption]) | ((license|components|directory|instfiles|uninstConfirm) [pre_function] [show_function] [leave_function])) [/ENABLECANCEL]"),TP_GLOBAL},
|
||||
#else
|
||||
{TOK_PAGE,"Page",1,1,"license|components|directory|instfiles|uninstConfirm [/ENABLECANCEL]",TP_GLOBAL},
|
||||
{TOK_PAGE,_T("Page"),1,1,_T("license|components|directory|instfiles|uninstConfirm [/ENABLECANCEL]"),TP_GLOBAL},
|
||||
#endif
|
||||
{TOK_PAGECALLBACKS,"PageCallbacks",0,3,"([creator_function] [leave_function]) | ([pre_function] [show_function] [leave_function])",TP_PAGEEX},
|
||||
{TOK_PAGEEX,"PageEx",1,0,"[un.](custom|uninstConfirm|license|components|directory|instfiles)",TP_GLOBAL},
|
||||
{TOK_PAGEEXEND,"PageExEnd",0,0,"",TP_PAGEEX},
|
||||
{TOK_POP,"Pop",1,0,"$(user_var: output)",TP_CODE},
|
||||
{TOK_PUSH,"Push",1,0,"string",TP_CODE},
|
||||
{TOK_QUIT,"Quit",0,0,"",TP_CODE},
|
||||
{TOK_READINISTR,"ReadINIStr",4,0,"$(user_var: output) ini_file section entry_name",TP_CODE},
|
||||
{TOK_READREGDWORD,"ReadRegDWORD",4,0,"$(user_var: output) rootkey subkey entry\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)",TP_CODE},
|
||||
{TOK_READREGSTR,"ReadRegStr",4,0,"$(user_var: output) rootkey subkey entry\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)",TP_CODE},
|
||||
{TOK_READENVSTR,"ReadEnvStr",2,0,"$(user_var: output) name",TP_CODE},
|
||||
{TOK_REBOOT,"Reboot",0,0,"",TP_CODE},
|
||||
{TOK_REGDLL,"RegDLL",1,1,"dll_path_on_target.dll [entrypoint_symbol]",TP_CODE},
|
||||
{TOK_RENAME,"Rename",2,1,"[/REBOOTOK] source_file destination_file",TP_CODE},
|
||||
{TOK_RET,"Return",0,0,"",TP_CODE},
|
||||
{TOK_RMDIR,"RMDir",1,2,"[/r] [/REBOOTOK] directory_name",TP_CODE},
|
||||
{TOK_SECTION,"Section",0,3,"[/o] [-][un.][section_name] [section index output]",TP_GLOBAL},
|
||||
{TOK_SECTIONEND,"SectionEnd",0,0,"",TP_SEC},
|
||||
{TOK_SECTIONIN,"SectionIn",1,-1,"InstTypeIdx [InstTypeIdx [...]]",TP_SEC},
|
||||
{TOK_SUBSECTION,"SubSection",1,2,"deprecated - use SectionGroup",TP_GLOBAL},
|
||||
{TOK_SECTIONGROUP,"SectionGroup",1,2,"[/e] [un.]section_group_name [section index output]",TP_GLOBAL},
|
||||
{TOK_SUBSECTIONEND,"SubSectionEnd",0,0,"deprecated - use SectionGroupEnd",TP_GLOBAL},
|
||||
{TOK_SECTIONGROUPEND,"SectionGroupEnd",0,0,"",TP_GLOBAL},
|
||||
{TOK_SEARCHPATH,"SearchPath",2,0,"$(user_var: result) filename",TP_CODE},
|
||||
{TOK_SECTIONSETFLAGS,"SectionSetFlags",2,0,"section_index flags",TP_CODE},
|
||||
{TOK_SECTIONGETFLAGS,"SectionGetFlags",2,0,"section_index $(user_var: output flags)",TP_CODE},
|
||||
{TOK_SECTIONSETINSTTYPES,"SectionSetInstTypes",2,0,"section_index inst_types",TP_CODE},
|
||||
{TOK_SECTIONGETINSTTYPES,"SectionGetInstTypes",2,0,"section_index $(user_var: output inst_types)",TP_CODE},
|
||||
{TOK_SECTIONGETTEXT,"SectionGetText",2,0,"section_index $(user_var: output text)",TP_CODE},
|
||||
{TOK_SECTIONSETTEXT,"SectionSetText",2,0,"section_index text_string",TP_CODE},
|
||||
{TOK_SECTIONGETSIZE,"SectionGetSize",2,0,"section_index $(user_var: output size)",TP_CODE},
|
||||
{TOK_SECTIONSETSIZE,"SectionSetSize",2,0,"section_index new_size",TP_CODE},
|
||||
{TOK_GETCURINSTTYPE,"GetCurInstType",1,0,"$(user_var: output inst_type_idx)",TP_CODE},
|
||||
{TOK_SETCURINSTTYPE,"SetCurInstType",1,0,"inst_type_idx",TP_CODE},
|
||||
{TOK_INSTTYPESETTEXT,"InstTypeSetText",2,0,"insttype_index flags",TP_CODE},
|
||||
{TOK_INSTTYPEGETTEXT,"InstTypeGetText",2,0,"insttype_index $(user_var: output flags)",TP_CODE},
|
||||
{TOK_SENDMESSAGE,"SendMessage",4,2,"hwnd message [wparam|STR:wParam] [lparam|STR:lParam] [$(user_var: return value)] [/TIMEOUT=X]",TP_CODE},
|
||||
{TOK_SETAUTOCLOSE,"SetAutoClose",1,0,"(false|true)",TP_CODE},
|
||||
{TOK_SETCTLCOLORS,"SetCtlColors",2,2,"hwnd [/BRANDING] [text_color] [transparent|bg_color]",TP_CODE},
|
||||
{TOK_SETBRANDINGIMAGE,"SetBrandingImage",1,2,"[/IMGID=image_item_id_in_dialog] [/RESIZETOFIT] bitmap.bmp",TP_CODE},
|
||||
{TOK_SETCOMPRESS,"SetCompress",1,0,"(off|auto|force)",TP_ALL},
|
||||
{TOK_SETCOMPRESSOR,"SetCompressor",1,2,"[/FINAL] [/SOLID] (zlib|bzip2|lzma)",TP_GLOBAL},
|
||||
{TOK_SETCOMPRESSORDICTSIZE,"SetCompressorDictSize",1,0,"dict_size_mb",TP_ALL},
|
||||
{TOK_SETCOMPRESSIONLEVEL,"SetCompressionLevel",1,0,"level_0-9",TP_ALL},
|
||||
{TOK_SETDATESAVE,"SetDateSave",1,0,"(off|on)",TP_ALL},
|
||||
{TOK_SETDETAILSVIEW,"SetDetailsView",1,0,"(hide|show)",TP_CODE},
|
||||
{TOK_SETDETAILSPRINT,"SetDetailsPrint",1,0,"(none|listonly|textonly|both)",TP_CODE},
|
||||
{TOK_SETERRORS,"SetErrors",0,0,"",TP_CODE},
|
||||
{TOK_SETERRORLEVEL,"SetErrorLevel",1,0,"error_level",TP_CODE},
|
||||
{TOK_GETERRORLEVEL,"GetErrorLevel",1,0,"$(user_var: output)",TP_CODE},
|
||||
{TOK_SETFILEATTRIBUTES,"SetFileAttributes",2,0,"file attribute[|attribute[...]]\n attribute=(NORMAL|ARCHIVE|HIDDEN|OFFLINE|READONLY|SYSTEM|TEMPORARY|0)",TP_CODE},
|
||||
{TOK_SETFONT,"SetFont",2,1,"[/LANG=lang_id] font_face_name font_size",TP_GLOBAL},
|
||||
{TOK_SETOUTPATH,"SetOutPath",1,0,"output_path",TP_CODE},
|
||||
{TOK_SETOVERWRITE,"SetOverwrite",1,0,"on|off|try|ifnewer|ifdiff",TP_ALL},
|
||||
{TOK_SETPLUGINUNLOAD,"SetPluginUnload",1,0,"deprecated - plug-ins should handle this on their own",TP_ALL},
|
||||
{TOK_SETREBOOTFLAG,"SetRebootFlag",1,0,"true|false",TP_CODE},
|
||||
{TOK_SETREGVIEW,"SetRegView",1,0,"32|64|lastused",TP_CODE},
|
||||
{TOK_SETSHELLVARCONTEXT,"SetShellVarContext",1,0,"all|current",TP_CODE},
|
||||
{TOK_SETSILENT,"SetSilent",1,0,"silent|normal",TP_CODE},
|
||||
{TOK_SHOWDETAILS,"ShowInstDetails",1,0,"(hide|show|nevershow)",TP_GLOBAL},
|
||||
{TOK_SHOWDETAILSUNINST,"ShowUninstDetails",1,0,"(hide|show|nevershow)",TP_GLOBAL},
|
||||
{TOK_SHOWWINDOW,"ShowWindow",2,0,"hwnd show_state",TP_CODE},
|
||||
{TOK_SILENTINST,"SilentInstall",1,0,"(normal|silent|silentlog)",TP_GLOBAL},
|
||||
{TOK_SILENTUNINST,"SilentUnInstall",1,0,"(normal|silent)",TP_GLOBAL},
|
||||
{TOK_SLEEP,"Sleep",1,0,"sleep_time_in_ms",TP_CODE},
|
||||
{TOK_STRCMP,"StrCmp",3,1,"str1 str2 label_to_goto_if_equal [label_to_goto_if_not]",TP_CODE},
|
||||
{TOK_STRCMPS,"StrCmpS",3,1,"str1 str2 label_to_goto_if_equal [label_to_goto_if_not]",TP_CODE},
|
||||
{TOK_STRCPY,"StrCpy",2,2,"$(user_var: output) str [maxlen] [startoffset]",TP_CODE},
|
||||
{TOK_STRLEN,"StrLen",2,0,"$(user_var: length output) str",TP_CODE},
|
||||
{TOK_SUBCAPTION,"SubCaption",2,0,"page_number(0-4) new_subcaption",TP_GLOBAL},
|
||||
{TOK_UNINSTALLEXENAME,"UninstallExeName",0,0,"no longer supported, use WriteUninstaller from section.",TP_ALL},
|
||||
{TOK_UNINSTCAPTION,"UninstallCaption",1,0,"uninstaller_caption",TP_GLOBAL},
|
||||
{TOK_UNINSTICON,"UninstallIcon",1,0,"icon_on_local_system.ico",TP_GLOBAL},
|
||||
{TOK_PAGECALLBACKS,_T("PageCallbacks"),0,3,_T("([creator_function] [leave_function]) | ([pre_function] [show_function] [leave_function])"),TP_PAGEEX},
|
||||
{TOK_PAGEEX,_T("PageEx"),1,0,_T("[un.](custom|uninstConfirm|license|components|directory|instfiles)"),TP_GLOBAL},
|
||||
{TOK_PAGEEXEND,_T("PageExEnd"),0,0,_T(""),TP_PAGEEX},
|
||||
{TOK_POP,_T("Pop"),1,0,_T("$(user_var: output)"),TP_CODE},
|
||||
{TOK_PUSH,_T("Push"),1,0,_T("string"),TP_CODE},
|
||||
{TOK_QUIT,_T("Quit"),0,0,_T(""),TP_CODE},
|
||||
{TOK_READINISTR,_T("ReadINIStr"),4,0,_T("$(user_var: output) ini_file section entry_name"),TP_CODE},
|
||||
{TOK_READREGDWORD,_T("ReadRegDWORD"),4,0,_T("$(user_var: output) rootkey subkey entry\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)"),TP_CODE},
|
||||
{TOK_READREGSTR,_T("ReadRegStr"),4,0,_T("$(user_var: output) rootkey subkey entry\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)"),TP_CODE},
|
||||
{TOK_READENVSTR,_T("ReadEnvStr"),2,0,_T("$(user_var: output) name"),TP_CODE},
|
||||
{TOK_REBOOT,_T("Reboot"),0,0,_T(""),TP_CODE},
|
||||
{TOK_REGDLL,_T("RegDLL"),1,1,_T("dll_path_on_target.dll [entrypoint_symbol]"),TP_CODE},
|
||||
{TOK_RENAME,_T("Rename"),2,1,_T("[/REBOOTOK] source_file destination_file"),TP_CODE},
|
||||
{TOK_RET,_T("Return"),0,0,_T(""),TP_CODE},
|
||||
{TOK_RMDIR,_T("RMDir"),1,2,_T("[/r] [/REBOOTOK] directory_name"),TP_CODE},
|
||||
{TOK_SECTION,_T("Section"),0,3,_T("[/o] [-][un.][section_name] [section index output]"),TP_GLOBAL},
|
||||
{TOK_SECTIONEND,_T("SectionEnd"),0,0,_T(""),TP_SEC},
|
||||
{TOK_SECTIONIN,_T("SectionIn"),1,-1,_T("InstTypeIdx [InstTypeIdx [...]]"),TP_SEC},
|
||||
{TOK_SUBSECTION,_T("SubSection"),1,2,_T("deprecated - use SectionGroup"),TP_GLOBAL},
|
||||
{TOK_SECTIONGROUP,_T("SectionGroup"),1,2,_T("[/e] [un.]section_group_name [section index output]"),TP_GLOBAL},
|
||||
{TOK_SUBSECTIONEND,_T("SubSectionEnd"),0,0,_T("deprecated - use SectionGroupEnd"),TP_GLOBAL},
|
||||
{TOK_SECTIONGROUPEND,_T("SectionGroupEnd"),0,0,_T(""),TP_GLOBAL},
|
||||
{TOK_SEARCHPATH,_T("SearchPath"),2,0,_T("$(user_var: result) filename"),TP_CODE},
|
||||
{TOK_SECTIONSETFLAGS,_T("SectionSetFlags"),2,0,_T("section_index flags"),TP_CODE},
|
||||
{TOK_SECTIONGETFLAGS,_T("SectionGetFlags"),2,0,_T("section_index $(user_var: output flags)"),TP_CODE},
|
||||
{TOK_SECTIONSETINSTTYPES,_T("SectionSetInstTypes"),2,0,_T("section_index inst_types"),TP_CODE},
|
||||
{TOK_SECTIONGETINSTTYPES,_T("SectionGetInstTypes"),2,0,_T("section_index $(user_var: output inst_types)"),TP_CODE},
|
||||
{TOK_SECTIONGETTEXT,_T("SectionGetText"),2,0,_T("section_index $(user_var: output text)"),TP_CODE},
|
||||
{TOK_SECTIONSETTEXT,_T("SectionSetText"),2,0,_T("section_index text_string"),TP_CODE},
|
||||
{TOK_SECTIONGETSIZE,_T("SectionGetSize"),2,0,_T("section_index $(user_var: output size)"),TP_CODE},
|
||||
{TOK_SECTIONSETSIZE,_T("SectionSetSize"),2,0,_T("section_index new_size"),TP_CODE},
|
||||
{TOK_GETCURINSTTYPE,_T("GetCurInstType"),1,0,_T("$(user_var: output inst_type_idx)"),TP_CODE},
|
||||
{TOK_SETCURINSTTYPE,_T("SetCurInstType"),1,0,_T("inst_type_idx"),TP_CODE},
|
||||
{TOK_INSTTYPESETTEXT,_T("InstTypeSetText"),2,0,_T("insttype_index flags"),TP_CODE},
|
||||
{TOK_INSTTYPEGETTEXT,_T("InstTypeGetText"),2,0,_T("insttype_index $(user_var: output flags)"),TP_CODE},
|
||||
{TOK_SENDMESSAGE,_T("SendMessage"),4,2,_T("hwnd message [wparam|STR:wParam] [lparam|STR:lParam] [$(user_var: return value)] [/TIMEOUT=X]"),TP_CODE},
|
||||
{TOK_SETAUTOCLOSE,_T("SetAutoClose"),1,0,_T("(false|true)"),TP_CODE},
|
||||
{TOK_SETCTLCOLORS,_T("SetCtlColors"),2,2,_T("hwnd [/BRANDING] [text_color] [transparent|bg_color]"),TP_CODE},
|
||||
{TOK_SETBRANDINGIMAGE,_T("SetBrandingImage"),1,2,_T("[/IMGID=image_item_id_in_dialog] [/RESIZETOFIT] bitmap.bmp"),TP_CODE},
|
||||
{TOK_SETCOMPRESS,_T("SetCompress"),1,0,_T("(off|auto|force)"),TP_ALL},
|
||||
{TOK_SETCOMPRESSOR,_T("SetCompressor"),1,2,_T("[/FINAL] [/SOLID] (zlib|bzip2|lzma)"),TP_GLOBAL},
|
||||
{TOK_SETCOMPRESSORDICTSIZE,_T("SetCompressorDictSize"),1,0,_T("dict_size_mb"),TP_ALL},
|
||||
{TOK_SETCOMPRESSIONLEVEL,_T("SetCompressionLevel"),1,0,_T("level_0-9"),TP_ALL},
|
||||
{TOK_SETDATESAVE,_T("SetDateSave"),1,0,_T("(off|on)"),TP_ALL},
|
||||
{TOK_SETDETAILSVIEW,_T("SetDetailsView"),1,0,_T("(hide|show)"),TP_CODE},
|
||||
{TOK_SETDETAILSPRINT,_T("SetDetailsPrint"),1,0,_T("(none|listonly|textonly|both)"),TP_CODE},
|
||||
{TOK_SETERRORS,_T("SetErrors"),0,0,_T(""),TP_CODE},
|
||||
{TOK_SETERRORLEVEL,_T("SetErrorLevel"),1,0,_T("error_level"),TP_CODE},
|
||||
{TOK_GETERRORLEVEL,_T("GetErrorLevel"),1,0,_T("$(user_var: output)"),TP_CODE},
|
||||
{TOK_SETFILEATTRIBUTES,_T("SetFileAttributes"),2,0,_T("file attribute[|attribute[...]]\n attribute=(NORMAL|ARCHIVE|HIDDEN|OFFLINE|READONLY|SYSTEM|TEMPORARY|0)"),TP_CODE},
|
||||
{TOK_SETFONT,_T("SetFont"),2,1,_T("[/LANG=lang_id] font_face_name font_size"),TP_GLOBAL},
|
||||
{TOK_SETOUTPATH,_T("SetOutPath"),1,0,_T("output_path"),TP_CODE},
|
||||
{TOK_SETOVERWRITE,_T("SetOverwrite"),1,0,_T("on|off|try|ifnewer|ifdiff"),TP_ALL},
|
||||
{TOK_SETPLUGINUNLOAD,_T("SetPluginUnload"),1,0,_T("deprecated - plug-ins should handle this on their own"),TP_ALL},
|
||||
{TOK_SETREBOOTFLAG,_T("SetRebootFlag"),1,0,_T("true|false"),TP_CODE},
|
||||
{TOK_SETREGVIEW,_T("SetRegView"),1,0,_T("32|64|lastused"),TP_CODE},
|
||||
{TOK_SETSHELLVARCONTEXT,_T("SetShellVarContext"),1,0,_T("all|current"),TP_CODE},
|
||||
{TOK_SETSILENT,_T("SetSilent"),1,0,_T("silent|normal"),TP_CODE},
|
||||
{TOK_SHOWDETAILS,_T("ShowInstDetails"),1,0,_T("(hide|show|nevershow)"),TP_GLOBAL},
|
||||
{TOK_SHOWDETAILSUNINST,_T("ShowUninstDetails"),1,0,_T("(hide|show|nevershow)"),TP_GLOBAL},
|
||||
{TOK_SHOWWINDOW,_T("ShowWindow"),2,0,_T("hwnd show_state"),TP_CODE},
|
||||
{TOK_SILENTINST,_T("SilentInstall"),1,0,_T("(normal|silent|silentlog)"),TP_GLOBAL},
|
||||
{TOK_SILENTUNINST,_T("SilentUnInstall"),1,0,_T("(normal|silent)"),TP_GLOBAL},
|
||||
{TOK_SLEEP,_T("Sleep"),1,0,_T("sleep_time_in_ms"),TP_CODE},
|
||||
{TOK_STRCMP,_T("StrCmp"),3,1,_T("str1 str2 label_to_goto_if_equal [label_to_goto_if_not]"),TP_CODE},
|
||||
{TOK_STRCMPS,_T("StrCmpS"),3,1,_T("str1 str2 label_to_goto_if_equal [label_to_goto_if_not]"),TP_CODE},
|
||||
{TOK_STRCPY,_T("StrCpy"),2,2,_T("$(user_var: output) str [maxlen] [startoffset]"),TP_CODE},
|
||||
{TOK_STRLEN,_T("StrLen"),2,0,_T("$(user_var: length output) str"),TP_CODE},
|
||||
{TOK_SUBCAPTION,_T("SubCaption"),2,0,_T("page_number(0-4) new_subcaption"),TP_GLOBAL},
|
||||
{TOK_UNINSTALLEXENAME,_T("UninstallExeName"),0,0,_T("no longer supported, use WriteUninstaller from section."),TP_ALL},
|
||||
{TOK_UNINSTCAPTION,_T("UninstallCaption"),1,0,_T("uninstaller_caption"),TP_GLOBAL},
|
||||
{TOK_UNINSTICON,_T("UninstallIcon"),1,0,_T("icon_on_local_system.ico"),TP_GLOBAL},
|
||||
#ifdef NSIS_SUPPORT_CODECALLBACKS
|
||||
{TOK_UNINSTPAGE,"UninstPage",1,4,"((custom [creator_function] [leave_function] [caption]) | ((license|components|directory|instfiles|uninstConfirm) [pre_function] [show_function] [leave_function])) [/ENABLECANCEL]",TP_GLOBAL},
|
||||
{TOK_UNINSTPAGE,_T("UninstPage"),1,4,_T("((custom [creator_function] [leave_function] [caption]) | ((license|components|directory|instfiles|uninstConfirm) [pre_function] [show_function] [leave_function])) [/ENABLECANCEL]"),TP_GLOBAL},
|
||||
#else
|
||||
{TOK_UNINSTPAGE,"UninstPage",1,1,"license|components|directory|instfiles|uninstConfirm [/ENABLECANCEL]",TP_GLOBAL},
|
||||
{TOK_UNINSTPAGE,_T("UninstPage"),1,1,_T("license|components|directory|instfiles|uninstConfirm [/ENABLECANCEL]"),TP_GLOBAL},
|
||||
#endif
|
||||
{TOK_UNINSTTEXT,"UninstallText",1,1,"Text_to_go_on_uninstall_page [subtext]",TP_PG},
|
||||
{TOK_UNINSTSUBCAPTION,"UninstallSubCaption",2,0,"page_number(0-2) new_subcaption",TP_GLOBAL},
|
||||
{TOK_UNREGDLL,"UnRegDLL",1,0,"dll_path_on_target.dll",TP_CODE},
|
||||
{TOK_WINDOWICON,"WindowIcon",1,0,"on|off",TP_GLOBAL},
|
||||
{TOK_WRITEINISTR,"WriteINIStr",4,0,"ini_file section_name entry_name new_value",TP_CODE},
|
||||
{TOK_WRITEREGBIN,"WriteRegBin",4,0,"rootkey subkey entry_name hex_string_like_12848412AB\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)",TP_CODE},
|
||||
{TOK_WRITEREGDWORD,"WriteRegDWORD",4,0,"rootkey subkey entry_name new_value_dword\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)",TP_CODE},
|
||||
{TOK_WRITEREGSTR,"WriteRegStr",4,0,"rootkey subkey entry_name new_value_string\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)",TP_CODE},
|
||||
{TOK_WRITEREGEXPANDSTR,"WriteRegExpandStr",4,0,"rootkey subkey entry_name new_value_string\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)",TP_CODE},
|
||||
{TOK_WRITEUNINSTALLER,"WriteUninstaller",1,0,"uninstall_exe_name",TP_CODE},
|
||||
{TOK_XPSTYLE, "XPStyle",1,0,"(on|off)",TP_GLOBAL},
|
||||
{TOK_REQEXECLEVEL, "RequestExecutionLevel",1,0,"none|user|highest|admin",TP_GLOBAL},
|
||||
{TOK_P_PACKEXEHEADER,"!packhdr",2,0,"temp_file_name command_line_to_compress_that_temp_file",TP_ALL},
|
||||
{TOK_P_SYSTEMEXEC,"!system",1,2,"command [<|>|<>|=) retval]",TP_ALL},
|
||||
{TOK_P_EXECUTE,"!execute",1,0,"command",TP_ALL},
|
||||
{TOK_P_ADDINCLUDEDIR,"!AddIncludeDir",1,0,"dir",TP_ALL},
|
||||
{TOK_P_INCLUDE,"!include",1,1,"[/NONFATAL] filename.nsh",TP_ALL},
|
||||
{TOK_P_CD,"!cd",1,0,"absolute_or_relative_new_directory",TP_ALL},
|
||||
{TOK_P_IF,"!if",1,3,"[!] value [(==,!=,<=,<,>,>=,&&,||) value2] [...]",TP_ALL},
|
||||
{TOK_P_IFDEF,"!ifdef",1,-1,"symbol [| symbol2 [& symbol3 [...]]]",TP_ALL},
|
||||
{TOK_P_IFNDEF,"!ifndef",1,-1,"symbol [| symbol2 [& symbol3 [...]]]",TP_ALL},
|
||||
{TOK_P_ENDIF,"!endif",0,0,"",TP_ALL},
|
||||
{TOK_P_DEFINE,"!define",1,4,"([/date|/utcdate] symbol [value]) | (/file symbol filename) | (/math symbol val1 OP val2)\n OP=(+ - * / % & | ^)",TP_ALL},
|
||||
{TOK_P_UNDEF,"!undef",1,1,"symbol [value]",TP_ALL},
|
||||
{TOK_P_ELSE,"!else",0,-1,"[if[macro][n][def] ...]",TP_ALL},
|
||||
{TOK_P_ECHO,"!echo",1,0,"message",TP_ALL},
|
||||
{TOK_P_WARNING,"!warning",0,1,"[warning_message]",TP_ALL},
|
||||
{TOK_P_ERROR,"!error",0,1,"[error_message]",TP_ALL},
|
||||
{TOK_UNINSTTEXT,_T("UninstallText"),1,1,_T("Text_to_go_on_uninstall_page [subtext]"),TP_PG},
|
||||
{TOK_UNINSTSUBCAPTION,_T("UninstallSubCaption"),2,0,_T("page_number(0-2) new_subcaption"),TP_GLOBAL},
|
||||
{TOK_UNREGDLL,_T("UnRegDLL"),1,0,_T("dll_path_on_target.dll"),TP_CODE},
|
||||
{TOK_WINDOWICON,_T("WindowIcon"),1,0,_T("on|off"),TP_GLOBAL},
|
||||
{TOK_WRITEINISTR,_T("WriteINIStr"),4,0,_T("ini_file section_name entry_name new_value"),TP_CODE},
|
||||
{TOK_WRITEREGBIN,_T("WriteRegBin"),4,0,_T("rootkey subkey entry_name hex_string_like_12848412AB\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)"),TP_CODE},
|
||||
{TOK_WRITEREGDWORD,_T("WriteRegDWORD"),4,0,_T("rootkey subkey entry_name new_value_dword\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)"),TP_CODE},
|
||||
{TOK_WRITEREGSTR,_T("WriteRegStr"),4,0,_T("rootkey subkey entry_name new_value_string\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)"),TP_CODE},
|
||||
{TOK_WRITEREGEXPANDSTR,_T("WriteRegExpandStr"),4,0,_T("rootkey subkey entry_name new_value_string\n root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)"),TP_CODE},
|
||||
{TOK_WRITEUNINSTALLER,_T("WriteUninstaller"),1,0,_T("uninstall_exe_name"),TP_CODE},
|
||||
{TOK_XPSTYLE, _T("XPStyle"),1,0,_T("(on|off)"),TP_GLOBAL},
|
||||
{TOK_REQEXECLEVEL, _T("RequestExecutionLevel"),1,0,_T("none|user|highest|admin"),TP_GLOBAL},
|
||||
{TOK_P_PACKEXEHEADER,_T("!packhdr"),2,0,_T("temp_file_name command_line_to_compress_that_temp_file"),TP_ALL},
|
||||
{TOK_P_SYSTEMEXEC,_T("!system"),1,2,_T("command [<|>|<>|=) retval]"),TP_ALL},
|
||||
{TOK_P_EXECUTE,_T("!execute"),1,0,_T("command"),TP_ALL},
|
||||
{TOK_P_ADDINCLUDEDIR,_T("!AddIncludeDir"),1,0,_T("dir"),TP_ALL},
|
||||
{TOK_P_INCLUDE,_T("!include"),1,1,_T("[/NONFATAL] filename.nsh"),TP_ALL},
|
||||
{TOK_P_CD,_T("!cd"),1,0,_T("absolute_or_relative_new_directory"),TP_ALL},
|
||||
{TOK_P_IF,_T("!if"),1,3,_T("[!] value [(==,!=,<=,<,>,>=,&&,||) value2] [...]"),TP_ALL},
|
||||
{TOK_P_IFDEF,_T("!ifdef"),1,-1,_T("symbol [| symbol2 [& symbol3 [...]]]"),TP_ALL},
|
||||
{TOK_P_IFNDEF,_T("!ifndef"),1,-1,_T("symbol [| symbol2 [& symbol3 [...]]]"),TP_ALL},
|
||||
{TOK_P_ENDIF,_T("!endif"),0,0,_T(""),TP_ALL},
|
||||
{TOK_P_DEFINE,_T("!define"),1,4,_T("([/date|/utcdate] symbol [value]) | (/file symbol filename) | (/math symbol val1 OP val2)\n OP=(+ - * / % & | ^)"),TP_ALL},
|
||||
{TOK_P_UNDEF,_T("!undef"),1,1,_T("symbol [value]"),TP_ALL},
|
||||
{TOK_P_ELSE,_T("!else"),0,-1,_T("[if[macro][n][def] ...]"),TP_ALL},
|
||||
{TOK_P_ECHO,_T("!echo"),1,0,_T("message"),TP_ALL},
|
||||
{TOK_P_WARNING,_T("!warning"),0,1,_T("[warning_message]"),TP_ALL},
|
||||
{TOK_P_ERROR,_T("!error"),0,1,_T("[error_message]"),TP_ALL},
|
||||
|
||||
{TOK_P_VERBOSE,"!verbose",1,0,"verbose_level | push | pop",TP_ALL},
|
||||
{TOK_P_VERBOSE,_T("!verbose"),1,0,_T("verbose_level | push | pop"),TP_ALL},
|
||||
|
||||
{TOK_P_MACRO,"!macro",1,-1,"macroname [parms ...]",TP_ALL},
|
||||
{TOK_P_MACROEND,"!macroend",0,0,"",TP_ALL},
|
||||
{TOK_P_INSERTMACRO,"!insertmacro",1,-1,"macroname [parms ...]",TP_ALL},
|
||||
{TOK_P_IFMACRODEF,"!ifmacrodef",1,-1,"macro [| macro2 [& macro3 [...]]]",TP_ALL},
|
||||
{TOK_P_IFMACRONDEF,"!ifmacrondef",1,-1,"macro [| macro2 [& macro3 [...]]]",TP_ALL},
|
||||
{TOK_P_MACRO,_T("!macro"),1,-1,_T("macroname [parms ...]"),TP_ALL},
|
||||
{TOK_P_MACROEND,_T("!macroend"),0,0,_T(""),TP_ALL},
|
||||
{TOK_P_INSERTMACRO,_T("!insertmacro"),1,-1,_T("macroname [parms ...]"),TP_ALL},
|
||||
{TOK_P_IFMACRODEF,_T("!ifmacrodef"),1,-1,_T("macro [| macro2 [& macro3 [...]]]"),TP_ALL},
|
||||
{TOK_P_IFMACRONDEF,_T("!ifmacrondef"),1,-1,_T("macro [| macro2 [& macro3 [...]]]"),TP_ALL},
|
||||
|
||||
{TOK_P_TEMPFILE,"!tempfile",1,0,"symbol",TP_ALL},
|
||||
{TOK_P_DELFILE,"!delfile",1,1,"[/nonfatal] file",TP_ALL},
|
||||
{TOK_P_APPENDFILE,"!appendfile",2,0,"file appended_line",TP_ALL},
|
||||
{TOK_P_TEMPFILE,_T("!tempfile"),1,0,_T("symbol"),TP_ALL},
|
||||
{TOK_P_DELFILE,_T("!delfile"),1,1,_T("[/nonfatal] file"),TP_ALL},
|
||||
{TOK_P_APPENDFILE,_T("!appendfile"),2,0,_T("file appended_line"),TP_ALL},
|
||||
|
||||
{TOK_P_SEARCHPARSESTRING,"!searchparse",3,-1,"[/ignorecase] [/noerrors] [/file] source_string substring OUTPUTSYM1 [substring [OUTPUTSYM2 [substring ...]]]",TP_ALL},
|
||||
{TOK_P_SEARCHREPLACESTRING,"!searchreplace",4,1,"[/ignorecase] output_name source_string substring replacestring", TP_ALL},
|
||||
{TOK_P_SEARCHPARSESTRING,_T("!searchparse"),3,-1,_T("[/ignorecase] [/noerrors] [/file] source_string substring OUTPUTSYM1 [substring [OUTPUTSYM2 [substring ...]]]"),TP_ALL},
|
||||
{TOK_P_SEARCHREPLACESTRING,_T("!searchreplace"),4,1,_T("[/ignorecase] output_name source_string substring replacestring"), TP_ALL},
|
||||
|
||||
{TOK_MISCBUTTONTEXT,"MiscButtonText",0,4,"[back button text] [next button text] [cancel button text] [close button text]",TP_GLOBAL},
|
||||
{TOK_DETAILSBUTTONTEXT,"DetailsButtonText",0,1,"[details button text]",TP_PG},
|
||||
{TOK_UNINSTBUTTONTEXT,"UninstallButtonText",0,1,"[uninstall button text]",TP_GLOBAL},
|
||||
{TOK_INSTBUTTONTEXT,"InstallButtonText",0,1,"[install button text]",TP_GLOBAL},
|
||||
{TOK_SPACETEXTS,"SpaceTexts",0,2,"none | ([space required text] [space available text])",TP_GLOBAL},
|
||||
{TOK_COMPLETEDTEXT,"CompletedText",0,1,"[completed text]",TP_PG},
|
||||
{TOK_MISCBUTTONTEXT,_T("MiscButtonText"),0,4,_T("[back button text] [next button text] [cancel button text] [close button text]"),TP_GLOBAL},
|
||||
{TOK_DETAILSBUTTONTEXT,_T("DetailsButtonText"),0,1,_T("[details button text]"),TP_PG},
|
||||
{TOK_UNINSTBUTTONTEXT,_T("UninstallButtonText"),0,1,_T("[uninstall button text]"),TP_GLOBAL},
|
||||
{TOK_INSTBUTTONTEXT,_T("InstallButtonText"),0,1,_T("[install button text]"),TP_GLOBAL},
|
||||
{TOK_SPACETEXTS,_T("SpaceTexts"),0,2,_T("none | ([space required text] [space available text])"),TP_GLOBAL},
|
||||
{TOK_COMPLETEDTEXT,_T("CompletedText"),0,1,_T("[completed text]"),TP_PG},
|
||||
|
||||
{TOK_GETFUNCTIONADDR,"GetFunctionAddress",2,0,"output function",TP_CODE},
|
||||
{TOK_GETLABELADDR,"GetLabelAddress",2,0,"output label",TP_CODE},
|
||||
{TOK_GETCURRENTADDR,"GetCurrentAddress",1,0,"output",TP_CODE},
|
||||
{TOK_GETFUNCTIONADDR,_T("GetFunctionAddress"),2,0,_T("output function"),TP_CODE},
|
||||
{TOK_GETLABELADDR,_T("GetLabelAddress"),2,0,_T("output label"),TP_CODE},
|
||||
{TOK_GETCURRENTADDR,_T("GetCurrentAddress"),1,0,_T("output"),TP_CODE},
|
||||
|
||||
{TOK_PLUGINDIR,"!AddPluginDir",1,0,"new_plugin_directory",TP_ALL},
|
||||
{TOK_INITPLUGINSDIR,"InitPluginsDir",0,0,"",TP_CODE},
|
||||
{TOK_PLUGINDIR,_T("!AddPluginDir"),1,0,_T("new_plugin_directory"),TP_ALL},
|
||||
{TOK_INITPLUGINSDIR,_T("InitPluginsDir"),0,0,_T(""),TP_CODE},
|
||||
// Added by ramon 23 May 2003
|
||||
{TOK_ALLOWSKIPFILES,"AllowSkipFiles",1,0,"(off|on)",TP_ALL},
|
||||
{TOK_ALLOWSKIPFILES,_T("AllowSkipFiles"),1,0,_T("(off|on)"),TP_ALL},
|
||||
// Added by ramon 3 jun 2003
|
||||
{TOK_DEFVAR,"Var",1,1,"[/GLOBAL] var_name",TP_ALL},
|
||||
{TOK_DEFVAR,_T("Var"),1,1,_T("[/GLOBAL] var_name"),TP_ALL},
|
||||
// Added by ramon 6 jun 2003
|
||||
{TOK_VI_ADDKEY,"VIAddVersionKey",2,1,"/LANG=lang_id keyname value",TP_GLOBAL},
|
||||
{TOK_VI_SETPRODUCTVERSION,"VIProductVersion",1,0,"[version_string_X.X.X.X]",TP_GLOBAL},
|
||||
{TOK_LOCKWINDOW,"LockWindow",1,0,"(on|off)",TP_CODE},
|
||||
{TOK_VI_ADDKEY,_T("VIAddVersionKey"),2,1,_T("/LANG=lang_id keyname value"),TP_GLOBAL},
|
||||
{TOK_VI_SETPRODUCTVERSION,_T("VIProductVersion"),1,0,_T("[version_string_X.X.X.X]"),TP_GLOBAL},
|
||||
{TOK_LOCKWINDOW,_T("LockWindow"),1,0,_T("(on|off)"),TP_CODE},
|
||||
};
|
||||
|
||||
void CEXEBuild::print_help(char *commandname)
|
||||
void CEXEBuild::print_help(TCHAR *commandname)
|
||||
{
|
||||
int x;
|
||||
for (x = 0; x < TOK__LAST; x ++)
|
||||
{
|
||||
if (!commandname || !stricmp(tokenlist[x].name,commandname))
|
||||
{
|
||||
ERROR_MSG("%s%s %s\n",commandname?"Usage: ":"",tokenlist[x].name,tokenlist[x].usage_str);
|
||||
ERROR_MSG(_T("%s%s %s\n"),commandname?_T("Usage: "):_T(""),tokenlist[x].name,tokenlist[x].usage_str);
|
||||
if (commandname) break;
|
||||
}
|
||||
}
|
||||
if (x == TOK__LAST && commandname)
|
||||
{
|
||||
ERROR_MSG("Invalid command \"%s\"\n",commandname);
|
||||
ERROR_MSG(_T("Invalid command \"%s\"\n"),commandname);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool CEXEBuild::is_valid_token(char *s)
|
||||
bool CEXEBuild::is_valid_token(TCHAR *s)
|
||||
{
|
||||
for (int x = 0; x < TOK__LAST; x ++)
|
||||
if (!stricmp(tokenlist[x].name,s))
|
||||
|
@ -309,7 +311,7 @@ bool CEXEBuild::is_valid_token(char *s)
|
|||
return false;
|
||||
}
|
||||
|
||||
int CEXEBuild::get_commandtoken(char *s, int *np, int *op, int *pos)
|
||||
int CEXEBuild::get_commandtoken(TCHAR *s, int *np, int *op, int *pos)
|
||||
{
|
||||
int x;
|
||||
for (x = 0; x < TOK__LAST; x ++)
|
||||
|
@ -343,7 +345,7 @@ int CEXEBuild::GetCurrentTokenPlace()
|
|||
return TP_GLOBAL;
|
||||
}
|
||||
|
||||
int CEXEBuild::IsTokenPlacedRight(int pos, char *tok)
|
||||
int CEXEBuild::IsTokenPlacedRight(int pos, TCHAR *tok)
|
||||
{
|
||||
if ((unsigned int) pos > (sizeof(tokenlist) / sizeof(tokenType)))
|
||||
return PS_OK;
|
||||
|
@ -354,45 +356,45 @@ int CEXEBuild::IsTokenPlacedRight(int pos, char *tok)
|
|||
return PS_OK;
|
||||
}
|
||||
else {
|
||||
char err[1024];
|
||||
TCHAR err[1024];
|
||||
if (cp == TP_SEC) {
|
||||
strcpy(err, "Error: command %s not valid in Section\n");
|
||||
_tcscpy(err, _T("Error: command %s not valid in Section\n"));
|
||||
}
|
||||
else if (cp == TP_FUNC) {
|
||||
strcpy(err, "Error: command %s not valid in Function\n");
|
||||
_tcscpy(err, _T("Error: command %s not valid in Function\n"));
|
||||
}
|
||||
else if (cp == TP_PAGEEX) {
|
||||
strcpy(err, "Error: command %s not valid in PageEx\n");
|
||||
_tcscpy(err, _T("Error: command %s not valid in PageEx\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(err, "Error: command %s not valid outside ");
|
||||
_tcscpy(err, _T("Error: command %s not valid outside "));
|
||||
if (tp & TP_SEC)
|
||||
strcat(err, "Section");
|
||||
_tcscat(err, _T("Section"));
|
||||
if (tp & TP_FUNC)
|
||||
{
|
||||
if (tp & TP_SEC)
|
||||
{
|
||||
if (tp & TP_PAGEEX)
|
||||
{
|
||||
strcat(err, ", ");
|
||||
_tcscat(err, _T(", "));
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(err, " or ");
|
||||
_tcscat(err, _T(" or "));
|
||||
}
|
||||
}
|
||||
strcat(err, "Function");
|
||||
_tcscat(err, _T("Function"));
|
||||
}
|
||||
if (tp & TP_PAGEEX)
|
||||
{
|
||||
if (tp & TP_CODE)
|
||||
{
|
||||
strcat(err, " or ");
|
||||
_tcscat(err, _T(" or "));
|
||||
}
|
||||
strcat(err, "PageEx");
|
||||
_tcscat(err, _T("PageEx"));
|
||||
}
|
||||
strcat(err, "\n");
|
||||
_tcscat(err, _T("\n"));
|
||||
}
|
||||
ERROR_MSG(err, tok);
|
||||
return PS_ERROR;
|
||||
|
|
548
Source/tokens.h
548
Source/tokens.h
|
@ -1,277 +1,277 @@
|
|||
/*
|
||||
* tokens.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 _TOKENS_H_
|
||||
#define _TOKENS_H_
|
||||
|
||||
// the order of these two lists no longer needs to match. -J
|
||||
enum
|
||||
{
|
||||
// header setting tokens
|
||||
TOK_NAME,
|
||||
TOK_CAPTION,
|
||||
TOK_UNINSTCAPTION,
|
||||
TOK_ICON,
|
||||
TOK_UNINSTICON,
|
||||
TOK_CHECKBITMAP,
|
||||
TOK_WINDOWICON,
|
||||
TOK_DIRTEXT,
|
||||
TOK_COMPTEXT,
|
||||
TOK_LICENSEBKCOLOR,
|
||||
TOK_LICENSEDATA,
|
||||
TOK_LICENSEFORCESELECTION,
|
||||
TOK_LICENSELANGSTRING,
|
||||
TOK_LICENSETEXT,
|
||||
TOK_UNINSTTEXT,
|
||||
TOK_SILENTINST,
|
||||
TOK_SILENTUNINST,
|
||||
TOK_INSTTYPE,
|
||||
TOK_OUTFILE,
|
||||
TOK_INSTDIR,
|
||||
TOK_INSTALLDIRREGKEY,
|
||||
TOK_UNINSTALLEXENAME,
|
||||
TOK_CRCCHECK,
|
||||
TOK_AUTOCLOSE,
|
||||
TOK_SHOWDETAILS,
|
||||
TOK_SHOWDETAILSUNINST,
|
||||
TOK_DIRSHOW,
|
||||
TOK_ROOTDIRINST,
|
||||
TOK_BGFONT,
|
||||
TOK_BGGRADIENT,
|
||||
TOK_INSTCOLORS,
|
||||
TOK_SUBCAPTION,
|
||||
TOK_UNINSTSUBCAPTION,
|
||||
TOK_BRANDINGTEXT,
|
||||
TOK_FILEERRORTEXT,
|
||||
TOK_INSTPROGRESSFLAGS,
|
||||
TOK_XPSTYLE,
|
||||
TOK_REQEXECLEVEL,
|
||||
TOK_CHANGEUI,
|
||||
TOK_ADDBRANDINGIMAGE,
|
||||
TOK_SETFONT,
|
||||
TOK_LOADNLF,
|
||||
TOK_RESERVEFILE,
|
||||
TOK_ALLOWSKIPFILES,
|
||||
TOK_DEFVAR,
|
||||
TOK_VI_ADDKEY,
|
||||
TOK_VI_SETPRODUCTVERSION,
|
||||
|
||||
TOK_MISCBUTTONTEXT,
|
||||
TOK_DETAILSBUTTONTEXT,
|
||||
TOK_UNINSTBUTTONTEXT,
|
||||
TOK_INSTBUTTONTEXT,
|
||||
TOK_SPACETEXTS,
|
||||
TOK_COMPLETEDTEXT,
|
||||
|
||||
TOK_LANGSTRING,
|
||||
TOK_LANGSTRINGUP,
|
||||
|
||||
// compression stuff
|
||||
TOK_SETCOMPRESS,
|
||||
TOK_DBOPTIMIZE,
|
||||
TOK_SETCOMPRESSOR,
|
||||
TOK_SETCOMPRESSORDICTSIZE,
|
||||
TOK_SETCOMPRESSIONLEVEL,
|
||||
TOK_FILEBUFSIZE,
|
||||
|
||||
// system "preprocessor"ish tokens
|
||||
TOK_P_IF,
|
||||
TOK_P_IFDEF,
|
||||
TOK_P_IFNDEF,
|
||||
TOK_P_ELSE,
|
||||
TOK_P_ENDIF,
|
||||
TOK_P_DEFINE,
|
||||
TOK_P_UNDEF,
|
||||
TOK_P_PACKEXEHEADER,
|
||||
TOK_P_SYSTEMEXEC,
|
||||
TOK_P_EXECUTE,
|
||||
TOK_P_ADDINCLUDEDIR,
|
||||
TOK_P_INCLUDE,
|
||||
TOK_P_CD,
|
||||
TOK_P_ECHO,
|
||||
TOK_P_WARNING,
|
||||
TOK_P_ERROR,
|
||||
|
||||
TOK_P_VERBOSE,
|
||||
|
||||
TOK_P_MACRO,
|
||||
TOK_P_MACROEND,
|
||||
TOK_P_INSERTMACRO,
|
||||
TOK_P_IFMACRODEF,
|
||||
TOK_P_IFMACRONDEF,
|
||||
|
||||
TOK_P_TEMPFILE,
|
||||
TOK_P_DELFILE,
|
||||
TOK_P_APPENDFILE,
|
||||
/*
|
||||
* tokens.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 _TOKENS_H_
|
||||
#define _TOKENS_H_
|
||||
|
||||
// the order of these two lists no longer needs to match. -J
|
||||
enum
|
||||
{
|
||||
// header setting tokens
|
||||
TOK_NAME,
|
||||
TOK_CAPTION,
|
||||
TOK_UNINSTCAPTION,
|
||||
TOK_ICON,
|
||||
TOK_UNINSTICON,
|
||||
TOK_CHECKBITMAP,
|
||||
TOK_WINDOWICON,
|
||||
TOK_DIRTEXT,
|
||||
TOK_COMPTEXT,
|
||||
TOK_LICENSEBKCOLOR,
|
||||
TOK_LICENSEDATA,
|
||||
TOK_LICENSEFORCESELECTION,
|
||||
TOK_LICENSELANGSTRING,
|
||||
TOK_LICENSETEXT,
|
||||
TOK_UNINSTTEXT,
|
||||
TOK_SILENTINST,
|
||||
TOK_SILENTUNINST,
|
||||
TOK_INSTTYPE,
|
||||
TOK_OUTFILE,
|
||||
TOK_INSTDIR,
|
||||
TOK_INSTALLDIRREGKEY,
|
||||
TOK_UNINSTALLEXENAME,
|
||||
TOK_CRCCHECK,
|
||||
TOK_AUTOCLOSE,
|
||||
TOK_SHOWDETAILS,
|
||||
TOK_SHOWDETAILSUNINST,
|
||||
TOK_DIRSHOW,
|
||||
TOK_ROOTDIRINST,
|
||||
TOK_BGFONT,
|
||||
TOK_BGGRADIENT,
|
||||
TOK_INSTCOLORS,
|
||||
TOK_SUBCAPTION,
|
||||
TOK_UNINSTSUBCAPTION,
|
||||
TOK_BRANDINGTEXT,
|
||||
TOK_FILEERRORTEXT,
|
||||
TOK_INSTPROGRESSFLAGS,
|
||||
TOK_XPSTYLE,
|
||||
TOK_REQEXECLEVEL,
|
||||
TOK_CHANGEUI,
|
||||
TOK_ADDBRANDINGIMAGE,
|
||||
TOK_SETFONT,
|
||||
TOK_LOADNLF,
|
||||
TOK_RESERVEFILE,
|
||||
TOK_ALLOWSKIPFILES,
|
||||
TOK_DEFVAR,
|
||||
TOK_VI_ADDKEY,
|
||||
TOK_VI_SETPRODUCTVERSION,
|
||||
|
||||
TOK_MISCBUTTONTEXT,
|
||||
TOK_DETAILSBUTTONTEXT,
|
||||
TOK_UNINSTBUTTONTEXT,
|
||||
TOK_INSTBUTTONTEXT,
|
||||
TOK_SPACETEXTS,
|
||||
TOK_COMPLETEDTEXT,
|
||||
|
||||
TOK_LANGSTRING,
|
||||
TOK_LANGSTRINGUP,
|
||||
|
||||
// compression stuff
|
||||
TOK_SETCOMPRESS,
|
||||
TOK_DBOPTIMIZE,
|
||||
TOK_SETCOMPRESSOR,
|
||||
TOK_SETCOMPRESSORDICTSIZE,
|
||||
TOK_SETCOMPRESSIONLEVEL,
|
||||
TOK_FILEBUFSIZE,
|
||||
|
||||
// system "preprocessor"ish tokens
|
||||
TOK_P_IF,
|
||||
TOK_P_IFDEF,
|
||||
TOK_P_IFNDEF,
|
||||
TOK_P_ELSE,
|
||||
TOK_P_ENDIF,
|
||||
TOK_P_DEFINE,
|
||||
TOK_P_UNDEF,
|
||||
TOK_P_PACKEXEHEADER,
|
||||
TOK_P_SYSTEMEXEC,
|
||||
TOK_P_EXECUTE,
|
||||
TOK_P_ADDINCLUDEDIR,
|
||||
TOK_P_INCLUDE,
|
||||
TOK_P_CD,
|
||||
TOK_P_ECHO,
|
||||
TOK_P_WARNING,
|
||||
TOK_P_ERROR,
|
||||
|
||||
TOK_P_VERBOSE,
|
||||
|
||||
TOK_P_MACRO,
|
||||
TOK_P_MACROEND,
|
||||
TOK_P_INSERTMACRO,
|
||||
TOK_P_IFMACRODEF,
|
||||
TOK_P_IFMACRONDEF,
|
||||
|
||||
TOK_P_TEMPFILE,
|
||||
TOK_P_DELFILE,
|
||||
TOK_P_APPENDFILE,
|
||||
|
||||
TOK_P_SEARCHPARSESTRING,
|
||||
TOK_P_SEARCHREPLACESTRING,
|
||||
|
||||
// section/function shit
|
||||
TOK_SECTION,
|
||||
TOK_SECTIONEND,
|
||||
TOK_SECTIONIN,
|
||||
TOK_SECTIONGROUP,
|
||||
TOK_SECTIONGROUPEND,
|
||||
TOK_SUBSECTION,
|
||||
TOK_SUBSECTIONEND,
|
||||
TOK_FUNCTION,
|
||||
TOK_FUNCTIONEND,
|
||||
TOK_ADDSIZE,
|
||||
|
||||
// page ordering
|
||||
TOK_PAGE,
|
||||
TOK_UNINSTPAGE,
|
||||
|
||||
// PageEx stuff
|
||||
TOK_PAGEEX,
|
||||
TOK_PAGEEXEND,
|
||||
TOK_DIRVAR,
|
||||
TOK_DIRVERIFY,
|
||||
TOK_PAGECALLBACKS,
|
||||
|
||||
TOK_GETINSTDIRERROR,
|
||||
|
||||
// flag setters
|
||||
TOK_SETDATESAVE,
|
||||
TOK_SETOVERWRITE,
|
||||
TOK_SETPLUGINUNLOAD,
|
||||
|
||||
// instructions
|
||||
TOK_NOP,
|
||||
TOK_GOTO,
|
||||
TOK_RET,
|
||||
TOK_CALL,
|
||||
TOK_SETOUTPATH,
|
||||
TOK_CREATEDIR,
|
||||
TOK_EXEC,
|
||||
TOK_EXECWAIT,
|
||||
TOK_EXECSHELL,
|
||||
TOK_CALLINSTDLL,
|
||||
TOK_REGDLL,
|
||||
TOK_UNREGDLL,
|
||||
TOK_RENAME,
|
||||
TOK_MESSAGEBOX,
|
||||
TOK_DELETEREGVALUE,
|
||||
TOK_DELETEREGKEY,
|
||||
TOK_WRITEREGSTR,
|
||||
TOK_WRITEREGEXPANDSTR,
|
||||
TOK_WRITEREGBIN,
|
||||
TOK_WRITEREGDWORD,
|
||||
TOK_DELETEINISEC,
|
||||
TOK_DELETEINISTR,
|
||||
TOK_FLUSHINI,
|
||||
TOK_WRITEINISTR,
|
||||
TOK_CREATESHORTCUT,
|
||||
TOK_FINDWINDOW,
|
||||
TOK_DELETE,
|
||||
TOK_RMDIR,
|
||||
TOK_FILE,
|
||||
TOK_COPYFILES,
|
||||
TOK_SETFILEATTRIBUTES,
|
||||
TOK_SLEEP,
|
||||
TOK_BRINGTOFRONT,
|
||||
TOK_HIDEWINDOW,
|
||||
TOK_IFFILEEXISTS,
|
||||
TOK_ABORT,
|
||||
TOK_QUIT,
|
||||
TOK_SETDETAILSVIEW,
|
||||
TOK_SETDETAILSPRINT,
|
||||
TOK_SETAUTOCLOSE,
|
||||
TOK_IFERRORS,
|
||||
TOK_CLEARERRORS,
|
||||
TOK_SETERRORS,
|
||||
TOK_IFABORT,
|
||||
TOK_STRCPY,
|
||||
TOK_STRCMP,
|
||||
TOK_STRCMPS,
|
||||
TOK_GETTEMPFILENAME,
|
||||
TOK_GETFUNCTIONADDR,
|
||||
TOK_GETLABELADDR,
|
||||
TOK_GETCURRENTADDR,
|
||||
TOK_READINISTR,
|
||||
TOK_READREGSTR,
|
||||
TOK_READREGDWORD,
|
||||
TOK_READENVSTR,
|
||||
TOK_EXPANDENVSTRS,
|
||||
TOK_DETAILPRINT,
|
||||
TOK_SEARCHPATH,
|
||||
TOK_GETDLLVERSION,
|
||||
TOK_GETDLLVERSIONLOCAL,
|
||||
TOK_GETFILETIME,
|
||||
TOK_GETFILETIMELOCAL,
|
||||
TOK_STRLEN,
|
||||
TOK_INTOP,
|
||||
TOK_INTCMP,
|
||||
TOK_INTCMPU,
|
||||
TOK_INTFMT,
|
||||
TOK_ENUMREGKEY,
|
||||
TOK_ENUMREGVAL,
|
||||
TOK_PUSH,
|
||||
TOK_POP,
|
||||
TOK_EXCH,
|
||||
TOK_SENDMESSAGE,
|
||||
TOK_ISWINDOW,
|
||||
TOK_GETDLGITEM,
|
||||
TOK_SETCTLCOLORS,
|
||||
TOK_FINDFIRST,
|
||||
TOK_FINDNEXT,
|
||||
TOK_FINDCLOSE,
|
||||
TOK_FILEOPEN,
|
||||
TOK_FILECLOSE,
|
||||
TOK_FILEREAD,
|
||||
TOK_FILEWRITE,
|
||||
TOK_FILEREADBYTE,
|
||||
TOK_FILEWRITEBYTE,
|
||||
TOK_FILESEEK,
|
||||
TOK_GETFULLPATHNAME,
|
||||
TOK_REBOOT,
|
||||
TOK_IFREBOOTFLAG,
|
||||
TOK_SETREBOOTFLAG,
|
||||
TOK_WRITEUNINSTALLER,
|
||||
TOK_LOGSET,
|
||||
TOK_LOGTEXT,
|
||||
TOK_SETBRANDINGIMAGE,
|
||||
TOK_SECTIONSETTEXT,
|
||||
TOK_SECTIONGETTEXT,
|
||||
TOK_SECTIONSETFLAGS,
|
||||
TOK_SECTIONGETFLAGS,
|
||||
TOK_SECTIONSETINSTTYPES,
|
||||
TOK_SECTIONGETINSTTYPES,
|
||||
TOK_SECTIONSETSIZE,
|
||||
TOK_SECTIONGETSIZE,
|
||||
TOK_INSTTYPESETTEXT,
|
||||
TOK_INSTTYPEGETTEXT,
|
||||
TOK_GETCURINSTTYPE,
|
||||
TOK_SETCURINSTTYPE,
|
||||
TOK_SETREGVIEW,
|
||||
TOK_SETSHELLVARCONTEXT,
|
||||
TOK_PLUGINDIR,
|
||||
TOK_INITPLUGINSDIR,
|
||||
TOK_CREATEFONT,
|
||||
TOK_SHOWWINDOW,
|
||||
TOK_ENABLEWINDOW,
|
||||
TOK_SETSILENT,
|
||||
TOK_IFSILENT,
|
||||
TOK_SETERRORLEVEL,
|
||||
TOK_GETERRORLEVEL,
|
||||
TOK_LOCKWINDOW,
|
||||
|
||||
TOK__LAST,
|
||||
TOK__PLUGINCOMMAND
|
||||
};
|
||||
|
||||
#endif//_TOKENS_H_
|
||||
|
||||
// section/function stuff
|
||||
TOK_SECTION,
|
||||
TOK_SECTIONEND,
|
||||
TOK_SECTIONIN,
|
||||
TOK_SECTIONGROUP,
|
||||
TOK_SECTIONGROUPEND,
|
||||
TOK_SUBSECTION,
|
||||
TOK_SUBSECTIONEND,
|
||||
TOK_FUNCTION,
|
||||
TOK_FUNCTIONEND,
|
||||
TOK_ADDSIZE,
|
||||
|
||||
// page ordering
|
||||
TOK_PAGE,
|
||||
TOK_UNINSTPAGE,
|
||||
|
||||
// PageEx stuff
|
||||
TOK_PAGEEX,
|
||||
TOK_PAGEEXEND,
|
||||
TOK_DIRVAR,
|
||||
TOK_DIRVERIFY,
|
||||
TOK_PAGECALLBACKS,
|
||||
|
||||
TOK_GETINSTDIRERROR,
|
||||
|
||||
// flag setters
|
||||
TOK_SETDATESAVE,
|
||||
TOK_SETOVERWRITE,
|
||||
TOK_SETPLUGINUNLOAD,
|
||||
|
||||
// instructions
|
||||
TOK_NOP,
|
||||
TOK_GOTO,
|
||||
TOK_RET,
|
||||
TOK_CALL,
|
||||
TOK_SETOUTPATH,
|
||||
TOK_CREATEDIR,
|
||||
TOK_EXEC,
|
||||
TOK_EXECWAIT,
|
||||
TOK_EXECSHELL,
|
||||
TOK_CALLINSTDLL,
|
||||
TOK_REGDLL,
|
||||
TOK_UNREGDLL,
|
||||
TOK_RENAME,
|
||||
TOK_MESSAGEBOX,
|
||||
TOK_DELETEREGVALUE,
|
||||
TOK_DELETEREGKEY,
|
||||
TOK_WRITEREGSTR,
|
||||
TOK_WRITEREGEXPANDSTR,
|
||||
TOK_WRITEREGBIN,
|
||||
TOK_WRITEREGDWORD,
|
||||
TOK_DELETEINISEC,
|
||||
TOK_DELETEINISTR,
|
||||
TOK_FLUSHINI,
|
||||
TOK_WRITEINISTR,
|
||||
TOK_CREATESHORTCUT,
|
||||
TOK_FINDWINDOW,
|
||||
TOK_DELETE,
|
||||
TOK_RMDIR,
|
||||
TOK_FILE,
|
||||
TOK_COPYFILES,
|
||||
TOK_SETFILEATTRIBUTES,
|
||||
TOK_SLEEP,
|
||||
TOK_BRINGTOFRONT,
|
||||
TOK_HIDEWINDOW,
|
||||
TOK_IFFILEEXISTS,
|
||||
TOK_ABORT,
|
||||
TOK_QUIT,
|
||||
TOK_SETDETAILSVIEW,
|
||||
TOK_SETDETAILSPRINT,
|
||||
TOK_SETAUTOCLOSE,
|
||||
TOK_IFERRORS,
|
||||
TOK_CLEARERRORS,
|
||||
TOK_SETERRORS,
|
||||
TOK_IFABORT,
|
||||
TOK_STRCPY,
|
||||
TOK_STRCMP,
|
||||
TOK_STRCMPS,
|
||||
TOK_GETTEMPFILENAME,
|
||||
TOK_GETFUNCTIONADDR,
|
||||
TOK_GETLABELADDR,
|
||||
TOK_GETCURRENTADDR,
|
||||
TOK_READINISTR,
|
||||
TOK_READREGSTR,
|
||||
TOK_READREGDWORD,
|
||||
TOK_READENVSTR,
|
||||
TOK_EXPANDENVSTRS,
|
||||
TOK_DETAILPRINT,
|
||||
TOK_SEARCHPATH,
|
||||
TOK_GETDLLVERSION,
|
||||
TOK_GETDLLVERSIONLOCAL,
|
||||
TOK_GETFILETIME,
|
||||
TOK_GETFILETIMELOCAL,
|
||||
TOK_STRLEN,
|
||||
TOK_INTOP,
|
||||
TOK_INTCMP,
|
||||
TOK_INTCMPU,
|
||||
TOK_INTFMT,
|
||||
TOK_ENUMREGKEY,
|
||||
TOK_ENUMREGVAL,
|
||||
TOK_PUSH,
|
||||
TOK_POP,
|
||||
TOK_EXCH,
|
||||
TOK_SENDMESSAGE,
|
||||
TOK_ISWINDOW,
|
||||
TOK_GETDLGITEM,
|
||||
TOK_SETCTLCOLORS,
|
||||
TOK_FINDFIRST,
|
||||
TOK_FINDNEXT,
|
||||
TOK_FINDCLOSE,
|
||||
TOK_FILEOPEN,
|
||||
TOK_FILECLOSE,
|
||||
TOK_FILEREAD,
|
||||
TOK_FILEWRITE,
|
||||
TOK_FILEREADBYTE,
|
||||
TOK_FILEWRITEBYTE,
|
||||
TOK_FILESEEK,
|
||||
TOK_GETFULLPATHNAME,
|
||||
TOK_REBOOT,
|
||||
TOK_IFREBOOTFLAG,
|
||||
TOK_SETREBOOTFLAG,
|
||||
TOK_WRITEUNINSTALLER,
|
||||
TOK_LOGSET,
|
||||
TOK_LOGTEXT,
|
||||
TOK_SETBRANDINGIMAGE,
|
||||
TOK_SECTIONSETTEXT,
|
||||
TOK_SECTIONGETTEXT,
|
||||
TOK_SECTIONSETFLAGS,
|
||||
TOK_SECTIONGETFLAGS,
|
||||
TOK_SECTIONSETINSTTYPES,
|
||||
TOK_SECTIONGETINSTTYPES,
|
||||
TOK_SECTIONSETSIZE,
|
||||
TOK_SECTIONGETSIZE,
|
||||
TOK_INSTTYPESETTEXT,
|
||||
TOK_INSTTYPEGETTEXT,
|
||||
TOK_GETCURINSTTYPE,
|
||||
TOK_SETCURINSTTYPE,
|
||||
TOK_SETREGVIEW,
|
||||
TOK_SETSHELLVARCONTEXT,
|
||||
TOK_PLUGINDIR,
|
||||
TOK_INITPLUGINSDIR,
|
||||
TOK_CREATEFONT,
|
||||
TOK_SHOWWINDOW,
|
||||
TOK_ENABLEWINDOW,
|
||||
TOK_SETSILENT,
|
||||
TOK_IFSILENT,
|
||||
TOK_SETERRORLEVEL,
|
||||
TOK_GETERRORLEVEL,
|
||||
TOK_LOCKWINDOW,
|
||||
|
||||
TOK__LAST,
|
||||
TOK__PLUGINCOMMAND
|
||||
};
|
||||
|
||||
#endif//_TOKENS_H_
|
||||
|
|
91
Source/tstring.h
Normal file
91
Source/tstring.h
Normal file
|
@ -0,0 +1,91 @@
|
|||
// tstring.h
|
||||
//
|
||||
// This file is a part of Unicode NSIS.
|
||||
//
|
||||
// Copyright (C) 2007-2009 Jim Park
|
||||
//
|
||||
// Licensed under the zlib/libpng license (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
//
|
||||
// This software is provided 'as-is', without any expressed or implied
|
||||
// warranty.
|
||||
//
|
||||
// Provides TSTRING support.
|
||||
|
||||
/*
|
||||
Unicode support by Jim Park -- 07/23/2007
|
||||
*/
|
||||
|
||||
#ifndef _TSTRING_
|
||||
#define _TSTRING_
|
||||
|
||||
#include "tchar.h"
|
||||
#include <string>
|
||||
//#include <windows.h>
|
||||
//#include <fstream>
|
||||
|
||||
/* Abstract string type as well. */
|
||||
#ifdef _UNICODE
|
||||
typedef std::wstring tstring;
|
||||
typedef std::wofstream tofstream;
|
||||
typedef std::wifstream tifstream;
|
||||
// Use the following macros to open text files.
|
||||
// #define FOPENTEXT(file, mode) _wfopen(file, mode ## L", ccs=Unicode")
|
||||
FILE* FileOpenUnicodeText(const TCHAR* file, const TCHAR* mode);
|
||||
#define FOPENTEXT(file, mode) FileOpenUnicodeText(file, mode)
|
||||
#else
|
||||
typedef std::string tstring;
|
||||
typedef std::ofstream tofstream;
|
||||
typedef std::ifstream tifstream;
|
||||
// Use the following macros to open text files.
|
||||
#define FOPENTEXT(file, mode) fopen(file, mode)
|
||||
#endif
|
||||
|
||||
#ifndef _UNICODE
|
||||
#define CtoTString(str) (str)
|
||||
#define TtoCString(str) (str)
|
||||
#else
|
||||
|
||||
// This is a helpful little function for converting exceptions or
|
||||
// other system type things that come back ANSI and must be
|
||||
// utilized as either ANSI or WCHAR depending on _UNICODE.
|
||||
class CtoTString
|
||||
{
|
||||
public:
|
||||
CtoTString(const char* str)
|
||||
{
|
||||
int len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
|
||||
m_wStr = (wchar_t*) GlobalAlloc(GPTR, len*sizeof(wchar_t));
|
||||
MultiByteToWideChar(CP_ACP, 0, str, -1, m_wStr, len);
|
||||
}
|
||||
|
||||
~CtoTString() { GlobalFree(m_wStr); m_wStr = 0; }
|
||||
|
||||
operator const wchar_t* tstr() { return m_wStr; }
|
||||
|
||||
private:
|
||||
wchar_t* m_wStr;
|
||||
};
|
||||
|
||||
// There may be system things that require C strings but we
|
||||
// may actually have Unicode strings.
|
||||
class TtoCString
|
||||
{
|
||||
public:
|
||||
TtoCString(const wchar_t* wStr)
|
||||
{
|
||||
int len = WideCharToMultiByte(CP_ACP, 0, wStr, -1, NULL, 0, 0, 0);
|
||||
m_cStr = (char*) GlobalAlloc(GPTR, len);
|
||||
WideCharToMultiByte(CP_ACP, 0, wStr, -1, m_cStr, len, 0, 0);
|
||||
}
|
||||
|
||||
~TtoCString() { GlobalFree(m_cStr); m_cStr = 0; }
|
||||
|
||||
operator const char*() { return m_cStr; }
|
||||
|
||||
private:
|
||||
char* m_cStr;
|
||||
};
|
||||
#endif // _UNICODE
|
||||
|
||||
#endif
|
|
@ -35,7 +35,7 @@ class UserVarsStringList : public SortedStringListND<struct uservarstring>
|
|||
}
|
||||
~UserVarsStringList() { }
|
||||
|
||||
int add(const char *name, int ref_count = 0 )
|
||||
int add(const TCHAR *name, int ref_count = 0 )
|
||||
{
|
||||
int pos=SortedStringListND<struct uservarstring>::add(name);
|
||||
if (pos == -1) return -1;
|
||||
|
@ -50,18 +50,38 @@ class UserVarsStringList : public SortedStringListND<struct uservarstring>
|
|||
return temp;
|
||||
}
|
||||
|
||||
int get(const char *name, int n_chars = -1)
|
||||
/**
|
||||
* Get the index of the string that matches 'name.'
|
||||
*
|
||||
* @param name The name of the string to search for.
|
||||
* @param n_chars If -1, match entire string, otherwise compare only
|
||||
* n_chars worth of characters.
|
||||
* @return The index position of the structure where structure.name ==
|
||||
* name.
|
||||
*/
|
||||
int get(const TCHAR *name, int n_chars = -1)
|
||||
{
|
||||
int v=SortedStringListND<struct uservarstring>::find(name, n_chars);
|
||||
if (v==-1) return -1;
|
||||
return (((struct uservarstring*)gr.get())[v].index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of strings.
|
||||
*
|
||||
* @return The count of strings.
|
||||
*/
|
||||
int getnum()
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the index of the structure, return the reference count.
|
||||
*
|
||||
* @return The reference count of the nth uservarstring structure.
|
||||
* If not found, returns -1.
|
||||
*/
|
||||
int get_reference(int idx)
|
||||
{
|
||||
int pos=get_internal_idx(idx);
|
||||
|
@ -69,6 +89,12 @@ class UserVarsStringList : public SortedStringListND<struct uservarstring>
|
|||
return (((struct uservarstring*)gr.get())[pos].reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the index of the structure, increment the reference count.
|
||||
*
|
||||
* @return The previous reference count (before the increment).
|
||||
* If not found, returns -1.
|
||||
*/
|
||||
int inc_reference(int idx)
|
||||
{
|
||||
int pos=get_internal_idx(idx);
|
||||
|
@ -76,12 +102,12 @@ class UserVarsStringList : public SortedStringListND<struct uservarstring>
|
|||
return (((struct uservarstring*)gr.get())[pos].reference)-1;
|
||||
}
|
||||
|
||||
char *idx2name(int idx)
|
||||
TCHAR *idx2name(int idx)
|
||||
{
|
||||
int pos=get_internal_idx(idx);
|
||||
if (pos==-1) return NULL;
|
||||
struct uservarstring *data=(struct uservarstring *)gr.get();
|
||||
return ((char*)strings.get() + data[pos].name);
|
||||
return ((TCHAR*)strings.get() + data[pos].name);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
190
Source/util.cpp
190
Source/util.cpp
|
@ -13,17 +13,17 @@
|
|||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*/
|
||||
|
||||
/* Unicode support by Jim Park -- 07/23/2007 */
|
||||
#include "Platform.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include "tchar.h"
|
||||
#include "exehead/fileform.h"
|
||||
#include "util.h"
|
||||
#include "strlist.h"
|
||||
#include "winchar.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <ctype.h>
|
||||
# include <unistd.h> // for close(2)
|
||||
|
@ -55,10 +55,10 @@ void dopause(void)
|
|||
{
|
||||
if (g_dopause)
|
||||
{
|
||||
if (g_display_errors) fprintf(g_output,"MakeNSIS done - hit enter to close...");
|
||||
if (g_display_errors) _ftprintf(g_output,_T("MakeNSIS done - hit enter to close..."));
|
||||
fflush(stdout);
|
||||
int a;
|
||||
while ((a=getchar()) != '\r' && a != '\n' && a != 27/*esc*/);
|
||||
while ((a=_gettchar()) != _T('\r') && a != _T('\n') && a != 27/*esc*/);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,8 +67,8 @@ void dopause(void)
|
|||
// Returns -2 if the file is an invalid bitmap
|
||||
// Returns -3 if the size doesn't match
|
||||
// Returns -4 if the bpp doesn't match
|
||||
int update_bitmap(CResourceEditor* re, WORD id, const char* filename, int width/*=0*/, int height/*=0*/, int maxbpp/*=0*/) {
|
||||
FILE *f = FOPEN(filename, "rb");
|
||||
int update_bitmap(CResourceEditor* re, WORD id, const TCHAR* filename, int width/*=0*/, int height/*=0*/, int maxbpp/*=0*/) {
|
||||
FILE *f = FOPEN(filename, _T("rb"));
|
||||
if (!f) return -1;
|
||||
|
||||
if (fgetc(f) != 'B' || fgetc(f) != 'M') {
|
||||
|
@ -134,23 +134,23 @@ int update_bitmap(CResourceEditor* re, WORD id, const char* filename, int width/
|
|||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
char *CharPrev(const char *s, const char *p) {
|
||||
TCHAR *CharPrev(const TCHAR *s, const TCHAR *p) {
|
||||
if (!s || !p || p < s)
|
||||
return NULL;
|
||||
while (*s) {
|
||||
char *n = CharNext(s);
|
||||
TCHAR *n = CharNext(s);
|
||||
if (n >= p)
|
||||
break;
|
||||
s = n;
|
||||
}
|
||||
return (char *) s;
|
||||
return (TCHAR *) s;
|
||||
}
|
||||
|
||||
char *CharNext(const char *s) {
|
||||
TCHAR *CharNext(const TCHAR *s) {
|
||||
int l = 0;
|
||||
if (s && *s)
|
||||
l = max(1, mblen(s, MB_CUR_MAX));
|
||||
return (char *) s + l;
|
||||
return (TCHAR *) s + l;
|
||||
}
|
||||
|
||||
char *CharNextExA(WORD codepage, const char *s, int flags) {
|
||||
|
@ -170,10 +170,10 @@ char *CharNextExA(WORD codepage, const char *s, int flags) {
|
|||
return (char *) np;
|
||||
}
|
||||
|
||||
int wsprintf(char *s, const char *format, ...) {
|
||||
int wsprintf(TCHAR *s, const TCHAR *format, ...) {
|
||||
va_list val;
|
||||
va_start(val, format);
|
||||
int res = vsnprintf(s, 1024, format, val);
|
||||
int res = _vsntprintf(s, 1024, format, val);
|
||||
va_end(val);
|
||||
return res;
|
||||
}
|
||||
|
@ -181,18 +181,18 @@ int wsprintf(char *s, const char *format, ...) {
|
|||
// iconv const inconsistency workaround by Alexandre Oliva
|
||||
template <typename T>
|
||||
inline size_t nsis_iconv_adaptor
|
||||
(size_t (*iconv_func)(iconv_t, T, size_t *, char**,size_t*),
|
||||
iconv_t cd, char **inbuf, size_t *inbytesleft,
|
||||
char **outbuf, size_t *outbytesleft)
|
||||
(size_t (*iconv_func)(iconv_t, T, size_t *, TCHAR**,size_t*),
|
||||
iconv_t cd, TCHAR **inbuf, size_t *inbytesleft,
|
||||
TCHAR **outbuf, size_t *outbytesleft)
|
||||
{
|
||||
return iconv_func (cd, (T)inbuf, inbytesleft, outbuf, outbytesleft);
|
||||
}
|
||||
|
||||
void static create_code_page_string(char *buf, size_t len, UINT code_page) {
|
||||
void static create_code_page_string(TCHAR *buf, size_t len, UINT code_page) {
|
||||
if (code_page == CP_ACP)
|
||||
code_page = 1252;
|
||||
|
||||
snprintf(buf, len, "CP%d", code_page);
|
||||
_sntprintf(buf, len, _T("CP%d"), code_page);
|
||||
}
|
||||
|
||||
int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr,
|
||||
|
@ -270,10 +270,10 @@ int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
|
|||
|
||||
BOOL IsValidCodePage(UINT CodePage)
|
||||
{
|
||||
char cp[128];
|
||||
TCHAR cp[128];
|
||||
create_code_page_string(cp, sizeof(cp), CodePage);
|
||||
|
||||
iconv_t cd = iconv_open("UCS-2LE", cp);
|
||||
iconv_t cd = iconv_open(_T("UCS-2LE"), cp);
|
||||
if (cd == (iconv_t) -1)
|
||||
return FALSE;
|
||||
|
||||
|
@ -282,37 +282,37 @@ BOOL IsValidCodePage(UINT CodePage)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#define MY_ERROR_MSG(x) {if (g_display_errors) {fprintf(g_output,"%s", x);}}
|
||||
#define MY_ERROR_MSG(x) {if (g_display_errors) {_ftprintf(g_output,_T("%s"), x);}}
|
||||
|
||||
char *my_convert(const char *path)
|
||||
TCHAR *my_convert(const TCHAR *path)
|
||||
{
|
||||
// TODO: (orip) ref. this func. to use std::string?
|
||||
char *converted_path = strdup(path);
|
||||
size_t len = strlen(path);
|
||||
TCHAR *converted_path = _tcsdup(path);
|
||||
size_t len = _tcsclen(path);
|
||||
|
||||
if(!converted_path)
|
||||
{
|
||||
MY_ERROR_MSG("Error: could not allocate memory in my_convert()\n");
|
||||
return (char*) path; /* dirty */
|
||||
MY_ERROR_MSG(_T("Error: could not allocate memory in my_convert()\n"));
|
||||
return (TCHAR*) path; /* dirty */
|
||||
}
|
||||
|
||||
/* Replace drive letter X: by /X */
|
||||
if(len >= 2)
|
||||
{
|
||||
if (path[1] == ':')
|
||||
if (path[1] == _T(':'))
|
||||
{
|
||||
converted_path[0] = '/';
|
||||
converted_path[1] = (char) tolower((int) path[0]);
|
||||
converted_path[0] = _T('/');
|
||||
converted_path[1] = (TCHAR) tolower((int) path[0]);
|
||||
}
|
||||
}
|
||||
|
||||
char *p = converted_path;
|
||||
TCHAR *p = converted_path;
|
||||
|
||||
do
|
||||
{
|
||||
if (*p == '\\')
|
||||
if (*p == _T('\\'))
|
||||
{
|
||||
*p = '/';
|
||||
*p = _T('/');
|
||||
}
|
||||
p = CharNext(p);
|
||||
}
|
||||
|
@ -321,25 +321,25 @@ char *my_convert(const char *path)
|
|||
return converted_path;
|
||||
}
|
||||
|
||||
void my_convert_free(char *converted_path)
|
||||
void my_convert_free(TCHAR *converted_path)
|
||||
{
|
||||
free(converted_path);
|
||||
}
|
||||
|
||||
int my_open(const char *pathname, int flags)
|
||||
int my_open(const TCHAR *pathname, int flags)
|
||||
{
|
||||
char *converted_pathname = my_convert(pathname);
|
||||
TCHAR *converted_pathname = my_convert(pathname);
|
||||
|
||||
int result = open(converted_pathname, flags);
|
||||
my_convert_free(converted_pathname);
|
||||
return result;
|
||||
}
|
||||
|
||||
FILE *my_fopen(const char *path, const char *mode)
|
||||
FILE *my_fopen(const TCHAR *path, const TCHAR *mode)
|
||||
{
|
||||
char *converted_path = my_convert(path);
|
||||
TCHAR *converted_path = my_convert(path);
|
||||
|
||||
FILE *result = fopen(converted_path, mode);
|
||||
FILE *result = _tfopen(converted_path, mode);
|
||||
my_convert_free(converted_path);
|
||||
return result;
|
||||
}
|
||||
|
@ -360,32 +360,32 @@ void operator delete [](void *p) throw() {
|
|||
if (p) free(p);
|
||||
}
|
||||
|
||||
size_t my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm) {
|
||||
return strftime(s, max, fmt, tm);
|
||||
size_t my_strftime(TCHAR *s, size_t max, const TCHAR *fmt, const struct tm *tm) {
|
||||
return _tcsftime(s, max, fmt, tm);
|
||||
}
|
||||
|
||||
string get_full_path(const string &path) {
|
||||
tstring get_full_path(const tstring &path) {
|
||||
#ifdef _WIN32
|
||||
char *throwaway;
|
||||
char real_path[1024];
|
||||
TCHAR *throwaway;
|
||||
TCHAR real_path[1024];
|
||||
int rc = GetFullPathName(path.c_str(),1024,real_path,&throwaway);
|
||||
assert(rc <= 1024); // path size is limited by MAX_PATH (260)
|
||||
assert(rc != 0); // rc==0 in case of error
|
||||
return string(real_path);
|
||||
return tstring(real_path);
|
||||
#else//_WIN32
|
||||
#ifdef PATH_MAX
|
||||
static char buffer[PATH_MAX];
|
||||
static TCHAR buffer[PATH_MAX];
|
||||
#else//PATH_MAX
|
||||
int path_max = pathconf(path.c_str(), _PC_PATH_MAX);
|
||||
if (path_max <= 0)
|
||||
path_max = 4096;
|
||||
char *buffer = (char *) malloc(path_max);
|
||||
TCHAR *buffer = (TCHAR *) malloc(path_max*sizeof(TCHAR));
|
||||
if (!buffer)
|
||||
return string(path);
|
||||
return tstring(path);
|
||||
#endif//PATH_MAX
|
||||
if (!realpath(path.c_str(), buffer))
|
||||
strcpy(buffer, path.c_str());
|
||||
string result(buffer);
|
||||
_tcscpy(buffer, path.c_str());
|
||||
tstring result(buffer);
|
||||
#ifndef PATH_MAX
|
||||
free(buffer);
|
||||
#endif//!PATH_MAX
|
||||
|
@ -393,63 +393,63 @@ string get_full_path(const string &path) {
|
|||
#endif//_WIN32
|
||||
}
|
||||
|
||||
string get_string_prefix(const string& str, const string& separator) {
|
||||
const string::size_type last_separator_pos = str.rfind(separator);
|
||||
tstring get_string_prefix(const tstring& str, const tstring& separator) {
|
||||
const tstring::size_type last_separator_pos = str.rfind(separator);
|
||||
if (last_separator_pos == string::npos)
|
||||
return str;
|
||||
return str.substr(0, last_separator_pos);
|
||||
}
|
||||
|
||||
string get_string_suffix(const string& str, const string& separator) {
|
||||
const string::size_type last_separator_pos = str.rfind(separator);
|
||||
if (last_separator_pos == string::npos)
|
||||
tstring get_string_suffix(const tstring& str, const tstring& separator) {
|
||||
const tstring::size_type last_separator_pos = str.rfind(separator);
|
||||
if (last_separator_pos == tstring::npos)
|
||||
return str;
|
||||
return str.substr(last_separator_pos + separator.size(), string::npos);
|
||||
return str.substr(last_separator_pos + separator.size(), tstring::npos);
|
||||
}
|
||||
|
||||
string get_dir_name(const string& path) {
|
||||
tstring get_dir_name(const tstring& path) {
|
||||
return get_string_prefix(path, PLATFORM_PATH_SEPARATOR_STR);
|
||||
}
|
||||
|
||||
string get_file_name(const string& path) {
|
||||
tstring get_file_name(const tstring& path) {
|
||||
return get_string_suffix(path, PLATFORM_PATH_SEPARATOR_STR);
|
||||
}
|
||||
|
||||
string get_executable_path(const char* argv0) {
|
||||
tstring get_executable_path(const TCHAR* argv0) {
|
||||
#ifdef _WIN32
|
||||
char temp_buf[MAX_PATH+1];
|
||||
temp_buf[0] = '\0';
|
||||
TCHAR temp_buf[MAX_PATH+1];
|
||||
temp_buf[0] = _T('\0');
|
||||
int rc = GetModuleFileName(NULL,temp_buf,MAX_PATH);
|
||||
assert(rc != 0);
|
||||
return string(temp_buf);
|
||||
return tstring(temp_buf);
|
||||
#elif __APPLE__
|
||||
char temp_buf[MAXPATHLEN+1];
|
||||
TCHAR temp_buf[MAXPATHLEN+1];
|
||||
unsigned int buf_len = MAXPATHLEN;
|
||||
int rc = Apple::_NSGetExecutablePath(temp_buf, &buf_len);
|
||||
assert(rc == 0);
|
||||
return string(temp_buf);
|
||||
return tstring(temp_buf);
|
||||
#else /* Linux/BSD/POSIX/etc */
|
||||
const char *envpath = getenv("_");
|
||||
const TCHAR *envpath = _tgetenv(_T("_"));
|
||||
if( envpath != NULL ) return get_full_path( envpath );
|
||||
else {
|
||||
char* pathtmp;
|
||||
char* path = NULL;
|
||||
TCHAR* pathtmp;
|
||||
TCHAR* path = NULL;
|
||||
size_t len = 100;
|
||||
int nchars;
|
||||
while(1){
|
||||
pathtmp = (char*)realloc(path,len+1);
|
||||
pathtmp = (TCHAR*)realloc(path,len+1);
|
||||
if( pathtmp == NULL ){
|
||||
free(path);
|
||||
return get_full_path(argv0);
|
||||
}
|
||||
path = pathtmp;
|
||||
nchars = readlink("/proc/self/exe", path, len);
|
||||
nchars = readlink(_T("/proc/self/exe"), path, len);
|
||||
if( nchars == -1 ){
|
||||
free(path);
|
||||
return get_full_path(argv0);
|
||||
}
|
||||
if( nchars < (int) len ){
|
||||
path[nchars] = '\0';
|
||||
path[nchars] = _T('\0');
|
||||
string result(path);
|
||||
free(path);
|
||||
return result;
|
||||
|
@ -460,26 +460,26 @@ string get_executable_path(const char* argv0) {
|
|||
#endif
|
||||
}
|
||||
|
||||
string get_executable_dir(const char *argv0) {
|
||||
tstring get_executable_dir(const TCHAR *argv0) {
|
||||
return get_dir_name(get_executable_path(argv0));
|
||||
}
|
||||
|
||||
string remove_file_extension(const string& path) {
|
||||
return get_string_prefix(path, ".");
|
||||
tstring remove_file_extension(const tstring& path) {
|
||||
return get_string_prefix(path, _T("."));
|
||||
}
|
||||
|
||||
struct ToLower
|
||||
{
|
||||
char operator() (char c) const { return tolower(c); }
|
||||
TCHAR operator() (TCHAR c) const { return _totlower(c); }
|
||||
};
|
||||
|
||||
string lowercase(const string &str) {
|
||||
string result = str;
|
||||
tstring lowercase(const tstring &str) {
|
||||
tstring result = str;
|
||||
transform(str.begin(), str.end(), result.begin(), ToLower());
|
||||
return result;
|
||||
}
|
||||
|
||||
int sane_system(const char *command) {
|
||||
int sane_system(const TCHAR *command) {
|
||||
#ifdef _WIN32
|
||||
|
||||
// workaround for bug #1509909
|
||||
|
@ -494,23 +494,21 @@ int sane_system(const char *command) {
|
|||
//
|
||||
// to avoid the stripping, a harmless string is prefixed
|
||||
// to the command line.
|
||||
|
||||
string command_s = "IF 1==1 ";
|
||||
tstring command_s = _T("IF 1==1 ");
|
||||
command_s += command;
|
||||
return system(command_s.c_str());
|
||||
return _tsystem(command_s.c_str());
|
||||
|
||||
#else
|
||||
|
||||
return system(command);
|
||||
|
||||
return _tsystem(command);
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool GetDLLVersionUsingRE(const string& filepath, DWORD& high, DWORD & low)
|
||||
|
||||
static bool GetDLLVersionUsingRE(const tstring& filepath, DWORD& high, DWORD & low)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
FILE *fdll = FOPEN(filepath.c_str(), "rb");
|
||||
FILE *fdll = FOPEN(filepath.c_str(), _T("rb"));
|
||||
if (!fdll)
|
||||
return 0;
|
||||
|
||||
|
@ -567,13 +565,13 @@ static bool GetDLLVersionUsingRE(const string& filepath, DWORD& high, DWORD & lo
|
|||
return found;
|
||||
}
|
||||
|
||||
static bool GetDLLVersionUsingAPI(const string& filepath, DWORD& high, DWORD& low)
|
||||
static bool GetDLLVersionUsingAPI(const tstring& filepath, DWORD& high, DWORD& low)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
#ifdef _WIN32
|
||||
char path[1024];
|
||||
char *name;
|
||||
TCHAR path[1024];
|
||||
TCHAR *name;
|
||||
path[0] = 0;
|
||||
|
||||
GetFullPathName(filepath.c_str(), 1024, path, &name);
|
||||
|
@ -587,7 +585,7 @@ static bool GetDLLVersionUsingAPI(const string& filepath, DWORD& high, DWORD& lo
|
|||
{
|
||||
UINT uLen;
|
||||
VS_FIXEDFILEINFO *pvsf;
|
||||
if (GetFileVersionInfo(path, 0, verSize, buf) && VerQueryValue(buf, "\\", (void**) &pvsf, &uLen))
|
||||
if (GetFileVersionInfo(path, 0, verSize, buf) && VerQueryValue(buf, _T("\\"), (void**) &pvsf, &uLen))
|
||||
{
|
||||
low = pvsf->dwFileVersionLS;
|
||||
high = pvsf->dwFileVersionMS;
|
||||
|
@ -606,9 +604,9 @@ static bool GetDLLVersionUsingAPI(const string& filepath, DWORD& high, DWORD& lo
|
|||
// the following structure must be byte-aligned.
|
||||
#pragma pack( push, pre_vxd_ver, 1 )
|
||||
typedef struct _VXD_VERSION_RESOURCE {
|
||||
char cType;
|
||||
char cType; // Should not be converted to TCHAR (JP)
|
||||
WORD wID;
|
||||
char cName;
|
||||
char cName; // Should not be converted to TCHAR (JP)
|
||||
WORD wOrdinal;
|
||||
WORD wFlags;
|
||||
DWORD dwResSize;
|
||||
|
@ -616,7 +614,7 @@ typedef struct _VXD_VERSION_RESOURCE {
|
|||
} VXD_VERSION_RESOURCE, *PVXD_VERSION_RESOURCE;
|
||||
#pragma pack( pop, pre_vxd_ver )
|
||||
|
||||
static BOOL GetVxdVersion( LPCSTR szFile, LPDWORD lpdwLen, LPVOID lpData )
|
||||
static BOOL GetVxdVersion( LPCTSTR szFile, LPDWORD lpdwLen, LPVOID lpData )
|
||||
{
|
||||
|
||||
HANDLE hFile = NULL;
|
||||
|
@ -769,7 +767,7 @@ static BOOL GetVxdVersion( LPCSTR szFile, LPDWORD lpdwLen, LPVOID lpData )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static DWORD GetVxdVersionInfoSize( LPCSTR szFile )
|
||||
static DWORD GetVxdVersionInfoSize( LPCTSTR szFile )
|
||||
{
|
||||
DWORD dwResult = 0;
|
||||
|
||||
|
@ -791,14 +789,14 @@ static DWORD GetVxdVersionInfoSize( LPCSTR szFile )
|
|||
return 0;
|
||||
}
|
||||
|
||||
static BOOL GetVxdVersionInfo( LPCSTR szFile, DWORD dwLen, LPVOID lpData )
|
||||
static BOOL GetVxdVersionInfo( LPCTSTR szFile, DWORD dwLen, LPVOID lpData )
|
||||
{
|
||||
return GetVxdVersion( szFile, &dwLen, lpData );
|
||||
}
|
||||
|
||||
#endif //_WIN32
|
||||
|
||||
static bool GetDLLVersionFromVXD(const string& filepath, DWORD& high, DWORD& low)
|
||||
static bool GetDLLVersionFromVXD(const tstring& filepath, DWORD& high, DWORD& low)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
|
@ -811,7 +809,7 @@ static bool GetDLLVersionFromVXD(const string& filepath, DWORD& high, DWORD& low
|
|||
{
|
||||
UINT uLen;
|
||||
VS_FIXEDFILEINFO *pvsf;
|
||||
if (GetVxdVersionInfo(filepath.c_str(), verSize, buf) && VerQueryValue(buf, "\\", (void**) &pvsf, &uLen))
|
||||
if (GetVxdVersionInfo(filepath.c_str(), verSize, buf) && VerQueryValue(buf, _T("\\"), (void**) &pvsf, &uLen))
|
||||
{
|
||||
low = pvsf->dwFileVersionLS;
|
||||
high = pvsf->dwFileVersionMS;
|
||||
|
@ -825,7 +823,7 @@ static bool GetDLLVersionFromVXD(const string& filepath, DWORD& high, DWORD& low
|
|||
return found;
|
||||
}
|
||||
|
||||
bool GetDLLVersion(const string& filepath, DWORD& high, DWORD& low)
|
||||
bool GetDLLVersion(const tstring& filepath, DWORD& high, DWORD& low)
|
||||
{
|
||||
if (GetDLLVersionUsingAPI(filepath, high, low))
|
||||
return true;
|
||||
|
|
|
@ -12,12 +12,14 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/10/2007
|
||||
*/
|
||||
|
||||
#ifndef _UTIL_H_
|
||||
#define _UTIL_H_
|
||||
|
||||
#include <string> // for std::string
|
||||
#include "tstring.h" // for std::string
|
||||
|
||||
#include "boost/scoped_ptr.hpp" // for boost::scoped_ptr
|
||||
#include "ResourceEditor.h"
|
||||
|
@ -28,35 +30,35 @@
|
|||
#endif
|
||||
|
||||
|
||||
// these are the standard pause-before-quit shit.
|
||||
// these are the standard pause-before-quit stuff.
|
||||
extern int g_dopause;
|
||||
extern void dopause(void);
|
||||
|
||||
// Adds the bitmap in filename using resource editor re as id id.
|
||||
// If width or height are specified it will also make sure the bitmap is in that size
|
||||
int update_bitmap(CResourceEditor* re, WORD id, const char* filename, int width=0, int height=0, int maxbpp=0);
|
||||
int update_bitmap(CResourceEditor* re, WORD id, const TCHAR* filename, int width=0, int height=0, int maxbpp=0);
|
||||
|
||||
size_t my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm);
|
||||
size_t my_strftime(TCHAR *s, size_t max, const TCHAR *fmt, const struct tm *tm);
|
||||
|
||||
bool GetDLLVersion(const std::string& filepath, DWORD& high, DWORD& low);
|
||||
bool GetDLLVersion(const tstring& filepath, DWORD& high, DWORD& low);
|
||||
|
||||
std::string get_full_path(const std::string& path);
|
||||
std::string get_dir_name(const std::string& path);
|
||||
std::string get_file_name(const std::string& path);
|
||||
std::string get_executable_dir(const char *argv0);
|
||||
std::string remove_file_extension(const std::string& path);
|
||||
std::string lowercase(const std::string&);
|
||||
tstring get_full_path(const tstring& path);
|
||||
tstring get_dir_name(const tstring& path);
|
||||
tstring get_file_name(const tstring& path);
|
||||
tstring get_executable_dir(const TCHAR *argv0);
|
||||
tstring remove_file_extension(const tstring& path);
|
||||
tstring lowercase(const tstring&);
|
||||
|
||||
std::string get_string_prefix(const std::string& str, const std::string& separator);
|
||||
std::string get_string_suffix(const std::string& str, const std::string& separator);
|
||||
tstring get_string_prefix(const tstring& str, const tstring& separator);
|
||||
tstring get_string_suffix(const tstring& str, const tstring& separator);
|
||||
|
||||
int sane_system(const char *command);
|
||||
int sane_system(const TCHAR *command);
|
||||
|
||||
#ifndef _WIN32
|
||||
char *CharPrev(const char *s, const char *p);
|
||||
char *CharNext(const char *s);
|
||||
TCHAR *CharPrev(const TCHAR *s, const TCHAR *p);
|
||||
TCHAR *CharNext(const TCHAR *s);
|
||||
char *CharNextExA(WORD codepage, const char *s, int flags);
|
||||
int wsprintf(char *s, const char *format, ...);
|
||||
int wsprintf(TCHAR *s, const TCHAR *format, ...);
|
||||
int WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr,
|
||||
int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar,
|
||||
LPBOOL lpUsedDefaultChar);
|
||||
|
@ -64,10 +66,10 @@ int MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr,
|
|||
int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
|
||||
BOOL IsValidCodePage(UINT CodePage);
|
||||
|
||||
char *my_convert(const char *path);
|
||||
void my_convert_free(char *converted_path);
|
||||
int my_open(const char *pathname, int flags);
|
||||
FILE *my_fopen(const char *path, const char *mode);
|
||||
TCHAR *my_convert(const TCHAR *path);
|
||||
void my_convert_free(TCHAR *converted_path);
|
||||
int my_open(const TCHAR *pathname, int flags);
|
||||
FILE *my_fopen(const TCHAR *path, const TCHAR *mode);
|
||||
|
||||
#define FOPEN(a, b) my_fopen(a, b)
|
||||
#define OPEN(a, b) my_open(a, b)
|
||||
|
@ -77,8 +79,8 @@ FILE *my_fopen(const char *path, const char *mode);
|
|||
#define my_convert(x) (x)
|
||||
#define my_convert_free(x)
|
||||
|
||||
#define FOPEN(a, b) fopen(a, b)
|
||||
#define OPEN(a, b) open(a, b)
|
||||
#define FOPEN(a, b) _tfopen(a, b)
|
||||
#define OPEN(a, b) _topen(a, b)
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/13/2007
|
||||
*/
|
||||
|
||||
#include "Platform.h"
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 07/31/2007
|
||||
*/
|
||||
|
||||
#include "Platform.h"
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/13/2007
|
||||
*/
|
||||
|
||||
#include "exehead/config.h"
|
||||
|
@ -21,6 +23,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdexcept>
|
||||
#include "tchar.h"
|
||||
|
||||
void writer_sink::write_byte(const unsigned char b)
|
||||
{
|
||||
|
@ -52,6 +55,7 @@ void writer_sink::write_string(const char *s)
|
|||
write_data(s, strlen(s) + 1);
|
||||
}
|
||||
|
||||
// size in this case is the length of the string to write.
|
||||
void writer_sink::write_string(const char *s, const size_t size)
|
||||
{
|
||||
char *wb = new char[size];
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/13/2007
|
||||
*/
|
||||
|
||||
#ifndef ___WRITER__H___
|
||||
|
@ -21,6 +23,7 @@
|
|||
#include "growbuf.h"
|
||||
#include "crc32.h"
|
||||
#include <stdio.h>
|
||||
#include "tchar.h"
|
||||
|
||||
class writer_sink {
|
||||
public:
|
||||
|
@ -31,8 +34,8 @@ public:
|
|||
virtual void write_short(const short s);
|
||||
virtual void write_int(const int i);
|
||||
virtual void write_int_array(const int i[], const size_t len);
|
||||
virtual void write_string(const char *s);
|
||||
virtual void write_string(const char *s, const size_t size);
|
||||
virtual void write_string(const TCHAR *s);
|
||||
virtual void write_string(const TCHAR *s, const size_t size);
|
||||
virtual void write_growbuf(const IGrowBuf *b);
|
||||
|
||||
virtual void write_data(const void *data, const size_t size) = 0;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/27/2007
|
||||
*/
|
||||
|
||||
/* deflate.h -- internal compression state
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/27/2007
|
||||
* All messages and true strings turned into TCHARs for when we
|
||||
* create viewable messages.
|
||||
*/
|
||||
|
||||
#include "../Platform.h"
|
||||
|
@ -367,14 +371,14 @@ int ZEXPORT inflate(z_streamp z)
|
|||
switch (t >> 1)
|
||||
{
|
||||
case 0: /* stored */
|
||||
Tracev((stderr, "inflate: stored block%s\n",
|
||||
LAST ? " (last)" : ""));
|
||||
Tracev((stderr, _T("inflate: stored block%s\n"),
|
||||
LAST ? _T(" (last)") : _T("")));
|
||||
DUMPBITS(k&7)
|
||||
s->mode = LENS; /* get length of stored block */
|
||||
break;
|
||||
case 1: /* fixed */
|
||||
Tracev((stderr, "inflate: fixed codes block%s\n",
|
||||
LAST ? " (last)" : ""));
|
||||
Tracev((stderr, _T("inflate: fixed codes block%s\n"),
|
||||
LAST ? _T(" (last)") : _T("")));
|
||||
{
|
||||
if (!fixed_built)
|
||||
{
|
||||
|
@ -414,8 +418,8 @@ int ZEXPORT inflate(z_streamp z)
|
|||
s->mode = CODES_START;
|
||||
break;
|
||||
case 2: /* dynamic */
|
||||
Tracev((stderr, "inflate: dynamic codes block%s\n",
|
||||
LAST ? " (last)" : ""));
|
||||
Tracev((stderr, _T("inflate: dynamic codes block%s\n"),
|
||||
LAST ? _T(" (last)") : _T("")));
|
||||
s->mode = TABLE;
|
||||
break;
|
||||
case 3: /* illegal */
|
||||
|
@ -427,7 +431,7 @@ int ZEXPORT inflate(z_streamp z)
|
|||
NEEDBITS(16)
|
||||
s->sub.left = (uInt)b & 0xffff;
|
||||
b = k = 0; /* dump bits */
|
||||
Tracev((stderr, "inflate: stored length %u\n", s->sub.left));
|
||||
Tracev((stderr, _T("inflate: stored length %u\n"), s->sub.left));
|
||||
s->mode = s->sub.left ? STORED : s->last;
|
||||
break;
|
||||
case STORED:
|
||||
|
@ -457,7 +461,7 @@ int ZEXPORT inflate(z_streamp z)
|
|||
//t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);
|
||||
DUMPBITS(14)
|
||||
s->sub.trees.index = 0;
|
||||
Tracev((stderr, "inflate: table sizes ok\n"));
|
||||
Tracev((stderr, _T("inflate: table sizes ok\n")));
|
||||
s->mode = BTREE;
|
||||
case BTREE:
|
||||
while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))
|
||||
|
@ -483,7 +487,7 @@ int ZEXPORT inflate(z_streamp z)
|
|||
}
|
||||
|
||||
s->sub.trees.index = 0;
|
||||
Tracev((stderr, "inflate: bits tree ok\n"));
|
||||
Tracev((stderr, _T("inflate: bits tree ok\n")));
|
||||
s->mode = DTREE;
|
||||
case DTREE:
|
||||
while (t = s->sub.trees.table,
|
||||
|
@ -558,7 +562,7 @@ int ZEXPORT inflate(z_streamp z)
|
|||
s->mode = BAD;
|
||||
LEAVE(Z_DATA_ERROR);
|
||||
}
|
||||
Tracev((stderr, "inflate: trees ok\n"));
|
||||
Tracev((stderr, _T("inflate: trees ok\n")));
|
||||
|
||||
//s->sub.decode.t_codes.mode = CODES_START;
|
||||
s->sub.decode.t_codes.lbits = (Byte)bl;
|
||||
|
@ -682,7 +686,7 @@ int ZEXPORT inflate(z_streamp z)
|
|||
LEAVE(Z_OK)
|
||||
if (s->mode == CODES_WASH)
|
||||
{
|
||||
Tracev((stderr, "inflate: codes end, %lu total out\n",
|
||||
Tracev((stderr, _T("inflate: codes end, %lu total out\n"),
|
||||
z->total_out + (q >= s->read ? q - s->read :
|
||||
(s->end - s->read) + (q - s->window))));
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/27/2007
|
||||
*/
|
||||
|
||||
/* zconf.h -- configuration of the zlib compression library
|
||||
|
@ -16,7 +18,7 @@
|
|||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id: ZCONF.H,v 1.2 2006/10/28 19:45:02 joostverburg Exp $ */
|
||||
/* @(#) $Id: ZCONF.H,v 1.3 2007/01/13 17:28:23 kichik Exp $ */
|
||||
|
||||
#ifndef _ZCONF_H
|
||||
#define _ZCONF_H
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/27/2007
|
||||
*/
|
||||
|
||||
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
||||
|
@ -175,7 +177,7 @@ typedef struct z_stream_s {
|
|||
uLong total_out; /* total nb of bytes output so far */
|
||||
#endif
|
||||
|
||||
// char *msg; /* last error message, NULL if no error */
|
||||
// TCHAR *msg; /* last error message, NULL if no error */
|
||||
//struct internal_state FAR *state; /* not visible by applications */
|
||||
#ifdef EXEHEAD
|
||||
struct inflate_blocks_state blocks; /* current inflate_blocks state */
|
||||
|
@ -278,16 +280,16 @@ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
|
|||
* and the compiler's view of z_stream:
|
||||
*/
|
||||
ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
|
||||
const char *version, int stream_size));
|
||||
const TCHAR *version, int stream_size));
|
||||
//ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
|
||||
// const char *version, int stream_size));
|
||||
// const TCHAR *version, int stream_size));
|
||||
ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
|
||||
int windowBits, int memLevel,
|
||||
int strategy, const char *version,
|
||||
int strategy, const TCHAR *version,
|
||||
int stream_size));
|
||||
|
||||
#define deflateInit(strm, level) \
|
||||
deflateInit_((strm), (level), "", sizeof(z_stream))
|
||||
deflateInit_((strm), (level), _T(""), sizeof(z_stream))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/27/2007
|
||||
* The messages generated here are mostly #def'ed out, but are used
|
||||
* when debugging. So in order for the messages to be viewable in
|
||||
* Unicode version, using TCHAR macros.
|
||||
*/
|
||||
|
||||
/* zutil.h -- internal interface and configuration of the compression library
|
||||
|
@ -21,13 +26,14 @@
|
|||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
/* @(#) $Id: ZUTIL.H,v 1.5 2007/01/13 17:28:23 kichik Exp $ */
|
||||
/* @(#) $Id: ZUTIL.H,v 1.6 2007/01/25 18:07:40 kichik Exp $ */
|
||||
|
||||
#ifndef _Z_UTIL_H
|
||||
#define _Z_UTIL_H
|
||||
|
||||
#include "../Platform.h"
|
||||
#include "ZLIB.H"
|
||||
#include "../tchar.h"
|
||||
|
||||
#ifndef local
|
||||
# define local static
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue