Changes to format of strings tables

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@686 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
eccles 2002-08-11 18:57:16 +00:00
parent ac00a53e1a
commit 8b9d432f7e
3 changed files with 103 additions and 106 deletions

View file

@ -68,10 +68,10 @@ extern char *english_strings[] = {
int CEXEBuild::SetString(char *string, int id, int process, WORD lang/*=0*/) { int CEXEBuild::SetString(char *string, int id, int process, WORD lang/*=0*/) {
lang = lang?lang:build_nlfs.size()?build_nlfs[build_nlfs.size()-1]->GetLang():0; lang = lang?lang:build_nlfs.size()?build_nlfs[build_nlfs.size()-1]->GetLang():0;
lang = lang?lang:string_tables.size()?string_tables[0]->lang_id:1033; // Default is English (1033) lang = lang?lang:string_tables.size()?string_tables[0]->common.lang_id:1033; // Default is English (1033)
StringTable *table = 0; StringTable *table = 0;
for (int i = 0; i < string_tables.size(); i++) { for (int i = 0; i < string_tables.size(); i++) {
if (lang == string_tables[i]->lang_id) { if (lang == string_tables[i]->common.lang_id) {
table = string_tables[i]; table = string_tables[i];
break; break;
} }
@ -83,7 +83,7 @@ int CEXEBuild::SetString(char *string, int id, int process, WORD lang/*=0*/) {
return PS_ERROR; return PS_ERROR;
} }
memset(table, -1, sizeof(StringTable)); memset(table, -1, sizeof(StringTable));
table->lang_id = table->ucommon.lang_id = table->installer.lang_id = table->uninstall.lang_id = lang; table->common.lang_id = table->ucommon.lang_id = lang;
string_tables.push_back(table); string_tables.push_back(table);
} }
@ -159,10 +159,10 @@ int CEXEBuild::SetString(char *string, int id, int process, StringTable *table)
bool CEXEBuild::_IsSet(int *str, WORD lang) { bool CEXEBuild::_IsSet(int *str, WORD lang) {
if (!str) return false; if (!str) return false;
lang = lang?lang:build_nlfs.size()?build_nlfs[build_nlfs.size()-1]->GetLang():0; lang = lang?lang:build_nlfs.size()?build_nlfs[build_nlfs.size()-1]->GetLang():0;
lang = lang?lang:string_tables.size()?string_tables[0]->lang_id:1033; // Default is English (1033) lang = lang?lang:string_tables.size()?string_tables[0]->common.lang_id:1033; // Default is English (1033)
int i; int i;
for (i = 0; i < string_tables.size(); i++) { for (i = 0; i < string_tables.size(); i++) {
if (lang == string_tables[i]->lang_id) { if (lang == string_tables[i]->common.lang_id) {
break; break;
} }
} }
@ -176,14 +176,14 @@ int CEXEBuild::WriteStringTables() {
// If we have no tables (user didn't set any string and didn't load any NLF) create the default one // If we have no tables (user didn't set any string and didn't load any NLF) create the default one
if (string_tables.size() == 0) { if (string_tables.size() == 0) {
build_header.str_tables_num = 1; build_header.common.str_tables_num = 1;
StringTable *table = (StringTable*)malloc(sizeof(StringTable)); StringTable *table = (StringTable*)malloc(sizeof(StringTable));
if (!table) { if (!table) {
ERROR_MSG("Internal compiler error #12345: malloc(%d) failed\n",sizeof(StringTable)); ERROR_MSG("Internal compiler error #12345: malloc(%d) failed\n",sizeof(StringTable));
return PS_ERROR; return PS_ERROR;
} }
memset(table, -1, sizeof(StringTable)); memset(table, -1, sizeof(StringTable));
table->lang_id=table->ucommon.lang_id=table->installer.lang_id=table->uninstall.lang_id=1033; // English table->common.lang_id=table->ucommon.lang_id=1033; // English
string_tables.push_back(table); string_tables.push_back(table);
} }
@ -193,35 +193,35 @@ int CEXEBuild::WriteStringTables() {
FillDefaultsIfNeeded(string_tables[i]); FillDefaultsIfNeeded(string_tables[i]);
// Add string tables into datablock // Add string tables into datablock
GrowBuf ist;
for (i = 0; i < st_num; i++)
ist.add(&string_tables[i]->installer, sizeof(installer_strings));
build_header.str_tables_num = st_num;
build_header.str_tables = add_data((char*)ist.get(), st_num*sizeof(installer_strings), &build_datablock);
GrowBuf cst; GrowBuf cst;
for (i = 0; i < st_num; i++) for (i = 0; i < st_num; i++)
cst.add(&string_tables[i]->common, sizeof(common_strings)); cst.add(&string_tables[i]->common, sizeof(common_strings));
build_header.common.str_tables_num = st_num;
build_header.common.str_tables = add_data((char*)cst.get(), st_num*sizeof(common_strings), &build_datablock); build_header.common.str_tables = add_data((char*)cst.get(), st_num*sizeof(common_strings), &build_datablock);
GrowBuf ust; GrowBuf ist;
for (i = 0; i < st_num; i++) for (i = 0; i < st_num; i++)
ust.add(&string_tables[i]->uninstall, sizeof(uninstall_strings)); ist.add(&string_tables[i]->installer, sizeof(installer_strings));
build_uninst.str_tables_num = st_num; build_header.common.inst_str_tables = add_data((char*)ist.get(), st_num*sizeof(installer_strings), &build_datablock);
build_uninst.str_tables = add_data((char*)ust.get(), st_num*sizeof(uninstall_strings), &ubuild_datablock);
GrowBuf ucst; GrowBuf ucst;
for (i = 0; i < st_num; i++) for (i = 0; i < st_num; i++)
ucst.add(&string_tables[i]->ucommon, sizeof(common_strings)); ucst.add(&string_tables[i]->ucommon, sizeof(common_strings));
build_uninst.common.str_tables_num = st_num;
build_uninst.common.str_tables = add_data((char*)ucst.get(), st_num*sizeof(common_strings), &ubuild_datablock); build_uninst.common.str_tables = add_data((char*)ucst.get(), st_num*sizeof(common_strings), &ubuild_datablock);
GrowBuf ust;
for (i = 0; i < st_num; i++)
ust.add(&string_tables[i]->uninstall, sizeof(uninstall_strings));
build_uninst.common.inst_str_tables = add_data((char*)ust.get(), st_num*sizeof(uninstall_strings), &ubuild_datablock);
return PS_OK; return PS_OK;
} }
void CEXEBuild::FillDefaultsIfNeeded(StringTable *table, NLF *nlf/*=0*/) { void CEXEBuild::FillDefaultsIfNeeded(StringTable *table, NLF *nlf/*=0*/) {
if (!nlf) { if (!nlf) {
for (int i = 0; i < build_nlfs.size(); i++) { for (int i = 0; i < build_nlfs.size(); i++) {
if (build_nlfs[i]->GetLang() == table->lang_id) { if (build_nlfs[i]->GetLang() == table->common.lang_id) {
nlf = build_nlfs[i]; nlf = build_nlfs[i];
break; break;
} }
@ -263,7 +263,7 @@ void CEXEBuild::FillDefaultsIfNeeded(StringTable *table, NLF *nlf/*=0*/) {
else table->installer.componenttext=-1; else table->installer.componenttext=-1;
} }
#endif #endif
static bool nameWarned = false; static bool nameWarned = false;
if (table->common.name < 0) if (table->common.name < 0)
{ {
@ -305,11 +305,11 @@ void CEXEBuild::FillDefaultsIfNeeded(StringTable *table, NLF *nlf/*=0*/) {
if (table->installer.spaceavailable<0 && !no_space_texts) table->installer.spaceavailable=add_string_main(str(NLF_SPACE_AVAIL),0); if (table->installer.spaceavailable<0 && !no_space_texts) table->installer.spaceavailable=add_string_main(str(NLF_SPACE_AVAIL),0);
} }
if (table->installer.text >= 0 if (table->installer.text >= 0
#ifdef NSIS_CONFIG_COMPONENTPAGE #ifdef NSIS_CONFIG_COMPONENTPAGE
|| table->installer.componenttext>=0 || table->installer.componenttext>=0
#endif #endif
) )
{ {
// Changed by Amir Szekely 22nd July 2002 // Changed by Amir Szekely 22nd July 2002
// Adds the ability to disable space texts // Adds the ability to disable space texts
@ -534,4 +534,4 @@ WORD NLF::GetLang() {
char* NLF::GetString(int idx) { char* NLF::GetString(int idx) {
if (idx < 0 || idx >= NLF_STRINGS) return 0; if (idx < 0 || idx >= NLF_STRINGS) return 0;
return m_szStrings[idx]; return m_szStrings[idx];
} }

View file

@ -8,10 +8,7 @@
using namespace std; using namespace std;
struct StringTable { struct StringTable {
union { common_strings common;
WORD lang_id;
common_strings common;
};
common_strings ucommon; common_strings ucommon;
installer_strings installer; installer_strings installer;
uninstall_strings uninstall; uninstall_strings uninstall;
@ -100,4 +97,4 @@ class NLF {
char *m_szStrings[NLF_STRINGS]; char *m_szStrings[NLF_STRINGS];
}; };
#endif #endif

View file

@ -54,7 +54,7 @@ int CEXEBuild::doParse(const char *str, FILE *fp, const char *curfilename, int *
// if ignoring, ignore all lines that don't begin with !. // if ignoring, ignore all lines that don't begin with !.
if (ignore && *str!='!') return PS_OK; if (ignore && *str!='!') return PS_OK;
if (m_linebuild.getlen()>1) m_linebuild.resize(m_linebuild.getlen()-2); if (m_linebuild.getlen()>1) m_linebuild.resize(m_linebuild.getlen()-2);
m_linebuild.add(str,strlen(str)+1); m_linebuild.add(str,strlen(str)+1);
@ -129,7 +129,7 @@ parse_again:
return PS_ERROR; return PS_ERROR;
} }
if (tkid == TOK_P_ELSE) if (tkid == TOK_P_ELSE)
{ {
if (line.getnumtokens() == 1) return PS_ELSE; if (line.getnumtokens() == 1) return PS_ELSE;
@ -153,7 +153,7 @@ parse_again:
// pure left to right precedence. Not too powerful, but useful. // pure left to right precedence. Not too powerful, but useful.
for (p = 1; p < line.getnumtokens(); p ++) for (p = 1; p < line.getnumtokens(); p ++)
{ {
if (p & 1) if (p & 1)
{ {
int new_s=!!definedlist.find(line.gettoken_str(p)); int new_s=!!definedlist.find(line.gettoken_str(p));
@ -207,7 +207,7 @@ parse_again:
return PS_OK; return PS_OK;
} }
if (tkid == TOK_P_ENDIF) return PS_ENDIF; if (tkid == TOK_P_ENDIF) return PS_ENDIF;
if (!ignore) if (!ignore)
{ {
int ret=doCommand(tkid,line,fp,curfilename,*lineptr); int ret=doCommand(tkid,line,fp,curfilename,*lineptr);
if (ret != PS_OK) return ret; if (ret != PS_OK) return ret;
@ -235,9 +235,9 @@ void CEXEBuild::ps_addtoline(const char *str, GrowBuf &linedata, StringList &his
continue; continue;
} }
in=t; in=t;
if (c == '$') if (c == '$')
{ {
if (in[0] == '\\') if (in[0] == '\\')
{ {
if (in[1] == 'r') if (in[1] == 'r')
@ -379,7 +379,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
break; break;
t++; t++;
} }
if (t && *t) if (t && *t)
{ {
ERROR_MSG("!macro: macro named \"%s\" already found!\n",line.gettoken_str(1)); ERROR_MSG("!macro: macro named \"%s\" already found!\n",line.gettoken_str(1));
return PS_ERROR; return PS_ERROR;
@ -414,7 +414,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
char *p=str; char *p=str;
str[0]=0; str[0]=0;
fgets(str,MAX_LINELENGTH,fp); fgets(str,MAX_LINELENGTH,fp);
if (feof(fp) || !str[0]) if (feof(fp) || !str[0])
{ {
ERROR_MSG("!macro \"%s\": unterminated (no !macroend found in file)!\n",line.gettoken_str(1)); ERROR_MSG("!macro \"%s\": unterminated (no !macroend found in file)!\n",line.gettoken_str(1));
return PS_ERROR; return PS_ERROR;
@ -444,7 +444,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
{ {
if (!stricmp(t,line.gettoken_str(1))) break; if (!stricmp(t,line.gettoken_str(1))) break;
t+=strlen(t)+1; t+=strlen(t)+1;
// advance over parms // advance over parms
while (*t) t+=strlen(t)+1; while (*t) t+=strlen(t)+1;
t++; t++;
@ -456,7 +456,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
t++; t++;
} }
SCRIPT_MSG("!insertmacro: %s\n",line.gettoken_str(1)); SCRIPT_MSG("!insertmacro: %s\n",line.gettoken_str(1));
if (!t || !*t) if (!t || !*t)
{ {
ERROR_MSG("!insertmacro: macro named \"%s\" not found!\n",line.gettoken_str(1)); ERROR_MSG("!insertmacro: macro named \"%s\" not found!\n",line.gettoken_str(1));
return PS_ERROR; return PS_ERROR;
@ -468,10 +468,10 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
DefineList l_define_saves; DefineList l_define_saves;
int npr=0; int npr=0;
// advance over parms // advance over parms
while (*t) while (*t)
{ {
char *v; char *v;
if (v=definedlist.find(t)) if (v=definedlist.find(t))
{ {
l_define_saves.add(t,v); l_define_saves.add(t,v);
definedlist.del(t); definedlist.del(t);
@ -507,7 +507,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
if (strcmp(t," ")) if (strcmp(t," "))
{ {
int ret=process_oneline(t,str,lp); int ret=process_oneline(t,str,lp);
if (ret != PS_OK) if (ret != PS_OK)
{ {
ERROR_MSG("Error in macro %s on macroline %d\n",line.gettoken_str(1),lp); ERROR_MSG("Error in macro %s on macroline %d\n",line.gettoken_str(1),lp);
return ret; return ret;
@ -661,7 +661,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
ERROR_MSG("InstType: no more than %d install types allowed. %d specified\n",NSIS_MAX_INST_TYPES,NSIS_MAX_INST_TYPES+1); ERROR_MSG("InstType: no more than %d install types allowed. %d specified\n",NSIS_MAX_INST_TYPES,NSIS_MAX_INST_TYPES+1);
return PS_ERROR; return PS_ERROR;
} }
else else
{ {
build_header.install_types_ptr[x] = add_string_main(line.gettoken_str(1),0); build_header.install_types_ptr[x] = add_string_main(line.gettoken_str(1),0);
SCRIPT_MSG("InstType: %d=\"%s\"\n",x+1,line.gettoken_str(1)); SCRIPT_MSG("InstType: %d=\"%s\"\n",x+1,line.gettoken_str(1));
@ -718,7 +718,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
if (fread(data,1,datalen,fp) != datalen) { if (fread(data,1,datalen,fp) != datalen) {
ERROR_MSG("LicenseData: can't read file.\n"); ERROR_MSG("LicenseData: can't read file.\n");
fclose(fp); fclose(fp);
return PS_ERROR; return PS_ERROR;
} }
fclose(fp); fclose(fp);
data[datalen]=0; data[datalen]=0;
@ -823,7 +823,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
SCRIPT_MSG("InstProgressFlags: %d (smooth=%d,colored=%d)\n",build_header.common.progress_flags, SCRIPT_MSG("InstProgressFlags: %d (smooth=%d,colored=%d)\n",build_header.common.progress_flags,
build_header.common.progress_flags&1, build_header.common.progress_flags&1,
(build_header.common.progress_flags&2)>>1); (build_header.common.progress_flags&2)>>1);
} }
return make_sure_not_in_secorfunc(line.gettoken_str(0)); return make_sure_not_in_secorfunc(line.gettoken_str(0));
case TOK_AUTOCLOSE: case TOK_AUTOCLOSE:
{ {
@ -913,7 +913,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
if (k == -1) PRINTHELP() if (k == -1) PRINTHELP()
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
if (which_token == TOK_SHOWDETAILSUNINST) build_uninst.common.show_details=k; if (which_token == TOK_SHOWDETAILSUNINST) build_uninst.common.show_details=k;
else else
#endif #endif
build_header.common.show_details=k; build_header.common.show_details=k;
SCRIPT_MSG("%s: %s\n",line.gettoken_str(0),line.gettoken_str(1)); SCRIPT_MSG("%s: %s\n",line.gettoken_str(0),line.gettoken_str(1));
@ -974,7 +974,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
build_header.common.bg_textcolor=((v3&0xff)<<16)|(v3&0xff00)|((v3&0xff0000)>>16); build_header.common.bg_textcolor=((v3&0xff)<<16)|(v3&0xff00)|((v3&0xff0000)>>16);
} }
} }
SCRIPT_MSG("BGGradient: %06X->%06X (text=%d)\n",v1,v2,v3); SCRIPT_MSG("BGGradient: %06X->%06X (text=%d)\n",v1,v2,v3);
} }
@ -1190,7 +1190,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
int k=line.gettoken_enum(1,"top\0left\0"); int k=line.gettoken_enum(1,"top\0left\0");
int wh=line.gettoken_int(2); int wh=line.gettoken_int(2);
if (k == -1) PRINTHELP() if (k == -1) PRINTHELP()
CResourceEditor re(header_data_new, exeheader_size_new); CResourceEditor re(header_data_new, exeheader_size_new);
BYTE* dlg = re.GetResource(RT_DIALOG, MAKEINTRESOURCE(IDD_INST), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); BYTE* dlg = re.GetResource(RT_DIALOG, MAKEINTRESOURCE(IDD_INST), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
@ -1318,7 +1318,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
exeheader_size_new=bzip2_exeheader_size; exeheader_size_new=bzip2_exeheader_size;
exeheader_size=bzip2_exeheader_size; exeheader_size=bzip2_exeheader_size;
if (!header_data_new) if (!header_data_new)
{ {
ERROR_MSG("Internal compiler error #12345: malloc(%d) failed\n",exeheader_size_new); ERROR_MSG("Internal compiler error #12345: malloc(%d) failed\n",exeheader_size_new);
extern void quit(); quit(); extern void quit(); quit();
@ -1350,14 +1350,14 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
} }
build_nlfs.push_back(newNLF); build_nlfs.push_back(newNLF);
for (i = 0; i < string_tables.size(); i++) { for (i = 0; i < string_tables.size(); i++) {
if (newNLF->GetLang() == string_tables[i]->lang_id) { if (newNLF->GetLang() == string_tables[i]->common.lang_id) {
break; break;
} }
} }
if (i < string_tables.size()) { if (i < string_tables.size()) {
StringTable *table = (StringTable*)malloc(sizeof(StringTable)); StringTable *table = (StringTable*)malloc(sizeof(StringTable));
memset(table, -1, sizeof(StringTable)); memset(table, -1, sizeof(StringTable));
table->lang_id=table->ucommon.lang_id=table->installer.lang_id=table->uninstall.lang_id=newNLF->GetLang(); table->common.lang_id=table->ucommon.lang_id=newNLF->GetLang();
string_tables.push_back(table); string_tables.push_back(table);
} }
} }
@ -1366,7 +1366,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
return PS_ERROR; return PS_ERROR;
} }
} }
return make_sure_not_in_secorfunc(line.gettoken_str(0)); return make_sure_not_in_secorfunc(line.gettoken_str(0));
// preprocessor-ish (ifdef/ifndef/else/endif are handled one step out from here) // preprocessor-ish (ifdef/ifndef/else/endif are handled one step out from here)
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -1479,8 +1479,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
return PS_OK; return PS_OK;
case TOK_UNINSTALLEXENAME: PRINTHELP() case TOK_UNINSTALLEXENAME: PRINTHELP()
#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
case TOK_UNINSTCAPTION: case TOK_UNINSTCAPTION:
{ {
@ -1558,9 +1558,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
ERROR_MSG("Error: %s specified, NSIS_CONFIG_UNINSTALL_SUPPORT not defined.\n", line.gettoken_str(0)); ERROR_MSG("Error: %s specified, NSIS_CONFIG_UNINSTALL_SUPPORT not defined.\n", line.gettoken_str(0));
return PS_ERROR; return PS_ERROR;
#endif #endif
// section/function shit // section/function shit
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -1615,7 +1615,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
} }
else else
{ {
ERROR_MSG("Error: SectionIn section %d out of range 1-%d\n",x+1,NSIS_MAX_INST_TYPES); ERROR_MSG("Error: SectionIn section %d out of range 1-%d\n",x+1,NSIS_MAX_INST_TYPES);
return PS_ERROR; return PS_ERROR;
} }
p++; p++;
@ -1678,7 +1678,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
case TOK_SETDATESAVE: case TOK_SETDATESAVE:
build_datesave=line.gettoken_enum(1,"off\0on\0"); build_datesave=line.gettoken_enum(1,"off\0on\0");
if (build_datesave==-1) PRINTHELP() if (build_datesave==-1) PRINTHELP()
SCRIPT_MSG("SetDateSave: %s\n",line.gettoken_str(1)); SCRIPT_MSG("SetDateSave: %s\n",line.gettoken_str(1));
return PS_OK; return PS_OK;
case TOK_SETOVERWRITE: case TOK_SETOVERWRITE:
build_overwrite=line.gettoken_enum(1,"on\0off\0try\0ifnewer\0"); build_overwrite=line.gettoken_enum(1,"on\0off\0try\0ifnewer\0");
@ -1821,11 +1821,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
// instructions // instructions
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
case TOK_NOP: case TOK_NOP:
SCRIPT_MSG("Nop\n"); SCRIPT_MSG("Nop\n");
ent.which=EW_NOP; ent.which=EW_NOP;
return add_entry(&ent); return add_entry(&ent);
case TOK_GOTO: case TOK_GOTO:
ent.which=EW_NOP; ent.which=EW_NOP;
if (process_jump(line,1,&ent.offsets[0])) PRINTHELP() if (process_jump(line,1,&ent.offsets[0])) PRINTHELP()
SCRIPT_MSG("Goto: %s\n",line.gettoken_str(1)); SCRIPT_MSG("Goto: %s\n",line.gettoken_str(1));
@ -1864,9 +1864,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
} }
else else
{ {
if (line.gettoken_str(1)[0] == ':') if (line.gettoken_str(1)[0] == ':')
{ {
ent.offsets[1]=1; ent.offsets[1]=1;
ent.offsets[0]=ns_label.add(line.gettoken_str(1)+1,0); ent.offsets[0]=ns_label.add(line.gettoken_str(1)+1,0);
} }
else ent.offsets[0]=ns_func.add(line.gettoken_str(1),0); else ent.offsets[0]=ns_func.add(line.gettoken_str(1),0);
@ -1879,11 +1879,11 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
char *p=line.gettoken_str(1); char *p=line.gettoken_str(1);
if (*p == '-') cur_out_path[0]=0; if (*p == '-') cur_out_path[0]=0;
else else
{ {
if (p[0] == '\\' && p[1] != '\\') p++; if (p[0] == '\\' && p[1] != '\\') p++;
strncpy(cur_out_path,p,1024-1); strncpy(cur_out_path,p,1024-1);
cur_out_path[1024-1]=0; cur_out_path[1024-1]=0;
if (*CharPrev(cur_out_path,cur_out_path+strlen(cur_out_path))=='\\') if (*CharPrev(cur_out_path,cur_out_path+strlen(cur_out_path))=='\\')
*CharPrev(cur_out_path,cur_out_path+strlen(cur_out_path))=0; // remove trailing slash *CharPrev(cur_out_path,cur_out_path+strlen(cur_out_path))=0; // remove trailing slash
} }
if (!cur_out_path[0]) strcpy(cur_out_path,"$INSTDIR"); if (!cur_out_path[0]) strcpy(cur_out_path,"$INSTDIR");
@ -1899,10 +1899,10 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
char *p=line.gettoken_str(1); char *p=line.gettoken_str(1);
if (*p == '-') out_path[0]=0; if (*p == '-') out_path[0]=0;
else else
{ {
if (p[0] == '\\' && p[1] != '\\') p++; if (p[0] == '\\' && p[1] != '\\') p++;
strncpy(out_path,p,1024-1); strncpy(out_path,p,1024-1);
if (*CharPrev(out_path,out_path+strlen(out_path))=='\\') if (*CharPrev(out_path,out_path+strlen(out_path))=='\\')
*CharPrev(out_path,out_path+strlen(out_path))=0; // remove trailing slash *CharPrev(out_path,out_path+strlen(out_path))=0; // remove trailing slash
} }
if (!*out_path) PRINTHELP() if (!*out_path) PRINTHELP()
@ -1917,7 +1917,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
ent.which=EW_EXECUTE; ent.which=EW_EXECUTE;
ent.offsets[0]=add_string(line.gettoken_str(1)); ent.offsets[0]=add_string(line.gettoken_str(1));
ent.offsets[1] = 0; ent.offsets[1] = 0;
if (which_token == TOK_EXECWAIT) if (which_token == TOK_EXECWAIT)
{ {
ent.offsets[1]=1; ent.offsets[1]=1;
ent.offsets[2]=line.gettoken_enum(2,usrvars); ent.offsets[2]=line.gettoken_enum(2,usrvars);
@ -1959,9 +1959,9 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
#else//NSIS_SUPPORT_ACTIVEXREG #else//NSIS_SUPPORT_ACTIVEXREG
ent.which=EW_REGISTERDLL; ent.which=EW_REGISTERDLL;
ent.offsets[0]=add_string(line.gettoken_str(1)); ent.offsets[0]=add_string(line.gettoken_str(1));
if (which_token == TOK_UNREGDLL) if (which_token == TOK_UNREGDLL)
{ {
ent.offsets[1]=add_string("DllUnregisterServer"); ent.offsets[1]=add_string("DllUnregisterServer");
ent.offsets[2]=add_string("Unregistering: "); ent.offsets[2]=add_string("Unregistering: ");
} }
else if (which_token == TOK_CALLINSTDLL) else if (which_token == TOK_CALLINSTDLL)
@ -2012,7 +2012,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
#ifdef NSIS_SUPPORT_MESSAGEBOX #ifdef NSIS_SUPPORT_MESSAGEBOX
{ {
#define MBD(x) {x,#x}, #define MBD(x) {x,#x},
struct struct
{ {
int id; int id;
char *str; char *str;
@ -2057,7 +2057,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
ent.which=EW_MESSAGEBOX; ent.which=EW_MESSAGEBOX;
ent.offsets[0]=r; ent.offsets[0]=r;
ent.offsets[1]=add_string(line.gettoken_str(2)); ent.offsets[1]=add_string(line.gettoken_str(2));
int rettab[] = int rettab[] =
{ {
0,IDABORT,IDCANCEL,IDIGNORE,IDNO,IDOK,IDRETRY,IDYES 0,IDABORT,IDCANCEL,IDIGNORE,IDNO,IDOK,IDRETRY,IDYES
}; };
@ -2079,7 +2079,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
SCRIPT_MSG("MessageBox: %d: \"%s\"",r,line.gettoken_str(2)); SCRIPT_MSG("MessageBox: %d: \"%s\"",r,line.gettoken_str(2));
if (line.getnumtokens()>4) SCRIPT_MSG(" (on %s goto %s)",line.gettoken_str(3),line.gettoken_str(4)); if (line.getnumtokens()>4) SCRIPT_MSG(" (on %s goto %s)",line.gettoken_str(3),line.gettoken_str(4));
SCRIPT_MSG("\n"); SCRIPT_MSG("\n");
} }
return add_entry(&ent); return add_entry(&ent);
#else//!NSIS_SUPPORT_MESSAGEBOX #else//!NSIS_SUPPORT_MESSAGEBOX
ERROR_MSG("Error: %s specified, NSIS_SUPPORT_MESSAGEBOX not defined.\n", line.gettoken_str(0)); ERROR_MSG("Error: %s specified, NSIS_SUPPORT_MESSAGEBOX not defined.\n", line.gettoken_str(0));
@ -2318,7 +2318,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
{ {
ent.which=EW_COPYFILES; ent.which=EW_COPYFILES;
ent.offsets[2]=FOF_NOCONFIRMATION|FOF_NOCONFIRMMKDIR|FOF_NOERRORUI|FOF_SIMPLEPROGRESS; ent.offsets[2]=FOF_NOCONFIRMATION|FOF_NOCONFIRMMKDIR|FOF_NOERRORUI|FOF_SIMPLEPROGRESS;
int a=1; int a=1;
int x; int x;
for (x = 0; x < 2; x ++) for (x = 0; x < 2; x ++)
@ -2336,7 +2336,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
} }
else if (line.gettoken_str(a)[0]=='/') PRINTHELP() else if (line.gettoken_str(a)[0]=='/') PRINTHELP()
else break; else break;
} }
ent.offsets[0]=add_string(line.gettoken_str(a)); ent.offsets[0]=add_string(line.gettoken_str(a));
ent.offsets[1]=add_string(line.gettoken_str(a+1)); ent.offsets[1]=add_string(line.gettoken_str(a+1));
int s; int s;
@ -2355,7 +2355,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
case TOK_SETFILEATTRIBUTES: case TOK_SETFILEATTRIBUTES:
{ {
#define MBD(x) {x,#x}, #define MBD(x) {x,#x},
struct struct
{ {
int id; int id;
char *str; char *str;
@ -2403,23 +2403,23 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
return add_entry(&ent); return add_entry(&ent);
case TOK_SLEEP: case TOK_SLEEP:
{ {
ent.which=EW_SLEEP; ent.which=EW_SLEEP;
ent.offsets[0]=add_string(line.gettoken_str(1)); ent.offsets[0]=add_string(line.gettoken_str(1));
SCRIPT_MSG("Sleep: %s ms\n",line.gettoken_str(1)); SCRIPT_MSG("Sleep: %s ms\n",line.gettoken_str(1));
} }
return add_entry(&ent); return add_entry(&ent);
case TOK_BRINGTOFRONT: case TOK_BRINGTOFRONT:
ent.which=EW_BRINGTOFRONT; ent.which=EW_BRINGTOFRONT;
SCRIPT_MSG("BringToFront\n"); SCRIPT_MSG("BringToFront\n");
return add_entry(&ent); return add_entry(&ent);
case TOK_HIDEWINDOW: case TOK_HIDEWINDOW:
ent.which=EW_HIDEWINDOW; ent.which=EW_HIDEWINDOW;
SCRIPT_MSG("HideWindow\n"); SCRIPT_MSG("HideWindow\n");
return add_entry(&ent); return add_entry(&ent);
case TOK_IFFILEEXISTS: case TOK_IFFILEEXISTS:
ent.which=EW_IFFILEEXISTS; ent.which=EW_IFFILEEXISTS;
ent.offsets[0] = add_string(line.gettoken_str(1)); ent.offsets[0] = add_string(line.gettoken_str(1));
if (process_jump(line,2,&ent.offsets[1]) || if (process_jump(line,2,&ent.offsets[1]) ||
process_jump(line,3,&ent.offsets[2])) PRINTHELP() process_jump(line,3,&ent.offsets[2])) PRINTHELP()
SCRIPT_MSG("IfFileExists: \"%s\" ? %s : %s\n",line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3)); SCRIPT_MSG("IfFileExists: \"%s\" ? %s : %s\n",line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3));
return add_entry(&ent); return add_entry(&ent);
@ -2458,7 +2458,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
return add_entry(&ent); return add_entry(&ent);
case TOK_IFERRORS: case TOK_IFERRORS:
ent.which=EW_IFERRORS; ent.which=EW_IFERRORS;
if (process_jump(line,1,&ent.offsets[0]) || if (process_jump(line,1,&ent.offsets[0]) ||
process_jump(line,2,&ent.offsets[1])) PRINTHELP() process_jump(line,2,&ent.offsets[1])) PRINTHELP()
SCRIPT_MSG("IfErrors ?%s:%s\n",line.gettoken_str(1),line.gettoken_str(2)); SCRIPT_MSG("IfErrors ?%s:%s\n",line.gettoken_str(1),line.gettoken_str(2));
return add_entry(&ent); return add_entry(&ent);
@ -2589,7 +2589,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
high=ft.dwHighDateTime; high=ft.dwHighDateTime;
low=ft.dwLowDateTime; low=ft.dwLowDateTime;
flag=1; flag=1;
} }
CloseHandle(hFile); CloseHandle(hFile);
} }
if (!flag) if (!flag)
@ -2637,7 +2637,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
char *vname="<section>"; char *vname="<section>";
ent.which=EW_WRITEINI; ent.which=EW_WRITEINI;
ent.offsets[0]=add_string(line.gettoken_str(2)); // section name ent.offsets[0]=add_string(line.gettoken_str(2)); // section name
if (line.getnumtokens() > 3) if (line.getnumtokens() > 3)
{ {
vname=line.gettoken_str(3); vname=line.gettoken_str(3);
ent.offsets[1]=add_string(vname); // value name ent.offsets[1]=add_string(vname); // value name
@ -2716,7 +2716,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
ERROR_MSG("Error: %s specified, NSIS_SUPPORT_FNUTIL not defined.\n", line.gettoken_str(0)); ERROR_MSG("Error: %s specified, NSIS_SUPPORT_FNUTIL not defined.\n", line.gettoken_str(0));
return PS_ERROR; return PS_ERROR;
#endif #endif
case TOK_GETDLLVERSION: case TOK_GETDLLVERSION:
#ifdef NSIS_SUPPORT_GETDLLVERSION #ifdef NSIS_SUPPORT_GETDLLVERSION
ent.which=EW_GETDLLVERSION; ent.which=EW_GETDLLVERSION;
ent.offsets[0]=add_string(line.gettoken_str(1)); ent.offsets[0]=add_string(line.gettoken_str(1));
@ -2768,7 +2768,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
ent.offsets[0]=add_string(line.gettoken_str(1)); ent.offsets[0]=add_string(line.gettoken_str(1));
ent.offsets[1]=add_string(line.gettoken_str(2)); ent.offsets[1]=add_string(line.gettoken_str(2));
if (process_jump(line,3,&ent.offsets[2]) || if (process_jump(line,3,&ent.offsets[2]) ||
process_jump(line,4,&ent.offsets[3]) || process_jump(line,4,&ent.offsets[3]) ||
process_jump(line,5,&ent.offsets[4])) PRINTHELP() process_jump(line,5,&ent.offsets[4])) PRINTHELP()
SCRIPT_MSG("%s %s:%s equal=%s, < %s, > %s\n",line.gettoken_str(0), SCRIPT_MSG("%s %s:%s equal=%s, < %s, > %s\n",line.gettoken_str(0),
line.gettoken_str(1),line.gettoken_str(2), line.gettoken_str(3),line.gettoken_str(4),line.gettoken_str(5)); line.gettoken_str(1),line.gettoken_str(2), line.gettoken_str(3),line.gettoken_str(4),line.gettoken_str(5));
@ -2797,7 +2797,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
else ent.offsets[4]=0; else ent.offsets[4]=0;
if (line.gettoken_str(3)[0] == '\\') warning("%s: registry path name begins with \'\\\', may cause problems (%s:%d)",line.gettoken_str(0),curfilename,linecnt); if (line.gettoken_str(3)[0] == '\\') warning("%s: registry path name begins with \'\\\', may cause problems (%s:%d)",line.gettoken_str(0),curfilename,linecnt);
SCRIPT_MSG("%s %s %s\\%s\\%s\n",line.gettoken_str(0), SCRIPT_MSG("%s %s %s\\%s\\%s\n",line.gettoken_str(0),
line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(4)); line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(4));
} }
return add_entry(&ent); return add_entry(&ent);
@ -2819,7 +2819,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
if (k == -1) k=line.gettoken_enum(a,rootkeys[1]); if (k == -1) k=line.gettoken_enum(a,rootkeys[1]);
if (k == -1) PRINTHELP() if (k == -1) PRINTHELP()
ent.which=EW_DELREG; ent.which=EW_DELREG;
ent.offsets[0]=(int)rootkey_tab[k]; ent.offsets[0]=(int)rootkey_tab[k];
ent.offsets[1]=add_string(line.gettoken_str(a+1)); ent.offsets[1]=add_string(line.gettoken_str(a+1));
ent.offsets[2]=(which_token==TOK_DELETEREGKEY)?-1:add_string(line.gettoken_str(a+2)); ent.offsets[2]=(which_token==TOK_DELETEREGKEY)?-1:add_string(line.gettoken_str(a+2));
if (line.gettoken_str(a+1)[0] == '\\') warning("%s: registry path name begins with \'\\\', may cause problems (%s:%d)",line.gettoken_str(0),curfilename,linecnt); if (line.gettoken_str(a+1)[0] == '\\') warning("%s: registry path name begins with \'\\\', may cause problems (%s:%d)",line.gettoken_str(0),curfilename,linecnt);
@ -2853,7 +2853,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
} }
else ent.offsets[4]=1; else ent.offsets[4]=1;
} }
if (which_token == TOK_WRITEREGBIN) if (which_token == TOK_WRITEREGBIN)
{ {
char data[NSIS_MAX_STRLEN]; char data[NSIS_MAX_STRLEN];
char *p=line.gettoken_str(4); char *p=line.gettoken_str(4);
@ -2874,7 +2874,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
else break; else break;
p++; p++;
c=(a<<4)|b; c=(a<<4)|b;
if (data_len >= NSIS_MAX_STRLEN) if (data_len >= NSIS_MAX_STRLEN)
{ {
ERROR_MSG("WriteRegBin: %d bytes of data exceeded\n",NSIS_MAX_STRLEN); ERROR_MSG("WriteRegBin: %d bytes of data exceeded\n",NSIS_MAX_STRLEN);
return PS_ERROR; return PS_ERROR;
@ -2888,7 +2888,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
if (ent.offsets[3] < 0) return PS_ERROR; if (ent.offsets[3] < 0) return PS_ERROR;
ent.offsets[4]=3; ent.offsets[4]=3;
} }
if (which_token == TOK_WRITEREGDWORD) if (which_token == TOK_WRITEREGDWORD)
{ {
ent.offsets[3]=add_string(line.gettoken_str(4)); ent.offsets[3]=add_string(line.gettoken_str(4));
ent.offsets[4]=2; ent.offsets[4]=2;
@ -2911,7 +2911,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
ent.offsets[3]=add_string(line.gettoken_str(4)); ent.offsets[3]=add_string(line.gettoken_str(4));
ent.offsets[4]=which_token == TOK_ENUMREGKEY; ent.offsets[4]=which_token == TOK_ENUMREGKEY;
if (line.gettoken_str(3)[0] == '\\') warning("%s: registry path name begins with \'\\\', may cause problems (%s:%d)",line.gettoken_str(0),curfilename,linecnt); if (line.gettoken_str(3)[0] == '\\') warning("%s: registry path name begins with \'\\\', may cause problems (%s:%d)",line.gettoken_str(0),curfilename,linecnt);
SCRIPT_MSG("%s %s %s\\%s\\%s\n",which_token == TOK_ENUMREGKEY ? "EnumRegKey" : "EnumRegValue", SCRIPT_MSG("%s %s %s\\%s\\%s\n",which_token == TOK_ENUMREGKEY ? "EnumRegKey" : "EnumRegValue",
line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(4)); line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(4));
} }
return add_entry(&ent); return add_entry(&ent);
@ -3063,7 +3063,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
ent.offsets[1]=GENERIC_WRITE|GENERIC_READ; ent.offsets[1]=GENERIC_WRITE|GENERIC_READ;
ent.offsets[2]=OPEN_ALWAYS; ent.offsets[2]=OPEN_ALWAYS;
} }
if (ent.offsets[3] < 0 || !ent.offsets[1]) PRINTHELP() if (ent.offsets[3] < 0 || !ent.offsets[1]) PRINTHELP()
} }
SCRIPT_MSG("FileOpen: %s as %s -> %s\n",line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(1)); SCRIPT_MSG("FileOpen: %s as %s -> %s\n",line.gettoken_str(2),line.gettoken_str(3),line.gettoken_str(1));
@ -3116,7 +3116,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
ent.offsets[1]=add_string(line.gettoken_str(2)); ent.offsets[1]=add_string(line.gettoken_str(2));
ent.offsets[3]=line.gettoken_enum(4,usrvars); ent.offsets[3]=line.gettoken_enum(4,usrvars);
if (mode<0 && !line.gettoken_str(3)[0]) if (mode<0 && !line.gettoken_str(3)[0])
{ {
mode=0; mode=0;
modestr="SET"; modestr="SET";
@ -3153,7 +3153,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
return add_entry(&ent); return add_entry(&ent);
case TOK_IFREBOOTFLAG: case TOK_IFREBOOTFLAG:
ent.which=EW_IFREBOOTFLAG; ent.which=EW_IFREBOOTFLAG;
if (process_jump(line,1,&ent.offsets[0]) || if (process_jump(line,1,&ent.offsets[0]) ||
process_jump(line,2,&ent.offsets[1])) PRINTHELP() process_jump(line,2,&ent.offsets[1])) PRINTHELP()
SCRIPT_MSG("IfRebootFlag ?%s:%s\n",line.gettoken_str(1),line.gettoken_str(2)); SCRIPT_MSG("IfRebootFlag ?%s:%s\n",line.gettoken_str(1),line.gettoken_str(2));
return add_entry(&ent); return add_entry(&ent);
@ -3175,7 +3175,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
ent.offsets[0]=1; ent.offsets[0]=1;
ent.offsets[1]=line.gettoken_enum(1,"off\0on\0"); ent.offsets[1]=line.gettoken_enum(1,"off\0on\0");
if (ent.offsets[1]<0) PRINTHELP() if (ent.offsets[1]<0) PRINTHELP()
SCRIPT_MSG("LogSet: %s\n",line.gettoken_str(1)); SCRIPT_MSG("LogSet: %s\n",line.gettoken_str(1));
return add_entry(&ent); return add_entry(&ent);
case TOK_LOGTEXT: case TOK_LOGTEXT:
@ -3216,7 +3216,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
ent.offsets[2]=line.gettoken_enum(2,usrvars); ent.offsets[2]=line.gettoken_enum(2,usrvars);
if (line.gettoken_str(2)[0] && ent.offsets[2]<0) PRINTHELP() if (line.gettoken_str(2)[0] && ent.offsets[2]<0) PRINTHELP()
SCRIPT_MSG("SectionGetText: %s->%s\n",line.gettoken_str(1),line.gettoken_str(2)); SCRIPT_MSG("SectionGetText: %s->%s\n",line.gettoken_str(1),line.gettoken_str(2));
return add_entry(&ent); return add_entry(&ent);
case TOK_SECTIONSETFLAGS: case TOK_SECTIONSETFLAGS:
if (uninstall_mode) if (uninstall_mode)
{ {
@ -3346,7 +3346,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
} }
else else
ERROR_MSG("Error: Plugin dll for command \"%s\" not found.\n",line.gettoken_str(0)); ERROR_MSG("Error: Plugin dll for command \"%s\" not found.\n",line.gettoken_str(0));
} }
return PS_ERROR; return PS_ERROR;
#else #else
case TOK_PLUGINDIR: case TOK_PLUGINDIR:
@ -3378,11 +3378,11 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn
h = FindFirstFile(lgss,&d); h = FindFirstFile(lgss,&d);
if (h != INVALID_HANDLE_VALUE) if (h != INVALID_HANDLE_VALUE)
{ {
do do
{ {
if (d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (d.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{ {
if (recurse && strcmp(d.cFileName,"..") && strcmp(d.cFileName,".")) if (recurse && strcmp(d.cFileName,"..") && strcmp(d.cFileName,"."))
{ {
entry ent={0,}; entry ent={0,};
int a; int a;
@ -3419,19 +3419,19 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn
ent.offsets[0]=add_string(cur_out_path); ent.offsets[0]=add_string(cur_out_path);
ent.offsets[1]=1; ent.offsets[1]=1;
a=add_entry(&ent); a=add_entry(&ent);
if (a != PS_OK) if (a != PS_OK)
{ {
FindClose(h); FindClose(h);
return a; return a;
} }
if (attrib) if (attrib)
{ {
ent.which=EW_SETFILEATTRIBUTES; ent.which=EW_SETFILEATTRIBUTES;
ent.offsets[0]=add_string(cur_out_path); ent.offsets[0]=add_string(cur_out_path);
ent.offsets[1]=d.dwFileAttributes; ent.offsets[1]=d.dwFileAttributes;
a=add_entry(&ent); a=add_entry(&ent);
if (a != PS_OK) if (a != PS_OK)
{ {
FindClose(h); FindClose(h);
return a; return a;
@ -3454,7 +3454,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn
SCRIPT_MSG("File: Returning to: \"%s\" -> \"%s\"\n",dir,cur_out_path); SCRIPT_MSG("File: Returning to: \"%s\" -> \"%s\"\n",dir,cur_out_path);
ent.offsets[0]=add_string(cur_out_path); ent.offsets[0]=add_string(cur_out_path);
a=add_entry(&ent); a=add_entry(&ent);
if (a != PS_OK) if (a != PS_OK)
{ {
FindClose(h); FindClose(h);
return a; return a;
@ -3526,7 +3526,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn
if (filedata) UnmapViewOfFile(filedata); if (filedata) UnmapViewOfFile(filedata);
if (hFileMap) CloseHandle(hFileMap); if (hFileMap) CloseHandle(hFileMap);
if (ent.offsets[2] < 0) if (ent.offsets[2] < 0)
{ {
CloseHandle(hFile); CloseHandle(hFile);
return PS_ERROR; return PS_ERROR;
@ -3565,7 +3565,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn
CloseHandle(hFile); CloseHandle(hFile);
int a=add_entry(&ent); int a=add_entry(&ent);
if (a != PS_OK) if (a != PS_OK)
{ {
FindClose(h); FindClose(h);
return a; return a;
@ -3573,7 +3573,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn
if (attrib) if (attrib)
{ {
char tmp_path[1024]; char tmp_path[1024];
ent.which=EW_SETFILEATTRIBUTES; ent.which=EW_SETFILEATTRIBUTES;
if (name_override) if (name_override)
{ {
sprintf(tmp_path,"%s\\%s",cur_out_path,name_override); sprintf(tmp_path,"%s\\%s",cur_out_path,name_override);
@ -3586,7 +3586,7 @@ int CEXEBuild::do_add_file(const char *lgss, int attrib, int recurse, int linecn
ent.offsets[1]=d.dwFileAttributes; ent.offsets[1]=d.dwFileAttributes;
a=add_entry(&ent); a=add_entry(&ent);
if (a != PS_OK) if (a != PS_OK)
{ {
FindClose(h); FindClose(h);
return a; return a;