From a3c887d456990cdf3aeb0ea4d600c478b0f5abf3 Mon Sep 17 00:00:00 2001 From: ramon18 Date: Wed, 23 Jul 2003 09:34:41 +0000 Subject: [PATCH] NSIS_SUPPORT_LANG_IN_STRINGS works without NSIS_SUPPORT_NAMED_USERVARS git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2764 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/build.cpp | 8 +++++++- Source/exehead/fileform.h | 27 ++++++++++++++++++--------- Source/exehead/util.c | 8 ++++++++ 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/Source/build.cpp b/Source/build.cpp index 165e9377..2cbf3567 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -512,8 +512,12 @@ int CEXEBuild::preprocess_string(char *out, const char *in) else // warning should go here #endif // not NSIS_SUPPORT_NAMED_USERVARS { -#ifdef NSIS_SUPPORT_NAMED_USERVARS + +#if defined(NSIS_SUPPORT_NAMED_USERVARS) || defined(NSIS_SUPPORT_LANG_IN_STRINGS) bool bProceced=false; +#endif + +#ifdef NSIS_SUPPORT_NAMED_USERVARS if ( *p ) { const char *pUserVarName = p; @@ -540,6 +544,7 @@ int CEXEBuild::preprocess_string(char *out, const char *in) pUserVarName--; } } +#endif #ifdef NSIS_SUPPORT_LANG_IN_STRINGS if ( !bProceced && *p == '(' ) { @@ -591,6 +596,7 @@ int CEXEBuild::preprocess_string(char *out, const char *in) free(cp); } #endif +#if defined(NSIS_SUPPORT_NAMED_USERVARS) || defined(NSIS_SUPPORT_LANG_IN_STRINGS) if ( bProceced ) continue; else diff --git a/Source/exehead/fileform.h b/Source/exehead/fileform.h index e1af6e13..7cf12c87 100644 --- a/Source/exehead/fileform.h +++ b/Source/exehead/fileform.h @@ -517,17 +517,26 @@ DWORD NSISCALL SetSelfFilePointer(LONG lDistanceToMove, DWORD dwMoveMethod); // $0..$9, $INSTDIR, etc are encoded as ASCII bytes starting from this value. // Added by ramon 3 jun 2003 #ifdef NSIS_SUPPORT_NAMED_USERVARS - #define VAR_CODES_START 253 + #ifdef NSIS_SUPPORT_LANG_IN_STRINGS + #define VAR_CODES_START 253 + #else + #define VAR_CODES_START 254 + #endif + #ifdef NSIS_SUPPORT_LANG_IN_STRINGS + #define LANG_CODES_START 254 + #endif #else -#ifdef NSIS_CONFIG_PLUGIN_SUPPORT - #define VAR_CODES_START (256 - 37) -#else - #define VAR_CODES_START (256 - 36) -#endif -#endif + #ifdef NSIS_SUPPORT_LANG_IN_STRINGS + #define LANG_CODES_START 254 + #else + #define LANG_CODES_START 255 + #endif -#ifdef NSIS_SUPPORT_LANG_IN_STRINGS - #define LANG_CODES_START 254 + #ifdef NSIS_CONFIG_PLUGIN_SUPPORT + #define VAR_CODES_START (LANG_CODES_START - 37) + #else + #define VAR_CODES_START (LANG_CODES_START - 36) + #endif #endif union installer_flags { diff --git a/Source/exehead/util.c b/Source/exehead/util.c index 79e3d869..e74035c8 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -443,6 +443,14 @@ char * NSISCALL process_string(const char *in) { *out++ = *in++; } +#ifdef NSIS_SUPPORT_LANG_IN_STRINGS + else if (nVarIdx == LANG_CODES_START) + { + nVarIdx = *(short*)in; in+=sizeof(WORD); + process_string(GetStringFromStringTab(nVarIdx), out-ps_tmpbuf); + out+=mystrlen(out); + } +#endif else { DWORD f;