diff --git a/Source/build.cpp b/Source/build.cpp index 07da33ea..a1483e62 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -3,8 +3,6 @@ #include "exehead/config.h" #include "exehead/fileform.h" -#include "exedata.h" - #include "build.h" #include "util.h" @@ -86,19 +84,6 @@ CEXEBuild::CEXEBuild() : ns_func.add("",0); // make sure offset 0 is special on these (i.e. never used by a label) ns_label.add("",0); - exehead_original_size = zlib_exehead_size; - update_exehead(zlib_exehead, zlib_exehead_size); - -#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT - // Changed by Amir Szekely 11th July 2002 - // No need to check for uninstaller icon if uninstall support is disabled. - if (unicondata_size != icondata_size) - { - ERROR_MSG("Internal compiler error #12345: installer,uninstaller icon size mismatch (%d,%d)\n",icondata_size,unicondata_size); - extern void quit(); quit(); - } -#endif // NSIS_CONFIG_UNINSTALL_SUPPORT - extern const char *NSIS_VERSION; definedlist.add("NSIS_VERSION", NSIS_VERSION); @@ -363,12 +348,8 @@ definedlist.add("NSIS_SUPPORT_LANG_IN_STRINGS"); build_font[0]=0; build_font_size=0; - m_unicon_data=(unsigned char *)malloc(unicondata_size+3*sizeof(DWORD)); - memcpy(m_unicon_data+2*sizeof(DWORD),unicon_data+22,unicondata_size); - *(DWORD*)(m_unicon_data) = unicondata_size; - *(DWORD*)(m_unicon_data + sizeof(DWORD)) = 0; - *(DWORD*)(m_unicon_data + 2*sizeof(DWORD) + unicondata_size) = 0; - unicondata_size += 3*sizeof(DWORD); + m_unicon_data=NULL; + m_unicon_size=0; branding_image_found=false; @@ -476,15 +457,32 @@ definedlist.add("NSIS_SUPPORT_LANG_IN_STRINGS"); m_ShellConstants.add("CDBURN_AREA", CSIDL_CDBURN_AREA, CSIDL_CDBURN_AREA); } -void CEXEBuild::setdirs(const char *argv0) +void CEXEBuild::initialize(const char *makensis_path) { - string nsis_dir = get_executable_dir(argv0); + string nsis_dir = get_executable_dir(makensis_path); definedlist.add("NSISDIR",nsis_dir.c_str()); - nsis_dir += PLATFORM_PATH_SEPARATOR_STR; - nsis_dir += "Include"; - include_dirs.add(nsis_dir.c_str(),0); + string includes_dir = nsis_dir; + includes_dir += PLATFORM_PATH_SEPARATOR_STR; + includes_dir += "Include"; + include_dirs.add(includes_dir.c_str(),0); + + stubs_dir = nsis_dir; + stubs_dir += PLATFORM_PATH_SEPARATOR_STR; + stubs_dir += "Stubs"; + + if (set_compressor("zlib", false) != PS_OK) + { + throw runtime_error("error setting default stub"); + } + + string uninst = stubs_dir + PLATFORM_PATH_SEPARATOR_STR + "uninst"; + m_unicon_data = generate_uninstall_icon_data(uninst.c_str(), m_unicon_size); + if (!m_unicon_data) + { + throw runtime_error("invalid default uninstall icon"); + } } @@ -2301,31 +2299,16 @@ int CEXEBuild::pack_exe_header() ERROR_MSG("Error: calling packer on \"%s\"\n",build_packname); return PS_ERROR; } - tmpfile=FOPEN(build_packname,"rb"); - if (!tmpfile) - { - remove(build_packname); - ERROR_MSG("Error: reading temporary file \"%s\" after pack\n",build_packname); - return PS_ERROR; - } - // read header from file - - fseek(tmpfile,0,SEEK_END); - size_t exehead_size = ftell(tmpfile); - - unsigned char *exehead = new unsigned char[exehead_size]; - fseek(tmpfile,0,SEEK_SET); - fread(exehead,1,exehead_size,tmpfile); - fclose(tmpfile); - - update_exehead(exehead, exehead_size); - - // cleanup - // TODO: use resource-controlling classes (e.g. Boost) - delete [] exehead; + int result = update_exehead(build_packname); remove(build_packname); + if (result != PS_OK) + { + ERROR_MSG("Error: reading temporary file \"%s\" after pack\n",build_packname); + return result; + } + return PS_OK; } @@ -2579,9 +2562,9 @@ int CEXEBuild::write_output(void) INFO_MSG("\nUsing %s%s compression.\n\n", compressor->GetName(), build_compress_whole?" (compress whole)":""); #endif - int total_usize=exehead_original_size; + int total_usize=m_exehead_original_size; - INFO_MSG("EXE header size: %10d / %d bytes\n",m_exehead_size,exehead_original_size); + INFO_MSG("EXE header size: %10d / %d bytes\n",m_exehead_size,m_exehead_original_size); if (build_compress_whole) { INFO_MSG("Install code: (%d bytes)\n", @@ -2795,8 +2778,7 @@ int CEXEBuild::uninstall_generate() // Get offsets of icons to replace for uninstall // Also makes sure that the icons are there and in the right size. // TODO: fix generate_unicons_offsets to check ranges (!) - icon_offset = generate_unicons_offsets(m_exehead, m_unicon_data); - if (icon_offset == 0) + if (generate_unicons_offsets(m_exehead, m_unicon_data) == 0) return PS_ERROR; entry *ent = (entry *) build_entries.get(); @@ -2810,7 +2792,7 @@ int CEXEBuild::uninstall_generate() if (ent->which == EW_WRITEUNINSTALLER) { ent->offsets[1] = uninstdata_offset; - ent->offsets[2] = unicondata_size; + ent->offsets[2] = m_unicon_size; uns--; if (!uns) break; @@ -2818,7 +2800,7 @@ int CEXEBuild::uninstall_generate() ent++; } - if (add_db_data((char *)m_unicon_data,unicondata_size) < 0) + if (add_db_data((char *)m_unicon_data,m_unicon_size) < 0) return PS_ERROR; #ifdef NSIS_CONFIG_CRC_SUPPORT @@ -2980,7 +2962,7 @@ int CEXEBuild::uninstall_generate() udata.clear(); //uninstall_size_full=fh.length_of_all_following_data + sizeof(int) + unicondata_size - 32 + sizeof(int); - uninstall_size_full=fh.length_of_all_following_data+unicondata_size; + uninstall_size_full=fh.length_of_all_following_data+m_unicon_size; // compressed size uninstall_size=build_datablock.getlen()-uninstdata_offset; @@ -2991,7 +2973,6 @@ int CEXEBuild::uninstall_generate() return PS_OK; } - #define SWAP(x,y,i) { i _ii; _ii=x; x=y; y=_ii; } void CEXEBuild::set_uninstall_mode(int un) @@ -3379,6 +3360,46 @@ void CEXEBuild::VerifyDeclaredUserVarRefs(UserVarsStringList *pVarsStringList) } } +int CEXEBuild::set_compressor(const string& compressor, const bool solid) { + string stub = stubs_dir + PLATFORM_PATH_SEPARATOR_STR + compressor; + if (solid) + stub += "_solid"; + + return update_exehead(stub, &m_exehead_original_size); +} + +int CEXEBuild::update_exehead(const string& file, size_t *size/*=NULL*/) { + FILE *tmpfile = fopen(file.c_str(), "rb"); + if (!tmpfile) + { + ERROR_MSG("Error: opening stub \"%s\"\n", file.c_str()); + return PS_ERROR; + } + + fseek(tmpfile, 0, SEEK_END); + size_t exehead_size = ftell(tmpfile); + + unsigned char *exehead = new unsigned char[exehead_size]; + fseek(tmpfile, 0, SEEK_SET); + if (fread(exehead, 1, exehead_size, tmpfile) != exehead_size) + { + ERROR_MSG("Error: reading stub \"%s\"\n", file.c_str()); + fclose(tmpfile); + delete [] exehead; + return PS_ERROR; + } + fclose(tmpfile); + + update_exehead(exehead, exehead_size); + + if (size) + *size = exehead_size; + + delete [] exehead; + + return PS_OK; +} + void CEXEBuild::update_exehead(const unsigned char *new_exehead, size_t new_size) { assert(m_exehead != new_exehead); @@ -3394,3 +3415,4 @@ void CEXEBuild::update_exehead(const unsigned char *new_exehead, size_t new_size // zero rest of exehead memset(m_exehead + new_size, 0, m_exehead_size - new_size); } + diff --git a/Source/build.h b/Source/build.h index d0ea7fbc..2307ce57 100644 --- a/Source/build.h +++ b/Source/build.h @@ -65,7 +65,7 @@ enum notify_e { class CEXEBuild { public: CEXEBuild(); - void setdirs(const char *argv0); + void initialize(const char *makensis_path); ~CEXEBuild(); // to add a warning to the compiler's warning list. @@ -116,6 +116,8 @@ class CEXEBuild { int prepare_uninstaller(); int pack_exe_header(); + int set_compressor(const std::string& compressor, const bool solid); + int update_exehead(const std::string& file, size_t *size=NULL); void update_exehead(const unsigned char *new_exehead, size_t new_size); // tokens.cpp @@ -281,6 +283,8 @@ class CEXEBuild { // a whole bunch O data. + std::string stubs_dir; + #ifdef NSIS_CONFIG_COMPRESSION_SUPPORT ICompressor *compressor; CZlib zlib_compressor; @@ -361,11 +365,12 @@ class CEXEBuild { unsigned char *m_exehead; size_t m_exehead_size; + size_t m_exehead_original_size; - int icon_offset; bool branding_image_found; WORD branding_image_id; unsigned char *m_unicon_data; + size_t m_unicon_size; #ifdef NSIS_SUPPORT_BGBG LOGFONT bg_font; diff --git a/Source/exedata.cpp b/Source/exedata.cpp deleted file mode 100644 index d8625cc5..00000000 --- a/Source/exedata.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "exedata.h" - -//#ifndef _DEBUG -#ifdef NSIS_CONFIG_COMPONENTPAGE -#include "exehead/Release-zlib/bitmap1.h" -#endif -#include "exehead/Release-zlib/icon.h" -#include "exehead/Release-zlib/unicon.h" -#include "exehead/Release-zlib/exehead_zlib.h" -#include "exehead/Release-bzip2/exehead_bzip2.h" -#include "exehead/Release-lzma/exehead_lzma.h" -/*#else -#ifdef NSIS_CONFIG_COMPONENTPAGE -#include "exehead/Debug-zlib/bitmap1.h" -#endif -#include "exehead/Debug-zlib/icon.h" -#include "exehead/Debug-zlib/unicon.h" -#include "exehead/Debug-zlib/exehead_zlib.h" -#include "exehead/Debug-bzip2/exehead_bzip2.h" -#include "exehead/Debug-lzma/exehead_lzma.h" -#endif*/ - -size_t zlib_exehead_size=sizeof(zlib_exehead); -size_t bzip2_exehead_size=sizeof(bzip2_exehead); -size_t lzma_exehead_size=sizeof(lzma_exehead); -size_t exehead_original_size=0; - -size_t icondata_size=sizeof(icon_data)-22; -size_t unicondata_size=sizeof(unicon_data)-22; diff --git a/Source/exedata.h b/Source/exedata.h deleted file mode 100644 index a6896aa8..00000000 --- a/Source/exedata.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _EXEDATA_H_ -#define _EXEDATA_H_ - -#include - -// TODO: these should live in a singleton -extern size_t zlib_exehead_size; -extern size_t bzip2_exehead_size; -extern size_t lzma_exehead_size; -extern size_t exehead_original_size; -extern size_t icondata_size; -extern size_t unicondata_size; - -extern unsigned char zlib_exehead[]; -extern unsigned char bzip2_exehead[]; -extern unsigned char lzma_exehead[]; -extern unsigned char icon_data[]; -extern unsigned char unicon_data[]; -extern unsigned char bitmap1_data[630]; - -#endif //_EXEDATA_H_ diff --git a/Source/exehead/config.h b/Source/exehead/config.h index 714dfc61..6157faaf 100644 --- a/Source/exehead/config.h +++ b/Source/exehead/config.h @@ -58,27 +58,6 @@ #define NSIS_CONFIG_COMPRESSION_SUPPORT // compression specific options - // NSIS_ZLIB_COMPRESS_WHOLE makes all install data in zlib installers - // compressed together. Runtime requirements are increased, but potential - // for compression is as well. Requires that the installer create a - // (potentially large) temporary file in the temp directory. - // not recommended for zlib installers, since bzip2 performs much better - // than zlib in whole mode usually. - // #define NSIS_ZLIB_COMPRESS_WHOLE - - // NSIS_LZMA_COMPRESS_WHOLE makes all install data in lzma installers - // compressed together. Runtime requirements are increased, but potential - // for compression is as well. Requires that the installer create a - // (potentially large) temporary file in the temp directory. - #define NSIS_LZMA_COMPRESS_WHOLE - - // NSIS_BZIP2_COMPRESS_WHOLE makes all install data in bzip2 installers - // compressed together. Runtime requirements are increased, but potential - // for compression is as well. Requires that the installer create a - // (potentially large) temporary file in the temp directory. - // recommended for bzip2, since bzip2 really shines in this mode - #define NSIS_BZIP2_COMPRESS_WHOLE - // if NSIS_COMPRESS_BZIP2_SMALLMODE is defined, bzip2's decompressor uses // bzip2's alternative decompression method that uses less runtime // memory, at the expense of speed (and executable size). not recommended. @@ -309,24 +288,6 @@ #endif #ifdef NSIS_CONFIG_COMPRESSION_SUPPORT - #ifdef NSIS_COMPRESS_USE_ZLIB - #ifdef NSIS_ZLIB_COMPRESS_WHOLE - #define NSIS_COMPRESS_WHOLE - #endif - #endif - - #ifdef NSIS_COMPRESS_USE_BZIP2 - #ifdef NSIS_BZIP2_COMPRESS_WHOLE - #define NSIS_COMPRESS_WHOLE - #endif - #endif - - #ifdef NSIS_COMPRESS_USE_LZMA - #ifdef NSIS_LZMA_COMPRESS_WHOLE - #define NSIS_COMPRESS_WHOLE - #endif - #endif - #ifdef NSIS_COMPRESS_WHOLE #ifdef NSIS_CONFIG_VISIBLE_SUPPORT #ifndef _NSIS_CONFIG_VERIFYDIALOG diff --git a/Source/makenssi.cpp b/Source/makenssi.cpp index a3b850f6..fd713fee 100644 --- a/Source/makenssi.cpp +++ b/Source/makenssi.cpp @@ -45,7 +45,6 @@ const char *NSIS_VERSION="v2.06"; #include "build.h" #include "util.h" -#include "exedata.h" using namespace std; @@ -96,7 +95,16 @@ int main(int argc, char **argv) int in_files=0; #endif - build.setdirs(argv[0]); + try + { + build.initialize(argv[0]); + } + catch (exception& err) + { + fprintf(g_output, "Error initalizing CEXEBuild: %s\n", err.what()); + fflush(g_output); + return 1; + } if (argc > 1 && !stricmp(argv[1], OPT_STR "VERSION")) { @@ -243,9 +251,6 @@ int main(int argc, char **argv) { if (build.display_info) { - fprintf(g_output,"Size of zlib EXE header is %d bytes.\n",zlib_exehead_size); - fprintf(g_output,"Size of bzip2 EXE header is %d bytes.\n",bzip2_exehead_size); - fprintf(g_output,"Size of lzma EXE header is %d bytes.\n",lzma_exehead_size); fprintf(g_output,"Size of first header is %d bytes.\n",sizeof(firstheader)); fprintf(g_output,"Size of main header is %d bytes.\n",sizeof(header)); fprintf(g_output,"Size of each section is %d bytes.\n",sizeof(section)); diff --git a/Source/script.cpp b/Source/script.cpp index dc877615..394836e7 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -4,7 +4,6 @@ #include "tokens.h" #include "build.h" #include "util.h" -#include "exedata.h" #include "ResourceEditor.h" #include "DialogTemplate.h" #include "lang.h" @@ -12,6 +11,8 @@ #include "exehead/resource.h" #include // for assert(3) #include +#include +#include using namespace std; @@ -1421,7 +1422,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SCRIPT_MSG("Icon: \"%s\"\n",line.gettoken_str(1)); try { init_res_editor(); - if (replace_icon(res_editor, IDI_ICON2, line.gettoken_str(1))) { + if (replace_icon(res_editor, IDI_ICON2, line.gettoken_str(1)) < 0) { ERROR_MSG("Error: File doesn't exist or is an invalid icon file\n"); return PS_ERROR; } @@ -2445,60 +2446,65 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) ERROR_MSG("Error: can't change compressor after data already got compressed or header already changed!\n"); return PS_ERROR; } - if (!build_compressor_final) + + if (build_compressor_final) + { + warning_fl("SetCompressor ignored due to previous call with the /FINAL switch"); + return PS_OK; + } + + int a = 1; + + build_compress_whole = false; + + while (line.gettoken_str(a)[0] == '/') { - int a = 1; if (!strcmpi(line.gettoken_str(1),"/FINAL")) { build_compressor_final = true; a++; } - else if (line.getnumtokens() == 3) + else if (!strcmpi(line.gettoken_str(1),"/SOLID")) { - ERROR_MSG("%s expects 2 parameters, got 3.\n",line.gettoken_str(0)); - PRINTHELP(); + build_compress_whole = true; + a++; } - int k=line.gettoken_enum(a,"zlib\0bzip2\0lzma\0"); - switch (k) { - case 0: // JF> should handle the state of going from bzip2 back to zlib: - compressor = &zlib_compressor; - update_exehead(zlib_exehead, zlib_exehead_size); -#ifdef NSIS_ZLIB_COMPRESS_WHOLE - build_compress_whole=true; -#else - build_compress_whole=false; -#endif - break; - - case 1: - compressor=&bzip2_compressor; - update_exehead(bzip2_exehead, bzip2_exehead_size); -#ifdef NSIS_BZIP2_COMPRESS_WHOLE - build_compress_whole=true; -#else - build_compress_whole=false; -#endif - break; - - case 2: - compressor = &lzma_compressor; - update_exehead(lzma_exehead, lzma_exehead_size); -#ifdef NSIS_LZMA_COMPRESS_WHOLE - build_compress_whole=true; -#else - build_compress_whole=false; -#endif - break; - - default: - PRINTHELP(); - } - SCRIPT_MSG("SetCompressor: %s%s\n", build_compressor_final? "/FINAL " : "", line.gettoken_str(a)); } - else + + if (a != line.getnumtokens() - 1) { - warning_fl("SetCompressor ignored due to previous call with the /FINAL switch"); + ERROR_MSG("%s expects %d parameters, got %d.\n", line.gettoken_str(0), a + 1, line.getnumtokens()); + PRINTHELP(); } + + int k=line.gettoken_enum(a, "zlib\0bzip2\0lzma\0"); + switch (k) { + case 0: + compressor = &zlib_compressor; + break; + + case 1: + compressor = &bzip2_compressor; + break; + + case 2: + compressor = &lzma_compressor; + break; + + default: + PRINTHELP(); + } + + string compressor_name = line.gettoken_str(a); + transform(compressor_name.begin(), compressor_name.end(), compressor_name.begin(), tolower); + + if (set_compressor(compressor_name, build_compress_whole) != PS_OK) + { + SCRIPT_MSG("SetCompressor: error loading stub for \"%s\" compressor.\n", compressor_name.c_str()); + return PS_ERROR; + } + + SCRIPT_MSG("SetCompressor: %s%s%s\n", build_compressor_final ? "/FINAL " : "", build_compress_whole ? "/SOLID " : "", line.gettoken_str(a)); } return PS_OK; #else//NSIS_CONFIG_COMPRESSION_SUPPORT @@ -2837,7 +2843,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line) SCRIPT_MSG("UninstallIcon: \"%s\"\n",line.gettoken_str(1)); try { free(m_unicon_data); - m_unicon_data = generate_uninstall_icon_data(line.gettoken_str(1)); + m_unicon_data = generate_uninstall_icon_data(line.gettoken_str(1), m_unicon_size); if (!m_unicon_data) { ERROR_MSG("Error: File doesn't exist or is an invalid icon file\n"); return PS_ERROR; diff --git a/Source/tokens.cpp b/Source/tokens.cpp index 33776531..5ad2d666 100644 --- a/Source/tokens.cpp +++ b/Source/tokens.cpp @@ -172,7 +172,7 @@ static tokenType tokenlist[TOK__LAST] = {TOK_SETCTLCOLORS,"SetCtlColors",2,2,"hwnd [/BRANDING] [text_color] [transparent|bg_color]",TP_CODE}, {TOK_SETBRANDINGIMAGE,"SetBrandingImage",1,2,"[/IMGID=image_item_id_in_dialog] [/RESIZETOFIT] bitmap.bmp",TP_CODE}, {TOK_SETCOMPRESS,"SetCompress",1,0,"(off|auto|force)",TP_ALL}, -{TOK_SETCOMPRESSOR,"SetCompressor",1,1,"[/FINAL] (zlib|bzip2|lzma)",TP_GLOBAL}, +{TOK_SETCOMPRESSOR,"SetCompressor",1,2,"[/FINAL] [/SOLID] (zlib|bzip2|lzma)",TP_GLOBAL}, {TOK_SETCOMPRESSORDICTSIZE,"SetCompressorDictSize",1,0,"dict_size_mb",TP_ALL}, {TOK_SETCOMPRESSIONLEVEL,"SetCompressionLevel",1,0,"level_0-9",TP_ALL}, {TOK_SETDATESAVE,"SetDateSave",1,0,"(off|on)",TP_ALL}, diff --git a/Source/util.cpp b/Source/util.cpp index d09af363..90f859de 100644 --- a/Source/util.cpp +++ b/Source/util.cpp @@ -3,7 +3,6 @@ #include #include #include -#include "exedata.h" #include "exehead/fileform.h" #include "util.h" #include "strlist.h" @@ -39,7 +38,7 @@ void dopause(void) // Returns -2 if the file is an invalid bitmap // Returns -3 if the size doesn't match // Returns -4 if the bpp doesn't match -int update_bitmap(CResourceEditor* re, WORD id, char* filename, int width/*=0*/, int height/*=0*/, int maxbpp/*=0*/) { +int update_bitmap(CResourceEditor* re, WORD id, const char* filename, int width/*=0*/, int height/*=0*/, int maxbpp/*=0*/) { FILE *f = FOPEN(filename, "rb"); if (!f) return -1; @@ -138,7 +137,7 @@ typedef struct { // return values: // 0 - All OK // -1 - Bad icon file -int replace_icon(CResourceEditor* re, WORD wIconId, char* filename) +int replace_icon(CResourceEditor* re, WORD wIconId, const char* filename) { FILE* f = FOPEN(filename, "rb"); if (!f) return -1; @@ -201,8 +200,6 @@ int replace_icon(CResourceEditor* re, WORD wIconId, char* filename) free(rsrcIconGroup); - icondata_size = iNewIconSize; - return 0; } @@ -212,7 +209,7 @@ int replace_icon(CResourceEditor* re, WORD wIconId, char* filename) // return values: // 0 - Bad icon file // Anything else - Pointer to the uninstaller icon data -unsigned char* generate_uninstall_icon_data(char* filename) +unsigned char* generate_uninstall_icon_data(const char* filename, size_t &size) { int i; @@ -263,7 +260,7 @@ unsigned char* generate_uninstall_icon_data(char* filename) free(offsets); free(rawSizes); - unicondata_size = iNewIconSize; + size = iNewIconSize; return pbUninstIcon; } @@ -281,7 +278,7 @@ int find_in_dir(PRESOURCE_DIRECTORY rd, WORD id) { } // Fill the array of icons for uninstall with their offsets -// Returns 0 if failed, anything else is icon_offset. +// Returns 0 if failed, anything else is the icon offset in the PE. int generate_unicons_offsets(unsigned char* exeHeader, unsigned char* uninstIconData) { int i; diff --git a/Source/util.h b/Source/util.h index 61aa005f..e10188bb 100644 --- a/Source/util.h +++ b/Source/util.h @@ -18,14 +18,14 @@ extern void dopause(void); // Adds the bitmap in filename using resource editor re as id id. // If width or height are specified it will also make sure the bitmap is in that size -int update_bitmap(CResourceEditor* re, WORD id, char* filename, int width=0, int height=0, int maxbpp=0); +int update_bitmap(CResourceEditor* re, WORD id, const char* filename, int width=0, int height=0, int maxbpp=0); -// reads icon file filename and places its icons in the resource wIconId using resource editor re. Also updates icondata_size. -int replace_icon(CResourceEditor* re, WORD wIconId, char* filename); +// reads icon file filename and places its icons in the resource wIconId using resource editor re +int replace_icon(CResourceEditor* re, WORD wIconId, const char* filename); #ifdef NSIS_CONFIG_UNINSTALL_SUPPORT // returns the data of the uninstaller icon (inside filename) that should replace the installer icon data -unsigned char* generate_uninstall_icon_data(char* filename); +unsigned char* generate_uninstall_icon_data(const char* filename, size_t &size); // Fill the array of icons for uninstall with their offsets int generate_unicons_offsets(unsigned char* exeHeader, unsigned char* uninstIconData); #endif//NSIS_CONFIG_UNINSTALL_SUPPORT