texaspapa
12th May 2011 00:15 UTC
MUI Invalid Languge File English
I am trying to get a test installer to work and get an error telling me that the language file is invalid. See below for details.
I get this error if I include either of these lines in the test program:
1) LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
2) !insertmacro MUI_LANGUAGE English
Code is including mui2.nsh.
I do not get this when I remove the line. This occurs with the build from Jan 26, 2011 available on the developers page. Does anyone know if there are issues with the language files? Has something changed related to language file formats since NSIS 2.46?
Test program works with the released version 2.46.
Compile output:
Exch($3,0)
FunctionEnd
!insertmacro: end of FUNCTION_STRING_StrTok
!define: "MUI_ABORTWARNING"=""
!define: "MUI_ICON"="\\h02264-pc\e$\Downloads\Programs\nsis\nsis-26-Jan-2011.cvs\Contrib\Graphics\T-System\TSystemEV.ico"
!define: "MUI_UNICON"="\\h02264-pc\e$\Downloads\Programs\nsis\nsis-26-Jan-2011.cvs\Contrib\Graphics\T-System\TSystemEV.ico"
!define: "MUI_COMPONENTSPAGE_NODESC"=""
!define: "MUI_WELCOMEFINISHPAGE_BITMAP"="\\h02264-pc\e$\Downloads\Programs\nsis\nsis-26-Jan-2011.cvs\Contrib\Graphics\T-System\T_Logo_Dialog2.bmp"
!define: "MUI_FINISHPAGE_NOAUTOCLOSE"=""
!insertmacro: MUI_PAGE_WELCOME
!insertmacro: end of MUI_PAGE_WELCOME
!insertmacro: MUI_PAGE_INSTFILES
!insertmacro: end of MUI_PAGE_INSTFILES
!insertmacro: MUI_PAGE_FINISH
!insertmacro: end of MUI_PAGE_FINISH
!insertmacro: MUI_UNPAGE_INSTFILES
!insertmacro: end of MUI_UNPAGE_INSTFILES
!insertmacro: MUI_LANGUAGE
Error: Invalid language file.
Error in macro MUI_LANGUAGE on macroline 9
Error in script "D:\dev\v40_work\Installer\testing\Test.nsi" on line 118 -- aborting creation process
T.Slappy
12th May 2011 05:37 UTC
Did you include MUI2 before !insertmacro MUI_LANGUAGE English ??
Sometimes the right order is needed.
texaspapa
12th May 2011 17:26 UTC
Language File Version 5 or 6?
Yes msi2 is included before any mui statements. msi2.nsh is the first file included.
This is strange as the same nsi file builds using the 2.46 version of nsis.
From what I can tell the current code Lang.cpp is checking for version 5 and language files all have version 6. Even the English NSIS 2.46 Language file is version 6.
// NSIS Language File parser
LanguageTable * CEXEBuild::LoadLangFile(char *filename) {
FILE *f = FOPEN(filename, "r");
if (!f) {
ERROR_MSG("Error: Can't open language file - \"%s\"!\n",filename);
return 0;
}
// Check header
char buf[NSIS_MAX_STRLEN];
buf[0] = SkipComments(f);
fgets(buf+1, NSIS_MAX_STRLEN, f);
if (strncmp(buf, "NLF v", 5)) {
ERROR_MSG("Error: Invalid language file.\n");
return 0;
}
Afrow UK
12th May 2011 17:45 UTC
No it's not checking for version 5. That is just telling it to only check the first 5 characters of buf (strncmp). Just use NSIS 2.46.
Stu
texaspapa
12th May 2011 18:43 UTC
You are correct. Code is only comparing 5 bytes. I still get the "Invalid Language File " error with the build from Jan 26th.
The 2.46 build is not working for me. I am trying to install on Windows 2008 (64-bit). Installer works on Windows Server 2003 (32-bit). When I run my installer it exits about half way through. I then ran my installer under Application Verifier and windbg. Application Verifier caught and aborted the installer the first time nsexec is invoked. This error occurs immediately when running the installer with Application Verifier. Turns out that nsexec.c ExecScript code corrupts memory on 64-bit system. This problem is fixed with current version of nsexec.c. This is why I am trying to get an updated nsis build!
I first checked out the latest NSIS source from SVN. After building NSIS I am not able to build any nsi file. So I thought that I would try the build from January 26 since it was available on the NSIS download page. With the Jan 26th build I get "Invalid Language File" when I build ANY nsi file including the languages.nsi file under examples.
Once I get past this issue, I will be able to resume debugging my installer.
Afrow UK
12th May 2011 18:55 UTC
You could use ExecDos instead? I have tested and modified that to work correctly on x64.
Stu
texaspapa
12th May 2011 19:48 UTC
thanks! I will look into ExecDos. Did you use the 2.46 build on a 64 bit OS when you used ExecDos?
I am now able to build the languages.nsi file using the build from January 26. It turns out that that build is built without UNICODE but that language files are saved as UTC-8 files. I saved the language files as ASCII files and can now build with no Invalid Language File errors.
Afrow UK
12th May 2011 20:59 UTC
The new NSIS version is meant to handle ANSI/Unicode duality but it's probably still work in progress. For that reason I would stick to 2.46 which has been tried and tested. You should always use stable releases in general, unless you are seeking for bad customer feedback ;). Yes we use 2.46.
Stu