diff --git a/Contrib/Makensisw/makensisw.cpp b/Contrib/Makensisw/makensisw.cpp index 0ce10b0a..2edb6454 100644 --- a/Contrib/Makensisw/makensisw.cpp +++ b/Contrib/Makensisw/makensisw.cpp @@ -31,7 +31,11 @@ #include "update.h" namespace MakensisAPI { +#ifdef _WIN64 + const TCHAR* SigintEventNameFmt = _T("makensis win32 sigint event %Iu"); +#else const TCHAR* SigintEventNameFmt = _T("makensis win32 sigint event %u"); +#endif const TCHAR* SigintEventNameLegacy = _T("makensis win32 signint event"); } diff --git a/Docs/src/history.but b/Docs/src/history.but index 18e81833..c530edfa 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -6,6 +6,10 @@ Released on ?, 2014 \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 \b Fixed POSIX !searchparse bug (\W{http://sf.net/p/nsis/patches/251}{patch #251}) diff --git a/Source/build.cpp b/Source/build.cpp index 0902caba..9fcc25ff 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -70,7 +70,11 @@ bool isSimpleChar(TCHAR ch) } // end of anonymous namespace 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 } @@ -3456,7 +3460,20 @@ void CEXEBuild::notify(MakensisAPI::notify_e code, const TCHAR *data) const #ifdef _WIN32 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); } #endif diff --git a/Source/build.h b/Source/build.h index c4bbb90e..32ea887d 100644 --- a/Source/build.h +++ b/Source/build.h @@ -85,7 +85,7 @@ namespace MakensisAPI { QUERYHOST = WM_APP // QUERYHOST_e in wParam }; 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 } diff --git a/Source/makenssi.cpp b/Source/makenssi.cpp index a4a284f5..46abe55f 100644 --- a/Source/makenssi.cpp +++ b/Source/makenssi.cpp @@ -39,6 +39,7 @@ using namespace std; bool g_dopause=false; int g_display_errors=1; FILE *g_output; +NStreamEncoding g_outputenc; #ifdef _WIN32 UINT g_wincon_orgoutcp; #ifdef _UNICODE @@ -290,7 +291,7 @@ static inline int makensismain(int argc, TCHAR **argv) HWND hostnotifyhandle=0; const TCHAR*stdoutredirname=0; - NStreamEncoding inputenc, outputenc; + NStreamEncoding inputenc, &outputenc = g_outputenc; int argpos=0; bool in_files=false; bool do_cd=true; @@ -299,6 +300,8 @@ static inline int makensismain(int argc, TCHAR **argv) bool noconfig=false; #ifdef _WIN32 signed char outputbom=1; + + assert(CP_ACP == outputenc.GetCodepage()); // Required by CEXEBuild::notify() char* legacy handling. #endif // Some parameters have to be parsed early so we can initialize stdout and the "host API". diff --git a/Source/utf.h b/Source/utf.h index 3577782e..a57ca665 100644 --- a/Source/utf.h +++ b/Source/utf.h @@ -189,7 +189,7 @@ public: }; NStreamEncoding() { Reset(); } - NStreamEncoding(WORD cp) { Reset();SetCodepage(cp); } + NStreamEncoding(WORD cp) { Reset(), SetCodepage(cp); } WORD GetCodepage() const { return m_cp; } void SetCodepage(WORD cp) { m_cp = cp; } void SafeSetCodepage(WORD cp)