From 6440139e8ebdc78b7c3497329910b2d404412f22 Mon Sep 17 00:00:00 2001 From: kichik Date: Thu, 19 Apr 2007 20:02:24 +0000 Subject: [PATCH] use $PROGRAMFILES for the root of the default $COMMONFILES instead of hard-coding "C:\Program Files" git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5102 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/build.cpp | 15 +++++++++++---- Source/exehead/util.c | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/build.cpp b/Source/build.cpp index 2ea6f0d0..c7a19ba2 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -338,12 +338,9 @@ CEXEBuild::CEXEBuild() : m_ShellConstants.add("CDBURN_AREA", CSIDL_CDBURN_AREA, CSIDL_CDBURN_AREA); unsigned int program_files = add_string("ProgramFilesDir"); - unsigned int common_files = add_string("CommonFilesDir"); unsigned int program_files_def = add_string("C:\\Program Files"); - unsigned int common_files_def = add_string("C:\\Program Files\\Common Files"); - if ((program_files >= 0x40) || (common_files >= 0x40) - || (program_files_def > 0xFF) || (common_files_def > 0xFF)) + if ((program_files >= 0x40) || (program_files_def >= 0xFF)) { // see Source\exehead\util.c for implementation details // basically, it knows it needs to get folders from the registry when the 0x80 is on @@ -354,6 +351,16 @@ CEXEBuild::CEXEBuild() : m_ShellConstants.add("PROGRAMFILES", 0x80 | program_files, program_files_def); m_ShellConstants.add("PROGRAMFILES32", 0x80 | program_files, program_files_def); m_ShellConstants.add("PROGRAMFILES64", 0xC0 | program_files, program_files_def); + + unsigned int common_files = add_string("CommonFilesDir"); + unsigned int common_files_def = add_string("$PROGRAMFILES\\Common Files"); + + if ((common_files > 0x40) || (common_files_def > 0xFF)) + { + ERROR_MSG("Internal compiler error: too many strings added to strings block before adding shell constants!\n"); + throw out_of_range("Internal compiler error: too many strings added to strings block before adding shell constants!"); + } + m_ShellConstants.add("COMMONFILES", 0x80 | common_files, common_files_def); m_ShellConstants.add("COMMONFILES32", 0x80 | common_files, common_files_def); m_ShellConstants.add("COMMONFILES64", 0xC0 | common_files, common_files_def); diff --git a/Source/exehead/util.c b/Source/exehead/util.c index ae9eefbe..2289c346 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -636,7 +636,7 @@ char * NSISCALL GetNSISString(char *outbuf, int strtab) { myRegGetStr(HKEY_LOCAL_MACHINE, SYSREGKEY, GetNSISStringNP(fldrs[0] & 0x3F), out, fldrs[0] & 0x40); if (!*out) - mystrcpy(out, GetNSISStringNP(fldrs[2])); + GetNSISString(out, fldrs[2]); x = 0; } else if (fldrs[0] == CSIDL_SYSTEM)