Added nsExec /MBCS switch

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7221 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2020-08-22 16:24:14 +00:00
parent 0f2f08439d
commit 654c8ad4d7
3 changed files with 17 additions and 6 deletions

View file

@ -6,17 +6,17 @@ without opening a dos box.
Usage
-----
nsExec::Exec [/OEM] [/TIMEOUT=x] path
nsExec::Exec [/MBCS] [/OEM] [/TIMEOUT=x] path
Pop $0
-or-
nsExec::ExecToLog [/OEM] [/TIMEOUT=x] path
nsExec::ExecToLog [/MBCS] [/OEM] [/TIMEOUT=x] path
Pop $0
-or-
nsExec::ExecToStack [/OEM] [/TIMEOUT=x] path
nsExec::ExecToStack [/MBCS] [/OEM] [/TIMEOUT=x] path
Pop $0 ; Return
Pop $1 ; Output
@ -24,6 +24,8 @@ All functions are the same except ExecToLog will print the output
to the log window and ExecToStack will push up to ${NSIS_MAX_STRLEN}
characters of output onto the stack after the return value.
Use the /MBCS switch to disable Unicode detection and always treat the text as ANSI.
Use the /OEM switch to convert the output text from OEM to ANSI.
The timeout value is optional. The timeout is the time in

View file

@ -181,7 +181,7 @@ void ExecScript(int mode) {
int ignoreData = mode == MODE_IGNOREOUTPUT;
int logMode = mode == MODE_LINES, stackMode = mode == MODE_STACK;
unsigned int to, tabExpandLength = logMode ? TAB_REPLACE_CCH : 0, codepage;
BOOL bOEM;
BOOL bOEM, forceNarrowInput = FALSE;
*szRet = _T('\0');
@ -275,7 +275,12 @@ params:
goto params;
}
if (!lstrcmpi(pExec, _T("/OEM"))) {
bOEM = TRUE;
bOEM = forceNarrowInput = TRUE;
*pExec = 0;
goto params;
}
if (!lstrcmpi(pExec, _T("/MBCS"))) {
forceNarrowInput = TRUE;
*pExec = 0;
goto params;
}
@ -300,7 +305,7 @@ params:
const BOOL isNT = sizeof(void*) > 4 || (GetVersion() < 0x80000000);
HANDLE newstdout = 0, read_stdout = 0;
HANDLE newstdin = 0, read_stdin = 0;
int utfSource = sizeof(TCHAR) > 1 ? -1 : FALSE, utfOutput = sizeof(TCHAR) > 1;
int utfSource = sizeof(TCHAR) > 1 && !forceNarrowInput ? -1 : FALSE, utfOutput = sizeof(TCHAR) > 1;
DWORD cbRead, dwLastOutput;
DWORD dwExit = 0, waitResult = WAIT_TIMEOUT;
static BYTE bufSrc[1024];

View file

@ -14,6 +14,10 @@ Unicode is the now default.
\b Unicode is the now default
\S2{} Minor Changes
\b Added nsExec /MBCS switch
\S2{} Translations
\b Updated Corsican\#{(forum)} and Japanese (maboroshin PR\#{github.com/maboroshin})