From 88acdf23452d66fde103d02d56bdf6c3ca2ec4cc Mon Sep 17 00:00:00 2001 From: justin1014 Date: Wed, 18 Sep 2002 23:19:13 +0000 Subject: [PATCH] updated with a lot of .data size optimizations.. used eccles' optimization for certain registry settings too (thanks dave).. code size may have gone slightly up,but it let me take a lot of data size off (had to change some of the default error msgs too) git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1039 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/exehead/Ui.c | 17 +++++++++++++---- Source/exehead/fileform.c | 2 +- Source/exehead/lang.h | 12 +++++------- Source/exehead/util.c | 12 ++++++++---- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index f2cce300..502ef4d1 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -408,13 +408,22 @@ int NSISCALL ui_doinstall(void) #ifdef NSIS_CONFIG_LICENSEPAGE { // load richedit DLL WNDCLASS wc={0,}; - if (!LoadLibrary("RichEd20.dll")) LoadLibrary("RichEd32.dll"); + static char str1[]="RichEd20.dll"; + static char str2[]="RichEdit20A"; + if (!LoadLibrary(str1)) + { + str1[6]='3'; + str1[7]='2'; + LoadLibrary(str1); + } // make richedit20a point to RICHEDIT - if (!GetClassInfo(NULL,"RichEdit20A",&wc)) + if (!GetClassInfo(NULL,str2,&wc)) { - GetClassInfo(NULL,"RICHEDIT",&wc); - wc.lpszClassName = "RichEdit20A"; + str2[8]=0; + GetClassInfo(NULL,str2,&wc); + wc.lpszClassName = str2; + str2[8]='2'; RegisterClass(&wc); } } diff --git a/Source/exehead/fileform.c b/Source/exehead/fileform.c index 4bebc50d..5b4a377a 100644 --- a/Source/exehead/fileform.c +++ b/Source/exehead/fileform.c @@ -83,7 +83,7 @@ int NSISCALL loadHeaders(void) if (GetCompressedDataFromDataBlockToMemory(-1,data,h.length_of_header) != h.length_of_header) { - my_MessageBox("Error reading installer info block",MB_OK); + my_MessageBox(_LANG_CANTOPENSELF,MB_OK); GlobalFree((HGLOBAL)data); return -1; } diff --git a/Source/exehead/lang.h b/Source/exehead/lang.h index 4685bf97..dbc7f67e 100644 --- a/Source/exehead/lang.h +++ b/Source/exehead/lang.h @@ -2,23 +2,21 @@ #define _NSIS_LANG_H_ // generic startup strings (these will never be overridable) -#define _LANG_INVALIDCRC "Installer verification failed.\r\n\r\n" \ - "This could be the result of an incomplete download,\r\n" \ - "a failing disk, or (possibly) corruption from a virus." \ - "\r\n\r\nYou can try to force an install using the /NCRC\r\n" \ - "command line switch (but it is NOT recommended)" +#define _LANG_INVALIDCRC "Installer corrupted or incomplete.\r\n\r\n" \ + "This could be the result of a failed download or corruption from a virus." \ + "\r\n\r\nIf desperate, try the /NCRC command line switch (NOT recommended)" #define _LANG_INVALIDINST "Installer corrupted.\r\n\r\n" \ "This could be the result of an incomplete download" -#define _LANG_UNINSTINITERROR "Error initializing uninstaller" +#define _LANG_UNINSTINITERROR "Error launching installer" #define _LANG_VERIFYINGINST "verifying installer: %d%%" #define _LANG_UNPACKING "unpacking data: %d%%" -#define _LANG_CANTOPENSELF "Can't open self" +#define _LANG_CANTOPENSELF "Error launching installer" // same as uninstiniterror for size #define _LANG_GENERIC_ERROR "NSIS ERROR" diff --git a/Source/exehead/util.c b/Source/exehead/util.c index cdd4ef96..be43a26d 100644 --- a/Source/exehead/util.c +++ b/Source/exehead/util.c @@ -28,7 +28,8 @@ HANDLE g_hInstance; HANDLE NSISCALL myCreateProcess(char *cmd, char *dir) { PROCESS_INFORMATION ProcInfo={0,}; - STARTUPINFO StartUp={sizeof(StartUp),}; + STARTUPINFO StartUp={0,}; + StartUp.cb=sizeof(StartUp); if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, dir, &StartUp, &ProcInfo)) return NULL; if (NULL != ProcInfo.hThread) CloseHandle( ProcInfo.hThread ); @@ -340,11 +341,14 @@ static void NSISCALL queryShellFolders(const char *name_, char *out) mystrcpy(name + 7, name_); { char f=g_all_user_var_flag; + static char buf[65]; + wsprintf(buf,"%s\\Explorer\\Shell Folders","Software\\Microsoft\\Windows\\CurrentVersion"); + again: myRegGetStr(f?HKEY_LOCAL_MACHINE:HKEY_CURRENT_USER, - "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", - name+(f?0:7),out); + buf, + f?name:name_,out); if (!out[0]) { if (f) @@ -497,7 +501,7 @@ void NSISCALL process_string(char *out, const char *in) break; case VAR_CODES_START + 26: // PROGRAMFILES - myRegGetStr(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion", "ProgramFilesDir", out); + myRegGetStr(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", "ProgramFilesDir", out); if (!*out) mystrcpy(out, "C:\\Program Files"); break;