From 871589cab4ba91681780b962bca4e30f35bce8b2 Mon Sep 17 00:00:00 2001 From: anders_k Date: Sun, 15 Jan 2017 15:20:07 +0000 Subject: [PATCH] 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 --- Contrib/nsExec/nsexec.c | 8 ++++---- Docs/src/history.but | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Contrib/nsExec/nsexec.c b/Contrib/nsExec/nsexec.c index b99d3ed8..dd6e9059 100644 --- a/Contrib/nsExec/nsexec.c +++ b/Contrib/nsExec/nsexec.c @@ -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'; diff --git a/Docs/src/history.but b/Docs/src/history.but index 907759e2..b48d6fef 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -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})