MakeNSIS WM_COPYDATA notify messages now use the QH_OUTPUTCHARSET encoding if specified by the host. CP_ACP is the default for compatibility with old IDEs.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6490 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
9c1d673c25
commit
8ed10146ef
6 changed files with 33 additions and 5 deletions
|
@ -31,7 +31,11 @@
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
|
||||||
namespace MakensisAPI {
|
namespace MakensisAPI {
|
||||||
|
#ifdef _WIN64
|
||||||
|
const TCHAR* SigintEventNameFmt = _T("makensis win32 sigint event %Iu");
|
||||||
|
#else
|
||||||
const TCHAR* SigintEventNameFmt = _T("makensis win32 sigint event %u");
|
const TCHAR* SigintEventNameFmt = _T("makensis win32 sigint event %u");
|
||||||
|
#endif
|
||||||
const TCHAR* SigintEventNameLegacy = _T("makensis win32 signint event");
|
const TCHAR* SigintEventNameLegacy = _T("makensis win32 signint event");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,10 @@ Released on ?, 2014
|
||||||
|
|
||||||
\S1{v3.0b1-cl} Changelog
|
\S1{v3.0b1-cl} Changelog
|
||||||
|
|
||||||
|
\S2{} Major Changes
|
||||||
|
|
||||||
|
\b MakeNSIS WM_COPYDATA messages now use the QH_OUTPUTCHARSET encoding with CP_ACP as the default for compatibility with old IDEs.
|
||||||
|
|
||||||
\S2{} Minor Changes
|
\S2{} Minor Changes
|
||||||
|
|
||||||
\b Fixed POSIX !searchparse bug (\W{http://sf.net/p/nsis/patches/251}{patch #251})
|
\b Fixed POSIX !searchparse bug (\W{http://sf.net/p/nsis/patches/251}{patch #251})
|
||||||
|
|
|
@ -70,7 +70,11 @@ bool isSimpleChar(TCHAR ch)
|
||||||
} // end of anonymous namespace
|
} // end of anonymous namespace
|
||||||
|
|
||||||
namespace MakensisAPI {
|
namespace MakensisAPI {
|
||||||
const TCHAR* SigintEventNameFmt = _T("makensis win32 sigint event %u"); // %u is the notify HWND, this is to make sure we abort the correct instance
|
#ifdef _WIN64
|
||||||
|
const TCHAR* SigintEventNameFmt = _T("makensis win32 sigint event %Iu"); // %u is the notify HWND, this is to make sure we abort the correct instance
|
||||||
|
#else
|
||||||
|
const TCHAR* SigintEventNameFmt = _T("makensis win32 sigint event %u");
|
||||||
|
#endif
|
||||||
const TCHAR* SigintEventNameLegacy = _T("makensis win32 signint event"); // "sigNint" typo is part of the API now and cannot be changed
|
const TCHAR* SigintEventNameLegacy = _T("makensis win32 signint event"); // "sigNint" typo is part of the API now and cannot be changed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3456,7 +3460,20 @@ void CEXEBuild::notify(MakensisAPI::notify_e code, const TCHAR *data) const
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (notify_hwnd)
|
if (notify_hwnd)
|
||||||
{
|
{
|
||||||
COPYDATASTRUCT cds = {(DWORD)code, (UINT32)(_tcslen(data)+1)*sizeof(TCHAR), (void *) data};
|
DWORD cb = (DWORD) (_tcslen(data)+1) * sizeof(TCHAR);
|
||||||
|
#ifdef _UNICODE
|
||||||
|
extern NStreamEncoding g_outputenc;
|
||||||
|
extern void quit();
|
||||||
|
CharEncConv cec;
|
||||||
|
if (!g_outputenc.IsUTF16LE())
|
||||||
|
{
|
||||||
|
size_t cbConv;
|
||||||
|
if (!cec.Initialize(g_outputenc.GetCodepage(), -1) || !(data = (const TCHAR*) cec.Convert(data, cb, &cbConv)))
|
||||||
|
PrintColorFmtMsg_ERR(_T("conversion failed!\n")), quit(); // Cannot use ERROR_MSG() here!
|
||||||
|
cb = (DWORD) (cbConv + NStreamEncoding::GetCodeUnitSize(g_outputenc.GetCodepage())); // cbConv does not include the \0.
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
COPYDATASTRUCT cds = {(DWORD) code, cb, (void*) data};
|
||||||
SendMessage(notify_hwnd, WM_COPYDATA, 0, (LPARAM)&cds);
|
SendMessage(notify_hwnd, WM_COPYDATA, 0, (LPARAM)&cds);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace MakensisAPI {
|
||||||
QUERYHOST = WM_APP // QUERYHOST_e in wParam
|
QUERYHOST = WM_APP // QUERYHOST_e in wParam
|
||||||
};
|
};
|
||||||
enum QUERYHOST_e {
|
enum QUERYHOST_e {
|
||||||
QH_OUTPUTCHARSET = 1 // return (wincodepage+1) or 0 for default
|
QH_OUTPUTCHARSET = 1 // return (wincodepage+1) or 0 for default (This encoding is used by stdout and the notify messages)
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ using namespace std;
|
||||||
bool g_dopause=false;
|
bool g_dopause=false;
|
||||||
int g_display_errors=1;
|
int g_display_errors=1;
|
||||||
FILE *g_output;
|
FILE *g_output;
|
||||||
|
NStreamEncoding g_outputenc;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
UINT g_wincon_orgoutcp;
|
UINT g_wincon_orgoutcp;
|
||||||
#ifdef _UNICODE
|
#ifdef _UNICODE
|
||||||
|
@ -290,7 +291,7 @@ static inline int makensismain(int argc, TCHAR **argv)
|
||||||
|
|
||||||
HWND hostnotifyhandle=0;
|
HWND hostnotifyhandle=0;
|
||||||
const TCHAR*stdoutredirname=0;
|
const TCHAR*stdoutredirname=0;
|
||||||
NStreamEncoding inputenc, outputenc;
|
NStreamEncoding inputenc, &outputenc = g_outputenc;
|
||||||
int argpos=0;
|
int argpos=0;
|
||||||
bool in_files=false;
|
bool in_files=false;
|
||||||
bool do_cd=true;
|
bool do_cd=true;
|
||||||
|
@ -299,6 +300,8 @@ static inline int makensismain(int argc, TCHAR **argv)
|
||||||
bool noconfig=false;
|
bool noconfig=false;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
signed char outputbom=1;
|
signed char outputbom=1;
|
||||||
|
|
||||||
|
assert(CP_ACP == outputenc.GetCodepage()); // Required by CEXEBuild::notify() char* legacy handling.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Some parameters have to be parsed early so we can initialize stdout and the "host API".
|
// Some parameters have to be parsed early so we can initialize stdout and the "host API".
|
||||||
|
|
|
@ -189,7 +189,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
NStreamEncoding() { Reset(); }
|
NStreamEncoding() { Reset(); }
|
||||||
NStreamEncoding(WORD cp) { Reset();SetCodepage(cp); }
|
NStreamEncoding(WORD cp) { Reset(), SetCodepage(cp); }
|
||||||
WORD GetCodepage() const { return m_cp; }
|
WORD GetCodepage() const { return m_cp; }
|
||||||
void SetCodepage(WORD cp) { m_cp = cp; }
|
void SetCodepage(WORD cp) { m_cp = cp; }
|
||||||
void SafeSetCodepage(WORD cp)
|
void SafeSetCodepage(WORD cp)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue