Unicode nsExec now supports the /OEM switch (bug #1171)

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6835 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2017-01-15 15:20:07 +00:00
parent 3659de8e37
commit 871589cab4
2 changed files with 6 additions and 4 deletions

View file

@ -107,19 +107,19 @@ BOOL IsWOW64() {
* @param cnt [in] the size of widebuf in wchar_t's.
* @return true, if ASCII, false if suspected as wide.
*/
BOOL WideConvertIfASCII(const char* ansiStr, int strLen, WCHAR* wideBuf, int cnt)
BOOL WideConvertIfASCII(const char* ansiStr, int strLen, WCHAR* wideBuf, int cnt, BOOL OEMCP)
{
BOOL rval = FALSE;
wideBuf[0] = 0;
if (lstrlenA(ansiStr) == strLen)
{
MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, wideBuf, cnt);
MultiByteToWideChar(OEMCP ? CP_OEMCP : CP_ACP, 0, ansiStr, -1, wideBuf, cnt);
rval = TRUE;
}
else
{
// Going to assume that it's a wide char array.
lstrcpyW(wideBuf, (const WCHAR*) ansiStr);
lstrcpynW(wideBuf, (const WCHAR*) ansiStr, cnt);
}
return rval;
@ -307,7 +307,7 @@ params:
#ifdef _UNICODE
ReadFile(read_stdout, ansiBuf, sizeof(ansiBuf)-1, &dwRead, NULL);
ansiBuf[dwRead] = 0;
WideConvertIfASCII(ansiBuf, dwRead, szBuf, sizeof(szBuf)/sizeof(szBuf[0]));
WideConvertIfASCII(ansiBuf, dwRead, szBuf, sizeof(szBuf)/sizeof(szBuf[0]), bOEM);
#else
ReadFile(read_stdout, szBuf, sizeof(szBuf)-1, &dwRead, NULL);
szBuf[dwRead] = '\0';

View file

@ -16,6 +16,8 @@ Released on ? ?th, 2017
\b Added support for MUI_UNCONFIRMPAGE_VARIABLE (\W{http://sf.net/p/nsis/feature-requests/511}{RFE #511})
\b Unicode nsExec now supports the /OEM switch (\W{http://sf.net/p/nsis/bugs/1171}{bug #1171})
\S2{} Translations
\b Minor French improvements (\W{http://sf.net/p/nsis/patches/221}{patch #221})