diff --git a/Source/DialogTemplate.cpp b/Source/DialogTemplate.cpp index 162004ac..16235f7b 100644 --- a/Source/DialogTemplate.cpp +++ b/Source/DialogTemplate.cpp @@ -605,8 +605,11 @@ BYTE* CDialogTemplate::Save(DWORD& dwSize) { // Write class variant length array const WCHAR *szClass = m_vItems[i]->szClass; #ifdef _UNICODE - if (!IS_INTRESOURCE(szClass) && m_build_unicode && !_wcsicmp(szClass, L"RichEdit20A")) - szClass = L"RichEdit20W"; // transmute ANSI RichEdit control into Unicode RichEdit + if (!IS_INTRESOURCE(szClass)) { + // transmute RichEdit20A/W control into RichEdit20T that matches the target + if (m_build_unicode && !_wcsicmp(szClass, L"RichEdit20A")) szClass = L"RichEdit20W"; + if (!m_build_unicode && !_wcsicmp(szClass, L"RichEdit20W")) szClass = L"RichEdit20A"; + } #endif WriteStringOrId(szClass); // Write title variant length array diff --git a/Source/script.cpp b/Source/script.cpp index 8bb4fac4..dca3b467 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -2647,7 +2647,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) // Search for required items #define GET(x) dlg = uire->GetResource(RT_DIALOG, x, 0); if (!dlg) return PS_ERROR; CDialogTemplate UIDlg(dlg, build_unicode, uDefCodePage); #define SEARCH(x) if (!UIDlg.GetItem(x)) {ERROR_MSG(_T("Error: Can't find %s (%u) in the custom UI!\n"), _T(#x), x);delete [] dlg;delete uire;return PS_ERROR;} - #define SAVE(x) dwSize = UIDlg.GetSize(); res_editor->UpdateResource(RT_DIALOG, x, NSIS_DEFAULT_LANG, dlg, dwSize); delete [] dlg; + #define SAVE(x) delete [] dlg; dlg = UIDlg.Save(dwSize); res_editor->UpdateResource(RT_DIALOG, x, NSIS_DEFAULT_LANG, dlg, dwSize); delete [] dlg; LPBYTE dlg = NULL;