Language strings inside any other strings, $$ defines fix, both currently disabled by defines, support for /LANG in command VIAddVersionKey

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2652 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
ramon18 2003-06-16 19:58:29 +00:00
parent 45a9eb4ae7
commit a558797625
11 changed files with 200 additions and 21 deletions

View file

@ -210,6 +210,11 @@
// NSIS_SUPPORT_VERSION_INFO enables support for version information on final exe
#define NSIS_SUPPORT_VERSION_INFO
// NSIS_SUPPORT_LANG_IN_STRINGS enables support for language strings inside other strings
//#define NSIS_SUPPORT_LANG_IN_STRINGS
// NSIS_FIX_DEFINES_IN_STRINGS fix defines inside defines and handles chars $ perfectly
//#define NSIS_FIX_DEFINES_IN_STRINGS
// Added by Ximon Eighteen 5th August 2002
// If this is uncommented the following changes/new features are

View file

@ -106,7 +106,11 @@ static int *parms;
static int NSISCALL process_string_fromparm_toint(int id_)
{
#ifdef NSIS_SUPPORT_LANG_IN_STRINGS
return myatoi(process_string(GetStringFromStringTab(parms[id_]), 0));
#else
return myatoi(process_string(GetStringFromStringTab(parms[id_])));
#endif
}
// NB - USE CAUTION when rearranging code to make use of the new return value of

View file

@ -524,6 +524,10 @@ DWORD NSISCALL SetSelfFilePointer(LONG lDistanceToMove, DWORD dwMoveMethod);
#endif
#endif
#ifdef NSIS_SUPPORT_LANG_IN_STRINGS
#define LANG_CODES_START 251
#endif
union installer_flags {
struct {
int autoclose;

View file

@ -333,7 +333,11 @@ char ps_tmpbuf[NSIS_MAX_STRLEN*2];
char * NSISCALL process_string_fromtab(char *out, int offs)
{
#ifdef NSIS_SUPPORT_LANG_IN_STRINGS
char *p=process_string(GetStringFromStringTab(offs), 0);
#else
char *p=process_string(GetStringFromStringTab(offs));
#endif
if (!out) return p;
return lstrcpyn(out,p,NSIS_MAX_STRLEN);
}
@ -394,9 +398,17 @@ int NSISCALL mystrlen(const char *in)
}
// Dave Laundon's simplified process_string
#ifdef NSIS_SUPPORT_LANG_IN_STRINGS
char * NSISCALL process_string(const char *in, int iStartIdx )
#else
char * NSISCALL process_string(const char *in)
#endif
{
#ifdef NSIS_SUPPORT_LANG_IN_STRINGS
char *out = ps_tmpbuf+iStartIdx;
#else
char *out = ps_tmpbuf;
#endif
while (*in && out - ps_tmpbuf < NSIS_MAX_STRLEN)
{
int nVarIdx = (unsigned char)*in++;
@ -525,11 +537,7 @@ char * NSISCALL process_string(const char *in)
{
*out++ = *in++;
}
else if (nVarIdx != VAR_CODES_START)
{
*out++ = nVarIdx;
}
else
else if (nVarIdx == VAR_CODES_START)
{
DWORD f;
static char smwcvesf[]="Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
@ -613,6 +621,19 @@ char * NSISCALL process_string(const char *in)
}
out+=mystrlen(out);
} // == VAR_CODES_START
#ifdef NSIS_SUPPORT_LANG_IN_STRINGS
else if ( nVarIdx == LANG_CODES_START )
{
char *p;
nVarIdx = *(short*)in; in+=sizeof(WORD);
p = process_string(GetStringFromStringTab(nVarIdx), out-ps_tmpbuf);
out+=mystrlen(out);
}
#endif
else // Normal char
{
*out++ = nVarIdx;
}
#endif
} // while
*out = 0;

View file

@ -1,7 +1,11 @@
#include "config.h"
extern char ps_tmpbuf[NSIS_MAX_STRLEN*2];
#ifdef NSIS_SUPPORT_LANG_IN_STRINGS
char * NSISCALL process_string(const char *in, int iStartIdx);
#else
char * NSISCALL process_string(const char *in);
#endif
char * NSISCALL process_string_fromtab(char *out, int offs);
void NSISCALL myRegGetStr(HKEY root, const char *sub, const char *name, char *out);
int NSISCALL myatoi(char *s);